From patchwork Wed Feb 14 09:32:46 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: 13556165 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 C31B4C48BEB for ; Wed, 14 Feb 2024 09:39:15 +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=V+thkesXqI0dA5OOVXHlFtrR1OqzOAQP4wTRFnDxIts=; b=Mym+qW333tsRaZ A/GQq9kxCamDC7whSy/jq8PBEuFlOiaitEC6Wv1PL8s6oyrgH/YvAOTaoj3UA1tY6CTuyE6UEdosE 6rNIZv1NfcDH9zwPAkafXPa1Vot/dYetf7KPczONZ05aFup0IRbJ/hTZNs0y751EK/BHpx0C56M4A M33QHgD3LBz0f7UvD05suoVQ+9OKoOaCCb449pAasbqVHkqZklgJqOMLgBnfXsfTMI/mMG45WL/rA 3l7GzfiTcJ/uqaztNSI6lO+Gxyc94OJLw5yLDPskCzsWEEn2mVYNAUW5Wn+TG9i/f2mXwi8/oKgvH vsiEDkXd2Dr8gzeAqusw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBjM-0000000CNRk-2Wx8; Wed, 14 Feb 2024 09:39: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 1raBfC-0000000CKVu-0WTG for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 09:34:54 +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-0005nZ-SR; Wed, 14 Feb 2024 10:34:39 +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 1raBf2-000fG6-57; Wed, 14 Feb 2024 10:34:36 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1raBf2-004Y7p-0H; Wed, 14 Feb 2024 10:34:36 +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 v6 119/164] pwm: stm32-lp: Prepare removing pwm_chip from driver data Date: Wed, 14 Feb 2024 10:32:46 +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=1932; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=DhwVfYK3PSVBUzZ2FBq5DeLipOrGjyXL7mQwfO9Ate8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlzIjTLu8CxBTkFi4qgs8ztGE1w3A0T1K4W9gN1 Cf6LJm4zEqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZcyI0wAKCRCPgPtYfRL+ TqylCACvPMxKFHFT15Jn4qEunBjFxMOoreUu6c1bQn0YeYAJE92+RJJrGaq/H5m8Y0oJXkRh2ah 0+tWpqd9Xo6AjXK/turnQ8KpIxTiPKZ0zIJBhKDCuXZ118TeLWjZ08AAvpm4FbtCyA3ehpVcQCr kLW4ZH/C1bcX15IpZ/LLZuiR8l9qokNWcYjWsQe76+6QxYDScfEBhbg2+tfsxN6YF2YAr6grLSK 2oqEdkFkyO9R4cYl+h5cdgo5vwWfA7SpxOEMAPQCY/Fp5RWPrxcXxIw41dr4+2twuCUAKnQD/BH zp1n2M7sNTgMEJrpoDvsmd429z1jC8PkbYGENujrDOBBC/hN 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_013446_443720_5C17C2BA 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 driver for further changes that will drop struct pwm_chip chip from struct stm32_pwm_lp. Use the pwm_chip as driver data instead of the stm32_pwm_lp to get access to the pwm_chip in stm32_pwm_lp_suspend() without using priv->chip. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-stm32-lp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index bbab6be314a8..b46d8193dd0f 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -197,6 +197,7 @@ static int stm32_pwm_lp_probe(struct platform_device *pdev) { struct stm32_lptimer *ddata = dev_get_drvdata(pdev->dev.parent); struct stm32_pwm_lp *priv; + struct pwm_chip *chip; int ret; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); @@ -205,28 +206,29 @@ static int stm32_pwm_lp_probe(struct platform_device *pdev) 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 = &priv->chip; + chip->dev = &pdev->dev; + chip->ops = &stm32_pwm_lp_ops; + chip->npwm = 1; - ret = devm_pwmchip_add(&pdev->dev, &priv->chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) return ret; - platform_set_drvdata(pdev, priv); + platform_set_drvdata(pdev, chip); return 0; } 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; }