From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7908DC4727C for ; Tue, 29 Sep 2020 16:37:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 160EF208B8 for ; Tue, 29 Sep 2020 16:37:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mMzxQvjL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728186AbgI2Qhl (ORCPT ); Tue, 29 Sep 2020 12:37:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728184AbgI2Qhl (ORCPT ); Tue, 29 Sep 2020 12:37:41 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEA7FC061755; Tue, 29 Sep 2020 09:37:40 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id jw11so2950412pjb.0; Tue, 29 Sep 2020 09:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tg5f8r5u/C7h4zTCABx8TCIEL7vsD7cEWgNSNx1Mhuo=; b=mMzxQvjL29Mh9yG57bCHo7dUr7BOU1mi5S7nRbttYY7qjpEtgyB3th6JKvs04eLZpD bh1InFSWp/G9PLsIwwV7KNWy/n6UOR1S07EU87EwmcT8rJ+fyEQfQC0pvCCMmtBTmLHG UrA0dz164V3sVMRVinQXq3o7e0+3WYj5EEePB6e9WimQJ7sZd2WBOdPrAGcIiVT+OtC5 QGf7hXTxUyc5W2F2kMvrCl5PrnByNb+GrZLatlCcQbQI4NeohOxJy6Mou4s5orbOWctl hU2+4OJ1CZf+APEJEIGwP8F7MxU2ILjNVscUd9h2NsS9+8csPUh2ANMVEPYXb8NKHenx +ovg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tg5f8r5u/C7h4zTCABx8TCIEL7vsD7cEWgNSNx1Mhuo=; b=YYtisWy8rzkYuF9VdIg4yAR9SivXQ4p7mWENJspVud4FtTUuMfRwpsakr7SqR+ocPz 4lmYnkwTj7exc+xOS6DnIebbv6F2jt/HCDM9CmYzlxCxoD9mHB/q6zSbmLbCLVMP1/+f mdh4gAf323ImNVotNPF3xKea2AgTzgAMWlq/a73fpihshDDhxCaLQnIH6q/woaArsxDB 0oKIDnW5zZKwHhNxnq6jyXmIOWepbfnBUuuRvKp4J3cuBtkxpbYybI7BrD/Vbn+MK6nM FspfhXG6AKicEgqiLvH7JiE4QENJOaAHU7n4f8ERspCowDi2fodXCC0s/MpZOd0xyEP9 buug== X-Gm-Message-State: AOAM531FiQlPaSE6aaSSfq21YgLmoX/LfVK0/S7XtFQ1Um0BmlgFIS+U qWhhwaLqFxP7kD6gsJZ//ugeP98tYmPtMagX00Y= X-Google-Smtp-Source: ABdhPJzZ2MWu7BgoxsmDjhQpS0GWZbywEzkmOKzpwIhLoaMANgTMAtb9GN0oR97r5Kd5jzUPLjGd6xvp9GBlEWkoC5E= X-Received: by 2002:a17:90b:fc4:: with SMTP id gd4mr4713204pjb.129.1601397460322; Tue, 29 Sep 2020 09:37:40 -0700 (PDT) MIME-Version: 1.0 References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> <20200924192455.2484005-4-j.neuschaefer@gmx.net> <20200925213207.GA2510@latitude> In-Reply-To: <20200925213207.GA2510@latitude> From: Andy Shevchenko Date: Tue, 29 Sep 2020 19:37:21 +0300 Message-ID: Subject: Re: [PATCH v3 3/7] mfd: Add base driver for Netronix embedded controller To: =?UTF-8?Q?Jonathan_Neusch=C3=A4fer?= Cc: Linux Kernel Mailing List , Lee Jones , Rob Herring , Thierry Reding , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Alessandro Zummo , Alexandre Belloni , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Sam Ravnborg , Linus Walleij , Heiko Stuebner , Stephan Gerhold , Lubomir Rintel , Mark Brown , allen , Mauro Carvalho Chehab , "David S. Miller" , devicetree , linux-pwm@vger.kernel.org, "open list:REAL TIME CLOCK (RTC) SUBSYSTEM" , linux-arm Mailing List , Heiko Stuebner , Josua Mayer , Andreas Kemnade , Arnd Bergmann , Daniel Palmer Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Sat, Sep 26, 2020 at 12:32 AM Jonathan Neusch=C3=A4fer 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=C3=A4fer > > wrote: ... > > > + dev_alert(&poweroff_restart_client->dev, > > > + "Failed to power off (err =3D %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). ... > > > + /* > > > + * NOTE: The lower half of the reset value is not sent, becau= se 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?). > > > + */ ... > > > + 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 detect= ed.\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. --=20 With Best Regards, Andy Shevchenko