1
0
Fork 0
forked from nuttx/nuttx-update

nxstyle fixes

nxstyle fixes to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2021-03-13 11:55:37 +01:00 committed by Xiang Xiao
parent 5e6d58dd03
commit d66d881b87
14 changed files with 88 additions and 50 deletions

View file

@ -20,7 +20,8 @@
/* This file provides a driver for a Nintendo Wii Nunchuck joystick device.
* The nunchuck joystick provides X/Y positional data as integer values.
* The analog positional data may also be accompanied by discrete button data.
* The analog positional data may also be accompanied by discrete button
* data.
*
* The nunchuck joystick driver exports a standard character driver
* interface. By convention, the nunchuck joystick is registered as an input
@ -98,7 +99,9 @@ static ssize_t nunchuck_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
static int nunchuck_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
/* I2C Helpers */
static int nunchuck_i2c_read(FAR struct nunchuck_dev_s *priv,
FAR uint8_t *regval, int len);
static int nunchuck_i2c_write(FAR struct nunchuck_dev_s *priv,
@ -200,7 +203,7 @@ static int nunchuck_sample(FAR struct nunchuck_dev_s *priv,
/* Delay 20ms */
nxsig_usleep(20*1000);
nxsig_usleep(20 * 1000);
initialized = true;
}
@ -259,10 +262,11 @@ static int nunchuck_sample(FAR struct nunchuck_dev_s *priv,
buffer->acc_x = (uint16_t) data[2];
buffer->acc_y = (uint16_t) data[3];
buffer->acc_z = (uint16_t) data[4];
buffer->nck_buttons = (uint8_t) ((data[5]+1) & 0x03);
buffer->nck_buttons = (uint8_t) ((data[5] + 1) & 0x03);
iinfo("X: %03d | Y: %03d | AX: %03d AY: %03d AZ: %03d | B: %d\n",
data[0], data[1], data[2], data[3], data[4], ((data[5]+1) & 0x03));
data[0], data[1], data[2], data[3],
data[4], ((data[5] + 1) & 0x03));
return OK;
}
@ -303,7 +307,8 @@ static int nunchuck_open(FAR struct file *filep)
/* Allocate a new open structure */
opriv = (FAR struct nunchuck_open_s *)kmm_zalloc(sizeof(struct nunchuck_open_s));
opriv = (FAR struct nunchuck_open_s *)
kmm_zalloc(sizeof(struct nunchuck_open_s));
if (!opriv)
{
ierr("ERROR: Failed to allocate open structure\n");
@ -493,11 +498,12 @@ static int nunchuck_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
switch (cmd)
{
/* Command: NUNCHUCKIOC_SUPPORTED
* Description: Report the set of button events supported by the hardware;
* Argument: A pointer to writeable integer value in which to return the
* set of supported buttons.
* Return: Zero (OK) on success. Minus one will be returned on failure
* with the errno value set appropriately.
* Description: Report the set of button events supported by the
* hardware;
* Argument: A pointer to writeable integer value in which to
* return the set of supported buttons.
* Return: Zero (OK) on success. Minus one will be returned
* on failure with the errno value set appropriately.
*/
case NUNCHUCKIOC_SUPPORTED:

View file

@ -87,7 +87,8 @@ int ssd1306_sendbyte(FAR struct ssd1306_dev_s *priv, uint8_t regval)
*
****************************************************************************/
int ssd1306_sendblk(FAR struct ssd1306_dev_s *priv, uint8_t *data, uint8_t len)
int ssd1306_sendblk(FAR struct ssd1306_dev_s *priv,
uint8_t *data, uint8_t len)
{
/* Send byte value to display */

View file

@ -183,7 +183,8 @@ static int max7219_close(FAR struct file *filep)
* Name: max7219_read
****************************************************************************/
static ssize_t max7219_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
static ssize_t max7219_read(FAR struct file *filep,
FAR char *buffer, size_t buflen)
{
return -ENOSYS;
}
@ -339,7 +340,8 @@ int max7219_leds_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
/* Initialize the MAX7219 device structure */
priv = (FAR struct max7219_dev_s *)kmm_malloc(sizeof(struct max7219_dev_s));
priv = (FAR struct max7219_dev_s *)
kmm_malloc(sizeof(struct max7219_dev_s));
if (!priv)
{
lederr("ERROR: Failed to allocate instance\n");

View file

@ -275,7 +275,6 @@ static unsigned short rgbled_lightness(unsigned char color_level)
static ssize_t rgbled_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
{
FAR struct inode *inode = filep->f_inode;
FAR struct rgbled_upperhalf_s *upper = inode->i_private;
FAR struct pwm_lowerhalf_s *ledr = upper->devledr;

View file

@ -35,7 +35,7 @@
#define BQ2425X_CURR_MIN 500
#define BQ2425X_CURR_MAX 2000
/* BQ2425x Register Definitions ********************************************/
/* BQ2425x Register Definitions *********************************************/
#define BQ2425X_REG_1 0x00
#define BQ2425X_REG_2 0x01
@ -82,6 +82,7 @@
# define BQ2425X_INP_CURR_LIM_2000MA (5 << BQ2425X_INP_CURR_LIM_SHIFT) /* Charger with 2000mA current limit */
# define BQ2425X_INP_CURR_EXT_ILIM (6 << BQ2425X_INP_CURR_LIM_SHIFT) /* External ILIM current limit */
# define BQ2425X_INP_CURR_NO_LIMIT (7 << BQ2425X_INP_CURR_LIM_SHIFT) /* No input current limit with internal clamp at 3A */
#define BQ2425X_EN_STAT (1 << 3) /* Enable/Disable STAT pin */
#define BQ2425X_EN_TERM (1 << 2) /* Enable/Disable charge termination */
#define BQ2425X_CE (1 << 1) /* Enable/Disable the Charger, inverted logic, 0 enables */
@ -218,12 +219,14 @@
/* REG 6 */
#define BQ2425X_2XTMR_EN (1 << 7) /* Timer slowed 2x when in thermal reg., Vin_dpm or DPPM */
#define BQ2425X_TIMER_SHIFT 6 /* Safety timer time limit */
#define BQ2425X_TIMER_MASK (3 << BQ2425X_TIMER_SHIFT)
# define BQ2425X_TIMER_0p74H (0 << BQ2425X_TIMER_SHIFT) /* 0.75 hour fast charge */
# define BQ2425X_TIMER_6H (1 << BQ2425X_TIMER_SHIFT) /* 6 hour fast charge (default 01) */
# define BQ2425X_TIMER_9H (2 << BQ2425X_TIMER_SHIFT) /* 9 hour fast charge */
# define BQ2425X_TIMER_DISABLED (3 << BQ2425X_TIMER_SHIFT) /* Disable safety timers */
#define BQ2425X_SYSOFF (1 << 4) /* 0 = SYSOFF disabled ; 1 = SYSOFF enabled */
#define BQ2425X_TS_EN (1 << 3) /* 0 = TS function disabled ; 1 = TS function enabled */
#define BQ2425X_TS_STATUS_SHIFT 0 /* TS Fault Mode */
@ -249,10 +252,13 @@
# define BQ2425X_VOLT_OVP_9p5V (5 << BQ2425X_VOLT_OVP_SHIFT) /* 9.5V */
# define BQ2425X_VOLT_OVP_10p0V (6 << BQ2425X_VOLT_OVP_SHIFT) /* 10.0V */
# define BQ2425X_VOLT_OVP_10p5V (7 << BQ2425X_VOLT_OVP_SHIFT) /* 10.5V */
#define BQ2425X_CLR_VDP (1 << 4) /* 0 = Keep D+ voltage ; 1 = Turn off D+ voltage */
#define BQ2425X_FORCE_BAT_DET (1 << 3) /* Enter the battery detection routine */
#define BQ2425X_FORCE_PTM (1 << 2) /* PTM mode enable */
/* bit 1: reserved */
/* bit 0: reserved */
#endif /* __DRIVERS_POWER_BQ2425X_H */

View file

@ -103,7 +103,8 @@ static int adxl345_close(FAR struct file *filep)
*
****************************************************************************/
static ssize_t adxl345_read(FAR struct file *filep, FAR char *buffer, size_t len)
static ssize_t adxl345_read(FAR struct file *filep,
FAR char *buffer, size_t len)
{
FAR struct inode *inode;
FAR struct adxl345_dev_s *priv;
@ -141,11 +142,14 @@ static ssize_t adxl345_read(FAR struct file *filep, FAR char *buffer, size_t len
/* Read accelerometer X Y Z axes */
sample.data_x = adxl345_getreg8(priv, ADXL345_DATAX1);
sample.data_x = (sample.data_x << 8) | adxl345_getreg8(priv, ADXL345_DATAX0);
sample.data_x = (sample.data_x << 8) |
adxl345_getreg8(priv, ADXL345_DATAX0);
sample.data_y = adxl345_getreg8(priv, ADXL345_DATAY1);
sample.data_y = (sample.data_y << 8) | adxl345_getreg8(priv, ADXL345_DATAY0);
sample.data_y = (sample.data_y << 8) |
adxl345_getreg8(priv, ADXL345_DATAY0);
sample.data_z = adxl345_getreg8(priv, ADXL345_DATAZ1);
sample.data_z = (sample.data_z << 8) | adxl345_getreg8(priv, ADXL345_DATAZ0);
sample.data_z = (sample.data_z << 8) |
adxl345_getreg8(priv, ADXL345_DATAZ0);
add_sensor_randomness(sample.data_x);
add_sensor_randomness((sample.data_z << 16) | sample.data_y);
@ -162,8 +166,8 @@ static ssize_t adxl345_read(FAR struct file *filep, FAR char *buffer, size_t len
* Name: adxl345_register
*
* Description:
* This function will register the accelerometer driver as /dev/accelN where N
* is the minor device number
* This function will register the accelerometer driver as /dev/accelN where
* N is the minor device number
*
* Input Parameters:
* handle - The handle previously returned by adxl345_register
@ -266,7 +270,8 @@ static void adxl345_worker(FAR void *arg)
*
****************************************************************************/
static void adxl345_interrupt(FAR struct adxl345_config_s *config, FAR void *arg)
static void adxl345_interrupt(FAR struct adxl345_config_s *config,
FAR void *arg)
{
FAR struct adxl345_dev_s *priv = (FAR struct adxl345_dev_s *)arg;
int ret;
@ -381,7 +386,8 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
/* Allocate the ADXL345 driver instance */
priv = (FAR struct adxl345_dev_s *)kmm_zalloc(sizeof(struct adxl345_dev_s));
priv = (FAR struct adxl345_dev_s *)
kmm_zalloc(sizeof(struct adxl345_dev_s));
if (!priv)
{
snerr("ERROR: Failed to allocate the device structure!\n");
@ -414,7 +420,9 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
adxl345_reset(priv);
/* Configure the interrupt output pin to generate interrupts on high or low level. */
/* Configure the interrupt output pin to generate interrupts on high or low
* level.
*/
regval = adxl345_getreg8(priv, ADXL345_DATA_FORMAT);
#ifdef CONFIG_ADXL345_ACTIVELOW
@ -426,7 +434,9 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
/* Attach the ADXL345 interrupt handler. */
config->attach(config, (adxl345_handler_t)adxl345_interrupt, (FAR void *)priv);
config->attach(config,
(adxl345_handler_t)adxl345_interrupt,
(FAR void *)priv);
/* Leave standby mode */

View file

@ -109,7 +109,7 @@ void adxl345_putreg8(FAR struct adxl345_dev_s *priv,
{
/* 8-bit data read sequence:
*
* Start - I2C_Write_Address - ADXL345_Reg_Address - ADXL345_Write_Data - STOP
* Start-I2C_Write_Address-ADXL345_Reg_Address-ADXL345_Write_Data-STOP
*/
struct i2c_msg_s msg;

View file

@ -267,7 +267,8 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM);
if (ret < 0)
{
snerr("ERROR: Cannot change to Continuously H-Resolution Mode!\n");
snerr("ERROR:");
snerr(" Cannot change to Continuously H-Resolution Mode!\n");
}
}
break;
@ -279,7 +280,8 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM2);
if (ret < 0)
{
snerr("ERROR: Cannot change to Continuously H-Resolution Mode2!\n");
snerr("ERROR:");
snerr(" Cannot change to Continuously H-Resolution Mode2!\n");
}
}
break;
@ -291,7 +293,8 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_LRM);
if (ret < 0)
{
snerr("ERROR: Cannot change to Continuously L-Resolution Mode!\n");
snerr("ERROR:");
snerr(" Cannot change to Continuously L-Resolution Mode!\n");
}
}
break;
@ -315,7 +318,8 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
ret = bh1750fvi_write8(priv, BH1750FVI_ONETIME_HRM2);
if (ret < 0)
{
snerr("ERROR: Cannot change to One Time H-Resolution Mode2!\n");
snerr("ERROR:");
snerr(" Cannot change to One Time H-Resolution Mode2!\n");
}
}
break;
@ -379,7 +383,8 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/light0"
* i2c - An instance of the I2C interface to use to communicate with BH1750FVI
* i2c - An instance of the I2C interface to use to communicate with
* BH1750FVI
* addr - The I2C address of the BH1750FVI.
*
* Returned Value:

View file

@ -157,7 +157,8 @@ static int max6675_close(FAR struct file *filep)
* Name: max6675_read
****************************************************************************/
static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
static ssize_t max6675_read(FAR struct file *filep,
FAR char *buffer, size_t buflen)
{
FAR struct inode *inode = filep->f_inode;
FAR struct max6675_dev_s *priv = inode->i_private;
@ -176,7 +177,8 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
if (buflen != 2)
{
snerr("ERROR: You can't read something other than 16 bits (2 bytes)\n");
snerr("ERROR:");
snerr(" You can't read something other than 16 bits (2 bytes)\n");
return -EINVAL;
}
@ -271,7 +273,8 @@ int max6675_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
/* Initialize the MAX6675 device structure */
priv = (FAR struct max6675_dev_s *)kmm_malloc(sizeof(struct max6675_dev_s));
priv = (FAR struct max6675_dev_s *)
kmm_malloc(sizeof(struct max6675_dev_s));
if (priv == NULL)
{
snerr("ERROR: Failed to allocate instance\n");

View file

@ -119,7 +119,8 @@ static inline void mpl115a_configspi(FAR struct spi_dev_s *spi)
*
****************************************************************************/
static uint8_t mpl115a_getreg8(FAR struct mpl115a_dev_s *priv, uint8_t regaddr)
static uint8_t mpl115a_getreg8(FAR struct mpl115a_dev_s *priv,
uint8_t regaddr)
{
uint8_t regval;
@ -325,7 +326,8 @@ static int mpl115a_close(FAR struct file *filep)
* Name: mpl115a_read
****************************************************************************/
static ssize_t mpl115a_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
static ssize_t mpl115a_read(FAR struct file *filep,
FAR char *buffer, size_t buflen)
{
FAR struct inode *inode = filep->f_inode;
FAR struct mpl115a_dev_s *priv = inode->i_private;
@ -339,7 +341,8 @@ static ssize_t mpl115a_read(FAR struct file *filep, FAR char *buffer, size_t buf
if (buflen != 2)
{
snerr("ERROR: You can't read something other than 16 bits (2 bytes)\n");
snerr("ERROR:");
snerr(" You can't read something other than 16 bits (2 bytes)\n");
return -1;
}
@ -392,7 +395,8 @@ int mpl115a_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
/* Initialize the MPL115A device structure */
priv = (FAR struct mpl115a_dev_s *)kmm_malloc(sizeof(struct mpl115a_dev_s));
priv = (FAR struct mpl115a_dev_s *)
kmm_malloc(sizeof(struct mpl115a_dev_s));
if (!priv)
{
snerr("ERROR: Failed to allocate instance\n");

View file

@ -287,7 +287,8 @@ static ssize_t veml6070_write(FAR struct file *filep,
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/uvlight0"
* i2c - An instance of the I2C interface to use to communicate with VEML6070
* i2c - An instance of the I2C interface to use to communicate with
* VEML6070
* addr - The I2C address of the VEML6070.
*
* Returned Value:

View file

@ -82,7 +82,6 @@ static const uint8_t crc8_tab[256] =
uint8_t crc8ccittpart(FAR const uint8_t *src, size_t len, uint8_t crc8val)
{
uint8_t *pos = (uint8_t *) src;
uint8_t *end = pos + len;
@ -106,5 +105,5 @@ uint8_t crc8ccittpart(FAR const uint8_t *src, size_t len, uint8_t crc8val)
uint8_t crc8ccitt(FAR const uint8_t *src, size_t len)
{
return crc8ccittpart(src, len, 0);
return crc8ccittpart(src, len, 0);
}

View file

@ -54,10 +54,10 @@
* _IONBF - Will cause input/output to be unbuffered.
*
* If buf is not a null pointer, the array it points to may be used instead
* of a buffer allocated by setvbuf() and the argument size specifies the size
* of the array; otherwise, size may determine the size of a buffer allocated
* by the setvbuf() function. The contents of the array at any time are
* unspecified.
* of a buffer allocated by setvbuf() and the argument size specifies the
* size of the array; otherwise, size may determine the size of a buffer
* allocated by the setvbuf() function. The contents of the array at any
* time are unspecified.
*
* Input Parameters:
* stream - the stream to flush
@ -81,6 +81,7 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size)
int errcode;
/* Verify arguments */
/* Make sure that a valid mode was provided */
if (mode != _IOFBF && mode != _IOLBF && mode != _IONBF)
@ -169,6 +170,7 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size)
/* Fall through */
case _IOFBF:
/* Use the existing buffer if size == 0 */
if (size > 0)
@ -181,8 +183,8 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size)
{
newbuf = (FAR unsigned char *)buffer;
/* Indicate that we have an I/O buffer managed by the caller of
* setvbuf.
/* Indicate that we have an I/O buffer managed by the caller
* of setvbuf.
*/
flags |= __FS_FLAG_UBF;
@ -212,6 +214,7 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size)
break;
case _IONBF:
/* No buffer needed... We must be performing unbuffered I/O */
newbuf = NULL;
@ -225,8 +228,8 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size)
* on a previous call to setvbuf().
*/
if (stream->fs_bufstart != NULL &&
(stream->fs_flags & __FS_FLAG_UBF) == 0)
if (stream->fs_bufstart != NULL &&
(stream->fs_flags & __FS_FLAG_UBF) == 0)
{
lib_free(stream->fs_bufstart);
}

View file

@ -18,7 +18,6 @@
*
****************************************************************************/
/* Source:
* https://github.com/raggi/apue.2e/blob/master/termios/isatty.c
* based on Advanced Programming in the UNIX Environment