From: "Jan Dąbroś" <jsd@semihalf.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-i2c <linux-i2c@vger.kernel.org>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Wolfram Sang <wsa@kernel.org>,
Raul E Rangel <rrangel@chromium.org>,
Marcin Wojtas <mw@semihalf.com>,
Grzegorz Jaszczyk <jaz@semihalf.com>,
upstream@semihalf.com
Subject: Re: [PATCH 1/2] i2c: designware: Add missing locks
Date: Mon, 24 Jan 2022 11:33:27 +0100 [thread overview]
Message-ID: <CAOtMz3ONrgq3QCvMqQHxiQhhaGuEY8PG4hLbFt4r9T9+ALG_iA@mail.gmail.com> (raw)
In-Reply-To: <5bec947e-272b-cfa0-b9b6-4d0d2626153f@redhat.com>
czw., 20 sty 2022 o 12:25 Hans de Goede <hdegoede@redhat.com> napisał(a):
>
> Hi,
>
> On 1/20/22 01:16, 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 controller by kernel.
> >
> > Signed-off-by: Jan Dabros <jsd@semihalf.com>
>
> Thanks, patch looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Thanks!
Best Regards,
Jan
>
>
> Regards,
>
> Hans
>
>
> > ---
> > drivers/i2c/busses/i2c-designware-common.c | 12 ++++++++++++
> > drivers/i2c/busses/i2c-designware-master.c | 6 ++++++
> > 2 files changed, 18 insertions(+)
> >
> > diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
> > index bf2a4920638a..9f8574320eb2 100644
> > --- a/drivers/i2c/busses/i2c-designware-common.c
> > +++ b/drivers/i2c/busses/i2c-designware-common.c
> > @@ -578,7 +578,12 @@ int i2c_dw_set_fifo_size(struct dw_i2c_dev *dev)
> > * Try to detect the FIFO depth if not set by interface driver,
> > * the depth could be from 2 to 256 from HW spec.
> > */
> > + ret = i2c_dw_acquire_lock(dev);
> > + if (ret)
> > + return ret;
> > +
> > ret = regmap_read(dev->map, DW_IC_COMP_PARAM_1, ¶m);
> > + i2c_dw_release_lock(dev);
> > if (ret)
> > return ret;
> >
> > @@ -607,6 +612,11 @@ u32 i2c_dw_func(struct i2c_adapter *adap)
> > void i2c_dw_disable(struct dw_i2c_dev *dev)
> > {
> > u32 dummy;
> > + int ret;
> > +
> > + 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);
> > }
> >
> > void i2c_dw_disable_int(struct dw_i2c_dev *dev)
> > diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
> > index 9177463c2cbb..1a4b23556db3 100644
> > --- a/drivers/i2c/busses/i2c-designware-master.c
> > +++ b/drivers/i2c/busses/i2c-designware-master.c
> > @@ -905,7 +905,13 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
> > irq_flags = IRQF_SHARED | IRQF_COND_SUSPEND;
> > }
> >
> > + ret = i2c_dw_acquire_lock(dev);
> > + if (ret)
> > + return ret;
> > +
> > i2c_dw_disable_int(dev);
> > + i2c_dw_release_lock(dev);
> > +
> > ret = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr, irq_flags,
> > dev_name(dev->dev), dev);
> > if (ret) {
> >
>
next prev parent reply other threads:[~2022-01-24 10:33 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 0:16 [PATCH 0/2] i2c-designware: Add support for AMD PSP semaphore Jan Dabros
2022-01-20 0:16 ` [PATCH 1/2] i2c: designware: Add missing locks Jan Dabros
2022-01-20 11:25 ` Hans de Goede
2022-01-24 10:33 ` Jan Dąbroś [this message]
2022-01-28 14:48 ` [PATCH v2 0/2] i2c-designware: Add support for AMD PSP semaphore Jan Dabros
2022-01-28 14:48 ` [PATCH v2 1/2] i2c: designware: Add missing locks Jan Dabros
2022-01-28 14:48 ` [PATCH v2 2/2] i2c: designware: Add AMD PSP I2C bus support Jan Dabros
2022-01-28 14:59 ` Jan Dąbroś
2022-01-28 15:49 ` Andy Shevchenko
2022-01-31 12:10 ` Jan Dąbroś
[not found] ` <CAOtMz3Oryr7mmRKf+secix_6=ZD_Lq+pMUoP=5T6AS6BPoqyQw@mail.gmail.com>
2022-01-31 13:31 ` Andy Shevchenko
2022-02-02 14:42 ` Jan Dąbroś
2022-01-28 14:58 ` [PATCH v2 0/2] i2c-designware: Add support for AMD PSP semaphore Jan Dąbroś
2022-02-02 14:43 ` [PATCH v3 " Jan Dabros
2022-02-02 14:43 ` [PATCH v3 2/2] i2c: designware: Add AMD PSP I2C bus support Jan Dabros
2022-02-02 16:13 ` Andy Shevchenko
2022-02-07 8:27 ` Jan Dąbroś
2022-02-07 11:41 ` Andy Shevchenko
2022-02-08 14:15 ` Jan Dąbroś
2022-02-07 14:25 ` Wolfram Sang
2022-02-08 14:13 ` Jan Dąbroś
2022-02-02 22:49 ` Limonciello, Mario
2022-02-03 10:41 ` Andy Shevchenko
2022-02-03 11:52 ` Jan Dąbroś
2022-01-20 0:16 ` [PATCH " Jan Dabros
2022-01-20 11:44 ` kernel test robot
2022-01-20 11:51 ` Hans de Goede
2022-01-21 9:59 ` Jan Dąbroś
2022-01-21 10:32 ` Hans de Goede
2022-01-21 17:38 ` Limonciello, Mario
2022-01-21 19:18 ` Tom Lendacky
2022-01-24 13:42 ` Jan Dąbroś
2022-01-26 19:36 ` Limonciello, Mario
2022-01-28 14:47 ` Jan Dąbroś
2022-01-24 12:35 ` Jan Dąbroś
2022-01-24 14:27 ` Hans de Goede
2022-01-20 14:20 ` Andy Shevchenko
2022-01-21 10:20 ` Jan Dąbroś
2022-01-21 17:51 ` Andy Shevchenko
2022-01-28 14:46 ` Jan Dąbroś
2022-01-20 15:33 ` kernel test robot
2022-01-20 17:09 ` Andy Shevchenko
2022-01-28 14:39 ` Jan Dąbroś
2022-01-20 11:15 ` [PATCH 0/2] i2c-designware: Add support for AMD PSP semaphore Hans de Goede
2022-01-20 12:29 ` Jan Dąbroś
2022-01-20 15:57 ` Hans de Goede
2022-01-21 10:27 ` 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=CAOtMz3ONrgq3QCvMqQHxiQhhaGuEY8PG4hLbFt4r9T9+ALG_iA@mail.gmail.com \
--to=jsd@semihalf.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jaz@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;
as well as URLs for NNTP newsgroup(s).