Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3087578pxy; Sun, 25 Apr 2021 13:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh+qdauQZ58a3Q8ihazxslXEiLjyh0fmZKt+/SyHCUPdmfWgT1lEKzm4JUOeWhMCu+DeH4 X-Received: by 2002:a17:906:5052:: with SMTP id e18mr15139389ejk.112.1619382806385; Sun, 25 Apr 2021 13:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619382806; cv=none; d=google.com; s=arc-20160816; b=PYLxKvIPThbOLEP9UZObhl4Z0nEiIlV7lSrxnlcIJyU8s42LbuEpTvprCWOVIK8Q0s nds7wpBJyskDdfKCRd21FjeCUcAWx9RruNcQS+OReD1AwA8ZD42fIvyCJFEXQj5xUHI/ 4rw7ZnokqzkrIc0281AMv1FUpMJVN9Ac1CuBUwO+R1RJWFw7Cy+cbkD5W/Vkm6NCiBqu tkfLzmQ9KNc9dGbcPXExwWDI0haDPWa0k5Mf0KDHOigSeupXW5jHa20k6YzXOc4jngsz 4W2imiSlZq/EVWsl4P6ej9QE2u/vBTtq+j4lzKyGBtTz9YDUAeOMPFf/vTqXCZpAz1E3 LcAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=gtI0h94x5tGphkdiZjq8qr5sJrIB3twlKR4JtUGcG+o=; b=jkLZJVpZkYHjIZCnX9amTdc/X9a+S4BFvgwuMnON+23oe7Q4cAQ41AExgcZx4mVlFU eXSUYJ8L/dXUWWtCSk4W0GzyevSoH5MCa0RizV9QKmE+sppgVvlPyUTf/j3yIxKc/l6d +pNxPc/IUZRwEhl+gvEP+V31yWsathLbzv8+ebYmpeGaCLi9d/gxMTZOkDJK/uKBt8p5 vB4pIdJAKsh9elETz6XN2zhSD3UjOCcNOXu4KQHRakMr/9CgsFITVcG9wqaQ4fdh3yX4 oWnufd5fwpTCVjnaqoHs6orAwyCOD+WXwef/Mgj6GcAjAV8tzlHyMyBz4ycuSaIcF6WI h4Pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si12315270ejz.47.2021.04.25.13.33.00; Sun, 25 Apr 2021 13:33:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231241AbhDYUb1 (ORCPT + 99 others); Sun, 25 Apr 2021 16:31:27 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:48028 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbhDYUb1 (ORCPT ); Sun, 25 Apr 2021 16:31:27 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id E41181C0B77; Sun, 25 Apr 2021 22:30:45 +0200 (CEST) Date: Sun, 25 Apr 2021 22:30:45 +0200 From: Pavel Machek To: Alexander Sverdlin Cc: linux-leds@vger.kernel.org, Dan Murphy , linux-kernel@vger.kernel.org Subject: Re: [PATCH] leds: trigger: timer: Optionally stop timer trigger on reboot Message-ID: <20210425203045.GB10996@amd> References: <20210213154736.2905933-1-alexander.sverdlin@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="s/l3CgOIzMHHjg/5" Content-Disposition: inline In-Reply-To: <20210213154736.2905933-1-alexander.sverdlin@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --s/l3CgOIzMHHjg/5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > This functionality is similar to heartbeat and activity triggers and > turns the timer-triggered LEDs off right before reboot. It's configurable > via new module parameter "reboot_off" to preserve original behaviour. >=20 > Signed-off-by: Alexander Sverdlin So actual problem this solves that LED stays on during reboot? I'd kind of expect hardware to switch the LEDs off. If hardware does not do that, maybe the driver should? So I'm not sure if it should be done from trigger; but if it is, it really should not be optional. Best regards, Pavel > --- > drivers/leds/trigger/ledtrig-timer.c | 39 +++++++++++++++++++++++++++- > 1 file changed, 38 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/leds/trigger/ledtrig-timer.c b/drivers/leds/trigger/= ledtrig-timer.c > index 7c14983781ee..3eadcb0a629a 100644 > --- a/drivers/leds/trigger/ledtrig-timer.c > +++ b/drivers/leds/trigger/ledtrig-timer.c > @@ -16,6 +16,11 @@ > #include > #include > #include > +#include > + > +static bool reboot_off; > +module_param(reboot_off, bool, 0444); > +MODULE_PARM_DESC(reboot_off, "Switch LED off on reboot"); > =20 > static ssize_t led_delay_on_show(struct device *dev, > struct device_attribute *attr, char *buf) > @@ -97,7 +102,39 @@ static struct led_trigger timer_led_trigger =3D { > .deactivate =3D timer_trig_deactivate, > .groups =3D timer_trig_groups, > }; > -module_led_trigger(timer_led_trigger); > + > +static int timer_reboot_notifier(struct notifier_block *nb, unsigned lon= g code, > + void *unused) > +{ > + led_trigger_unregister(&timer_led_trigger); > + return NOTIFY_DONE; > +} > + > +static struct notifier_block timer_reboot_nb =3D { > + .notifier_call =3D timer_reboot_notifier, > +}; > + > +static int __init timer_trig_init(void) > +{ > + int ret; > + > + ret =3D led_trigger_register(&timer_led_trigger); > + if (ret) > + return ret; > + if (reboot_off) > + register_reboot_notifier(&timer_reboot_nb); > + return 0; > +} > + > +static void __exit timer_trig_exit(void) > +{ > + /* Not afraid of -ENOENT */ > + unregister_reboot_notifier(&timer_reboot_nb); > + led_trigger_unregister(&timer_led_trigger); > +} > + > +module_init(timer_trig_init); > +module_exit(timer_trig_exit); > =20 > MODULE_AUTHOR("Richard Purdie "); > MODULE_DESCRIPTION("Timer LED trigger"); --=20 http://www.livejournal.com/~pavelmachek --s/l3CgOIzMHHjg/5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmCF0XUACgkQMOfwapXb+vLGXwCfT/ZhKdk8kl1vMeqc+MIUdDLY UbcAniseCewwzdeVlpEO3/M668CbNeoH =7h4z -----END PGP SIGNATURE----- --s/l3CgOIzMHHjg/5--