From patchwork Wed Aug 28 14:23:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13781369 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 5C100C5B548 for ; Wed, 28 Aug 2024 14:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LrHmiGEvv6MDAGepllhcPNTwBI3+8SvnBm3u8QNVLgU=; b=0EUcKbt2DKjJ7cyT9/gGNmZX27 TyEL37MurR7tTHEqOtQ1LLsk7IzVZMMh6OekN9isXOVDszGMOcn5RCcUmEa7XyBurMHx/SzmJaNdi mUaIcdu941Da7cDnEjm1ONY1IXVMjBQy+vPbXpIcxjAXea965XHfqH6ie7Um9jTsNnFXo1Ea7y9dj p562zp21rFdLY9M99vTxOqS7e7TyBaK0Js1CnCe6fcf7V6Rd4FJmEKgeEzwHJlYJgmHvpAq2jzjJN GPIv6F1b98ahnu7M4QdOz3vbSYF/T1X9i2XsMkPbpmT/XTlQFk71VdDMfuVyLpkOxhF9YlWOmevZf YY20HeiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJeT-0000000FjiC-2Wqi; Wed, 28 Aug 2024 14:28:01 +0000 Received: from mgamail.intel.com ([192.198.163.14]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJcY-0000000Fj5Y-0aCM for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 14:26:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724855162; x=1756391162; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yU5WIK6BIkbyOwE3GLh6HhhYOjF54mrhGpUrqhf5QJ8=; b=C4KCIPUjm18haNAn1LUG9EcJ1awb5xwcxAbtWn8yfpBfjLk9wy9joFVY hMoVmiMgzZf2V0f+nn4cgt3V7gFoCjFdvUuyT6QpnrO3pBVgMMAcIuBLf JyzqY/ANVscclulhCvcpC/3/xw8sBfqINtRGkvdkfQvXgNUFjZj/cT0oI 4kbIjytc1897RtuFNKrXbPrb+ODyNFWSNafejN8OAFvbtEFmvW6dCe/ys UOnOicNxT6ASTH+0XkgEDPHcx+qgpg3K72AMbJc8lSGo/FGwFwZ/Lqrsv A7yXjaw8hZ9lrmgagaMdqdJQl10rxuQgt5bjDIqMD0lc0FCbSxmwlnLFf A==; X-CSE-ConnectionGUID: PYXbfiA4SUG27numxTSFEA== X-CSE-MsgGUID: PQr5gIAFQf65athOQXhL/A== X-IronPort-AV: E=McAfee;i="6700,10204,11178"; a="23575178" X-IronPort-AV: E=Sophos;i="6.10,183,1719903600"; d="scan'208";a="23575178" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2024 07:26:00 -0700 X-CSE-ConnectionGUID: lBon98/0R/2TP/tuD79jbA== X-CSE-MsgGUID: nMtBCdoiQM2p+v3YgGxGyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,183,1719903600"; d="scan'208";a="94047452" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa001.fm.intel.com with ESMTP; 28 Aug 2024 07:25:57 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0A707118; Wed, 28 Aug 2024 17:25:56 +0300 (EEST) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-gpio@vger.kernel.org Cc: Hartley Sweeten , Alexander Sverdlin , Russell King , Thomas Bogendoerfer , Bartosz Golaszewski Subject: [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions Date: Wed, 28 Aug 2024 17:23:57 +0300 Message-ID: <20240828142554.2424189-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240828142554.2424189-1-andriy.shevchenko@linux.intel.com> References: <20240828142554.2424189-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-20240828_072602_293853_77BF4F06 X-CRM114-Status: GOOD ( 13.06 ) 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 Besides the fact that (old) drivers use wrong definitions, e.g., GPIOF_INIT_HIGH instead of GPIOF_OUT_INIT_HIGH, shrink the legacy definitions by killing those GPIOF_INIT_* completely. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- arch/arm/mach-ep93xx/vision_ep9307.c | 3 +-- arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- drivers/gpio/gpiolib-legacy.c | 3 +-- include/linux/gpio.h | 7 ++----- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c index 9471938df64c..02c5a4724192 100644 --- a/arch/arm/mach-ep93xx/vision_ep9307.c +++ b/arch/arm/mach-ep93xx/vision_ep9307.c @@ -76,8 +76,7 @@ static int vision_lcd_setup(struct platform_device *pdev) { int err; - err = gpio_request_one(VISION_LCD_ENABLE, GPIOF_INIT_HIGH, - dev_name(&pdev->dev)); + err = gpio_request_one(VISION_LCD_ENABLE, GPIOF_OUT_INIT_HIGH, dev_name(&pdev->dev)); if (err) return err; diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index 99f321b6e417..9cc8fbf218a5 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c @@ -42,7 +42,7 @@ static struct board_info __initdata board_cvg834g = { .expected_cpu_id = 0x3368, .ephy_reset_gpio = 36, - .ephy_reset_gpio_flags = GPIOF_INIT_HIGH, + .ephy_reset_gpio_flags = GPIOF_OUT_INIT_HIGH, .has_pci = 1, .has_uart0 = 1, .has_uart1 = 1, diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c index d27142418f9f..51d5fe203111 100644 --- a/drivers/gpio/gpiolib-legacy.c +++ b/drivers/gpio/gpiolib-legacy.c @@ -46,8 +46,7 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) if (flags & GPIOF_DIR_IN) err = gpiod_direction_input(desc); else - err = gpiod_direction_output_raw(desc, - (flags & GPIOF_INIT_HIGH) ? 1 : 0); + err = gpiod_direction_output_raw(desc, !!(flags & GPIOF_OUT_INIT_HIGH)); if (err) goto free_gpio; diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 063f71b18a7c..4af8ad114557 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -20,12 +20,9 @@ struct device; #define GPIOF_DIR_OUT (0 << 0) #define GPIOF_DIR_IN (1 << 0) -#define GPIOF_INIT_LOW (0 << 1) -#define GPIOF_INIT_HIGH (1 << 1) - #define GPIOF_IN (GPIOF_DIR_IN) -#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) -#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) +#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | (0 << 1)) +#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | (1 << 1)) /* Gpio pin is active-low */ #define GPIOF_ACTIVE_LOW (1 << 2) From patchwork Wed Aug 28 14:23:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13781370 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 90CD2C5AE5A for ; Wed, 28 Aug 2024 14:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=l/OaiWSzbep5/7/oBEfFn/r4k/mW7DlCk5MsiDrMjrQ=; b=YhIzjl1aOkuU7Pc4OwsMHJ66mU wNGfKioVJ+tm3R+WnR+4nHv8kdAV/yXBkf+jOjoei6VB4XzEA+qpK2QhGow/cq9tpJgTrE8gZEwbG lJrQNocUGgMiP47OMWTfshv2Li5Db0jKgI7PTYC8Tb/1k8z7Eidx6osdS6kpW+7ACIzcQXPMziISB n4oP3VZDlApgdXaJqOE3zBIV+7yNBSTFqeq0TaaxVum+S45GetH39rNqgZp9koCjQc8QA16A1W5K4 zJBvVeNisJN+mNaA31hltadNwGmP9552/IV5eDYjqxgBOMydJEKj5B6ynZ8GRjqbIUKZYZOMsmZz1 USb0QEIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJfI-0000000Fk4m-30wO; Wed, 28 Aug 2024 14:28:52 +0000 Received: from mgamail.intel.com ([192.198.163.17]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJcY-0000000Fj5z-223c for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 14:26:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724855162; x=1756391162; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b+YH70YKIG5Ozic9cP8h4si5TZhR2H4rU94oHvsAHFQ=; b=eJT+MwSOKYSALtRSNwsqR/wE/bJaICcdLREHy++UM1XX7sPF1PDR6mmq 7pRBN74ucAT0MHYxJkXJuKgM+ezHtZvBTtwwYTjiXjn81XJflsOaK1HVl d7C+iOLPJtpaAKFsOQQVL46A1wBKjgdqY3nPixUHuAozFslZtSFyZ9uzE K0EkdZtlM2ZdIowks7vVo5LMWUPyHjLJL0qStinFEe4Jo1pnco+6jo0Uz IBCbufFP/TexQlsRE34Lrkcqm8aj5xnTdh70EUgrzVwpC7ZbUNhtm5Yrq 4nA10QbM+kuFnOu2BwCL5Gthh9xzPuuSISy9XBQGqcL2IfFyHchbSqZ2M w==; X-CSE-ConnectionGUID: GZndaJmgRdOeOwpqxlSHJQ== X-CSE-MsgGUID: 2BefdLN2TFmbGMFuihnayw== X-IronPort-AV: E=McAfee;i="6700,10204,11178"; a="23274778" X-IronPort-AV: E=Sophos;i="6.10,183,1719903600"; d="scan'208";a="23274778" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2024 07:26:00 -0700 X-CSE-ConnectionGUID: +tK0UVQLSImmEQhoKK8oDA== X-CSE-MsgGUID: FVejs9rTQjmtlnD+HrsDwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,183,1719903600"; d="scan'208";a="68086592" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa005.jf.intel.com with ESMTP; 28 Aug 2024 07:25:57 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 16A6A2E6; Wed, 28 Aug 2024 17:25:56 +0300 (EEST) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-gpio@vger.kernel.org Cc: Hartley Sweeten , Alexander Sverdlin , Russell King , Thomas Bogendoerfer , Bartosz Golaszewski Subject: [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions Date: Wed, 28 Aug 2024 17:23:58 +0300 Message-ID: <20240828142554.2424189-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240828142554.2424189-1-andriy.shevchenko@linux.intel.com> References: <20240828142554.2424189-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-20240828_072602_561444_E1F02A57 X-CRM114-Status: GOOD ( 13.91 ) 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 Besides the fact that (old) drivers use wrong definitions, e.g., GPIOF_DIR_IN instead of GPIOF_IN, shrink the legacy definitions by killing those GPIOF_DIR_* completely. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- arch/arm/mach-ep93xx/vision_ep9307.c | 3 +-- drivers/gpio/gpiolib-legacy.c | 2 +- include/linux/gpio.h | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c index 02c5a4724192..85f0dd7255a9 100644 --- a/arch/arm/mach-ep93xx/vision_ep9307.c +++ b/arch/arm/mach-ep93xx/vision_ep9307.c @@ -292,8 +292,7 @@ static void __init vision_init_machine(void) * Request the gpio expander's interrupt gpio line now to prevent * the kernel from doing a WARN in gpiolib:gpio_ensure_requested(). */ - if (gpio_request_one(EP93XX_GPIO_LINE_F(7), GPIOF_DIR_IN, - "pca9539:74")) + if (gpio_request_one(EP93XX_GPIO_LINE_F(7), GPIOF_IN, "pca9539:74")) pr_warn("cannot request interrupt gpio for pca9539:74\n"); vision_i2c_info[1].irq = gpio_to_irq(EP93XX_GPIO_LINE_F(7)); diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c index 51d5fe203111..087fe3227e35 100644 --- a/drivers/gpio/gpiolib-legacy.c +++ b/drivers/gpio/gpiolib-legacy.c @@ -43,7 +43,7 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) if (flags & GPIOF_ACTIVE_LOW) set_bit(FLAG_ACTIVE_LOW, &desc->flags); - if (flags & GPIOF_DIR_IN) + if (flags & GPIOF_IN) err = gpiod_direction_input(desc); else err = gpiod_direction_output_raw(desc, !!(flags & GPIOF_OUT_INIT_HIGH)); diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 4af8ad114557..2d105be7bbc3 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -17,12 +17,9 @@ struct device; /* make these flag values available regardless of GPIO kconfig options */ -#define GPIOF_DIR_OUT (0 << 0) -#define GPIOF_DIR_IN (1 << 0) - -#define GPIOF_IN (GPIOF_DIR_IN) -#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | (0 << 1)) -#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | (1 << 1)) +#define GPIOF_IN ((1 << 0)) +#define GPIOF_OUT_INIT_LOW ((0 << 0) | (0 << 1)) +#define GPIOF_OUT_INIT_HIGH ((0 << 0) | (1 << 1)) /* Gpio pin is active-low */ #define GPIOF_ACTIVE_LOW (1 << 2)