- Subject: Re: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
- From: Tomoya MORINAGA <tomoya.rohm@xxxxxxxxx>
- Date: Thu, 19 Apr 2012 15:19:14 +0900
- Cc: Jean Delvare <khali@xxxxxxxxxxxx>, Ben Dooks <ben-linux@xxxxxxxxx>, Feng Tang <feng.tang@xxxxxxxxx>, Alexander Stein <alexander.stein@xxxxxxxxxxxxxxxxxxxxx>, linux-i2c@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, qi.wang@xxxxxxxxx, yong.y.wang@xxxxxxxxx, joel.clark@xxxxxxxxx, kok.howg.ewe@xxxxxxxxx
- In-reply-to: <20120418150544.GE19802@pengutronix.de>
- References: <1332741325-7746-1-git-send-email-tomoya.rohm@gmail.com> <1332741325-7746-2-git-send-email-tomoya.rohm@gmail.com> <20120418150544.GE19802@pengutronix.de>
On Thu, Apr 19, 2012 at 12:05 AM, Wolfram Sang <w.sang@xxxxxxxxxxxxxx> wrote:
> On Mon, Mar 26, 2012 at 02:55:24PM +0900, Tomoya MORINAGA wrote:
>>
>> Signed-off-by: Tomoya MORINAGA <tomoya.rohm@xxxxxxxxx>
>
> Woha, that's copy&paste code all over. May I ask to refactor this?
> Something like:
>
> rtn = pch_..._wait_for_checked_xfer();
> if (rtn)
> return rtn;
> // All the things you have to do when rtn == 0
>
> in that new function (the name was only a suugestion), you can do all
> the checks which are now copy-pasted, e.g.:
>
> 458 rtn = pch_i2c_wait_for_xfer_complete(adap);
> 459 if (rtn == 0) {
> 460 if (pch_i2c_getack(adap)) {
> 461 pch_dbg(adap, "Receive NACK for slave address"
> 462 "setting\n");
> 463 return -EIO;
> 464 }
> 465 } else if (rtn == -EIO) { /* Arbitration Lost */
> 466 pch_err(adap, "Lost Arbitration\n");
> 467 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
> 468 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
> 469 pch_i2c_init(adap);
> 470 return -EAGAIN;
> 471 } else { /* wait-event timeout */
> 472 pch_i2c_stop(adap);
> // Your current fixes added here
> 473 return -ETIME;
> 474 }
> return 0;
>
> It is only pseudo-code, but I think it can be done and will help the driver.
>
OK.
I'm ready to submit new patch you are saying.
So, firstly, could you accept this patch ?
After your accept, new patch series can be applicable.
thanks.
--
ROHM Co., Ltd.
tomoya
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[LM Sensors]
[Linux USB Devel]
[Linux Media]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]