From patchwork Wed Feb 14 09:32:28 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: 13556197 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 7511EC48BEB for ; Wed, 14 Feb 2024 09:39:51 +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=ba8l98zKxUE4yuk0xWBID5D9soHUYx0Dvt8ijamq4rk=; b=WbJSppxqz/ERYR iSDkxnEVjrLzoo8WqDiSRJQGDBRztNGZA3MBRkzDO2JaiAMge15SJVAL3KCrWTkSN5A4lZyvIPiCy rK1vq+Q8qaih724spEmhOFpJh8DGmOYrK8tG4u3UnDimxoWi6HWd7l8rCLRgXArF8giYjFD8mGYtZ 4k1T/WubHeTh4Nxchdi6znF+NGDa2L7E5LLiV5Z2T7E3ILX/Hx4DVlBCqxcfo6szmMskDQETmt3xX D8ekiOsXRhTEzMaeVtteFGfiuQhGxu/l4mEQMDhE2sp4DbdatXb6ppMapGvGT2dbrf26GdZDXXVri Na8xC3vIMWdDKNObTNWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBjt-0000000CNvO-2Cbq; Wed, 14 Feb 2024 09:39:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBfW-0000000CKuL-1kYK for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Feb 2024 09:35:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=4Y9wguz1rEYWXMAPI+RD8FD3INg1KWlyLC5Z+IETRHM=; b=g3FQFKs6e7fNd3+NeK8X+3zUv1 jr+sVPSpRVZ2B2y0PeJXH8J/mv1F9mGVBrxr+lrq9yHNJNIQBXRo7NFRF5j5KhdCsH4sxEW27U8RF /TmDtt6D9Y9elLrsaKcrws4rdyj0uzDPi7igiXoUwmf0YRm9Rj0kiKt42ka2L6ir2b8OFF4vIpSxm SVS+uZWlLB4DcgOYbIFXJKclaNskTUA3o08P1VwNAPDLXDBbq0p4snok+6+mBPO+KRnwqsaNEUHkU 0EMBIBYVu+Lqd9R25dOZrrGzGF+yW7Ra75eMR3bA6K6igLYepfcclcTaGsnDVwryUMUrnXEUdK0AR W7RcHHAA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBfD-0000000GAXB-3pkO for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 09:35:02 +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 1raBf2-0005X3-Ha; Wed, 14 Feb 2024 10:34:36 +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 1raBez-000fF1-DI; Wed, 14 Feb 2024 10:34:33 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1raBez-004Y6f-14; Wed, 14 Feb 2024 10:34:33 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski , linux-pwm@vger.kernel.org Cc: Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v6 101/164] pwm: samsung: Make use of devm_pwmchip_alloc() function Date: Wed, 14 Feb 2024 10:32:28 +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=2108; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=L2fP/40Abfd2uvbzxxaCl1aJUDUo3oBsL6xZcwUm+2w=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlzIi/e7UAi6YnGdZM63g1kB7xY5zzYA/9MCiLs qcEG9PGLFWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZcyIvwAKCRCPgPtYfRL+ Tt6uCACPyWp3rurpxUbYuN/g8JHDaC1Vl08KyFrb62bjxltlTf/39f706K/2jtSvH9JJmOWQY9s d/JbO2xwE/+kQgdAzHRq7cKgd35llxalGb9EnnjjF5uCVisi8lvyxDCoEh2u0gZLDZN1MyAC9mZ tdPWltTiSjjusA9CTvaqlifwLrbMYLFHYDY9r6fxa2EfuuYMKHEe5B3cSL6KJrxtyC4d1+YKg37 bJtZikaRpPZlgoOX9T1gL6SZ1sWJDgCMFwH0FJbn8zEADmgfyI1VpRnSRP8h+z6HBIhgW5tFKt5 OmKJ6Z+n8ySR2wSqYp0mElum6sud+xIHBMQE6/fqrog4XPo4 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_093448_555525_61BEE537 X-CRM114-Status: GOOD ( 14.33 ) 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 pwm-samsung 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 --- drivers/pwm/pwm-samsung.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index d3dc9b5b80d6..efb60c9f0cb3 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -69,7 +69,6 @@ struct samsung_pwm_channel { /** * struct samsung_pwm_chip - private data of PWM chip - * @chip: generic PWM chip * @variant: local copy of hardware variant data * @inverter_mask: inverter status for all channels - one bit per channel * @disabled_mask: disabled status for all channels - one bit per channel @@ -80,7 +79,6 @@ struct samsung_pwm_channel { * @channel: per channel driver data */ struct samsung_pwm_chip { - struct pwm_chip chip; struct samsung_pwm_variant variant; u8 inverter_mask; u8 disabled_mask; @@ -110,7 +108,7 @@ static DEFINE_SPINLOCK(samsung_pwm_lock); static inline struct samsung_pwm_chip *to_samsung_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct samsung_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static inline unsigned int to_tcon_channel(unsigned int channel) @@ -549,14 +547,12 @@ static int pwm_samsung_probe(struct platform_device *pdev) unsigned int chan; int ret; - our_chip = devm_kzalloc(&pdev->dev, sizeof(*our_chip), GFP_KERNEL); - if (our_chip == NULL) - return -ENOMEM; + chip = devm_pwmchip_alloc(&pdev->dev, SAMSUNG_PWM_NUM, sizeof(*our_chip)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + our_chip = to_samsung_pwm_chip(chip); - chip = &our_chip->chip; - chip->dev = &pdev->dev; chip->ops = &pwm_samsung_ops; - chip->npwm = SAMSUNG_PWM_NUM; our_chip->inverter_mask = BIT(SAMSUNG_PWM_NUM) - 1; if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {