public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jan Dabros <jsd@semihalf.com>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com,
	wsa@kernel.org, rrangel@chromium.org, mw@semihalf.com,
	jaz@semihalf.com, upstream@semihalf.com
Subject: Re: [RFC 1/2] i2c: designware: Add missing locks
Date: Thu, 23 Dec 2021 17:50:02 +0200	[thread overview]
Message-ID: <YcSaqmlI7l4H1lsN@smile.fi.intel.com> (raw)
In-Reply-To: <20211222094558.2098791-2-jsd@semihalf.com>

On Wed, Dec 22, 2021 at 10:45:57AM +0100, Jan Dabros wrote:
> All accesses to controller's registers should be protected on
> probe, disable and xfer paths. This is needed for i2c bus controllers
> that are shared with but not controlled by kernel.

...

> +	ret = i2c_dw_acquire_lock(dev);
> +	if (ret)
> +		return ret;
> +
>  	ret = regmap_read(dev->map, DW_IC_COMP_PARAM_1, &param);
>  	if (ret)
>  		return ret;
> +	i2c_dw_release_lock(dev);

Not sure this part is fully correct. Please, fix the leakage.

...

> +	ret = i2c_dw_acquire_lock(dev);
> +	if (ret)
> +		return;
>  
>  	/* Disable controller */
>  	__i2c_dw_disable(dev);
> @@ -614,6 +624,8 @@ void i2c_dw_disable(struct dw_i2c_dev *dev)
>  	/* Disable all interrupts */
>  	regmap_write(dev->map, DW_IC_INTR_MASK, 0);
>  	regmap_read(dev->map, DW_IC_CLR_INTR, &dummy);

> +	i2c_dw_release_lock(dev);

Not enough context here, bu I believe there is the same issue(s).

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2021-12-23 15:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22  9:45 [RFC 0/2] i2c-designware: Add support for AMD PSP semaphore Jan Dabros
2021-12-22  9:45 ` [RFC 1/2] i2c: designware: Add missing locks Jan Dabros
2021-12-23 14:29   ` Jarkko Nikula
2021-12-23 15:50   ` Andy Shevchenko [this message]
2021-12-27  7:17     ` Jan Dąbroś
2021-12-22  9:45 ` [RFC 2/2] i2c: designware: Add AMD PSP I2C bus support Jan Dabros
2021-12-23 14:37   ` Jarkko Nikula
2021-12-27 11:34     ` Jan Dąbroś
2021-12-22 11:46 ` [RFC 0/2] i2c-designware: Add support for AMD PSP semaphore Andy Shevchenko
2021-12-22 17:56   ` Serge Semin
2021-12-22 18:21     ` Andy Shevchenko
2021-12-22 21:51       ` Jan Dąbroś
2021-12-25 15:58 ` Andy Shevchenko
2021-12-27  7:00   ` Jan Dąbroś

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=YcSaqmlI7l4H1lsN@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jaz@semihalf.com \
    --cc=jsd@semihalf.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mw@semihalf.com \
    --cc=rrangel@chromium.org \
    --cc=upstream@semihalf.com \
    --cc=wsa@kernel.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