From patchwork Wed Dec 6 11:43:36 2023 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: 13481592 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 F16C6C4167B for ; Wed, 6 Dec 2023 11:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=U/vkQZi0To4Ix6nIKB8jbPlrhs5cPn8HcDiMcgUQ5P4=; b=MbsH/DDw5ocENK6Rx7DgI3AdnF osAQgIUJRAr/632Jfz8tUob4iByTYTCXoKdyT5CPsfGdAX5Hxe0K/q2liRhx5ZNgXjwnhv/Cw0RlZ E7QQEeABs75rmj44LkkzFTKAtaKY6t3MezBZtUA4jACNpVkdl23oCCmcQoToJasGOeqAf98sj2OYj NqjhHxF3CpxPmyfrNDBJSuhgAKBWCctuqJt/TTLdiArbO+PPqzMqFoEE3eR+2UtJVc1mVSX1Hkjcx 9BXspM/KeMVxRwdEI7ZEzpUlH+InTOEprmh20Ix88wd/zbu25901qqmg300LMkOPvEGZN6RrYxgVq w2DnTviA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAqOQ-00A6L8-2L; Wed, 06 Dec 2023 11:48:42 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAqOD-00A64X-0z for linux-mediatek@lists.infradead.org; Wed, 06 Dec 2023 11:48:34 +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 1rAqO8-0006Ep-TL; Wed, 06 Dec 2023 12:48:24 +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 1rAqO8-00Dwsh-9C; Wed, 06 Dec 2023 12:48:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rAqO8-00FQxr-0A; Wed, 06 Dec 2023 12:48:24 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding Cc: kernel@pengutronix.de, Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 022/115] pwm: mediatek: Make use of pwmchip_parent() macro Date: Wed, 6 Dec 2023 12:43:36 +0100 Message-ID: <028a566d671a9ef14ed8e79818bfd05b19a234cf.1701860672.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.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=rTrJ+ySN/1myKTD4cdzDIS35z0aynWVLqSK1aIKD+6g=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlcF51kfFJCnd66iQB3eAzapZvNuVGMkc8+JQFu 1+46KlAhPqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZXBedQAKCRCPgPtYfRL+ TgByB/wLeINwa1gPhUVtrcZ8wpIk0rHsuQflG6dGClx0sIlx/gtpew1ubrDrpboLyXc7Tsct5BE E7hKMr8bn9r4+Sje5ONHcUoAq+FFOJpg7LB+37XtB3997I7NcceobiUlbINRllTCZ3Wf6b9gX5K AzuRsS4fatLICal2o3YT5n1ZXUTBs7yiwFskmL4WqP3qIfQ0Q6UnpLUQ6HRgmgnH8Mwk4bFELgP W9BaZ2AIj6o2CZEPIS5cvPk+ID7WSd47MNX39tk4pCx0ohZNqH34TWuV/mmfT4cnl9U7TVhK27G uCk8myQ9S1Qs4mPQooqa93qFxkK5wsXM/UmlmKe3ENV59zKW 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-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_034829_339341_9E441ACB X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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-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 17d290f847af..d7d1c326e8cf 100644 --- a/drivers/pwm/pwm-mediatek.c +++ b/drivers/pwm/pwm-mediatek.c @@ -150,7 +150,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 Wed Dec 6 11:43:38 2023 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: 13481593 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 62714C10DCE for ; Wed, 6 Dec 2023 11:48: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=Rs5yC4OnASo61dZaNSgFMOQCw+JbGmnIpYIvPJplZ88=; b=GPP/FK3m9hF0LHQ7fCdsd2Wb4+ tYazWQjdRrBPNM9qmOqKBU3aGrJFLq/deXwdhnwg3086a89gCT5/ZjjDduwZC59dEiHMD1KD9jcjI 6jRml8JwAoL5vXs8za3Wfo9dLzWCNgpVsxP85YCFKKL30hvKup9uL5C6A1hqNJliUF9tUjm53iC1v w1AiUohwOxtrazffy2XsgpazbqM21tG9rnaBKNsmYIJr6ef2IyRJeMnx5VyXwdKwEPMgrx6hK16Hs pMY6/SZzoRneLdFsYGe2lRny5Y14Mb1kApgmmdvWwXSXqoQI4QlFKsf7dGn/YxVUTGdHxoQ+/koT9 l2cWAVEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAqOY-00A6RE-02; Wed, 06 Dec 2023 11:48:50 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAqOD-00A65L-2D for linux-mediatek@lists.infradead.org; Wed, 06 Dec 2023 11:48:34 +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 1rAqO9-0006GW-90; Wed, 06 Dec 2023 12:48:25 +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 1rAqO8-00Dwsq-J2; Wed, 06 Dec 2023 12:48:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rAqO8-00FQxz-A6; Wed, 06 Dec 2023 12:48:24 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding Cc: kernel@pengutronix.de, Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 024/115] pwm: mtk-disp: Make use of pwmchip_parent() macro Date: Wed, 6 Dec 2023 12:43:38 +0100 Message-ID: <93ee3518cd35dd9ec88b83b9657c9857e7be58e3.1701860672.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.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=vXuY2V8WhGS3JT93BuIQZEPRXMh4TZPOCFwd/uY3uho=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlcF58mdlTqGe/5tEN+95CriSc4xxiMsWOGLVtc 9feixsE7E6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZXBefAAKCRCPgPtYfRL+ TpFZCAC4QtiSBvKJjI0hvUgSNMcdzTy2tDb5uIvhxo4XOk2P/eTuYw/U+aEJ2FOPQHJov/OuXsz xUy6ZyeWBaqIPm7hRLBP04NfYYHgJiMT4tJDoJejISfNNXPZL0ETUWgxSu+BgknrCxHwPzPZ8N5 4qmzzO/jy7CnsavXOW1/KZRAQrwO52VT1cY6bZdPuAXc0kWetvSrhXS01OFxiA8f/LB3nfwD8N9 8LAU9or4c5XArj1tAzzBpYIpqdK8uL7dYIxYzohAMta29ick0wu/cBNUba2BH3wkloqFX8ZYp7I a3RhldNpNw8U76romVxIrq+rft1pUY+QgoajqgFws0u/bTHL 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-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_034829_728240_E3CBDFAA X-CRM114-Status: GOOD ( 11.57 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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-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 Wed Dec 6 11:44:28 2023 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: 13481595 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 DBAECC10DCE for ; Wed, 6 Dec 2023 11:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=pKEXsp1E216gUs4ybvIcXnTF/TUfvw6mlj4vK1e/djA=; b=bwbkc2G7oeb6JuK6OhdHvSafaw STumFrr1ZsrpJPzbvqNNOS1stL+8Wk/3rIlFKRdjRaYmvqYxJZpjc2kOX64w40m36BdAgU8iNCkts /ADUEChrc+VB2I4q+rsgx4MNi918X3Ufn5Q+klVlk+Jgr2fVhBGP07MmB3u6nBH1jcRUjjBKwvpnL 2AVMvbbtjzJYFlIBF3bzzTdsn65w2GUPZ1hY7fKp7/oenL/rDsul/wFyifaGtY1T6N2hwa4gOlhVK zdYcpv5UxrdPe1ChyViV5eReBDUyJFrWIMCazt8xLWzYsx0jopVl5Kqn/XEApZ+h02z4lUBeDQTas cygc50Aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAqQ8-00A85q-0Z; Wed, 06 Dec 2023 11:50:28 +0000 Received: from metis.whiteo.stw.pengutronix.de ([185.203.201.7]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAqOP-00A6JK-2O for linux-mediatek@lists.infradead.org; Wed, 06 Dec 2023 11:48:47 +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 1rAqOJ-00073y-3U; Wed, 06 Dec 2023 12:48:35 +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 1rAqOG-00Dwvz-QF; Wed, 06 Dec 2023 12:48:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rAqOG-00FR1N-HL; Wed, 06 Dec 2023 12:48:32 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding Cc: kernel@pengutronix.de, Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 074/115] pwm: mediatek: Make use of devm_pwmchip_alloc() function Date: Wed, 6 Dec 2023 12:44:28 +0100 Message-ID: <555f6785eb433361f116151ef998f5b412fff3a9.1701860672.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2933; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=CFiGLNGZLW2dHQLgBxlZrkfwHYjasLQjxR8Le4nvp8Q=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlcF7oUWGWaRcLJOyFiMunIQ5oyca5/NvAAw0U6 +W4pfXNgGeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZXBe6AAKCRCPgPtYfRL+ TjkaB/4qwTYCYkG0GD+6wlVqxV/Aw9ZjveHkiq/0UeDYnU0foaRH99xpme/efmFbwHSLwEOqNOu Nwl4sqQakpa3mkPEr2zTozRFidZuY6mpHXhY2hVg3y84eiK4A3CA23mEvjn2/2cZNCmbSZCvDp4 98pWXzeI7NN32P2p9pq9loIyvmUTqCuSqU4E/YeXMsNl9xWj5y7A5xz2h9GiQlicCwNE2TZY18C Mq76Zq5ed3wbyC1sqUx9SCHSoJfIyIsYr/+JlPU0fNisicdrJTqc/qaxHD7jemErsL7+XR/B2TV RGhze/q1IpnkpunuRdqGCIbLg34uEcd7AWRo3b3a1w4byDNv 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-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_034841_813924_2007D98A X-CRM114-Status: GOOD ( 16.98 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c index d7d1c326e8cf..d4329affccda 100644 --- a/drivers/pwm/pwm-mediatek.c +++ b/drivers/pwm/pwm-mediatek.c @@ -51,7 +51,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; @@ -70,7 +69,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, @@ -233,21 +232,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; @@ -262,7 +266,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); @@ -273,11 +277,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 Wed Dec 6 11:44:31 2023 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: 13481594 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 0EB5CC4167B for ; Wed, 6 Dec 2023 11:50: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=S1x/954YsIisqD97Ev0aVRxObzswnBbVxYWdcDa63+M=; b=Zk3BPII2dMFcwx1HTp90Dlngc0 +jXTBwgVDyiWOmVkGkqygBHXh45GEJkIzxNYY3J7HO+MmzF632Vp23UvZcMbgD3ohcbNaAyzDiIoQ Sy8yFIfPmdVg3Kmzyt/7EjDVg1RvdgajkTCS3Lz3YAWiQCzRb5IbzcUEC4ODUx98ewbZ+ODpIBi7g TuoAxgJyZSNoGUkpoi/pDAT2vYjOSXTf015oW6UaU6gq5xsEfro9x1i3QAcXv/ZdfW4U1cUmv1fEN OFLnibLg+daW5AO+7LIcGNwsmAVydUa8VlwKv0WOD38z1PTxF2TL+SBCFRGgTjoYklRzq00ZV5Ool 9H41DPrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAqPp-00A7iS-1d; Wed, 06 Dec 2023 11:50:09 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAqOU-00A6NH-0L for linux-mediatek@bombadil.infradead.org; Wed, 06 Dec 2023 11:48: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=S1x/954YsIisqD97Ev0aVRxObzswnBbVxYWdcDa63+M=; b=C/jRcZWUfNbemSX6jd8wtbmykA BFfYi92nnmIH+vt/2i0vcYCbJbe0oYpWUzeQTTRbKiuobRsnxv4PQzflBal7yheOs3mkYI77RIuQ/ ey++NPfbcp+08+OMGFce+dwy/NBCxfsyd7muiXWU2CBUfAu+M+zfJ5J2Ome0P4u987YFhBUnAolJV 8reCaSlEGwmPHJ75yoKCiNmhkCTwQSMNoc2+lvpP0BzRj8qAbqcTqkqUvU/03gnXJzoB4oHWS5OrM hUGHxfECQNvkPexQHShTufQE10CYFDyYFP8DniAmZ0RwMac9262inZZD9Zh2W+Az1/PnB6XNKBv+O 7HTRwIuQ==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAqOQ-0059Vs-0G for linux-mediatek@lists.infradead.org; Wed, 06 Dec 2023 11:48:44 +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 1rAqOJ-00076x-GN; Wed, 06 Dec 2023 12:48:35 +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 1rAqOH-00Dww8-9N; Wed, 06 Dec 2023 12:48:33 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rAqOH-00FR1Z-0J; Wed, 06 Dec 2023 12:48:33 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding Cc: kernel@pengutronix.de, Matthias Brugger , AngeloGioacchino Del Regno , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 077/115] pwm: mtk-disp: Make use of devm_pwmchip_alloc() function Date: Wed, 6 Dec 2023 12:44:31 +0100 Message-ID: X-Mailer: git-send-email 2.42.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=3mAoZwowhY5Q8LCYbYjvGDo+okdiQ2FoVEfE9Yl1Q1g=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlcF7xh32gzhap3jjyjBbN3xzzHqKLN2B8d4VSv x40XBxRKimJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZXBe8QAKCRCPgPtYfRL+ Tn5qB/4jM5NCMPtVpE7/WT8nG1cdwNbVeL5IHXkTjMY3RcH0zqTyQrnkxNcJgk8B1lDuXZ+41oE pNbPJUAsu8g3Z9U+YiQE32GukVNXxUttZxMVm4fKsIiCRboZD9TrPURE13Lq5xCkjW+5JusZLAc njClh0Mg+XDBZ51RwUO9D74m54USiy+8bTyUD+4jZ0ig7t8+h9eYDImSP3YBpa8HVKzVFmgYAcr Mf2resUYHXr4FgFDvnbdJxzfPtUImqMsJAgiqBVQqP80GndKWQsuIpOzFu5DhO0voSwk9fwI1bq 1gOpCfYzKCoftO5sk6ganeKLuRraJZilfrxaXZ9rHWD6TbNf 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-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_114842_208807_9AEB4445 X-CRM114-Status: GOOD ( 14.71 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 --- 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");