2021-06-17 10:39:22

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 3/3] i2c:support new register set for ast2600

On Thu, Jun 17, 2021 at 05:43:40PM +0800, Jamin Lin wrote:
> Add i2c new driver to support new register set for AST2600.
> AST2600 support three modes for data transfer which are
> byte mode, buffer mode and dma mode, respectively.
> The global driver of i2c is used to set the new register
> mode and define the base clock frequency
> of baseclk_1~baseclk_4.
>
> Signed-off-by: Jamin Lin <[email protected]>
> ---
> drivers/i2c/busses/Kconfig | 11 +
> drivers/i2c/busses/Makefile | 1 +
> drivers/i2c/busses/ast2600-i2c-global.c | 205 +++
> drivers/i2c/busses/ast2600-i2c-global.h | 25 +
> drivers/i2c/busses/i2c-new-aspeed.c | 1796 +++++++++++++++++++++++

I commented _something_ (but read comments carefully, they will cover much
more). The overall it seems you have to:
- shrink the code base by at least ~15% (it's possible), i.e. -200 LOCs
- rethink how you do calculations and bit operations
- better code style

--
With Best Regards,
Andy Shevchenko



2021-06-18 04:07:57

by Jamin Lin

[permalink] [raw]
Subject: Re: [PATCH 3/3] i2c:support new register set for ast2600

The 06/17/2021 10:36, Andy Shevchenko wrote:
> On Thu, Jun 17, 2021 at 05:43:40PM +0800, Jamin Lin wrote:
> > Add i2c new driver to support new register set for AST2600.
> > AST2600 support three modes for data transfer which are
> > byte mode, buffer mode and dma mode, respectively.
> > The global driver of i2c is used to set the new register
> > mode and define the base clock frequency
> > of baseclk_1~baseclk_4.
> >
> > Signed-off-by: Jamin Lin <[email protected]>
> > ---
> > drivers/i2c/busses/Kconfig | 11 +
> > drivers/i2c/busses/Makefile | 1 +
> > drivers/i2c/busses/ast2600-i2c-global.c | 205 +++
> > drivers/i2c/busses/ast2600-i2c-global.h | 25 +
> > drivers/i2c/busses/i2c-new-aspeed.c | 1796 +++++++++++++++++++++++
>
> I commented _something_ (but read comments carefully, they will cover much
> more). The overall it seems you have to:
> - shrink the code base by at least ~15% (it's possible), i.e. -200 LOCs
Can you describe it more detail?
Do you mean I should separate the patch file to fix size limitation?
> - rethink how you do calculations and bit operations
> - better code style
>
Thanks for your review and very good suggestion
I will update them and sent patch again.
By the way, I received test failed email from Robot due to compiling
warning. I will fix them, too.

> --
> With Best Regards,
> Andy Shevchenko
>
>

2021-06-18 10:04:44

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 3/3] i2c:support new register set for ast2600

On Fri, Jun 18, 2021 at 11:58:55AM +0800, Jamin Lin wrote:
> The 06/17/2021 10:36, Andy Shevchenko wrote:
> > On Thu, Jun 17, 2021 at 05:43:40PM +0800, Jamin Lin wrote:
> > > Add i2c new driver to support new register set for AST2600.
> > > AST2600 support three modes for data transfer which are
> > > byte mode, buffer mode and dma mode, respectively.
> > > The global driver of i2c is used to set the new register
> > > mode and define the base clock frequency
> > > of baseclk_1~baseclk_4.

> > - shrink the code base by at least ~15% (it's possible), i.e. -200 LOCs
> Can you describe it more detail?
> Do you mean I should separate the patch file to fix size limitation?

No. Based on my brief review you introduce to many redundant LOCs (lines of
code). Remove them, refactor the code, make it small and neat and easy to read
and understand. It is possible to achieve!

> > - rethink how you do calculations and bit operations
> > - better code style
> >
> Thanks for your review and very good suggestion
> I will update them and sent patch again.
> By the way, I received test failed email from Robot due to compiling
> warning. I will fix them, too.

--
With Best Regards,
Andy Shevchenko


2021-06-21 05:16:48

by Jamin Lin

[permalink] [raw]
Subject: Re: [PATCH 3/3] i2c:support new register set for ast2600

The 06/18/2021 10:00, Andy Shevchenko wrote:
> On Fri, Jun 18, 2021 at 11:58:55AM +0800, Jamin Lin wrote:
> > The 06/17/2021 10:36, Andy Shevchenko wrote:
> > > On Thu, Jun 17, 2021 at 05:43:40PM +0800, Jamin Lin wrote:
> > > > Add i2c new driver to support new register set for AST2600.
> > > > AST2600 support three modes for data transfer which are
> > > > byte mode, buffer mode and dma mode, respectively.
> > > > The global driver of i2c is used to set the new register
> > > > mode and define the base clock frequency
> > > > of baseclk_1~baseclk_4.
>
> > > - shrink the code base by at least ~15% (it's possible), i.e. -200 LOCs
> > Can you describe it more detail?
> > Do you mean I should separate the patch file to fix size limitation?
>
> No. Based on my brief review you introduce to many redundant LOCs (lines of
> code). Remove them, refactor the code, make it small and neat and easy to read
> and understand. It is possible to achieve!
>
Will fix
Thanks
> > > - rethink how you do calculations and bit operations
> > > - better code style
> > >
> > Thanks for your review and very good suggestion
> > I will update them and sent patch again.
> > By the way, I received test failed email from Robot due to compiling
> > warning. I will fix them, too.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>