From patchwork Wed Nov 30 15:21:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13060032 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7A68C4332F for ; Wed, 30 Nov 2022 15:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=quoPwBldRaKfC9e9vzo1Og3F9fWf4LVLKYCE6Xfl0Dc=; b=IveF7HbjtwIIfI Szcz+RDV3Qt19siKzvul09OdDIK/RKuXb+wbuUYMOdI09JyhfDTR1jgYITj7fXFmm2fWwl2fMxBHe HfGFjuBpTkZ0oC49DYaULuW7Z9Nw8F+cT3w4KLTtMtQffFVO3+sZH0Zuw07rHOufXjx6tqjaPEkXG spp3PxsS554woUYG6SpEV2FgJWvjdVxRU7nAklwpviTsM9gQU5nznwiUAL8OtOgSNeOWTu0fKL7xp TM6OgIV9MtYSHCECgAABbx+bx7dnxLDZMVjTHCchU+JAfI+2hHt7xm/RnGHycxfzs7LRlXJP1LZ8B pSB0IjxsIIPtN/H2ctqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0OxS-00HOTX-O2; Wed, 30 Nov 2022 15:25:10 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0OvO-00HNH3-3t for linux-riscv@lists.infradead.org; Wed, 30 Nov 2022 15:23:04 +0000 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 1p0OuS-00009r-WF; Wed, 30 Nov 2022 16:22:05 +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 1p0OuI-001LdM-Fl; Wed, 30 Nov 2022 16:21:55 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1p0OuI-001VqY-Bk; Wed, 30 Nov 2022 16:21:54 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding Cc: Conor Dooley , Linus Walleij , Bartosz Golaszewski , Douglas Anderson , Pavel Machek , Claudiu Beznea , Nicolas Ferre , Alexandre Belloni , Ray Jui , Scott Branden , Broadcom internal kernel review list , Benson Leung , Guenter Roeck , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , Florian Fainelli , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Michael Walle , Orson Zhai , Baolin Wang , Chunyan Zhang , Fabrice Gasnier , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Samuel Holland , Hammer Hsieh , Nobuhiro Iwamatsu , Sean Anderson , Michal Simek , Bjorn Andersson , Stephen Boyd , Matthias Kaehlcke , Satya Priya , linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-sunxi@lists.linux.dev, Steven Rostedt , Masami Hiramatsu , Marijn Suijten Subject: [PATCH v2 00/11] pwm: Allow .get_state to fail Date: Wed, 30 Nov 2022 16:21:37 +0100 Message-Id: <20221130152148.2769768-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4201; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=OJndCEVt3aO3P0WDGIcSb4svVqFYr4L7BRkc05e7KK8=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBjh3TeeKE42zO/dADA8GIRueUo9ayiBLrzlu5BRvEE w4nESiyJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCY4d03gAKCRDB/BR4rcrsCSMiB/ 9P92eEh5i/ykm3IhBfm7shzbMkb/wG7nDkc+vvv70Z73UbyxFvKLzsJ+xK5VXqTCLlo8DUkfo9BJPh gr8T1RvP6HUtOELqCuQE6ruqv9wlN28AYIytMCoO+QvOqLdbM84LW89W1fK1B6ImECmggYrGw60CXE f7Rv+b9z4cETy+dLsOSVyQ0zsix7/7HyoqlinRbwr3R1SJewjSjU++PJ6H8LCe6DcYMwdJkpBaC2Ol hVLwWlo1eF82Cow8M5bd0+XSEZXpG5oFaf6CebgL+JYlfUHRWLzOpJpq6RAXCmfilUqisk0cROhhop q2OYuXh1amqkiMJYz8hRni9/YulIOt X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221130_072302_354140_677559EF X-CRM114-Status: GOOD ( 19.01 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Hello, I forgot about this series and was remembered when I talked to Conor Dooley about how .get_state() should behave in an error case. Compared to (implicit) v1, sent with Message-Id: 20220916151506.298488-1-u.kleine-koenig@pengutronix.de I changed: - Patch #1 which does the prototype change now just adds "return 0" to all implementations and so gets simpler and doesn't change behaviour. The adaptions to the different .get_state() implementations are split out into individual patches to ease review. - One minor inconsistency fixed in "pwm: Handle .get_state() failures" that I noticed while looking into this patch. - I skipped changing sun4i.c as I don't know how to handle the error there. Someone might want to have a look. (That's not ideal, but it's not worse than the same issue before this series.) In v1 Thierry had the concern: | That raises the question about what to do in these cases. If we return | an error, that could potentially throw off consumers. So perhaps the | closest would be to return a disabled PWM? Or perhaps it'd be up to the | consumer to provide some fallback configuration for invalidly configured | or unconfigured PWMs. .get_state() is only called in pwm_device_request on a pwm_state that a consumer might see. Before my series a consumer might have seen a partial modified pwm_state (because .get_state() might have modified .period, then stumbled and returned silently). The last patch ensures that this partial modification isn't given out to the consumer. Instead they now see the same as if .get_state wasn't implemented at all. Best regards Uwe Uwe Kleine-König (11): pwm: Make .get_state() callback return an error code pwm/tracing: Also record trace events for failed API calls drm/bridge: ti-sn65dsi86: Propagate errors in .get_state() to the caller leds: qcom-lpg: Propagate errors in .get_state() to the caller pwm: crc: Propagate errors in .get_state() to the caller pwm: cros-ec: Propagate errors in .get_state() to the caller pwm: imx27: Propagate errors in .get_state() to the caller pwm: mtk-disp: Propagate errors in .get_state() to the caller pwm: rockchip: Propagate errors in .get_state() to the caller pwm: sprd: Propagate errors in .get_state() to the caller pwm: Handle .get_state() failures drivers/gpio/gpio-mvebu.c | 9 ++++++--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 14 ++++++++------ drivers/leds/rgb/leds-qcom-lpg.c | 14 ++++++++------ drivers/pwm/core.c | 28 +++++++++++++++++---------- drivers/pwm/pwm-atmel.c | 6 ++++-- drivers/pwm/pwm-bcm-iproc.c | 8 +++++--- drivers/pwm/pwm-crc.c | 10 ++++++---- drivers/pwm/pwm-cros-ec.c | 8 +++++--- drivers/pwm/pwm-dwc.c | 6 ++++-- drivers/pwm/pwm-hibvt.c | 6 ++++-- drivers/pwm/pwm-imx-tpm.c | 8 +++++--- drivers/pwm/pwm-imx27.c | 8 +++++--- drivers/pwm/pwm-intel-lgm.c | 6 ++++-- drivers/pwm/pwm-iqs620a.c | 6 ++++-- drivers/pwm/pwm-keembay.c | 6 ++++-- drivers/pwm/pwm-lpss.c | 6 ++++-- drivers/pwm/pwm-meson.c | 8 +++++--- drivers/pwm/pwm-mtk-disp.c | 12 +++++++----- drivers/pwm/pwm-pca9685.c | 8 +++++--- drivers/pwm/pwm-raspberrypi-poe.c | 8 +++++--- drivers/pwm/pwm-rockchip.c | 12 +++++++----- drivers/pwm/pwm-sifive.c | 6 ++++-- drivers/pwm/pwm-sl28cpld.c | 8 +++++--- drivers/pwm/pwm-sprd.c | 8 +++++--- drivers/pwm/pwm-stm32-lp.c | 8 +++++--- drivers/pwm/pwm-sun4i.c | 12 +++++++----- drivers/pwm/pwm-sunplus.c | 6 ++++-- drivers/pwm/pwm-visconti.c | 6 ++++-- drivers/pwm/pwm-xilinx.c | 8 +++++--- include/linux/pwm.h | 4 ++-- include/trace/events/pwm.h | 20 +++++++++---------- 31 files changed, 174 insertions(+), 109 deletions(-) base-commit: 50315945d178eebec4e8e2c50c265767ddb926eb Acked-by: Conor Dooley