From patchwork Wed Feb 14 09:32:26 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: 13556168 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 61527C48BC4 for ; Wed, 14 Feb 2024 09:39:19 +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=kGl6BDW33kzyhERGbRtmFPBUpRwmp+0S6nQ7w/vPiSQ=; b=hzCNSfdtmPbCNq h6ZNpS7Hc/ZhFNRmG1KjpSH3z7Oul7n2PHqF947REDCbn5T/Yh6dm6w2zgsKn4Siwex2ppUselcA6 3ay3zM3wlVBMO6V4MFIVAyReJwhAghHdfNapYja5EL5xKHfQEJALnIKaaS2pWrhzDRX6crn0Qy95W fNijsEwPJWU5FkPM/hBDuZf1Ajk0XldAN4AvVF2Bi3Lj1c1o3h1rLwmypjwLA5qZIQHr3R01dqJKV vTvrgKPVMLadDKcyS6zAR+GGZ3t8UE9u4I4rEgycNCHgID/5ha2ZljCX5TNpg5fSZMmbCykhgA2OT IHLASuEeIFSi9OHn9qsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raBjO-0000000CNSm-0m3o; Wed, 14 Feb 2024 09:39:06 +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 1raBfL-0000000CKfr-06ga for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Feb 2024 09:34:55 +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=y91g4yI4rseGyKyD7ymZrjgxRrLB8caOVwuH2Bejqcc=; b=ha0P5sp63Ezcsi1TQgxoxcNhOg +7qQGTvJY9H3AS8ZRmI0a43srnhiQpgIOMbe2GFVp/5bwTRSRhXm0IT9cCMJbO1X99Q2VBEXH1PZj D6EIJLV9743G9yX7KlKXXtCpjw3UcDl/b1h7iyGFlPovXZEpmIgrYLWM74qlkWW6QGzMUdoE60pQU Peu2wCLtTYXMqHM/gwe6/OgaAP2phx0ycNOWEZWVRDD0BWrC+6puXC5HJBfYAKNSjcfndIugI+DqZ Axd6+Amqk3/wHaVapcLF6/KzvPA3DWsHyGkPq+BPXbyDOtKwhxA+6sunLphQ8ffdvp+ZGQmYVSsk4 jmACPejg==; 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 1raBfE-0000000GAXF-00GO for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 09:34:53 +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-0005V0-5E; 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-000fEs-3E; 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-004Y6N-04; 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 099/164] pwm: samsung: Simplify by using devm functions in probe Date: Wed, 14 Feb 2024 10:32:26 +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=2301; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=3v6X/rsxer0vDPK7DKg5bXut2iQNblBHiv/m7ZhnHuY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlzIi9JgUZ1qPpDDBkOWLudUXKLXy1s3CQlmeMd X1eK4wZ7P6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZcyIvQAKCRCPgPtYfRL+ TkDECACOQhL3yH4vO+rA5qPmJEOOHzv6MLKcO3Cvdj6aq+DSb+1yq9+x16z5AuhgyzgFUmopefY DAnN7FxMHjLrX+KCzhiBhErdQkB4CM8Qr1jmLq/4914ZQ/USoTzx00oI112ko5qPHbJkMku0KzW LY6w40l5kgP4WL8voUyTrnF6sR1lYgftUaG7HmPxA1CEv+q6iGBMN5EyLezxjIyaVYlETWZ8m4S odZMZEN+bgvH6qt9njfe1Kuu1UOkd5iP+KnMNSo5mWNZYGwXQSjd4HRzUgSVFXr2484m5alH+iS tmhQVfVvAPgmBG9OGQNIzT1vjd6YKDI10vL92/Ip3Pfe0d2V 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_696522_74E31C48 X-CRM114-Status: GOOD ( 14.54 ) 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 With using devm_clk_get_enabled() and devm_pwmchip_add() the .remove_new() callback can be dropped and an error path in .probe() simplified. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-samsung.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index cabdcdf37ec9..81a2e66e927e 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -577,18 +577,12 @@ static int pwm_samsung_probe(struct platform_device *pdev) if (IS_ERR(our_chip->base)) return PTR_ERR(our_chip->base); - our_chip->base_clk = devm_clk_get(&pdev->dev, "timers"); + our_chip->base_clk = devm_clk_get_enabled(&pdev->dev, "timers"); if (IS_ERR(our_chip->base_clk)) { dev_err(dev, "failed to get timer base clk\n"); return PTR_ERR(our_chip->base_clk); } - ret = clk_prepare_enable(our_chip->base_clk); - if (ret < 0) { - dev_err(dev, "failed to enable base clock\n"); - return ret; - } - for (chan = 0; chan < SAMSUNG_PWM_NUM; ++chan) if (our_chip->variant.output_mask & BIT(chan)) pwm_samsung_set_invert(our_chip, chan, true); @@ -599,10 +593,9 @@ static int pwm_samsung_probe(struct platform_device *pdev) platform_set_drvdata(pdev, chip); - ret = pwmchip_add(chip); + ret = devm_pwmchip_add(&pdev->dev, chip); if (ret < 0) { dev_err(dev, "failed to register PWM chip\n"); - clk_disable_unprepare(our_chip->base_clk); return ret; } @@ -614,16 +607,6 @@ static int pwm_samsung_probe(struct platform_device *pdev) return 0; } -static void pwm_samsung_remove(struct platform_device *pdev) -{ - struct pwm_chip *chip = platform_get_drvdata(pdev); - struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); - - pwmchip_remove(chip); - - clk_disable_unprepare(our_chip->base_clk); -} - static int pwm_samsung_resume(struct device *dev) { struct pwm_chip *chip = dev_get_drvdata(dev); @@ -666,7 +649,6 @@ static struct platform_driver pwm_samsung_driver = { .of_match_table = of_match_ptr(samsung_pwm_matches), }, .probe = pwm_samsung_probe, - .remove_new = pwm_samsung_remove, }; module_platform_driver(pwm_samsung_driver);