Thread (37 messages) 37 messages, 3 authors, 20d ago

Re: [PATCH v4 02/14] mfd: lm3533: Remove driver specific regmap wrappers

From: Svyatoslav Ryhel <hidden>
Date: 2026-06-10 14:32:34
Also in: dri-devel, linux-devicetree, linux-iio, linux-leds, lkml

вт, 9 черв. 2026 р. о 22:02 Andy Shevchenko [off-list ref] пише:
On Sat, Jun 06, 2026 at 10:22:43AM +0300, Svyatoslav Ryhel wrote:
quoted
сб, 6 черв. 2026 р. о 09:53 Andy Shevchenko [off-list ref] пише:
quoted
On Sat, Jun 06, 2026 at 07:57:26AM +0300, Svyatoslav Ryhel wrote:
...
quoted
quoted
quoted
+     ret = regmap_assign_bits(als->lm3533->regmap, LM3533_REG_ALS_ZONE_INFO,
+                              LM3533_ALS_INT_ENABLE_MASK, enable);
In cases like this perhaps leaving mask would be fine and together with
I prefer to remove intermediate variables it the helper allows to
directly pass needed value.
quoted
        struct regmap *map = als->lm3533->regmap;
next patch drops lm3533 so there will be als->regmap which IMHO is
more logical instead of passing entire lm3533 to child devices.
Still it's longer than map. A local variable may help with making lines
shorter.
Introducing and assigning a local variable for a single use regmap
operation seems excessive especially since next patch removes operator
chaining leaving only als->regmap.
quoted
quoted
this be nice one-liner:

        ret = regmap_assign_bits(map, LM3533_REG_ALS_ZONE_INFO, mask, enable);
quoted
      if (ret) {
              dev_err(&indio_dev->dev, "failed to set int mode %d\n",
                                                              enable);
In many cases it won't increase LoC count.
--
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help