linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.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 22:55:07 +0200	[thread overview]
Message-ID: <d5e73f83-90dd-6bf2-c682-2d8da849fc49@redhat.com> (raw)
In-Reply-To: <1502742959.25945.3.camel@linux.intel.com>

Hi,

On 14-08-17 22:35, Andy Shevchenko wrote:
> 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,
>> &reg);
>> -		if (ret)
>> -			return ret;
>> -
> 
>>   		data->byte = reg;
> 
> Can this be moved out to keep logic the same (don't dirt data on error)?

Setting data on error is not really a problem and this gets
fixed in the next patch in the series where the reading
of the data moves to the irq-handler.

Regards,

Hans

  reply	other threads:[~2017-08-14 20:55 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
2017-08-14 20:55     ` Hans de Goede [this message]
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=d5e73f83-90dd-6bf2-c682-2d8da849fc49@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.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).