From patchwork Wed Feb 14 09:32: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: 13556206 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 A86F9C48BEC for ; Wed, 14 Feb 2024 09:40:41 +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=nLvr9nbQWt7Q2kihdKMCM/gMKMbxJhBzoB/NAukT1oc=; b=I9BjAc3lu87dFo omfthnjITvKs0U4GscHp8aASJTG8J+M9iJfImqth24us2Bws8gjlvUXdRtjLNF3PL6Rl7fFHxfW0Z MKF2YdtbIdM7KrIUuluOx1brne0BTWZt2qAkDsiQayltlVFzu1CWHN9CYTVpRMevTShzwejLubBbc AXlVHwpKvb81LfokT2DDDuvlp+DBMLodaZTMppGBVxeOZN9yVQT79EhHtZ4U3M1aQg5Uvw43MG0gT 9O6G3nJRBV0ka2eF2MlWCu8oS2LM+6f0UNT9TkgKnb2nDqRtrIlme9j4EPPuPfLyk8ihsDbGFMugX Do2AhRa8FLPPp+XWu7CQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBkf-0000000COYT-1675; Wed, 14 Feb 2024 09:40: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 1raBfd-0000000CKyS-2bCb for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Feb 2024 09:35:13 +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=zgOKZ/SykLTdsPsKzcInfEDlQAdgI/56cAnEEkumn3k=; b=Ey5Pv4xb4GFfyRB8jaBg/OHoJd PrQ66cPPX4H6UNJZjzsCMNLVrmXeSLG2MDwArSQJ3JCzSYNzoWCS5GoAv+tk/MEpPHgva4cUadyQW GpBuMymZRRHhEsCA22h6Q84DafLx7G9rQWN+YheQzdaQ7OsfWwdTgxDuatIw4jC5u1MoFTjQqdyXN fJWFUwYvbtyHcPUR+RtTMFL8jkKEYL70Sw11e9fezZf8Epn+A15QkqT3PzWYOJpjVloGsRqbITmly MgOqvHbLVRDmZ6WdPnFeK7KL3kd8sHsn4k1sXS/lXiFvoChG/KzNIVHFZ8ERRoBP+V35Pp+FUvLAJ iWOKiuhw==; 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 1raBfT-0000000GDl5-0CW0 for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 09:35: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 1raBf5-0005st-Vy; Wed, 14 Feb 2024 10:34:40 +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 1raBf3-000fGT-3o; Wed, 14 Feb 2024 10:34:37 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1raBf3-004Y8D-08; Wed, 14 Feb 2024 10:34:37 +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 v6 125/164] pwm: sun4i: Prepare removing pwm_chip from driver data Date: Wed, 14 Feb 2024 10:32:52 +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=2191; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=AueSBh20l+IvmTnMku/uAxXaCwl5AScvfIDtGYeyXxg=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlzIjaRcrH/Di3kXiX+2H/62isgprTTbchcjoRV XNyA2Z72KSJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZcyI2gAKCRCPgPtYfRL+ Tk7uCACQKU8wijfW5XTvrUoBIFZpXyJP4eFodXHJNx5MUXhZp+D7toClZKgb7XRdVgCsbAxnLdn CzEnmZTpm3beiNytFEAkZnC33LdIMo/sh7PWQ7Zeo1hmcL2/SOE926dzq+2vJWR7fTgHBziHF6x oGb80w8h9qONuV7o3QKZqL4eSsgw3jZs7ou3Yxo8QG3TYD8XJmAeNWN2QUyY78TrR0RCx3u9Ubm GIqlxCc409hLFN8CPQnVWqLnRGhCVU6AIDUkYN13tc0YB0yg0MKtZaUVvh5JfgVcbCjgTUWJQ1Z +UFDKwc14laD4XSymg32R/GWoUJidJ00KG4Tk3FQE3aW5P89 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_093504_537533_B6272474 X-CRM114-Status: GOOD ( 12.53 ) 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 sun4i_pwm_chip. Use the pwm_chip as driver data instead of the sun4i_pwm_chip to get access to the pwm_chip in sun4i_pwm_remove() without using sun4ichip->chip. Signed-off-by: Uwe Kleine-König Reviewed-by: Jernej Skrabec --- drivers/pwm/pwm-sun4i.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 44edf1ce5739..c2f579043915 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -384,12 +384,14 @@ 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; int ret; sun4ichip = devm_kzalloc(&pdev->dev, sizeof(*sun4ichip), GFP_KERNEL); if (!sun4ichip) return -ENOMEM; + chip = &sun4ichip->chip; sun4ichip->data = of_device_get_match_data(&pdev->dev); if (!sun4ichip->data) @@ -451,19 +453,19 @@ 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->dev = &pdev->dev; + 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 +479,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);