From: Felipe Balbi <felipe.balbi@nokia.com>
To: ext Amit Kucheria <amit.kucheria@verdurent.com>
Cc: List Linux Kernel <linux-kernel@vger.kernel.org>,
Samuel Ortiz <sameo@linux.intel.com>,
List Linux Omap <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] mfd: twl4030: clarify the return value for read and write
Date: Wed, 2 Dec 2009 15:41:44 +0200 [thread overview]
Message-ID: <20091202134144.GL1361@nokia.com> (raw)
In-Reply-To: <1259760678-18707-1-git-send-email-amit.kucheria@verdurent.com>
Hi,
On Wed, Dec 02, 2009 at 02:31:18PM +0100, ext Amit Kucheria wrote:
>@@ -298,10 +298,12 @@ int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
> ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 1);
> mutex_unlock(&twl->xfer_lock);
>
>- /* i2cTransfer returns num messages.translate it pls.. */
>- if (ret >= 0)
>- ret = 0;
>- return ret;
>+ /* i2c_transfer returns number of messages transferred */
>+ if (ret != 1) {
>+ pr_err("%s: twl4030_i2c_write failed to transfer all messages\n", DRIVER_NAME);
this line is over 80-chars
>+ return ret;
>+ } else
you should have {} here as well.
>+ return 0;
> }
> EXPORT_SYMBOL(twl4030_i2c_write);
>
>@@ -350,10 +352,13 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
> ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 2);
> mutex_unlock(&twl->xfer_lock);
>
>- /* i2cTransfer returns num messages.translate it pls.. */
>- if (ret >= 0)
>- ret = 0;
>- return ret;
>+ /* i2c_transfer returns number of messages transferred */
>+ if (ret != 2) {
>+ pr_err("%s: twl4030_i2c_read failed to transfer all messages\n", DRIVER_NAME);
over 80-chars
>+ return ret;
>+ }
>+ else
} else {
>+ return 0;
}
--
balbi
next prev parent reply other threads:[~2009-12-02 13:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 13:31 [PATCH] mfd: twl4030: clarify the return value for read and write Amit Kucheria
2009-12-02 13:41 ` Felipe Balbi [this message]
2009-12-02 14:00 ` [PATCHv2] " Amit Kucheria
2009-12-02 15:05 ` Gadiyar, Anand
2009-12-07 12:17 ` [PATCH 1/1] " Amit Kucheria
2009-12-07 13:53 ` Eduardo Valentin
2009-12-11 10:36 ` Samuel Ortiz
2009-12-11 10:53 ` Eduardo Valentin
2009-12-11 12:11 ` Samuel Ortiz
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=20091202134144.GL1361@nokia.com \
--to=felipe.balbi@nokia.com \
--cc=amit.kucheria@verdurent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=sameo@linux.intel.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