Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp257990rdb; Thu, 19 Oct 2023 03:52:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxTaiSQ4n9pfjD9qOLebn1Z4UKUIG+C7IYmK/w2oo+sHfxthxrySrcIzw9ZbPC9yu4AWRq X-Received: by 2002:a17:90a:744b:b0:274:616e:3fc4 with SMTP id o11-20020a17090a744b00b00274616e3fc4mr1634039pjk.34.1697712755090; Thu, 19 Oct 2023 03:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697712755; cv=none; d=google.com; s=arc-20160816; b=jWpX3T0GaJiKTQH4nIprzhreY1yqhRkjM0RYQ7SjRx2QpuV2mGlPhGNYNkR2fTbRvG iEO/YwvZy2hkJi2ED87dNq/FOD9IBBvCXm/28qbMsIJ+uYYDbchtnuD2X+5CNVffGexO WL2pGiO68UFL7xyAJsrLGZtLRttafnE/T2qpwe9ERknUVW4iAecdoAYqKHMASuhaUCL8 6jkAqOZEi8+H/jnxx39ckz5DpTmqfXTTVy6u82ySwwsF/hJVPlpEVgySJrT7whGeE2EL lKpOsuHQyylgmLHqT6748zpgttbKW3F6Xe/D8slVNZH6QViWXSOdwHPiR2AfBdxBFvDy UZnw== 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=4vn2qTuJ4FMIBqYzk8TDUMcHnK95Skh+1SwGKuf95iQ=; fh=BoVYoAFI1iRbZ2eX1ZNPoM+PNPd59D/uWyBb45AGOBc=; b=QJg4uqicx/pXzzFbhmgyolf/R9enyhkj0N++rzsgUtFfmmlngDwcDfhE6cTBeAJJsJ bDKcpZid0PHVxq45n06lFrg6JdeU9mLViVC5Bfrdj5WEACBW1/pbKMqGPXaOqa0BYhZo gz+B9JPW6ZRSv4bjiU/CL2nrx6Lt24bReoCAIHvT+o6bEnrtjTZV5r5uv1VjP9wz+Sdk fNnTVo3nYJCcyvXE6mqDvqneOn4UsT53notKt0JDhlmpAZN//YfiKDTvE8OCeK9O88sc HMhzBsgrOa9e1UlLfHD380w7SQxfHa0cyEZR/YK7CsHo3yZ2tv6VwIpqfMtNm6c1GWvI L59g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b18-20020a6567d2000000b005b3e6867a01si4163520pgs.427.2023.10.19.03.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 03:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B880E81822F5; Thu, 19 Oct 2023 03:52:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345187AbjJSKwV (ORCPT + 99 others); Thu, 19 Oct 2023 06:52:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232678AbjJSKwT (ORCPT ); Thu, 19 Oct 2023 06:52:19 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B779134 for ; Thu, 19 Oct 2023 03:52:17 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qtQcb-0002Wd-GE; Thu, 19 Oct 2023 12:51:21 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtQcZ-002lnZ-81; Thu, 19 Oct 2023 12:51:19 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qtQcY-001W9b-T9; Thu, 19 Oct 2023 12:51:18 +0200 Date: Thu, 19 Oct 2023 12:51:18 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Hans de Goede Cc: Sean Young , linux-media@vger.kernel.org, linux-pwm@vger.kernel.org, Ivaylo Dimitrov , Thierry Reding , Jonathan Corbet , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Javier Martinez Canillas , Jean Delvare , Guenter Roeck , Support Opensource , Dmitry Torokhov , Pavel Machek , Lee Jones , Mauro Carvalho Chehab , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , Mark Gross , Liam Girdwood , Mark Brown , Daniel Thompson , Jingoo Han , Helge Deller , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org Subject: Re: [PATCH v3 1/3] pwm: make it possible to apply pwm changes in atomic context Message-ID: <20231019105118.64gdzzixwqrztjir@pengutronix.de> References: <90728c06-4c6c-b3d2-4723-c24711be2fa5@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yn2iyczv5acooknv" Content-Disposition: inline In-Reply-To: <90728c06-4c6c-b3d2-4723-c24711be2fa5@redhat.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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 03:52:32 -0700 (PDT) --yn2iyczv5acooknv Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 18, 2023 at 03:57:48PM +0200, Hans de Goede wrote: > Hi Sean, >=20 > On 10/17/23 11:17, Sean Young wrote: > > Some drivers require sleeping, for example if the pwm device is connect= ed > > over i2c. The pwm-ir-tx requires precise timing, and sleeping causes ha= voc > > with the generated IR signal when sleeping occurs. > >=20 > > This patch makes it possible to use pwm when the driver does not sleep, > > by introducing the pwm_can_sleep() function. > >=20 > > Signed-off-by: Sean Young >=20 > I have no objection to this patch by itself, but it seems a bit > of unnecessary churn to change all current callers of pwm_apply_state() > to a new API. The idea is to improve the semantic of the function name, see https://lore.kernel.org/linux-pwm/20231013180449.mcdmklbsz2rlymzz@pengutron= ix.de for more context. I think it's very subjective if you consider this churn or not. While it's nice to have every caller converted in a single step, I'd go for #define pwm_apply_state(pwm, state) pwm_apply_cansleep(pwm, state) , keep that macro for a while and convert all users step by step. This way we don't needlessly break oot code and the changes to convert to the new API can go via their usual trees without time pressure. > Why not just keep pwm_apply_state() as is and introduce a new > pwm_apply_state_atomic() for callers which want to apply state > in a case where sleeping is not allowed ? There is a big spontaneous growth of function name patterns. I didn't claim having done a complete research, but not using a suffix for the fast variant and _cansleep for the sleeping one at least aligns to how the gpio subsystem names things. Grepping a bit more: - regmap has: regmap_might_sleep() and struct regmap::can_sleep The actual API doesn't have different functions to differentiate sleeping and non-sleeping calls. (Though there is regmap_read_poll_timeout_atomic().) - kmap() + kmap_atomic() - set_pte() + set_pte_atomic() - There is scmi_is_transport_atomic() and scmi_handle::is_transport_atomic= () (Is this also about sleeping?) - There are quite a lot more symbols ending in _atomic and in _cansleep, but several of them don't exists to differentiate a slow and a fast procedure. (e.g. drm_mode_atomic) Not entirely sure what to read out of that. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --yn2iyczv5acooknv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmUxCiUACgkQj4D7WH0S /k4jlwgAgQS/Vm8QPoZFBjT4W6JQXxJRPwUsXBOa7whQZfAYqlzZZ35+WjXKug70 1nq/INcUz96H0aYtK2aHLUeOEQH+cDau32nAM9dYk0S4qWXOEgC1gFbPwGTrF1SE gEPMEkOMezwBlon9ik8cPddAGP5rDSXD8YKeiGy5O6gbXi/iKChFxnamOn5K7B+j mgPy/pP0tTP79r0tsVIKta7hnJ1uGfv8cWRQqvPTyT9YuEiBfKRzgi7rxXq9gH2X DS+SMO7jtBXFEl5kzKsw1oKpR5VqInvebeBJHSnsH3T/sXAuyJj379046bjbKq7c rp0jBis0JVqrfUguEpnfRBuxuTilXQ== =OvnQ -----END PGP SIGNATURE----- --yn2iyczv5acooknv--