linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Alexander Stein
	<alexander.stein-93q1YBGzJSMe9JSWTWOYM3xStJ4P+DSV@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	qi.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
Date: Fri, 20 Apr 2012 22:37:12 +0200	[thread overview]
Message-ID: <20120420203712.GA12691@pengutronix.de> (raw)
In-Reply-To: <CANKRQng5nb0nU_e1o6TLnvOwPoXX1C_bJguNyjrsVfo+mubKaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

On Thu, Apr 19, 2012 at 03:19:14PM +0900, Tomoya MORINAGA wrote:
> On Thu, Apr 19, 2012 at 12:05 AM, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > On Mon, Mar 26, 2012 at 02:55:24PM +0900, Tomoya MORINAGA wrote:
> >>
> >> Signed-off-by: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >
> > 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.

Applied to next, thanks to the follow up patches :)

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2012-04-20 20:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26  5:55 [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address Tomoya MORINAGA
2012-03-26  5:55 ` [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs Tomoya MORINAGA
     [not found]   ` <1332741325-7746-2-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-03-26  6:34     ` [PATCH 2/3 v2] " Tomoya MORINAGA
2012-04-18 15:05     ` [PATCH 2/3] " Wolfram Sang
     [not found]       ` <20120418150544.GE19802-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-19  6:19         ` Tomoya MORINAGA
     [not found]           ` <CANKRQng5nb0nU_e1o6TLnvOwPoXX1C_bJguNyjrsVfo+mubKaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-20 20:37             ` Wolfram Sang [this message]
     [not found] ` <1332741325-7746-1-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-03-26  5:55   ` [PATCH 3/3] i2c-eg20t: change timeout value 50msec to 1000msec Tomoya MORINAGA
     [not found]     ` <1332741325-7746-3-git-send-email-tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-18 15:00       ` Wolfram Sang
2012-04-18 14:58   ` [PATCH 1/3] i2c-eg20t: Modify MODULE_AUTHOR's email address Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120420203712.GA12691@pengutronix.de \
    --to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=alexander.stein-93q1YBGzJSMe9JSWTWOYM3xStJ4P+DSV@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=qi.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).