From: Yingjoe Chen <yingjoe.chen@mediatek.com>
To: Eddie Huang <eddie.huang@mediatek.com>, u.kleine-koenig@pengutronix.de
Cc: Mark Rutland <mark.rutland@arm.com>,
Wolfram Sang <wsa@the-dreams.de>,
Andrew Bresticker <abrestic@chromium.org>,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
Lee Jones <lee.jones@linaro.org>, Jean Delvare <jdelvare@suse.de>,
Xudong Chen <xudong.chen@mediatek.com>,
Boris BREZILLON <boris.brezillon@free-electrons.com>,
Arnd Bergmann <arnd@arndb.de>,
yh.chen@mediatek.com, Wei Yan <sledge.yanwei@huawei.com>,
Bjorn Andersson <bjorn.andersson@sonymobile.com>,
Grant Likely <grant.likely@linaro.org>,
devicetree@vger.kernel.org, Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Beniamino Galvani <b.galvani@gmail.com>,
Neelesh Gupta <neelegup@linux.vnet.ibm.com>,
Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-arm-kernel@lists.infradead.org,
srv_heupstream@mediatek.comAnders Berg <and>
Subject: Re: [PATCH v4 2/2] I2C: mediatek: Add driver for MediaTek I2C controller
Date: Wed, 21 Jan 2015 14:30:09 +0800 [thread overview]
Message-ID: <1421821809.11671.117.camel@mtksdaap41> (raw)
In-Reply-To: <1421810004.15468.825.camel@mtksdaap41>
Hi Uwe,
Thanks for your review,
On Wed, 2015-01-21 at 11:13 +0800, Eddie Huang wrote:
<...>
> > > + ret = -EINVAL;
> > > + goto err_exit;
> > > + }
> > > +
> > > + if (msgs->buf == NULL) {
> > > + dev_dbg(i2c->dev, " data buffer is NULL.\n");
> > > + ret = -EINVAL;
> > > + goto err_exit;
> > > + }
> > > +
> > > + i2c->addr = msgs->addr;
> > > + i2c->msg_len = msgs->len;
> > > + i2c->msg_buf = msgs->buf;
> > > +
> > > + if (msgs->flags & I2C_M_RD)
> > > + i2c->op = I2C_MASTER_RD;
> > > + else
> > > + i2c->op = I2C_MASTER_WR;
> > > +
> > > + /* combined two messages into one transaction */
> > > + if (num > 1) {
> > > + i2c->msg_aux_len = (msgs + 1)->len;
> > > + i2c->op = I2C_MASTER_WRRD;
> > > + }
> > This means "write then read", right? You should check here that the
> > first message is really a write and the 2nd a read then.
> > Can this happen at all with the quirks defined below (.max_num_msgs =
> > 1)?
> Yes, mean write then read. Indeed, add check is better.
> If msg number is 1, means normal write or read, not "write then read".
The quirks will increase the message count and check 'write then read'
for us. We don't have to add check here.
<...>
> > > +static int mtk_i2c_remove(struct platform_device *pdev)
> > > +{
> > > + struct mtk_i2c *i2c = platform_get_drvdata(pdev);
> > > +
> > > + i2c_del_adapter(&i2c->adap);
> > > + free_i2c_dma_bufs(i2c);
> > > + platform_set_drvdata(pdev, NULL);
> > > +
> > Here you need to make sure that no irq is running when i2c_del_adapter
> > is called.
> OK, add check here
I thought after i2c_del_adapter() is complete, all i2c_transfer for this
adapter is completed. If this is true, then i2c clock is already off and
we won't have any on-going transfer/pending irq.
Joe.C
next prev parent reply other threads:[~2015-01-21 6:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 10:33 [PATCH v4 0/2] ARM: mediatek: Add driver for Mediatek I2C controller Eddie Huang
2015-01-16 10:33 ` [PATCH v4 1/2] dt-bindings: Add I2C bindings for mt65xx/mt81xx Eddie Huang
[not found] ` <1421404418-50718-1-git-send-email-eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-01-16 10:33 ` [PATCH v4 2/2] I2C: mediatek: Add driver for MediaTek I2C controller Eddie Huang
[not found] ` <1421404418-50718-3-git-send-email-eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-01-18 10:18 ` Uwe Kleine-König
[not found] ` <20150118101816.GF22880-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-01-21 3:13 ` Eddie Huang
2015-01-21 6:30 ` Yingjoe Chen [this message]
2015-01-21 8:15 ` Uwe Kleine-König
[not found] ` <20150121081519.GS22880-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-01-21 12:49 ` Yingjoe Chen
2015-01-21 15:31 ` Uwe Kleine-König
[not found] ` <20150121153131.GV22880-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-01-22 1:30 ` Yingjoe Chen
2015-01-21 8:20 ` Uwe Kleine-König
[not found] ` <20150121082022.GT22880-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-01-21 8:34 ` Eddie Huang
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=1421821809.11671.117.camel@mtksdaap41 \
--to=yingjoe.chen@mediatek.com \
--cc=abrestic@chromium.org \
--cc=arnd@arndb.de \
--cc=b.galvani@gmail.com \
--cc=bjorn.andersson@sonymobile.com \
--cc=boris.brezillon@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=eddie.huang@mediatek.com \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jdelvare@suse.de \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=neelegup@linux.vnet.ibm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sledge.yanwei@huawei.com \
--cc=srv_heupstream@mediatek.comAnders \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wsa@the-dreams.de \
--cc=xudong.chen@mediatek.com \
--cc=yh.chen@mediatek.com \
/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).