From patchwork Tue May 23 15:40:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13252567 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 1A275C7EE26 for ; Tue, 23 May 2023 15:40:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5229210E457; Tue, 23 May 2023 15:40:50 +0000 (UTC) Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by gabe.freedesktop.org (Postfix) with ESMTPS id C49EB10E457 for ; Tue, 23 May 2023 15:40:47 +0000 (UTC) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed30:b0ac:7afd:272:4cff]) by laurent.telenet-ops.be with bizsmtp id 0Fgi2A00U0Jkz7G01Fgi8n; Tue, 23 May 2023 17:40:46 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1q1U7g-002t5B-8n; Tue, 23 May 2023 17:40:42 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1q1U7u-00CkiL-KO; Tue, 23 May 2023 17:40:42 +0200 From: Geert Uytterhoeven To: Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , Lee Jones , Daniel Thompson , Jingoo Han , Linus Walleij , Bartosz Golaszewski Subject: [PATCH] backlight: pwm_bl: Remove unneeded checks for valid GPIOs Date: Tue, 23 May 2023 17:40:41 +0200 Message-Id: <00be8237e0e2bc9b179177b5490f175d657261a2.1684856337.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Geert Uytterhoeven , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-gpio@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" All of gpiod_set_value_cansleep() and gpiod_direction_output() handle NULL GPIO pointers just fine, so there is no need to check for that in the caller. Signed-off-by: Geert Uytterhoeven --- drivers/video/backlight/pwm_bl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index fce412234d10399a..a51fbab96368053b 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -54,8 +54,7 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb) if (pb->post_pwm_on_delay) msleep(pb->post_pwm_on_delay); - if (pb->enable_gpio) - gpiod_set_value_cansleep(pb->enable_gpio, 1); + gpiod_set_value_cansleep(pb->enable_gpio, 1); pb->enabled = true; } @@ -65,8 +64,7 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) if (!pb->enabled) return; - if (pb->enable_gpio) - gpiod_set_value_cansleep(pb->enable_gpio, 0); + gpiod_set_value_cansleep(pb->enable_gpio, 0); if (pb->pwm_off_delay) msleep(pb->pwm_off_delay); @@ -429,8 +427,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb) * Synchronize the enable_gpio with the observed state of the * hardware. */ - if (pb->enable_gpio) - gpiod_direction_output(pb->enable_gpio, active); + gpiod_direction_output(pb->enable_gpio, active); /* * Do not change pb->enabled here! pb->enabled essentially