From patchwork Thu Jan 25 12:08:27 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: 13530843 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 8D9F9C47258 for ; Thu, 25 Jan 2024 13:50:32 +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=HX8RSs8vliLIgyryAnvkgRy4rQAk+x6tZYfxAO6ifPg=; b=ulVJkzoSBAAbwv Zz8za+Aq8Yh8+MaNwBGIEFl2dfJgOOzeq5Ak/jIHeW5HlcfZQhOkMGY+mRhDJedzJhPqIz/mQHtaq bH2lNGdKL2H7NZACm4ka5Bawz7JplUbvFqKw4BWYvXDlJyQQU1h7Z8NBWGikfquhVyoCyk2+WnC8Q dZ4c77kUILrpgLu5btdBxjVB++8CWyd83X1k3ZJ1M5AkP08D09xrMrp2iaKBYRCDtA936vpAyVVWk DCGKyjQAbG9skqwOqQw6x9+z4oSCC+plVLxR664tlmCVFjFkYFwE6Og+YGU8IyBmD+Zh0irSIAt5b zIWdh4aEf5SjvxsMfSew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07Z-0000000087V-2DEQ; Thu, 25 Jan 2024 13:50:21 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07R-0000000084A-2XmV for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 13:50:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=BsBCwtWGqzFu1VHoVIwHSt9EG9C1K/fyqqr4EubQSjo=; b=P7CGGkO/L5gNbNQDovGceuoG6r /OLCb2N+COwaah6ZQGuWglGP4qxg8XPDVZbNwyZJz+g7TTowGhakRaH9ZuSpXxfcknVXmbRxiyX7I c1udErCJ7VM0Qs7LDlCAxxpmBD29Sj804TmnOnMhOixJDmVh8HqB+O8LiwqV1R+kiwvprZsvvR5bb tVsyjFDAE0Ho6/SzoOH58PFgnhN08gow2n/2BcebE23lXqCJ/wMDOPRSww56gTWJSJXUWKhBii741 N1FrgyfgFJwa15z4EPg+StARayCmls5zZ0VFdDzqCQasuuQpA9X9iQ7XUajXBI0CQ67vNMaNstTAC kgcVDhCg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybQ-00000005Hfj-2qpX for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:09 +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 1rSyZ8-0003Zp-BR; Thu, 25 Jan 2024 13:10:42 +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 1rSyZ6-002HP1-Rn; Thu, 25 Jan 2024 13:10:40 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZ6-007myO-2W; Thu, 25 Jan 2024 13:10:40 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Claudiu Beznea , Nicolas Ferre , Alexandre Belloni , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 005/111] pwm: atmel: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:27 +0100 Message-ID: <33b1da62f00242be38a5804ef046f2c7f65402c9.1706182805.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=2827; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=toAW/efX1boJm8BkufsQI2RsQDbOMmC1WhC5mdC1O8Y=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk8/hWYPV9wcyN0d9t8ww6T4FARCszgsYBCgd CrF7YrXrrGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPPwAKCRCPgPtYfRL+ Tmh0CACRtfusaeNOqY7cy6oTyJOATo3TYMTHD5EXWKMMaoGM06TJMW3Kj0fPD36eiIQLj+CMu37 80xpkLPTapUWmzUsEcJeEo2LUzTa78QFB7gEy9zd212aaVOTv9T69Osy50/1tv93PZH4QkewnvQ Q/3xFgqKFIpRtEs5e6Jm9v8iCuiKPS1m1kftHe4QdYz+lGyWMdxafSb7vmb7i/IIykiuw1kGrlY 275IHrB0qllB+FAK4GqgP6ZIrMcFvS/iIDRI0lLcFCJKEf/DdP6czXOQT+bb2hQpWV93SQQjajd 7nGL25GeKWtR7V53jMEwYC5SeqRB/6WddmZyyS6FCCMj3eo5 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-20240125_121304_790814_FEC7BF76 X-CRM114-Status: GOOD ( 16.79 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-atmel.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index 47bcc8a3bf9d..4ef91fe6f147 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c @@ -210,7 +210,7 @@ static int atmel_pwm_calculate_cprd_and_pres(struct pwm_chip *chip, shift = fls(cycles) - atmel_pwm->data->cfg.period_bits; if (shift > PWM_MAX_PRES) { - dev_err(chip->dev, "pres exceeds the maximum value\n"); + dev_err(pwmchip_parent(chip), "pres exceeds the maximum value\n"); return -EINVAL; } else if (shift > 0) { *pres = shift; @@ -321,7 +321,7 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ret = atmel_pwm_calculate_cprd_and_pres(chip, clkrate, state, &cprd, &pres); if (ret) { - dev_err(chip->dev, + dev_err(pwmchip_parent(chip), "failed to calculate cprd and prescaler\n"); return ret; } @@ -333,7 +333,7 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, } else { ret = clk_enable(atmel_pwm->clk); if (ret) { - dev_err(chip->dev, "failed to enable clock\n"); + dev_err(pwmchip_parent(chip), "failed to enable clock\n"); return ret; } } @@ -462,8 +462,9 @@ static const struct of_device_id atmel_pwm_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids); -static int atmel_pwm_enable_clk_if_on(struct atmel_pwm_chip *atmel_pwm, bool on) +static int atmel_pwm_enable_clk_if_on(struct pwm_chip *chip, bool on) { + struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip); unsigned int i, cnt = 0; unsigned long sr; int ret = 0; @@ -480,7 +481,7 @@ static int atmel_pwm_enable_clk_if_on(struct atmel_pwm_chip *atmel_pwm, bool on) for (i = 0; i < cnt; i++) { ret = clk_enable(atmel_pwm->clk); if (ret) { - dev_err(atmel_pwm->chip.dev, + dev_err(pwmchip_parent(chip), "failed to enable clock for pwm %pe\n", ERR_PTR(ret)); @@ -525,7 +526,7 @@ static int atmel_pwm_probe(struct platform_device *pdev) atmel_pwm->chip.ops = &atmel_pwm_ops; atmel_pwm->chip.npwm = 4; - ret = atmel_pwm_enable_clk_if_on(atmel_pwm, true); + ret = atmel_pwm_enable_clk_if_on(&atmel_pwm->chip, true); if (ret < 0) return ret; @@ -538,7 +539,7 @@ static int atmel_pwm_probe(struct platform_device *pdev) return 0; disable_clk: - atmel_pwm_enable_clk_if_on(atmel_pwm, false); + atmel_pwm_enable_clk_if_on(&atmel_pwm->chip, false); return ret; } From patchwork Thu Jan 25 12:08:28 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: 13530902 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 D04A8C4828A for ; Thu, 25 Jan 2024 14:10:52 +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=C9Lil3X4LF308mGTJEarGcZtocvTbZw5/FqMC1ppJk8=; b=PKRoxsNjn15b2X gT34mZ/T3QroB3IWv55ozbkuAMl+Qr8vtGYmg4T4OSl13OPOBQoBi6voCcDhAYdvbg0+Vt5Q9KA6f GRJG6tKWOkt6Ch0xngvA99//+FwKD0ylz4HmgCEWVIKmJZBhCrrCLGVzILgeAtw61fZi9chqYb/9C 2pkpVqVXgRf+TnSKmBQgYfqUM6f61WAoxfpahGOOqkFODyxHMxtnupTY0UVSep6NnjMzOpxCZsRHp IHc4Gfntv/0WBhKtgyotvZYD6BK4FbSPfT8kqg28WGd3Ba754pB14k5vR1MZ8PpWqmnlSHhHWrOb/ N9Ffc6jKB8JL0Tnh9WBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0RF-00000000GcS-2vc2; Thu, 25 Jan 2024 14:10:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pi-00000000FbC-45BQ for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=z9GRUQ7e0m+XeNNiFGQ8/u8OjqBK+icwYlXJzSsW2yU=; b=dAV6v2TPJXLQ+igsrgYJ5lUzuF 8pWLPrZCG/SMMl7cpRpQjQBmJmqgv6/JzyxAA3quy6ayP3INuHT/qQXsu6oaBYztN1E7XO90PKofQ ZVT8eBpvR/nlm+AhC5sb3TAQsfEeZEBAeZs+46AxXBs9zd0qgmHAOKtnekZ+qOh8s85MkTvkaz8Fk 4/J+ZCLbVEzKdbMU02WNaFpHGuWVrM55iEmXEpYUeAkxhBUi/npmW/iY81FzrgGvSbqwQ9oz1wedT yAMRN32f1dEelcyzRpBYQIKaqzdTTroe9Rgmhiv715ZSdnCkx8c5uxXwlqzB7pOllxdHonULGBS2K JFncJpug==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDT-22ru for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:14 +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 1rSyZ8-0003Zt-BR; Thu, 25 Jan 2024 13:10:42 +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 1rSyZ7-002HP4-1u; Thu, 25 Jan 2024 13:10:41 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZ6-007myS-3A; Thu, 25 Jan 2024 13:10:40 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 006/111] pwm: atmel-tcb: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:28 +0100 Message-ID: <1c39fb0cafbd301da6b5d17d7336f4a1336a52c9.1706182805.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=941; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=eBtQyqLCRtmLfSPQUANukLLiI/iNUzLf98CR7LqcGJo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9AjB23XbPT/nTF6Ff/JCcjexXCQwLeFRLlZ 6ZUhQarPHCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPQAAKCRCPgPtYfRL+ TrT0B/93OcSt0tmFqc4iX9KzQekCQ1RFoSErwDYmvOtNrXx31oq59n/D40lTVVkGzSfgjxT9Two v96FGZd5d9PYlwl9j6c8dIih/cKn4oCiWouncJfUI9s2Mbm5f6G3oKfDXmOrbSl3ibKeZE4MxDI Ynbj+0reG1d5C+D7vsd+ZN2bvJXZAoCq0x7HLsb91UzicMPKpEPuUz46NhktTpvQfIr37kJq8bv oQtqr3KxMBPqZqOmWbvBiMV76iVGbOMHGdl9ioajz0JRwV9grOy5SpWoSYUgOFr9UcuiV5WivTa RChV0Gw8lbXECpVQmvB7CJI1YsRsET1Soam8Z28yoB5R8tow 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-20240125_121309_906826_80C71FC4 X-CRM114-Status: GOOD ( 12.51 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-atmel-tcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c index d42c897cb85e..80121ab81a01 100644 --- a/drivers/pwm/pwm-atmel-tcb.c +++ b/drivers/pwm/pwm-atmel-tcb.c @@ -327,7 +327,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, if ((atcbpwm && atcbpwm->duty > 0 && atcbpwm->duty != atcbpwm->period) && (atcbpwm->div != i || atcbpwm->period != period)) { - dev_err(chip->dev, + dev_err(pwmchip_parent(chip), "failed to configure period_ns: PWM group already configured with a different value\n"); return -EINVAL; } From patchwork Thu Jan 25 12:08:36 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: 13530906 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 B4E61C47258 for ; Thu, 25 Jan 2024 14:10:58 +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=0KMT4Rg/LewQlZmXCaEP7AY2p8tree92do7jumQpnag=; b=jNOaLtYb0N3Gim s2Xu1IHlCnvrvCmKwyO9QjSYyTJL5s4a2g92dbMxRkBhHSi2FeHtRaG4Dfiv3uYP7rcX06+PDxxF2 lz3Q0XuwCqiKrIOsrnesmzubbB17+6ZSsJjeFPW0bWa7BwY2zERD8+z0x/PhdPX/Osj7Z4sI7Na43 pDfY49dItf2Je40NKrHlMTozTFXyS7X7H6ZEN+mNTOfIAN112kD7lJisOeugcNeOY+CDsDGHkb9nk nmD/kINAsyVZK5aOJxWVOn6YwU4FvmW9WHphL0rQl9rVMIbI5LgACkaa1lK1glrQtEAQsyVtVV2Mq kJLBEKKv/pS4qb3QlIPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0RD-00000000GaT-1gk9; Thu, 25 Jan 2024 14:10:39 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pi-00000000FbC-2xor for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=wzx+BzqZF+o9zGx/ghVB4LK+JkEBlp3H4JtUiE4HJmY=; b=c73vOlLTG/S/HYnUgiFhKKeyJT y3ijykF/URZofkuzzbqUTcgWkfCVYKaqTC4UtzB51EeyyrbT8SkfRSpsJuQim4p4mgjyKgxmOorj0 QBX+EC/GdN4m5fJqVbHX8FDyG0/uUMBnq0gAQFpvw+o3McIPrdkMsWjD2lrWCxqtQ3a0ulrkBjQ+m p8/1F1h6BqLN+Ah6cPHT6AI3HlgL11dP8DA3SipeOOtWfmoSnWzemrKPQXcbpg/g+fIoBm4cq4OkA 6RFbTZjLZD09lD0QpXhA+b8zt+YOWaQSjg2jx3aDKClQL3Mxvr+58d6oL8qBdJEq+mq6A52rvAyMs 1bISTzyw==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDR-2KaH for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:14 +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 1rSyZ9-0003gR-D6; Thu, 25 Jan 2024 13:10:43 +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 1rSyZ8-002HPa-Jm; Thu, 25 Jan 2024 13:10:42 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZ8-007mz3-1j; Thu, 25 Jan 2024 13:10:42 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Shawn Guo , Sascha Hauer , linux-pwm@vger.kernel.org Cc: Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 014/111] pwm: imx27: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:36 +0100 Message-ID: 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=1477; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=FjGukNj1cYfdDeJbaFr89/JaJYedpj7bOyWFB1DfTbE=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtRN/l6V/GWyigEb/iTefuf1aK6L1azGyfUZrOuL7CxSM 5vSdD52MhqzMDByMciKKbLYN67JtKqSi+xc++8yzCBWJpApDFycAjARCS72/xFfpuToNHFLdZUs +BL1VFcgS42XnT9nw5UYo/UHY7b9018atnh64P2Sx1kqDj8svO7te39S2ctK9nxypHkk8620fbs Vu2MyAvSfz96jsf3BghiPbOv2rge+JT7mCe739qzPUM81/zlhh/GsdYtvKy/N28R3kffknZh0md fubyXNWB558AeUWLN9kpG9Xvvmm9gvwT2c9zyWbL9p0CY/5T9n+Q+NnesVm20PWqQJTG1RlPhXO HHdinIjcZ2FgvcX/Hj3vn/F3sU979Mc3gpqayX8a7zKl9rqs4JdqM/WbPG3mDMu2mu3NlyK+m+0 YE2UoL/j0clNztOMXmkxnvpvdI75yOKmfQoFE4oaCsR6AA== 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-20240125_121309_969089_938BB908 X-CRM114-Status: GOOD ( 10.67 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-imx27.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c index 7d9bc43f12b0..5d796453519a 100644 --- a/drivers/pwm/pwm-imx27.c +++ b/drivers/pwm/pwm-imx27.c @@ -145,7 +145,7 @@ static int pwm_imx27_get_state(struct pwm_chip *chip, state->polarity = PWM_POLARITY_INVERSED; break; default: - dev_warn(chip->dev, "can't set polarity, output disconnected"); + dev_warn(pwmchip_parent(chip), "can't set polarity, output disconnected"); } prescaler = MX3_PWMCR_PRESCALER_GET(val); @@ -177,7 +177,7 @@ static int pwm_imx27_get_state(struct pwm_chip *chip, static void pwm_imx27_sw_reset(struct pwm_chip *chip) { struct pwm_imx27_chip *imx = to_pwm_imx27_chip(chip); - struct device *dev = chip->dev; + struct device *dev = pwmchip_parent(chip); int wait_count = 0; u32 cr; @@ -196,7 +196,7 @@ static void pwm_imx27_wait_fifo_slot(struct pwm_chip *chip, struct pwm_device *pwm) { struct pwm_imx27_chip *imx = to_pwm_imx27_chip(chip); - struct device *dev = chip->dev; + struct device *dev = pwmchip_parent(chip); unsigned int period_ms; int fifoav; u32 sr; From patchwork Thu Jan 25 12:08:38 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: 13530847 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 15FB5C47258 for ; Thu, 25 Jan 2024 13:51:26 +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=Oj3nSqKIpqSW4/zkTrgeO/FDJPDgWiVFeUl1jRKhD+U=; b=b7a/+ByyXJQwQQ WTuaFZEcomFq3DS2yopLBBUbr8wuzag+il2e89h9WT+FxdQJs+kuRHrd6VEEjd3o6/Q0MPayG5PZy iK9SBc86BSsnUAEDd6GSwyvSIBNdnhaaYFNn9/FvasgaF/4afMao7Yxy2g1ui3B3nGxv1Zsa7U229 JZFIpbfRTlXm9yxjdnAp9g49EUVY+ht/XnKfZQGCWUWIpnE23eiXhStBd3A4KHtR3c6uPaE046P5/ 0nXBPP4IxZz7wzfygi5y2XJG6QmxrA0hpm042sCto0RK6TvhT4PVOInh8E2zJt80m8+4xn9FG4Dwi GiWLGROEcBPoE7g0VeCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT08P-000000008lU-2tS7; Thu, 25 Jan 2024 13:51:13 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07w-000000008Om-0y3A for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 13:50:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=U+sEPW2mra/7BX1+22r/MmdJnegJKugNJVxG+ORUzvc=; b=KRoG7mj4H0h6zIVSTJk/r+f2PG N7mbP9TSfWPJZHvFnaRC6Okgvw+3uoVtUbbq/HTaN66hYxm9bj+3LUeno/7Jy/Khd54ck7bIgcsow wNa7bssU1yVjigGs7AQUAEuAYR5+LAu4AesvsM22IsU+hjeOBRrjAyNBa5PWBZHHsnXRcSWOtB1E2 ZHPzaTXhMqyQhYNYqdnI02p/t/Wb87/oXz4DqUf8m2k/UI8pAIbw2/a8CsEqWdCX8aQLSurOAZ1eF nfyWaxZTP0C7TpJJkWb0KsrnRb1PcT7XcyP9f/B1CxHbXJkio2bEQ2Es7xMwn7Ik+dSBXThXXmfst 69C7O3ew==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybQ-00000005Hfb-2MVd for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:07 +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 1rSyZ9-0003hx-Bz; Thu, 25 Jan 2024 13:10:43 +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 1rSyZ8-002HPh-Ut; Thu, 25 Jan 2024 13:10:42 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZ8-007mzB-2p; Thu, 25 Jan 2024 13:10:42 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Vladimir Zapolskiy , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 016/111] pwm: lpc18xx-sct: Make use of parent device pointer in driver data Date: Thu, 25 Jan 2024 13:08:38 +0100 Message-ID: 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=2273; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=9I6mp43V59KeZtkOb5brm+FGGJoThb3S6V+ToYzCpe4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9MwAszs4qqG1xpjvFD+N8bFQMQi7skhk9rp 5kvuEUR4AWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPTAAKCRCPgPtYfRL+ TkDNB/9JGdinssjbOnuol9/1nla9F1EV08P1WRntSHIOsxptv6q/CgAxVnmeloQ9Zw55QfPS+Is 9/m0SJT+nmPovW8v8r8DWmFGmg6YFhQS9GSPuiYm/ECqXfnTnUgb9OG0sWRxRaUhl8kpGwyeuFY CIMpYh7WqyPFctr/RSv2bvYEOhPzSfYzDyQRdGqmLsLo3eE/6mfdY1eGcGkaqwZvdwSiOfCt+bI Yokv1NndTg1UKs1KRydWorUmuzwt1HH9O8uhcgixdchT4kZ4J5HUn4sSuSK326I02Z4JERbJ0so yitgngTcL/n2KMx8bd/gr28GX+EOp4S67Uvdk8uEsiQ/jrlf 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-20240125_121304_711910_D78B560F X-CRM114-Status: GOOD ( 17.00 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, make use of the already existing pointer to the parent device in driver data. However rename the pointer to "parent" for consistency with other drivers. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-lpc18xx-sct.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index fe891fa71a1d..1d2d342c05fd 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -92,7 +92,7 @@ struct lpc18xx_pwm_data { }; struct lpc18xx_pwm_chip { - struct device *dev; + struct device *parent; struct pwm_chip chip; void __iomem *base; struct clk *pwm_clk; @@ -198,7 +198,7 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, if (period_ns < lpc18xx_pwm->min_period_ns || period_ns > lpc18xx_pwm->max_period_ns) { - dev_err(chip->dev, "period %d not in range\n", period_ns); + dev_err(lpc18xx_pwm->parent, "period %d not in range\n", period_ns); return -ERANGE; } @@ -214,7 +214,7 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, */ if (requested_events > 2 && lpc18xx_pwm->period_ns != period_ns && lpc18xx_pwm->period_ns) { - dev_err(chip->dev, "conflicting period requested for PWM %u\n", + dev_err(lpc18xx_pwm->parent, "conflicting period requested for PWM %u\n", pwm->hwpwm); mutex_unlock(&lpc18xx_pwm->period_lock); return -EBUSY; @@ -289,7 +289,7 @@ static int lpc18xx_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) LPC18XX_PWM_EVENT_MAX); if (event >= LPC18XX_PWM_EVENT_MAX) { - dev_err(lpc18xx_pwm->dev, + dev_err(lpc18xx_pwm->parent, "maximum number of simultaneous channels reached\n"); return -EBUSY; } @@ -358,7 +358,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) if (!lpc18xx_pwm) return -ENOMEM; - lpc18xx_pwm->dev = &pdev->dev; + lpc18xx_pwm->parent = &pdev->dev; lpc18xx_pwm->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(lpc18xx_pwm->base)) From patchwork Thu Jan 25 12:08:40 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: 13530842 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 82139C48260 for ; Thu, 25 Jan 2024 13:50:24 +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=ANwwmuAHA4GgFRtqnejUlUL67MpAcveSyQoWeZClqbE=; b=W11B0CuQhy4vup X+97UL0SIiRCoNYU1o3emv/YrL8h7ceUqPrl74J70pWM9DGvLxG57PgnE8I/WTw45ASL08ifJ89Qx /WhACn5yZkdVD/NEqZ7+PUUD3yxN7yhKBNr8skxSm6G7FBMFlme6hjwG1BUPnk1vXFwH4tSIefrjt PNPIS0REmdsSlC8O9aKPu/nG6kJh9+HQdGjY8jzM0YY5doxVl9lzhJD5h/5AF8InrpWvqmbbrHSj8 VXzSM1dwNTlkeE7spKfRZSLceWtYhSiDLYrpLSVTxGGoe1LFxaTkguqLGr5RVsCmsJFORVmh0D6zm fmKuO1emuq30i4DzD78A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07R-0000000084L-1iQy; Thu, 25 Jan 2024 13:50:13 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07Q-0000000083E-1C6P for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 13:50:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=itURF0xQnb8RoP1grg8Az4WICimBb7VTHFJnEE7qJ00=; b=QujDMqe9JDHn0udOX8j351HEnl nFUtvoljysbs/Xkk/FQ+3+j0G7/VUrZfOtbb9ktNXE6z9t80Zf3aW9YSK/ByYUlqBHGPpwVBxoIkx InZMGTNN1Fzobwxdlqes6v2wQT9OHmoLEYRVP97ixjve4+yfJfbR2HU9PsBN8kfjyjlYbFA29iNQy Cm5qwjUi8ZQ1pJCbh6lIBtsVQ3/2OBz37/ICTHiU0OlGujPKwca6zUp+GZ4mXXv0wM+1b+WL1TVEb I86I0OKIJ+apzIV8TWhUl/7DmyvRq61uiK5OrJj1hBgmVm5q6zXpIegZRoKAP7a7NeflmsJEzreNK yX3aJ/NA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybQ-00000005Hfa-2cW8 for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:09 +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 1rSyZ9-0003iz-R1; Thu, 25 Jan 2024 13:10:43 +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 1rSyZ9-002HPp-Df; Thu, 25 Jan 2024 13:10:43 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZ9-007mzJ-17; Thu, 25 Jan 2024 13:10:43 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 018/111] pwm: mediatek: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:40 +0100 Message-ID: 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=879; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=u3GNrzdZ0E6VhvixW9xjo+R0sSVqJ6WMNnaZDq30XSE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9OmFrBGbhFht5Thk81FH0FpaFGolMcp7/J6 C6IpjBvbTaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPTgAKCRCPgPtYfRL+ TljzCACbatZ+qvtz/DkM39dSpNt8mCZBcG3gGoIJumxpmQWDQKS9u/tVmbD5QiiDapasn50JKaC JYrHAROuEMyVO1hDSoZLQPhSGzlTJW0lhwhtVTDKEiTUZ1gy2vdCjxH/NI9d+2lyuGsWhvs/w5m joYWO05vgVrbB6Z5Hw4QDsDw9Zv3NL3u1tRoDkwGk+H/EQ7ies9ArY+92pIl/z4tTn585jXXT1o twBTa5tiE3O4lbsF7PPM8gxjwGsOQiPJmuZwCXY0NCUmTWJ0CMPNgZ4GhGSAhgbXFszVfrREqnK z9HYAyt3i6OJEim6eLUrWSsxVMVdGh/gjLYaL20S+TH2lhfA 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-20240125_121304_770137_9F392AD3 X-CRM114-Status: GOOD ( 13.07 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König Reviewed-by: AngeloGioacchino Del Regno --- drivers/pwm/pwm-mediatek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c index 562102a47ac0..6cf7543a3826 100644 --- a/drivers/pwm/pwm-mediatek.c +++ b/drivers/pwm/pwm-mediatek.c @@ -149,7 +149,7 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm, if (clkdiv > PWM_CLK_DIV_MAX) { pwm_mediatek_clk_disable(chip, pwm); - dev_err(chip->dev, "period of %d ns not supported\n", period_ns); + dev_err(pwmchip_parent(chip), "period of %d ns not supported\n", period_ns); return -EINVAL; } From patchwork Thu Jan 25 12:08:41 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: 13530846 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 16AD7C47258 for ; Thu, 25 Jan 2024 13:50:47 +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=q57QanYgmdaeAYdaAn9DR6RcGZq4PLG3uNyGGf0tH3E=; b=h34rFoA+qPjPBH TPSC7AFmW0etbU01z5f3QL5kpKQK3xnG4fF/nKE2MF5fcUekrhIpVrSQorYh3dNXAIHYZhiFRHtQZ B/2NqLgEYq3cwxC7ykoPliAwFL7IfJdiOkYCa7j9h1u+B+rVGBNRPr3wFmWgxNeAQIIy2KPteyrDJ VIdxIzfOmqclk8Q8n9Ui2BN2ssMhhNFfA3qf150RJ2YnGZlc+t5asAXrL+kmGHKWEqH62pRANOjJP wDs8VilEhUtnmWHPcFZQ2qMN4s0D6EuY9pXndTNHxldV7DViLtHlk6HK+NMmGOhffxxwEDPkQahOH 6xAlinppq3XUqjp9U4hQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07n-000000008HF-3nDT; Thu, 25 Jan 2024 13:50:35 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07Z-0000000087Q-3NoB for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 13:50:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=TGAZAvuxvzR0Z6dpggwwsh9bgXH1N7rswlHIcwoZm74=; b=Xt+zpJplSgW8ajvWKxZv3244fo 2gnFPMfgotPCKBHyG8ZxzSRa8tgA1Jg2L8/QRqxEPK8Awd9Mfzy+OMpATVTbdKZIVzaoCA0Sl2/Uf cNYuUYiWcFEdDufyBnOUx2ENJdUXxqCq3SKZ6iOcoLZ/MKWP9gM1oueXNIIRQKRzsIVT+jfDNNWLL x3bYjkqI3Q/Bx30KC85yWfnGZ5xxHdWS0Ea7nPL0P+/j35FhwBzNyeR20kVKpnfsVgQTTcvxHGHB9 imggJvuh865x5j4TnOySponVbbW8hXS2j3K/voUNZtuJn6uXVwM1tJ9DF2ewgwWQ2tqO+ZecmaqYx HKyLUWTg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybQ-00000005Hfi-0ncu for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:06 +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 1rSyZA-0003j5-0T; Thu, 25 Jan 2024 13:10:44 +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 1rSyZ9-002HPu-Jh; Thu, 25 Jan 2024 13:10:43 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZ9-007mzN-1i; Thu, 25 Jan 2024 13:10:43 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Neil Armstrong , Kevin Hilman , linux-pwm@vger.kernel.org Cc: Jerome Brunet , Martin Blumenstingl , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 019/111] pwm: meson: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:41 +0100 Message-ID: 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=5214; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=R+qmHnPJHXiOMTExINSGoYHhLOryMHBoLVU0lUzmjkM=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9PZruxaLIqpTlyQIEgdXq4dp7BHpKxf+JAt 0X9o0tM8CiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPTwAKCRCPgPtYfRL+ Tp6IB/42RtqLmGDC00nfkrEoDG7kY5jWJL+kPhKnNq4MuFDAs4GyGLD1q3Wlo3D1/w70bl3TQCA L97ik+Mf61dx517Ph/TE6ZyUcZb2YQTAWcJq0IU9qkoAc93Kn1gT4AoqVCITKhvuxrWqgVc9VqY 1Sw6R+0d2wBjxEylRvDLifeMXmy21kx0fCQfaIcOssNHDTj8x9f50yDwPgyY4oujfL+vgBp/EhI VI9T7o5r9I8DJyUUdqu8+MMQ7bwq/PoYU/Jz1bTPsZw2leiEMTANRlUFThVuIynOejUY9Dwmo36 eR1Wyu6xstLJrwSr4e4VkkYkuAZyC8Q/B0YOESOqJSNVGdjM 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-20240125_121304_382327_ACAF3F1A X-CRM114-Status: GOOD ( 17.38 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-meson.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 2971bbf3b5e7..dd0e18437be9 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -122,7 +122,7 @@ static int meson_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) { struct meson_pwm *meson = to_meson_pwm(chip); struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; - struct device *dev = chip->dev; + struct device *dev = pwmchip_parent(chip); int err; err = clk_prepare_enable(channel->clk); @@ -143,9 +143,10 @@ static void meson_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) clk_disable_unprepare(channel->clk); } -static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, +static int meson_pwm_calc(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state) { + struct meson_pwm *meson = to_meson_pwm(chip); struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; unsigned int cnt, duty_cnt; unsigned long fin_freq; @@ -169,19 +170,19 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, fin_freq = clk_round_rate(channel->clk, freq); if (fin_freq == 0) { - dev_err(meson->chip.dev, "invalid source clock frequency\n"); + dev_err(pwmchip_parent(chip), "invalid source clock frequency\n"); return -EINVAL; } - dev_dbg(meson->chip.dev, "fin_freq: %lu Hz\n", fin_freq); + dev_dbg(pwmchip_parent(chip), "fin_freq: %lu Hz\n", fin_freq); cnt = div_u64(fin_freq * period, NSEC_PER_SEC); if (cnt > 0xffff) { - dev_err(meson->chip.dev, "unable to get period cnt\n"); + dev_err(pwmchip_parent(chip), "unable to get period cnt\n"); return -EINVAL; } - dev_dbg(meson->chip.dev, "period=%llu cnt=%u\n", period, cnt); + dev_dbg(pwmchip_parent(chip), "period=%llu cnt=%u\n", period, cnt); if (duty == period) { channel->hi = cnt; @@ -192,7 +193,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, } else { duty_cnt = div_u64(fin_freq * duty, NSEC_PER_SEC); - dev_dbg(meson->chip.dev, "duty=%llu duty_cnt=%u\n", duty, duty_cnt); + dev_dbg(pwmchip_parent(chip), "duty=%llu duty_cnt=%u\n", duty, duty_cnt); channel->hi = duty_cnt; channel->lo = cnt - duty_cnt; @@ -203,8 +204,9 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, return 0; } -static void meson_pwm_enable(struct meson_pwm *meson, struct pwm_device *pwm) +static void meson_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) { + struct meson_pwm *meson = to_meson_pwm(chip); struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; struct meson_pwm_channel_data *channel_data; unsigned long flags; @@ -215,7 +217,7 @@ static void meson_pwm_enable(struct meson_pwm *meson, struct pwm_device *pwm) err = clk_set_rate(channel->clk, channel->rate); if (err) - dev_err(meson->chip.dev, "setting clock rate failed\n"); + dev_err(pwmchip_parent(chip), "setting clock rate failed\n"); spin_lock_irqsave(&meson->lock, flags); @@ -230,8 +232,9 @@ static void meson_pwm_enable(struct meson_pwm *meson, struct pwm_device *pwm) spin_unlock_irqrestore(&meson->lock, flags); } -static void meson_pwm_disable(struct meson_pwm *meson, struct pwm_device *pwm) +static void meson_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) { + struct meson_pwm *meson = to_meson_pwm(chip); unsigned long flags; u32 value; @@ -269,16 +272,16 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, channel->hi = ~0; channel->lo = 0; - meson_pwm_enable(meson, pwm); + meson_pwm_enable(chip, pwm); } else { - meson_pwm_disable(meson, pwm); + meson_pwm_disable(chip, pwm); } } else { - err = meson_pwm_calc(meson, pwm, state); + err = meson_pwm_calc(chip, pwm, state); if (err < 0) return err; - meson_pwm_enable(meson, pwm); + meson_pwm_enable(chip, pwm); } return 0; @@ -432,10 +435,11 @@ static const struct of_device_id meson_pwm_matches[] = { }; MODULE_DEVICE_TABLE(of, meson_pwm_matches); -static int meson_pwm_init_channels(struct meson_pwm *meson) +static int meson_pwm_init_channels(struct pwm_chip *chip) { + struct meson_pwm *meson = to_meson_pwm(chip); struct clk_parent_data mux_parent_data[MESON_MAX_MUX_PARENTS] = {}; - struct device *dev = meson->chip.dev; + struct device *dev = pwmchip_parent(chip); unsigned int i; char name[255]; int err; @@ -543,7 +547,7 @@ static int meson_pwm_probe(struct platform_device *pdev) meson->data = of_device_get_match_data(&pdev->dev); - err = meson_pwm_init_channels(meson); + err = meson_pwm_init_channels(&meson->chip); if (err < 0) return err; From patchwork Thu Jan 25 12:08:42 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: 13530844 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 3362EC47258 for ; Thu, 25 Jan 2024 13:50:35 +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=iyn5W2yrgELCNhTdwW53qF0vTgUFJ/tET+aT2L2O8Q8=; b=KX92x6FaRQzn0R YscWuuYz3gyvLjucAUkzi/xIaccabcB0vrs4fWKH65sluNOcEk/8cbGCMzpo3NBVKBJzTkTiWApHk O1MNrnmD6omqxRjzYli9lDw41ylvhq00r+rJQoVCo+KCnTwBP909W16ZgcPFGj0ti3bA4XRSsLDVW aqIyW2F7E2gF4bVhkZ65BQoDufAV+UK4ILsaV3bj7rMg96wZV8zRGVN7esoDh97GsexwykHN15Gj5 tiZQNIJVvNdHRCS/XFP6M3oaMp9Y6iT2qNmx9gRtuIo3I6D32GCuCl4mExAFehmYIoekL2P2ygB0+ 1Xk1tr8+WIWh+3L32iJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07c-0000000089Y-2KCY; Thu, 25 Jan 2024 13:50:24 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07W-0000000086F-09gZ for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 13:50:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=A6p+Ikb+FWnsbZl/wQ+N3du9Q0O1Jo/a4LBjUHzLi8o=; b=jtyLVxGo7LNpRMPaO8PEsTe2lW 0FAH59EfYCUNd5r70Fs+92bqoYpFZgfeo7AV/VCoFuHuy0X1lJ+MJj8dqVTX9dCdWX1ERNDs9fF/F LmSO6DZ9gZ+AqBar7egHfHa/ByPazi8XZWv7+cu1GyKW5TjR3A7ACDuGDGKvYbEdaNW7PeuxLiF+o zp3URCfnRBiTFPqON+srvmuzbGExLkPbnGc5iOW1b7qNQdLncuh/MUKafl4YLabOZTmWaqUOW4Fha WjCd1aX7setwiWpmahBwM2dL5czjpQu/mCZjyJ/FVtMcvn6wqaiiAoUxgttlD2l00yIadvGVJL421 ImmFhkRA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybQ-00000005Hfh-27vL for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:07 +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 1rSyZA-0003jN-7m; Thu, 25 Jan 2024 13:10:44 +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 1rSyZ9-002HPy-R6; Thu, 25 Jan 2024 13:10:43 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZ9-007mzR-2N; Thu, 25 Jan 2024 13:10:43 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 020/111] pwm: mtk-disp: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:42 +0100 Message-ID: <0ebb99812e0d563437d2cdb8d980e89461e28a6d.1706182805.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=1778; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=2my+KTISTjKr4blFD22AL+yDfNEk1kSQLWB/RlEBkzo=; b=owEBbAGT/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9RzviGTen8OjNSCvRF2x6ld2MV3ea52eNvR wOwyTtOPAeJATIEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPUQAKCRCPgPtYfRL+ TommB/jA5Z6pZ/uA1Ye/QbFGhQsZEg4kXPITCIu9yH6QU3WHNF+nB93lX9TnTRKgv2PL8CHAxvw Fes6xRHy3yEqA+QBzVQP1rv/cBLA3hLxQeOvzyDxgQBBPSPEGw/KRG8ngkorYRQ0q6n3yk6bzbO vM14u1uKpaTXB0u/qkmY1X3+K9iQbPKcQeQ2NR+4Y7k6vQx8LuTQwfn+gjiPde9G5rRkTEH2dzN p/zMD/bW/DPn9TkUE9ZAKWQvSK59b5iulGBSob1qsb/IbxnaHutm9Nq84pRjts+gEBKgaR74Ajs VgxaS1rKwiBjBLXbkIFmHydOquk/GAZvEAZLSiOzik0hHr4= 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-20240125_121304_700967_18D6F9D4 X-CRM114-Status: GOOD ( 12.64 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König Reviewed-by: AngeloGioacchino Del Regno --- drivers/pwm/pwm-mtk-disp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c index a72f7be36996..186aa5c04435 100644 --- a/drivers/pwm/pwm-mtk-disp.c +++ b/drivers/pwm/pwm-mtk-disp.c @@ -91,14 +91,14 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, if (!mdp->enabled) { err = clk_prepare_enable(mdp->clk_main); if (err < 0) { - dev_err(chip->dev, "Can't enable mdp->clk_main: %pe\n", + dev_err(pwmchip_parent(chip), "Can't enable mdp->clk_main: %pe\n", ERR_PTR(err)); return err; } err = clk_prepare_enable(mdp->clk_mm); if (err < 0) { - dev_err(chip->dev, "Can't enable mdp->clk_mm: %pe\n", + dev_err(pwmchip_parent(chip), "Can't enable mdp->clk_mm: %pe\n", ERR_PTR(err)); clk_disable_unprepare(mdp->clk_main); return err; @@ -181,13 +181,13 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip, err = clk_prepare_enable(mdp->clk_main); if (err < 0) { - dev_err(chip->dev, "Can't enable mdp->clk_main: %pe\n", ERR_PTR(err)); + dev_err(pwmchip_parent(chip), "Can't enable mdp->clk_main: %pe\n", ERR_PTR(err)); return err; } err = clk_prepare_enable(mdp->clk_mm); if (err < 0) { - dev_err(chip->dev, "Can't enable mdp->clk_mm: %pe\n", ERR_PTR(err)); + dev_err(pwmchip_parent(chip), "Can't enable mdp->clk_mm: %pe\n", ERR_PTR(err)); clk_disable_unprepare(mdp->clk_main); return err; } From patchwork Thu Jan 25 12:08:45 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: 13530908 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 3BCD0C48260 for ; Thu, 25 Jan 2024 14:11:13 +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=pUgDykXpMZI1LDPF5wIG4xw3GztJr9L8LeuXI2pcRsc=; b=IjtCapTgOshsBz ogNo/+N8Wg+ImRv/+CU0btLYONAF2pZdPVkrkaXxVBLOalGdvwXbEjLwlzmBz8i9e4YzUu6/ulWZM ydJt8d6jy57g5YtQ4ky4HPQs0cTVBEFE9mDrb6/+Dld+5r5yUNSjxXSbEbOiLZDWL6h8CMrwYUk+C wx6ps2HRDCLZN6CpyL3K+DvUH6JjesDKsgVLTwpkdQ19x9uCHU9fAzusvn3wWFgnmiTnyt2iDdTj2 AqII4hGtlT1id8Yv7LrL1oLMEiWj/cE6RHP65s8ENon0KU2JuZedtt/JxnC1ju0+CtBplWhb1kisf hbS389zYoc980IxDUQhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0RU-00000000Gqg-15gp; Thu, 25 Jan 2024 14:10:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pj-00000000FbC-3kc6 for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=r/YgE9gKOZFQjjkqDs353cTZIle0S8d7JkiQUeS/fs4=; b=sCVnWLOeFQgvU9BDaUbLT1Tr/p dpTUeAb/Fm5XixIboG/gF2jnXnxRckzdTRlY12l9E3BhP45bN1+08o/UyWooRaSIrS+91g/6uaENm NwOhXZPa6MhDrcAPY8NkA/Ywp4M0/DCl5S5yYfNxn32NhZLFcq100yBLXk5ke4D9qAwwegQi8ZmCw iISNzldEJO7YEWkUKGOR6dBFe8RcPWmZjnSvkBSwlQ4tp2iQYNiNTEg/HwhDYYSS6002Nm9gnU2nZ 8aqKppvpgdRO8+7D+04uon2U3K+FxylXKFKXqL/pOD1BA98w3+DiVwA2gSJOa9hcFiO5UDgS368z7 HcGsn+qQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDV-1apt for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:12 +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 1rSyZA-0003jy-SU; Thu, 25 Jan 2024 13:10:44 +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 1rSyZA-002HQA-Ec; Thu, 25 Jan 2024 13:10:44 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZA-007mzd-1B; Thu, 25 Jan 2024 13:10:44 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Florian Fainelli , linux-pwm@vger.kernel.org Cc: Broadcom internal kernel review list , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 023/111] pwm: raspberrypi-poe: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:45 +0100 Message-ID: <5cc19dbbd107812096475804c0832fbc145ef56f.1706182805.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=941; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=15QkF6UfRNZdEbGD6rCarw+yiORwQG1S55uDkQ6Up0I=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9UpYSmshITP3oz3sc4JeLkLfn+6PTdHTpfD qXAu6V8IGKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPVAAKCRCPgPtYfRL+ TlzIB/9r+h2bdaHzVxAPYYa6Dr1kO112dyGGAnvijgrH7rzt93A/5Qf8BD3MmsJReLaBy8447BP iX4OAmbCnbRipmaatduFYU7FjuASiNgbD1pCo6+v2zvbWF0lkn0IuRSkgYmbym2znYXQjlXY64g PdukF3zv9Pc6mFCYD/yNZH8NaK0Y8PzKBvIM1lOCuBPiTVdsatzYtcWcHU8pFvjsk7eOR785J+I 4emxoMsxUfqZFww0Cgyffo4HU2dhgmEoW9H9ZHMAz1jBCr/Kj9xT5u7dhaSwULR3i4D7ayINfc6 R8t7w//jaZvpmoEben5n2cf4tvfU0Go/8D4+WnCcyVAA8k0W 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-20240125_121309_806187_0201EFD2 X-CRM114-Status: GOOD ( 11.92 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-raspberrypi-poe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c index 1ad814fdec6b..f10e8a624c51 100644 --- a/drivers/pwm/pwm-raspberrypi-poe.c +++ b/drivers/pwm/pwm-raspberrypi-poe.c @@ -122,7 +122,7 @@ static int raspberrypi_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, duty_cycle); if (ret) { - dev_err(chip->dev, "Failed to set duty cycle: %pe\n", + dev_err(pwmchip_parent(chip), "Failed to set duty cycle: %pe\n", ERR_PTR(ret)); return ret; } From patchwork Thu Jan 25 12:08:48 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: 13530845 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 C20C1C47258 for ; Thu, 25 Jan 2024 13:50:37 +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=+XLrhJJI4p7xjjl3vMhd1+JDwc2UoP8THUbOATYz2lw=; b=ker0EDD/UORhn5 pD/mX5aN3z8hwAYHhb4T43QR796guzkZ3HZZMDzkSTKR0ke8evksRPNvGqClQFOJyOvDM4478yHE1 kgvVKRwMWixN/+a77GIiJHTDMmKVfEoF/p0R5XklCbkydx1JzACIJapHkeSSn0DnSz5Ny7CuJxmc3 sCg5FDPubzUxeLkzaB2uuvhpjgvrvSXdSyn3XTf2b4f4YkGEDHC07bYGxZBISNLmKtmObRAbbATMB 7bDFy2czFShUbKHiiNsYrm2eur34qMfdRHkXMduGhcQK4+tX0VMsz9IK9++GdO1KIQEyjmbVEbhjS OJtvuR68gJXW9iJp1QQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07b-0000000088j-14Ac; Thu, 25 Jan 2024 13:50:23 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT07U-0000000085P-0kaE for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 13:50:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=3ivyEpR2ygXScufZYM0BbSVQaqb4R739HVUAzzfz9aw=; b=oQtQ2qNuUWgUr7I0TYKRCMsIfy NpdnY40fjGpsEAyGYXApFfbzt5bR3AABi/E7V/Z7sLuiJZLAZe46RsLt5dVRIjp7LK+T+/YXV0666 jqYZ50Q9uEKwNEMMT8qo32A+8gwTwUzHjoqt825+p41FmP4Ag3Jhkwgeqnv6H9z9qAEl9VBcTnZen aStxaMVWwm7gOT4+E+yqqBfwv4qvjUj+gTTvAz7HBR/UOWmbFF61c7IwSGVbM+TEKmhL6t/7O2tFI kWWhlQnl9IA0t4zWgI6PF9pNEDfNqEZvKVtCh5kHwvYUoU22sXaILMhjLKrKhSLl86XX+3P9BsH2K yIWr4oDA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybQ-00000005Hfg-17F7 for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:07 +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 1rSyZB-0003nb-Ut; Thu, 25 Jan 2024 13:10:45 +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 1rSyZB-002HQM-1K; Thu, 25 Jan 2024 13:10:45 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZA-007mzp-36; Thu, 25 Jan 2024 13:10:44 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski , linux-pwm@vger.kernel.org Cc: Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v5 026/111] pwm: samsung: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:48 +0100 Message-ID: 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=3577; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=jjY2kkYkkj8AYXzFgZVbJHxcNLlKbgf5gvxM/X6Wwys=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9Y1IufeL63Y1mple+o5ralvOu3YuMO/Y+uD 901bGwiQQyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPWAAKCRCPgPtYfRL+ TkhVB/9BdSGxcu86jJ0V9wqEHF09XJgSSHoGyC4OxM/N1dQoP9yAjfztp7WOsvVbqq6JD3eOnV1 lEnmCx+YmAEPzoZ8x0GfyLhT05o0/Xg4ClmpIKPUiwKzHJ3aPtih/3/WQOFEGT1tIPKIwtPgPzG MRjKMQ8ccDEgvu2ALI5lQlBw2wW8njbKueZRN23aG4oWkUpfq/sJUYk+oYtnUpLJ5FRzOwxspb6 RFab5yUM5xXAaiA9czUE/YPSbqiWLiXfk5SGjpsPVrvxsr1J+KFxwKBctubWb0bCF8QuK4qiLPq OUue2dAY0xE+c3MjJGejqKDuMvhEvKrJDPQAA5x8yaxYYC6I 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-20240125_121304_527420_EC881ABE X-CRM114-Status: GOOD ( 12.61 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-samsung.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index 6e77302f7368..a97cae49406e 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -197,12 +197,12 @@ static unsigned long pwm_samsung_calc_tin(struct samsung_pwm_chip *our_chip, return rate; } - dev_warn(our_chip->chip.dev, + dev_warn(pwmchip_parent(&our_chip->chip), "tclk of PWM %d is inoperational, using tdiv\n", chan); } rate = pwm_samsung_get_tin_rate(our_chip, chan); - dev_dbg(our_chip->chip.dev, "tin parent at %lu\n", rate); + dev_dbg(pwmchip_parent(&our_chip->chip), "tin parent at %lu\n", rate); /* * Compare minimum PWM frequency that can be achieved with possible @@ -232,7 +232,7 @@ static int pwm_samsung_request(struct pwm_chip *chip, struct pwm_device *pwm) struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); if (!(our_chip->variant.output_mask & BIT(pwm->hwpwm))) { - dev_warn(chip->dev, + dev_warn(pwmchip_parent(chip), "tried to request PWM channel %d without output\n", pwm->hwpwm); return -EINVAL; @@ -326,12 +326,12 @@ static int __pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm, period = NSEC_PER_SEC / period_ns; - dev_dbg(our_chip->chip.dev, "duty_ns=%d, period_ns=%d (%u)\n", + dev_dbg(pwmchip_parent(chip), "duty_ns=%d, period_ns=%d (%u)\n", duty_ns, period_ns, period); tin_rate = pwm_samsung_calc_tin(our_chip, pwm->hwpwm, period); - dev_dbg(our_chip->chip.dev, "tin_rate=%lu\n", tin_rate); + dev_dbg(pwmchip_parent(chip), "tin_rate=%lu\n", tin_rate); tin_ns = NSEC_PER_SEC / tin_rate; tcnt = period_ns / tin_ns; @@ -355,8 +355,7 @@ static int __pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm, /* -1UL will give 100% duty. */ --tcmp; - dev_dbg(our_chip->chip.dev, - "tin_ns=%u, tcmp=%u/%u\n", tin_ns, tcmp, tcnt); + dev_dbg(pwmchip_parent(chip), "tin_ns=%u, tcmp=%u/%u\n", tin_ns, tcmp, tcnt); /* Update PWM registers. */ writel(tcnt, our_chip->base + REG_TCNTB(pwm->hwpwm)); @@ -368,7 +367,7 @@ static int __pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm, * shortly afer this update (before it autoreloaded the new values). */ if (oldtcmp == (u32) -1) { - dev_dbg(our_chip->chip.dev, "Forcing manual update"); + dev_dbg(pwmchip_parent(chip), "Forcing manual update"); pwm_samsung_manual_update(our_chip, pwm); } @@ -509,7 +508,7 @@ MODULE_DEVICE_TABLE(of, samsung_pwm_matches); static int pwm_samsung_parse_dt(struct samsung_pwm_chip *our_chip) { - struct device_node *np = our_chip->chip.dev->of_node; + struct device_node *np = pwmchip_parent(&our_chip->chip)->of_node; const struct of_device_id *match; struct property *prop; const __be32 *cur; @@ -523,7 +522,7 @@ static int pwm_samsung_parse_dt(struct samsung_pwm_chip *our_chip) of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) { if (val >= SAMSUNG_PWM_NUM) { - dev_err(our_chip->chip.dev, + dev_err(pwmchip_parent(&our_chip->chip), "%s: invalid channel index in samsung,pwm-outputs property\n", __func__); continue; From patchwork Thu Jan 25 12:08:50 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: 13530901 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 2EF2DC48260 for ; Thu, 25 Jan 2024 14:10:51 +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=OcdrDizwTXedm6ZS3yVQdpkYRyp6g1Gaz2s+wnfQ75A=; b=4KYLzYFhuf2g3N VOTk+S2bw2gh7ItyyB4V0JRb03kc2dBAn/KgU+S/7EjPNNytopcz2i80hQdqzxNNR5MLkITvsjXWl iOFjT8xt+ZSQY+4JwIFti/iZcAUB+uk+VsC1EYcuDEghzOEfQKX+Me3RklnJkuUGtXAAEo3HR02Zm PW8kTlVH1UIFOOnK6Hh7tCLpjkU7l0gFQ73U//hMlrr4ECRCnb7aNSZjl7rrIBq9V10ZBlrQEQtkX hYWZXrFGQoVORmdIRwdnGXf5TnkGxal/YwoS5c1E4rg5iedrfLFdxizpqLESeqkCBzzmkeVix49xy QocmTgGZemx5bW/fk9bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0RB-00000000GZJ-1Jr6; Thu, 25 Jan 2024 14:10:37 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ph-00000000FbC-33qV for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=ufODsDkmhKXfURomUiKjf/ONy9dTxiQ2vr5fLQssuhA=; b=G4kXFaEaW54tbes5pG7kRJhVJ8 r2upfeaE6xxXG1CRpCIe9bh1H2RsdGDCL9j57Bwznfyh/oBowhQhuFbYRM+KNAhmCnq+W4UNfNUcf 01TL31GptgMPp5ht4QBi9Stri9HHPTlXsAOmeVNRW2Fyh7mzmGL+VyBy3Y/G/Tv+qIANt5gDxvygs DklLHRzrQNdhE993z/MtMwCCF0ZMiTh66mtgQKxB+XOx5E6vhK8TyaDgFrNL194E12mR5YDdzOlOj 61wdxHsMLB+QLAcT3eOSo+HieMS81S2LbvB1stX+llJ1wSJrbzwKrypkwhXtljnZ5FA59O08Jj47h b01I7dUA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDY-2TMM for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:15 +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 1rSyZC-0003qe-D4; Thu, 25 Jan 2024 13:10:46 +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 1rSyZB-002HQT-EB; Thu, 25 Jan 2024 13:10:45 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZB-007mzx-1A; Thu, 25 Jan 2024 13:10:45 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Fabrice Gasnier , Maxime Coquelin , Alexandre Torgue , linux-pwm@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 028/111] pwm: stm32-lp: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:50 +0100 Message-ID: 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=1687; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=GxMi0tXDokbqmRCwg0JFBfaf+3WQDSlBqy/nZUUiyFI=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9amGtsO13RN82ZdGaIn265nrghL45JlRz3H m4/+E8MM2qJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPWgAKCRCPgPtYfRL+ TmMLB/4nmEyDWMlrmY+YHCGKQA5px+JYct1T/6PjFiwE6aTzYuhAfKJfiBdeO1QUt9gTuqFG6po N8HW/Iq0aH2dy8grQs11fpFeqwEetOMGYqFQeNtlsyp3JqzTtpdzB663RrV/E3nT2J6CkX7B6ch KS93iYe4qCYjUn2eNsSy5MFZ1Hba6SZKmJ78DO1JjInA2WId1BHN+MiDkJ98Vkh1ldYGLtEXGj7 9dZgYkc7o5dkvfzFxoY+WYtDw1KXuQVX8IkHOBMC2bD4fBdTx2mXVbP8Q/cwOGb8tUT/rKllgU+ zvJqbac8fjXH0wRoUxJblXzlaUj5NBzzHK5ee+mm1ldRJEb4 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-20240125_121310_016465_5220F301 X-CRM114-Status: GOOD ( 11.05 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-stm32-lp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index 439068f3eca1..3754faeca838 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -61,7 +61,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, do_div(div, NSEC_PER_SEC); if (!div) { /* Clock is too slow to achieve requested period. */ - dev_dbg(priv->chip.dev, "Can't reach %llu ns\n", state->period); + dev_dbg(pwmchip_parent(chip), "Can't reach %llu ns\n", state->period); return -EINVAL; } @@ -69,7 +69,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, while (div > STM32_LPTIM_MAX_ARR) { presc++; if ((1 << presc) > STM32_LPTIM_MAX_PRESCALER) { - dev_err(priv->chip.dev, "max prescaler exceeded\n"); + dev_err(pwmchip_parent(chip), "max prescaler exceeded\n"); return -EINVAL; } div = prd >> presc; @@ -130,7 +130,7 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, (val & STM32_LPTIM_CMPOK_ARROK) == STM32_LPTIM_CMPOK_ARROK, 100, 1000); if (ret) { - dev_err(priv->chip.dev, "ARR/CMP registers write issue\n"); + dev_err(pwmchip_parent(chip), "ARR/CMP registers write issue\n"); goto err; } ret = regmap_write(priv->regmap, STM32_LPTIM_ICR, From patchwork Thu Jan 25 12:08:51 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: 13530900 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 E9CA2C47258 for ; Thu, 25 Jan 2024 14:10:48 +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=AzDQ/AUQwD52wOZ5Vs1tHqbEFJas5umCVx4rc43EDc0=; b=0v7ssfhIdMAlgx 9326B61SMD2yVl4jC1vwplifskREc9KtUuRfuT8vb/lHQOUnltW9z1/nosJDjC+UVV4v56P6u2eA8 VnBd3LU/Lo3VpmK+P9EXDtlIF0HqKbe0KShTxx3XI+HvVDQM5OqyQ7AOYl+2ck+bY8j2rmX6yB80Y k1zJaTCq/T4k679ytp1wtUwXBWXaI0xYEPY6PgIFHpPr5qzAcTTocJXdcupB5XffyujTEFuoQ51/9 v3Yl5ibgqqqxwIGcA4UAi7IlHQMycbujGmkqpjDE5LnDNj3DzLZnXeMjxSvC/yEBXQv+oApqcyG0N TeLzlRvnZeBD7yRiSsGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0R9-00000000GYA-16Mm; Thu, 25 Jan 2024 14:10:35 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ph-00000000FbC-1rdS for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=RzFBkbK1MnX53y8Svv3lY5px8BUoJMvRZfepbQGrygU=; b=AmG0zSXcq1kQaEXgMNFpXOGd6t mAeM8QoAwvUYtRuiaG8Vj9HCU0wemBaidODpKkk7ElOaC4mrzjN7bBSixBGFf4vRKBlK9PpHJ24Ac isQyZ5sD/vSDNfzMguSIxPkozWem3k2zooP/2g7GK1Z7utGLKXFI8y+j9rlkyGR8FlPG3/Nl8GkJu D8zQfpgPou15hYenX0B8nfsTiqRDKeJmHq/JR6+WlwndaWXKQU8Rlk4lcqXAE4JK7bPeCGBwG/zL6 V9Jqs5FW0/zKkYH8V2qPr3PGY9ePHhM9Am5sQ2cWhp2j0qK8mYf0iJbMgk5vw4bP1ZnEdRmvZj7Tb aDMxumfw==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDW-2eG9 for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:16 +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 1rSyZC-0003sa-ER; Thu, 25 Jan 2024 13:10:46 +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 1rSyZB-002HQX-Kv; Thu, 25 Jan 2024 13:10:45 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZB-007n01-1p; Thu, 25 Jan 2024 13:10:45 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Fabrice Gasnier , Maxime Coquelin , Alexandre Torgue , linux-pwm@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 029/111] pwm: stm32: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:51 +0100 Message-ID: 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=1165; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=2rCU3Goqf+i/4f2eo8F31DBFj03pWNn5JfV1Fg0fihU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9b5vHxohwwaQtHz8JsM2yY5H4duLs5GHq54 vcS0n3FevKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPWwAKCRCPgPtYfRL+ TnxKCACg9m9lIgloOvrBwmqvi6ascp/CemOgDNoaxiIYlJP8+rO8Lt91yaKtyuEb3iKVS4l0Kag pwXWK0TiysMO8g+NcyK144WBEglsDTfTMgLmDV5kNEML2pPBK+2KwG02MkVrO1dt/XTV5ESbHHS sh3BRGZk1H0q7W49CWQnA51FdXrfN0Ol8mHUIQ6lMLHkpyHLxZPgfPqBXkLNxZD7F7AAFH0P1zA twi9sdK6u8XozxsIvNe4quvBfv+HwgX7IcRDMylR7YgTywquTMOyqUJrWPAM/VFexsy9RHWAGAI gSXmV2PtXaTWfI45CGi2+PgaxKIdNXGUP4xxjp8Vi9Lm2FSM 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-20240125_121310_069386_A5197449 X-CRM114-Status: GOOD ( 12.51 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-stm32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c index 5f10cba492ec..d1dc9e3ca2a1 100644 --- a/drivers/pwm/pwm-stm32.c +++ b/drivers/pwm/pwm-stm32.c @@ -94,7 +94,7 @@ static int stm32_pwm_raw_capture(struct stm32_pwm *priv, struct pwm_device *pwm, unsigned long tmo_ms, u32 *raw_prd, u32 *raw_dty) { - struct device *parent = priv->chip.dev->parent; + struct device *parent = pwmchip_parent(&priv->chip)->parent; enum stm32_timers_dmas dma_id; u32 ccen, ccr; int ret; @@ -170,7 +170,7 @@ static int stm32_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm, ret = clk_enable(priv->clk); if (ret) { - dev_err(priv->chip.dev, "failed to enable counter clock\n"); + dev_err(pwmchip_parent(chip), "failed to enable counter clock\n"); goto unlock; } From patchwork Thu Jan 25 12:08:52 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: 13530907 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 3FC56C48260 for ; Thu, 25 Jan 2024 14:11:09 +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=R6PRuUxM6m9VF6YQDMdn+kMY8BP5EmKub1N4XNNpL4I=; b=XOjNgnHfbwGbwC bovCZ7c4YwBzt6hUgiMw7OJWj6aq6vzYfLXzzkFjmZYI/vmdTAILcUYHvMA2mipdNOqjkGvNm1uQ1 Xior+p1mQ5wWpus7LQKwajkid4sqXUGWPV4yAP5u+mKdP25jKnppmz5XCIgMUFOocizBfPkIEmFXm 8YmvSGEmuzepu5QJrw6VXgPmKG6drWZioZs9fE3njNxXLfbnAnVeF2jdy5OG9mVGbzEY631fZRIWM lBwjHFD6XVBZfT9zMcrapazg6IzAGI03Dc+Q2LlJWTta7w0f0qXQO7NiDnpXE6OD2d64EulYQ09ko MBObWyzexV5DTEJCk9bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0RO-00000000Gm5-45Mk; Thu, 25 Jan 2024 14:10:51 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pj-00000000FbC-20yU for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=XiMtz/jaFDb0ZEJyhfFMZ8mGV7gs35ScLKrZLKAFxeg=; b=KNpn5SV9Ave2pt7/MECIWnQWvb x1da3XhLmK+pYwFYukJhQVLO0RHLiHUiwuPxdCQROkURf2hv7C33Ur5RAEpxJCnIZi7VFvPgi433P hRY3Mn2QyTbHVv2HivoS0VGo2nNz+B4n0BCxmYfNRE5jtNLf4rn38o1SXuBnoEQdl/rZcPPLbdv2J WVQtgIp1maI9g+gsUDx5fK/V8phHxSRQmViQ/wI/AIrxKGKhkgrnc8dZMvU65Ci9j3aZVRzkCrBWY eCMg6OD8cjLYlPJQ8/4kTbaa5ZZhZA9HjwmAtorl0NruiAhKHNX5C6QFblBQNGpmHGywU7g8MSH9C Oc59B54w==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDX-1NpM for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:12 +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 1rSyZD-0003ul-8c; Thu, 25 Jan 2024 13:10:47 +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 1rSyZB-002HQb-Re; Thu, 25 Jan 2024 13:10:45 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZB-007n05-2V; Thu, 25 Jan 2024 13:10:45 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maxime Coquelin , Alexandre Torgue , linux-pwm@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 030/111] pwm: stmpe: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:52 +0100 Message-ID: <4429d56b2b4452687bbd34fcd7129ef1b8b215cd.1706182805.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=3973; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=VtRkOXadk7PhuJR6plzr6JlXTjGn2qEhYa+ucY8hwas=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9ckt6biCk699tUOev2DxKkJzNUlodamAnyZ kxKeQYSZleJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPXAAKCRCPgPtYfRL+ Th/DB/4z/0rMH//RkTf+FSP2aenm4/eapOxa/9SLJi8ipYxWgrNFPGMJU8fy8UjG8iEyvbND+oc S2d6ICSvHXUz17y0He6YSslmx0e5i+YtqfwB/5TLYZdF0ed167ebRKLK2H6mQjiTIYypUxmxOza w/Hd2MCFGhePZ/Ok/F9ZThYFTAcgBNOIz5TLIKynzZerEGTwPmR8eWKus/KAQoOkkHN6Lk6T7Ue DMNthTKUthQyEDLShlseLTkXNHrkC0M++61juVWb5LVEB3uOlrEIvt4LvkoGdMZe4qAMtCklXoE H+s/5aZ13UNf1oKnpZoFt5rvFHIjQjY7QwOWPi+RXCKlUEZ+ 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-20240125_121309_761144_2FCD3E07 X-CRM114-Status: GOOD ( 11.98 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-stmpe.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pwm/pwm-stmpe.c b/drivers/pwm/pwm-stmpe.c index 19c0c0f39675..05f3f38031ee 100644 --- a/drivers/pwm/pwm-stmpe.c +++ b/drivers/pwm/pwm-stmpe.c @@ -44,7 +44,7 @@ static int stmpe_24xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ret = stmpe_reg_read(stmpe_pwm->stmpe, STMPE24XX_PWMCS); if (ret < 0) { - dev_dbg(chip->dev, "error reading PWM#%u control\n", + dev_dbg(pwmchip_parent(chip), "error reading PWM#%u control\n", pwm->hwpwm); return ret; } @@ -53,7 +53,7 @@ static int stmpe_24xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ret = stmpe_reg_write(stmpe_pwm->stmpe, STMPE24XX_PWMCS, value); if (ret) { - dev_dbg(chip->dev, "error writing PWM#%u control\n", + dev_dbg(pwmchip_parent(chip), "error writing PWM#%u control\n", pwm->hwpwm); return ret; } @@ -70,7 +70,7 @@ static int stmpe_24xx_pwm_disable(struct pwm_chip *chip, ret = stmpe_reg_read(stmpe_pwm->stmpe, STMPE24XX_PWMCS); if (ret < 0) { - dev_dbg(chip->dev, "error reading PWM#%u control\n", + dev_dbg(pwmchip_parent(chip), "error reading PWM#%u control\n", pwm->hwpwm); return ret; } @@ -79,7 +79,7 @@ static int stmpe_24xx_pwm_disable(struct pwm_chip *chip, ret = stmpe_reg_write(stmpe_pwm->stmpe, STMPE24XX_PWMCS, value); if (ret) - dev_dbg(chip->dev, "error writing PWM#%u control\n", + dev_dbg(pwmchip_parent(chip), "error writing PWM#%u control\n", pwm->hwpwm); return ret; } @@ -125,7 +125,7 @@ static int stmpe_24xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ret = stmpe_set_altfunc(stmpe_pwm->stmpe, BIT(pin), STMPE_BLOCK_PWM); if (ret) { - dev_err(chip->dev, "unable to connect PWM#%u to pin\n", + dev_err(pwmchip_parent(chip), "unable to connect PWM#%u to pin\n", pwm->hwpwm); return ret; } @@ -150,7 +150,7 @@ static int stmpe_24xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, return -ENODEV; } - dev_dbg(chip->dev, "PWM#%u: config duty %d ns, period %d ns\n", + dev_dbg(pwmchip_parent(chip), "PWM#%u: config duty %d ns, period %d ns\n", pwm->hwpwm, duty_ns, period_ns); if (duty_ns == 0) { @@ -216,7 +216,7 @@ static int stmpe_24xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, program[1] = BRANCH; } - dev_dbg(chip->dev, + dev_dbg(pwmchip_parent(chip), "PWM#%u: value = %02x, last_duty = %02x, program=%04x,%04x,%04x\n", pwm->hwpwm, value, last, program[0], program[1], program[2]); @@ -233,7 +233,7 @@ static int stmpe_24xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ret = stmpe_reg_write(stmpe_pwm->stmpe, offset, value); if (ret) { - dev_dbg(chip->dev, "error writing register %02x: %d\n", + dev_dbg(pwmchip_parent(chip), "error writing register %02x: %d\n", offset, ret); return ret; } @@ -242,7 +242,7 @@ static int stmpe_24xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ret = stmpe_reg_write(stmpe_pwm->stmpe, offset, value); if (ret) { - dev_dbg(chip->dev, "error writing register %02x: %d\n", + dev_dbg(pwmchip_parent(chip), "error writing register %02x: %d\n", offset, ret); return ret; } @@ -255,7 +255,7 @@ static int stmpe_24xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, /* Sleep for 200ms so we're sure it will take effect */ msleep(200); - dev_dbg(chip->dev, "programmed PWM#%u, %u bytes\n", pwm->hwpwm, i); + dev_dbg(pwmchip_parent(chip), "programmed PWM#%u, %u bytes\n", pwm->hwpwm, i); return 0; } From patchwork Thu Jan 25 12:08:53 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: 13530859 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 AFF29C47258 for ; Thu, 25 Jan 2024 13:59:58 +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=yA3EJ5pbB6EvbVj1oAczU1BNKS1KwQ7J/YwNFeUmGXI=; b=MHbw3htCruEfGP 3r/9A0SrKNvqf5ATVpR7QkrAaK4x9ZzJPGBmxWUjv+hrSkxYYfkDzStmPnZLvTWLy8jMszE07t/+l rKxzoMR7z3HOz4x2pTADqZx3G+IcocZtde2s22plw3JikKuOpmmE9ilnAPKsvsBb/RQIyqM1derKk Y23esMAmrXEEFt6uELxBHiHfugwOogUg6t9DcHuL+QE+BRb5tN65kh9YrUxCABqFlD1Uj5exKoQDL ZIhDuF0iZrrlEj/tIzCxizIxtTgZA/On3htfERVnJNroCTxqlyaUOAeD/57vc+Wgi0kCNJpBjw06P aJEgoZ3vRlQeup/H8U9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Gg-00000000Bha-0W2T; Thu, 25 Jan 2024 13:59:46 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ge-00000000Bgl-1OrU for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 13:59:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=89qhZySIciFw7lqCMWdS7Gkco0FWDw+mSpKHJIQ9pVw=; b=jQzt5DqioIrbfehR1jj8/EN0qr 4nNZTzL0Fivmbi2bJKZnZQigrmd41ip8DOmo5lbvjCloY1HAbYw7VXoHI58jZRrSYCEWQi7uKsWbG /mVQ7gFzhMeZUL/Olob3qK2tTigxntvs3euADpUiIwf2i8EXXvyO4DgXKR1ykcu6ks7T1+AG2oR9k bfXduc9DoioddOTEFIxzjuS6GXcl6ugbTT13Q1HRASkP29R+R92i1R53myVEKuRLDxoLzB4PiP/Jj dDDZqrNMxKTlQ4YrSpdeuoFX/snbBFlbSrTfKydx1pZ/qwDJPCFyORRtrNLr+ocnLMc/Y+te0bCGD orVwUgVA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000005Hfz-00K8 for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:11 +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 1rSyZD-0003wU-G3; Thu, 25 Jan 2024 13:10:47 +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 1rSyZC-002HQe-26; Thu, 25 Jan 2024 13:10:46 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZB-007n09-3A; Thu, 25 Jan 2024 13:10:45 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@pengutronix.de Subject: [PATCH v5 031/111] pwm: sun4i: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:53 +0100 Message-ID: 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=1321; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=Yo6420w9dPgmTPswboA7SwJA2LCycKMLXUcUeusg2wY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9dgDg56kpyhjNfeMv9DpxDruYzLJ61u+zTj P5zOqm+z8WJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPXQAKCRCPgPtYfRL+ TuBrB/4zTmfwVgGCMKd/3WeDkLXoFcndR3WQBzEwLpyzuAowHlixCYbjoiQRznu8edYBIj91bwJ VTGTxeRS01JRhniYM3qDoJlAAtaFjA66IYNbTIvpi+RxeAqFb8j0RnbCDgAMSbgrSUhrcHFW7Oo Glib/4p0ATZK002PxHdeAWF3r0d4CKQYCpOcf5cgjVxqhZDMQQV9cD0gXR3pPj+wRjrNRjlo0tv 8O/2e2wW2ZM6QfrVNI+oGMXkM1ML1KJjoxAxx0e1nz03c6mzG5SZrwHpW3nmnuOJGh3iBrlLAIL gAcJAQzLnV0qdAMXHM055zMFrdiAg7/67smfmUr1AA38b7tc 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-20240125_121308_203065_E9E39A5E X-CRM114-Status: GOOD ( 13.11 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Acked-by: Jernej Skrabec Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-sun4i.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 1a439025540d..44edf1ce5739 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -245,7 +245,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, if (!cstate.enabled) { ret = clk_prepare_enable(sun4i_pwm->clk); if (ret) { - dev_err(chip->dev, "failed to enable PWM clock\n"); + dev_err(pwmchip_parent(chip), "failed to enable PWM clock\n"); return ret; } } @@ -253,7 +253,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ret = sun4i_pwm_calculate(sun4i_pwm, state, &duty, &period, &prescaler, &bypass); if (ret) { - dev_err(chip->dev, "period exceeds the maximum value\n"); + dev_err(pwmchip_parent(chip), "period exceeds the maximum value\n"); if (!cstate.enabled) clk_disable_unprepare(sun4i_pwm->clk); return ret; From patchwork Thu Jan 25 12:08:58 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: 13530904 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 2E17DC48286 for ; Thu, 25 Jan 2024 14:10:53 +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=bYmVxNG0crC0JXyigYLbVIQ2y0g0dw+tu+X7dgeFy9Q=; b=YRAhHs7C4EZkt0 5MoDqRjvMKBK8N9KpRx786mrfD+W9dg6dpeDS7dd29BACyNRjm3r+XM4WkSbxVszaF1MZvxjxCGZD YlfXHBn+VXWRVDYlZAHl/RpeBfkOKsRDQuFkoM7Zvtky1uKDRj7E7l8Z9HYWPJjUWJNwkCUvv0WRw F8yMSqPAugFHEtyZ/ZQpa7DEBuwNHS8AltZbutr3xRKh6p0ycqEuKJKuo00OAczSPaxLsaqq4XBQU w19XIUvBOpvbK8TREyT/iSVjTs7l3oM9MY8rB3wNEu+gEppZbGhlWSS1XMNEqq6OsnTwyZaGH9Ce8 kqxfc2DU1khUo5j7ol+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0R8-00000000GXf-24Z1; Thu, 25 Jan 2024 14:10:34 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ph-00000000FbC-06QO for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=I2/XefLqBgsIGZVpSehKcL20EDK3ATo7IzOfzNufeBI=; b=mbwDGUvbE5G9kg1ChH/Vq2uXVh r33o/uOCkXmMxDM7lG5Qx+j0VxDYUueNPn/EJjHpF+sKr235HI9Y47YOyNSLeQwOqO/06wg+4eYo7 OOuJjyoGdT6w83kQMQ+FDixa3SBPSkHjv5pJcoKAzaoAiMYXDRARkjyFqCUF4cpXajEZ3DfDIBQ5J drtkXop3c3kQbxs7XktxFDmfJ6C463EwiYRXiuW0+7yjnQ8eRLRkQJf/9dDsDl4Mng56CyTrK8QqU tgz9peh8rPzo7UK9o3LqUuO2dSrg9VCLbN4s48CjjsJXQ2Um2c3IhAbnfkFie4NS5KwVngek1m373 hjp44B9A==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDS-2tdm for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:16 +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 1rSyZE-00043y-59; Thu, 25 Jan 2024 13:10:48 +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 1rSyZD-002HQx-3B; Thu, 25 Jan 2024 13:10:47 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZD-007n0Y-05; Thu, 25 Jan 2024 13:10:47 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 036/111] pwm: vt8500: Make use of pwmchip_parent() macro Date: Thu, 25 Jan 2024 13:08:58 +0100 Message-ID: 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=3929; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=6N+OroGyfr8Zv9hj4gyioNXSGQtISRkgGmItwvdinxg=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9j/mLFlyrsxTGO2eCSVCFlG6ZLpf+YL32wz bb53hfgDkuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPYwAKCRCPgPtYfRL+ TtR7CAC4qdbDwKFYVfHl7bjXxXjZ0IpOEkbbINYFcsKJStB5zCgCUS7Ye+h8SqVh7heSBrAcADD kHQRfEeFK3eMsRtddqOEYFseKqx9AElNZL5e414ne0dbfYNcaiLopllhHZQ4YBnRO8xMeqgUgCf ms6Ou7+jV/2OVHj49gJlHSx/CbWFgPlIXjevUlqEnNzayW3CuEn9MiqpU6bxuKBmEr3UO7NfWvE kVyQVTfMM/wMnK8ZUrtnTO6V06lYQJvLHtFMfme/LrTyPna1yWS2ualr8EKrTPbKdJro7TTvP/o RS30qWYBqzmqfBO1zuKKkjuBl/aN6qsPQ0VouEZ1RS14PHvF 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-20240125_121310_096550_F8C772E3 X-CRM114-Status: GOOD ( 12.59 ) 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 struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the macro provided for exactly this purpose. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-vt8500.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c index 7bfeacee05d0..def48dbef808 100644 --- a/drivers/pwm/pwm-vt8500.c +++ b/drivers/pwm/pwm-vt8500.c @@ -53,8 +53,9 @@ struct vt8500_chip { #define to_vt8500_chip(chip) container_of(chip, struct vt8500_chip, chip) #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) -static inline void vt8500_pwm_busy_wait(struct vt8500_chip *vt8500, int nr, u8 bitmask) +static inline void vt8500_pwm_busy_wait(struct pwm_chip *chip, int nr, u8 bitmask) { + struct vt8500_chip *vt8500 = to_vt8500_chip(chip); int loops = msecs_to_loops(10); u32 mask = bitmask << (nr << 8); @@ -62,7 +63,7 @@ static inline void vt8500_pwm_busy_wait(struct vt8500_chip *vt8500, int nr, u8 b cpu_relax(); if (unlikely(!loops)) - dev_warn(vt8500->chip.dev, "Waiting for status bits 0x%x to clear timed out\n", + dev_warn(pwmchip_parent(chip), "Waiting for status bits 0x%x to clear timed out\n", mask); } @@ -77,7 +78,7 @@ static int vt8500_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, err = clk_enable(vt8500->clk); if (err < 0) { - dev_err(chip->dev, "failed to enable clock\n"); + dev_err(pwmchip_parent(chip), "failed to enable clock\n"); return err; } @@ -103,18 +104,18 @@ static int vt8500_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, dc = div64_u64(c, period_ns); writel(prescale, vt8500->base + REG_SCALAR(pwm->hwpwm)); - vt8500_pwm_busy_wait(vt8500, pwm->hwpwm, STATUS_SCALAR_UPDATE); + vt8500_pwm_busy_wait(chip, pwm->hwpwm, STATUS_SCALAR_UPDATE); writel(pv, vt8500->base + REG_PERIOD(pwm->hwpwm)); - vt8500_pwm_busy_wait(vt8500, pwm->hwpwm, STATUS_PERIOD_UPDATE); + vt8500_pwm_busy_wait(chip, pwm->hwpwm, STATUS_PERIOD_UPDATE); writel(dc, vt8500->base + REG_DUTY(pwm->hwpwm)); - vt8500_pwm_busy_wait(vt8500, pwm->hwpwm, STATUS_DUTY_UPDATE); + vt8500_pwm_busy_wait(chip, pwm->hwpwm, STATUS_DUTY_UPDATE); val = readl(vt8500->base + REG_CTRL(pwm->hwpwm)); val |= CTRL_AUTOLOAD; writel(val, vt8500->base + REG_CTRL(pwm->hwpwm)); - vt8500_pwm_busy_wait(vt8500, pwm->hwpwm, STATUS_CTRL_UPDATE); + vt8500_pwm_busy_wait(chip, pwm->hwpwm, STATUS_CTRL_UPDATE); clk_disable(vt8500->clk); return 0; @@ -128,14 +129,14 @@ static int vt8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) err = clk_enable(vt8500->clk); if (err < 0) { - dev_err(chip->dev, "failed to enable clock\n"); + dev_err(pwmchip_parent(chip), "failed to enable clock\n"); return err; } val = readl(vt8500->base + REG_CTRL(pwm->hwpwm)); val |= CTRL_ENABLE; writel(val, vt8500->base + REG_CTRL(pwm->hwpwm)); - vt8500_pwm_busy_wait(vt8500, pwm->hwpwm, STATUS_CTRL_UPDATE); + vt8500_pwm_busy_wait(chip, pwm->hwpwm, STATUS_CTRL_UPDATE); return 0; } @@ -148,7 +149,7 @@ static void vt8500_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) val = readl(vt8500->base + REG_CTRL(pwm->hwpwm)); val &= ~CTRL_ENABLE; writel(val, vt8500->base + REG_CTRL(pwm->hwpwm)); - vt8500_pwm_busy_wait(vt8500, pwm->hwpwm, STATUS_CTRL_UPDATE); + vt8500_pwm_busy_wait(chip, pwm->hwpwm, STATUS_CTRL_UPDATE); clk_disable(vt8500->clk); } @@ -168,7 +169,7 @@ static int vt8500_pwm_set_polarity(struct pwm_chip *chip, val &= ~CTRL_INVERT; writel(val, vt8500->base + REG_CTRL(pwm->hwpwm)); - vt8500_pwm_busy_wait(vt8500, pwm->hwpwm, STATUS_CTRL_UPDATE); + vt8500_pwm_busy_wait(chip, pwm->hwpwm, STATUS_CTRL_UPDATE); return 0; } From patchwork Thu Jan 25 12:09:04 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: 13530885 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 BC91BC47258 for ; Thu, 25 Jan 2024 14:08:52 +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=cYWIo8zQdkKM5NvWr2Df4dchEHG4mQjCj4ykh1sEBQg=; b=Bu5DuHFczY5dVW rLLpJ3qagYho5qtKrz5ufHaQNZjlS4QOYe1iNtp0mgOpea/DU184GdU+9hyF96ZBa53Jogll0VF0w KEsixm4q86OH8vmhR/T/1M0fzoUuQ9s+zB51Lxp6i+ypUVst6TYt/TQ2MVBfKdjp+U35h4afGgLkd dgBiM5WnnfJAm8J5pzAZjGXJ5KY9BxZxSOOGQ+/98+b73/NgVeOc4t+k8CSCZP3uQqHJF5s0Hz0Uu DNqmmmCzsN/VSTy56dvhmJv/YfOC63rqGTSbGLmviXNotTpAZnybTnQN8TmvGEBveq5ulfuh4NgjR H/LATRQ6nNsk2/7JgNFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PK-00000000FGP-1VI1; Thu, 25 Jan 2024 14:08:42 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Oc-00000000Evs-0NUg for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:07:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=8Um1r0x/YD0JJ4xTOvDzrcYDspd9p9lm5UFna3sW+0U=; b=jZT/F6AqWBe/ZPhbof8ThCdkCT ZvmMi4dDVBfPvYdK7CxInQ+dmT/j53kXxkTIN6YsBc9jas3W+Qk17f4Uwx/ofqvXCSM9W0ObrbjmB apGJ36s6clMpmMLv/lygPB5yHeSfJn9b3T3TzzmKtiO8cOqlefrkasS3T62JRwrV4lreivBk0ljMp WQ/56oqZQQ0A1957zgPsF0Z72NPCiUPo7HqKDJtzQsvHP/PYtMeWcBAip+fTGzKjbVfREpwq//xOO 2kRY8PUJU5r+eoKxNVnklyTlby++DQRE1YTWi9ndtCX/W6vIShz45jOfEBvt66oyeOCPGA1nUluBs uOMpmUPQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSyba-00000009sDa-1UDc for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:21 +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 1rSyZF-0004B7-SP; Thu, 25 Jan 2024 13:10:49 +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 1rSyZE-002HRP-Dv; Thu, 25 Jan 2024 13:10:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZE-007n0x-17; Thu, 25 Jan 2024 13:10:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Hector Martin , Sven Peter , linux-pwm@vger.kernel.org Cc: Alyssa Rosenzweig , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 042/111] pwm: apple: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:04 +0100 Message-ID: <2e206fd150681b9723ab19e3cccee6888a3b46de.1706182805.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=2027; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=H2gBKJqPhxEH02LxqBcE7cgJijeXYph95OqB+mGaqEU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9rlpZFHURacBlhG0kY5bULxwpd5zYoQh1k7 lR9eSFMJHaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPawAKCRCPgPtYfRL+ Ti5SB/9YqXuqNC3bQ8hqIp2f5nMBxU8URTKYa2VuwlklztiyBxaGLZkKep9xeaYBMJ/AuKpWY5e 4F/vGHWma3E2FxesQJn65+H9I+o2bu4w/KiwJLmwgCi/eAcPyfYc7UAwskM6FRmwUXuwZdiXLHU FJ6jlxBm+a/+rzEJdFeuUZEhKNmxHoIQGu3Tgh3+JvRg6AxVGE+Iy++WuuhC47meesmW11BLbU0 e0teupMjotHCBgM5u6sWu6Uk/3dyTxSQjvbiaq7Xn1996TMvKAj1kP7p0xyzFxO1xd8xBaHx1LS fbqHrHjx5fcVZOq9If0XCtolQo9ixqeNCLK7VtiaPPVR10N9 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-20240125_121315_756857_8E99F6C7 X-CRM114-Status: GOOD ( 12.94 ) 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 This prepares the pwm-apple driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-apple.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-apple.c b/drivers/pwm/pwm-apple.c index 4d755b628d9e..6e58aca2f13c 100644 --- a/drivers/pwm/pwm-apple.c +++ b/drivers/pwm/pwm-apple.c @@ -32,14 +32,13 @@ #define APPLE_PWM_CTRL_OUTPUT_ENABLE BIT(14) struct apple_pwm { - struct pwm_chip chip; void __iomem *base; u64 clkrate; }; static inline struct apple_pwm *to_apple_pwm(struct pwm_chip *chip) { - return container_of(chip, struct apple_pwm, chip); + return pwmchip_get_drvdata(chip); } static int apple_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, @@ -103,13 +102,16 @@ static const struct pwm_ops apple_pwm_ops = { static int apple_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct apple_pwm *fpwm; struct clk *clk; int ret; - fpwm = devm_kzalloc(&pdev->dev, sizeof(*fpwm), GFP_KERNEL); - if (!fpwm) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*fpwm)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + + fpwm = to_apple_pwm(chip); fpwm->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(fpwm->base)) @@ -129,11 +131,9 @@ static int apple_pwm_probe(struct platform_device *pdev) if (fpwm->clkrate > NSEC_PER_SEC) return dev_err_probe(&pdev->dev, -EINVAL, "pwm clock out of range"); - fpwm->chip.dev = &pdev->dev; - fpwm->chip.npwm = 1; - fpwm->chip.ops = &apple_pwm_ops; + chip->ops = &apple_pwm_ops; - ret = devm_pwmchip_add(&pdev->dev, &fpwm->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "unable to add pwm chip"); From patchwork Thu Jan 25 12:09:05 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: 13530903 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 DB146C4828C for ; Thu, 25 Jan 2024 14:10:53 +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=/gE5jOfEsRhMzmdihE5LWmocDbdSopRz8emWk70i9Yc=; b=E7sbHJ6+uGeC6h oC6uGGz3InN+9vvsBGQCYsrlb3bSRA4SlCIS3q8J2FLsKwxZ69ULy6z7OFb0tFHIYIBAVsDL0Dccc OLQpGbmA5Rh8zqm4TdUKhBNOcgEpEqw7Rx4k+9jgzfyENBYvrrN2KB6BVbGQo4E1rxmrWZOscXekA toOgBxp8bVUnvkASDEHOnxk+PxG1CHfyy4jJblGkjPTxCtJOXi+/BYOV2NiPmOgGz5iBpLpHoAvaQ m75d7le3J2zMHN13mKxbExLkPk1A5FpfCC78Eb1eL15fCIlKBkmqOHsxLsuBENVbFPuPq7bl1B9H6 dtKl7eYBe1sEQKPNz+WA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0RC-00000000GZq-15kd; Thu, 25 Jan 2024 14:10:38 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pi-00000000FbC-02pY for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=ytAF6wB67gOH35ywoWlQypQJOflvZ4aIzWEmDq21PoA=; b=SkDp1YCMFvB1PqjRCwnAeSYJZz B60OdVogVhpuJwZn+EtoZkG/H3As+mB/+RNvxTvpzMuxEbgjwxgr+P0bBIKrwPQgQIZVS7Yu1YHzN TfgxiPJWPklmKAAANYJbz1ko1xoCDBkpVJz5L9ixFoQxSOIS5z8cd9jJN9GqlaQMTtbfIpFzXqEWa bzIPCXXyO2n9M7BZ0jEVZ/9q9znNDRmbwxXLZRouRoFxE63G7yTzdwOd6WSwlqG4FVVoT0K71wz0K XAc4BNfhLZTc84Dx/3ciESeo7gJZIEcmeMqnZTqcfGynd+b13qlDLtarZS8SFovCY0xnl5wKYjBxP djGrq+Dw==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDa-1tzz for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:15 +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 1rSyZF-0004Bl-Qe; Thu, 25 Jan 2024 13:10:49 +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 1rSyZE-002HRT-JE; Thu, 25 Jan 2024 13:10:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZE-007n11-1e; Thu, 25 Jan 2024 13:10:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 043/111] pwm: atmel-hlcdc: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:05 +0100 Message-ID: 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=4042; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=dLFZTDMUC6xoGbG+9xpu86busFxUvBdf0vDphT6lr2Y=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9s0h3gK6rFD/kqyrpeUbSStlKuipc0ZZiel 0jwMgKdzzyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPbAAKCRCPgPtYfRL+ TjQ/CACxujpWZNvzJn4Gg7OPhFPTJ7RRHbsQv2C8UA37deCkyxEiKPA8CZYiRRkswSQk6N8zh1o e6ZozKwQ3Ai9KFJ2BnE6LK/1dt1f2xAp1k/esRnSWm1F04Wdenyk/PH8xV+uX0QxJINIVsfy+p6 EYC1EzDqHuyKDk6EGIpbjeis5NbUEXSkL3oe5SVbHIzlph2vb5AC96jjKVI27DQDFFB+o0OiPY6 HffJiLydDPFbZkhRWnIg4UfQEugKTe2zTgccFJKkCeJjHpP+qMB+bHUOuwml4SvGbDlqCK0hXrT lg4SNRTYtEjrPLP0zKQYnOIOQui1daCp1iOgOdG6CgaPxp+k 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-20240125_121309_874010_DFBE12FA X-CRM114-Status: GOOD ( 15.60 ) 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 This prepares the pwm-atme-hlcdc driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-atmel-hlcdc.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c index 3f2c5031a3ba..aa1b67b6f2ea 100644 --- a/drivers/pwm/pwm-atmel-hlcdc.c +++ b/drivers/pwm/pwm-atmel-hlcdc.c @@ -28,7 +28,6 @@ struct atmel_hlcdc_pwm_errata { }; struct atmel_hlcdc_pwm { - struct pwm_chip chip; struct atmel_hlcdc *hlcdc; struct clk *cur_clk; const struct atmel_hlcdc_pwm_errata *errata; @@ -36,7 +35,7 @@ struct atmel_hlcdc_pwm { static inline struct atmel_hlcdc_pwm *to_atmel_hlcdc_pwm(struct pwm_chip *chip) { - return container_of(chip, struct atmel_hlcdc_pwm, chip); + return pwmchip_get_drvdata(chip); } static int atmel_hlcdc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, @@ -182,10 +181,11 @@ static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_sama5d3_errata = { static int atmel_hlcdc_pwm_suspend(struct device *dev) { - struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev); + struct pwm_chip *chip = dev_get_drvdata(dev); + struct atmel_hlcdc_pwm *atmel = to_atmel_hlcdc_pwm(chip); /* Keep the periph clock enabled if the PWM is still running. */ - if (pwm_is_enabled(&atmel->chip.pwms[0])) + if (pwm_is_enabled(&chip->pwms[0])) clk_disable_unprepare(atmel->hlcdc->periph_clk); return 0; @@ -193,11 +193,12 @@ static int atmel_hlcdc_pwm_suspend(struct device *dev) static int atmel_hlcdc_pwm_resume(struct device *dev) { - struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev); + struct pwm_chip *chip = dev_get_drvdata(dev); + struct atmel_hlcdc_pwm *atmel = to_atmel_hlcdc_pwm(chip); struct pwm_state state; int ret; - pwm_get_state(&atmel->chip.pwms[0], &state); + pwm_get_state(&chip->pwms[0], &state); /* Re-enable the periph clock it was stopped during suspend. */ if (!state.enabled) { @@ -206,8 +207,7 @@ static int atmel_hlcdc_pwm_resume(struct device *dev) return ret; } - return atmel_hlcdc_pwm_apply(&atmel->chip, &atmel->chip.pwms[0], - &state); + return atmel_hlcdc_pwm_apply(chip, &chip->pwms[0], &state); } static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops, @@ -243,15 +243,17 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev) { const struct of_device_id *match; struct device *dev = &pdev->dev; + struct pwm_chip *chip; struct atmel_hlcdc_pwm *atmel; struct atmel_hlcdc *hlcdc; int ret; hlcdc = dev_get_drvdata(dev->parent); - atmel = devm_kzalloc(dev, sizeof(*atmel), GFP_KERNEL); - if (!atmel) - return -ENOMEM; + chip = devm_pwmchip_alloc(dev, 1, sizeof(*atmel)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + atmel = to_atmel_hlcdc_pwm(chip); ret = clk_prepare_enable(hlcdc->periph_clk); if (ret) @@ -262,11 +264,9 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev) atmel->errata = match->data; atmel->hlcdc = hlcdc; - atmel->chip.ops = &atmel_hlcdc_pwm_ops; - atmel->chip.dev = dev; - atmel->chip.npwm = 1; + chip->ops = &atmel_hlcdc_pwm_ops; - ret = pwmchip_add(&atmel->chip); + ret = pwmchip_add(chip); if (ret) { clk_disable_unprepare(hlcdc->periph_clk); return ret; @@ -279,9 +279,10 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev) static void atmel_hlcdc_pwm_remove(struct platform_device *pdev) { - struct atmel_hlcdc_pwm *atmel = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); + struct atmel_hlcdc_pwm *atmel = to_atmel_hlcdc_pwm(chip); - pwmchip_remove(&atmel->chip); + pwmchip_remove(chip); clk_disable_unprepare(atmel->hlcdc->periph_clk); } From patchwork Thu Jan 25 12:09:06 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: 13530893 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 C8C25C47258 for ; Thu, 25 Jan 2024 14:09:24 +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=AZCkvJNUHt9WzNLSLqpP2CphaLspLKVGHYwst5Z/YPM=; b=RmahhedTitQqYc DycjRHB7qDLStBd065GXI60IJmMJzG3HazsDzf0ZbUinIcp+Hh2h8x2P9usOwT0AAO6T6MmqchwV4 d1JKchR+z9a6iSSrqntNhjLS8I/Ofy790Cum52Y9jlnF/Pk9zKY3rbIKcJ4edLcAlLPcBHJyRiJvP Y4C/ENUS+M0sTIqBFqzPCu8o4WhfspwV75zyRnagTrtfAtZALIqPPqHWsF1WEc5JBve+2LLc7vNKX p+/8/FkdNHtwSSS5uuDWSVEu8IFlNlulG/+yxpa44Bh5Xsb39ia5WRMUE9jLyEaT3Q8iW0gaWME6X nAhyet9rT0pB5pfVunmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pm-00000000FhH-1MKv; Thu, 25 Jan 2024 14:09:10 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0P3-00000000FA2-1jk5 for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=iiLNrI2fgyS4sfjxn+B34OIFQ6EgYyW7o7DF+5Uw2x8=; b=pLCceGoSq6AqITAFHALw9FRa5g YcSIn6yNwx+dBHVqdTlvb37vNaki8c41SCmxyC/qIJfWeKJwIDA4y+jpbgwPDRJqY9y83xePfpdM/ +KE0T2hA+7Kt7LUc47YH3kzLddvZQ0FI+bX+eMsnrgA5jC6a6SIaaCzMebz12n6ImbOuoIn5HXzvx O4V/KleXokBA/Rf+swfnkJdp0bYE2U4Ee/xo+wV8NgruzodWyQl+e+G3GAFzKxGJitFglrEbkhGVI rJWA2JqU/4bEj47UUnzPArLPTmyfRL6cViNZyvo/qpP3uowE6TgCd6KFLuAEPE53jeA0GMWcgEcjw zpLRt3Og==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000009sDe-25ef for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:19 +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 1rSyZF-0004CV-Bl; Thu, 25 Jan 2024 13:10:49 +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 1rSyZE-002HRW-P9; Thu, 25 Jan 2024 13:10:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZE-007n15-2G; Thu, 25 Jan 2024 13:10:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Claudiu Beznea , Nicolas Ferre , Alexandre Belloni , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 044/111] pwm: atmel: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:06 +0100 Message-ID: <3e8a8d3e493f473b02c5551b8185c285f5e3701b.1706182805.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=3197; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=HqaMlO4bwz8FFPc9Sh9l7EOcdPN0NloTc6UjhKjzABE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9tTtw+Qm7qFLZSyjxnqBJVeWPjvL8bfTeFz XWo4e9QeSuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPbQAKCRCPgPtYfRL+ TvpmB/4448JtaJVVnSq1/4PrVO/LXyNG7PFSiGJEkrXeGHZNIkGAoUWHv4byXmsb231Cm9jRimj /EvAD/U07gUCDNW9Wh8jc+HvvR//6XhvJzVA6Oq8iEuhsS6W8wd1pF2ML9IEo9+3H+JabI3B1je aD5mS0zUm2emRS5r7E/BmHEdjSvr0l746f1ja4BW/4a7UMP3iPuQOlbsHmNPHeYx5vRjDlGmvIj 5PuV3epkJ6hLJVeN70jVPS0RQnuRU/Z6qJ7qvaNYFuHaxxPZnoNVbRt8Fk4Ox5k67TOvjcStiZS K265jPuiZjOVozA2tgU8FMAvYPFlaExHlN88Oyl4/0aGYOAW 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-20240125_121313_934790_EE11D5AC X-CRM114-Status: GOOD ( 14.61 ) 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 This prepares the pwm-atmel driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-atmel.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index 4ef91fe6f147..ab84229161ef 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c @@ -77,7 +77,6 @@ struct atmel_pwm_data { }; struct atmel_pwm_chip { - struct pwm_chip chip; struct clk *clk; void __iomem *base; const struct atmel_pwm_data *data; @@ -99,7 +98,7 @@ struct atmel_pwm_chip { static inline struct atmel_pwm_chip *to_atmel_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct atmel_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static inline u32 atmel_pwm_readl(struct atmel_pwm_chip *chip, @@ -473,7 +472,7 @@ static int atmel_pwm_enable_clk_if_on(struct pwm_chip *chip, bool on) if (!sr) return 0; - cnt = bitmap_weight(&sr, atmel_pwm->chip.npwm); + cnt = bitmap_weight(&sr, chip->npwm); if (!on) goto disable_clk; @@ -481,9 +480,8 @@ static int atmel_pwm_enable_clk_if_on(struct pwm_chip *chip, bool on) for (i = 0; i < cnt; i++) { ret = clk_enable(atmel_pwm->clk); if (ret) { - dev_err(pwmchip_parent(chip), - "failed to enable clock for pwm %pe\n", - ERR_PTR(ret)); + dev_err_probe(pwmchip_parent(chip), ret, + "failed to enable clock for pwm\n"); cnt = i; goto disable_clk; @@ -501,12 +499,14 @@ static int atmel_pwm_enable_clk_if_on(struct pwm_chip *chip, bool on) static int atmel_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct atmel_pwm_chip *atmel_pwm; int ret; - atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL); - if (!atmel_pwm) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 4, sizeof(*atmel_pwm)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + atmel_pwm = to_atmel_pwm_chip(chip); atmel_pwm->data = of_device_get_match_data(&pdev->dev); @@ -522,15 +522,13 @@ static int atmel_pwm_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(atmel_pwm->clk), "failed to get prepared PWM clock\n"); - atmel_pwm->chip.dev = &pdev->dev; - atmel_pwm->chip.ops = &atmel_pwm_ops; - atmel_pwm->chip.npwm = 4; + chip->ops = &atmel_pwm_ops; - ret = atmel_pwm_enable_clk_if_on(&atmel_pwm->chip, true); + ret = atmel_pwm_enable_clk_if_on(chip, true); if (ret < 0) return ret; - ret = devm_pwmchip_add(&pdev->dev, &atmel_pwm->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) { dev_err_probe(&pdev->dev, ret, "failed to add PWM chip\n"); goto disable_clk; @@ -539,7 +537,7 @@ static int atmel_pwm_probe(struct platform_device *pdev) return 0; disable_clk: - atmel_pwm_enable_clk_if_on(&atmel_pwm->chip, false); + atmel_pwm_enable_clk_if_on(chip, false); return ret; } From patchwork Thu Jan 25 12:09:07 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: 13530897 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 10CECC48260 for ; Thu, 25 Jan 2024 14:09:40 +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=QHpIBsgJOaJaeBuVZrKaFVhhAQXq3UTnztl7Q60LgV0=; b=wBS0U7lBqLAb5a qpTxcYnobm2Je2ZcRQmzaFsZJDXnkYY14S5g0FN9cCvayqLgJyotmzEiT8igKynaQSDvaUt6FtoPH 7xzU8sdj/dUIUh+vf7WNxT5AF+X/qz0jxAfAaKvt4O1G4WK/6xTp2lF0hmnjztva3DE8jNykPG+D9 rQEAA50Q8IMARnW6YCU04e2luIqRjn5eQqa/0Qa9Gf48m6wBibMWpUajidQqVa3QXtBrdYmDnwPlR tNJDyL1IWeyXoUELvTcR3tagILdI3honvSNlRrk/d5vjN+K3jJB89ZRwvEIUKnmY0qTM6qRUwTlbG aSlt89T7YH/dxin/4asw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Q1-00000000FtQ-0lgm; Thu, 25 Jan 2024 14:09:25 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0P4-00000000FA2-3IGj for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=1UtYQ81IDzSphm6o/E15PsImLZcjbPSxsSzzpRNM73E=; b=uE0wQsM/D+ScT7eROmGwLymFnZ B1Caf5mX3fnEGi5Y1ABi2vOGxEIjOmVqLuXgBtS0vOfOHPOO25fOoDGPnI93LDKst/Scd6vRjdgeN etuy4gS2mQ5M1kgqzlR/j8XgWjt8TusRRZjejo2xSfBR6J6e+bh/WHImvTSCFWFD3X+g8yTnZauJy ZBGqPciW5/ZD7ss1hxbdX5fTdH+9Luj/ODLPJm2t0U2kDtZunQwxc+gK73VJXzRa/4Oimtvyoj+AF 4sLxTUmHjja9wSMgQlq1Lvj+Rw5iys+1HE1KRPvvc4z2DhqRA30O7xXw84ghGtnjf6yI5m7mhdvUK PXknKQNg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000009sDZ-1DzK for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:17 +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 1rSyZF-0004DE-Rp; Thu, 25 Jan 2024 13:10:49 +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 1rSyZE-002HRZ-Vj; Thu, 25 Jan 2024 13:10:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZE-007n19-2u; Thu, 25 Jan 2024 13:10:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 045/111] pwm: atmel-tcb: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:07 +0100 Message-ID: <929bfbd2695535c73260647e16f44de17ec892af.1706182805.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=2971; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=Qrt9vaeR4KUuMfztIWBoWRb0aAUfBcwyeUrVK67lMM4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9uVoZxZ932+hxCc1MLX7pX118ipIVmyxMd7 QEJ8McityaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPbgAKCRCPgPtYfRL+ TiGrB/9ietXPsxs0oMkY3xy79/6GRlF8x68TjvUWo6tC7zsKbLXZ53MwqX5oBPo7J+iuB6mRJZ/ uH9Sfi80JKlq0LaAc7SoFKRgkN9LrRlXv98D4Mes1pIRpQJ/bierH/KprkGEei5EBVXVlMESWa0 z/13bIk3NpzCGZSHUkhjBI74HIhwaxeH9m1mdCIilmE+yY6q1E9KPe0at0CSC0Sh3srV4R1aUoM kZc3i5S4C80ye/akqyniiltBU1cxNmGugVMF1RNiO3p9J0tsaiI4rYWf5RGNuqrPEepzBk9gPWX qHofFlXGd8ChFgWMoE8DbB+Cp4SYOYblw989mVo3JK0Gkho+ 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-20240125_121313_716192_46435A18 X-CRM114-Status: GOOD ( 14.29 ) 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 This prepares the pwm-atmel-tcb driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-atmel-tcb.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c index 80121ab81a01..0663685532ec 100644 --- a/drivers/pwm/pwm-atmel-tcb.c +++ b/drivers/pwm/pwm-atmel-tcb.c @@ -47,7 +47,6 @@ struct atmel_tcb_channel { }; struct atmel_tcb_pwm_chip { - struct pwm_chip chip; spinlock_t lock; u8 channel; u8 width; @@ -63,7 +62,7 @@ static const u8 atmel_tcb_divisors[] = { 2, 8, 32, 128, 0, }; static inline struct atmel_tcb_pwm_chip *to_tcb_chip(struct pwm_chip *chip) { - return container_of(chip, struct atmel_tcb_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static int atmel_tcb_pwm_request(struct pwm_chip *chip, @@ -389,6 +388,7 @@ static const struct of_device_id atmel_tcb_of_match[] = { static int atmel_tcb_pwm_probe(struct platform_device *pdev) { const struct of_device_id *match; + struct pwm_chip *chip; struct atmel_tcb_pwm_chip *tcbpwm; const struct atmel_tcb_config *config; struct device_node *np = pdev->dev.of_node; @@ -396,9 +396,10 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev) int err; int channel; - tcbpwm = devm_kzalloc(&pdev->dev, sizeof(*tcbpwm), GFP_KERNEL); - if (tcbpwm == NULL) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, NPWM, sizeof(*tcbpwm)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + tcbpwm = to_tcb_chip(chip); err = of_property_read_u32(np, "reg", &channel); if (err < 0) { @@ -436,9 +437,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev) } } - tcbpwm->chip.dev = &pdev->dev; - tcbpwm->chip.ops = &atmel_tcb_pwm_ops; - tcbpwm->chip.npwm = NPWM; + chip->ops = &atmel_tcb_pwm_ops; tcbpwm->channel = channel; tcbpwm->width = config->counter_width; @@ -448,11 +447,11 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev) spin_lock_init(&tcbpwm->lock); - err = pwmchip_add(&tcbpwm->chip); + err = pwmchip_add(chip); if (err < 0) goto err_disable_clk; - platform_set_drvdata(pdev, tcbpwm); + platform_set_drvdata(pdev, chip); return 0; @@ -473,9 +472,10 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev) static void atmel_tcb_pwm_remove(struct platform_device *pdev) { - struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); + struct atmel_tcb_pwm_chip *tcbpwm = to_tcb_chip(chip); - pwmchip_remove(&tcbpwm->chip); + pwmchip_remove(chip); clk_disable_unprepare(tcbpwm->slow_clk); clk_put(tcbpwm->gclk); From patchwork Thu Jan 25 12:09:08 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: 13530898 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 42BD4C47258 for ; Thu, 25 Jan 2024 14:10:44 +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=oqEkhGjjU9n9wqq+8Yw9WwbJ65BtFNKqRuyCzMCiATM=; b=MrYbkwUuNSUmUe T9mfR8gsL/sTqrfVF3hkpTRn72VrNzslOOAaXFeXcAy4wcSIggj5rNgy0tgzTbV7s391rWofbxeHc xUiFPGfYEnYJ5onudwb2Eb8b2nDz6CjFfg90TQ2hb4PHowrfNe4enQ6ecKuJ4orFmGYfOkGjEv7/V gcnvqq+mAwvdlnKVt56O3kgW387b3V+MhjQSoCaNDR8m1CrU3p49cZAmBWlAmWZbJKxpInjNWCfqX ErxgvvjW+e7jfpgVLFX66HmKU2hvPOOvsLSBO5h8/P5Rj1fgJvYVNsLtCty/6aziu3QA3NTJ+oWzp wSU/Gz6/PYI83q2osu3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0R7-00000000GX9-2bIi; Thu, 25 Jan 2024 14:10:33 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pg-00000000FbC-3APx for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=V1mtQEUhF1Ve5IJnhZAiJk92SCG45naY1Ozfd0bT2BA=; b=XvNG09P08dAHJJS78C96WOP3tB YqCNlf0NxZn34RpG83Xyfpy40Uirw11W+tOyscu3kqToZb5hIB7k3JCx9Ewv1Z+oAcaKMu/Stc9JF IZAJvmCHB7cvFtfo+/qB8HE0WO8yOQH2Df/OjeTv5nbzS6blO7MY71RwyeTgpjTTkijSXb3/C8KFI D/zCE3YNR7ejGulGoxPwd845IG+MEhpOigEFeDO7Mhx6JlzLymJwE6IdnHzEtJb7oPogSpuUhdM2Y QYiLxeRgCJ6MW3eH+WfukjDJVjTsonx/zzeh0J1tAwjxcUPS55VSTJe3oOyZVNU9iBh1dlolpOjFJ qtKazCfQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybU-00000009sDg-380j for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:16 +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 1rSyZF-0004Dw-RI; Thu, 25 Jan 2024 13:10:49 +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 1rSyZF-002HRc-5v; Thu, 25 Jan 2024 13:10:49 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZF-007n1D-0K; Thu, 25 Jan 2024 13:10:49 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Florian Fainelli , Ray Jui , Scott Branden , linux-pwm@vger.kernel.org Cc: Broadcom internal kernel review list , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 046/111] pwm: bcm2835: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:08 +0100 Message-ID: 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=2088; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=neQkkkXDHUEM9dSo5MAWe6moa15OMaMntAJ6c9xCReQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9vN3MiJgOE+8YM2JmyCFJtFosL4WRveO87u BWJ/eitXHuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPbwAKCRCPgPtYfRL+ TqLxB/9YKXtEWsPi9SVOPdPwSqXSRyHuCh8NojbANO7EqjpTT1pGQVTVnb5qnW1DJSRvdotYx5h Mr6vqdqqjQ5S6HzBmSq3uZuBMT9BLE2nbJnERTyOqnV8fJY0Y2ZLn5o7PPWrTgsLBt6j1KJDndX 3vs1gGuLXp3WzKuV1kWYRLVIbx0j+tdXX1grM6bdDKVHzPfH9/lPlI0IchuqbvPPqlXfPE316dS 6ZjQKW0G3GfLrR3ZGfLUiTmDLAyTjeUaVNs0YXE2bu4NCXBiKKSOfI48DzdycrU76p8vl2Jr9um jtbN+O/wFriJPdEwRNSqG90zFVLqgDILuUSA+zhZFebM74Sm 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-20240125_121310_157970_A17AEECD X-CRM114-Status: GOOD ( 12.72 ) 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 This prepares the pwm-bcm2835 driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-bcm2835.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c index 283cf27f25ba..a7450c98368d 100644 --- a/drivers/pwm/pwm-bcm2835.c +++ b/drivers/pwm/pwm-bcm2835.c @@ -24,7 +24,6 @@ #define PERIOD_MIN 0x2 struct bcm2835_pwm { - struct pwm_chip chip; struct device *dev; void __iomem *base; struct clk *clk; @@ -33,7 +32,7 @@ struct bcm2835_pwm { static inline struct bcm2835_pwm *to_bcm2835_pwm(struct pwm_chip *chip) { - return container_of(chip, struct bcm2835_pwm, chip); + return pwmchip_get_drvdata(chip); } static int bcm2835_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) @@ -135,12 +134,14 @@ static void devm_clk_rate_exclusive_put(void *data) static int bcm2835_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct bcm2835_pwm *pc; int ret; - pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); - if (!pc) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 2, sizeof(*pc)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + pc = to_bcm2835_pwm(chip); pc->dev = &pdev->dev; @@ -168,14 +169,12 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, -EINVAL, "failed to get clock rate\n"); - pc->chip.dev = &pdev->dev; - pc->chip.ops = &bcm2835_pwm_ops; - pc->chip.atomic = true; - pc->chip.npwm = 2; + chip->atomic = true; + chip->ops = &bcm2835_pwm_ops; platform_set_drvdata(pdev, pc); - ret = devm_pwmchip_add(&pdev->dev, &pc->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "failed to add pwmchip\n"); From patchwork Thu Jan 25 12:09:09 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: 13530895 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 B1687C48260 for ; Thu, 25 Jan 2024 14:09:29 +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=4j0AFoOV0UItHbjxA5k6h15tD4TySW+SPO+4aOFdTNU=; b=BFGIFN9/sOlTRw U7cusSSmP6HSr7xFyINfAd+XcVADo19X30L3fGAPXUuwv/o0SJPRLzJ8Jk1rbn25q25Ja5/YuFvNV Cbegty67DDwk0NfGJtH9m+VpUboHpAoG6stNnRXYn8xKzRvLvnEKJ0IsG995l7pDJmfeAgylgDIKU nwtr1zBdafZISIKFjOGHImoaW3XRgJO1IbTtgF+3wEthALrzmsVSI9jWgld4709O6dUd3dI8X9+Cv Hi3cfUyyLVsv+P2lLywXOt2WOld4qVGbFDx8s1XbFIPDtLyOHSlldnTT3efScuOYb/qB7zHr8lWyF fgvO5Npwddm62AN+anCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pn-00000000FiY-4Bfo; Thu, 25 Jan 2024 14:09:12 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0P3-00000000FA2-2iLE for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=GEG2qfft0Mh8KW0ip9+4ogP1mH9tBH0gduBKyOhjsuw=; b=YoLzA3dS1QPfmLQzWx48azS+Nw dgc4AcEBtIG9BGgSgCpNkm3v8xM+L1k7/NFpqdGYcL6Oz48lp7Ntg8C87U5PMYbKv7O96FM4vKd8z APbYqJui/V/qhdEftEhXXfIzyZpKKNwpRptjAQiOFMV2k5ewGPl7nA3WrqskkXGoW09mK69A8uWOt x1ZFS/7rov3YVhAB88Z9rj2LU6W6NJ7Y3tKBUjim9Q3PvdV/SdkJ5HQQr1cRRXa/JLkHjqsSa09rI Sacd9cWwRPEDFJwUlEyL0FV4y+BWppZkvxO9PDP+3EgHVjlJ2/Prvp4siu6fxA9FgY4ZHrnYah1t3 AkK/8Mgw==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000009sDb-1o4W for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:19 +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 1rSyZG-0004Eo-8r; Thu, 25 Jan 2024 13:10:50 +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 1rSyZF-002HRh-BI; Thu, 25 Jan 2024 13:10:49 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZF-007n1H-0s; Thu, 25 Jan 2024 13:10:49 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ray Jui , Scott Branden , linux-pwm@vger.kernel.org Cc: Broadcom internal kernel review list , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 047/111] pwm: bcm-iproc: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:09 +0100 Message-ID: <1b1e749557294b383d15d06f8f2da847a3e7d87f.1706182805.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=2342; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=KnJ19DF+WYdolraq2C+RV1Rwrj5TWFY7glRMFg+qlK4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk9xJDxLxKjbhXCFVsudQML2+70Kv6ydMl25V 2ReDB7mKnuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPcQAKCRCPgPtYfRL+ TgNLCACE9hoI0AR+p7q6vVZ0ZVRqIleC87WOR3rF1SpgbBR3BIuwxApeftKVD19PZd80ePzW6iv LZNKWc55OCjJkyZEF9/Yl8z6SbahfLaPYSi9cL9ADUs/FFFheGW0oYJC2byAmfojS2L5Tbbvbbg oDbsJITjPRB6eYeNTYkf3HAKfIyL3asrez/sRYkLup4HBuR3Vnb6pA0a94wvl35TppdVr0QgQMY 0/yS1zTkNAT9fcsRR4ZU1AZHZkk7w3y24k2KCbi08t3S/xUZNGt8Awy7+rEq+enro2r+0R3f/Xm O7qWCAYAXrkTaq1Dpf/r0vl9KV8u1EVjeXCjoS7GgVHZY7c/ 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-20240125_121313_901124_934793FD X-CRM114-Status: GOOD ( 13.99 ) 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 This prepares the pwm-bcm-iproc driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-bcm-iproc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/pwm/pwm-bcm-iproc.c b/drivers/pwm/pwm-bcm-iproc.c index 758254025683..f4c9f10e490e 100644 --- a/drivers/pwm/pwm-bcm-iproc.c +++ b/drivers/pwm/pwm-bcm-iproc.c @@ -34,14 +34,13 @@ #define IPROC_PWM_PRESCALE_MAX 0x3f struct iproc_pwmc { - struct pwm_chip chip; void __iomem *base; struct clk *clk; }; static inline struct iproc_pwmc *to_iproc_pwmc(struct pwm_chip *chip) { - return container_of(chip, struct iproc_pwmc, chip); + return pwmchip_get_drvdata(chip); } static void iproc_pwmc_enable(struct iproc_pwmc *ip, unsigned int channel) @@ -187,20 +186,20 @@ static const struct pwm_ops iproc_pwm_ops = { static int iproc_pwmc_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct iproc_pwmc *ip; unsigned int i; u32 value; int ret; - ip = devm_kzalloc(&pdev->dev, sizeof(*ip), GFP_KERNEL); - if (!ip) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 4, sizeof(*ip)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + ip = to_iproc_pwmc(chip); platform_set_drvdata(pdev, ip); - ip->chip.dev = &pdev->dev; - ip->chip.ops = &iproc_pwm_ops; - ip->chip.npwm = 4; + chip->ops = &iproc_pwm_ops; ip->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(ip->base)) @@ -214,14 +213,14 @@ static int iproc_pwmc_probe(struct platform_device *pdev) /* Set full drive and normal polarity for all channels */ value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); - for (i = 0; i < ip->chip.npwm; i++) { + for (i = 0; i < chip->npwm; i++) { value &= ~(1 << IPROC_PWM_CTRL_TYPE_SHIFT(i)); value |= 1 << IPROC_PWM_CTRL_POLARITY_SHIFT(i); } writel(value, ip->base + IPROC_PWM_CTRL_OFFSET); - ret = devm_pwmchip_add(&pdev->dev, &ip->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "failed to add PWM chip\n"); From patchwork Thu Jan 25 12:09:12 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: 13530896 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 AC8ADC48285 for ; Thu, 25 Jan 2024 14:09:31 +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=Zz/gkfgS8RPmUe/9pHWxOwp8cPOL9WhDzwZjwu14t30=; b=Xp9fBNO5U1dePG 75Hobaf7HCuIk4uIMgogbWaJtwkq4nHxC76Uwk6zzB3o0n8BmjE/MSknu76cqXe/h9KjmIFPLJY68 aSVEWhvlFen4yNf2WyNv/oAvr8cJErCBeiaemrVKUW7i7QRX+NC5ohOAlDf+IQ25zgYEvL9pJWby4 iEHElXWbPQpl8fs8N+26I/RvuKvvA+xmlvYwUvaXq3/6v5OiP943tJQfx0xLTlsa6M/heJNHChlk5 33dnEI5ftQ2HearXJBnAwSQb4RfEQ4RV9cLq63dA8PpKJPq5v++aKbUSSnFM94MEJ9ceZt1XT6xYE g1/CDbcO9zggkDEHOZDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ps-00000000Flq-09Av; Thu, 25 Jan 2024 14:09:16 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0P4-00000000FA2-0S13 for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=tGubfqazQglh6ZGRToG4VYEthfYG/V+3kw7KUXGTlXM=; b=GyH3LnNjopvyr7+aZgZ73n5Ag1 cw1Oxni/BdmehRl0RT4Hldv2Z+C/GpkXpp7L0nWqBylJ5eJjuRMZN9SHRSDV/yJIFXrxln7ALRUWY F79PRJSkjEqAQP6P5WL7kEIhmciognys/HVyLQbtoyEewVWiQmU+w1iDl9xfWVR1RB5vz0e2mbUpJ IxUuNucwdQbIVJFdRxAOfYnnylB64SrfDNlfPUZ01ZbZSBVoUmACVduC/UHTl4gAtt2aHSAaMFmWQ DzSW7LC8rFFmFlTO0GVVsXObiTiFZJAJaRbVpa0DlTOGoyOR+jSfUpA2HxQmRMFNKSbrzHGYclTVt Dq6DuBkw==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000009sDd-1WPO for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:18 +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 1rSyZG-0004Hd-Le; Thu, 25 Jan 2024 13:10:50 +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 1rSyZG-002HRw-0e; Thu, 25 Jan 2024 13:10:50 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZF-007n1T-32; Thu, 25 Jan 2024 13:10:49 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Florian Fainelli , linux-pwm@vger.kernel.org Cc: Broadcom internal kernel review list , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 050/111] pwm: brcmstb: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:12 +0100 Message-ID: <4da39b2333ae7639d724e925eaffb51d9e577492.1706182805.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=2069; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=TZC2i850mmZA7TRa+F19cdXeyXFOZTXIsdwaUd0XKe0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk90yXfDgUf/cID0mjpPVYObWmZe7DptZfvar G34xi4Bu2uJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPdAAKCRCPgPtYfRL+ TvxXB/99FlBF4ZIb3AlkJeqniog7qM3n62rsSuFgiDwQ7M+LXfyWsZSDlWvbYVjz8k/WRgaHgBH pthnHVuHV4GsT8cZeFEN0XEQ3zQaAY1R4ZGqHyMwYqyD/0Hh62+JPz/tlzVc2f97s85keOrAiQC aS9tPeiSOabtnuekfF4Vb8FON+5M0JOC0eCKUY06PwkUZZFC6IhH+/H2ldwsYMP6xFz3KwBZomQ ZFU+zJFh0y+O/7lSGBnKOV1RnxtlGcgrn2mL8tPZOJeZwabIXfH4z5B8NUwCDnbjYKH2IqYnUhR ZsR5rqgLQ63y9beDlTtBPRBNAEpistIE+jlbay6eLrDUb5Sn 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-20240125_121313_819026_B4B0E667 X-CRM114-Status: GOOD ( 12.66 ) 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 This prepares the pwm-brcmstb driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-brcmstb.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c index 0fdeb0b2dbf3..82d27d07ba91 100644 --- a/drivers/pwm/pwm-brcmstb.c +++ b/drivers/pwm/pwm-brcmstb.c @@ -54,7 +54,6 @@ struct brcmstb_pwm { void __iomem *base; struct clk *clk; - struct pwm_chip chip; }; static inline u32 brcmstb_pwm_readl(struct brcmstb_pwm *p, @@ -77,7 +76,7 @@ static inline void brcmstb_pwm_writel(struct brcmstb_pwm *p, u32 value, static inline struct brcmstb_pwm *to_brcmstb_pwm(struct pwm_chip *chip) { - return container_of(chip, struct brcmstb_pwm, chip); + return pwmchip_get_drvdata(chip); } /* @@ -230,12 +229,14 @@ MODULE_DEVICE_TABLE(of, brcmstb_pwm_of_match); static int brcmstb_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct brcmstb_pwm *p; int ret; - p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); - if (!p) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 2, sizeof(*p)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + p = to_brcmstb_pwm(chip); p->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(p->clk)) @@ -244,15 +245,13 @@ static int brcmstb_pwm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, p); - p->chip.dev = &pdev->dev; - p->chip.ops = &brcmstb_pwm_ops; - p->chip.npwm = 2; + chip->ops = &brcmstb_pwm_ops; p->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(p->base)) return PTR_ERR(p->base); - ret = devm_pwmchip_add(&pdev->dev, &p->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret) return dev_err_probe(&pdev->dev, ret, "failed to add PWM chip\n"); From patchwork Thu Jan 25 12:09:14 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: 13530894 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 6972CC47258 for ; Thu, 25 Jan 2024 14:09:28 +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=pYgjnz1K0nvrJzfzfoSTlXLZjy33DiSiwvJUBGU9gkA=; b=4g9KiLWuh78HgU TBeFssvkX7uk21JTDXrmiTrnrvnv04y5XWd2u9DG59KwTXkrMq4VdkaT5L/gjG/rEqjuU/wV+eL65 Cw3rRqWm29zVGR3iscy0hK0hu4lkidemyn3qHvPfliys54O1DqY9aJNHGcLXWQxUAh02BrOCYCQzh y+i7WNfIUrVjwr3YsSzCE3DYGnRm1BzWDQG3NjV27qXci0Nkd40gzqcP9nZrlHBaBRs6JqUolH3uE ouY8eQkr7dMpLoXPeK/2fCL7lBRFkf8MOqyU4vp5aV4J40PGSwuPhXAd+awDG95LnZu+CdvSmqT5o g4dk/ipMdOLSU62O9lgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pp-00000000Fjp-1hTQ; Thu, 25 Jan 2024 14:09:13 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0P3-00000000FA2-3dIX for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=TIfDOv2KtDQJ012PlJXh13/qy1GbNbCrs5TqcGPbkQA=; b=syXOCgAdJVFWrTNgxhJQB6zNS/ 0O8hoySGm9vidpO/BT84QFzD7sja4zBdWoUkxN14T1sYM5iaS+wAZw19AMZuwjnFjhuI5rgawKm+e 5XL1DpFhev9ocnkvZihvY7vLLCVH/5uv0nDdtugI/kbDmp3top/YBoEQUwiwEQLInRGft0nOO+moX 4/EpZf3Yyz5s+CcQYaI86D0RJguIC8vZLk2azJ/qQX0jJUAitlua+k4uvTnoTiQ4rDsbqbpuJgcUh ZsdLDxRO7ETHw/EjK7WbQw3pGxmVeaij2XEbGdTl7Au+gT8Js6eWeU/ffaHmS7spGstPycu1OH59j jQp7UKjA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000009sDc-1fFN for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:18 +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 1rSyZH-0004Is-1u; Thu, 25 Jan 2024 13:10:51 +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 1rSyZG-002HS3-DA; Thu, 25 Jan 2024 13:10:50 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZG-007n1b-14; Thu, 25 Jan 2024 13:10:50 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Alexander Shiyan , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 052/111] pwm: clps711x: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:14 +0100 Message-ID: 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=2072; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=gyrgGlXTWMnebiB+hz+WH9nrN2SBwKfFMXH7r00+5dc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk93mtoZRyWudm1BUXmc9BtNwlBmywQ1/B3Jz HCnQsCwdWuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPdwAKCRCPgPtYfRL+ TnWNB/4mmUjrRAHYVj0jSHnjtG2K8vmGaLx/+qfdqceud8IEQ2EvNaBDAZ/RKtEjiByyUVDllEZ nuAnrG26Z+5RaOZ3gCT5DNu6aYyL17xrTNRFCXoc5rd3effrQkEBIHLXDbP6lE1Npy9M4fK6LAZ DMWt1P/ok1CLWikaCzMTH8wuWt2H0DiMyR3H6OiVdQYIc/4pf4JxgOVEKgV4TmF5fNOhyQ1egAO aX9Pbx0LtIW0Fg9pA//la30KlgS3C7h+J6K3K45ra6Ki54NKJaUYcWpB9Er7SZq4FEaDfGdWay6 A83vCJqh/mCsizIuZSRR4kjw7pdzyAMHU3+HFHO3ScjKg2dN 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-20240125_121313_860313_88F6903B X-CRM114-Status: GOOD ( 13.19 ) 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 This prepares the pwm-clps711x driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-clps711x.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-clps711x.c b/drivers/pwm/pwm-clps711x.c index f3b4af7963be..c950e1dbd2b8 100644 --- a/drivers/pwm/pwm-clps711x.c +++ b/drivers/pwm/pwm-clps711x.c @@ -12,7 +12,6 @@ #include struct clps711x_chip { - struct pwm_chip chip; void __iomem *pmpcon; struct clk *clk; spinlock_t lock; @@ -20,7 +19,7 @@ struct clps711x_chip { static inline struct clps711x_chip *to_clps711x_chip(struct pwm_chip *chip) { - return container_of(chip, struct clps711x_chip, chip); + return pwmchip_get_drvdata(chip); } static int clps711x_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) @@ -76,11 +75,13 @@ static const struct pwm_ops clps711x_pwm_ops = { static int clps711x_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct clps711x_chip *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 2, sizeof(*priv)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + priv = to_clps711x_chip(chip); priv->pmpcon = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->pmpcon)) @@ -90,13 +91,11 @@ static int clps711x_pwm_probe(struct platform_device *pdev) if (IS_ERR(priv->clk)) return PTR_ERR(priv->clk); - priv->chip.ops = &clps711x_pwm_ops; - priv->chip.dev = &pdev->dev; - priv->chip.npwm = 2; + chip->ops = &clps711x_pwm_ops; spin_lock_init(&priv->lock); - return devm_pwmchip_add(&pdev->dev, &priv->chip); + return devm_pwmchip_add(&pdev->dev, chip); } static const struct of_device_id __maybe_unused clps711x_pwm_dt_ids[] = { From patchwork Thu Jan 25 12:09:22 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: 13530873 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 9B537C47258 for ; Thu, 25 Jan 2024 14:08:03 +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=MBiMuHO1f9a0OhiKLCnO4W9dN1oxxseevLyDG2bWt9U=; b=tnD0PNwVBwKeT2 Hfi362yP27kdbb4uULx7aUQy18FpVmNPuC3ETuSJFXyfXPb/gdpbwrpY5WPAvmJSjon1gjiRljVwq ECsxlduAQFMlpuBVExLOFW83QM80G66xNpwskTqC3unqycVVeKRcU5VU5YzOhuDigMpGvt2lEXSlG oMhpraRVjRaMH9MUG9ShgzECN1tTytbzRldYb+YO50XXWowKQfxsZIwErN5aCw4tMOOAHf5Ve6osw 1Fje7+LbrxY8fARoE9piE3OWI5JNflz9YRUWe8j59fBHQ+E6ZN6NettFRx3j571Oa8idaP0cbFhqu 59UvqjQjZ+41q7DWsjbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0OR-00000000Ems-1s4m; Thu, 25 Jan 2024 14:07:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0OJ-00000000Efb-0Zbj for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:07:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=QNOsmRW+9oqzUnTeuClJIaoeryksS0CfhQyYWbKv/QU=; b=ipLlh6YVKMHXA3lt8PTxU/1c/9 vF8A5PLft7abn44JRE2yqqPw7+p14LihjTLp36GIsv34xfr5i3vATuQfHR+lbPv9/UrxzwIBNNr7K 1CaVEIyzRZcylsVSwRyWnkQYGWOVlts376OP4vjHdFwCHHA7uKxowyOMN1VdyAPqS1NcLlvVGYjgJ m8ZHcipcPxfv30WAM+z/rV4nsb//aYsUEfBN29KWStGmd9g/Um5SnMwRdYUeaV9/0tL2JHyorLovz +pQIGONToEvkjjD87pTB9wkQcS6ilbmKhAuL7GT+4JukLHXC/aFxMwotxc5PRDQeVVzwtZu12oRjZ 7HLHvkFg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybW-00000005Hfj-3DXU for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:12 +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 1rSyZI-0004M3-Q8; Thu, 25 Jan 2024 13:10:52 +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 1rSyZH-002HSa-S4; Thu, 25 Jan 2024 13:10:51 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZH-007n2C-2V; Thu, 25 Jan 2024 13:10:51 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Shawn Guo , Sascha Hauer , linux-pwm@vger.kernel.org Cc: Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 060/111] pwm: imx1: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:22 +0100 Message-ID: <93774b5353d24af8aa2e8823c321babb20d16716.1706182805.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=2093; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=tbiGp63L/S7w22iJkzOIhD7LLwswGphHaG03oglAbok=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+AayXd8vcBw3Wj0goE4JaBJFRrcLr+eNs+X 84o/+CKqqiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPgAAKCRCPgPtYfRL+ TrUcCAC6HQcncc0T9tii5v/tFwAtydkbzZrCqKiwCGaMIZ6LveLXNdUaZd43zkXmFpnMp7SNJdB H0xKQDdbc5F/isvPfe6dn+qS5PsldJtz1G3olSYJkzLSGEKJk42hg1kOMT1rkUKwLJjsZaH2ctD 2F80OnXW9GUm1+0IQzBQXAw6Rj2F8K+e5M9XGPRhW9PCGZyvDVUB72dDiMT+01yPL4hbfijJ1Rx 0/XeAxQnVZ6reZjOL0JcHNaJNj6rjb08o6kzOVlIqfNazgR+WMl1cL8rkDdfmjS6v0qNyESa9d0 8AHrOMvxTYh3+JAWt7euf+XZhHb2NFPA8MhLu5B2+d/wmzB0 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-20240125_121310_866420_838F744B X-CRM114-Status: GOOD ( 14.73 ) 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 This prepares the pwm-imx1 driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-imx1.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-imx1.c b/drivers/pwm/pwm-imx1.c index d175d895f22a..1d2aae2d278f 100644 --- a/drivers/pwm/pwm-imx1.c +++ b/drivers/pwm/pwm-imx1.c @@ -28,10 +28,12 @@ struct pwm_imx1_chip { struct clk *clk_ipg; struct clk *clk_per; void __iomem *mmio_base; - struct pwm_chip chip; }; -#define to_pwm_imx1_chip(chip) container_of(chip, struct pwm_imx1_chip, chip) +static inline struct pwm_imx1_chip *to_pwm_imx1_chip(struct pwm_chip *chip) +{ + return pwmchip_get_drvdata(chip); +} static int pwm_imx1_clk_prepare_enable(struct pwm_chip *chip) { @@ -156,11 +158,13 @@ MODULE_DEVICE_TABLE(of, pwm_imx1_dt_ids); static int pwm_imx1_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct pwm_imx1_chip *imx; - imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL); - if (!imx) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*imx)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + imx = to_pwm_imx1_chip(chip); imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); if (IS_ERR(imx->clk_ipg)) @@ -172,15 +176,13 @@ static int pwm_imx1_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_per), "failed to get peripheral clock\n"); - imx->chip.ops = &pwm_imx1_ops; - imx->chip.dev = &pdev->dev; - imx->chip.npwm = 1; + chip->ops = &pwm_imx1_ops; imx->mmio_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(imx->mmio_base)) return PTR_ERR(imx->mmio_base); - return devm_pwmchip_add(&pdev->dev, &imx->chip); + return devm_pwmchip_add(&pdev->dev, chip); } static struct platform_driver pwm_imx1_driver = { From patchwork Thu Jan 25 12:09:23 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: 13530905 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 5F60EC47258 for ; Thu, 25 Jan 2024 14:10:52 +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=NLn8oyxknFeL3OoapNIRSeDZS2NBW6hZpHByks+aPNs=; b=H53XkHRSdQpkw/ 0ThpZhZVR5mz1J7qGrxVnt+2o1zwlH+MrdZaNvn//qJlYY2sHML8nFQl4vrOsUolYPM+A5fiKF0YI +2UBZCv87OU4fPkvzy5/AQrdq4BTvbcw8Kdx7IXlCEm6HYXHoz4SdNEfzvBAMBnfTITuEInYQpnP3 9ZqXXnnbNfXgJS35jypaYVXwYWQ4kcMPevBo6DsbyjLnwwpEMrgETZOmoaBMINsCr0t3OUUa1s4qa CjbqeHSGRFwPyqAFnIW/wH+gBiZJ+DXxuHtl37JM3upM5gSqXbKZTbWmoQHTVKrpKsTmkH4DbKiM/ 0IVj80HBjKvBjUy1RxCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0RA-00000000GYf-1APy; Thu, 25 Jan 2024 14:10:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ph-00000000Fbq-2MgP for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:09:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=LROA7QHpRhrN8GWssHNYDj5LpSP3o+5WSh79CzwMSsI=; b=DlxcK01bzDEJrUmZn2MQMEuDZx AxiGnSYCG2YHEMgco8xFgVpuEauRyjmFsqh4r8eI5opx9w4Sicv/wfVIWJz1BQ/iqNXwgOXjzs88G M4vogk54yqD3uBFh0mFchdS35CRZcciUs91IR7pOhYwx7EaAg7ywrLAkdGHwmMWKbBPs53rVe6PcJ MFYnzNSFdqm/DyAEs4Jut3v5DQVDVdOe9zYUZCsRJwmp5LJMB66Dt1MXKzf5akzR0c+LxB7wOOrA/ SKdM3xzN18p09YxR3aLUTQ0zPk1AxQzd4uebwQmR+Mh3ukWLp8Zj4cYktrAafXGOaToprA2yqZkmv G4luOghQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000005Hfz-3gtW for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:16 +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 1rSyZJ-0004MG-1z; Thu, 25 Jan 2024 13:10:53 +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 1rSyZI-002HSh-2V; Thu, 25 Jan 2024 13:10:52 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZH-007n2G-3C; Thu, 25 Jan 2024 13:10:52 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Shawn Guo , Sascha Hauer , linux-pwm@vger.kernel.org Cc: Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de, Philipp Zabel Subject: [PATCH v5 061/111] pwm: imx27: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:23 +0100 Message-ID: <5d6f5a50b0b9642896503abeb91ea194c455fa68.1706182805.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=2468; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=drUK8CPnDdwgQVYE19JQZ1JYcqRkvpoCDmnK/uMOCDk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+BrLe8yBGhMf1MLy+YAJzfV7igkXIBnG3NM qaL3Aim9qWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPgQAKCRCPgPtYfRL+ TtlQCACtbyZHXw5MXBHPRIhc52AM7ylcqrLylgLKnbh5oUDEp+vadKVG+pvnR+wx8ng/MYNXS8F 11LgQ+27ow8SIobjcSxI5fYOCzRgpyoQLJXtHG3fs4CqmcY0Rrzo0Rlm332nBnyIlrjGmztG+ij qliAnknqwr+spXUlP1yeYQTmxtaq3FAIiavQWxsKdNY1A3LTm+3SueU67Pf3R/XNpW22X5byRcs YCk0FfWRKkNPoPxyiT6zv+MNbdfXfUdxexIH/5hDtZX/WWSZUYOkE4aSpJ6NqD5wdwL91CVq665 F6/tjASRIP5G1H1iPkDr+MnLjhEKGDMal5CweghxQDGH5t2c 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-20240125_121313_138474_174C7558 X-CRM114-Status: GOOD ( 15.77 ) 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 This prepares the pwm-imx27 driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Reviewed-by: Philipp Zabel Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-imx27.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c index 5d796453519a..54589f0b3b78 100644 --- a/drivers/pwm/pwm-imx27.c +++ b/drivers/pwm/pwm-imx27.c @@ -83,7 +83,6 @@ struct pwm_imx27_chip { struct clk *clk_ipg; struct clk *clk_per; void __iomem *mmio_base; - struct pwm_chip chip; /* * The driver cannot read the current duty cycle from the hardware if @@ -93,7 +92,10 @@ struct pwm_imx27_chip { unsigned int duty_cycle; }; -#define to_pwm_imx27_chip(chip) container_of(chip, struct pwm_imx27_chip, chip) +static inline struct pwm_imx27_chip *to_pwm_imx27_chip(struct pwm_chip *chip) +{ + return pwmchip_get_drvdata(chip); +} static int pwm_imx27_clk_prepare_enable(struct pwm_imx27_chip *imx) { @@ -306,13 +308,15 @@ MODULE_DEVICE_TABLE(of, pwm_imx27_dt_ids); static int pwm_imx27_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct pwm_imx27_chip *imx; int ret; u32 pwmcr; - imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL); - if (imx == NULL) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*imx)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + imx = to_pwm_imx27_chip(chip); imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); if (IS_ERR(imx->clk_ipg)) @@ -324,9 +328,7 @@ static int pwm_imx27_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_per), "failed to get peripheral clock\n"); - imx->chip.ops = &pwm_imx27_ops; - imx->chip.dev = &pdev->dev; - imx->chip.npwm = 1; + chip->ops = &pwm_imx27_ops; imx->mmio_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(imx->mmio_base)) @@ -341,7 +343,7 @@ static int pwm_imx27_probe(struct platform_device *pdev) if (!(pwmcr & MX3_PWMCR_EN)) pwm_imx27_clk_disable_unprepare(imx); - return devm_pwmchip_add(&pdev->dev, &imx->chip); + return devm_pwmchip_add(&pdev->dev, chip); } static struct platform_driver imx_pwm_driver = { From patchwork Thu Jan 25 12:09:24 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: 13530868 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 0461AC47258 for ; Thu, 25 Jan 2024 14:07:11 +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=lo7fkKAosxIOz0RG+V3kPG6J66ftEEh0lSVwIpzhXOA=; b=Z21J/VQhPsrgfZ 7DyB5vQE4mlO/Al9VJRqRJP/b64wfmLpx//Itm/OmQAcVrXCaOqvUtcJAiC9i32Cqf6Sq0d2R4EJ8 OAVYp7fAwawRp43KQ+KIaoUTg68YsMBdqAvvssZoXxZA1dusJP967Li6R/Kv5h8TgIF2z6QNWOSBG Yx47OaFVmTlHWfgvjLeuNu0JSxnPttKJqcFAovwP+K1Hwxg9rXkO1CWE7pHs54fJFhGAmpOzOEoYg +DYnuv96fenscxTAA84W/ZOlrx9V/8OkCdKiL/jINY+thxxyDoSTRqbec7GmmStH5ym6ItSRO7boC 6PvTnqDw0fzqMtsQ0Ftw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Nb-00000000EFU-1zGe; Thu, 25 Jan 2024 14:06:55 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0NZ-00000000EF1-2JaT for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:06:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=XpW93pgnbY5VPL7kaP5SHUdD88drdcAIxq3/xQLHYHQ=; b=IdCJskmMFQCInF5V/K7g3JfSOY M3f775ktRD3XkHEFlTkIHNsxOpwAvgmB+j+nYzVYpxcYVSNWCN8xARVt6gr6TF+g5A4AwZ63+8ImV vi7jSD0q4IzbIM6TMoSHtHJbSZpxRg10r/g9XCghLRGeeD6/RbYsH2QUhy77WYWpGargcXVaE34/9 4v99+VMN8jwpuWBfe0EH4/7JhTk9Db3hbxDMzFQIgrfaCzyoARsQLiS6AKjUy+hhXKnja+F9JplFS pdEBrlGWPRCOqzTRWiLZXie6rygyypz7JxjxX+E7oI7c6Y9OWmR5fjCILH8k2Cd6Sn4BJo0bgFbIA NAFdA6hg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybW-00000005Hjc-3BjU for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:12 +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 1rSyZJ-0004Mi-5T; Thu, 25 Jan 2024 13:10:53 +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 1rSyZI-002HSk-86; Thu, 25 Jan 2024 13:10:52 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZI-007n2K-0X; Thu, 25 Jan 2024 13:10:52 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Shawn Guo , Sascha Hauer , linux-pwm@vger.kernel.org Cc: Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 062/111] pwm: imx-tpm: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:24 +0100 Message-ID: <6144c4925c464cf677517c24701a8b36e80d6f6d.1706182805.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=2604; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=Zom3RCFrlpm+waz+6f5uIA5kXrRlXpCKoQzIGutQMZo=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtRN/s0M4nFM010jPmd6LAq2PTd3tk/51dnvU8V2VqV92 8OcG3Stk9GYhYGRi0FWTJHFvnFNplWVXGTn2n+XYQaxMoFN4eIUgIlM/cr+P3PF66ylOnV+Cw41 nObJMq6I+nu/5cH0mxIZX4P37lM4dkR8zY8reXzCW0+y1jxlX9LCbXCa59//6095peUjlX0PZzz 3ztt+M+a+l/SW9Zomdu99RJa7v5zs9GXVriV/mC6Gz36UsmW+VOb8Am+ZyzYlN/h+rBBSuV7q1M Z42HjRqRA9w/WZnXcfOiy86XaNKav1X2xYuJKWRO0KpheuB6d4vU3jOcF94l/bftWcQ/8XMZUbT BP/7CN41n6TxcLDcVYWolXaDbFJ7itOJZv1iEhF+s3e6lxyzSCaoYQ7YWbf2v2sKxorfrhsNQ1M vWq6Zo8YX6NL8lUtiUS3lLrrrC9rkucvOnxoEYOP3A1NAA== 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-20240125_121310_855793_B6D6FFB9 X-CRM114-Status: GOOD ( 16.13 ) 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 This prepares the pwm-tmp driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-imx-tpm.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c index 9fc290e647e1..04f8ab315748 100644 --- a/drivers/pwm/pwm-imx-tpm.c +++ b/drivers/pwm/pwm-imx-tpm.c @@ -57,7 +57,6 @@ #define PWM_IMX_TPM_MOD_MOD GENMASK(PWM_IMX_TPM_MOD_WIDTH - 1, 0) struct imx_tpm_pwm_chip { - struct pwm_chip chip; struct clk *clk; void __iomem *base; struct mutex lock; @@ -75,7 +74,7 @@ struct imx_tpm_pwm_param { static inline struct imx_tpm_pwm_chip * to_imx_tpm_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct imx_tpm_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } /* @@ -336,35 +335,40 @@ static const struct pwm_ops imx_tpm_pwm_ops = { static int pwm_imx_tpm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct imx_tpm_pwm_chip *tpm; + void __iomem *base; int ret; + unsigned int npwm; u32 val; - tpm = devm_kzalloc(&pdev->dev, sizeof(*tpm), GFP_KERNEL); - if (!tpm) - return -ENOMEM; + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + /* get number of channels */ + val = readl(tpm->base + PWM_IMX_TPM_PARAM); + npwm = FIELD_GET(PWM_IMX_TPM_PARAM_CHAN, val); + + chip = devm_pwmchip_alloc(&pdev->dev, npwm, sizeof(*tpm)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + tpm = to_imx_tpm_pwm_chip(chip); platform_set_drvdata(pdev, tpm); - tpm->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(tpm->base)) - return PTR_ERR(tpm->base); + tpm->base = base; tpm->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(tpm->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(tpm->clk), "failed to get PWM clock\n"); - tpm->chip.dev = &pdev->dev; - tpm->chip.ops = &imx_tpm_pwm_ops; - - /* get number of channels */ - val = readl(tpm->base + PWM_IMX_TPM_PARAM); - tpm->chip.npwm = FIELD_GET(PWM_IMX_TPM_PARAM_CHAN, val); + chip->ops = &imx_tpm_pwm_ops; mutex_init(&tpm->lock); - ret = devm_pwmchip_add(&pdev->dev, &tpm->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret) return dev_err_probe(&pdev->dev, ret, "failed to add PWM chip\n"); From patchwork Thu Jan 25 12:09:30 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: 13530917 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 29D39C48260 for ; Thu, 25 Jan 2024 14:14:53 +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=cFzJzEI1XUYn6QO8SiSBz5GXy3rj/g3JkwXtbblsV2w=; b=ME0WffAwLIJycd z1snH/yOagJ4M2/+sdzeZ230eHN5tlzluxdW2IZHkdOXQB4YvqCWlH9R3zb31KhO7wKKcheJMuKHc 6rZnbV4zn4JZvhtfZ7TecTkbEx+rDEInln4f2cETC+m0lFrt8PIgaJU8Y5KDeNOrAOGYiRRVfMuk7 cPmxxllBU5LMUcGExfiwdN5oEG7LlTO6TDQlr6hB7buWDRT+quesyFZdlW4wvjfhduS7/xM1LqH0c dEqwPFcsG9UIFWwvCPUCzcca0KacVo847hXaBsg7iSvKAmFZh4plo2twg5CpQKcuHbziomf+yQjAP +b6IDjJvX0QZ5D1IttSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0V6-00000000J7F-1dnZ; Thu, 25 Jan 2024 14:14:40 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ud-00000000IoD-1Me3 for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:14:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=AV0ojSZLefxA8/MSqZzCpesD4x8tZqTSLfecR0IcNUI=; b=HM+RQwBc8g8a8w+/P/zJyKMIlQ 5FzFoQflqNrsymDZo2EnXoOMNUdG0K5O5TXQfi2NQehbwoF1S9ZGeN6phHwHy8MWcgQ6FIY5F6tmj 0h7UbKEaT7iSOaH4OpTkE+hvR1x6U1kI9S8S08QmJhP9qz4uBwxjGI+NBS6JYHulPA5/g03ZecBuC zBUaI1q3lZ5l34ed4KIbqYKiLL7Gns7GxPNGS/2doKU08yM7BIKX6iXIMp1gM+KJF/urwNJwJ7inl JtaT83Xosthx6BTATlc8S49LP5wx+nGFwqUr7Un9bzC4R/aoeCZ9qvHeFKpv5fP0N2rdLYV0eHCmg TkRnFnXg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybT-00000005Hjc-06Bi for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:09 +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 1rSyZK-0004Pb-Qm; Thu, 25 Jan 2024 13:10:54 +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 1rSyZJ-002HT7-DO; Thu, 25 Jan 2024 13:10:53 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZJ-007n2i-15; Thu, 25 Jan 2024 13:10:53 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Vladimir Zapolskiy , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 068/111] pwm: lpc18xx-sct: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:30 +0100 Message-ID: <200c88b25064360f01776574deda657adc646b45.1706182805.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=3045; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=q7gYTyr75ccBLRk0l0v9LT7305ravTnhDw2pdohEEK8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+KkUIR0iwRFKUiiTU9thDO0PgLE/RD3UpMn JZ/2kJKcTOJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPigAKCRCPgPtYfRL+ TjCmCACJvnX+waF4sOiCdNEGmXtwh3wZTghCj3KdplWTnBr4fJ3VNgn8hgU4vMPiozMUU6nRH/9 14FZ5YtB+/iNwoFnWdgScp7ai65E2dwMO+Ce4NvW2hJG27YLVzZBZbxbUgc8tZOZHcm35jazTRm leQ5OmcI/ExLJtGObgP43Bi8MlR48PjGV4snvO0TYmp34kpE+mKtSoWITTRhI+F6krC+8Tae6Oh J+xj+vHJ++CkUzpHn/ZrX6Xv35T6UifAwSAvWyfSnYnD2kN4J4vYf3qAlsV4U7uNetXw6v9mgb/ 70Y48OqfIrgWjpc4goB6PM1AEJbe1z6dX/lY3PXPDNMqbi8/ 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-20240125_121307_175451_A6B5523B X-CRM114-Status: GOOD ( 16.25 ) 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 This prepares the pwm-lpc18xx-sct driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-lpc18xx-sct.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index 1d2d342c05fd..23c324d4c0bb 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -93,7 +93,6 @@ struct lpc18xx_pwm_data { struct lpc18xx_pwm_chip { struct device *parent; - struct pwm_chip chip; void __iomem *base; struct clk *pwm_clk; unsigned long clk_rate; @@ -110,7 +109,7 @@ struct lpc18xx_pwm_chip { static inline struct lpc18xx_pwm_chip * to_lpc18xx_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct lpc18xx_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static inline void lpc18xx_pwm_writel(struct lpc18xx_pwm_chip *lpc18xx_pwm, @@ -349,14 +348,15 @@ MODULE_DEVICE_TABLE(of, lpc18xx_pwm_of_match); static int lpc18xx_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct lpc18xx_pwm_chip *lpc18xx_pwm; int ret; u64 val; - lpc18xx_pwm = devm_kzalloc(&pdev->dev, sizeof(*lpc18xx_pwm), - GFP_KERNEL); - if (!lpc18xx_pwm) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, LPC18XX_NUM_PWMS, sizeof(*lpc18xx_pwm)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + lpc18xx_pwm = to_lpc18xx_pwm_chip(chip); lpc18xx_pwm->parent = &pdev->dev; @@ -389,9 +389,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) lpc18xx_pwm->min_period_ns = DIV_ROUND_UP(NSEC_PER_SEC, lpc18xx_pwm->clk_rate); - lpc18xx_pwm->chip.dev = &pdev->dev; - lpc18xx_pwm->chip.ops = &lpc18xx_pwm_ops; - lpc18xx_pwm->chip.npwm = LPC18XX_NUM_PWMS; + chip->ops = &lpc18xx_pwm_ops; /* SCT counter must be in unify (32 bit) mode */ lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CONFIG, @@ -423,21 +421,22 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) val |= LPC18XX_PWM_PRE(0); lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CTRL, val); - ret = pwmchip_add(&lpc18xx_pwm->chip); + ret = pwmchip_add(chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "pwmchip_add failed\n"); - platform_set_drvdata(pdev, lpc18xx_pwm); + platform_set_drvdata(pdev, chip); return 0; } static void lpc18xx_pwm_remove(struct platform_device *pdev) { - struct lpc18xx_pwm_chip *lpc18xx_pwm = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); + struct lpc18xx_pwm_chip *lpc18xx_pwm = to_lpc18xx_pwm_chip(chip); u32 val; - pwmchip_remove(&lpc18xx_pwm->chip); + pwmchip_remove(chip); val = lpc18xx_pwm_readl(lpc18xx_pwm, LPC18XX_PWM_CTRL); lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CTRL, From patchwork Thu Jan 25 12:09:31 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: 13530919 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 3D560C48260 for ; Thu, 25 Jan 2024 14:15:23 +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=h2D5xXc+aVOUA6zzPv0R+ZPd003wroKejnhpTWkWsgg=; b=GummMkPYWcMw4q Slm4nXeGoNLHj56b+qBG67AxKBOpBXNFurBm8UsqlyE37fMDYtRgTBLlgVoFDe8tbhT+PTG3IBpet wikwcr15zvM0bcc0yM1h96Y7LUyRHd6HbY52oPXMhNcnBr2XlMkzAQEtiUxwxvbbXk9NwVf+JmnNe CC4qBwNatckMnoKvzyI7zoenaaHil2VHL0zMtbKMmLID14iti1B0wziaI3L2SXjpTtUrzlocHjlKl c3ctyIw0bEWJjL/5rOyiBq+WQKJ8bmUreSVaqW1K17X+EpuwI0joLIKPam7e1VNXutkn1ANY8n2oT VeaIFFr45Np8xk6wuBVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0VZ-00000000JN6-21To; Thu, 25 Jan 2024 14:15:09 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0VB-00000000JA9-0EGc for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:14:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=17CDjAnX5r8ST76/Kw5rqbzXYpTkU5ry9glUaTGvn4w=; b=Vsxx6bj+YAHNFFg9mP5anNVIaY TcM5tcGnfgGmirZfe0IFKrgTohkpJ/hE6hgYVdQkAjV3BppEpIgqI9Y3M6ysrCTyAGc+diUmFiHNs GjfXveiF3oxp1dq6VA1hNPg6wD72t27Wn7FONeAW5paK2PJyevj7CLQzV4AXguk8Q4boZZ6DE+m2w Qs915LiY4Gqpgf6Yj7FGvfVnV2lreC3bVO95o5qStYqpBTJZMQ/OUfP+9HSYUsHm/QMY4IfB1SGfp pVvVN1UCSsC2SXceSAncNix1cU44FQPR56YwJyZO51yIg04svIC4jtKZdwdfJeSx3lwHeGTNEIjJ7 WwK9RThQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybT-00000005Hjd-05vF for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:09 +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 1rSyZK-0004Q1-Uk; Thu, 25 Jan 2024 13:10:54 +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 1rSyZJ-002HTB-LM; Thu, 25 Jan 2024 13:10:53 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZJ-007n2m-1q; Thu, 25 Jan 2024 13:10:53 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Vladimir Zapolskiy , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 069/111] pwm: lpc32xx: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:31 +0100 Message-ID: <5e32d14f20bbd1ea78b20d4f24af6d63d7d0df2f.1706182805.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=2413; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=zaexTqZbDea+1T5ODHlpi8H+vbuSfxVuSfiw4opuuIA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+LwrmSRQ128wGA/R6iDpLRU0hjwr68+Jo1v q7UGfKc6D2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPiwAKCRCPgPtYfRL+ ThMXB/9nfyjsn113qb4NLTNMVOFCBu8l2P5LsRxvx2/cT2PtgxN3+tAO0Wznqjb1Lcnrq03yBiW 79SAcU/AWi3KkPET003aVC0TiGK409QWGcQGFK1aR2D9eb3RXHA0XW59d7Ixd9ic7AaTH09QvFC 2szmmYDi6F/R3Jo4+g8bflLHFDCvjTV6zR9G5Qw4QzxKpKGJXEuZ5YdTMZ5iZkAnseZlnbWhHkC cv+MGCCU4YU320HbiI5pHLd52MhVK67JV/xHVetmMEC3dQ7VXzdXL0EYGpiPTU3GAmxsw6g0X5h wZ2La7L9Jb5iiypcHHg3P56Zz+9LvGHBVhp0jwFOGKVHUdIX 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-20240125_121307_220453_8CA8FEB9 X-CRM114-Status: GOOD ( 17.22 ) 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 This prepares the pwm-lpc32xx driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-lpc32xx.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c index 1d9f3e7a2434..c748537e57d1 100644 --- a/drivers/pwm/pwm-lpc32xx.c +++ b/drivers/pwm/pwm-lpc32xx.c @@ -15,7 +15,6 @@ #include struct lpc32xx_pwm_chip { - struct pwm_chip chip; struct clk *clk; void __iomem *base; }; @@ -23,8 +22,10 @@ struct lpc32xx_pwm_chip { #define PWM_ENABLE BIT(31) #define PWM_PIN_LEVEL BIT(30) -#define to_lpc32xx_pwm_chip(_chip) \ - container_of(_chip, struct lpc32xx_pwm_chip, chip) +static inline struct lpc32xx_pwm_chip *to_lpc32xx_pwm_chip(struct pwm_chip *chip) +{ + return pwmchip_get_drvdata(chip); +} static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, int duty_ns, int period_ns) @@ -119,13 +120,15 @@ static const struct pwm_ops lpc32xx_pwm_ops = { static int lpc32xx_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct lpc32xx_pwm_chip *lpc32xx; int ret; u32 val; - lpc32xx = devm_kzalloc(&pdev->dev, sizeof(*lpc32xx), GFP_KERNEL); - if (!lpc32xx) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*lpc32xx)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + lpc32xx = to_lpc32xx_pwm_chip(chip); lpc32xx->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(lpc32xx->base)) @@ -135,16 +138,14 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev) if (IS_ERR(lpc32xx->clk)) return PTR_ERR(lpc32xx->clk); - lpc32xx->chip.dev = &pdev->dev; - lpc32xx->chip.ops = &lpc32xx_pwm_ops; - lpc32xx->chip.npwm = 1; + chip->ops = &lpc32xx_pwm_ops; /* If PWM is disabled, configure the output to the default value */ val = readl(lpc32xx->base); val &= ~PWM_PIN_LEVEL; writel(val, lpc32xx->base); - ret = devm_pwmchip_add(&pdev->dev, &lpc32xx->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) { dev_err(&pdev->dev, "failed to add PWM chip, error %d\n", ret); return ret; From patchwork Thu Jan 25 12:09:33 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: 13530918 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 9CE5BC47258 for ; Thu, 25 Jan 2024 14:15:20 +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=bpnEtFSUDjjrsc1o/ikuAS/+BV3vE3PxjoxsXv+KKIo=; b=ejAw6PI1LkYOUs beY/iwRMFde4vgvuFDIs+P0HftH5Jh8EgmA8DiqfAo0XjJaDK/ErFS+TOb0ZkvCtxmgo8tXBd+G2R RzlI3KLnSxnHuv/E3IaWdUreVmYTabMmUH0yzE1JpEfL5ZHzNwNgULieHEzarWvjWPykj7GVVx9qk neSZGkeYjVjDpaxhfHPYDv3q7jEr5OZWUjAA2NvJd14SEGsiOJnPTRisKMGL1CkKEm4kFvXL8iVRP 9QVaTDC4XZNmI1EO1YK/KAgclSMMxamZlzZcLWHpWKJZXQXgvUaVOXSOwyEyupfvQsAx/qSIklNEU BYJ9HXrX53/p4y5ghQSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Va-00000000JNf-2V5x; Thu, 25 Jan 2024 14:15:10 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0VC-00000000JBH-3IQR for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:14:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=7PPdCFSTOt8Wh2uj35QYBS1aRoj9Os6L0OTsFQ63VpQ=; b=FbOB5oEIvSn1je4XHQLDEVvsRX OLHcLiuv6uiYRRsRxVz7CZc262q06t3Wwq6iDiRpjPkS1XS5RbBKYHd8FLYiArZBHXZsQ5Wz4Zouw MOoK9CYPjxXgwO5w2s45H+svTohCqky9rxIQ6ftgtQpv0wi5KU1ltBMHegcJX7iv6F0RqN4NTp51y xo4xLcFrzEHUzgyo9BFv20MGXKsh1mY65Csx4ffZuDQZrhEftL5Dc2Ok5E0t1PMsn2y5OKHLEZDRB HFon5FvzxTGdr2WKURi59ZnXYiTc5gdscx2yjtxAoGgtST+CJ/8RspJrwO3JM3O9q4gEOUCRD5XvG CSNXb4+g==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybT-00000005Hje-06K2 for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:09 +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 1rSyZL-0004Qe-Jl; Thu, 25 Jan 2024 13:10:55 +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 1rSyZK-002HTJ-2H; Thu, 25 Jan 2024 13:10:54 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZJ-007n2u-3B; Thu, 25 Jan 2024 13:10:53 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 071/111] pwm: mediatek: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:33 +0100 Message-ID: <4036b71713b5d451d8a26bafc79beec3048f370e.1706182805.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=3214; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=efjqoTt2JNTkS/blkL8nCUoyaB7R1fYI93LJBT5sUFk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+NihwCwdSqi5FKXniJt2QUk7GmBCYrZVtZP GJhTUnavFqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPjQAKCRCPgPtYfRL+ TjTDB/4qzFNHTch2lxkrVdZPgh21vLc9VCCQPOfTj5KZt77Nbv1qpJMi7KYeN7S7hIMzpBV+a44 ftjupQiH0NLezjX8m519bwLsz+QjvCr+GtJFBU2Nn7jePIvIbu3JJy59J5KRVVTmtl7LY/aYHGd IpdvnfkSUUv03Hn3Ix0wOPx/gZFiwAhzz+7yZnQZyApz6eEUxrs+jQe/6/lWOVWMuDRS+Qp/Mm/ eLdCUnCzcI+JGtpNEuh7PRXUPV4UQldRtDYl7D/FZpKMdK09Zfx7qHgiNcBbi72icHGqr6er+lf jlL++n2ft0YFLan1cMOE80BH4072qDBNfl3Uml+A/NWlx7Su 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-20240125_121307_183961_1721AA04 X-CRM114-Status: GOOD ( 18.90 ) 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 This prepares the pwm-mediatek driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-mediatek.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c index 6cf7543a3826..c5fca0f1ebc7 100644 --- a/drivers/pwm/pwm-mediatek.c +++ b/drivers/pwm/pwm-mediatek.c @@ -42,7 +42,6 @@ struct pwm_mediatek_of_data { /** * struct pwm_mediatek_chip - struct representing PWM chip - * @chip: linux PWM chip representation * @regs: base address of PWM chip * @clk_top: the top clock generator * @clk_main: the clock used by PWM core @@ -50,7 +49,6 @@ struct pwm_mediatek_of_data { * @soc: pointer to chip's platform data */ struct pwm_mediatek_chip { - struct pwm_chip chip; void __iomem *regs; struct clk *clk_top; struct clk *clk_main; @@ -69,7 +67,7 @@ static const unsigned int mtk_pwm_reg_offset_v2[] = { static inline struct pwm_mediatek_chip * to_pwm_mediatek_chip(struct pwm_chip *chip) { - return container_of(chip, struct pwm_mediatek_chip, chip); + return pwmchip_get_drvdata(chip); } static int pwm_mediatek_clk_enable(struct pwm_chip *chip, @@ -232,21 +230,26 @@ static const struct pwm_ops pwm_mediatek_ops = { static int pwm_mediatek_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct pwm_mediatek_chip *pc; + const struct pwm_mediatek_of_data *soc; unsigned int i; int ret; - pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); - if (!pc) - return -ENOMEM; + soc = of_device_get_match_data(&pdev->dev); - pc->soc = of_device_get_match_data(&pdev->dev); + chip = devm_pwmchip_alloc(&pdev->dev, soc->num_pwms, sizeof(*pc)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + pc = to_pwm_mediatek_chip(chip); + + pc->soc = soc; pc->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pc->regs)) return PTR_ERR(pc->regs); - pc->clk_pwms = devm_kmalloc_array(&pdev->dev, pc->soc->num_pwms, + pc->clk_pwms = devm_kmalloc_array(&pdev->dev, soc->num_pwms, sizeof(*pc->clk_pwms), GFP_KERNEL); if (!pc->clk_pwms) return -ENOMEM; @@ -261,7 +264,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_main), "Failed to get main clock\n"); - for (i = 0; i < pc->soc->num_pwms; i++) { + for (i = 0; i < soc->num_pwms; i++) { char name[8]; snprintf(name, sizeof(name), "pwm%d", i + 1); @@ -272,11 +275,9 @@ static int pwm_mediatek_probe(struct platform_device *pdev) "Failed to get %s clock\n", name); } - pc->chip.dev = &pdev->dev; - pc->chip.ops = &pwm_mediatek_ops; - pc->chip.npwm = pc->soc->num_pwms; + chip->ops = &pwm_mediatek_ops; - ret = devm_pwmchip_add(&pdev->dev, &pc->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "pwmchip_add() failed\n"); From patchwork Thu Jan 25 12:09:34 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: 13530872 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 56099C48260 for ; Thu, 25 Jan 2024 14:07:59 +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=pM0N4Ta0RbGVIwFibguXGDByTTN8Au7cICVUu8JOYlM=; b=1ZiB9QgtFi25cq cWYOo2k2qcIb5L4hbiwRX6WiEdm0SyG0qIQXiO99XLZ5JGQlDPfoVp9sAiyCcM6UuifsFj/HISxvy 6WNDtNpQRm6nXUpnxiazuTcjdCYa1NWNCJh4M9pEmzqH50IccBaJStIZo8CMsENjEABMOYUZkNQmw 72GopdF4KhHFFX1uB0y7vT8Kfw9lfXONnyZLyigS5Up20cWLlVoFLnvgnfcZycwhE/hShhgazEyvP SREwwnsTKRK9WgzmnF7PYhTeuX5HjAZTCf65eyu53GjsGdrqtnB0U4kAtThQbf83LfimUDiFUDT/Z DKHhQVxqYqQh1lGqrWEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0OP-00000000Ekk-13gn; Thu, 25 Jan 2024 14:07:45 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0OA-00000000EXI-0a0T for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:07:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=DoBDSizlhGxg56AeVJwqv1E1op+2VJ/F7USVHLvNloM=; b=so5DE47wgPcktlEwtbxCDuT44I zDMoj9XPlvQZxbvlz504QJEm3/ar+cSvTWMux9dO9Zvw+42aNgN6GzmDF9bhXnaVqKjy4Apn2Lab9 FOz9w3EC1ZRrP7YuMVIqRKHGDYQs7ReC86oN3ySeQ2gTxfZswY0D/ifginQzkK9UcZizfrIHSlh7M SolI41quM/uyl/5QFhRpclmq2MAgkKbcLLTRHxPQ5NqE+FX2v89V7NH5WF9hv4xcilYNLeuT+uxKc GCYkzn/l4fJDrsAqfY2eYbRQPTrUAascyNRnseThohBttZuqyLGKIf/82ybh4uzRt3lhqZyHLAFNo +kg9xK8A==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybc-00000009sDZ-2V3Z for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:22 +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 1rSyZL-0004RC-OT; Thu, 25 Jan 2024 13:10:55 +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 1rSyZK-002HTN-8J; Thu, 25 Jan 2024 13:10:54 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZK-007n2y-0X; Thu, 25 Jan 2024 13:10:54 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Neil Armstrong , Kevin Hilman , linux-pwm@vger.kernel.org Cc: Jerome Brunet , Martin Blumenstingl , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 072/111] pwm: meson: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:34 +0100 Message-ID: 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=2615; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=tbf+Q2Gxrb81SZI03PQrpWoV9hGmidTqVonqvgzF990=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+Ps9GWUz16FfY73NvDjTCMhYVcOfguNy68z bzG8PvGCR2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPjwAKCRCPgPtYfRL+ TqjuCACTkTZutcwEYIAetP5/AnxvzOgESXYd5G4R2im/Y3HsmdptBtCo5AOOfuzXrbfejfnh74I iG5FTd+XcdAShxd3o91Yiv5Fc6ktPwv3ckxk+GDnd/y0+EKX9jAlgMP7ggC14b0Xg7MCL253ufx q0lV7JWwmrNn9n82i9O6PrzwH1IjQ5ZT6gNjm6ANh7oqn728Wk09If78UNy1De8YxVH+XLA5Bqz FLdS4pu+lb/I1bpLoTRfLI3rTuNAD3HGo6E/fAbexVkcUT0hJGYBbHEjJd7Y1NQ5YvDDwR169/2 DpoAM+Klwutd44wmbOSqFnbswNBAsYTAcmSJbij2W7ACJO0E 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-20240125_121318_046247_A1BE214F X-CRM114-Status: GOOD ( 13.43 ) 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 This prepares the pwm-meson driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-meson.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index dd0e18437be9..40a5b64c26f5 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -102,7 +102,6 @@ struct meson_pwm_data { }; struct meson_pwm { - struct pwm_chip chip; const struct meson_pwm_data *data; struct meson_pwm_channel channels[MESON_NUM_PWMS]; void __iomem *base; @@ -115,7 +114,7 @@ struct meson_pwm { static inline struct meson_pwm *to_meson_pwm(struct pwm_chip *chip) { - return container_of(chip, struct meson_pwm, chip); + return pwmchip_get_drvdata(chip); } static int meson_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) @@ -449,7 +448,7 @@ static int meson_pwm_init_channels(struct pwm_chip *chip) mux_parent_data[i].name = meson->data->parent_names[i]; } - for (i = 0; i < meson->chip.npwm; i++) { + for (i = 0; i < chip->npwm; i++) { struct meson_pwm_channel *channel = &meson->channels[i]; struct clk_parent_data div_parent = {}, gate_parent = {}; struct clk_init_data init = {}; @@ -529,29 +528,29 @@ static int meson_pwm_init_channels(struct pwm_chip *chip) static int meson_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct meson_pwm *meson; int err; - meson = devm_kzalloc(&pdev->dev, sizeof(*meson), GFP_KERNEL); - if (!meson) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, MESON_NUM_PWMS, sizeof(*meson)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + meson = to_meson_pwm(chip); meson->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(meson->base)) return PTR_ERR(meson->base); spin_lock_init(&meson->lock); - meson->chip.dev = &pdev->dev; - meson->chip.ops = &meson_pwm_ops; - meson->chip.npwm = MESON_NUM_PWMS; + chip->ops = &meson_pwm_ops; meson->data = of_device_get_match_data(&pdev->dev); - err = meson_pwm_init_channels(&meson->chip); + err = meson_pwm_init_channels(chip); if (err < 0) return err; - err = devm_pwmchip_add(&pdev->dev, &meson->chip); + err = devm_pwmchip_add(&pdev->dev, chip); if (err < 0) return dev_err_probe(&pdev->dev, err, "failed to register PWM chip\n"); From patchwork Thu Jan 25 12:09:36 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: 13530890 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 73C74C47258 for ; Thu, 25 Jan 2024 14:09:06 +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=Dv7f28wf46HOu4OhK4AYTpBm9KnRBLF7231qyaeijg0=; b=d3ODPVTC+nPIWu +JDBvRgm9vn/CW5if+9ECBYj/SXVgg3HPMbNGdrns0a9uOFa7Z4xa+d3wgGLQkcUPgA6tYfTM6/v9 4U1dPFWpqbHgjdI2pa4Snn0ThxQnw64I2dUbFeIJcLIe7fr0a0PQyMdBjnsX3rpTd/Bc3VJsbfC+9 87Mgg1d/nuaP3ovjaJcrUFTW0eZGD89ZrJgLWGspIXM/Wck8fgFTVbQkEc1km6R2Dq1+4FrOuCq3C eM1ws7dhVPfcx+LkVES1Fo+zCPDHFDuqsmMlS9WjhO7bG085B3DYneN+3Ht1jOizackk7YcPYChiw m6GiwAa89BlKUnbwuCZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PQ-00000000FLJ-2pG0; Thu, 25 Jan 2024 14:08:48 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ok-00000000F1m-3pJO for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=pO92xLPNMiFcoUkK3uT/usJ1+jrM1n/YAGrQxv2FE6g=; b=qnujAtLaNHZh5k5HcukLsgC6kh YGSI39Kaz9FH2YXw/J/muzqit3VOj52zY4lLpiiO2zljp+c2HQkmoQBvV5TD4igY/dvMksj61Ww4j 7iwVjzZVkr3m9+kxk97Z6QfKdTImd2KzMSmDT0X/uZfy467mw08g1v3hgjERXvm80CuHR7UH4ok1q +vCXj/s3QlOhVf0Qx9FDTLG0zcerh8Xzhw+zeXKG8a6pnfM3K1oJAhSUrV6GoiAZJGEldd0tPIGwk Hahv6v3Pphoev3pi+iSbkp4GbTQvdqmm6JSflFp9/zanGagHTn60RDV7cq6E4UmNxH/OyDjDyGvty mCYYX3PA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybd-00000009sDc-2n2h for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:24 +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 1rSyZL-0004Rw-V4; Thu, 25 Jan 2024 13:10:55 +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 1rSyZK-002HTU-Jl; Thu, 25 Jan 2024 13:10:54 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZK-007n36-1i; Thu, 25 Jan 2024 13:10:54 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 074/111] pwm: mtk-disp: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:36 +0100 Message-ID: <77d027ef065580f5f29fc003bb0cad6bda1abdb1.1706182805.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=2065; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=GBLmuONAg1sBI8HP1ChJ031DZ0t8wiTvxNd4lqFmn0s=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+R3qfd2M9eC00TKIyuTdbSKXkYyP+QERKKk 9IdeES1fUyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPkQAKCRCPgPtYfRL+ TjdsCAC5kkRUjvz3BywQfS+hgjj+9os0Sz+9Z8nKNZBRE9v9reG3RweAk07BuGW5zW7dA8Eb6CW y6T2DgGXm7Mtj0qWbkPbYmxEozzsaqi8P/cT8rH/AXWPaCiTXKlgZncm6iuMWJCSaVpOD6+rKMc TgM//dVPN0c93BXcVur3TCusBbV+7w6Mdfp9SXLXvJ2BJm67Pj1kQPcrEQww90PU0Pupz613Kz/ EUxqmpEVGALwxgGoFEZ7OMsKJzTZr7LdgZdlEjFeSuwplH08Ec6ikEWBaCx7Q7MrthBEfYR4qq3 SD+GYkFPuRZRTFp32b5ESvVvCUbhI7Xpf4AkQFduhKNK7HkV 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-20240125_121319_124905_C5B21DAD X-CRM114-Status: GOOD ( 13.25 ) 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 This prepares the pwm-mtk-disp driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König Reviewed-by: AngeloGioacchino Del Regno --- drivers/pwm/pwm-mtk-disp.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c index 186aa5c04435..bafd6b6195f6 100644 --- a/drivers/pwm/pwm-mtk-disp.c +++ b/drivers/pwm/pwm-mtk-disp.c @@ -42,7 +42,6 @@ struct mtk_pwm_data { }; struct mtk_disp_pwm { - struct pwm_chip chip; const struct mtk_pwm_data *data; struct clk *clk_main; struct clk *clk_mm; @@ -52,7 +51,7 @@ struct mtk_disp_pwm { static inline struct mtk_disp_pwm *to_mtk_disp_pwm(struct pwm_chip *chip) { - return container_of(chip, struct mtk_disp_pwm, chip); + return pwmchip_get_drvdata(chip); } static void mtk_disp_pwm_update_bits(struct mtk_disp_pwm *mdp, u32 offset, @@ -231,12 +230,14 @@ static const struct pwm_ops mtk_disp_pwm_ops = { static int mtk_disp_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct mtk_disp_pwm *mdp; int ret; - mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL); - if (!mdp) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*mdp)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + mdp = to_mtk_disp_pwm(chip); mdp->data = of_device_get_match_data(&pdev->dev); @@ -254,11 +255,9 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(mdp->clk_mm), "Failed to get mm clock\n"); - mdp->chip.dev = &pdev->dev; - mdp->chip.ops = &mtk_disp_pwm_ops; - mdp->chip.npwm = 1; + chip->ops = &mtk_disp_pwm_ops; - ret = devm_pwmchip_add(&pdev->dev, &mdp->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "pwmchip_add() failed\n"); From patchwork Thu Jan 25 12:09:37 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: 13530899 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 38A23C48260 for ; Thu, 25 Jan 2024 14:10:46 +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=sbic3ud+NqieV2gjxBB+qQ6F304qbnwXMIGOyxrYbl0=; b=rcYy42jm9s7ODy Kxk8NXBVr0IRMekvLNrEkCp/UsFu2NPXVLOulFUHv1ygXa7vpS29I3Mpr8NOzF4KzLzgUTYWe95Nq DkMb2YaIugYMIAVCALNnXGA92FPZikjmu/XSrMTatx5GeVMOyRyVjkx/U3axeVAtLic8sF+4e/R6c NQfdWJpkCI2ZAzbWKPa3QY+v0ot3bfTjEDsf7GmozSDtqWwDnlC4EvDoObOl+KKDjJ3zJRD15uFxv j/oNn16VaR+XL6jVaXEOf8U5C6RfRfA+Fah0FpKDSTtV1yzruleDPX4d1+qgeh+I1+LpZTIBI5Jru qaWC3KVg5yZ9RbViHmOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0R6-00000000GWf-38DV; Thu, 25 Jan 2024 14:10:32 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PA-00000000FDK-1UAZ for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=LNRaVVN0Hnu2VR3B1GTVUZm8YXhQRfobIWiEfm6SE1w=; b=CiXMxLsR6yDDdK1e0zmvIj+aUI U2idvQt/lwZfLJvhgmyTcbmz6bdqyZ20/Ai3j8D+RnJf2zZ61q/D2T5KwHdzWgYG9IRRwfx9QxRPR WHZGruDjjUPcVN5YKfwEAM9IhiYDWpDeUzdLIcFC+Xr+o1Xc7AUxB3Vl5F2Ztcuby0gVSecp05ECl GUal2n3xbChJhk1JXL+HlAZ6R26bVNSJ2AzP68xiDZGAwM7kK/FtrEAo4YkMrblYYtPdZ6aZjVhx+ Pfsc1ZqV+L0uh2daubgf/I9MUEcqsU3+B/WMxiC40al9OOd0A/yFfGRL1aUR2S04M4nIrRV0krcbP AhZMucJQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000005Hjc-474H for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:16 +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 1rSyZL-0004S4-Uy; Thu, 25 Jan 2024 13:10:55 +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 1rSyZK-002HTX-Q2; Thu, 25 Jan 2024 13:10:54 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZK-007n3A-2K; Thu, 25 Jan 2024 13:10:54 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Shawn Guo , Sascha Hauer , linux-pwm@vger.kernel.org Cc: Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 075/111] pwm: mxs: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:37 +0100 Message-ID: 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=2587; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=UNgqLeMXr58KAB5LmcXwr6O+sjdR2/n1zhLr20cCLt0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+SoUl8mI/vlGobtYcaW4a2khiwRZFgy1pi0 kVy9p7C9geJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPkgAKCRCPgPtYfRL+ TrneB/9NNsQCezDzdiMvfCHIXzcUcdpxBL4zm8gvDuqWxzChkgNt+WGpZzQj4oH/i9K5sXM3LVZ PlxtLsN4tM7w4CWVtXa82UFv0BuutXfNYo7YkY8I2PvdFIrsR6545eR044iKfil+ZX1lrmujddt XmoHCgx/nLxQpZf1Z9b4nMv5Xo9QjtiGnckhOZCY5/wSlg4lZ4dJGrLufN1WDAD5ohVQWw3H+hD 78MZTyUOFdRem2BK+oh7cZSteIl0+tz6agaaQIaVvLmwOfoUD5bCLWkYUJT5PbQYyP2bV0gyp5m PRtDChSabzXVq2N8ltAJATDvdReSHDavD6lM08Lxfgg8KtUo 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-20240125_121313_231790_70D4214C X-CRM114-Status: GOOD ( 16.65 ) 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 This prepares the pwm-mxs driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-mxs.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c index 1b5e787d78f1..8cad214b1c29 100644 --- a/drivers/pwm/pwm-mxs.c +++ b/drivers/pwm/pwm-mxs.c @@ -37,12 +37,14 @@ static const u8 cdiv_shift[PERIOD_CDIV_MAX] = { }; struct mxs_pwm_chip { - struct pwm_chip chip; struct clk *clk; void __iomem *base; }; -#define to_mxs_pwm_chip(_chip) container_of(_chip, struct mxs_pwm_chip, chip) +static inline struct mxs_pwm_chip *to_mxs_pwm_chip(struct pwm_chip *chip) +{ + return pwmchip_get_drvdata(chip); +} static int mxs_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state) @@ -120,12 +122,21 @@ static const struct pwm_ops mxs_pwm_ops = { static int mxs_pwm_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; + struct pwm_chip *chip; struct mxs_pwm_chip *mxs; + u32 npwm; int ret; - mxs = devm_kzalloc(&pdev->dev, sizeof(*mxs), GFP_KERNEL); - if (!mxs) - return -ENOMEM; + ret = of_property_read_u32(np, "fsl,pwm-number", &npwm); + if (ret < 0) { + dev_err(&pdev->dev, "failed to get pwm number: %d\n", ret); + return ret; + } + + chip = devm_pwmchip_alloc(&pdev->dev, npwm, sizeof(*mxs)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + mxs = to_mxs_pwm_chip(chip); mxs->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(mxs->base)) @@ -135,21 +146,14 @@ static int mxs_pwm_probe(struct platform_device *pdev) if (IS_ERR(mxs->clk)) return PTR_ERR(mxs->clk); - mxs->chip.dev = &pdev->dev; - mxs->chip.ops = &mxs_pwm_ops; - - ret = of_property_read_u32(np, "fsl,pwm-number", &mxs->chip.npwm); - if (ret < 0) { - dev_err(&pdev->dev, "failed to get pwm number: %d\n", ret); - return ret; - } + chip->ops = &mxs_pwm_ops; /* FIXME: Only do this if the PWM isn't already running */ ret = stmp_reset_block(mxs->base); if (ret) return dev_err_probe(&pdev->dev, ret, "failed to reset PWM\n"); - ret = devm_pwmchip_add(&pdev->dev, &mxs->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) { dev_err(&pdev->dev, "failed to add pwm chip %d\n", ret); return ret; From patchwork Thu Jan 25 12:09:42 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: 13530891 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 66243C48285 for ; Thu, 25 Jan 2024 14:09:09 +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=kaPb2gVTBZARMF0Pxt3k9ptZj+2Ghy99GB5Lb0eYIko=; b=dQj1VI66C8yKaO B5/EggJwdWEJW+sB6CtRjCwCOPRSviqp+lMzVB8E00ZRSgcznCfTaG6DTnFFsflaNVyqeGvMDQCLt sAENPvt5UAOLpg+RpyY8TjzClSNlwfF7qrSTEL2itIGzT7TCF5VM1fvNKrF/HUEiW9CnvHGjayAsq qX2H1XogMnAmp4bL5UAWU8f3rFiNtgj8zTgrrCBsMzhFwqA6K14cclZflJW8jtQxGT2lijj7vKoWQ OR226sbOv2duKYEJj0mKYgt9GGhkrhRoY06tG4nblXc97gulZlM18ldDgxrJz8xepHgAVS2wYjxJu zT+DKvHi9/egWYdHPtbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PW-00000000FRV-3y6g; Thu, 25 Jan 2024 14:08:54 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ou-00000000F5v-3CFX for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=8zhso+SNIeR6+iOZO3KeMbHpZe1lwFUA7b2eFCEH484=; b=OQcZrGaDXciULNHfOLUIOJNtMB WL0aqLPTJ8c46x/djDJ/eyXzb3fqvcYsaH5dFulqm+uZ7TgH3iAFD80TNyCHTtjXW+iZ1F2GPYb7T d/tmVM9t6+BLibHQxFajicIBlIJvM5HJuuIWKYhasG9yZMdwORNyeOdDnlgaNVZRu0CurWVpZ06Cz mfuTPHyLRM1iOq6MOE+guFqZy0VAHOu6uHd9EM0Ot72YeNZNO49hqn3rLfelE2YM1TiMz+sPeK83b vdtpwBHhE/HJvIyOvPYiPE7kVGyMlf0mvKNQuh8QNx86g0IZ7k/Nth8TBI6RIHRYdii+imz2ciMc9 I5IJjcbQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybi-00000009sDf-0LUf for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:25 +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 1rSyZN-0004UE-0f; Thu, 25 Jan 2024 13:10:57 +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 1rSyZL-002HTr-QD; Thu, 25 Jan 2024 13:10:55 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZL-007n3U-2M; Thu, 25 Jan 2024 13:10:55 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Florian Fainelli , linux-pwm@vger.kernel.org Cc: Broadcom internal kernel review list , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 080/111] pwm: raspberrypi-poe: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:42 +0100 Message-ID: <7240dd99d9ef8032b51995feb6d7e63b6c45558b.1706182805.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=2408; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=hZ48ifFT5vmPHvpooGFp+QQXZ/HZi5ytMwRpLJdzaL4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+Y57iPgeMAeGCjIL4Dzuip7IHsvGZge+Sza VKltxAix+uJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPmAAKCRCPgPtYfRL+ Tp3UB/4n0S/zlLIBBC0jmzVZQXhOAT4zj+dOPbCv3R9U4BJWwZzKIw0JxfOYA6c7ecMOuZLsGGc DVlG8U1d5RZNmzxbGCPY0YvQug+qZApwKESMKM6/IchAt3jVGOj/bNf8npO6awSfAvbsen4kk/w oaAUtrK6CW+Tw+c8QckK5IQ1+lLOpOtpS9E11FY2OLCtXSiYV0070wE1itItoaFNnKlOFooNunF DYwYDRByI7FinEFT5F+PYeE+yflyRRAmytp9JjqV6P2UHpDyOLLgoLBDz6RT32v2mFL3xY71jGQ Osd4h5nNLqPQ8IH4IePCdKUdrgl3NPI8nr+P/7pMYTNFKdht 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-20240125_121323_603232_5701D7F4 X-CRM114-Status: GOOD ( 13.10 ) 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 This prepares the pwm-raspberrypi-poe driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-raspberrypi-poe.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c index f10e8a624c51..8921e7ea2cea 100644 --- a/drivers/pwm/pwm-raspberrypi-poe.c +++ b/drivers/pwm/pwm-raspberrypi-poe.c @@ -27,7 +27,6 @@ struct raspberrypi_pwm { struct rpi_firmware *firmware; - struct pwm_chip chip; unsigned int duty_cycle; }; @@ -40,7 +39,7 @@ struct raspberrypi_pwm_prop { static inline struct raspberrypi_pwm *raspberrypi_pwm_from_chip(struct pwm_chip *chip) { - return container_of(chip, struct raspberrypi_pwm, chip); + return pwmchip_get_drvdata(chip); } static int raspberrypi_pwm_set_property(struct rpi_firmware *firmware, @@ -142,6 +141,7 @@ static int raspberrypi_pwm_probe(struct platform_device *pdev) struct device_node *firmware_node; struct device *dev = &pdev->dev; struct rpi_firmware *firmware; + struct pwm_chip *chip; struct raspberrypi_pwm *rpipwm; int ret; @@ -157,14 +157,14 @@ static int raspberrypi_pwm_probe(struct platform_device *pdev) return dev_err_probe(dev, -EPROBE_DEFER, "Failed to get firmware handle\n"); - rpipwm = devm_kzalloc(&pdev->dev, sizeof(*rpipwm), GFP_KERNEL); - if (!rpipwm) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, RASPBERRYPI_FIRMWARE_PWM_NUM, + sizeof(*rpipwm)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + rpipwm = raspberrypi_pwm_from_chip(chip); rpipwm->firmware = firmware; - rpipwm->chip.dev = dev; - rpipwm->chip.ops = &raspberrypi_pwm_ops; - rpipwm->chip.npwm = RASPBERRYPI_FIRMWARE_PWM_NUM; + chip->ops = &raspberrypi_pwm_ops; ret = raspberrypi_pwm_get_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, &rpipwm->duty_cycle); @@ -173,7 +173,7 @@ static int raspberrypi_pwm_probe(struct platform_device *pdev) return ret; } - return devm_pwmchip_add(dev, &rpipwm->chip); + return devm_pwmchip_add(dev, chip); } static const struct of_device_id raspberrypi_pwm_of_match[] = { From patchwork Thu Jan 25 12:09:45 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: 13530888 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 38B25C48285 for ; Thu, 25 Jan 2024 14:09: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=PLtUnNuVRNNNsldBfXpyAHxjyxpj4V74m+ZXYK1Sido=; b=QwR0GsQKmDUiE9 UsKdEd1eu2Pz7GOV2BrENsiQBXCzQQnlq0gfyz6xd0/Ec2FgFRrIVXhTrCEz1AhIfSbKpyBL+EGpL HLacddFusLo+nbJuWVukR05fYGyBqn6sCFMqKC9LIXgo/Iiolc4AFDXzZKhWGeDKnJcIUo+LC+dvB 0RdnUFeBAqTZIv+4m+YH/KUA0/q/jfuEISuciUy85sl2ijNQWuvE+4QPwNo4bLX4gpURvyW3LAC6z d6n9JMH3L7nAJO94Varmnj57jDfhX5+iLiOvx1+45JdXTqAndwwLiihvysDOaj7QBsweB7dI/oFm7 5zvFJCd0fOlTTuOZUwbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PS-00000000FMf-1qFF; Thu, 25 Jan 2024 14:08:50 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ol-00000000F1m-0t6p for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=EF3eYK6XmS3ZD3U/bmbaOtrol+AEJdn5GjkXO/CimKY=; b=UfzJEWvo+dYg9pgoUbeQv/ZzXg GFYFLJqT8bv5hauOOenBYlzq0v02hnr50Z+khtzzdaxhh5nQsX8NRoyDKaAUjsunARh/TVz0Krl3z +1bglEs/ENAshytaimc3Eb1vgkoMsm+oaVdajRSKNEu2h4zt+FSjGweusYcbNssOD1HF1YOBNUHOu uE8Ji+O4WQ1eFg59N9uRQ1MCT5gc0GPNC6yA9lm8AdYS0ktRuL0Q1Pn16IQEJIs2KicTf+luQtXjL j1iy6E8Lr4gGxAV3U5CnRyPRg45FjTQX2ncdx+0E8sQMdZNpH1/xo6YcefRPoQ5h/bickJOZjYbq6 yZ6raXPg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybd-00000009sDd-0l8D for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:23 +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 1rSyZN-0004Vs-IK; Thu, 25 Jan 2024 13:10:57 +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 1rSyZM-002HU4-9G; Thu, 25 Jan 2024 13:10:56 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZM-007n3g-0e; Thu, 25 Jan 2024 13:10:56 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Heiko Stuebner , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 083/111] pwm: rockchip: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:45 +0100 Message-ID: <3fa1cd248c423c95ab1290634cbfeb3276ba28fd.1706182805.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=2829; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=rtkcltZMOo6Md1RGPzlmRgv8CpR5PZFpQu75wMewXGw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+b7O3Tj9e5mLiJRD+ipanh5rqcqMw8SSFr/ hT7jkyLY7CJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPmwAKCRCPgPtYfRL+ TuX4CAC4FUxEkLR++lna/0x4V3p4ucf0bvhZZV0k6mJtnGEetrbF3GlcUj72tO9zyWvSwqlKlpa Sb2q6kLIzDQ5ibxn4iivv2/bu9OP5KAElzL1SNw+Zz8g+60tyRtXVuF5Fkz7Jm8ZQYAe0IzbCK7 /8hEjfWL1mq67VfXAdd8yUSDLgt5iO2lUVc2OW0kyLSXDqsLyci3EuaKXD+Dn5xur7WNvikj+iv JPBuh0SVgJmHo/euTq7tj1bvqvCBhjqbK8L76bhzidQlLJmAb+KufRtPjEMG/wdJPovR+3wjbv7 pro6sGXR9szKEmMyP9kEdsFle+mOmG+n34s717EcTv0kDpjR 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-20240125_121318_689233_9C0F82EE X-CRM114-Status: GOOD ( 13.22 ) 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 This prepares the pwm-rockchip driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Reviewed-by: Heiko Stuebner Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-rockchip.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c index a7c647e37837..0fa7575dbb54 100644 --- a/drivers/pwm/pwm-rockchip.c +++ b/drivers/pwm/pwm-rockchip.c @@ -30,7 +30,6 @@ #define PWM_LP_DISABLE (0 << 8) struct rockchip_pwm_chip { - struct pwm_chip chip; struct clk *clk; struct clk *pclk; const struct rockchip_pwm_data *data; @@ -54,7 +53,7 @@ struct rockchip_pwm_data { static inline struct rockchip_pwm_chip *to_rockchip_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct rockchip_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static int rockchip_pwm_get_state(struct pwm_chip *chip, @@ -296,14 +295,16 @@ MODULE_DEVICE_TABLE(of, rockchip_pwm_dt_ids); static int rockchip_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct rockchip_pwm_chip *pc; u32 enable_conf, ctrl; bool enabled; int ret, count; - pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); - if (!pc) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*pc)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + pc = to_rockchip_pwm_chip(chip); pc->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pc->base)) @@ -337,18 +338,16 @@ static int rockchip_pwm_probe(struct platform_device *pdev) goto err_clk; } - platform_set_drvdata(pdev, pc); + platform_set_drvdata(pdev, chip); pc->data = device_get_match_data(&pdev->dev); - pc->chip.dev = &pdev->dev; - pc->chip.ops = &rockchip_pwm_ops; - pc->chip.npwm = 1; + chip->ops = &rockchip_pwm_ops; enable_conf = pc->data->enable_conf; ctrl = readl_relaxed(pc->base + pc->data->regs.ctrl); enabled = (ctrl & enable_conf) == enable_conf; - ret = pwmchip_add(&pc->chip); + ret = pwmchip_add(chip); if (ret < 0) { dev_err_probe(&pdev->dev, ret, "pwmchip_add() failed\n"); goto err_pclk; @@ -372,9 +371,10 @@ static int rockchip_pwm_probe(struct platform_device *pdev) static void rockchip_pwm_remove(struct platform_device *pdev) { - struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); + struct rockchip_pwm_chip *pc = to_rockchip_pwm_chip(chip); - pwmchip_remove(&pc->chip); + pwmchip_remove(chip); clk_unprepare(pc->pclk); clk_unprepare(pc->clk); From patchwork Thu Jan 25 12:09:47 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: 13530887 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 89DE7C48285 for ; Thu, 25 Jan 2024 14:08:57 +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=NOug0AEdWS2NuM5VIn9AH0/R8JtiaACIDUhbNiVZE3M=; b=3YjPjVvrx1nOOw 7gMusJK/CsK30g5RFA3243pYKR2zHZazCnqpb4PhF7HniCQdmJzz5KBGi3wBMfHWos8GfZ+R5dVvQ +Gbb8EDc80TCaWMyvUjlaTl2OZXTnQYjTyo5VAIr+MFkYBPsuI83zRZjfzc4QN7g9Ybs3S8XTqpxW kqmjeiunaZBGDD1nYdusJ3LQXgzc/rZJZtU97e58CQCTNNevU73BBz+JwWgQP0uWtY0A2g07TAhPx PKBrt0t7sqqCRTbYZ5Z9yOaxMBoGup6V6oRb1qkS7a1Vcm0bBXkKbOFlK+CZh8Tty4mNZIsfv7Vu0 0DgNRybLm5Y+RnMA1Odg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PO-00000000FJ4-2BaL; Thu, 25 Jan 2024 14:08:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Oh-00000000EzJ-0qzm for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=APbGLYh+dqYjnIB1vJrWsG5Hmws/aSKmB5F9mN9fD6A=; b=K7vm0zGNHbtr1AjdM3GESEQwe7 2WT2OFfWoPU9dlUe0dkM+x+ynaLPYamQi+Cx4Xv6D6aIQLdLEdkKyLcOsuwJ4ADj57FzlKGajsEVg yRUpfFDQXeJRwccq/rwkqvM6SdpDAnAKU1sGwxJUvz55yk+z8+7c38IsLzjpYQaTsYSnAMiwTICDo O0qC7R7dC6HGzBcVGaifMD6xsFsKhkOzcgIM8X0A9WYgopE/TF+EY5cMT8oR6SM4wIoyyPbed4PtX gMYmI5WJHDWskRriHhw6bzirhChBBkgH5qu9TWa0kJOHhzo0uH+7Szl5WIXKb++gfJL51aNwiKfyx UyngckzA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybb-00000009sDg-3Vry for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:22 +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 1rSyZN-0004WW-SI; Thu, 25 Jan 2024 13:10:57 +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 1rSyZM-002HUB-JE; Thu, 25 Jan 2024 13:10:56 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZM-007n3o-1f; Thu, 25 Jan 2024 13:10:56 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski , linux-pwm@vger.kernel.org Cc: Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v5 085/111] pwm: samsung: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:47 +0100 Message-ID: <259526dbf79927759cf0dbd5cea1c9a72e93b492.1706182805.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=6205; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=UeKCwn2GW6SYXoYMGVhQOEFQrUIA+9rYY7iFhSXWjuE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+e5VzO5pcCwTrYHpG8dMQVP716ZZNx2LcP6 Vm+iFOq4DWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPngAKCRCPgPtYfRL+ TiyuB/9YYuayjJurs4fj41Lwo4crThgLymmHi5MjbtZ8gke5dMiTpAnoxz61mTG7TtUBKPU4LFu 8de2uwDyTY4Sp/OasOnsFIbi+cn2j+P6L32VPmtGqRijIAhIEVOki4MRwJTmVDjYvT8H3VQqUYV WuvrHl34z+EJnMjX6yZpkd/1s3x4YfJTnc5rrambSqfhylo3gLQwP9SIm1ko2ppF7AIifbc0KQp 4CQz8+gMottKvblH9g+R0hxi2ch3qPk5zl0rSEbeJhMVNZigLbi140rk0f9cFyNRFgRkGzyU0g9 a+WFyx2APP+h1WwQ379Vg6V3R31irxagB6PyGrs1OQET4yAB 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-20240125_121317_332885_215182B5 X-CRM114-Status: GOOD ( 16.20 ) 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 This prepares the pwm-samsung driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-samsung.c | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index a97cae49406e..dec44ba1f90b 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -69,7 +69,6 @@ struct samsung_pwm_channel { /** * struct samsung_pwm_chip - private data of PWM chip - * @chip: generic PWM chip * @variant: local copy of hardware variant data * @inverter_mask: inverter status for all channels - one bit per channel * @disabled_mask: disabled status for all channels - one bit per channel @@ -80,7 +79,6 @@ struct samsung_pwm_channel { * @channel: per channel driver data */ struct samsung_pwm_chip { - struct pwm_chip chip; struct samsung_pwm_variant variant; u8 inverter_mask; u8 disabled_mask; @@ -110,7 +108,7 @@ static DEFINE_SPINLOCK(samsung_pwm_lock); static inline struct samsung_pwm_chip *to_samsung_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct samsung_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static inline unsigned int to_tcon_channel(unsigned int channel) @@ -181,9 +179,10 @@ static unsigned long pwm_samsung_get_tin_rate(struct samsung_pwm_chip *our_chip, return rate / (reg + 1); } -static unsigned long pwm_samsung_calc_tin(struct samsung_pwm_chip *our_chip, +static unsigned long pwm_samsung_calc_tin(struct pwm_chip *chip, unsigned int chan, unsigned long freq) { + struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); struct samsung_pwm_variant *variant = &our_chip->variant; unsigned long rate; struct clk *clk; @@ -197,12 +196,12 @@ static unsigned long pwm_samsung_calc_tin(struct samsung_pwm_chip *our_chip, return rate; } - dev_warn(pwmchip_parent(&our_chip->chip), + dev_warn(pwmchip_parent(chip), "tclk of PWM %d is inoperational, using tdiv\n", chan); } rate = pwm_samsung_get_tin_rate(our_chip, chan); - dev_dbg(pwmchip_parent(&our_chip->chip), "tin parent at %lu\n", rate); + dev_dbg(pwmchip_parent(chip), "tin parent at %lu\n", rate); /* * Compare minimum PWM frequency that can be achieved with possible @@ -329,7 +328,7 @@ static int __pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm, dev_dbg(pwmchip_parent(chip), "duty_ns=%d, period_ns=%d (%u)\n", duty_ns, period_ns, period); - tin_rate = pwm_samsung_calc_tin(our_chip, pwm->hwpwm, period); + tin_rate = pwm_samsung_calc_tin(chip, pwm->hwpwm, period); dev_dbg(pwmchip_parent(chip), "tin_rate=%lu\n", tin_rate); @@ -506,9 +505,10 @@ static const struct of_device_id samsung_pwm_matches[] = { }; MODULE_DEVICE_TABLE(of, samsung_pwm_matches); -static int pwm_samsung_parse_dt(struct samsung_pwm_chip *our_chip) +static int pwm_samsung_parse_dt(struct pwm_chip *chip) { - struct device_node *np = pwmchip_parent(&our_chip->chip)->of_node; + struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); + struct device_node *np = pwmchip_parent(chip)->of_node; const struct of_device_id *match; struct property *prop; const __be32 *cur; @@ -522,7 +522,7 @@ static int pwm_samsung_parse_dt(struct samsung_pwm_chip *our_chip) of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) { if (val >= SAMSUNG_PWM_NUM) { - dev_err(pwmchip_parent(&our_chip->chip), + dev_err(pwmchip_parent(chip), "%s: invalid channel index in samsung,pwm-outputs property\n", __func__); continue; @@ -533,7 +533,7 @@ static int pwm_samsung_parse_dt(struct samsung_pwm_chip *our_chip) return 0; } #else -static int pwm_samsung_parse_dt(struct samsung_pwm_chip *our_chip) +static int pwm_samsung_parse_dt(struct pwm_chip *chip) { return -ENODEV; } @@ -542,21 +542,22 @@ static int pwm_samsung_parse_dt(struct samsung_pwm_chip *our_chip) static int pwm_samsung_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct pwm_chip *chip; struct samsung_pwm_chip *our_chip; unsigned int chan; int ret; - our_chip = devm_kzalloc(&pdev->dev, sizeof(*our_chip), GFP_KERNEL); - if (our_chip == NULL) + chip = devm_pwmchip_alloc(&pdev->dev, SAMSUNG_PWM_NUM, sizeof(*chip)); + if (chip == NULL) return -ENOMEM; + our_chip = to_samsung_pwm_chip(chip); + + chip->ops = &pwm_samsung_ops; - our_chip->chip.dev = &pdev->dev; - our_chip->chip.ops = &pwm_samsung_ops; - our_chip->chip.npwm = SAMSUNG_PWM_NUM; our_chip->inverter_mask = BIT(SAMSUNG_PWM_NUM) - 1; if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { - ret = pwm_samsung_parse_dt(our_chip); + ret = pwm_samsung_parse_dt(chip); if (ret) return ret; } else { @@ -595,7 +596,7 @@ static int pwm_samsung_probe(struct platform_device *pdev) platform_set_drvdata(pdev, our_chip); - ret = pwmchip_add(&our_chip->chip); + ret = pwmchip_add(chip); if (ret < 0) { dev_err(dev, "failed to register PWM chip\n"); clk_disable_unprepare(our_chip->base_clk); @@ -612,17 +613,18 @@ static int pwm_samsung_probe(struct platform_device *pdev) static void pwm_samsung_remove(struct platform_device *pdev) { - struct samsung_pwm_chip *our_chip = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); + struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); - pwmchip_remove(&our_chip->chip); + pwmchip_remove(chip); clk_disable_unprepare(our_chip->base_clk); } static int pwm_samsung_resume(struct device *dev) { - struct samsung_pwm_chip *our_chip = dev_get_drvdata(dev); - struct pwm_chip *chip = &our_chip->chip; + struct pwm_chip *chip = dev_get_drvdata(dev); + struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); unsigned int i; for (i = 0; i < SAMSUNG_PWM_NUM; i++) { From patchwork Thu Jan 25 12:09:53 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: 13530892 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 D033FC48285 for ; Thu, 25 Jan 2024 14:09:24 +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=U6VpLCjQ0I2DvLC7W7fFLUhSzbg8kYY70xBjuOjeKNw=; b=Xy8uY9WCr7n/tW /lPoz5tDf4B+of/3v+JiwPjp70s1JYEiZS+Y3Fgkg9xpDx3XxV41o40HUE8/JpfL7PV3r0PV1fKEw nw/88dX1y4hm/9fqQFJGAGtZIJTGeUqZ7aq10Wvt/+BW3JGn+hae7uz9XnqACCI4vxPBCC1K8rEsg l6wAOs5JjFQv87nHqqR5QsY1BJiUBNuvhWUfgsU4iEd3eXauFHEoiYjNA0shptL7yh4ZehIJHwBDN UUPZ5RusjmWKU5VWICFclmTnEjZpOUVRyo8YMx40fFSaehLXnpjopDpHRsg5H7ftp9ql2S2H5gowU K9MvuxNPMaPKUdB5qsHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Pj-00000000FeH-11Z6; Thu, 25 Jan 2024 14:09:07 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0P3-00000000FA2-0a8R for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=ZzIdNPTAp9v5S9BFgUlYCwK6lYRZoWiMsAd+fTffKAI=; b=eIZJV+slhJn8hAA0awYn7WBFYO PRl4xQ3p6D64GKb6DVuRM8u3IhfwPWY02VwMIlHCUIRXoYceseG+NRzxPlGwDZsVzwpL7kulfGAOy TFxyZwgzwQ5BrArcjOWs9ZJJXx11CVZqeG6ABykp1lHSjDKOPCtYrS84+LFAtjcZAOcdBgCynS2W1 UfKZi4//6usoBWY60etr7mY6+j9v44pZc/OvxkarByFtdxNRbaIrhK6OuGd+EMi3O+j3t6tceNY0d Bv620kikhn9VAMq7ZV/vh0OAclT3CO9xaVthCQADN1VvWtIxZVG3aqG5whdk0xcP9pfTB3wImb8Vo SjR+pz4A==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybY-00000009sDQ-3HRH for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:19 +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 1rSyZO-0004YQ-WC; Thu, 25 Jan 2024 13:10:59 +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 1rSyZN-002HUX-Ka; Thu, 25 Jan 2024 13:10:57 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZN-007n4H-1n; Thu, 25 Jan 2024 13:10:57 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Fabrice Gasnier , Maxime Coquelin , Alexandre Torgue , linux-pwm@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 091/111] pwm: stm32-lp: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:53 +0100 Message-ID: <4eb36d234035eeff80cbf2b1156bf16df09f52fe.1706182805.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=2375; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=TYiQCSljGWoEGgak5kXyP6CBHH4tPiwJ97FsdVYfhqA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+lDRHuHfukkFSiK82TipFM60fLRJr2uJ3ny 7HKMm1kX6WJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPpQAKCRCPgPtYfRL+ Tjq8CACo4QSpAmaDkazaEljQNRarkFbeLc9mq2/bcFSVIBFVvvXdYD6rLFERJAjkN2r6xl5yi8t YUtzbQsSlfFAsgsPlWD3tA+PelXtGOvnmekGXXoeMuiUDpAnjUg1G1ABZM+trbIFg29ocBXjglL n3R+GkuauOrQbEafWhkz6rsVE/V1kuw2tK9VhA79F93RhCoe+w/WdMpq25hPqgnW4cWjDT75Cre Jtr7pUhfhHVp9fTF2j7T4EA8aj2pEUr6IYll6aDgpeHWhHylV76ZHTGwN2cPPrRIrV2CJl6ZVox 3LBT9DprPc+lKMMH/dItrUvBpRoZ1gxEBWEFXb5K5dqDSyKA 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-20240125_121314_261539_1CC9CBC0 X-CRM114-Status: GOOD ( 13.20 ) 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 This prepares the pwm-stm32-lp driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-stm32-lp.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index 3754faeca838..579fea9a0da4 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -18,14 +18,13 @@ #include struct stm32_pwm_lp { - struct pwm_chip chip; struct clk *clk; struct regmap *regmap; }; static inline struct stm32_pwm_lp *to_stm32_pwm_lp(struct pwm_chip *chip) { - return container_of(chip, struct stm32_pwm_lp, chip); + return pwmchip_get_drvdata(chip); } /* STM32 Low-Power Timer is preceded by a configurable power-of-2 prescaler */ @@ -196,20 +195,20 @@ static const struct pwm_ops stm32_pwm_lp_ops = { static int stm32_pwm_lp_probe(struct platform_device *pdev) { struct stm32_lptimer *ddata = dev_get_drvdata(pdev->dev.parent); + struct pwm_chip *chip; struct stm32_pwm_lp *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*priv)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + priv = to_stm32_pwm_lp(chip); priv->regmap = ddata->regmap; priv->clk = ddata->clk; - priv->chip.dev = &pdev->dev; - priv->chip.ops = &stm32_pwm_lp_ops; - priv->chip.npwm = 1; + chip->ops = &stm32_pwm_lp_ops; - ret = devm_pwmchip_add(&pdev->dev, &priv->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return ret; @@ -220,13 +219,13 @@ static int stm32_pwm_lp_probe(struct platform_device *pdev) static int stm32_pwm_lp_suspend(struct device *dev) { - struct stm32_pwm_lp *priv = dev_get_drvdata(dev); + struct pwm_chip *chip = dev_get_drvdata(dev); struct pwm_state state; - pwm_get_state(&priv->chip.pwms[0], &state); + pwm_get_state(&chip->pwms[0], &state); if (state.enabled) { dev_err(dev, "The consumer didn't stop us (%s)\n", - priv->chip.pwms[0].label); + chip->pwms[0].label); return -EBUSY; } From patchwork Thu Jan 25 12:09:54 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: 13530870 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 6DA6FC48260 for ; Thu, 25 Jan 2024 14:07:46 +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=x2f0aG6rqQ0qT8t3fVQAnZvJWcttkD/7Rh09rHrpLH4=; b=N9N13wBIRq0TGT UmF08S15+tQqJQuE5XV9hnV80XsFQ6GDM7tIIEIV+oyUekPSJMEsJe7GnZpE886VjwnFLdEmqpudD vuDDugNE98nGLIjzB7AamQ0LpKVpsjUUpC6IB1w12AakqtCwZhgKPdCHiacVHrzpOo2t9R6OiHbzk uqEeuuyPs4bfpgWNxZ6rnRlof+VCW/IRmx5F1t7ZYEjO9hJgUdfqinVrw9YzOQnsaSQCWHq+k9qN7 VXkW6gFhQbSvl4Y8URl3K/PLvHkQHZfr0X68j9gBV2D+CGr0qk1IRyH4dy9pbPEDgFXJG9DnvgYa6 xuJstE+o3KtZN2QnHJSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0OD-00000000Eak-1P0j; Thu, 25 Jan 2024 14:07:33 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0O8-00000000EVS-2gcV for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:07:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=7Gsj4DFdca5z3hWypNFXiUgOA6cyHjuSOp2vm3aVTG0=; b=ArzcUDAmaBbCmcSneZbZxXduiH oMgFqbMQrXfRrlkZrO1d3i60JVvuFNUUu0RDIYF0Gzwy6/VAAmzuPNuStVgVFJHbfal0m7wXwWXh3 lsVVkUeH13AnQTkKx96JNN+/ylevNVUOSKexeFDnpdY9qnlyWcPh54vFDVkKVR+2VNAmzKFDUASM6 0TPJGg6su4qRQh+bGbDSIUBeQslv6n4LtpwgbKGce+DQmSFd64zpjrESJQDGXxgZFm4mRrtSUyA1y 2xH25Xa8vin7KIuiS7dQh7fkAgRzqgg8LCH9kJLiaVYs2ZMoJedITOEUW6GOfDd4WK7Q/WYxMy0jv qWGtOBrg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybZ-00000009sDT-17ia for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:20 +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 1rSyZP-0004Yb-25; Thu, 25 Jan 2024 13:10:59 +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 1rSyZN-002HUb-Pa; Thu, 25 Jan 2024 13:10:57 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZN-007n4L-2I; Thu, 25 Jan 2024 13:10:57 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Fabrice Gasnier , Maxime Coquelin , Alexandre Torgue , linux-pwm@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 092/111] pwm: stm32: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:54 +0100 Message-ID: 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=5965; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=0HmvancSqF28RgYlD77HxpTnrmZZEhBgpTGq9hfZqz8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+m6QKrYs1EdiSiurHKBUFhgbBCzD5ACx3nU VJx48wabS2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPpgAKCRCPgPtYfRL+ TlHsB/9NYQG9wuCXPkYCVrpEmCCKg2qWOe0xSOdaSvEhljLRcM5bMGa9CG9bpdNaGTurm4j8Feh c5e5wRWejkJz68epUICl6+mrKgbRRlv+LoO3/+0vJ9Wy507XKJTvAHUNTDAkf7u1OJFbD3MGHfh mBeBrGQQhh1OEyttKvWKiY6NOa/Ac+pyttyqCHD9YDIF7n1NIdpmnUq9WEf3B/g5jWKckswtEXT a8M58RyKREKUyCAiopHgj7jZy5ITi/U8mxJmi9+OroSux9yCtdmbyAGbioSh/Wir5QoulR8Vp6h tcVY1c7voOtBp4Yx1SkNnRuuoGsu9ho/yF/F6fS4GksH4Msx 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-20240125_121314_703840_2A5CEF43 X-CRM114-Status: GOOD ( 17.70 ) 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 This prepares the pwm-stm32 driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-stm32.c | 51 ++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c index d1dc9e3ca2a1..aae8bd4f40ab 100644 --- a/drivers/pwm/pwm-stm32.c +++ b/drivers/pwm/pwm-stm32.c @@ -27,7 +27,6 @@ struct stm32_breakinput { }; struct stm32_pwm { - struct pwm_chip chip; struct mutex lock; /* protect pwm config/enable */ struct clk *clk; struct regmap *regmap; @@ -40,7 +39,7 @@ struct stm32_pwm { static inline struct stm32_pwm *to_stm32_pwm_dev(struct pwm_chip *chip) { - return container_of(chip, struct stm32_pwm, chip); + return pwmchip_get_drvdata(chip); } static u32 active_channels(struct stm32_pwm *dev) @@ -90,11 +89,12 @@ static u32 active_channels(struct stm32_pwm *dev) * - Period = t2 - t0 * - Duty cycle = t1 - t0 */ -static int stm32_pwm_raw_capture(struct stm32_pwm *priv, struct pwm_device *pwm, +static int stm32_pwm_raw_capture(struct pwm_chip *chip, struct pwm_device *pwm, unsigned long tmo_ms, u32 *raw_prd, u32 *raw_dty) { - struct device *parent = pwmchip_parent(&priv->chip)->parent; + struct stm32_pwm *priv = to_stm32_pwm_dev(chip); + struct device *parent = pwmchip_parent(chip)->parent; enum stm32_timers_dmas dma_id; u32 ccen, ccr; int ret; @@ -208,7 +208,7 @@ static int stm32_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm, TIM_CCER_CC12P : TIM_CCER_CC34P, pwm->hwpwm < 2 ? TIM_CCER_CC2P : TIM_CCER_CC4P); - ret = stm32_pwm_raw_capture(priv, pwm, tmo_ms, &raw_prd, &raw_dty); + ret = stm32_pwm_raw_capture(chip, pwm, tmo_ms, &raw_prd, &raw_dty); if (ret) goto stop; @@ -229,7 +229,7 @@ static int stm32_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm, /* 2nd measure with new scale */ psc /= scale; regmap_write(priv->regmap, TIM_PSC, psc); - ret = stm32_pwm_raw_capture(priv, pwm, tmo_ms, &raw_prd, + ret = stm32_pwm_raw_capture(chip, pwm, tmo_ms, &raw_prd, &raw_dty); if (ret) goto stop; @@ -257,7 +257,7 @@ static int stm32_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm, FIELD_PREP(TIM_CCMR_IC1PSC, icpsc) | FIELD_PREP(TIM_CCMR_IC2PSC, icpsc)); - ret = stm32_pwm_raw_capture(priv, pwm, tmo_ms, &raw_prd, &raw_dty); + ret = stm32_pwm_raw_capture(chip, pwm, tmo_ms, &raw_prd, &raw_dty); if (ret) goto stop; @@ -605,7 +605,7 @@ static void stm32_pwm_detect_complementary(struct stm32_pwm *priv) priv->have_complementary_output = (ccer != 0); } -static unsigned int stm32_pwm_detect_channels(struct stm32_pwm *priv, +static unsigned int stm32_pwm_detect_channels(struct stm32_timers *ddata, unsigned int *num_enabled) { u32 ccer, ccer_backup; @@ -614,10 +614,10 @@ static unsigned int stm32_pwm_detect_channels(struct stm32_pwm *priv, * If channels enable bits don't exist writing 1 will have no * effect so we can detect and count them. */ - regmap_read(priv->regmap, TIM_CCER, &ccer_backup); - regmap_set_bits(priv->regmap, TIM_CCER, TIM_CCER_CCXE); - regmap_read(priv->regmap, TIM_CCER, &ccer); - regmap_write(priv->regmap, TIM_CCER, ccer_backup); + regmap_read(ddata->regmap, TIM_CCER, &ccer_backup); + regmap_set_bits(ddata->regmap, TIM_CCER, TIM_CCER_CCXE); + regmap_read(ddata->regmap, TIM_CCER, &ccer); + regmap_write(ddata->regmap, TIM_CCER, ccer_backup); *num_enabled = hweight32(ccer_backup & TIM_CCER_CCXE); @@ -632,11 +632,14 @@ static int stm32_pwm_probe(struct platform_device *pdev) struct stm32_pwm *priv; unsigned int num_enabled; unsigned int i; + struct pwm_chip *chip; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; + chip = devm_pwmchip_alloc(dev, stm32_pwm_detect_channels(ddata, &num_enabled), + sizeof(*priv)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + priv = to_stm32_pwm_dev(chip); mutex_init(&priv->lock); priv->regmap = ddata->regmap; @@ -652,37 +655,36 @@ static int stm32_pwm_probe(struct platform_device *pdev) stm32_pwm_detect_complementary(priv); - priv->chip.dev = dev; - priv->chip.ops = &stm32pwm_ops; - priv->chip.npwm = stm32_pwm_detect_channels(priv, &num_enabled); + chip->ops = &stm32pwm_ops; /* Initialize clock refcount to number of enabled PWM channels. */ for (i = 0; i < num_enabled; i++) clk_enable(priv->clk); - ret = devm_pwmchip_add(dev, &priv->chip); + ret = devm_pwmchip_add(dev, chip); if (ret < 0) return ret; - platform_set_drvdata(pdev, priv); + platform_set_drvdata(pdev, chip); return 0; } static int stm32_pwm_suspend(struct device *dev) { - struct stm32_pwm *priv = dev_get_drvdata(dev); + struct pwm_chip *chip = dev_get_drvdata(dev); + struct stm32_pwm *priv = to_stm32_pwm_dev(chip); unsigned int i; u32 ccer, mask; /* Look for active channels */ ccer = active_channels(priv); - for (i = 0; i < priv->chip.npwm; i++) { + for (i = 0; i < chip->npwm; i++) { mask = TIM_CCER_CC1E << (i * 4); if (ccer & mask) { dev_err(dev, "PWM %u still in use by consumer %s\n", - i, priv->chip.pwms[i].label); + i, chip->pwms[i].label); return -EBUSY; } } @@ -692,7 +694,8 @@ static int stm32_pwm_suspend(struct device *dev) static int stm32_pwm_resume(struct device *dev) { - struct stm32_pwm *priv = dev_get_drvdata(dev); + struct pwm_chip *chip = dev_get_drvdata(dev); + struct stm32_pwm *priv = to_stm32_pwm_dev(chip); int ret; ret = pinctrl_pm_select_default_state(dev); From patchwork Thu Jan 25 12:09:55 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: 13530871 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 17F1CC48286 for ; Thu, 25 Jan 2024 14:07:46 +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=0koAf7bWzSnMecBVOtuxaA016PL/lIdSOwrPgvV9+ac=; b=UBDBulntguD8mF uRslvV3sftecV0sJFb9Ls2NzTG6WUS/vxSBdAEBWXXmKLnvAtHBG9EFEGVVIRQph27H/1IYhI4b19 ZyQh6QzG7GSvS68qLkQRdjDIFAtNCDesO0o4xSW5Pd577lxwNUS4joLzpQtQKJDPEuYFMdQsBPw37 bfyYXzEtnsRdBCkc1DuW8B/4nS5H6eMqC946DiHY5hcVe9zf0DUaZ0sKb7iBhKHHc5gwOoxMlFwJH 1PkIjSK1VnM9dR1EFz3uouKdtts5D0fDyrfDlH8cXMY60qW9n84eLz72BFktZQoj/iU3J0iw2LHyC LtYwDR34WRQ06p6XK4qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0O9-00000000EXb-34XH; Thu, 25 Jan 2024 14:07:29 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0O8-00000000EVS-0hR8 for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:07:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=bk79hDXmtBBIJjvsDAjQ6a/pV9DeaE9Q7de8dkBV9Xw=; b=Q91htVVxupGsyXWPd29+uGyesS McexkWPh+rh0NXPiBy7koFw7LJjMBixEFcU/dy0z3b9KemdfIKDzRknj74vmufn4ba30SBhz/L/a7 SekikxkwsPL5mdJEet4q0TV7UBS50GKVwjRBIE8QXrI1WhinewSDDoHrZmN0JidyblX7j+saA8J3E /1OvakMN2AD3/46NSbV2b1KyRKwNm0e7Li0qv7Xnn0IU8IOctyAZ9YIr2JDQFWpa08xicGitCRGeP 0Q8qUliTQGMVzFMqWMrgOC/bR6PgNpyRVKmgV/NbkejU0O0N3PTev6LvFkae+vH0SeuJivjxFP8t3 Re4ChUwg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybZ-00000009sDR-1dQr for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:20 +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 1rSyZP-0004Yz-7P; Thu, 25 Jan 2024 13:10:59 +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 1rSyZN-002HUf-UG; Thu, 25 Jan 2024 13:10:57 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZN-007n4O-2l; Thu, 25 Jan 2024 13:10:57 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maxime Coquelin , Alexandre Torgue , linux-pwm@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 093/111] pwm: stmpe: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:55 +0100 Message-ID: <0c1f5268c8045c2b4cb6e00bd2d81a20d0df53c9.1706182805.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=2455; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=vidtE9CgEuAi+9yLI9nc75r2oHZCcD5MypZmUOpuSi0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+n+E9fw0hJYqoDvom0/6h63yfF5ktdkZ3gq BUOhlhqrpGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPpwAKCRCPgPtYfRL+ TiGNB/9vGzi2NfwWEhEY8IsXVwdtspOXHyJ9JsxWnZWBaSRVmeveEwNu/pAElgGNlz96XlhCTFK PZQkr8+IvGngLHmJIxPT9+oQedpXPKKRE/iiUwq2zmhsfQsAqkOA0BCZgf+NIQjEajZFrIeqpbA 3RdXG0IwKieoDKAJ/s859qy/fJk30M4yqIs/33TzHway4PPGpFkM6feTDCD9xrZiHsrZImKmvdK DFPQhlGemU67ANopPFqYtR0iquQ4/XhwZpajZBt1SyAizEpw2rxriikpBdDamPoSdpf8eKOz7vm 1itx7NWHoCux6w8FmvfGbPLfxb1tejG8p6VJZUCtFmHZzO5q 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-20240125_121314_821482_536A3BE2 X-CRM114-Status: GOOD ( 14.10 ) 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 This prepares the pwm-stmpe driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-stmpe.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/pwm/pwm-stmpe.c b/drivers/pwm/pwm-stmpe.c index 05f3f38031ee..319c6ad6a79b 100644 --- a/drivers/pwm/pwm-stmpe.c +++ b/drivers/pwm/pwm-stmpe.c @@ -27,13 +27,12 @@ struct stmpe_pwm { struct stmpe *stmpe; - struct pwm_chip chip; u8 last_duty; }; static inline struct stmpe_pwm *to_stmpe_pwm(struct pwm_chip *chip) { - return container_of(chip, struct stmpe_pwm, chip); + return pwmchip_get_drvdata(chip); } static int stmpe_24xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) @@ -292,33 +291,36 @@ static const struct pwm_ops stmpe_24xx_pwm_ops = { static int __init stmpe_pwm_probe(struct platform_device *pdev) { struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); + struct pwm_chip *chip; struct stmpe_pwm *stmpe_pwm; int ret; - stmpe_pwm = devm_kzalloc(&pdev->dev, sizeof(*stmpe_pwm), GFP_KERNEL); - if (!stmpe_pwm) - return -ENOMEM; + switch (stmpe->partnum) { + case STMPE2401: + case STMPE2403: + break; + case STMPE1601: + return dev_err_probe(&pdev->dev, -EINVAL, + "STMPE1601 not yet supported\n"); + default: + return dev_err_probe(&pdev->dev, -EINVAL, + "Unknown STMPE PWM\n"); + } + + chip = devm_pwmchip_alloc(&pdev->dev, 3, sizeof(*stmpe_pwm)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + stmpe_pwm = to_stmpe_pwm(chip); stmpe_pwm->stmpe = stmpe; - stmpe_pwm->chip.dev = &pdev->dev; - if (stmpe->partnum == STMPE2401 || stmpe->partnum == STMPE2403) { - stmpe_pwm->chip.ops = &stmpe_24xx_pwm_ops; - stmpe_pwm->chip.npwm = 3; - } else { - if (stmpe->partnum == STMPE1601) - dev_err(&pdev->dev, "STMPE1601 not yet supported\n"); - else - dev_err(&pdev->dev, "Unknown STMPE PWM\n"); - - return -ENODEV; - } + chip->ops = &stmpe_24xx_pwm_ops; ret = stmpe_enable(stmpe, STMPE_BLOCK_PWM); if (ret) return ret; - ret = pwmchip_add(&stmpe_pwm->chip); + ret = pwmchip_add(chip); if (ret) { stmpe_disable(stmpe, STMPE_BLOCK_PWM); return ret; From patchwork Thu Jan 25 12:09:56 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: 13530889 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 38AD0C47258 for ; Thu, 25 Jan 2024 14:09: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=3B4ySZuiDZ/GKRPZ+wajzL6r4XzY0uFnAuakrYSkLt0=; b=gOTb4rmiCwZTfo C72ijfqG+6dTyOs0nLwXgrMf7UmdhhmYOBdWE5dsTT75tLrI9UuPNtF2yC1PwHnChGf1O/BAJAqck n1dcccaRoofMyFYi337eiNTAPMrKL4JhKYQxIV0szTs1M6P4u8CQvf+4JSKGSkpSmm0Kzmpg+lq3F JfmA4ccJZv8/Lgdq0/miI0H9YvbgnIQdEuYFH/E5LF19QLfduXxfnfh/bMDVLVK3aQ+vZPz+wrede Gb+ACnZp5AUq0hbITpQt4oAsfGJVbM/Da1AZfChz58DriE5kpoPxq06/hyy0kozDT0E3xZncBqpWK M2N8FwwRVkWu7+ZriokQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PM-00000000FHr-3ShD; Thu, 25 Jan 2024 14:08:44 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Og-00000000EzJ-3cZB for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:08:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=eMxgfpisafBWEop1cRsJLV56QkmXzJpKfSWtWJNjT6U=; b=NepU+LHaM4W0bAPIL7G+0ebiSs SBcNMDGyTPU74ZLIMY3z8L/WH1LWSXIh9uLI8JYyffxkZAA9kf6YufHvzaQbGyVjPHVD95yQxxr00 MsXkpTWb4IWQ0dgRchwaSHzeop5g0yaI1wxjEYqNMn7KgKCzL48JbMO/NPWrPWM1P+untJoKstEin hy0hHE++aEgxOhi1Wfv49jrbk8/62oPmiXQoi5NVZ/RdEcRQ3SrA1tnFSxqddJUyL0AtT0UCCd6Fc vP7bpFGURjtPbq4g5FLY/XcW2+OvMPhGXGzr8B7N77FgIarHhQ3rpYVfVAtsP/po5HS4EwFr/d5Tz nSwg08PA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybb-00000009sDW-08wp for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:22 +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 1rSyZP-0004ZA-E7; Thu, 25 Jan 2024 13:10:59 +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 1rSyZO-002HUk-37; Thu, 25 Jan 2024 13:10:58 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZO-007n4T-03; Thu, 25 Jan 2024 13:10:58 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@pengutronix.de, Andre Przywara Subject: [PATCH v5 094/111] pwm: sun4i: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:09:56 +0100 Message-ID: <3fbc44ec7f4a5b8c388ebddb8fc9c98d2eb04834.1706182805.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=3137; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=pbimw4e1snhdJV1OL+Hd8nlXssUcoYI3zeJdziV6/04=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+ovSOLzS0QBSxAO37SsCRl6WlZNV2yQM532 +KI5vxIZ1WJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPqAAKCRCPgPtYfRL+ TmiTB/9RSOvADji5DhMKskrIzH8FgyRWsSbXa0Ivb77Apq8oM+u13NHEmx5xWmyspbmx4cG4Vy1 s36owWy4rycjf72wTGYzizrnTg/W4APlv+3sRGnYTS53zybIzA/0dp5lRrT7uZcxERbdEJlj04I j//7OLQoKzJKm5YP8qnrFqx1wDq+0JE/iFlhXGHaT0toVCvxxwaRx5ZXqSkTxqmwpzH9la9/azl ltZGMSOhARoKupbwp9CVHRQWxsNH34GDmFKTkJUcWkaLXEmPlEuuFTRmn3+DQ0K18HLg7pQmsGj cEiElqZzAuGlFUca/aI+f2vMOXAvyECx8z/RSQavqqBJXn8X 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-20240125_121316_485765_BD6AEB2B X-CRM114-Status: GOOD ( 13.86 ) 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 This prepares the pwm-sun4i driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Reviewed-by: Andre Przywara Reviewed-by: Jernej Skrabec Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-sun4i.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 44edf1ce5739..36a8dc65b19c 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -81,7 +81,6 @@ struct sun4i_pwm_data { }; struct sun4i_pwm_chip { - struct pwm_chip chip; struct clk *bus_clk; struct clk *clk; struct reset_control *rst; @@ -92,7 +91,7 @@ struct sun4i_pwm_chip { static inline struct sun4i_pwm_chip *to_sun4i_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct sun4i_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static inline u32 sun4i_pwm_readl(struct sun4i_pwm_chip *chip, @@ -384,17 +383,22 @@ MODULE_DEVICE_TABLE(of, sun4i_pwm_dt_ids); static int sun4i_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct sun4i_pwm_chip *sun4ichip; + const struct sun4i_pwm_data *data; int ret; - sun4ichip = devm_kzalloc(&pdev->dev, sizeof(*sun4ichip), GFP_KERNEL); - if (!sun4ichip) - return -ENOMEM; - - sun4ichip->data = of_device_get_match_data(&pdev->dev); - if (!sun4ichip->data) + data = of_device_get_match_data(&pdev->dev); + if (!data) return -ENODEV; + chip = devm_pwmchip_alloc(&pdev->dev, data->npwm, sizeof(*sun4ichip)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + sun4ichip = to_sun4i_pwm_chip(chip); + + sun4ichip->data = data; + sun4ichip->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(sun4ichip->base)) return PTR_ERR(sun4ichip->base); @@ -451,19 +455,18 @@ static int sun4i_pwm_probe(struct platform_device *pdev) goto err_bus; } - sun4ichip->chip.dev = &pdev->dev; - sun4ichip->chip.ops = &sun4i_pwm_ops; - sun4ichip->chip.npwm = sun4ichip->data->npwm; + chip->ops = &sun4i_pwm_ops; + chip->npwm = sun4ichip->data->npwm; spin_lock_init(&sun4ichip->ctrl_lock); - ret = pwmchip_add(&sun4ichip->chip); + ret = pwmchip_add(chip); if (ret < 0) { dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret); goto err_pwm_add; } - platform_set_drvdata(pdev, sun4ichip); + platform_set_drvdata(pdev, chip); return 0; @@ -477,9 +480,10 @@ static int sun4i_pwm_probe(struct platform_device *pdev) static void sun4i_pwm_remove(struct platform_device *pdev) { - struct sun4i_pwm_chip *sun4ichip = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); + struct sun4i_pwm_chip *sun4ichip = to_sun4i_pwm_chip(chip); - pwmchip_remove(&sun4ichip->chip); + pwmchip_remove(chip); clk_disable_unprepare(sun4ichip->bus_clk); reset_control_assert(sun4ichip->rst); From patchwork Thu Jan 25 12:10:02 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: 13530886 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 832E5C48260 for ; Thu, 25 Jan 2024 14:08:57 +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=Um1KllIy84qlwet/MQd8H8SqVqqBOfrMizv5jcfY4/c=; b=2oRzgS4O/f3xmS tGRhdWqnlLy+cN8Zoa8CDmw1tSJ9zF1HwzN7EaYfXsU9NbJVmAGvtcBw2Pw9SecOfaqFqBNwyw6X+ HYHS8Px1cVtF0OtcUURLjAEgoZXcVAsGKL5CIrMP5jzFpFsBchI1i73CHpPmMxyjbd0u1PAbxjsTc bcfYNa4PEEK4+UtXkXqfizmNwNUKOTOpVvr7hysDIlZyOLn/tDD3/1E829LcK/yk/e0B/FfIR7MSy PnoX5AnWNcQY24RzYGxKBXVzbWb8sERIxzFidadIKxLk9VooN51t7PbIfqG1w1Ysw1cxy60+mhUH4 kIwuwr9/7fw1CvoFTDIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0PJ-00000000FFc-1cxW; Thu, 25 Jan 2024 14:08:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Ob-00000000Evs-3VUV for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:07:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=h/cLOAWQ66J9qGAkXVYnfmLpuHjwIxxZ1jW7MNm8f5w=; b=GfCyz4IOCMX6jayfojpzs5Ztr/ EsfjBl+ocDQCcXsn6mdzQO1oCazckSp1K8iTQVg6WpBlgPQWd7+/I84vr0k5CtZ1LksUfB233dD+5 2xd6j1gA3WIva3WOYc7HFarcGxxKtKz1xzCuDOABneZ8QmBcu2fZcYG9UGD3HY3po5CyiIsgpV6Lv wI80HUWzj7sTDOfIB/aQ6q3PypDtELuZ7Oiow5yi6n2GGMuZo9m0dsfkL4Ylv8rgBBVTNGxEYbzrH bNAGoyl+ZMQfTZNTxzzCfBX9FaijhGMjGeQklkUKbnwi/O9hy6MGiJkN/Mq1gK6ymhs5iswzky/10 QYxcYrAw==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSyba-00000009sDY-3QSk for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:21 +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 1rSyZR-0004bf-0J; Thu, 25 Jan 2024 13:11:01 +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 1rSyZP-002HV8-48; Thu, 25 Jan 2024 13:10:59 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZP-007n4r-08; Thu, 25 Jan 2024 13:10:59 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Nobuhiro Iwamatsu , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 100/111] pwm: visconti: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:10:02 +0100 Message-ID: <1debdb7798b99db180bf92ea9f38fd1bb9904864.1706182805.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=1937; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=CDg5DENx7fvJJUTQlX8qtwT+uKgrppGqalaIRu7TUN4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+vUR8OAGO4TTfgRsObBRSF699ecKeCylvoK kd/tHoJ2UWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPrwAKCRCPgPtYfRL+ TqzIB/9+qKFby9PwLsVpnhWDFLd/dGcob6nGpzmsNjAr8fnBQZ4cau0Hdx/CkENffeZQn+lc/tC Hdgf6iMnLXP+MTyuot1Ypld3ZmGKkEooW0sgAJ+PmuX4/MZb6JBqRkV0eosncUwTUR0MvojpgLb Z4J5Wr6qUIolCLxERCZcvckF0nvND5s46A6bPzQjl7bVK1smNF4AfHrZTJinwbPH/tBtb/hrShv CdOIbStCgzz7HofchphnKWEUVJBl9RWlWj4radRpRlDPR1U1f9rc2aqG171ljqRQSPSDgBDCZ44 khbmpHlTQwruqRt3FrTgSAC/Y65s9Fqlu3lWl0Y5TbwpEdHo 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-20240125_121316_244559_A891F1AC X-CRM114-Status: GOOD ( 12.80 ) 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 This prepares the pwm-visconti driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-visconti.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-visconti.c b/drivers/pwm/pwm-visconti.c index 8d736d558122..9e55380957be 100644 --- a/drivers/pwm/pwm-visconti.c +++ b/drivers/pwm/pwm-visconti.c @@ -34,13 +34,12 @@ #define PIPGM_PWMC_POLARITY_MASK GENMASK(5, 5) struct visconti_pwm_chip { - struct pwm_chip chip; void __iomem *base; }; static inline struct visconti_pwm_chip *visconti_pwm_from_chip(struct pwm_chip *chip) { - return container_of(chip, struct visconti_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static int visconti_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, @@ -134,22 +133,22 @@ static const struct pwm_ops visconti_pwm_ops = { static int visconti_pwm_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct pwm_chip *chip; struct visconti_pwm_chip *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; + chip = devm_pwmchip_alloc(dev, 4, sizeof(*priv)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + priv = visconti_pwm_from_chip(chip); priv->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->base)) return PTR_ERR(priv->base); - priv->chip.dev = dev; - priv->chip.ops = &visconti_pwm_ops; - priv->chip.npwm = 4; + chip->ops = &visconti_pwm_ops; - ret = devm_pwmchip_add(&pdev->dev, &priv->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "Cannot register visconti PWM\n"); From patchwork Thu Jan 25 12:10:03 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: 13530909 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 3FC7AC47258 for ; Thu, 25 Jan 2024 14:12:53 +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=4lxg+29Ks/XFOUF/EN5h1INsVf4O5xjyf0PZIkcuBrg=; b=eGhr9TY/scNgvs 3am0coBZs8YHS7maNFE6uDjwsglP8qVM4KEz9uNxfqogqs8MfqfYx4VRxCdAAO8zYjkCraQjwX00A 2BTDmqRI+jrXewQTif2rBmpVKDzg6zcfLMntUtymhoaknjM7kOBKcksCdTcPKV+F0vj60+snXRUAU jn0qmz16PHXP5tVpFNRpDM8PiPHWl38CisaLYalB/KAb7MlYjntaXf8xu7URLWq9HxPM1uORcHdvn h+38SXTFON71ZwjzjEjg6R763NZ1Tpy6o1pWU2tZFakNbsNi+uUngjpN7sBRvap5f42N4oUW8m2jN 6lUgD71rz+vWNtQYLA6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0T9-00000000I42-2vT1; Thu, 25 Jan 2024 14:12:39 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Rv-00000000HEw-2sgG for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:11:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=Tqxc53ahBSQJ24o5WhxLjWqvdL03JFzbjNyaqkiORGg=; b=ApRkHrJU7eTOF5VECxpfHc7nUb B+uaMagvg6B3G1CV4YyIjQm1vDZrwYlKq5lL/y/5qh/hhjd363GIWPAxYBdRPW8DNjWK0ZtHXsQ4c yhTfk0n3PR9PSebEfb9/BlfgCGi4gxu4pnA2LtulgFAfoWOlYRZ1vzdLHnyUoNnEQGIazvmvisWq8 rq8nQVJNfG8BeRfFsewsnJ3SkgzLUFeZ7Llb3NRUAyTHUdQsxJ82qrsFbWujOXr0/54O6H/PyHkYQ XmSEexrqQO+xwSpj9wWc9nG+HiJhvNtLjNXpbCdHmRKs5zEcYkvafh9iuabfjNtmPvW/4JpUBKzwK owQJftVg==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybc-00000005Hjc-3MLs for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:18 +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 1rSyZQ-0004cI-NS; Thu, 25 Jan 2024 13:11:00 +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 1rSyZP-002HVC-Aj; Thu, 25 Jan 2024 13:10:59 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZP-007n4v-0o; Thu, 25 Jan 2024 13:10:59 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 101/111] pwm: vt8500: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:10:03 +0100 Message-ID: <01b4c6f966cd9506c7a0771a442d13199c4b92fd.1706182805.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=2303; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=dkfJtIjUtbDhr/LiFNhq2M4wEO28QtDlc90Nq+Tu3yQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+wQpnU070buZRIXoJz4AXaXF25nY4Up4epJ Ecc2tP/8ziJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPsAAKCRCPgPtYfRL+ TjfIB/4mu+z9//YiNWdz74fKfzConYKFZMTK4Cl5mKn4KsqQNAru7rYDjLlne3ucrOFBG0RX4m8 JJVsg9ElZ5Lg1b7MPOOxWF3W9b/riBHCGuo/AImRA99Ca9mojDQoqIXP3GX2lhK0fRhBHBr9nW3 /sgq7LBynQIYO3BrvApdGOMV4ftabAuwi/GTqDB+VR+5GMEe4XeaL2fxZmcH915UdGZ15cyx+pw 6yACeE+jS9LBwwAAHwXjOkSA6bgByXh+gzHcApssDVsd6b/cV8wbhwdWCayRBn4mBnL8IqXHlfR pMMC0kv80mdiK8iq20/sRNsNK/f25mymmuhYLcxTh/8Uy7pm 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-20240125_121316_924498_860F53E4 X-CRM114-Status: GOOD ( 14.75 ) 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 This prepares the pwm-vt8500 driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-vt8500.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c index def48dbef808..ea465376fe09 100644 --- a/drivers/pwm/pwm-vt8500.c +++ b/drivers/pwm/pwm-vt8500.c @@ -45,12 +45,14 @@ #define STATUS_ALL_UPDATE 0x0F struct vt8500_chip { - struct pwm_chip chip; void __iomem *base; struct clk *clk; }; -#define to_vt8500_chip(chip) container_of(chip, struct vt8500_chip, chip) +static inline struct vt8500_chip *to_vt8500_chip(struct pwm_chip *chip) +{ + return pwmchip_get_drvdata(chip); +} #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) static inline void vt8500_pwm_busy_wait(struct pwm_chip *chip, int nr, u8 bitmask) @@ -232,6 +234,7 @@ MODULE_DEVICE_TABLE(of, vt8500_pwm_dt_ids); static int vt8500_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct vt8500_chip *vt8500; struct device_node *np = pdev->dev.of_node; int ret; @@ -239,13 +242,12 @@ static int vt8500_pwm_probe(struct platform_device *pdev) if (!np) return dev_err_probe(&pdev->dev, -EINVAL, "invalid devicetree node\n"); - vt8500 = devm_kzalloc(&pdev->dev, sizeof(*vt8500), GFP_KERNEL); - if (vt8500 == NULL) + chip = devm_pwmchip_alloc(&pdev->dev, VT8500_NR_PWMS, sizeof(*vt8500)); + if (chip == NULL) return -ENOMEM; + vt8500 = to_vt8500_chip(chip); - vt8500->chip.dev = &pdev->dev; - vt8500->chip.ops = &vt8500_pwm_ops; - vt8500->chip.npwm = VT8500_NR_PWMS; + chip->ops = &vt8500_pwm_ops; vt8500->clk = devm_clk_get_prepared(&pdev->dev, NULL); if (IS_ERR(vt8500->clk)) @@ -255,7 +257,7 @@ static int vt8500_pwm_probe(struct platform_device *pdev) if (IS_ERR(vt8500->base)) return PTR_ERR(vt8500->base); - ret = devm_pwmchip_add(&pdev->dev, &vt8500->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "failed to add PWM chip\n"); From patchwork Thu Jan 25 12:10:04 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: 13530910 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 8BE69C48260 for ; Thu, 25 Jan 2024 14:12:58 +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=/oeNpF6KQZMJfegxdhyRlw4CNCMt+IvYFlTtnPS5m7k=; b=d9aG3XUBHsu4cr tJgnHmR38KqPUSQeBDPU+LDTA54idujS/uLAjd+LTdGheziO3VXA8zq0cs6kPc0UNhkERzNVRC9NK wU4foThrGcHAJnnWsGJos8RcQtz/9tQKnFi/XVM9EBsv9nSpH2+2KJG5jaQEyYqHTw9kXm/rNHxlD eFm0a29oVyD5w7cQ90MMoGu/BxGp9m8dTlu5splTMFFAE/bQNg2oejT+ytijXtxAfsYSUxdCKJNY8 d2llyjuiN6LFPuSf23PEUr6hmzLTAnquW8obhAI60U0xZ1nuVleQGb7MVddncHGNt/Rk5N/fGMKc4 IBLa5ZhUgo5B1uOyaXVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0TB-00000000I5k-2NTp; Thu, 25 Jan 2024 14:12:41 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT0Rx-00000000HG7-0Se8 for linux-arm-kernel@bombadil.infradead.org; Thu, 25 Jan 2024 14:11:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=zodK5nDWeaC8c/0m6fpR1k61WEJd5c7jxCurV5IezwQ=; b=B8NRLh1s+rZ1qWXWLlBGX6xDtm 7THHiDdMlyZeVVlzfPRNliDFG3003KEjEAuRsXXjZ2HKG1eHwKYTrPPBSNWDfK3yHdlDzDDM4kvsZ Dg8WHwTtUaXwJJU0LUNC/RsDFHQJGv4CR1bFHhZNoyCcLhGgLKMHMndQ1xX7Xm73jHsj2J63DEen2 S9VgPR8gtPvOpxkbgB7JIb76S8lqvsmAt0U7fSXzTaPvXGxAZMFyiEDa5ByMCFOMs4EkJHh8D9wkH H/1lBmsGMmMaDGxyOOZP7fQ88oYYUMwNUHI7t4CPnIGOBVhmBSgiNvH7GiVr25vyhalwRRM7SRJw0 WBP6WOHw==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSybc-00000005Hfz-3FV3 for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 12:13:18 +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 1rSyZR-0004d8-AP; Thu, 25 Jan 2024 13:11:01 +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 1rSyZP-002HVI-J9; Thu, 25 Jan 2024 13:10:59 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSyZP-007n4z-1e; Thu, 25 Jan 2024 13:10:59 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Sean Anderson , Michal Simek , linux-pwm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH v5 102/111] pwm: xilinx: Make use of devm_pwmchip_alloc() function Date: Thu, 25 Jan 2024 13:10:04 +0100 Message-ID: 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=3206; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=as3S2egeJ/QZdTUEgNrgJSJQI7Am97f8zTw8M8Bg5WY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsk+xN9oc1YRMXX3AynlpRvrvMmCCIXir8Cjx4 BnW/FFqx6iJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbJPsQAKCRCPgPtYfRL+ Tm45CACp+YZ/zWPGZv9AUc/cZ4no3uHmpyJ4kAp6Zi9zW6qArfTFNW1Sj/AGlm4B6YKoRLWGyeh hsGTt/WK4CNSocALAyeYUvv4gPAcqEV3KA3iK+ZX/0DCuN++M0Q8Zufemw4c/FcJga6bbGnbotG PaA5p2ueL2Nvsq5PaTsNXbnwLrDPMcIj7malzTwAt5+jN/5KtOLpqXouIOX9k9Yrgn11lTTNUzL U5h+mpQh9dLjC/gibD/ZdaSHGzdin/xMrGd1cBgQ1komaGTSvJQgqg5fsS3+YDgTfjtMXgHPOIM vb2MBAVoSjMJwLVz7B4A4bBHk2ReuLouc28oK8Fu/v16IXq6 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-20240125_121316_899447_BC7EBEEC X-CRM114-Status: GOOD ( 15.69 ) 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 This prepares the pwm-xilinx driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-xilinx.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/pwm/pwm-xilinx.c b/drivers/pwm/pwm-xilinx.c index 5f3c2a6fed11..465ac9617256 100644 --- a/drivers/pwm/pwm-xilinx.c +++ b/drivers/pwm/pwm-xilinx.c @@ -80,15 +80,10 @@ unsigned int xilinx_timer_get_period(struct xilinx_timer_priv *priv, #define TCSR_PWM_CLEAR (TCSR_MDT | TCSR_LOAD) #define TCSR_PWM_MASK (TCSR_PWM_SET | TCSR_PWM_CLEAR) -struct xilinx_pwm_device { - struct pwm_chip chip; - struct xilinx_timer_priv priv; -}; - static inline struct xilinx_timer_priv *xilinx_pwm_chip_to_priv(struct pwm_chip *chip) { - return &container_of(chip, struct xilinx_pwm_device, chip)->priv; + return pwmchip_get_drvdata(chip); } static bool xilinx_timer_pwm_enabled(u32 tcsr0, u32 tcsr1) @@ -213,8 +208,8 @@ static int xilinx_pwm_probe(struct platform_device *pdev) int ret; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; + struct pwm_chip *chip; struct xilinx_timer_priv *priv; - struct xilinx_pwm_device *xilinx_pwm; u32 pwm_cells, one_timer, width; void __iomem *regs; @@ -225,11 +220,11 @@ static int xilinx_pwm_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "could not read #pwm-cells\n"); - xilinx_pwm = devm_kzalloc(dev, sizeof(*xilinx_pwm), GFP_KERNEL); - if (!xilinx_pwm) - return -ENOMEM; - platform_set_drvdata(pdev, xilinx_pwm); - priv = &xilinx_pwm->priv; + chip = devm_pwmchip_alloc(dev, 1, sizeof(*priv)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + priv = xilinx_pwm_chip_to_priv(chip); + platform_set_drvdata(pdev, chip); regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(regs)) @@ -278,10 +273,8 @@ static int xilinx_pwm_probe(struct platform_device *pdev) return dev_err_probe(dev, ret, "Clock enable failed\n"); clk_rate_exclusive_get(priv->clk); - xilinx_pwm->chip.dev = dev; - xilinx_pwm->chip.ops = &xilinx_pwm_ops; - xilinx_pwm->chip.npwm = 1; - ret = pwmchip_add(&xilinx_pwm->chip); + chip->ops = &xilinx_pwm_ops; + ret = pwmchip_add(chip); if (ret) { clk_rate_exclusive_put(priv->clk); clk_disable_unprepare(priv->clk); @@ -293,11 +286,12 @@ static int xilinx_pwm_probe(struct platform_device *pdev) static void xilinx_pwm_remove(struct platform_device *pdev) { - struct xilinx_pwm_device *xilinx_pwm = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); + struct xilinx_timer_priv *priv = xilinx_pwm_chip_to_priv(chip); - pwmchip_remove(&xilinx_pwm->chip); - clk_rate_exclusive_put(xilinx_pwm->priv.clk); - clk_disable_unprepare(xilinx_pwm->priv.clk); + pwmchip_remove(chip); + clk_rate_exclusive_put(priv->clk); + clk_disable_unprepare(priv->clk); } static const struct of_device_id xilinx_pwm_of_match[] = {