From patchwork Mon Jan 29 08:56:25 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: 13535251 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 2DD0DC47DA9 for ; Mon, 29 Jan 2024 08:56: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: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:In-Reply-To:References: List-Owner; bh=2hHDJgm2CPO8vxsGoBXzyp1XC0rLDT7TkFVPeiSg3eo=; b=sb6EtoF44wX46K 4jVO6ePlRbvSJVZUApzhu4cwbIkDYzQfYSel8pndf6FX43gnOv7BeWqgCX6YrJyvGw+AX11ensRCL vrrC8NYfnrb7wy0WVbvbF3n1Ttiiov+QVJdhq1+QfK94NxGcJQLSyEPnDku1dhk0Ox2U18y0ZpClE j5YOGaspEGIDQlPQqXXboYOAtG+CeK/RcmiWZ6hKVrkozwcin1EQ/eWKspqYTUAMKmCsI+tdZ1vpY Av9MVltxIjDVn7GLPTMmCaXmSqLaY/BDTBPB1WGPkmMnZfW0Lh0J3fFLlTheBH2KuMz9VSVgUta/N QYpD+U2YUr2lR5De8XpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUNRV-0000000BtfF-06Z0; Mon, 29 Jan 2024 08:56:37 +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 1rUNRT-0000000Btdt-0LcG for linux-arm-kernel@lists.infradead.org; Mon, 29 Jan 2024 08:56:36 +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 1rUNRP-00025t-D5; Mon, 29 Jan 2024 09:56:31 +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 1rUNRO-00381G-Fj; Mon, 29 Jan 2024 09:56:30 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rUNRO-00Ak4t-1H; Mon, 29 Jan 2024 09:56:30 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Claudiu Beznea , Nicolas Ferre , Alexandre Belloni Cc: linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH] pwm: atmel: Don't use pwm consumer API Date: Mon, 29 Jan 2024 09:56:25 +0100 Message-ID: <20240129085627.2386470-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2007; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=JHogV1trNXAXd7KQiAOevqso4YRtz3t2b9NmFznYtGk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlt2g74GFyPCTtWB/ohcWS27hDSdZBbmGSsC8Kg xE/aBX1ZDCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbdoOwAKCRCPgPtYfRL+ Til8CAC3Y3MGZLlsJCB0Huk4NCSnFKJtk2BVRbqC9NuklecvhAmuVhzUKC1lwWN5HEJ2kUDWYtu Nt+5V6Epb+yzfKSY1Q7g1tl1yFMoB2mSj66ESVnG5PASUGC50O0C8cvbchASq5XfwODnbCWG417 4HA85oFfubvYsG0Qn9iTSF3ltlAj1E+myVU833Q4YLn6u8poZIIJQRlsLorFdDAlOyzy4MBs3uV 89FC0aur9bKdeMC8BI0VQLf+fi1A0Q9T3Ex1p93Q9wu24Uy5ffHQ4ZYEuLYMavly2ZZrgubU+CW ydR/igSO1tZGhWA6RN34YGM7u1wa5Ai7hj45kbuVc3HwC0Aq 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-20240129_005635_160982_20D60161 X-CRM114-Status: GOOD ( 12.68 ) 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 Lowlevel driver callbacks are not supposed to use the consumer API functions. Currently this works, but with the upcoming locking changes this probably results in dead locks. Signed-off-by: Uwe Kleine-König Reviewed-by: Claudiu Beznea --- drivers/pwm/pwm-atmel.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index 47bcc8a3bf9d..26573829e391 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c @@ -294,19 +294,16 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state) { struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip); - struct pwm_state cstate; unsigned long cprd, cdty; u32 pres, val; int ret; - pwm_get_state(pwm, &cstate); - if (state->enabled) { unsigned long clkrate = clk_get_rate(atmel_pwm->clk); - if (cstate.enabled && - cstate.polarity == state->polarity && - cstate.period == state->period) { + if (pwm->state.enabled && + pwm->state.polarity == state->polarity && + pwm->state.period == state->period) { u32 cmr = atmel_pwm_ch_readl(atmel_pwm, pwm->hwpwm, PWM_CMR); cprd = atmel_pwm_ch_readl(atmel_pwm, pwm->hwpwm, @@ -328,7 +325,7 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, atmel_pwm_calculate_cdty(state, clkrate, cprd, pres, &cdty); - if (cstate.enabled) { + if (pwm->state.enabled) { atmel_pwm_disable(chip, pwm, false); } else { ret = clk_enable(atmel_pwm->clk); @@ -348,7 +345,7 @@ static int atmel_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWM_CMR, val); atmel_pwm_set_cprd_cdty(chip, pwm, cprd, cdty); atmel_pwm_writel(atmel_pwm, PWM_ENA, 1 << pwm->hwpwm); - } else if (cstate.enabled) { + } else if (pwm->state.enabled) { atmel_pwm_disable(chip, pwm, true); }