[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHO=5PEMou=a7Kqc=_ZJ8V9FQ=dHA0cJkkojdq91NBsO1Dp3TQ@mail.gmail.com>
Date: Thu, 16 Jul 2020 22:49:14 +0530
From: Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Wolfram Sang <wsa@...nel.org>,
linux-i2c <linux-i2c@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ray Jui <rjui@...adcom.com>,
Scott Branden <sbranden@...adcom.com>,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
Lori Hikichi <lori.hikichi@...adcom.com>,
Robert Richter <rrichter@...vell.com>,
Nishka Dasgupta <nishkadg.linux@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH V1 2/2] i2c: iproc: add slave pec support
Hi Andy,
On Thu, Jul 16, 2020 at 3:44 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Thu, Jul 16, 2020 at 11:14 AM Rayagonda Kokatanur
> <rayagonda.kokatanur@...adcom.com> wrote:
> >
> > Iproc supports PEC computation and checking in both Master
> > and Slave mode.
> >
> > This patch adds support for PEC in slave mode.
>
> ...
>
> > -#define S_RX_PEC_ERR_SHIFT 29
> > +#define S_RX_PEC_ERR_SHIFT 28
> > +#define S_RX_PEC_ERR_MASK 0x3
> > +#define S_RX_PEC_ERR 0x1
>
> This needs to be explained in the commit message, in particular why
> this change makes no regression.
I didn't get what do you mean by "no regression", please elaborate.
>
> ...
>
> > +static int bcm_iproc_smbus_check_slave_pec(struct bcm_iproc_i2c_dev *iproc_i2c,
> > + u32 val)
> > +{
> > + u8 err_status;
>
> > + int ret = 0;
>
> Completely redundant variable.
>
> > + if (!iproc_i2c->en_s_pec)
> > + return ret;
>
> return 0;
>
> > + err_status = (u8)((val >> S_RX_PEC_ERR_SHIFT) & S_RX_PEC_ERR_MASK);
>
> Why casting?
>
> > + if (err_status == S_RX_PEC_ERR) {
> > + dev_err(iproc_i2c->device, "Slave PEC error\n");
>
> > + ret = -EBADMSG;
>
> return ...
>
> > + }
> > +
> > + return ret;
>
> return 0;
>
> > +}
>
> ...
>
> > + if (rx_status == I2C_SLAVE_RX_END) {
> > + int ret;
> > +
> > + ret = bcm_iproc_smbus_check_slave_pec(iproc_i2c,
> > + val);
>
> One line looks better.
Yes, but to have 80 char per line, I have to do this.
>
> > + if (!ret)
>
> Why not positive conditional?
Thank you for your review.
Will fix all above.
Best regards,
Rayagonda
>
> > + i2c_slave_event(iproc_i2c->slave,
> > + I2C_SLAVE_STOP, &value);
> > + else
> > + i2c_slave_event(iproc_i2c->slave,
> > + I2C_SLAVE_PEC_ERR,
> > + &value);
> > + }
>
> --
> With Best Regards,
> Andy Shevchenko
Powered by blists - more mailing lists