From patchwork Wed Feb 14 09:33:16 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: 13556174 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 2A77AC48BEB for ; Wed, 14 Feb 2024 09:39:25 +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=8wpyrhOZbqBXhKHDdTV2ZqltSgu3Q6Cacum7W5Efb2c=; b=aRXg5ICdKCu7z/ hQ1umZZAl4FOOkOimgJoOynBReJABYWHfPiCLbB5zMYgrdRrD2gXnGEre88G+wC8fryrPX9GSr0kq cEGmWqraTMfTwuF7qlvaENuJQi26wxux/8vg5NlpUGHIcMVJLIIbA9G93vv28z261YrpQEnx1BQ7d JEGIS/xMWyr047B1dsDjGCRmmAwoyqbsS4OeSBe2heCaqU14BKmRiM4dqLVcqfpA79lXjqdkdjNG7 aVAxkl9S7VXvP6WjU4q45hNPhLDc7A1fU1AryaKN7yUDPWRLrMGb422YB8cNkQvWjdrOaQBoXTF89 7tP+YN3n/PF9dsS6TgqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBjR-0000000CNUI-37kb; Wed, 14 Feb 2024 09:39:09 +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 1raBfF-0000000CKb1-2Kv6 for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 09:34:57 +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 1raBfB-0006BN-5F; Wed, 14 Feb 2024 10:34: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 1raBf6-000fI3-Ma; Wed, 14 Feb 2024 10:34:40 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1raBf6-004Y9v-1z; Wed, 14 Feb 2024 10:34:40 +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 v6 149/164] pwm: xilinx: Prepare removing pwm_chip from driver data Date: Wed, 14 Feb 2024 10:33:16 +0100 Message-ID: <738b9929c1d13bde64050f8bbc4ce8d85f58cc7a.1707900770.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=2515; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=0SYLkEACQ8T9AGYR57XhymGkN9/LFLhJpbaYpX97npw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlzIj2a6DGhXDiU1Z6aUiYCWWWQW9gEgMV3inMX qS/8CiV40CJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZcyI9gAKCRCPgPtYfRL+ Tn9BB/oCWEPoJqHqeucqUnA/H0dRS9PaYdQkNJvfa8bFh529CNuNG6EmxBMMDxr1vEH4TBW5OHv ae1T6JUTMThxqwufl7aTSCib+f4HO83gp5u23ZxkZGjmv9iuQ6BPFp4yF7MEIc0lrV2kRGt7btt 4kZM/IZF0Jc0+yxyGVsenhKA2zsKzvBxT9xV1yIVzOjMEJ0tSd9wyv/P8NTZiGyltL3fTSiDkn2 BDbG1dB272qKH4MekygiNmgE2jc8IheosgITEV6drW5YQ998xQ/TCmMv+X20iylqISHzP7yO3up 4yiuaFpqWSqbA5w5ql7M6ocKtTxF0W6jMQ3PgfFe2bncQADS 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_013449_833306_A7589A83 X-CRM114-Status: GOOD ( 14.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 driver for further changes that will drop struct pwm_chip chip from struct xilinx_pwm_device. Use the pwm_chip as driver data instead of the xilinx_pwm_device to get access to the pwm_chip in xilinx_pwm_remove() without using xilinx_pwm->chip. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-xilinx.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-xilinx.c b/drivers/pwm/pwm-xilinx.c index 5f3c2a6fed11..0ca79fe8c105 100644 --- a/drivers/pwm/pwm-xilinx.c +++ b/drivers/pwm/pwm-xilinx.c @@ -214,6 +214,7 @@ static int xilinx_pwm_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct xilinx_timer_priv *priv; + struct pwm_chip *chip; struct xilinx_pwm_device *xilinx_pwm; u32 pwm_cells, one_timer, width; void __iomem *regs; @@ -228,8 +229,9 @@ static int xilinx_pwm_probe(struct platform_device *pdev) 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 = &xilinx_pwm->chip; + platform_set_drvdata(pdev, chip); regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(regs)) @@ -278,10 +280,10 @@ 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->dev = dev; + chip->ops = &xilinx_pwm_ops; + chip->npwm = 1; + ret = pwmchip_add(chip); if (ret) { clk_rate_exclusive_put(priv->clk); clk_disable_unprepare(priv->clk); @@ -293,11 +295,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[] = {