From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>, Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org
Subject: Re: [PATCH 1/3] i2c-cht-wc: Add locking to interrupt / smbus_xfer functions
Date: Mon, 14 Aug 2017 23:35:59 +0300 [thread overview]
Message-ID: <1502742959.25945.3.camel@linux.intel.com> (raw)
In-Reply-To: <20170814201726.21045-2-hdegoede@redhat.com>
On Mon, 2017-08-14 at 22:17 +0200, Hans de Goede wrote:
> Although unlikely without locking the smbux_xfer function may miss
> the nack flag and further fixes in this patch-set add some more
> complex constructions which need protection.
> - if (read_write == I2C_SMBUS_READ) {
> + ret = 0;
> + mutex_lock(&adap->adap_lock);
> + if (adap->nack)
> + ret = -EIO;
> + else if (read_write == I2C_SMBUS_READ) {
> ret = regmap_read(adap->regmap, CHT_WC_I2C_RDDATA,
> ®);
> - if (ret)
> - return ret;
> -
> data->byte = reg;
Can this be moved out to keep logic the same (don't dirt data on error)?
> }
> + mutex_unlock(&adap->adap_lock);
>
> - return 0;
> + return ret;
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2017-08-14 20:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 20:17 [PATCH 0/3] i2c-cht-wc: Various fixes Hans de Goede
2017-08-14 20:17 ` [PATCH 1/3] i2c-cht-wc: Add locking to interrupt / smbus_xfer functions Hans de Goede
2017-08-14 20:35 ` Andy Shevchenko [this message]
2017-08-14 20:55 ` Hans de Goede
2017-08-17 16:16 ` Wolfram Sang
2017-08-14 20:17 ` [PATCH 2/3] i2c-cht-wc: Ack read irqs after reading the data register Hans de Goede
2017-08-17 16:16 ` Wolfram Sang
2017-08-14 20:17 ` [PATCH 3/3] i2c-cht-wc: Workaround CHT GPIO controller IRQ issues Hans de Goede
2017-08-17 16:16 ` 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=1502742959.25945.3.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=linux-i2c@vger.kernel.org \
--cc=wsa@the-dreams.de \
/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).