From patchwork Thu May 4 05:35:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13230782 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 7FEE8C77B78 for ; Thu, 4 May 2023 05:37:14 +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:Subject:From:Cc:To:MIME-Version:Date: Message-ID: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=ISZxOiCwzjc8jVz2XInSimLJUBHNJJG84tEqbWfE+hY=; b=1MEoEEQT05iLEL sxy3A5uGnsti9xLyFEcnoO3KR1sdKw3Z40L2hj8mfNN9wEwuDaUVqfOYTK9HMwyk8syOHbRKhmFjL f8QZcpa+Cts9a8sKb9BvsNlKTyr24nXI9pdIcAnpnK/5qByXkCl6Ye5yrpbhgf6d70cYXJ2Nvy2cG j4yBJ45/jedlzFAWoO/qGFq+FLD4bVN/Wu44r4ZuhXoR2lUxNE13XOR24R3MJyi3nslzbGW7gbrU+ QU+usY1Ot16GF2syqp7eZi0DmNJPOruEr1U0bVnOd3qjqi4C7ifufFr84gBoD0ZT1d6s1DkQOA4tr Z34AaZCinU9VwWNazkrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1puRdM-006ek0-14; Thu, 04 May 2023 05:36:04 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1puRdK-006ejJ-0J; Thu, 04 May 2023 05:36:03 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9619095f479so4638966b.1; Wed, 03 May 2023 22:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683178559; x=1685770559; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=2B0t5YGI0IKM6eJmALhq9Gwt5nHb+W20+Of1xihS5tU=; b=CwILioX0YQcUeq9+Eli1Hmp2zaY8kTSpsMSQhAfhkU+sNv5U947J2jYAg6jqzFl4d/ ZTRAhIsGHAR0UYT2ym2Lf3L6sP3R9RUE0485DEr9p7vgRL+u71GLkZx+aCCCi5CJaywS 1KcbB+QYRBDqBUeOYZc30PMXEi0pJORquK9u7wTzQuuKXwOsEGb6nQQxU7lyLWizXw+C n4ixejUlzJp576TWcpb1xBKLxu4ZxEzmPnUB7HcgTishIGyHWFDFD6hxaqruxeINe945 LAiPzlsalTFyrPhfmtLDHhhuxr1+bpVHS3gvGj5HJA4JHA10ld3fK0NZfdOv2jN0DpcK hs2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683178559; x=1685770559; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2B0t5YGI0IKM6eJmALhq9Gwt5nHb+W20+Of1xihS5tU=; b=WhV43bJky/c1ZvZAAysFrVSpHwTQBM40Jqs/so0qO9OFaolwtz4I4h7U2DCWBh1u62 D2JQrvCM/3JAzIkW2tFjTaJkJJe1qQzMVjX34loRVqViU+lSCaiTtKS6PiQFXXpl7IGq kdGdOeayW7t6bUrLJj3QMnUmpooI9zWSLyTQ2x/m+uttjugs2fgnhkEU9AT/yOHP1GbZ xpJCD7ULrYpO3/TsoxFvK92CmRRjB3fN/0r3pZjCGfEFyjeQiYiy7vFYkSouVR+ofiI7 a3BvJo+A6jtNy88p7NujK7sKP1tHugd4tYls30SmscOvjDj+huC7vca9D+on4SN8i50H pB0Q== X-Gm-Message-State: AC+VfDxcmQjkw833J22tS9PQDSMa0+vec4LuxVMgltMQSkAxigFdwekg e6zR22/CaC821OucpBfV9iM= X-Google-Smtp-Source: ACHHUZ5FtRAYDi71Gl+BLlzVhBBkGmjcV75ZWWjXELJJn89EBnz0Q1Ap2oGatIcuHtImFMJU5FLkPA== X-Received: by 2002:a17:907:70b:b0:94f:296d:75d0 with SMTP id xb11-20020a170907070b00b0094f296d75d0mr5134611ejb.30.1683178559131; Wed, 03 May 2023 22:35:59 -0700 (PDT) Received: from ?IPV6:2a01:c22:77ba:7e00:1ea:4329:c109:e987? (dynamic-2a01-0c22-77ba-7e00-01ea-4329-c109-e987.c22.pool.telefonica.de. [2a01:c22:77ba:7e00:1ea:4329:c109:e987]) by smtp.googlemail.com with ESMTPSA id sb21-20020a170906edd500b0094f4d2d81d9sm18226897ejb.94.2023.05.03.22.35.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 May 2023 22:35:58 -0700 (PDT) Message-ID: Date: Thu, 4 May 2023 07:35:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Jerome Brunet , Martin Blumenstingl , Neil Armstrong , Kevin Hilman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , "thierry.reding@gmail.com" Cc: "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , linux-pwm@vger.kernel.org From: Heiner Kallweit Subject: [PATCH] pwm: pwm-meson: remove not needed check in meson_pwm_calc X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230503_223602_140918_C70ED467 X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. 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 duty <= period implies that duty_cnt <= cnt. We verified before that cnt <= 0xffff, therefore we can omit the check here. Suggested-by: Uwe Kleine-König Signed-off-by: Heiner Kallweit Reviewed-by: Uwe Kleine-König --- Note: Applies only after "pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX" --- drivers/pwm/pwm-meson.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 33107204a..aad4a0ed3 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -204,12 +204,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, channel->hi = 0; channel->lo = cnt; } else { - /* Then check is we can have the duty with the same pre_div */ duty_cnt = div64_u64(fin_freq * duty, NSEC_PER_SEC * (pre_div + 1)); - if (duty_cnt > 0xffff) { - dev_err(meson->chip.dev, "unable to get duty cycle\n"); - return -EINVAL; - } dev_dbg(meson->chip.dev, "duty=%llu pre_div=%u duty_cnt=%u\n", duty, pre_div, duty_cnt);