From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23A1BEB64DD for ; Fri, 21 Jul 2023 14:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231375AbjGUO0d (ORCPT ); Fri, 21 Jul 2023 10:26:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbjGUO0d (ORCPT ); Fri, 21 Jul 2023 10:26:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715F22D6D for ; Fri, 21 Jul 2023 07:26:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C03E661CD1 for ; Fri, 21 Jul 2023 14:26:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA783C433C9; Fri, 21 Jul 2023 14:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689949590; bh=rgAaikkFx2A5Ii3ZwYiDOzYayie/EDoXe377INTrwa0=; h=Subject:To:Cc:From:Date:From; b=Sjyn4IJa+GaQ+VCOrU+PE2R2xcC0e+o94tlAZP8rxGB8BpTkF1jfOvBJWkCpMZfaJ 5razM81gA2GjR8kiUqcGJvXUkybJzjYe8BrddfQ5PwbaRo6OAQhCYqTOqchO/6OHSf kn9iIFSmlX0GSxraKCEv9VX25KrKjzuCRiV2ItAA= Subject: FAILED: patch "[PATCH] pwm: meson: modify and simplify calculation in" failed to apply to 5.10-stable tree To: hkallweit1@gmail.com, ddrokosov@sberdevices.ru, martin.blumenstingl@googlemail.com, thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de Cc: From: Date: Fri, 21 Jul 2023 16:26:19 +0200 Message-ID: <2023072119-angling-cryptic-51ea@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 6b9352f3f8a1a35faf0efc1ad1807ee303467796 # git commit -s git send-email --to '' --in-reply-to '2023072119-angling-cryptic-51ea@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: 6b9352f3f8a1 ("pwm: meson: modify and simplify calculation in meson_pwm_get_state") 6c452cff79f8 ("pwm: Make .get_state() callback return an error code") 8eca6b0a647a ("Merge tag 'pwm/for-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 6b9352f3f8a1a35faf0efc1ad1807ee303467796 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Wed, 24 May 2023 21:47:43 +0200 Subject: [PATCH] pwm: meson: modify and simplify calculation in meson_pwm_get_state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don't see a reason why we should treat the case lo < hi differently and return 0 as period and duty_cycle. The current logic was added with c375bcbaabdb ("pwm: meson: Read the full hardware state in meson_pwm_get_state()"), Martin as original author doesn't remember why it was implemented this way back then. So let's handle it as normal use case and also remove the optimization for lo == 0. I think the improved readability is worth it. Fixes: c375bcbaabdb ("pwm: meson: Read the full hardware state in meson_pwm_get_state()") Reviewed-by: Uwe Kleine-König Reviewed-by: Dmitry Rokosov Acked-by: Martin Blumenstingl Cc: stable@vger.kernel.org Signed-off-by: Heiner Kallweit Signed-off-by: Thierry Reding diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 5732300eb004..3865538dd2d6 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -351,18 +351,8 @@ static int meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, channel->lo = FIELD_GET(PWM_LOW_MASK, value); channel->hi = FIELD_GET(PWM_HIGH_MASK, value); - if (channel->lo == 0) { - state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->hi); - state->duty_cycle = state->period; - } else if (channel->lo >= channel->hi) { - state->period = meson_pwm_cnt_to_ns(chip, pwm, - channel->lo + channel->hi); - state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, - channel->hi); - } else { - state->period = 0; - state->duty_cycle = 0; - } + state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->lo + channel->hi); + state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, channel->hi); state->polarity = PWM_POLARITY_NORMAL;