drivers/power: Run tools/nxstyle against all .c and .h files in this directory.

This commit is contained in:
Gregory Nutt 2019-10-28 18:28:41 -06:00
parent 41d9365f06
commit 2852b3a8c8
9 changed files with 92 additions and 56 deletions

View File

@ -112,6 +112,7 @@ struct bq2425x_dev_s
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
/* I2C support */ /* I2C support */
static int bq2425x_getreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr, static int bq2425x_getreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr,
@ -122,20 +123,31 @@ static int bq2425x_putreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr,
static inline int bq2425x_getreport(FAR struct bq2425x_dev_s *priv, static inline int bq2425x_getreport(FAR struct bq2425x_dev_s *priv,
uint8_t *report); uint8_t *report);
static inline int bq2425x_reset(FAR struct bq2425x_dev_s *priv); static inline int bq2425x_reset(FAR struct bq2425x_dev_s *priv);
static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv, bool enable); static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv,
static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv, int current); bool enable);
static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv, int volts); static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv,
static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current); int current);
static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv,
int volts);
static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv,
int current);
/* Battery driver lower half methods */ /* Battery driver lower half methods */
static int bq2425x_state(struct battery_charger_dev_s *dev, int *status); static int bq2425x_state(FAR struct battery_charger_dev_s *dev,
static int bq2425x_health(struct battery_charger_dev_s *dev, int *health); FAR int *status);
static int bq2425x_online(struct battery_charger_dev_s *dev, bool *status); static int bq2425x_health(FAR struct battery_charger_dev_s *dev,
static int bq2425x_voltage(struct battery_charger_dev_s *dev, int value); FAR int *health);
static int bq2425x_current(struct battery_charger_dev_s *dev, int value); static int bq2425x_online(FAR struct battery_charger_dev_s *dev,
static int bq2425x_input_current(struct battery_charger_dev_s *dev, int value); FAR bool *status);
static int bq2425x_operate(struct battery_charger_dev_s *dev, uintptr_t param); static int bq2425x_voltage(FAR struct battery_charger_dev_s *dev,
int value);
static int bq2425x_current(FAR struct battery_charger_dev_s *dev,
int value);
static int bq2425x_input_current(FAR struct battery_charger_dev_s *dev,
int value);
static int bq2425x_operate(FAR struct battery_charger_dev_s *dev,
uintptr_t param);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -247,7 +259,7 @@ static int bq2425x_putreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr,
****************************************************************************/ ****************************************************************************/
static inline int bq2425x_getreport(FAR struct bq2425x_dev_s *priv, static inline int bq2425x_getreport(FAR struct bq2425x_dev_s *priv,
uint8_t *report) FAR uint8_t *report)
{ {
uint8_t regval = 0; uint8_t regval = 0;
int ret; int ret;
@ -318,7 +330,8 @@ static inline int bq2425x_reset(FAR struct bq2425x_dev_s *priv)
* *
****************************************************************************/ ****************************************************************************/
static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv, bool enable) static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv,
bool enable)
{ {
int ret; int ret;
uint8_t regval; uint8_t regval;
@ -357,7 +370,8 @@ static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv, bool enable)
* *
****************************************************************************/ ****************************************************************************/
static int bq2425x_state(struct battery_charger_dev_s *dev, int *status) static int bq2425x_state(FAR struct battery_charger_dev_s *dev,
FAR int *status)
{ {
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev; FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
uint8_t regval = 0; uint8_t regval = 0;
@ -414,7 +428,8 @@ static int bq2425x_state(struct battery_charger_dev_s *dev, int *status)
* *
****************************************************************************/ ****************************************************************************/
static int bq2425x_health(struct battery_charger_dev_s *dev, int *health) static int bq2425x_health(FAR struct battery_charger_dev_s *dev,
FAR int *health)
{ {
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev; FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
uint8_t regval = 0; uint8_t regval = 0;
@ -476,7 +491,8 @@ static int bq2425x_health(struct battery_charger_dev_s *dev, int *health)
* *
****************************************************************************/ ****************************************************************************/
static int bq2425x_online(struct battery_charger_dev_s *dev, bool *status) static int bq2425x_online(FAR struct battery_charger_dev_s *dev,
FAR bool *status)
{ {
/* There is no concept of online/offline in this driver */ /* There is no concept of online/offline in this driver */
@ -492,10 +508,12 @@ static int bq2425x_online(struct battery_charger_dev_s *dev, bool *status)
* *
****************************************************************************/ ****************************************************************************/
static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv, int current) static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv,
int current)
{ {
uint8_t regval; uint8_t regval;
int ret, idx; int idx;
int ret;
switch (current) switch (current)
{ {
@ -572,7 +590,8 @@ static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv, int curren
static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv, int volts) static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv, int volts)
{ {
uint8_t regval; uint8_t regval;
int ret, idx; int idx;
int ret;
/* Verify if voltage is in the acceptable range */ /* Verify if voltage is in the acceptable range */
@ -620,7 +639,8 @@ static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv, int volts)
static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current) static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current)
{ {
uint8_t regval; uint8_t regval;
int ret, idx; int idx;
int ret;
/* Verify if voltage is in the acceptable range */ /* Verify if voltage is in the acceptable range */
@ -657,7 +677,6 @@ static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current)
return OK; return OK;
} }
/**************************************************************************** /****************************************************************************
* Name: bq2425x_voltage * Name: bq2425x_voltage
* *
@ -666,7 +685,7 @@ static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current)
* *
****************************************************************************/ ****************************************************************************/
static int bq2425x_voltage(struct battery_charger_dev_s *dev, int value) static int bq2425x_voltage(FAR struct battery_charger_dev_s *dev, int value)
{ {
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev; FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
int ret; int ret;
@ -691,7 +710,7 @@ static int bq2425x_voltage(struct battery_charger_dev_s *dev, int value)
* *
****************************************************************************/ ****************************************************************************/
static int bq2425x_current(struct battery_charger_dev_s *dev, int value) static int bq2425x_current(FAR struct battery_charger_dev_s *dev, int value)
{ {
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev; FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
int ret; int ret;
@ -716,7 +735,8 @@ static int bq2425x_current(struct battery_charger_dev_s *dev, int value)
* *
****************************************************************************/ ****************************************************************************/
static int bq2425x_input_current(struct battery_charger_dev_s *dev, int value) static int bq2425x_input_current(FAR struct battery_charger_dev_s *dev,
int value)
{ {
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev; FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
int ret; int ret;
@ -739,7 +759,8 @@ static int bq2425x_input_current(struct battery_charger_dev_s *dev, int value)
* *
****************************************************************************/ ****************************************************************************/
static int bq2425x_operate(struct battery_charger_dev_s *dev, uintptr_t param) static int bq2425x_operate(FAR struct battery_charger_dev_s *dev,
uintptr_t param)
{ {
return -ENOSYS; return -ENOSYS;
} }

View File

@ -135,6 +135,7 @@ struct bq2429x_dev_s
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
/* I2C support */ /* I2C support */
static int bq2429x_getreg8(FAR struct bq2429x_dev_s *priv, uint8_t regaddr, static int bq2429x_getreg8(FAR struct bq2429x_dev_s *priv, uint8_t regaddr,
@ -840,7 +841,8 @@ static int bq2429x_online(FAR struct battery_charger_dev_s *dev,
static int bq2429x_powersupply(FAR struct bq2429x_dev_s *priv, int current) static int bq2429x_powersupply(FAR struct bq2429x_dev_s *priv, int current)
{ {
uint8_t regval, idx; uint8_t regval;
uint8_t idx;
int ret; int ret;
switch (current) switch (current)
@ -918,7 +920,8 @@ static int bq2429x_powersupply(FAR struct bq2429x_dev_s *priv, int current)
static inline int bq2429x_setvolt(FAR struct bq2429x_dev_s *priv, int req_volts) static inline int bq2429x_setvolt(FAR struct bq2429x_dev_s *priv, int req_volts)
{ {
uint8_t regval; uint8_t regval;
int ret, idx; int idx;
int ret;
/* Verify if voltage is in the acceptable range */ /* Verify if voltage is in the acceptable range */
@ -967,8 +970,9 @@ static inline int bq2429x_setcurr(FAR struct bq2429x_dev_s *priv,
int req_current) int req_current)
{ {
uint8_t regval; uint8_t regval;
int ret, idx;
bool force_20pct = false; bool force_20pct = false;
int idx;
int ret;
/* If requested current is below the minimum for fast charge, /* If requested current is below the minimum for fast charge,
* configure for trickle charging. Trickle charging uses 20% * configure for trickle charging. Trickle charging uses 20%
@ -1164,8 +1168,9 @@ static int bq2429x_operate(FAR struct battery_charger_dev_s *dev,
uintptr_t param) uintptr_t param)
{ {
FAR struct bq2429x_dev_s *priv = (FAR struct bq2429x_dev_s *)dev; FAR struct bq2429x_dev_s *priv = (FAR struct bq2429x_dev_s *)dev;
struct batio_operate_msg_s *msg = (struct batio_operate_msg_s *)param; FAR struct batio_operate_msg_s *msg = (FAR struct batio_operate_msg_s *)param;
int op, value; int op;
int value;
int ret = OK; int ret = OK;
bq2429x_dump_regs(priv); bq2429x_dump_regs(priv);

View File

@ -69,7 +69,9 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* CONFIG_I2C_MAX17040 or CONFIG_I2C_MAX17041 - The driver must know which /* CONFIG_I2C_MAX17040 or CONFIG_I2C_MAX17041 - The driver must know which
* chip is on the board in order to scale the voltage correctly. * chip is on the board in order to scale the voltage correctly.
*/ */
@ -80,6 +82,7 @@
#endif #endif
/* MAX1704x Register Definitions ********************************************/ /* MAX1704x Register Definitions ********************************************/
/* "All host interaction with the MAX17040/MAX17041 is handled by writing to /* "All host interaction with the MAX17040/MAX17041 is handled by writing to
* and reading from register locations. The MAX17040/MAX17041 have six 16-bit * and reading from register locations. The MAX17040/MAX17041 have six 16-bit
* registers: SOC, VCELL, MODE, VERSION, RCOMP, and COMMAND. Register reads * registers: SOC, VCELL, MODE, VERSION, RCOMP, and COMMAND. Register reads
@ -190,6 +193,7 @@ struct max1704x_dev_s
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
/* I2C support */ /* I2C support */
static int max1704x_getreg16(FAR struct max1704x_dev_s *priv, uint8_t regaddr, static int max1704x_getreg16(FAR struct max1704x_dev_s *priv, uint8_t regaddr,
@ -330,6 +334,7 @@ static inline int max1704x_getvcell(FAR struct max1704x_dev_s *priv,
{ {
*vcell = MAX1407X_VCELL(regval); *vcell = MAX1407X_VCELL(regval);
} }
return ret; return ret;
} }
@ -352,6 +357,7 @@ static inline int max1704x_getsoc(FAR struct max1704x_dev_s *priv,
{ {
*soc = MAX1407X_SOC(regval); *soc = MAX1407X_SOC(regval);
} }
return ret; return ret;
} }
@ -560,6 +566,7 @@ FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c
} }
#endif #endif
} }
return (FAR struct battery_gauge_dev_s *)priv; return (FAR struct battery_gauge_dev_s *)priv;
} }

View File

@ -207,7 +207,8 @@ static ssize_t motor_read(FAR struct file *filep, FAR char *buffer, size_t bufle
* Name: motor_write * Name: motor_write
****************************************************************************/ ****************************************************************************/
static ssize_t motor_write(FAR struct file *filep, FAR const char *buffer, size_t buflen) static ssize_t motor_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
{ {
return 1; return 1;
} }
@ -359,7 +360,7 @@ static int motor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case PWRIOC_GET_FAULT: case PWRIOC_GET_FAULT:
{ {
uint8_t *fault = ((uint8_t*)arg); FAR uint8_t *fault = ((FAR uint8_t *)arg);
ret = dev->ops->fault_get(dev, fault); ret = dev->ops->fault_get(dev, fault);
if (ret != OK) if (ret != OK)

View File

@ -55,6 +55,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* Convert the time slice interval into system clock ticks. /* Convert the time slice interval into system clock ticks.

View File

@ -280,7 +280,7 @@ int pm_changestate(int domain, enum pm_state_e newstate)
DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS); DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
/* Disable interrupts throught this operation... changing driver states /* Disable interrupts throughout this operation... changing driver states
* could cause additional driver activity that might interfere with the * could cause additional driver activity that might interfere with the
* state change. When the state change is complete, interrupts will be * state change. When the state change is complete, interrupts will be
* re-enabled. * re-enabled.

View File

@ -206,7 +206,6 @@ static int powerled_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{ {
case PWRIOC_START: case PWRIOC_START:
{ {
/* Allow powerled start only when limits set and structure is locked */ /* Allow powerled start only when limits set and structure is locked */
if (powerled->limits.lock == false || if (powerled->limits.lock == false ||
@ -312,7 +311,7 @@ static int powerled_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case PWRIOC_GET_FAULT: case PWRIOC_GET_FAULT:
{ {
uint8_t *fault = ((uint8_t*)arg); FAR uint8_t *fault = ((FAR uint8_t *)arg);
ret = dev->ops->fault_get(dev, fault); ret = dev->ops->fault_get(dev, fault);
if (ret != OK) if (ret != OK)
@ -385,7 +384,8 @@ errout:
* Name: powerled_register * Name: powerled_register
****************************************************************************/ ****************************************************************************/
int powerled_register(FAR const char *path, FAR struct powerled_dev_s *dev, FAR void *lower) int powerled_register(FAR const char *path, FAR struct powerled_dev_s *dev,
FAR void *lower)
{ {
int ret; int ret;

View File

@ -208,7 +208,8 @@ static ssize_t smps_read(FAR struct file *filep, FAR char *buffer, size_t buflen
* Name: smps_write * Name: smps_write
****************************************************************************/ ****************************************************************************/
static ssize_t smps_write(FAR struct file *filep, FAR const char *buffer, size_t buflen) static ssize_t smps_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
{ {
return 1; return 1;
} }
@ -369,7 +370,7 @@ static int smps_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case PWRIOC_GET_FAULT: case PWRIOC_GET_FAULT:
{ {
uint8_t *fault = ((uint8_t*)arg); FAR uint8_t *fault = ((FAR uint8_t *)arg);
ret = dev->ops->fault_get(dev, fault); ret = dev->ops->fault_get(dev, fault);
if (ret != OK) if (ret != OK)