Re: [PATCH 2/5] mfd: mp2629: Add support for mps battery charger

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux