[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250330184705.7a9b1211@jic23-huawei>
Date: Sun, 30 Mar 2025 18:47:05 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: David Heidelberg via B4 Relay <devnull+david.ixit.cz@...nel.org>
Cc: david@...t.cz, Lars-Peter Clausen <lars@...afoo.de>, Svyatoslav Ryhel
<clamor95@...il.com>, Robert Eckelmann <longnoserob@...il.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 12/13] iio: light: al3010: Implement regmap support
On Sun, 30 Mar 2025 18:45:38 +0100
Jonathan Cameron <jic23@...nel.org> wrote:
> On Wed, 19 Mar 2025 21:59:51 +0100
> David Heidelberg via B4 Relay <devnull+david.ixit.cz@...nel.org> wrote:
>
> > From: David Heidelberg <david@...t.cz>
> >
> > Modernize and make driver a bit cleaner.
> >
> > After the regmap implementation, the compiler is able to produce
> > much smaller module.
> >
> > Size before: 72 kB
> > Size after: 58 kB
> >
> > Signed-off-by: David Heidelberg <david@...t.cz>
> Just one real comment on your code.
> Also a passing musing that you can feel free to ignore!
>
> Jonathan
>
>
> > static void al3010_set_pwr_off(void *_data)
> > {
> > struct al3010_data *data = _data;
> > + struct device *dev = regmap_get_device(data->regmap);
> > + int ret;
> >
> > - i2c_smbus_write_byte_data(data->client, AL3010_REG_SYSTEM,
> > - AL3010_CONFIG_DISABLE);
> > + ret = regmap_write(data->regmap, AL3010_REG_SYSTEM, AL3010_CONFIG_DISABLE);
> > + if (ret)
> > + dev_err(dev, "failed to write system register\n");
>
> Unrelated to your patch, but I wonder if there is appetite for
> regmap_err(data->regmap, "failed to write system register\n");
>
> A lot of drivers carry a local dev pointer because the regmap_get_device() stuff
> is a bit clunky. They only use it in many paths for prints like this.
>
> > }
>
>
> > @@ -204,7 +210,9 @@ static int al3010_suspend(struct device *dev)
> >
> > static int al3010_resume(struct device *dev)
> > {
> > - return al3010_set_pwr_on(to_i2c_client(dev));
> > + struct al3010_data *data = iio_priv(dev_get_drvdata(dev));
>
> Why this change?
Ah. Obvious. Ignore me.
>
> > +
> > + return al3010_set_pwr_on(data);
> > }
> >
> > static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
> >
>
Powered by blists - more mailing lists