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: 685190 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 39857C7EE26 for ; Tue, 23 May 2023 15:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233433AbjEWPrl (ORCPT ); Tue, 23 May 2023 11:47:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237020AbjEWPrk (ORCPT ); Tue, 23 May 2023 11:47:40 -0400 X-Greylist: delayed 351 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 23 May 2023 08:47:39 PDT Received: from riemann.telenet-ops.be (riemann.telenet-ops.be [IPv6:2a02:1800:110:4::f00:10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C490611A for ; Tue, 23 May 2023 08:47:39 -0700 (PDT) Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by riemann.telenet-ops.be (Postfix) with ESMTPS id 4QQdpg05gtz4x9XP for ; Tue, 23 May 2023 17:41:47 +0200 (CEST) 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 Cc: linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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