From patchwork Sun Mar 10 13:47:19 2024 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: 13588128 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 20002C54791 for ; Sun, 10 Mar 2024 13:48:01 +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:References:In-Reply-To: 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: List-Owner; bh=Ea9It+JzGgFLGRZbqEllGJ0mQTo7voXnXa1yjom8C4g=; b=iXZcdI8IQAZ91W QAO7yt8JUIIA80cH7jVAfhhLYQLRl61SaZjZE1x0h39PrMC+qLZTdTu1p+lvKfNPz98w01IcWZGOw zsgaNU0Cd9NQELo79nQ77kl1L8h78aRoq/KeKM/kiqC8MS1cdXOAaoHPA/8eTy3mjMa+nuRpU3iHw Zd9+jMh/HouJYJne3H5Z/++FdCvllP0TDKpFWl5MD4Jbn5Pu6H2iP+UYtHCJ/HWJGrkDVishk4WWC /NcvYAHFv5EDk6dr1a/bkfpeSYeN/wu7lu6Q/2kSLE3+KJ4+D4Fwxdu8RkYrvL6sfCYY3MJCjGLMk oJzaYne2BIvzuwKwo5aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjJWg-0000000FsZ1-3P28; Sun, 10 Mar 2024 13:47:42 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjJWc-0000000FsXM-1QeA for linux-arm-kernel@lists.infradead.org; Sun, 10 Mar 2024 13:47:40 +0000 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 1rjJWX-0000xB-7v; Sun, 10 Mar 2024 14:47:33 +0100 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 1rjJWW-005WrI-RJ; Sun, 10 Mar 2024 14:47:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rjJWW-003SK3-2Q; Sun, 10 Mar 2024 14:47:32 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Florian Fainelli , Ray Jui , Scott Branden Cc: Broadcom internal kernel review list , linux-pwm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 1/2] pwm: bcm2835: Introduce a local variable for &pdev->dev Date: Sun, 10 Mar 2024 14:47:19 +0100 Message-ID: <3f302472e30e21c7ef5624a1d0a2890d9fdf3c7f.1710078146.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2289; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=mmw8koG/ZtiJc4H8TwSRcAGvWLX/ZD4CZUW4WDksnuA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl7bnqwhgoFRD6Z6wGsqlOWltW+ttEgVDMRpBnV xnm0jypV36JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZe256gAKCRCPgPtYfRL+ Tvm7CACibulWA51FwQr+TDupOZs7Xnpd1uqBTeEOXabfpYjQr3tfR3+ggOB4x4FsFskNC7sYnSh jhw0TsXEjQ+T/qVop8wX9STJ1r7OvxjqGqHruhlo/9PmR8sudjfB5QzAb2Xb9/HU/HcXTD9PhrQ QojDywcrYqo/98ZhfPruxvMBivRZg4/vfnUx0IHOLsRXexlfAjlQAcXFp+iA9RLcRUzkMsUcOmD imYdyJE39hkwXqkdHeXtm0mq2p0sXmyFaPahmrRd2KYUNNGvnbo62tqogZ25mXCpkFAU4tdvaxf 1566prKYGUK6Uxsvc7n+ySFtfTbroC6FxKUZu3VBGFMxyvwb 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240310_064739_175944_82DCB2B0 X-CRM114-Status: GOOD ( 13.54 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org &pdev->dev is used several times in bcm2835_pwm_probe(). Introduce a local variable to simplify all usages. Signed-off-by: Uwe Kleine-König Reviewed-by: Florian Fainelli --- drivers/pwm/pwm-bcm2835.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c index aa35acbb0cbc..3d0c089c9ef0 100644 --- a/drivers/pwm/pwm-bcm2835.c +++ b/drivers/pwm/pwm-bcm2835.c @@ -133,11 +133,12 @@ static void devm_clk_rate_exclusive_put(void *data) static int bcm2835_pwm_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct pwm_chip *chip; struct bcm2835_pwm *pc; int ret; - chip = devm_pwmchip_alloc(&pdev->dev, 2, sizeof(*pc)); + chip = devm_pwmchip_alloc(dev, 2, sizeof(*pc)); if (IS_ERR(chip)) return PTR_ERR(chip); pc = to_bcm2835_pwm(chip); @@ -146,24 +147,24 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) if (IS_ERR(pc->base)) return PTR_ERR(pc->base); - pc->clk = devm_clk_get_enabled(&pdev->dev, NULL); + pc->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(pc->clk)) - return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk), + return dev_err_probe(dev, PTR_ERR(pc->clk), "clock not found\n"); ret = clk_rate_exclusive_get(pc->clk); if (ret) - return dev_err_probe(&pdev->dev, ret, + return dev_err_probe(dev, ret, "fail to get exclusive rate\n"); - ret = devm_add_action_or_reset(&pdev->dev, devm_clk_rate_exclusive_put, + ret = devm_add_action_or_reset(dev, devm_clk_rate_exclusive_put, pc->clk); if (ret) return ret; pc->rate = clk_get_rate(pc->clk); if (!pc->rate) - return dev_err_probe(&pdev->dev, -EINVAL, + return dev_err_probe(dev, -EINVAL, "failed to get clock rate\n"); chip->ops = &bcm2835_pwm_ops; @@ -171,10 +172,9 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pc); - ret = devm_pwmchip_add(&pdev->dev, chip); + ret = devm_pwmchip_add(dev, chip); if (ret < 0) - return dev_err_probe(&pdev->dev, ret, - "failed to add pwmchip\n"); + return dev_err_probe(dev, ret, "failed to add pwmchip\n"); return 0; } From patchwork Sun Mar 10 13:47:20 2024 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: 13588127 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 70C9CC54E58 for ; Sun, 10 Mar 2024 13:48:00 +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:References:In-Reply-To: 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: List-Owner; bh=+lejULq9q8QfdipiiUmf8ChYlQ28BLd5rR1PzLcFEtU=; b=m2tA3IOvNezYBP U6Mtt5vqQNB89dlt/abtMRH2dWruZU1fcZSEXDd6W6M7F67haaaKbdaRneAHqZiHIORke3qay46lM 0IU9DZYrbS30oWmFF7WVerD9BKpjNdHjMlTMme1dqNy+1VOOdgaphqaus3D7Hex2NcqvWBQNIwd7K tVLgeFwwgLpVJaA9zS+6uHRpfNC7uENOYQ9X62z/iA90uVkjhDYyemvLTEX3BzOTULvuxZ6duJT4L oCtuxaWgCIoNRlTG4U1XQg2U3dKt3a0YMziRrZJySm/IoEz1+/Ey7h6d459UpJuPQgO9FO+xxRFr5 RLt/z7w1uW+/7msifn/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjJWi-0000000FsZT-1Dnz; Sun, 10 Mar 2024 13:47:44 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjJWd-0000000FsXT-1Kte for linux-arm-kernel@lists.infradead.org; Sun, 10 Mar 2024 13:47:41 +0000 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 1rjJWY-0000zS-Hz; Sun, 10 Mar 2024 14:47:34 +0100 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 1rjJWY-005WrM-5F; Sun, 10 Mar 2024 14:47:34 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rjJWY-003SKC-0E; Sun, 10 Mar 2024 14:47:34 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Florian Fainelli , Ray Jui , Scott Branden Cc: Broadcom internal kernel review list , linux-pwm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 2/2] pwm: bcm2835: Drop open coded variant of devm_clk_rate_exclusive_get() Date: Sun, 10 Mar 2024 14:47:20 +0100 Message-ID: <8e1a5151a7bcd455996c873bb3d13ab86def3490.1710078146.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1472; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=79AmYYZEOLbzvbNiEIIV8+diN3zkJyqKVCdZ4iuPKdU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl7bnrmLEyB+GTwBPINh8dcmnkHqGw5+Zd/jTs4 cHZN1/kvyWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZe256wAKCRCPgPtYfRL+ Tjw6CACdSW2/oqMiil35Ct2BPwBxq3vQ9/ihg0LsM6L0MzzZLnj2Il8lBgyORX2peNbWFGF81gE ttppqD01XO6sNlq8tR06RieweKXpBX5RGR04QL9+6p/TqONzTl4bl9ansGLmwDv1E+cy74zBtot roNFXz1yD90c1hsITRmucRONsNqGQRcvlvdA39dijiUHIt9i69ofzfgtf03QACwdj1N5SDBWv+D /obKJM8Vy5l7KcFOggyA3ug9kQGnumrcgSvtRth8fd6Sf4P7n6oQkFqQJHnUiVCi+efZSGpnLI5 IiHo++qviX4hQgRGswJCPZRDNpLdLVVDIStAZgRAm4JUXm46 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240310_064739_416393_07FFF20C X-CRM114-Status: GOOD ( 13.08 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit b0cde62e4c54 ("clk: Add a devm variant of clk_rate_exclusive_get()") the clk subsystem provides devm_clk_rate_exclusive_get(). Replace the open coded implementation by the new function. Signed-off-by: Uwe Kleine-König Reviewed-by: Florian Fainelli --- drivers/pwm/pwm-bcm2835.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c index 3d0c089c9ef0..578e95e0296c 100644 --- a/drivers/pwm/pwm-bcm2835.c +++ b/drivers/pwm/pwm-bcm2835.c @@ -124,13 +124,6 @@ static const struct pwm_ops bcm2835_pwm_ops = { .apply = bcm2835_pwm_apply, }; -static void devm_clk_rate_exclusive_put(void *data) -{ - struct clk *clk = data; - - clk_rate_exclusive_put(clk); -} - static int bcm2835_pwm_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -152,16 +145,11 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(pc->clk), "clock not found\n"); - ret = clk_rate_exclusive_get(pc->clk); + ret = devm_clk_rate_exclusive_get(dev, pc->clk); if (ret) return dev_err_probe(dev, ret, "fail to get exclusive rate\n"); - ret = devm_add_action_or_reset(dev, devm_clk_rate_exclusive_put, - pc->clk); - if (ret) - return ret; - pc->rate = clk_get_rate(pc->clk); if (!pc->rate) return dev_err_probe(dev, -EINVAL,