Re: [PATCH v2 13/14] regulator: add pm8008 pmic regulator driver

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

 



On Wed, May 29, 2024 at 11:02:57PM +0300, Andy Shevchenko wrote:
> On Wed, May 29, 2024 at 7:30 PM Johan Hovold <johan+linaro@xxxxxxxxxx> wrote:

> > +#include <linux/array_size.h>
> > +#include <linux/bits.h>
> > +#include <linux/device.h>
> > +#include <linux/math.h>
> > +#include <linux/module.h>
> 
> > +#include <linux/of.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/regmap.h>
> > +#include <linux/regulator/driver.h>
> 
> + types.h

This one is already pulled in indirectly and I'm not going to respin for
this.

> + asm/byteorder.h

Already explicitly included in the code you left out.

> > +static int pm8008_regulator_set_voltage_sel(struct regulator_dev *rdev, unsigned int sel)
> > +{
> > +       struct pm8008_regulator *preg = rdev_get_drvdata(rdev);
> > +       unsigned int mV;
> > +       __le16 val;
> > +       int ret;
> > +
> > +       ret = regulator_list_voltage_linear_range(rdev, sel);
> > +       if (ret < 0)
> > +               return ret;
> > +
> > +       mV = DIV_ROUND_UP(ret, 1000);
> 
> MILLI from units.h ?

Nah. 
 
> > +       val = cpu_to_le16(mV);
> 
> > +       ret = regmap_bulk_write(preg->regmap, preg->base + LDO_VSET_LB_REG,
> > +                       &val, sizeof(val));
> > +       if (ret < 0)
> > +               return ret;
> > +
> > +       return 0;
> 
> May be written as
> 
>   return regmap_bulk_write(...);

I obviously prefer it the way I wrote it.

> > +               rdev = devm_regulator_register(dev, desc, &config);
> > +               if (IS_ERR(rdev)) {
> > +                       ret = PTR_ERR(rdev);
> > +                       dev_err(dev, "failed to register regulator %s: %d\n",
> > +                                       desc->name, ret);
> > +                       return ret;
> 
> It's possible to use
> 
>   return dev_err_probe(...);
> 
> even for non-probe functions.

This is a probe function(), but as I've told you repeatedly I'm not
going to use dev_err_probe() here.

Johan




[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