From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 2/4] watchdog: implement generic support for .running device parameter
Date: Fri, 8 Nov 2019 12:04:39 +0100 [thread overview]
Message-ID: <07bbcbf6-e955-f700-2bbc-c79a07188481@pengutronix.de> (raw)
In-Reply-To: <20191105111859.wvtd3vnm62l532qk@pengutronix.de>
On 11/5/19 12:18 PM, Sascha Hauer wrote:
> On Tue, Nov 05, 2019 at 12:10:51PM +0100, Ahmad Fatoum wrote:
>> On 11/5/19 11:46 AM, Ahmad Fatoum wrote:
>>> Hi,
>>>
>>> On 11/5/19 11:40 AM, Sascha Hauer wrote:
>>>> When we just started the watchdog we actually know that it is running,
>>>> so we could support the parameter for all watchdogs once it's started.
>>
>> I'll do this.
>>
>>>> Casting p->value to (struct watchdog *) seems wrong. However, this
>>>> function shouldn't be needed, see below.
>>
>> It's well-defined, but ye, it feels a bit wrong.
>>
>>>>> +
>>>>> static int watchdog_register_dev(struct watchdog *wd, const char *name, int id)
>>>>> {
>>>>> wd->dev.parent = wd->hwdev;
>>>>> @@ -162,6 +184,15 @@ int watchdog_register(struct watchdog *wd)
>>>>> if (ret)
>>>>> return ret;
>>>>>
>>>>> + if (test_bit(WDOG_HW_RUNNING_SUPPORTED, &wd->status)) {
>>>>> + p = dev_add_param(&wd->dev, "running", NULL,
>>>>> + watchdog_get_running, PARAM_FLAG_RO);
>>>>> + if (IS_ERR(p))
>>>>> + return PTR_ERR(p);
>>>>> +
>>>>> + p->value = (char *)wd;
>>>>> + }
>>>>
>>>> How about adding this parameter unconditionally, with "unknown" as value
>>>> when WDOG_HW_RUNNING_SUPPORTED is not set. You can use
>>>> dev_add_param_enum() here.
>>
>> Thinking about it, I'd rather not use dev_add_param_enum here. I would like
>> to leave the driver-side API not too different from Linux, i.e. status bits
>> that can be set. If I use dev_add_param_enum, I'll have to add a new struct
>> member for every new status bit.
>
> Not for every bit, but for every flag you want to export as a parameter.
> But where's the problem with that?
Ok, sent v3 with your suggestions incorporated.
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-11-08 11:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 22:14 [PATCH v2 1/4] watchdog: always populate watchdog priority from device tree if possible Ahmad Fatoum
2019-11-04 22:14 ` [PATCH v2 2/4] watchdog: implement generic support for .running device parameter Ahmad Fatoum
2019-11-05 10:40 ` Sascha Hauer
2019-11-05 10:46 ` Ahmad Fatoum
2019-11-05 10:51 ` Sascha Hauer
2019-11-05 11:10 ` Ahmad Fatoum
2019-11-05 11:18 ` Sascha Hauer
2019-11-08 11:04 ` Ahmad Fatoum [this message]
2019-11-04 22:14 ` [PATCH v2 3/4] watchdog: imxwd: support .running device parameter on i.MX2+ Ahmad Fatoum
2019-11-04 22:14 ` [PATCH v2 4/4] watchdog: f71808e: support .running device parameter Ahmad Fatoum
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=07bbcbf6-e955-f700-2bbc-c79a07188481@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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