From patchwork Tue Sep 6 14:06:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101843 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp567913qgf; Tue, 6 Sep 2016 07:07:07 -0700 (PDT) X-Received: by 10.98.108.4 with SMTP id h4mr73438490pfc.128.1473170824587; Tue, 06 Sep 2016 07:07:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f187si10273123pfc.288.2016.09.06.07.07.04; Tue, 06 Sep 2016 07:07:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756623AbcIFOGz (ORCPT + 27 others); Tue, 6 Sep 2016 10:06:55 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:58282 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756504AbcIFOGj (ORCPT ); Tue, 6 Sep 2016 10:06:39 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0M5fZo-1asTmC29eK-00xYFQ; Tue, 06 Sep 2016 16:06:00 +0200 From: Arnd Bergmann To: Jason Cooper , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth Cc: linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 2/4] ARM: mvebu/orion: remove NO_IRQ check from device init Date: Tue, 6 Sep 2016 16:06:21 +0200 Message-Id: <20160906140623.2853066-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160906140623.2853066-1-arnd@arndb.de> References: <20160906140623.2853066-1-arnd@arndb.de> X-Provags-ID: V03:K0:/wnxtQcnTKkOUO/B5YdnQZoSoFM7bRkO9kV1l+Kxx9NSXy4vh9l dIoAu0NKF9cZaPgZpxiYnhrDwcgWdhOQBE1vBReEUDIbDnO8rDHtWvrL1CIkdZN6nWkhEPH zqm2lkKj1ocCqmqQ6u6zDRm0+0UVZkWkb+8l77hJ45Q+HVQFbqlaAw6UCMVfmWNScQMrrTV SDMhi0MCHYe+zyXF9AlWg== X-UI-Out-Filterresults: notjunk:1; V01:K0:a0KZNjQ3UaU=:oOXPkv7+itc5Uc51K/Y7sB 8uGd6eDTUkOIfDRSo7lrhmCyG2FCfstI3k87PtSrXpd6+f2KBvP0wPvrgc6MA8WXh4MR5ObMe wJqDg78wm6vajCcwdPNb7+S8y8Sb3VCNrV0iCqTVo2v/9g+uPs2AA8PEUphyHU5BRrS9wY41I bcnLURwZ16si1ZGSoRyhN81Ejt9oYrW0WRQtYXlmt8pQRzpxt3QUJk4lgHV8ukOTeNLRDF/1b lwrBRe9QLze7umwRFfdWNx82i8RE73oaXRA8oKi0VdnD3n7Mm+WuUmyNM1hwCUhNia9H0rNJQ JAg+ESeGRbq0r6iiiI7zU2uIo4noiiWSMeMOACiCvspVk8/IF1pTRanmYHqqn4i7DjGv65qfL JEoCtlW0qayQ+NZtE8TvxYnmCRiDaptshWABlzuUYxHDIy0m5qacjZr7YiRGmugUbsRPN5q2/ LgJVIpH/HWgsDJQSC/Rhn2DN2T5UPw4iRAfp/GuOiU4ElQ5lvKH/jyw2PNUVbZkuJoQgk2yAi bfHIsmr/GMshI029zXOTUvzCwqekJUd0TYhp/qrNpdbXcRM1641qaTyspniP9EDhc8mOeUvsP Sf7j6ZpnJgyHehcCkunci9GllPIS43fKxd4bS9g7qofIhrtZlrCtlOenrWIfYVFCaYjFsvaT6 ziI8IiBY4rgbUVyP/fDy4IXpCJjRIXoCLJ+/G8uAZU2+DN270l/EMOZ+U3cQr8in71hQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For most devices, we know in advance whether they have an interrupt line or not, so we can avoid passing NO_IRQ and instead split fill_resources() into two interfaces, with only the new fill_resources_irq() function taking an irq argument, which it then can use unconditionally. Signed-off-by: Arnd Bergmann --- arch/arm/plat-orion/common.c | 52 ++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 23 deletions(-) -- 2.9.0 diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index 7757f71fe709..7b9b70785a54 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c @@ -52,21 +52,27 @@ void __init orion_clkdev_init(struct clk *tclk) static void fill_resources(struct platform_device *device, struct resource *resources, resource_size_t mapbase, - resource_size_t size, - unsigned int irq) + resource_size_t size) { device->resource = resources; device->num_resources = 1; resources[0].flags = IORESOURCE_MEM; resources[0].start = mapbase; resources[0].end = mapbase + size; +} - if (irq != NO_IRQ) { - device->num_resources++; - resources[1].flags = IORESOURCE_IRQ; - resources[1].start = irq; - resources[1].end = irq; - } +static void fill_resources_irq(struct platform_device *device, + struct resource *resources, + resource_size_t mapbase, + resource_size_t size, + unsigned int irq) +{ + fill_resources(device, resources, mapbase, size); + + device->num_resources++; + resources[1].flags = IORESOURCE_IRQ; + resources[1].start = irq; + resources[1].end = irq; } /***************************************************************************** @@ -93,7 +99,7 @@ static void __init uart_complete( data->uartclk = uart_get_clk_rate(clk); orion_uart->dev.platform_data = data; - fill_resources(orion_uart, resources, mapbase, 0xff, irq); + fill_resources_irq(orion_uart, resources, mapbase, 0xff, irq); platform_device_register(orion_uart); } @@ -305,8 +311,8 @@ void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data, unsigned int tx_csum_limit) { fill_resources(&orion_ge00_shared, orion_ge00_shared_resources, - mapbase + 0x2000, SZ_16K - 1, NO_IRQ); - fill_resources(&orion_ge_mvmdio, orion_ge_mvmdio_resources, + mapbase + 0x2000, SZ_16K - 1); + fill_resources_irq(&orion_ge_mvmdio, orion_ge_mvmdio_resources, mapbase + 0x2004, 0x84 - 1, irq_err); orion_ge00_shared_data.tx_csum_limit = tx_csum_limit; ge_complete(&orion_ge00_shared_data, @@ -357,7 +363,7 @@ void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data, unsigned int tx_csum_limit) { fill_resources(&orion_ge01_shared, orion_ge01_shared_resources, - mapbase + 0x2000, SZ_16K - 1, NO_IRQ); + mapbase + 0x2000, SZ_16K - 1); orion_ge01_shared_data.tx_csum_limit = tx_csum_limit; ge_complete(&orion_ge01_shared_data, orion_ge01_resources, irq, &orion_ge01_shared, @@ -406,7 +412,7 @@ void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data, unsigned long irq) { fill_resources(&orion_ge10_shared, orion_ge10_shared_resources, - mapbase + 0x2000, SZ_16K - 1, NO_IRQ); + mapbase + 0x2000, SZ_16K - 1); ge_complete(&orion_ge10_shared_data, orion_ge10_resources, irq, &orion_ge10_shared, NULL, @@ -454,7 +460,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data, unsigned long irq) { fill_resources(&orion_ge11_shared, orion_ge11_shared_resources, - mapbase + 0x2000, SZ_16K - 1, NO_IRQ); + mapbase + 0x2000, SZ_16K - 1); ge_complete(&orion_ge11_shared_data, orion_ge11_resources, irq, &orion_ge11_shared, NULL, @@ -535,7 +541,7 @@ void __init orion_i2c_init(unsigned long mapbase, unsigned long freq_m) { orion_i2c_pdata.freq_m = freq_m; - fill_resources(&orion_i2c, orion_i2c_resources, mapbase, + fill_resources_irq(&orion_i2c, orion_i2c_resources, mapbase, SZ_32 - 1, irq); platform_device_register(&orion_i2c); } @@ -545,7 +551,7 @@ void __init orion_i2c_1_init(unsigned long mapbase, unsigned long freq_m) { orion_i2c_1_pdata.freq_m = freq_m; - fill_resources(&orion_i2c_1, orion_i2c_1_resources, mapbase, + fill_resources_irq(&orion_i2c_1, orion_i2c_1_resources, mapbase, SZ_32 - 1, irq); platform_device_register(&orion_i2c_1); } @@ -573,14 +579,14 @@ static struct platform_device orion_spi_1 = { void __init orion_spi_init(unsigned long mapbase) { fill_resources(&orion_spi, &orion_spi_resources, - mapbase, SZ_512 - 1, NO_IRQ); + mapbase, SZ_512 - 1); platform_device_register(&orion_spi); } void __init orion_spi_1_init(unsigned long mapbase) { fill_resources(&orion_spi_1, &orion_spi_1_resources, - mapbase, SZ_512 - 1, NO_IRQ); + mapbase, SZ_512 - 1); platform_device_register(&orion_spi_1); } @@ -738,7 +744,7 @@ void __init orion_ehci_init(unsigned long mapbase, enum orion_ehci_phy_ver phy_version) { orion_ehci_data.phy_version = phy_version; - fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1, + fill_resources_irq(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1, irq); platform_device_register(&orion_ehci); @@ -762,7 +768,7 @@ static struct platform_device orion_ehci_1 = { void __init orion_ehci_1_init(unsigned long mapbase, unsigned long irq) { - fill_resources(&orion_ehci_1, orion_ehci_1_resources, + fill_resources_irq(&orion_ehci_1, orion_ehci_1_resources, mapbase, SZ_4K - 1, irq); platform_device_register(&orion_ehci_1); @@ -786,7 +792,7 @@ static struct platform_device orion_ehci_2 = { void __init orion_ehci_2_init(unsigned long mapbase, unsigned long irq) { - fill_resources(&orion_ehci_2, orion_ehci_2_resources, + fill_resources_irq(&orion_ehci_2, orion_ehci_2_resources, mapbase, SZ_4K - 1, irq); platform_device_register(&orion_ehci_2); @@ -816,7 +822,7 @@ void __init orion_sata_init(struct mv_sata_platform_data *sata_data, unsigned long irq) { orion_sata.dev.platform_data = sata_data; - fill_resources(&orion_sata, orion_sata_resources, + fill_resources_irq(&orion_sata, orion_sata_resources, mapbase, 0x5000 - 1, irq); platform_device_register(&orion_sata); @@ -846,7 +852,7 @@ void __init orion_crypto_init(unsigned long mapbase, unsigned long sram_size, unsigned long irq) { - fill_resources(&orion_crypto, orion_crypto_resources, + fill_resources_irq(&orion_crypto, orion_crypto_resources, mapbase, 0xffff, irq); orion_crypto.num_resources = 3; orion_crypto_resources[2].start = srambase;