diff mbox series

[v3,3/3] iio: addac: ad74413r: for_each_set_bit_from -> for_each_set_bit

Message ID 20220111074703.3677392-3-cosmin.tanislav@analog.com (mailing list archive)
State Accepted
Headers show
Series [v3,1/3] iio: addac: ad74413r: use ngpio size when iterating over mask | expand

Commit Message

Cosmin Tanislav Jan. 11, 2022, 7:47 a.m. UTC
The starting bit is always zero, it doesn't make much sense to
use for_each_set_bit_from. Replace it with for_each_set_bit
which doesn't start from a particular bit.

Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
V2 -> V3
 * move after patch 3
---
 drivers/iio/addac/ad74413r.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Andy Shevchenko Jan. 11, 2022, 9:22 a.m. UTC | #1
On Tue, Jan 11, 2022 at 9:47 AM Cosmin Tanislav <demonsingur@gmail.com> wrote:
>
> The starting bit is always zero, it doesn't make much sense to
> use for_each_set_bit_from. Replace it with for_each_set_bit
> which doesn't start from a particular bit.

We refer to the function() like this.
But no need to resend, I hope Jonathan may amend this when applying.
Jonathan Cameron Jan. 15, 2022, 6:59 p.m. UTC | #2
On Tue, 11 Jan 2022 11:22:23 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Tue, Jan 11, 2022 at 9:47 AM Cosmin Tanislav <demonsingur@gmail.com> wrote:
> >
> > The starting bit is always zero, it doesn't make much sense to
> > use for_each_set_bit_from. Replace it with for_each_set_bit
> > which doesn't start from a particular bit.  
> 
> We refer to the function() like this.
> But no need to resend, I hope Jonathan may amend this when applying.
> 

I'll need to wait for rc1 to have the relevant code in my fixes-togreg
branch to pick these up.

They look fine to me and hopefully I'll remember to cleanup the above ;)

Thanks,

Jonathan
Jonathan Cameron Jan. 30, 2022, 2:25 p.m. UTC | #3
On Sat, 15 Jan 2022 18:59:48 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 11 Jan 2022 11:22:23 +0200
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> 
> > On Tue, Jan 11, 2022 at 9:47 AM Cosmin Tanislav <demonsingur@gmail.com> wrote:  
> > >
> > > The starting bit is always zero, it doesn't make much sense to
> > > use for_each_set_bit_from. Replace it with for_each_set_bit
> > > which doesn't start from a particular bit.    
> > 
> > We refer to the function() like this.
> > But no need to resend, I hope Jonathan may amend this when applying.
> >   
> 
> I'll need to wait for rc1 to have the relevant code in my fixes-togreg
> branch to pick these up.
> 
> They look fine to me and hopefully I'll remember to cleanup the above ;)
> 
First 2 applied to the fixes-togreg branch of iio.git.

This 3rd one isn't a fix so will have to wait for those to end up in
my togreg branch.  Give me a shout if I seem to have lost this once that
is true.

Thanks,

Jonathan

> Thanks,
> 
> Jonathan
Jonathan Cameron June 4, 2022, 3:25 p.m. UTC | #4
On Sun, 30 Jan 2022 14:25:58 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Sat, 15 Jan 2022 18:59:48 +0000
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > On Tue, 11 Jan 2022 11:22:23 +0200
> > Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> >   
> > > On Tue, Jan 11, 2022 at 9:47 AM Cosmin Tanislav <demonsingur@gmail.com> wrote:    
> > > >
> > > > The starting bit is always zero, it doesn't make much sense to
> > > > use for_each_set_bit_from. Replace it with for_each_set_bit
> > > > which doesn't start from a particular bit.      
> > > 
> > > We refer to the function() like this.
> > > But no need to resend, I hope Jonathan may amend this when applying.
> > >     
> > 
> > I'll need to wait for rc1 to have the relevant code in my fixes-togreg
> > branch to pick these up.
> > 
> > They look fine to me and hopefully I'll remember to cleanup the above ;)
> >   
> First 2 applied to the fixes-togreg branch of iio.git.
> 
> This 3rd one isn't a fix so will have to wait for those to end up in
> my togreg branch.  Give me a shout if I seem to have lost this once that
> is true.

Oops.  Even with patchwork I occasionally lose patches as too many things
stick there for a long time for complex reasons.

Anyhow, now applied to the togreg branch of iio.git

Sorry for the delay

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > Thanks,
> > 
> > Jonathan  
>
diff mbox series

Patch

diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
index b13cd5407df3..cf58ee19f912 100644
--- a/drivers/iio/addac/ad74413r.c
+++ b/drivers/iio/addac/ad74413r.c
@@ -284,10 +284,10 @@  static void ad74413r_gpio_set_multiple(struct gpio_chip *chip,
 	struct ad74413r_state *st = gpiochip_get_data(chip);
 	unsigned long real_mask = 0;
 	unsigned long real_bits = 0;
-	unsigned int offset = 0;
+	unsigned int offset;
 	int ret;
 
-	for_each_set_bit_from(offset, mask, chip->ngpio) {
+	for_each_set_bit(offset, mask, chip->ngpio) {
 		unsigned int real_offset = st->gpo_gpio_offsets[offset];
 
 		ret = ad74413r_set_gpo_config(st, real_offset,
@@ -325,7 +325,7 @@  static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
 				      unsigned long *bits)
 {
 	struct ad74413r_state *st = gpiochip_get_data(chip);
-	unsigned int offset = 0;
+	unsigned int offset;
 	unsigned int val;
 	int ret;
 
@@ -333,7 +333,7 @@  static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
 	if (ret)
 		return ret;
 
-	for_each_set_bit_from(offset, mask, chip->ngpio) {
+	for_each_set_bit(offset, mask, chip->ngpio) {
 		unsigned int real_offset = st->comp_gpio_offsets[offset];
 
 		__assign_bit(offset, bits, val & BIT(real_offset));