[PATCH v4 0/9] i2c: riic: driver cleanup and improvements

Prabhakar posted 9 patches 1 year, 1 month ago
drivers/i2c/busses/i2c-riic.c | 137 ++++++++++++++++++----------------
1 file changed, 72 insertions(+), 65 deletions(-)
[PATCH v4 0/9] i2c: riic: driver cleanup and improvements
Posted by Prabhakar 1 year, 1 month ago
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Simplify and modernize the RIIC I2C driver with the following changes:

1. Refactor error handling in `riic_i2c_probe()` and `riic_init_hw()` by
   replacing `dev_err()` with `dev_err_probe()` and using a local `dev`
   pointer.
2. Use `BIT()` and `GENMASK()` macros for consistent and clear bit
   handling.
3. Manage reset lines with `devm_reset_control_get_exclusive()` to
   simplify resource handling.
4. Mark `riic_irqs` as `const` and simplify clock tick calculations with
   predefined macros.
5. Add `riic_bus_barrier()` to check bus availability and improve
   reliability.

v3->v4
-> Created new patch 1/9
-> Dropped RB/TB tags from patch 8/9
-> Dropped `unsigned long` cast and updated the format specifier while
   printing bus frequency
-> Included required headers
-> Propogated the error

Cheers,
Prabhakar

Lad Prabhakar (9):
  i2c: riic: Introduce a separate variable for IRQ
  i2c: riic: Use dev_err_probe in probe and riic_init_hw functions
  i2c: riic: Use local `dev` pointer in `dev_err_probe()`
  i2c: riic: Use BIT macro consistently
  i2c: riic: Use GENMASK() macro for bitmask definitions
  i2c: riic: Make use of devres helper to request deasserted reset line
  i2c: riic: Mark riic_irqs array as const
  i2c: riic: Use predefined macro and simplify clock tick calculation
  i2c: riic: Add `riic_bus_barrier()` to check bus availability

 drivers/i2c/busses/i2c-riic.c | 137 ++++++++++++++++++----------------
 1 file changed, 72 insertions(+), 65 deletions(-)

-- 
2.43.0
Re: [PATCH v4 0/9] i2c: riic: driver cleanup and improvements
Posted by Andi Shyti 1 year, 1 month ago
Hi,

I will need for Andy's ack here because he had some comments.

Thanks,
Andi

On Fri, Jan 03, 2025 at 09:18:51AM +0000, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Simplify and modernize the RIIC I2C driver with the following changes:
> 
> 1. Refactor error handling in `riic_i2c_probe()` and `riic_init_hw()` by
>    replacing `dev_err()` with `dev_err_probe()` and using a local `dev`
>    pointer.
> 2. Use `BIT()` and `GENMASK()` macros for consistent and clear bit
>    handling.
> 3. Manage reset lines with `devm_reset_control_get_exclusive()` to
>    simplify resource handling.
> 4. Mark `riic_irqs` as `const` and simplify clock tick calculations with
>    predefined macros.
> 5. Add `riic_bus_barrier()` to check bus availability and improve
>    reliability.
> 
> v3->v4
> -> Created new patch 1/9
> -> Dropped RB/TB tags from patch 8/9
> -> Dropped `unsigned long` cast and updated the format specifier while
>    printing bus frequency
> -> Included required headers
> -> Propogated the error
> 
> Cheers,
> Prabhakar
> 
> Lad Prabhakar (9):
>   i2c: riic: Introduce a separate variable for IRQ
>   i2c: riic: Use dev_err_probe in probe and riic_init_hw functions
>   i2c: riic: Use local `dev` pointer in `dev_err_probe()`
>   i2c: riic: Use BIT macro consistently
>   i2c: riic: Use GENMASK() macro for bitmask definitions
>   i2c: riic: Make use of devres helper to request deasserted reset line
>   i2c: riic: Mark riic_irqs array as const
>   i2c: riic: Use predefined macro and simplify clock tick calculation
>   i2c: riic: Add `riic_bus_barrier()` to check bus availability
> 
>  drivers/i2c/busses/i2c-riic.c | 137 ++++++++++++++++++----------------
>  1 file changed, 72 insertions(+), 65 deletions(-)
> 
> -- 
> 2.43.0
>
Re: [PATCH v4 0/9] i2c: riic: driver cleanup and improvements
Posted by Lad, Prabhakar 1 year, 1 month ago
Hi Andi,

On Fri, Jan 3, 2025 at 11:54 PM Andi Shyti <andi.shyti@kernel.org> wrote:
>
> Hi,
>
> I will need for Andy's ack here because he had some comments.
>
I'll have to respin the series fixing patch 1/9.

Cheers,
Prabhakar

