From patchwork Thu Mar 7 13:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13585702 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 62D63C48BF6 for ; Thu, 7 Mar 2024 13:51:34 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t2ugtFOrk58iu7WeGs/28lJ3OlT3pOFldmAaTQoZCE0=; b=EYXGMg5Jtb5l/y FfVaFZPLHiWwA43D9Nec22kbuqRsnLv4GkkbewpWKg5PYZRR+pXwUTHS2xFzyg4i/ayekx7CR2xn+ p11qbNB5Xq6i9jJalXA5o9EYwvGdxsBS/JafLGMFYGhvXLNpRx8ID0wF7RAbcQc1EcGtdZPfmKzek vF9Ig/8zkE17equYlCr6xpAMwN4NP4++0izXh6lcuAouF13yy3j+ncpZMf7pZ2B3OmU0y7/+TWvzN ycErfSst5huuPvej9t30I2vj9C5unzhL3FI5duEpBsIU4E0vkQj6+oMY3zIe0SjNOscI3g0KOyIxz tcm+F25VOGVKYvImpTWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riE9c-00000004s0c-2gMA; Thu, 07 Mar 2024 13:51:24 +0000 Received: from mgamail.intel.com ([198.175.65.9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riE9X-00000004rxP-2iim for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2024 13:51:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709819480; x=1741355480; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zl1ZwjdCwvGQxetgUvY4jVAUPX49ROq+BTSxqfQpADs=; b=jwHGZZd//5JCZqromXFqUTjOxNjz1aEG8rDfR8sG7SFyBlib/4qwaeQo RKcRIcz6BPWufUC1JYWi3lVjH6GK7nzPM5+hh/0h44PQmzHDz0nk0yIka /TAEHNC6HqBMrdKEuGRNCr5mYMcZ8q6+l50d6pVLTkRmoUDqtywEgkefS HS1FdqX3BDtnI7VOr1KJaWgbgRY+2zS5p1tXuPN5xGqNnwbBPzyDaKcVB wrwy8HVpIVM03FOlBf5nKGfu4HMpHwBsju4Ar12J4JZZbH1aPYJm0sWKw X3jRnDptgjynSv39+P0CFFNMz1T4linwJzXPDRTrCP9ozULdcKlQ66EKO A==; X-IronPort-AV: E=McAfee;i="6600,9927,11005"; a="26960314" X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="26960314" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2024 05:51:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11005"; a="937046158" X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="937046158" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 07 Mar 2024 05:51:12 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 157ED5BB; Thu, 7 Mar 2024 15:51:11 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Alex Shi , Yanteng Si , Hu Haowen <2023002089@link.tyut.edu.cn>, Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v1 2/3] ARM: sa1100: Open code gpio_request_array() Date: Thu, 7 Mar 2024 15:49:04 +0200 Message-ID: <20240307135109.3778316-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240307135109.3778316-1-andriy.shevchenko@linux.intel.com> References: <20240307135109.3778316-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240307_055119_755366_A0ED683D X-CRM114-Status: GOOD ( 15.52 ) 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 In order to prerare for removal of gpio_request_array(), open code the latter. Note, we are not using gpio_request_one() as it's also deprecated, hence reducing legacy API usage to the very basic ones. Signed-off-by: Andy Shevchenko --- arch/arm/mach-sa1100/h3600.c | 47 +++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c index 5e25dfa752e9..1cfc0b1fa41c 100644 --- a/arch/arm/mach-sa1100/h3600.c +++ b/arch/arm/mach-sa1100/h3600.c @@ -20,16 +20,6 @@ #include "generic.h" -/* - * helper for sa1100fb - */ -static struct gpio h3600_lcd_gpio[] = { - { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD power" }, - { H3600_EGPIO_LCD_PCI, GPIOF_OUT_INIT_LOW, "LCD control" }, - { H3600_EGPIO_LCD_5V_ON, GPIOF_OUT_INIT_LOW, "LCD 5v" }, - { H3600_EGPIO_LVDD_ON, GPIOF_OUT_INIT_LOW, "LCD 9v/-6.5v" }, -}; - static bool h3600_lcd_request(void) { static bool h3600_lcd_ok; @@ -38,7 +28,42 @@ static bool h3600_lcd_request(void) if (h3600_lcd_ok) return true; - rc = gpio_request_array(h3600_lcd_gpio, ARRAY_SIZE(h3600_lcd_gpio)); + rc = gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power"); + if (rc) + goto out; + rc = gpio_direction_output(H3XXX_EGPIO_LCD_ON, 0); + if (rc) + goto out_free_on; + rc = gpio_request(H3600_EGPIO_LCD_PCI, "LCD control"); + if (rc) + goto out_free_on; + rc = gpio_direction_output(H3600_EGPIO_LCD_PCI, 0); + if (rc) + goto out_free_pci; + rc = gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v"); + if (rc) + goto out_free_pci; + rc = gpio_direction_output(H3600_EGPIO_LCD_5V_ON, 0); + if (rc) + goto out_free_5v_on; + rc = gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v"); + if (rc) + goto out_free_5v_on; + rc = gpio_direction_output(H3600_EGPIO_LVDD_ON, 0); + if (rc) + goto out_free_lvdd_on; + + goto out; + +out_free_lvdd_on: + gpio_free(H3600_EGPIO_LVDD_ON); +out_free_5v_on: + gpio_free(H3600_EGPIO_LCD_5V_ON); +out_free_pci: + gpio_free(H3600_EGPIO_LCD_PCI); +out_free_on: + gpio_free(H3XXX_EGPIO_LCD_ON); +out: if (rc) pr_err("%s: can't request GPIOs\n", __func__); else