On Tue, Sep 29, 2020 at 07:37:21PM +0300, Andy Shevchenko wrote: > On Sat, Sep 26, 2020 at 12:32 AM Jonathan Neuschäfer > <j.neuschaefer@xxxxxxx> wrote: > > On Fri, Sep 25, 2020 at 12:29:45PM +0300, Andy Shevchenko wrote: > > > On Thu, Sep 24, 2020 at 10:26 PM Jonathan Neuschäfer > > > <j.neuschaefer@xxxxxxx> wrote: > > ... > > > > > + dev_alert(&poweroff_restart_client->dev, > > > > + "Failed to power off (err = %d)\n", res); > > > > > > alert? This needs to be explained. > > > > I copied the dev_alert from drivers/mfd/rn5t618.c. > > > > Upon reconsideration, I'm not sure what the correct log level would be, > > but _warn seems enough, or maybe _err is better > > It's up to you to decide, but crit/alert and similar has to be > justified (commit message / comment in the code). Alright, thanks for explaining. > > > > + /* > > > > + * NOTE: The lower half of the reset value is not sent, because sending > > > > + * it causes an error > > > > > > Why? Any root cause? Perhaps you need to send 0xffff ? > > > > Unknown, because I don't have the EC firmware for analysis. The vendor > > kernel sends 0xff00 and gets an error. > > > > Sending 0xffff doesn't help. > > Maybe a slightly elaborated comment that it's copied from the vendor > kernel (which is?). Good idea, I'll do that. > ... > > > > > + dev_info(ec->dev, > > > > + "Netronix embedded controller version %04x detected.\n", > > > > + version); > > > > > > This info level may confuse users if followed by an error path. > > > > Right. I suppose printing incompatible versions is still useful, so how > > about something like the following? > > > > > > /* Bail out if we encounter an unknown firmware version */ > > switch (version) { > > case 0xd726: /* found in Kobo Aura */ > > dev_info(ec->dev, > > "Netronix embedded controller version %04x detected.\n", > > version); > > break; > > default: > > dev_err(ec->dev, > > "Netronix embedded controller version %04x is not supported.\n", > > version); > > return -ENODEV; > > } > > This is better. > > ... > > > > > + WARN_ON(poweroff_restart_client); > > > > > > WARN_ON? All these alerts, WARNs, BUGs must be explained. Screaming to > > > the user is not good if it wasn't justified. > > > > poweroff_restart_client being already set is not a situation that should > > happen (and would indicate a bug in this driver, AFAICT), but I guess > > the log message could be better in that case... > > As per above. Okay, I'll rework the dev_alert/WARN_ON parts. Thanks, Jonathan Neuschäfer
Attachment:
signature.asc
Description: PGP signature