> Thanks,
> Andi
>
> On Fri, Jan 03, 2025 at 09:18:51AM +0000, Prabhakar wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Simplify and modernize the RIIC I2C driver with the following changes:
> >
> > 1. Refactor error handling in `riic_i2c_probe()` and `riic_init_hw()` by
> >    replacing `dev_err()` with `dev_err_probe()` and using a local `dev`
> >    pointer.
> > 2. Use `BIT()` and `GENMASK()` macros for consistent and clear bit
> >    handling.
> > 3. Manage reset lines with `devm_reset_control_get_exclusive()` to
> >    simplify resource handling.
> > 4. Mark `riic_irqs` as `const` and simplify clock tick calculations with
> >    predefined macros.
> > 5. Add `riic_bus_barrier()` to check bus availability and improve
> >    reliability.
> >
> > v3->v4
> > -> Created new patch 1/9
> > -> Dropped RB/TB tags from patch 8/9
> > -> Dropped `unsigned long` cast and updated the format specifier while
> >    printing bus frequency
> > -> Included required headers
> > -> Propogated the error
> >
> > Cheers,
> > Prabhakar
> >
> > Lad Prabhakar (9):
> >   i2c: riic: Introduce a separate variable for IRQ
> >   i2c: riic: Use dev_err_probe in probe and riic_init_hw functions
> >   i2c: riic: Use local `dev` pointer in `dev_err_probe()`
> >   i2c: riic: Use BIT macro consistently
> >   i2c: riic: Use GENMASK() macro for bitmask definitions
> >   i2c: riic: Make use of devres helper to request deasserted reset line
> >   i2c: riic: Mark riic_irqs array as const
> >   i2c: riic: Use predefined macro and simplify clock tick calculation
> >   i2c: riic: Add `riic_bus_barrier()` to check bus availability
> >
> >  drivers/i2c/busses/i2c-riic.c | 137 ++++++++++++++++++----------------
> >  1 file changed, 72 insertions(+), 65 deletions(-)
> >
> > --
> > 2.43.0
> >
Re: [PATCH v4 0/9] i2c: riic: driver cleanup and improvements
Posted by Andi Shyti 1 year, 1 month ago
Hi,

On Sat, Jan 04, 2025 at 08:15:56AM +0000, Lad, Prabhakar wrote:
> On Fri, Jan 3, 2025 at 11:54 PM Andi Shyti <andi.shyti@kernel.org> wrote:
> > I will need for Andy's ack here because he had some comments.
> >
> I'll have to respin the series fixing patch 1/9.

if you want you can only send patch 1. It's OK as far as I'm
aware of it ;-)

I pinged Andy privately to give an ack here, we still have a few
days to the merge window.

Andi
Re: [PATCH v4 0/9] i2c: riic: driver cleanup and improvements
Posted by Andy Shevchenko 1 year ago
On Thu, Jan 9, 2025 at 4:44 PM Andi Shyti <andi.shyti@kernel.org> wrote:
>
> Hi,
>
> On Sat, Jan 04, 2025 at 08:15:56AM +0000, Lad, Prabhakar wrote:
> > On Fri, Jan 3, 2025 at 11:54 PM Andi Shyti <andi.shyti@kernel.org> wrote:
> > > I will need for Andy's ack here because he had some comments.
> > >
> > I'll have to respin the series fixing patch 1/9.
>
> if you want you can only send patch 1. It's OK as far as I'm
> aware of it ;-)
>
> I pinged Andy privately to give an ack here, we still have a few
> days to the merge window.

Sorry for the delay, I have got sick just at the end of my vacation
(and I still have a couple of days left), but I looked at the v4 and
most of the patches LGTM, the respective comments are in the
individual replies.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v4 0/9] i2c: riic: driver cleanup and improvements
Posted by Andy Shevchenko 1 year ago
On Sun, Jan 12, 2025 at 4:27 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Thu, Jan 9, 2025 at 4:44 PM Andi Shyti <andi.shyti@kernel.org> wrote:
> > On Sat, Jan 04, 2025 at 08:15:56AM +0000, Lad, Prabhakar wrote:
> > > On Fri, Jan 3, 2025 at 11:54 PM Andi Shyti <andi.shyti@kernel.org> wrote:
> > > > I will need for Andy's ack here because he had some comments.
> > > >
> > > I'll have to respin the series fixing patch 1/9.
> >
> > if you want you can only send patch 1. It's OK as far as I'm
> > aware of it ;-)
> >
> > I pinged Andy privately to give an ack here, we still have a few
> > days to the merge window.
>
> Sorry for the delay, I have got sick just at the end of my vacation
> (and I still have a couple of days left), but I looked at the v4 and
> most of the patches LGTM, the respective comments are in the
> individual replies.

Okay, seems the main concern over v4/v5 is that vdso/* inclusions
while they should be linux/* ones. Otherwise LGTM. Since there are a
few changes required I would expect a v6 soon.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v4 0/9] i2c: riic: driver cleanup and improvements
Posted by Lad, Prabhakar 1 year, 1 month ago
Hi Andi,

On Thu, Jan 9, 2025 at 2:44 PM Andi Shyti <andi.shyti@kernel.org> wrote:
>
> Hi,
>
> On Sat, Jan 04, 2025 at 08:15:56AM +0000, Lad, Prabhakar wrote:
> > On Fri, Jan 3, 2025 at 11:54 PM Andi Shyti <andi.shyti@kernel.org> wrote:
> > > I will need for Andy's ack here because he had some comments.
> > >
> > I'll have to respin the series fixing patch 1/9.
>
> if you want you can only send patch 1. It's OK as far as I'm
> aware of it ;-)
>
> I pinged Andy privately to give an ack here, we still have a few
> days to the merge window.
>
My initial plan was to send a v5 including the recovery patch too, I
switched to using the generic i2c recovery algorithm and saw issues
which I reported [0] and waiting for Wolfram's reply.

Maybe for now, I'll send patch 1/9 only, thanks.

[0] https://lore.kernel.org/all/CA+V-a8s4-g9vxyfYMgnKMK=Oej9kDBwWsWehWLYTkxw-06w-2g@mail.gmail.com/

Cheers,
Prabhakar