From patchwork Tue Nov 30 22:08:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 519459 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 3FF61C433F5 for ; Tue, 30 Nov 2021 22:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344732AbhK3WMy (ORCPT ); Tue, 30 Nov 2021 17:12:54 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:38614 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344671AbhK3WMT (ORCPT ); Tue, 30 Nov 2021 17:12:19 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DF7E1CE1CAD for ; Tue, 30 Nov 2021 22:08:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1148CC53FCF; Tue, 30 Nov 2021 22:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638310128; bh=ICs1EZZPgNBH5xISNjPbuRfciO3/zeRncX7W82GW4dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J4KLg3+i2972N7lAQNhoDrBBcDAuhU95HYlnrY62d6gIaw06rB3vvgLEiyB4DI2cr M5OuWmFeEZc3+2mqXg6Gj2XJM2vvP4vqGMBefMZWZ0Qtgy6WQm+G8n9dLv7Hk7axKI KZ84SgJyjHBFlnW4nAyq4hVbMb0MdCoWXUPGE7Fo4W14meen/Vzfm1izdo/l+VL1lj F8uYI6JqK46LcUlBmApp4Hof6nbwjK+tMv7ckYl8WSZY84HMXAmVHOjQHhjAe6Yl1C e+f6VoFkk+a1I8sqMIosDBPSHq8Z0uQFaT7LRbr4BvcZ0DHvsDVjRW6qq2u7cqnGpK UyF/+UZYCGChA== From: Bjorn Helgaas To: Andy Shevchenko Cc: Vaibhav Gupta , linux-gpio@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 1/5] gpio: pch: Use .driver_data instead of checking Device IDs again Date: Tue, 30 Nov 2021 16:08:37 -0600 Message-Id: <20211130220841.2776562-2-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130220841.2776562-1-helgaas@kernel.org> References: <20211130220841.2776562-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bjorn Helgaas Previously, pch_gpio_probe() tested the Device ID to determine the type of IOH. But the driver core has already matched the Device ID with one of the IDs in the pch_gpio_pcidev_id[] table, and we can supply the IOH type there as .driver_data. Use the pci_device_id.driver_data to learn the IOH type instead of testing the Device ID again. No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/gpio/gpio-pch.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index a552df298a97..625920421990 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -368,14 +368,7 @@ static int pch_gpio_probe(struct pci_dev *pdev, } chip->base = pcim_iomap_table(pdev)[1]; - - if (pdev->device == 0x8803) - chip->ioh = INTEL_EG20T_PCH; - else if (pdev->device == 0x8014) - chip->ioh = OKISEMI_ML7223m_IOH; - else if (pdev->device == 0x8043) - chip->ioh = OKISEMI_ML7223n_IOH; - + chip->ioh = id->driver_data; chip->reg = chip->base; pci_set_drvdata(pdev, chip); spin_lock_init(&chip->spinlock); @@ -439,10 +432,14 @@ static int __maybe_unused pch_gpio_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pch_gpio_pm_ops, pch_gpio_suspend, pch_gpio_resume); static const struct pci_device_id pch_gpio_pcidev_id[] = { - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) }, - { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8014) }, - { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8043) }, - { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8803) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803), + .driver_data = INTEL_EG20T_PCH }, + { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8014), + .driver_data = OKISEMI_ML7223m_IOH }, + { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8043), + .driver_data = OKISEMI_ML7223n_IOH }, + { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8803), + .driver_data = INTEL_EG20T_PCH }, { 0, } }; MODULE_DEVICE_TABLE(pci, pch_gpio_pcidev_id); From patchwork Tue Nov 30 22:08:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 518356 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 7F792C4332F for ; Tue, 30 Nov 2021 22:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344929AbhK3WRP (ORCPT ); Tue, 30 Nov 2021 17:17:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42176 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344549AbhK3WMN (ORCPT ); Tue, 30 Nov 2021 17:12:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5CD60B81D41 for ; Tue, 30 Nov 2021 22:08:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C95A3C53FCC; Tue, 30 Nov 2021 22:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638310130; bh=Bwocmk2zGXOjzfa7u+dwaG1albWjVqET0kPSLgpOr4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GciYKpYkLowc18qjD16FHkGNoP6Ov2oRhoVJ8Kkd84iYgWg1oZpIlAOqO7bQdcN+c j01N5OjFd5m6efB5OgEHLUr3UWgRFxQAkl5e79S/IqH1GFqDg1EocM+1HNM6dl5ut8 EodXhAFQRDH2b6LAs15AyrmWtGmPydZyE8YAsPSGEipPUvYRXvYfUYOI4rmefEdiKb TaDOImRsKuCFy1cDtr9dWmfVdvtcR6hQj0eFOy7CxlEUW8lMf1HTwejGnenFy0VT5J IZSzUeAhOVPkQYQpGijF7yt9QGA5wEPNGFljj2Ie4n/S0G4e23fvEbt4X13XqDkjJH 1UMIIkBudw7Jw== From: Bjorn Helgaas To: Andy Shevchenko Cc: Vaibhav Gupta , linux-gpio@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 2/5] gpio: pch: Cache &pdev->dev to reduce repetition Date: Tue, 30 Nov 2021 16:08:38 -0600 Message-Id: <20211130220841.2776562-3-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130220841.2776562-1-helgaas@kernel.org> References: <20211130220841.2776562-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bjorn Helgaas pch_gpio_probe() repeats the "&pdev->dev" expression several times. Cache the result as "struct device *dev" to reduce the repetition. No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/gpio/gpio-pch.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 625920421990..3a0bd8795741 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -346,24 +346,25 @@ static int pch_gpio_alloc_generic_chip(struct pch_gpio *chip, static int pch_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct device *dev = &pdev->dev; s32 ret; struct pch_gpio *chip; int irq_base; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); if (chip == NULL) return -ENOMEM; - chip->dev = &pdev->dev; + chip->dev = dev; ret = pcim_enable_device(pdev); if (ret) { - dev_err(&pdev->dev, "pci_enable_device FAILED"); + dev_err(dev, "pci_enable_device FAILED"); return ret; } ret = pcim_iomap_regions(pdev, BIT(1), KBUILD_MODNAME); if (ret) { - dev_err(&pdev->dev, "pci_request_regions FAILED-%d", ret); + dev_err(dev, "pci_request_regions FAILED-%d", ret); return ret; } @@ -374,16 +375,16 @@ static int pch_gpio_probe(struct pci_dev *pdev, spin_lock_init(&chip->spinlock); pch_gpio_setup(chip); - ret = devm_gpiochip_add_data(&pdev->dev, &chip->gpio, chip); + ret = devm_gpiochip_add_data(dev, &chip->gpio, chip); if (ret) { - dev_err(&pdev->dev, "PCH gpio: Failed to register GPIO\n"); + dev_err(dev, "PCH gpio: Failed to register GPIO\n"); return ret; } - irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0, + irq_base = devm_irq_alloc_descs(dev, -1, 0, gpio_pins[chip->ioh], NUMA_NO_NODE); if (irq_base < 0) { - dev_warn(&pdev->dev, "PCH gpio: Failed to get IRQ base num\n"); + dev_warn(dev, "PCH gpio: Failed to get IRQ base num\n"); chip->irq_base = -1; return 0; } @@ -393,10 +394,10 @@ static int pch_gpio_probe(struct pci_dev *pdev, iowrite32(BIT(gpio_pins[chip->ioh]) - 1, &chip->reg->imask); iowrite32(BIT(gpio_pins[chip->ioh]) - 1, &chip->reg->ien); - ret = devm_request_irq(&pdev->dev, pdev->irq, pch_gpio_handler, + ret = devm_request_irq(dev, pdev->irq, pch_gpio_handler, IRQF_SHARED, KBUILD_MODNAME, chip); if (ret) { - dev_err(&pdev->dev, "request_irq failed\n"); + dev_err(dev, "request_irq failed\n"); return ret; } From patchwork Tue Nov 30 22:08:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 518358 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 5F102C433FE for ; Tue, 30 Nov 2021 22:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344747AbhK3WM7 (ORCPT ); Tue, 30 Nov 2021 17:12:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344678AbhK3WMU (ORCPT ); Tue, 30 Nov 2021 17:12:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67698C061757 for ; Tue, 30 Nov 2021 14:08:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2F159B81D3C for ; Tue, 30 Nov 2021 22:08:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2F1FC53FD0; Tue, 30 Nov 2021 22:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638310131; bh=K5kjoVixjmU2Vq/LXKt/KMDR0qFId8jnRJKidJLr00Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqSbB4KOvGz1cn8u4iRgS/20RpUe+KO2Hxn9XbTcngU9F/5GiuchAQLOsWIbSxZ2P 4RO8oG+mV1bdEnL+NJW7jR349NuMChTGlXCAFqqBnCnWZ9EtqN/AsFddsgmwjCcPT7 NfMp+mao5cmSbvgMKoy+4acvJpTezdi+FUFzROMcTp4GbCHOR2EWzmP0nJgjQqvCHY yhezT7j6Sq8/MwGz7s0hG/5Ao4oXSgDUP8oxtB/+3hznmD6d67Z/+TdfcMKl7MdlzH mTdqm7iX8yr7cnjWhQty4CXPqH5kS6yrX2knvgfHY+rStuEVjePWyGjfLQo7C7+fPG m5bllxeTTsSlw== From: Bjorn Helgaas To: Andy Shevchenko Cc: Vaibhav Gupta , linux-gpio@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 3/5] gpio: ml-ioh: Cache &pdev->dev to reduce repetition Date: Tue, 30 Nov 2021 16:08:39 -0600 Message-Id: <20211130220841.2776562-4-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130220841.2776562-1-helgaas@kernel.org> References: <20211130220841.2776562-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bjorn Helgaas ioh_gpio_probe() repeats the "&pdev->dev" expression several times. Cache the result as "struct device *dev" to reduce the repetition. No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/gpio/gpio-ml-ioh.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index efa9acdc320a..4e9528dd1152 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c @@ -401,6 +401,7 @@ static int ioh_gpio_alloc_generic_chip(struct ioh_gpio *chip, static int ioh_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct device *dev = &pdev->dev; int ret; int i, j; struct ioh_gpio *chip; @@ -410,19 +411,19 @@ static int ioh_gpio_probe(struct pci_dev *pdev, ret = pci_enable_device(pdev); if (ret) { - dev_err(&pdev->dev, "%s : pci_enable_device failed", __func__); + dev_err(dev, "%s : pci_enable_device failed", __func__); goto err_pci_enable; } ret = pci_request_regions(pdev, KBUILD_MODNAME); if (ret) { - dev_err(&pdev->dev, "pci_request_regions failed-%d", ret); + dev_err(dev, "pci_request_regions failed-%d", ret); goto err_request_regions; } base = pci_iomap(pdev, 1, 0); if (!base) { - dev_err(&pdev->dev, "%s : pci_iomap failed", __func__); + dev_err(dev, "%s : pci_iomap failed", __func__); ret = -ENOMEM; goto err_iomap; } @@ -435,7 +436,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev, chip = chip_save; for (i = 0; i < 8; i++, chip++) { - chip->dev = &pdev->dev; + chip->dev = dev; chip->base = base; chip->reg = chip->base; chip->ch = i; @@ -443,17 +444,17 @@ static int ioh_gpio_probe(struct pci_dev *pdev, ioh_gpio_setup(chip, num_ports[i]); ret = gpiochip_add_data(&chip->gpio, chip); if (ret) { - dev_err(&pdev->dev, "IOH gpio: Failed to register GPIO\n"); + dev_err(dev, "IOH gpio: Failed to register GPIO\n"); goto err_gpiochip_add; } } chip = chip_save; for (j = 0; j < 8; j++, chip++) { - irq_base = devm_irq_alloc_descs(&pdev->dev, -1, IOH_IRQ_BASE, + irq_base = devm_irq_alloc_descs(dev, -1, IOH_IRQ_BASE, num_ports[j], NUMA_NO_NODE); if (irq_base < 0) { - dev_warn(&pdev->dev, + dev_warn(dev, "ml_ioh_gpio: Failed to get IRQ base num\n"); ret = irq_base; goto err_gpiochip_add; @@ -467,11 +468,10 @@ static int ioh_gpio_probe(struct pci_dev *pdev, } chip = chip_save; - ret = devm_request_irq(&pdev->dev, pdev->irq, ioh_gpio_handler, + ret = devm_request_irq(dev, pdev->irq, ioh_gpio_handler, IRQF_SHARED, KBUILD_MODNAME, chip); if (ret != 0) { - dev_err(&pdev->dev, - "%s request_irq failed\n", __func__); + dev_err(dev, "%s request_irq failed\n", __func__); goto err_gpiochip_add; } @@ -498,7 +498,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev, err_pci_enable: - dev_err(&pdev->dev, "%s Failed returns %d\n", __func__, ret); + dev_err(dev, "%s Failed returns %d\n", __func__, ret); return ret; } From patchwork Tue Nov 30 22:08:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 519458 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 25021C433EF for ; Tue, 30 Nov 2021 22:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344775AbhK3WNM (ORCPT ); Tue, 30 Nov 2021 17:13:12 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:38650 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344672AbhK3WMU (ORCPT ); Tue, 30 Nov 2021 17:12:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9B22ACE1CB3 for ; Tue, 30 Nov 2021 22:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8881DC53FCC; Tue, 30 Nov 2021 22:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638310133; bh=eHxGQRZA8SnJr+v/Ptp4jOeJXBUt2PqdBQ6hMDC8uV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/zJvmfkgfBRqMOTJQspTCITqMf75oV1dY3RlBRPBoQBQ2s40HvudQWOhaeyj9rsX FhNjJKp3X/99bx0YAwWWXp8MAwNgfbSIX5nv+ExAnTsUSMC5KgBOx820h4Yi2pbNrj 4UcWqVlHeyeg8bmvXGt2Hob50i7DPezCTntt4k+6I9jRdQaYjJRlKWq+lXU7O9fQ1t OMjb2QP4OL1A0dxcriRvGk4foOMfW1dujGG1ePMioMJSZ2tkN7FQVzlJdITa7S9imJ zhWY88xCl8kpaJ2oZgS0+m0Ve2InGU8gpcES8d7uJQcRb5exNhxi1RapsAyOcVSNJm ffIAwGogzjXIw== From: Bjorn Helgaas To: Andy Shevchenko Cc: Vaibhav Gupta , linux-gpio@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 4/5] gpio: ml-ioh: Use BIT() to match gpio-pch.c Date: Tue, 30 Nov 2021 16:08:40 -0600 Message-Id: <20211130220841.2776562-5-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130220841.2776562-1-helgaas@kernel.org> References: <20211130220841.2776562-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bjorn Helgaas The ML IOH driver is very similar to the PCH driver. To make it more similar, replace "1 << nr" with "BIT(nr)". No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/gpio/gpio-ml-ioh.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index 4e9528dd1152..0fb9c8bc9b2d 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c @@ -98,9 +98,9 @@ static void ioh_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) spin_lock_irqsave(&chip->spinlock, flags); reg_val = ioread32(&chip->reg->regs[chip->ch].po); if (val) - reg_val |= (1 << nr); + reg_val |= BIT(nr); else - reg_val &= ~(1 << nr); + reg_val &= ~BIT(nr); iowrite32(reg_val, &chip->reg->regs[chip->ch].po); spin_unlock_irqrestore(&chip->spinlock, flags); @@ -110,7 +110,7 @@ static int ioh_gpio_get(struct gpio_chip *gpio, unsigned nr) { struct ioh_gpio *chip = gpiochip_get_data(gpio); - return !!(ioread32(&chip->reg->regs[chip->ch].pi) & (1 << nr)); + return !!(ioread32(&chip->reg->regs[chip->ch].pi) & BIT(nr)); } static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, @@ -123,15 +123,15 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, spin_lock_irqsave(&chip->spinlock, flags); pm = ioread32(&chip->reg->regs[chip->ch].pm) & - ((1 << num_ports[chip->ch]) - 1); - pm |= (1 << nr); + (BIT(num_ports[chip->ch]) - 1); + pm |= BIT(nr); iowrite32(pm, &chip->reg->regs[chip->ch].pm); reg_val = ioread32(&chip->reg->regs[chip->ch].po); if (val) - reg_val |= (1 << nr); + reg_val |= BIT(nr); else - reg_val &= ~(1 << nr); + reg_val &= ~BIT(nr); iowrite32(reg_val, &chip->reg->regs[chip->ch].po); spin_unlock_irqrestore(&chip->spinlock, flags); @@ -147,8 +147,8 @@ static int ioh_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) spin_lock_irqsave(&chip->spinlock, flags); pm = ioread32(&chip->reg->regs[chip->ch].pm) & - ((1 << num_ports[chip->ch]) - 1); - pm &= ~(1 << nr); + (BIT(num_ports[chip->ch]) - 1); + pm &= ~BIT(nr); iowrite32(pm, &chip->reg->regs[chip->ch].pm); spin_unlock_irqrestore(&chip->spinlock, flags); @@ -304,7 +304,7 @@ static void ioh_irq_unmask(struct irq_data *d) struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct ioh_gpio *chip = gc->private; - iowrite32(1 << (d->irq - chip->irq_base), + iowrite32(BIT(d->irq - chip->irq_base), &chip->reg->regs[chip->ch].imaskclr); } @@ -313,7 +313,7 @@ static void ioh_irq_mask(struct irq_data *d) struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct ioh_gpio *chip = gc->private; - iowrite32(1 << (d->irq - chip->irq_base), + iowrite32(BIT(d->irq - chip->irq_base), &chip->reg->regs[chip->ch].imask); } @@ -326,7 +326,7 @@ static void ioh_irq_disable(struct irq_data *d) spin_lock_irqsave(&chip->spinlock, flags); ien = ioread32(&chip->reg->regs[chip->ch].ien); - ien &= ~(1 << (d->irq - chip->irq_base)); + ien &= ~BIT(d->irq - chip->irq_base); iowrite32(ien, &chip->reg->regs[chip->ch].ien); spin_unlock_irqrestore(&chip->spinlock, flags); } @@ -340,7 +340,7 @@ static void ioh_irq_enable(struct irq_data *d) spin_lock_irqsave(&chip->spinlock, flags); ien = ioread32(&chip->reg->regs[chip->ch].ien); - ien |= 1 << (d->irq - chip->irq_base); + ien |= BIT(d->irq - chip->irq_base); iowrite32(ien, &chip->reg->regs[chip->ch].ien); spin_unlock_irqrestore(&chip->spinlock, flags); } From patchwork Tue Nov 30 22:08:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 518357 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 B8FA7C433F5 for ; Tue, 30 Nov 2021 22:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344757AbhK3WNE (ORCPT ); Tue, 30 Nov 2021 17:13:04 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42250 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344676AbhK3WMT (ORCPT ); Tue, 30 Nov 2021 17:12:19 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F146BB81D3F for ; Tue, 30 Nov 2021 22:08:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AD20C53FC7; Tue, 30 Nov 2021 22:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638310135; bh=XnlDPKEDWVuVJi1CUdYT+X3zeuXgvLu8Oq/LXlGLyD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8sDCZlCDbmSdOeCC05xaWareeQn1klzeMzws5fkA6lGBXyrvh3xcnywbfmgPfg1I vOPKsUESZolNn+Ue9IkYcEKXcyLlOzByFYw8Ca6ApqB5EJpl15cXG//toGJX2olO03 QHmdUYIAjPE4topyNMySvNcvqxloYEQYpz4CH4JojVaHC5xDdomQeXWWadqNSJ1Ll1 oxJTKpI8Vs4mJHOOhYJrg0tvI57u2cbx08tshxz2jpPlXLYVoqCFhfvZ8fgg4KNvsr w4K8XZQyblg7pM1+kRy5zkIaIjQiieBWi9tP60ZtZ+1HImreCvWVH7JyjN5iAa+jOC YMd+UdPbjEMCQ== From: Bjorn Helgaas To: Andy Shevchenko Cc: Vaibhav Gupta , linux-gpio@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 5/5] gpio: ml-ioh: Change whitespace to match gpio-pch.c Date: Tue, 30 Nov 2021 16:08:41 -0600 Message-Id: <20211130220841.2776562-6-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211130220841.2776562-1-helgaas@kernel.org> References: <20211130220841.2776562-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bjorn Helgaas The ML IOH driver is very similar to the PCH driver. To make it more similar, tweak the whitespace in ioh_gpio_direction_output() and ioh_gpio_direction_input(). No functional change intended. Signed-off-by: Bjorn Helgaas --- drivers/gpio/gpio-ml-ioh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index 0fb9c8bc9b2d..b060c4773698 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c @@ -122,8 +122,8 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, unsigned long flags; spin_lock_irqsave(&chip->spinlock, flags); - pm = ioread32(&chip->reg->regs[chip->ch].pm) & - (BIT(num_ports[chip->ch]) - 1); + pm = ioread32(&chip->reg->regs[chip->ch].pm); + pm &= BIT(num_ports[chip->ch]) - 1; pm |= BIT(nr); iowrite32(pm, &chip->reg->regs[chip->ch].pm); @@ -146,8 +146,8 @@ static int ioh_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) unsigned long flags; spin_lock_irqsave(&chip->spinlock, flags); - pm = ioread32(&chip->reg->regs[chip->ch].pm) & - (BIT(num_ports[chip->ch]) - 1); + pm = ioread32(&chip->reg->regs[chip->ch].pm); + pm &= BIT(num_ports[chip->ch]) - 1; pm &= ~BIT(nr); iowrite32(pm, &chip->reg->regs[chip->ch].pm); spin_unlock_irqrestore(&chip->spinlock, flags);