[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200312174933.GJ1922688@smile.fi.intel.com>
Date: Thu, 12 Mar 2020 19:49:33 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Saravanan Sekar <sravanhome@...il.com>
Cc: lee.jones@...aro.org, robh+dt@...nel.org, jic23@...nel.org,
knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
sre@...nel.org, mchehab+huawei@...nel.org, davem@...emloft.net,
gregkh@...uxfoundation.org, fabrice.gasnier@...com,
beniamin.bia@...log.com, linus.walleij@...aro.org,
u.kleine-koenig@...gutronix.de, fabrizio.castro@...renesas.com,
info@...ux.net, hancock@...systems.ca, gregory.clement@...tlin.com,
renatogeh@...il.com, plr.vincent@...il.com,
miquel.raynal@...tlin.com, marcelo.schmitt1@...il.com,
paul@...pouillou.net, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH 2/5] mfd: mp2629: Add support for mps battery charger
On Thu, Mar 12, 2020 at 06:26:46PM +0100, Saravanan Sekar wrote:
> mp2629 is a highly-integrated switching-mode battery charge management
> device for single-cell Li-ion or Li-polymer battery.
>
> Add MFD core enables chip access for ADC driver for battery readings,
> and a power supply battery-charger driver
...
> drivers/mfd/Kconfig | 43 +++++----------
Why do you have unrelated changes here?
...
> +int mp2629_set_value(struct regmap *map, u8 reg, u8 mask, unsigned int val)
> +{
> + return regmap_update_bits(map, reg, mask, val);
> +}
> +EXPORT_SYMBOL(mp2629_set_value);
> +
> +int mp2629_get_value(struct regmap *map, u8 reg, unsigned int *val)
> +{
> + return regmap_read(map, reg, val);
> +}
> +EXPORT_SYMBOL(mp2629_get_value);
I'm wondering why a child can get access to parent's regmap?
I.o.w. why is this being exported?
...
> +static int mp2629_probe(struct i2c_client *client)
> +{
> + struct mp2629_info *info;
> + int ret;
> +
> + info = devm_kzalloc(&client->dev, sizeof(struct mp2629_info),
> + GFP_KERNEL);
info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL);
will be shorter.
> + if (!info)
> + return -ENOMEM;
> + ret = devm_mfd_add_devices(info->dev, -1, mp2629mfd,
> + ARRAY_SIZE(mp2629mfd), NULL,
> + 0, NULL);
-1 has a defined name in this case.
> + if (ret)
> + dev_err(info->dev, "Failed to add mfd %d\n", ret);
> +
> + return ret;
> +}
...
> +static const struct of_device_id mp2629_of_match[] = {
> + { .compatible = "mps,mp2629"},
> + {},
Terminator line doesn't require comma.
> +};
...
> +static const struct i2c_device_id mp2629_id[] = {
> + { "mp2629", },
> + { },
Ditto.
> +};
> +MODULE_DEVICE_TABLE(i2c, mp2629_id);
...
> + .of_match_table = of_match_ptr(mp2629_of_match),
of_match_ptr() is redundant and even might provoke compiler warning...
> + .probe_new = mp2629_probe,
...especially taking into consideration ->probe_new().
...
> +#include <linux/platform_device.h>
No user here. (Hint: Use forward declaration of struct device instead)
> +#include <linux/i2c.h>
Ditto.
> +#include <linux/regmap.h>
Ditto. (Hint: Use forward declaration of struct regmap instead)
But linux/types.h is actually missed.
> +int mp2629_set_value(struct regmap *map, u8 reg, u8 mask, unsigned int val);
> +int mp2629_get_value(struct regmap *map, u8 reg, unsigned int *val);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists