Message ID | 59e5dfff2b878cc8590e286572672e4f10e35380.1707900770.git.u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 7B719C48BEC for <linux-arm-kernel@archiver.kernel.org>; Wed, 14 Feb 2024 09:41:50 +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=4sbVjWbRJrHfqlV6cjuGVdTv4Pvk470YcV+rnp+aDTE=; b=c5xjPO+e7hf/ew h5kMqEPiKot1Lc0KtZrsz57Q+E44zOzF/r30D3b+8ToamP0mqp9xoOP3zCfGz9wkUypeDqrurxhSe FOOI6zJRndqrXhflJey9AtCEX+RiNhHmzIDpgedds/jgzjhd3bermwhKAG8B1B/dQu5QK02V9gQP1 G7o+uIHfH6D/uBVziCFsZSDGxX0WcDxVYIi24Akk+x50p9KdkheyE7x19qcgGZ8xKvnbAFNv89unj gioIRu/kvVx7IM6WwNVvcqMmynJ6ewkIo/VKptFwOdIsi5OvrXpYbkg3pnlceDsM0dcGCceBQcn7B XB2mffKSsARyF7h/tY/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBlp-0000000CPT9-3qr4; Wed, 14 Feb 2024 09:41:37 +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 1raBfc-0000000CKxf-1WXn for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Feb 2024 09:35:12 +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=WMGtrrgp9CxLav1NK0/SfK+RJxkTjntNQJJwDIEQkUU=; b=E8vWUK8j865DkCPAF/rIy7t3i5 7NTyseo6u8OAdlpBDKLl9/+xJKH2nlgBpFWPCqxcub9j+WnDK7AqJ3v+nupuyfw1yu84JsNUjYZTJ 1zajFdmF/p5H336036Bo6icpIQy/njZg8q2cdQdB0e5E9sDeenpZvvqC5sIho9NrIVWxevQj0IeCQ C87O3DwDMciiTr4nSutkQRtEqB64caSQIv9jyru4jRVA/ChcrTUgjv0Ia8EZ8Ma+qzfrMHcPS0sTF 6LHSS4mAh1NbM4DnsGtVhqFPXZuxQpO0AU7lMItpL/DGIA7lZYYEtppeYSGHmu9rKKte6qEf5c2uV KVfBsDFA==; 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 1raBfS-0000000GDlE-43wi for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 09:35:11 +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 <ukl@pengutronix.de>) id 1raBf5-0005mH-Id; 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 <ukl@pengutronix.de>) id 1raBf1-000fFz-TE; Wed, 14 Feb 2024 10:34:35 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from <ukl@pengutronix.de>) id 1raBf1-004Y7h-2c; Wed, 14 Feb 2024 10:34:35 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> To: Fabrice Gasnier <fabrice.gasnier@foss.st.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, 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 117/164] pwm: stm32: Make use of devm_pwmchip_alloc() function Date: Wed, 14 Feb 2024 10:32:44 +0100 Message-ID: <59e5dfff2b878cc8590e286572672e4f10e35380.1707900770.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <cover.1707900770.git.u.kleine-koenig@pengutronix.de> References: <cover.1707900770.git.u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2070; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=T/U7wQnCa/nBPtaaTnKA2tY72R4dDiZtK4LWdIBSJd4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlzIjRsLdl8HTUa9tf6qIs+zvnxTpj//AqG0X++ ldOrCB7T1eJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZcyI0QAKCRCPgPtYfRL+ Tu6/B/477D5/A7oJB9f/BCRHZQWbXLL6oXepDfsU47gcf24GXzWckRUa2n8Rqdd/N4URAzUpcng QoWNKG5EiIW/stnDW/Fr9WxNS+3kZw4quDzkWcw+aosSTnstAtrM8uI1gQdxfEy6aWOuhuQnS0S X1xBRUp9v2dVbkizu0+a0AAOrbtrVgh2rMLKXiDWhTYbKz6xHdZnlnNf3HLdCXkpxK96WQWJeJ/ ozDH2tVMAE52haznrJX5TZ6pbjP/ScQoKzLEl2AjJfNXu6U7ma8ohFQa2H/l9Eu0mjDCN3jpiV1 eOORhbGtaT96LiRrSk8FkgoUtiZWGOArvSlrqsow37mhdCpm 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_512972_F744201A X-CRM114-Status: GOOD ( 12.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
[v6,001/164] pwm: Provide an inline function to get the parent device of a given chip
|
expand
|
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c index 1440b706ee57..0c028d17c075 100644 --- a/drivers/pwm/pwm-stm32.c +++ b/drivers/pwm/pwm-stm32.c @@ -27,7 +27,6 @@ struct stm32_breakinput { }; struct stm32_pwm { - struct pwm_chip chip; struct mutex lock; /* protect pwm config/enable */ struct clk *clk; struct regmap *regmap; @@ -40,7 +39,7 @@ struct stm32_pwm { static inline struct stm32_pwm *to_stm32_pwm_dev(struct pwm_chip *chip) { - return container_of(chip, struct stm32_pwm, chip); + return pwmchip_get_drvdata(chip); } static u32 active_channels(struct stm32_pwm *dev) @@ -632,14 +631,16 @@ static int stm32_pwm_probe(struct platform_device *pdev) struct stm32_timers *ddata = dev_get_drvdata(pdev->dev.parent); struct pwm_chip *chip; struct stm32_pwm *priv; - unsigned int num_enabled; + unsigned int npwm, num_enabled; unsigned int i; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - chip = &priv->chip; + npwm = stm32_pwm_detect_channels(ddata->regmap, &num_enabled); + + chip = devm_pwmchip_alloc(dev, npwm, sizeof(*priv)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + priv = to_stm32_pwm_dev(chip); mutex_init(&priv->lock); priv->regmap = ddata->regmap; @@ -655,9 +656,7 @@ static int stm32_pwm_probe(struct platform_device *pdev) stm32_pwm_detect_complementary(priv); - chip->dev = dev; chip->ops = &stm32pwm_ops; - chip->npwm = stm32_pwm_detect_channels(ddata->regmap, &num_enabled); /* Initialize clock refcount to number of enabled PWM channels. */ for (i = 0; i < num_enabled; i++)
This prepares the pwm-stm32 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 <u.kleine-koenig@pengutronix.de> --- drivers/pwm/pwm-stm32.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)