RE: [PATCH] i2c: mux: ltc4306: Simplify probe()

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

 



Hi Geert,

Thanks for the feedback.

> -----Original Message-----
> From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Sent: Monday, July 17, 2023 10:17 AM
> To: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> Cc: Peter Rosin <peda@xxxxxxxxxx>; Michael Hennerich
> <michael.hennerich@xxxxxxxxxx>; linux-i2c@xxxxxxxxxxxxxxx; Prabhakar
> Mahadev Lad <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>; linux-renesas-
> soc@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] i2c: mux: ltc4306: Simplify probe()
> 
> Hi Biju,
> 
> On Sun, Jul 16, 2023 at 8:51 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> wrote:
> > The ltc4306_id[].driver_data could store a pointer to the chips, like
> > for DT-based matching, making I2C and DT-based matching more similar.
> >
> > After that, we can simplify the probe() by replacing of_device_get_
> > match_data() and i2c_match_id() by i2c_get_match_data() as we have
> > similar I2C and DT-based matching table.
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> 
> Thanks for your patch!
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> 
> A suggestion for improvement (which can be a separate patch, as it would
> touch ltc4306_of_match[] too) below.

OK.

> 
> > --- a/drivers/i2c/muxes/i2c-mux-ltc4306.c
> > +++ b/drivers/i2c/muxes/i2c-mux-ltc4306.c
> > @@ -192,8 +192,8 @@ static int ltc4306_deselect_mux(struct
> > i2c_mux_core *muxc, u32 chan)  }
> >
> >  static const struct i2c_device_id ltc4306_id[] = {
> > -       { "ltc4305", ltc_4305 },
> > -       { "ltc4306", ltc_4306 },
> > +       { "ltc4305", .driver_data = (kernel_ulong_t)&chips[ltc_4305]
> },
> > +       { "ltc4306", .driver_data = (kernel_ulong_t)&chips[ltc_4306]
> > + },
> 
> As after this the ltc_type enum values are used only for hardcoded
> indexing inside the chips array, you can get rid of them by splitting
> the array in individual variables, shortening the lines above (and in
> ltc4306_of_match[] below) in the process.

Agreed. Will send separate patch for this.

Cheers,
Biju




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux