lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zlg1bGOs3V3TkHck@hovoldconsulting.com>
Date: Thu, 30 May 2024 10:14:36 +0200
From: Johan Hovold <johan@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Johan Hovold <johan+linaro@...nel.org>, Lee Jones <lee@...nel.org>,
	Mark Brown <broonie@...nel.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	Bjorn Andersson <andersson@...nel.org>,
	Konrad Dybcio <konrad.dybcio@...aro.org>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Liam Girdwood <lgirdwood@...il.com>,
	Das Srinagesh <quic_gurus@...cinc.com>,
	Satya Priya Kakitapalli <quic_skakitap@...cinc.com>,
	Stephen Boyd <swboyd@...omium.org>,
	Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
	linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org
Subject: Re: [PATCH v2 13/14] regulator: add pm8008 pmic regulator driver

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@...nel.org> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