Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2698773rwb; Fri, 9 Dec 2022 05:26:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7o+CdPoiumSXUw+jsQ5D/5jevnakToBu2Ri6GLtcrQ33wJsoXxoQNsV5PuhmEx+4S94vGc X-Received: by 2002:a17:906:b091:b0:7ae:bfec:74c7 with SMTP id x17-20020a170906b09100b007aebfec74c7mr5283787ejy.72.1670592417354; Fri, 09 Dec 2022 05:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670592417; cv=none; d=google.com; s=arc-20160816; b=twXUCMlSbXNVLjw2Hg8QRmbA6UriBMHFYWKU0bL/tVjxvYexsoOujDJqGjh5NO8E0d GWV9sct+YPH06jGUwKoEFzXpAXct7o01s8DGyersmsVjP1QQ2ryVgyf2wXtoarEyr6u5 wgiAGVsYcjoVeK6/PcvIiiurqhSejATNyyLsb/rO7Clc9YujyWuGs6AOiK7SnGAxRZMf iumYWrbSdkRmHd01BGyoli7Oe1B4cBKmkAiO7eIRzRjESaBVrVgwrFyUwydFWskuTMdi OBWEr9y4Zt2QljBDUsR6HpvJCHY0M7PkXugdu5ftq20pPQ5GHGjeIeamFwnV4BboPqLW YQZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=qFZ51NsyaOzjJZHHmkBBvVydv6ms8WJlyx7VwvQ/+c8=; b=0QIXpryNVsFFPoeNK0wP/5oWuSC5Xh/d4LPd2ByJIGW0W5bs1SP561IelW8QGeAbR2 biEYK6nmt94Mxxg23zyT3Gx5UrPgulKmJkxAYdtx/AR0VgIJ+pIORve+0uaRvg/NuB/G suEysGFZ8o06/pIlgQUInyR6OlWDDLEBsuZbipi08Ps6RGQ3G0S4eu7DcmkNk7Aveum9 FZLQPbo+j5x+UUBfPCb23dPQ5i+U6TD0Nf5EOZW1UYsxrZSuj1lPPU7QgPLJVg1MGers r8n7GUsZpPErIov0jS04xkV80jHgNW7vTtiliAEMgB6CJcqI0DC9+3QlfjSdcQCY4523 VO9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb13-20020a170907070d00b007ae2dfe020bsi1172318ejb.783.2022.12.09.05.26.38; Fri, 09 Dec 2022 05:26:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229779AbiLIMlO (ORCPT + 75 others); Fri, 9 Dec 2022 07:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiLIMlL (ORCPT ); Fri, 9 Dec 2022 07:41:11 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA16066CBF for ; Fri, 9 Dec 2022 04:41:10 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p3cgW-0003Sv-Hx; Fri, 09 Dec 2022 13:41:00 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1p3cgU-003Mfi-7i; Fri, 09 Dec 2022 13:40:59 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1p3cgU-003lnM-7P; Fri, 09 Dec 2022 13:40:58 +0100 Date: Fri, 9 Dec 2022 13:40:58 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Qingtao Cao Cc: Qingtao Cao , Pavel Machek , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] leds: ledtrig-tty.c: call led_set_brightness() when the blocking callback is not available Message-ID: <20221209124058.dwez7wohs7dfeiik@pengutronix.de> References: <20221209001039.7287-1-qingtao.cao@digi.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="565mh7mmkut75gk2" Content-Disposition: inline In-Reply-To: <20221209001039.7287-1-qingtao.cao@digi.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --565mh7mmkut75gk2 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 09, 2022 at 10:10:38AM +1000, Qingtao Cao wrote: > The Marvell GPIO controller's driver will setup its struct gpio_chip's ca= n_sleep > false, making create_gpio_led() setting up the brightness_set function po= inter > instead of the brightness_set_blocking function pointer. In this case the > nonblocking version led_set_brightness() should be fallen back on by ledt= rig_tty_work() >=20 > Signed-off-by: Qingtao Cao > --- > drivers/leds/trigger/ledtrig-tty.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/le= dtrig-tty.c > index f62db7e520b5..e43d285b5d06 100644 > --- a/drivers/leds/trigger/ledtrig-tty.c > +++ b/drivers/leds/trigger/ledtrig-tty.c > @@ -122,12 +122,18 @@ static void ledtrig_tty_work(struct work_struct *wo= rk) > =20 > if (icount.rx !=3D trigger_data->rx || > icount.tx !=3D trigger_data->tx) { > - led_set_brightness_sync(trigger_data->led_cdev, LED_ON); > + if (trigger_data->led_cdev->brightness_set_blocking) > + led_set_brightness_sync(trigger_data->led_cdev, LED_ON); > + else if (trigger_data->led_cdev->brightness_set) > + led_set_brightness(trigger_data->led_cdev, LED_ON); I had similar issues in the past where a function call worked for sleeping LEDs but not atomic ones (or the other way around? Don't remember the details.) I wonder if there isn't a function that does the right thing no matter what type the LED is. The other triggers should have the same issue, and doing the above check in all of them just looks wrong. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --565mh7mmkut75gk2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmOTLNcACgkQwfwUeK3K 7AncHgf+MX7UU32R1xOxDn2kHRK45G5QRz1Iog0wvmFwNW3dXft+e8rrIm66X897 xAc6AleuqAM2Hos8NGFAsehr3StUD1yXSvtR3wAxKCJ3USmF26DOMAXsCZe6UoPb Shu1sFSeZApZQRdvWHJxI1OXanh1CjfEbar4i6YLsqa4saGlQ+3tbVVqX75Z8F1O J0fWjZk0LO4a0rsaThYj7qPymqm7VsDDuEVfIMiatH3tIOL5PxfUqm/SRenpPDlF jJw49kf6xiw6GAJCWdHh3ke3Fo8L0tte+iUpYDLOyW/QOpyxr0akm81Ylc/1Wpnp 4QGxcs+BQiVBFxIV27xyy+8h8+N0Pw== =2hSk -----END PGP SIGNATURE----- --565mh7mmkut75gk2--