mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
driver/power: using upper-half structure directly in the lower-half structure.
N/A Change-Id: I29da755e303191788cb79ddb6972045a5c368c83 Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -77,8 +77,7 @@ struct bq2425x_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_charger_dev_s dev; /* Battery charger device */
|
||||
|
||||
/* Data fields specific to the lower half BQ2425x driver follow */
|
||||
|
||||
@@ -788,8 +787,7 @@ FAR struct battery_charger_dev_s *
|
||||
{
|
||||
/* Initialize the BQ2425x device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_bq2425xops;
|
||||
priv->dev.ops = &g_bq2425xops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
|
||||
@@ -117,8 +117,7 @@ struct bq2429x_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_charger_dev_s dev; /* Battery charger device */
|
||||
|
||||
/* Data fields specific to the lower half BQ2429X driver follow */
|
||||
|
||||
@@ -1260,8 +1259,7 @@ FAR struct battery_charger_dev_s *
|
||||
{
|
||||
/* Initialize the BQ2429x device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_bq2429xops;
|
||||
priv->dev.ops = &g_bq2429xops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
|
||||
@@ -78,8 +78,7 @@ struct bq25618_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_charger_dev_s dev; /* Battery charger device */
|
||||
|
||||
/* Data fields specific to the lower half BQ25618 driver follow */
|
||||
|
||||
@@ -1412,8 +1411,7 @@ bq25618_initialize(FAR struct i2c_master_s *i2c, uint8_t addr,
|
||||
{
|
||||
/* Initialize the BQ25618 device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_bq25618ops;
|
||||
priv->dev.ops = &g_bq25618ops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
|
||||
@@ -101,8 +101,7 @@ struct bq27426_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_gauge_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_gauge_dev_s dev; /* Battery gauge device */
|
||||
|
||||
/* Data fields specific to the lower half bq27426 driver follow */
|
||||
|
||||
@@ -444,8 +443,7 @@ FAR struct battery_gauge_dev_s *bq27426_initialize(
|
||||
{
|
||||
/* Initialize the bq27426 device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_bq27426ops;
|
||||
priv->dev.ops = &g_bq27426ops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
|
||||
@@ -94,8 +94,7 @@ struct bq769x0_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_monitor_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_monitor_dev_s dev; /* Battery monitor device */
|
||||
|
||||
/* Data fields specific to the lower half BQ769x0 driver follow */
|
||||
|
||||
@@ -2096,8 +2095,7 @@ FAR struct battery_monitor_dev_s *
|
||||
{
|
||||
/* Initialize the BQ769x0 device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_bq769x0ops;
|
||||
priv->dev.ops = &g_bq769x0ops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
|
||||
@@ -60,8 +60,7 @@ struct cw2218_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_gauge_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_gauge_dev_s dev; /* Battery gauge device */
|
||||
|
||||
/* Data fields specific to the lower half cw2218 driver follow */
|
||||
|
||||
@@ -1013,10 +1012,9 @@ FAR struct battery_gauge_dev_s *cw2218_initialize(
|
||||
{
|
||||
/* Initialize the cw2218 device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_cw2218ops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->dev.ops = &g_cw2218ops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,8 +162,7 @@ struct max1704x_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_gauge_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_gauge_dev_s dev; /* Battery gauge device */
|
||||
|
||||
/* Data fields specific to the lower half MAX1704x driver follow */
|
||||
|
||||
@@ -533,8 +532,7 @@ max1704x_initialize(FAR struct i2c_master_s *i2c,
|
||||
{
|
||||
/* Initialize MAX1704x device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_max1704xops;
|
||||
priv->dev.ops = &g_max1704xops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
|
||||
@@ -73,9 +73,7 @@ struct mcp73871_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
|
||||
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_charger_dev_s dev; /* Battery charger device */
|
||||
|
||||
/* MCP73871 configuration helpers */
|
||||
|
||||
@@ -387,9 +385,8 @@ FAR struct battery_charger_dev_s *
|
||||
{
|
||||
/* Initialize the MCP73871 device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_mcp73871ops;
|
||||
priv->config = config;
|
||||
priv->dev.ops = &g_mcp73871ops;
|
||||
priv->config = config;
|
||||
|
||||
/* Enable the battery charge */
|
||||
|
||||
|
||||
@@ -66,8 +66,7 @@ struct sc8551_dev_s
|
||||
{
|
||||
/* The common part of the battery driver visible to the upper-half driver */
|
||||
|
||||
FAR const struct battery_charger_operations_s *ops; /* Battery operations */
|
||||
sem_t batsem; /* Enforce mutually exclusive access */
|
||||
struct battery_charger_dev_s dev; /* Battery charger device */
|
||||
|
||||
/* Data fields specific to the lower half SC8551 driver follow */
|
||||
|
||||
@@ -1823,8 +1822,7 @@ FAR struct battery_charger_dev_s *
|
||||
{
|
||||
/* Initialize the SC8551 device structure */
|
||||
|
||||
nxsem_init(&priv->batsem, 0, 1);
|
||||
priv->ops = &g_sc8551ops;
|
||||
priv->dev.ops = &g_sc8551ops;
|
||||
priv->i2c = i2c;
|
||||
priv->addr = addr;
|
||||
priv->frequency = frequency;
|
||||
|
||||
Reference in New Issue
Block a user