From patchwork Wed Feb 14 09:31:49 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: 13556155 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 A6425C48BEB for ; Wed, 14 Feb 2024 09:36:22 +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=0qfFDDTJ0cMqmvVwclKhvCPVFDlYFXDCcM+Rzy6X9mk=; b=mCo5zo5zHZXvGW jECpMplv+hT9Iu9Rj5gYyHkh9K3FRjgjAVkXuNDccXplTDsEHDnMHc/slpczQRndjwZMmD5NEW7uT ZP3Vu1YB+eDUvhd9fbS80oedJr1Mdqvv08jQFb21YFuLv812OTLDgLaena76sV+S9QGYsFiuvVVnR IWGLBPdViMXsyPGiZS1kBVMv5f3vo00D/kUHglvUZ+/JwonsfkQzluyC549FUVbIZjO4J7NIzVdkr jvuob9F2Rc+SMZaH2JE2ZFcpQ+Lt+JTXxglrxe6h5Sxqx/y6KsuQ7rdU/mi3/ejGm4PufVNsBjAAw wO33IUhM3BxZTFvo4kzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBgS-0000000CLcw-2155; Wed, 14 Feb 2024 09:36:04 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBez-0000000CKH9-2UMV for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 09:34:37 +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 1raBew-0004xK-89; Wed, 14 Feb 2024 10:34:30 +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 1raBet-000fCc-FA; Wed, 14 Feb 2024 10:34:27 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1raBet-004Y3p-1G; Wed, 14 Feb 2024 10:34:27 +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 v6 062/164] pwm: lpc18xx-sct: Prepare removing pwm_chip from driver data Date: Wed, 14 Feb 2024 10:31:49 +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=2552; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=3da8qrj1JzLsfU2rOYyBMIHXaXMB5GdW4GAulxI0eRc=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtQzHRPt47KY1T6/9gq5HHjvGb+wAk/v/H1sZZW3ZSZfi frnd4+tk9GYhYGRi0FWTJHFvnFNplWVXGTn2n+XYQaxMoFMYeDiFICJnK7jYOiJTpA9uXbFniLL K1F3mrI5Bf7WqC/Z9vqu+5bdG9zWKR6wyWOM7Lt5R2m2sBbb6T0vcv+yWv+r1U4X/DWtRDWybVG 65FZOxijVrgTe+9KL07doMvRWRIckXvuxQpvZMY9rI7vZz3pbjejUWf9nymlEMfyYtr/M7cvB7r Nb4hryC2NUXsW98Iy3vR7i+SmQ8+/p14av5b87zFx8p+tlgH2yR9OVsuxJXkz5d8/vu+2wuHFJ5 I3QpZVx1yTk5jD6r9kcOWFLpHPw7c/sJT3ibJOPyT698z3GWUn/TbpWEJfSFNsa7ZP9h9I6FkXn P5kY52PFt4+pev22Lt5nCrZfbB5u+x1Y4DLDTJFnkoIqAA== 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-20240214_013433_826897_A4A6ABB1 X-CRM114-Status: GOOD ( 14.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 This prepares the driver for further changes that will drop struct pwm_chip chip from struct lpc18xx_pwm_chip. Use the pwm_chip as driver data instead of the lpc18xx_pwm_chip to get access to the pwm_chip in lpc18xx_pwm_remove() without using lpc18xx_pwm->chip. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-lpc18xx-sct.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index 46eeca27d9ab..9b1e8141aec7 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -348,6 +348,7 @@ 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; @@ -356,6 +357,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) GFP_KERNEL); if (!lpc18xx_pwm) return -ENOMEM; + chip = &lpc18xx_pwm->chip; lpc18xx_pwm->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(lpc18xx_pwm->base)) @@ -386,9 +388,9 @@ 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->dev = &pdev->dev; + chip->ops = &lpc18xx_pwm_ops; + chip->npwm = LPC18XX_NUM_PWMS; /* SCT counter must be in unify (32 bit) mode */ lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CONFIG, @@ -420,21 +422,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,