From: Marco Felsch <m.felsch@pengutronix.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: support.opensource@diasemi.com, contact@stefanchrist.eu,
Adam.Thomson.Opensource@diasemi.com,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
Subject: Re: [PATCH] watchdog: da9062: make restart handler atomic safe
Date: Tue, 14 Jan 2020 18:30:36 +0100 [thread overview]
Message-ID: <20200114173036.ueepbqf54yzh26lm@pengutronix.de> (raw)
In-Reply-To: <20200113202809.GA21484@roeck-us.net>
Hi,
On 20-01-13 12:28, Guenter Roeck wrote:
> On Mon, Jan 13, 2020 at 10:15:21AM +0100, Marco Felsch wrote:
> > The restart handler is executed during the shutdown phase which is
> > atomic/irq-less. The i2c framework supports atomic transfers since
> > commit 63b96983a5dd ("i2c: core: introduce callbacks for atomic
> > transfers") but unfortunately the regmap framework doesn't support it
> > yet. Hard coding the i2c stuff can be done without worries since the
> > DA9062 is an i2c-only device.
> >
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> > Hi,
> >
> > This patch is based on Stefan Lengfeld's RFC Patch [1].
> >
> > [1] https://patchwork.ozlabs.org/patch/1085942/
> > ---
> > drivers/watchdog/da9062_wdt.c | 15 +++++++++++----
> > 1 file changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> > index c9b9d6394525..84c5a0a455b2 100644
> > --- a/drivers/watchdog/da9062_wdt.c
> > +++ b/drivers/watchdog/da9062_wdt.c
> > @@ -11,6 +11,7 @@
> > #include <linux/platform_device.h>
> > #include <linux/uaccess.h>
> > #include <linux/slab.h>
> > +#include <linux/i2c.h>
> > #include <linux/delay.h>
> > #include <linux/jiffies.h>
> > #include <linux/mfd/da9062/registers.h>
> > @@ -149,12 +150,18 @@ static int da9062_wdt_restart(struct watchdog_device *wdd, unsigned long action,
> > void *data)
> > {
> > struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
> > + struct i2c_client *client = to_i2c_client(wdt->hw->dev);
> > + u8 buf[] = {DA9062AA_CONTROL_F, DA9062AA_SHUTDOWN_MASK};
> > + struct i2c_msg msg = {
> > + .addr = client->addr,
> > + .flags = 0,
> > + .len = sizeof(buf),
> > + .buf = buf,
> > + };
> > int ret;
> >
> > - ret = regmap_write(wdt->hw->regmap,
> > - DA9062AA_CONTROL_F,
> > - DA9062AA_SHUTDOWN_MASK);
> > - if (ret)
> > + ret = i2c_transfer(client->adapter, &msg, 1);
>
> Why not i2c_smbus_write_byte_data() ? I don't immediately see the difference.
Because I didn't noticed it, sorry. I changed it and notice no
differences. Thanks for the review =)
Regards,
Marco
> Guenter
>
> > + if (ret < 0)
> > dev_alert(wdt->hw->dev, "Failed to shutdown (err = %d)\n",
> > ret);
> >
> > --
> > 2.20.1
> >
next prev parent reply other threads:[~2020-01-14 17:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-13 9:15 [PATCH] watchdog: da9062: make restart handler atomic safe Marco Felsch
2020-01-13 20:28 ` Guenter Roeck
2020-01-14 17:30 ` Marco Felsch [this message]
2020-01-14 20:00 ` Stefan Lengfeld
2020-01-15 7:19 ` Marco Felsch
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=20200114173036.ueepbqf54yzh26lm@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=Adam.Thomson.Opensource@diasemi.com \
--cc=contact@stefanchrist.eu \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=support.opensource@diasemi.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;
as well as URLs for NNTP newsgroup(s).