Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3924262ybh; Tue, 17 Mar 2020 09:00:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsxg8pmI/O9GjUHynlLd1+fATJkFFbfJsD8M/+IIneRRcsUFWOFdJ1MsvmDr7p9heEJIyMU X-Received: by 2002:aca:bd46:: with SMTP id n67mr16283oif.120.1584460844506; Tue, 17 Mar 2020 09:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584460844; cv=none; d=google.com; s=arc-20160816; b=oUQPaGNbIagEWDsKn1O6Ljv1/jO6V6ZwpbJ467adoKyaMVjEJdeGVxAp3a9EpaYOg4 deVJWpip5aJ7KU1unehBvoKvqxhi2OJjjnUYCFu0TXJJ3Tx2yhB3mlZ8GR1UTST9RCZG Xk1PJek04dJdA/eIqOEpCrxUTTKltbeQOL8JAE7OxVddCEXRpSTS7sU6pR2hB7F+Urbq K4ymAzmftVG3MNW8rSu5hff1XWYkvJLzSMo70jgiOa4OnHamk4Zx6GuZ1KGqkP7UEngY hxcmupzazo4TObxjOZxzl7RSfOg8QSDHUb92ABNU4rxWGxUuKL2FVvrqPrCv3+aCEnub JE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nbuCrokfZgS+KDFkBtlQ837IpeveIBjp9cmu5UpyyK8=; b=vDfa7A0L0qBzZ/yWWbFcRNGF+s8vUaEs9zp8XVRTo5JbqF7hBBgFqlUXV1bnK9+RPt 3+uMEsWxFI4YBk96V57YUlJ55Tqf+VqSexbvPqgxTjW7sIUGYFAhkokzQ3P+KqOcCVgo zycf+L6dsY8SiiuB65diA8sALEsR2Kwn7X3GMryot5ipE1inzj48bBrB1thb0x31sJjy WA+OuxZuMwHTQFOlogfliZ7bN6fNIZrmkqX3bKaF43p6/CWMK6gB5seEy0PtPVtl9f+2 2HLN17ke/Kpb2oW46rXqQ1m2LjhFRa0pyIc96v4G/ExoIp1vr4V4x9r227PLiLvE7JTy Cppw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pascalroeleven.nl header.s=x header.b=OAGrX5m0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=pascalroeleven.nl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l13si1788685oib.268.2020.03.17.09.00.24; Tue, 17 Mar 2020 09:00:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@pascalroeleven.nl header.s=x header.b=OAGrX5m0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=pascalroeleven.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbgCQQAA (ORCPT + 99 others); Tue, 17 Mar 2020 12:00:00 -0400 Received: from web0081.zxcs.nl ([185.104.29.10]:54686 "EHLO web0081.zxcs.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbgCQP77 (ORCPT ); Tue, 17 Mar 2020 11:59:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pascalroeleven.nl; s=x; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nbuCrokfZgS+KDFkBtlQ837IpeveIBjp9cmu5UpyyK8=; b=OAGrX5m0ORyGc9okH++QCW9zWp W/38mXJ2gySBtgFpVftPBORd/kDiYnWv35ifBGNgseKqnMztsVoIRbn5Yr5trMmBiBQa1w6ujGiEo QijEEwoNuJKSWJ6kYz4+ogkD6P8s/18m4jkexWnPP6yWczWbtPrtK3aCBsYhHvk+xsHIqgOBO+ln3 D5yOXQh6n6BxiMtSBfTAj5Pp9Vq6900Eu8/Xk4ngkFfMY9wdY4kJDiKjCujemfuO5DG401/ph+mzl rT7IRq1hgxCrVMYLXah730Vzvfn0YTJz09RXfGcwIj2Y9YckShiyEYGtK8xcvcRrrGMSRrhLiVJ15 tZiX8PqA==; Received: from ip565b1bc7.direct-adsl.nl ([86.91.27.199]:60802 helo=localhost.localdomain) by web0081.zxcs.nl with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) (envelope-from ) id 1jEEdG-001IGT-MA; Tue, 17 Mar 2020 16:59:54 +0100 From: Pascal Roeleven To: Thierry Reding , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Maxime Ripard , Chen-Yu Tsai , Philipp Zabel , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linux-sunxi@googlegroups.com, Pascal Roeleven Subject: [RFC PATCH 1/4] pwm: sun4i: Remove redundant needs_delay Date: Tue, 17 Mar 2020 16:59:03 +0100 Message-Id: <20200317155906.31288-2-dev@pascalroeleven.nl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200317155906.31288-1-dev@pascalroeleven.nl> References: <20200317155906.31288-1-dev@pascalroeleven.nl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: dev@pascalroeleven.nl Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'needs_delay' does now always evaluate to true, so remove all occurrences. Signed-off-by: Pascal Roeleven --- drivers/pwm/pwm-sun4i.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 3e3efa6c7..5c677c563 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -90,7 +90,6 @@ struct sun4i_pwm_chip { spinlock_t ctrl_lock; const struct sun4i_pwm_data *data; unsigned long next_period[2]; - bool needs_delay[2]; }; static inline struct sun4i_pwm_chip *to_sun4i_pwm_chip(struct pwm_chip *chip) @@ -287,7 +286,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm)); sun4i_pwm->next_period[pwm->hwpwm] = jiffies + usecs_to_jiffies(cstate.period / 1000 + 1); - sun4i_pwm->needs_delay[pwm->hwpwm] = true; if (state->polarity != PWM_POLARITY_NORMAL) ctrl &= ~BIT_CH(PWM_ACT_STATE, pwm->hwpwm); @@ -298,7 +296,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, if (state->enabled) { ctrl |= BIT_CH(PWM_EN, pwm->hwpwm); - } else if (!sun4i_pwm->needs_delay[pwm->hwpwm]) { + } else { ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm); ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm); } @@ -310,15 +308,9 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, if (state->enabled) return 0; - if (!sun4i_pwm->needs_delay[pwm->hwpwm]) { - clk_disable_unprepare(sun4i_pwm->clk); - return 0; - } - /* We need a full period to elapse before disabling the channel. */ now = jiffies; - if (sun4i_pwm->needs_delay[pwm->hwpwm] && - time_before(now, sun4i_pwm->next_period[pwm->hwpwm])) { + if (time_before(now, sun4i_pwm->next_period[pwm->hwpwm])) { delay_us = jiffies_to_usecs(sun4i_pwm->next_period[pwm->hwpwm] - now); if ((delay_us / 500) > MAX_UDELAY_MS) @@ -326,7 +318,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, else usleep_range(delay_us, delay_us * 2); } - sun4i_pwm->needs_delay[pwm->hwpwm] = false; spin_lock(&sun4i_pwm->ctrl_lock); ctrl = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG); -- 2.20.1