Re: [PATCH v2 06/16] watchdog: hpwdt: drop warning after calling watchdog_init_timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 17, 2019 at 12:17:02AM +0200, Wolfram Sang wrote:
> On Tue, Apr 16, 2019 at 02:20:46PM -0700, Guenter Roeck wrote:
> > On Tue, Apr 16, 2019 at 10:55:33PM +0200, Wolfram Sang wrote:
> > > 
> > > > That is indeed a problem: the pointer will be NULL if there is no parent
> > > > device (such as in softdog.c). Otherwise it should never be NULL.
> > > 
> > > Okay, this spoils my err_dev solution. So, we probably go this route
> > > then:
> > > 
> > > 	pr_<errlvl>("watchdog%d: <err_msg>\n", wdd->id);
> > > 
> > 
> > I don't like it because it doesn't show the driver name, and watchdog%d
> > can change with each reboot. How about something like this ?
> > 
> > static void pr_wdt_err(struct watchdog_device *wdd, char *text, int err)
> > {
> > 	if (wdd->parent)
> > 		dev_err(wdd->parent, "%s: %d\n", text, err);
> > 	else
> > 		pr_err("%s: %s: %d\n", wdd->info->identity, text, err);
> > }
> > 
> > We could then use the same mechanism to generate error messages for
> > watchdog_register_device().
> 
> 'text' is a constant string then. Supporting a format string will make
> this much more complicated. Yet, printing out the wrong timeout is
> useful, I think.
> 
> What about:
> 
> 	dev_str = wdd->parent ? dev_name(wdd->parent) : wdd->info->identity;
> 	pr_<errlvl>("%s: <errstr>\n", dev_str, ...);
> 
Yes, that works as well. Note that it will actually print something like
"watchdog: <device>: ..." due to the pr_fmt() at the top of watchdog_core.c.
I guess that should be ok.

Guenter



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux