From 7127df3e38fde6b012c3e675262bc6c927d0266f Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Sat, 5 Jan 2019 11:49:18 -0600 Subject: [PATCH] drivers/power/mcp73871.c: Fix MCP73871 driver to register correctly as a battery charger. The first element of a 'struct battery_charger_dev_s' should be a pointer to operations structure. --- drivers/power/mcp73871.c | 13 +++++++------ tools/cfgdefine.c | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/power/mcp73871.c b/drivers/power/mcp73871.c index 74a5c2f483..4da5fa517b 100644 --- a/drivers/power/mcp73871.c +++ b/drivers/power/mcp73871.c @@ -93,14 +93,15 @@ struct mcp73871_dev_s { - /* MCP73871 configuration helpers */ - - FAR struct mcp73871_config_s *config; - /* 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 */ + + /* MCP73871 configuration helpers */ + + FAR struct mcp73871_config_s *config; }; /**************************************************************************** @@ -399,14 +400,14 @@ FAR struct battery_charger_dev_s * { FAR struct mcp73871_dev_s *priv; - /* Initialize the BQ2425x device structure */ + /* Allocate the MCP73871 device structure */ priv = (FAR struct mcp73871_dev_s *) kmm_zalloc(sizeof(struct mcp73871_dev_s)); if (priv) { - /* Initialize the BQ2425x device structure */ + /* Initialize the MCP73871 device structure */ nxsem_init(&priv->batsem, 0, 1); priv->ops = &g_mcp73871ops; diff --git a/tools/cfgdefine.c b/tools/cfgdefine.c index 78fd81b032..ec5d815482 100644 --- a/tools/cfgdefine.c +++ b/tools/cfgdefine.c @@ -352,7 +352,7 @@ void generate_definitions(FILE *stream) printf("#define %s 1\n", varname); } - /* Or to '2' if it has the special value "m" */ + /* Or to '2' if it has the special value 'm' */ else if (strcmp(varval, "m") == 0) {