From patchwork Wed Jan 27 14:04:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101072 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2602286lbb; Wed, 27 Jan 2016 06:06:57 -0800 (PST) X-Received: by 10.67.22.97 with SMTP id hr1mr42970787pad.49.1453903617453; Wed, 27 Jan 2016 06:06:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qp8si9710212pac.229.2016.01.27.06.06.57; Wed, 27 Jan 2016 06:06:57 -0800 (PST) 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 S932822AbcA0OGz (ORCPT + 30 others); Wed, 27 Jan 2016 09:06:55 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:62662 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754261AbcA0OGx (ORCPT ); Wed, 27 Jan 2016 09:06:53 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0M6rkj-1aCPer0yvN-00wo6I; Wed, 27 Jan 2016 15:06:20 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, Jaroslav Kysela , linux-kernel@vger.kernel.org Subject: [PATCH 2/9] net: hp100: remove unnecessary #ifdefs Date: Wed, 27 Jan 2016 15:04:52 +0100 Message-Id: <1453903507-3427225-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:S0UMsy6g/rlB5xKZahO3FbAcszoBrkodb4sKHU2a2WqU/qlJUWc UVunQ+sy38AfR+tA5Ek6XqyUTNfgOKhNVrf5Gdda+3xi/fspHlrT0xu/xZ/azQ377UovYF+ al1fERbfY/OOlyphEh63rBYXcVwcvOwJClzl9hrMjGHonVUesK9bVMS5n023k8DqeRSL3MW Nb7xvXRnF8xDPOnpzNC7Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:WsiXQYkskAs=:vbDRddyKXCiUSblpB1VIlO BspKQ91ElXPTk99HvNoOv6Qs34A+eDtnV1JUT2YoHSUkxADtG0wx6w+OTKSkjrYSv54WttD++ xDcQsKhV525PflQ385MmsyWTAitU1SAZs0+NEutg4OS+D/tbnwClDGVJDVoJ0GnZRn6WpEobt vSSlZAMCxxgw/+pPrCXkSCKtG1GnfxYZUPRB0ciKQg+TQYwT7t6V2BEjd11px1aNoRzhjuzOW vYCSudhJ8D+fLxVqIxZAUAFdztGymx+4l7F5EHk7yYsJEOFTMFKCNtH8mjkP3KSF3Isyjcdoa uDA0AY5+8XXbe/vqrFgsYMcQKBmqWRLazr7iu+oqV4ve8RsEkFt6JFUeF315thaYQ2XlsXX78 hKaxGkOD24qdWgp6ollrw+cK/0BzZWIrpCcy3GNgayiigF9PJYzbtG1Jm2GrXcTJmPDHEJYbZ qpbcGSfHWZJFt+oLLrEIJCeSHtYg01FIN+/qM7NJv1dB2V0ZwSqwSCcbnSl78ELglKnevJbYU 2ZPmC2FTau2w/ZV5cK9dL8lZ5+f51cfabL8DuAOQN0wBTPuopT8dN224LhgUakfZWGIDDmqLt 0rDHRNttTYmCG0PrU9ZeNJ3bCivguGrME8/OTW12X5uyIBkOQcxEyJCStzRi6fbJl/MxQjtyS pxXUcfYwNYZ+1xXlEH9z3VhKVssve70+0IxshiClZxYpqSF+MXAf6uLRAmkRHk2Vlf/c= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Building the hp100 ethernet driver causes warnings when both the PCI and EISA drivers are disabled: ethernet/hp/hp100.c: In function 'hp100_module_init': ethernet/hp/hp100.c:3047:2: warning: label 'out3' defined but not used [-Wunused-label] ethernet/hp/hp100.c: At top level: ethernet/hp/hp100.c:2828:13: warning: 'cleanup_dev' defined but not used [-Wunused-function] We can easily avoid the warnings and make the driver look slightly nicer by removing the #ifdefs that check for the CONFIG_PCI and CONFIG_EISA, as all the registration functions are designed to have no effect when the buses are disabled. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/hp/hp100.c | 18 ------------------ 1 file changed, 18 deletions(-) -- 2.7.0 diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c index 1d5c3e16d8f4..3daf2d4a7ca0 100644 --- a/drivers/net/ethernet/hp/hp100.c +++ b/drivers/net/ethernet/hp/hp100.c @@ -194,7 +194,6 @@ static const char *hp100_isa_tbl[] = { }; #endif -#ifdef CONFIG_EISA static struct eisa_device_id hp100_eisa_tbl[] = { { "HWPF180" }, /* HP J2577 rev A */ { "HWP1920" }, /* HP 27248B */ @@ -205,9 +204,7 @@ static struct eisa_device_id hp100_eisa_tbl[] = { { "" } /* Mandatory final entry ! */ }; MODULE_DEVICE_TABLE(eisa, hp100_eisa_tbl); -#endif -#ifdef CONFIG_PCI static const struct pci_device_id hp100_pci_tbl[] = { {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A, PCI_ANY_ID, PCI_ANY_ID,}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585B, PCI_ANY_ID, PCI_ANY_ID,}, @@ -219,7 +216,6 @@ static const struct pci_device_id hp100_pci_tbl[] = { {} /* Terminating entry */ }; MODULE_DEVICE_TABLE(pci, hp100_pci_tbl); -#endif static int hp100_rx_ratio = HP100_DEFAULT_RX_RATIO; static int hp100_priority_tx = HP100_DEFAULT_PRIORITY_TX; @@ -2842,7 +2838,6 @@ static void cleanup_dev(struct net_device *d) free_netdev(d); } -#ifdef CONFIG_EISA static int hp100_eisa_probe(struct device *gendev) { struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); @@ -2884,9 +2879,7 @@ static struct eisa_driver hp100_eisa_driver = { .remove = hp100_eisa_remove, } }; -#endif -#ifdef CONFIG_PCI static int hp100_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -2955,7 +2948,6 @@ static struct pci_driver hp100_pci_driver = { .probe = hp100_pci_probe, .remove = hp100_pci_remove, }; -#endif /* * module section @@ -3032,23 +3024,17 @@ static int __init hp100_module_init(void) err = hp100_isa_init(); if (err && err != -ENODEV) goto out; -#ifdef CONFIG_EISA err = eisa_driver_register(&hp100_eisa_driver); if (err && err != -ENODEV) goto out2; -#endif -#ifdef CONFIG_PCI err = pci_register_driver(&hp100_pci_driver); if (err && err != -ENODEV) goto out3; -#endif out: return err; out3: -#ifdef CONFIG_EISA eisa_driver_unregister (&hp100_eisa_driver); out2: -#endif hp100_isa_cleanup(); goto out; } @@ -3057,12 +3043,8 @@ static int __init hp100_module_init(void) static void __exit hp100_module_exit(void) { hp100_isa_cleanup(); -#ifdef CONFIG_EISA eisa_driver_unregister (&hp100_eisa_driver); -#endif -#ifdef CONFIG_PCI pci_unregister_driver (&hp100_pci_driver); -#endif } module_init(hp100_module_init) From patchwork Wed Jan 27 14:04:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101059 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2602731lbb; Wed, 27 Jan 2016 06:07:37 -0800 (PST) X-Received: by 10.66.142.201 with SMTP id ry9mr43140618pab.89.1453903656904; Wed, 27 Jan 2016 06:07:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d29si9765368pfj.73.2016.01.27.06.07.36; Wed, 27 Jan 2016 06:07:36 -0800 (PST) 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 S932891AbcA0OHd (ORCPT + 30 others); Wed, 27 Jan 2016 09:07:33 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:52792 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932573AbcA0OH3 (ORCPT ); Wed, 27 Jan 2016 09:07:29 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0LrEhY-1ZwkKo08Nw-0138oJ; Wed, 27 Jan 2016 15:06:38 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, Michael Chan , Paul Gortmaker , Rajesh Borundia , Rasesh Mody , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , linux-kernel@vger.kernel.org Subject: [PATCH 3/9] net: bgmac: clarify CONFIG_BCMA dependency Date: Wed, 27 Jan 2016 15:04:53 +0100 Message-Id: <1453903507-3427225-4-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:g/MZ4svSFVmeXjKbNSTIWX6aK9tZIrvgqcANRK3T6VQ8gtNMV1A 7Bqoixlgp+co+RKGJsgdJBTFU5/bWHja2p1PhcUTA9LuxJAWMTqbTkPpTvSOEDqo1sC9ETx Nmf1+DWT6Fb+uh6PTBRYAEaZsos5sVI6/tiw7KvFIxZgcdJvcS0PfIrs/LMX10q3Ljr+gHG bH4VC9qfv85rWzky+fKew== X-UI-Out-Filterresults: notjunk:1; V01:K0:ACFja/sPwtk=:DHGVPqGi7tMyb1VY8NL7DK TtytXm6AHyh0lOAar2Maq4jbfFsT7dqmvS+f4b9ce63qiozILx5C+tGKD4TefnvpTDXwEAbHe psJdN+7NzWu4BolagPT0icyZjOxqmllkULGAFxZL5mO7UFQMgtt+WgaO1iXVQBb0UsUs0BxLo jhDvipdBidiRcyb2y/SZfgUNFU/S0MFY8rzxLgXtN+F1C280iBpSSny5XiFGOxYcLg3eQt5iz /P1nk2NH6Ts1nPG0Lla+Y3GcyquGIoXa7BZsLlF98YBIA+4fqsYKQVE5msdlP5Jjqz271VFj3 tEyxrGZ/6Dh2bK9vekdwdugJEewX1H9rVbRIPC/KWhrr3GN/f6z3EFo41egJu3uhYDbyvJ8k5 JM7SLNzV3kTkRGs5A5MH/qqFmqcCaMDM/LM9ykHIss3LGYn/xz5TlcrfgfYIQ4pNBUxIgroUa VG34q63PI5vC504SFXY+R4j9taUvNGfi3ezkP2cEuGYmll5wDWRxjpYRDB1QeHls3428YswyU PknJOjnr56YxITmxK4vvOYZzSQN+od0cl5bGJUYpQTULX8vgiDXTgq61pJq2yupu2umK7FqU3 mno73XNkvOYDgNmyeM6kwzyiA6v9YNrNcKDfsIK6pDwhm5fRNCEXi+c69IV3V0+uWxRYo9h8a HlpZHlkP2d9nudMlZo08H4BBB/ZSG/IYhnFhlxbfiT6RXv0LMuArvux0Loe+RmS54DeI= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The bgmac driver depends on BCMA_HOST_SOC, which is only used when CONFIG_BCMA is enabled. However, it is a bool option and can be set when CONFIG_BCMA=m, and then bgmac can be built-in, leading to an obvious link error: drivers/built-in.o: In function `bgmac_init': :(.init.text+0x7f2c): undefined reference to `__bcma_driver_register' drivers/built-in.o: In function `bgmac_exit': :(.exit.text+0x110a): undefined reference to `bcma_driver_unregister' To avoid this case, we need to depend on both BCMA and BCMA_SOC, as this patch does. I'm also trying to make the dependency more readable by splitting it into three lines, and adding a COMPILE_TEST alternative so we can test-build it in all configurations that support BCMA. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/broadcom/Kconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.7.0 diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig index 8550df189ceb..19f7cd02e085 100644 --- a/drivers/net/ethernet/broadcom/Kconfig +++ b/drivers/net/ethernet/broadcom/Kconfig @@ -151,8 +151,11 @@ config BNX2X_VXLAN config BGMAC tristate "BCMA bus GBit core support" - depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X) + depends on BCMA && BCMA_HOST_SOC + depends on HAS_DMA + depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST select PHYLIB + select FIXED_PHY ---help--- This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. They can be found on BCM47xx SoCs and provide gigabit ethernet. From patchwork Wed Jan 27 14:04:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101048 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2602847lbb; Wed, 27 Jan 2016 06:07:47 -0800 (PST) X-Received: by 10.67.14.234 with SMTP id fj10mr19868430pad.149.1453903667200; Wed, 27 Jan 2016 06:07:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id la16si9760113pab.64.2016.01.27.06.07.46; Wed, 27 Jan 2016 06:07:47 -0800 (PST) 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 S932930AbcA0OHo (ORCPT + 30 others); Wed, 27 Jan 2016 09:07:44 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:57672 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932752AbcA0OHc (ORCPT ); Wed, 27 Jan 2016 09:07:32 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0MNhgQ-1aRBdr3WmI-007Aa9; Wed, 27 Jan 2016 15:06:57 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, =?utf-8?q?fran=C3=A7ois_romieu?= , linux-kernel@vger.kernel.org Subject: [PATCH 4/9] net: moxart: use correct accessors for DMA memory Date: Wed, 27 Jan 2016 15:04:54 +0100 Message-Id: <1453903507-3427225-5-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:FHVJGvpMNQgm+BXqrEWGducxbwN9y29SJHPlqYRWIDpcK0J7Dng MQsexhM4ScTZMLwSOC1eLrP04weeMeG95qFLxtQFAxyWrRWczbhTV8N6vbAFIZwPi2iiRCm i1mbTbY7mHlAoaA5/19Rki6F8MYXivuZmf0tXaLVF6q2dGvC9aroI4vps3hfyTzRoOGDNyd yJLt27ziSZqGLr5G4dBZw== X-UI-Out-Filterresults: notjunk:1; V01:K0:fckmUYvKMY8=:Ucwc4ORcpN8kx4ONRXwMeb fPUeEAcrMTCGGiPN/V2vgDVg5VDvMWQ/iLcGeCo0XpwZdmoL68OYjHjk5J13On5NDyQPyYv58 4LoWPkO3Z7G6GqAU0Zi0R5d8D3tLVEOIFVE4ou/ifu7SwRQiBSYoMFcjq+ZIbDUHHyinA9rlr 2VO6M3Dby0cWuxOF23Ydk0cSNL29HWjqpabIlhPwY4iKZgRK3/+fsgFx5zLBBneI/3hg1ht6O a6Pm8zvdWCtm+FJqbZBxty6DZVSVz6ykXi9IU309Ltg+lvRukk1hwTny9wDRbYgPretGeX21Z NfOi8rP0Sy5n8+evmMwH/zKItZPC5u+/FioY407pI1RZWZpnMVpO8F7NzBun64YtlgRR31oB0 tkl8FPGSnoSMpkMY6Wb1t6/6Eou67t3rN2vb1MMiVwj4JJR7ScQeNhmM76IqKZswe08fCxeam J6EW+zuXOz66E08uoBP8YVdyobC6YZhbQe9gHEdyegcxbcaAw69VsiK7oFHVJVWxJQeypen06 eYUqjcDy785f22oBVGy7qejY/tdLFWMwVKgvwFKa8G/6yhELZF/KstWaIYISDRa/7R+2iu9xX p2sYKj/7cz9TMFWJpS8xz1eIH6fMDVx+fDNFizxqnrZDNe7xc5DKYDbj+qtfte51vGX8wmA0a uc+ajaYKg00a+4ys6tq5Ifo9QxCtoQnzCPhNUGPr3tfhT57fOfqMnoT84a3bX9x9D0D4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The moxart ethernet driver confuses coherent DMA buffers with MMIO registers. moxart_ether.c: In function 'moxart_mac_setup_desc_ring': moxart_ether.c:146:428: error: passing argument 1 of '__fswab32' makes integer from pointer without a cast [-Werror=int-conversion] moxart_ether.c:74:39: warning: incorrect type in argument 3 (different address spaces) moxart_ether.c:74:39: expected void *cpu_addr moxart_ether.c:74:39: got void [noderef] *tx_desc_base This leaves the basic logic alone and uses normal pointers for the virtual address of the descriptor. As we cannot use readl/writel to access them, we also introduce our own moxart_desc_read moxart_desc_write helpers that perform the same endianess swap as the original code, but without the extra barriers and address space conversion. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/moxa/moxart_ether.c | 42 ++++++++++++++++++++------------ drivers/net/ethernet/moxa/moxart_ether.h | 4 +-- 2 files changed, 28 insertions(+), 18 deletions(-) -- 2.7.0 diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index a10c928bbd6b..b2f1c0db9445 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -28,6 +28,16 @@ #include "moxart_ether.h" +static inline void moxart_desc_write(u32 data, u32 *desc) +{ + *desc = cpu_to_le32(data); +} + +static inline u32 moxart_desc_read(u32 *desc) +{ + return le32_to_cpu(*desc); +} + static inline void moxart_emac_write(struct net_device *ndev, unsigned int reg, unsigned long value) { @@ -112,7 +122,7 @@ static void moxart_mac_enable(struct net_device *ndev) static void moxart_mac_setup_desc_ring(struct net_device *ndev) { struct moxart_mac_priv_t *priv = netdev_priv(ndev); - void __iomem *desc; + void *desc; int i; for (i = 0; i < TX_DESC_NUM; i++) { @@ -121,7 +131,7 @@ static void moxart_mac_setup_desc_ring(struct net_device *ndev) priv->tx_buf[i] = priv->tx_buf_base + priv->tx_buf_size * i; } - writel(TX_DESC1_END, desc + TX_REG_OFFSET_DESC1); + moxart_desc_write(TX_DESC1_END, desc + TX_REG_OFFSET_DESC1); priv->tx_head = 0; priv->tx_tail = 0; @@ -129,8 +139,8 @@ static void moxart_mac_setup_desc_ring(struct net_device *ndev) for (i = 0; i < RX_DESC_NUM; i++) { desc = priv->rx_desc_base + i * RX_REG_DESC_SIZE; memset(desc, 0, RX_REG_DESC_SIZE); - writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); - writel(RX_BUF_SIZE & RX_DESC1_BUF_SIZE_MASK, + moxart_desc_write(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); + moxart_desc_write(RX_BUF_SIZE & RX_DESC1_BUF_SIZE_MASK, desc + RX_REG_OFFSET_DESC1); priv->rx_buf[i] = priv->rx_buf_base + priv->rx_buf_size * i; @@ -141,12 +151,12 @@ static void moxart_mac_setup_desc_ring(struct net_device *ndev) if (dma_mapping_error(&ndev->dev, priv->rx_mapping[i])) netdev_err(ndev, "DMA mapping error\n"); - writel(priv->rx_mapping[i], + moxart_desc_write(priv->rx_mapping[i], desc + RX_REG_OFFSET_DESC2 + RX_DESC2_ADDRESS_PHYS); - writel(priv->rx_buf[i], + moxart_desc_write((uintptr_t)priv->rx_buf[i], desc + RX_REG_OFFSET_DESC2 + RX_DESC2_ADDRESS_VIRT); } - writel(RX_DESC1_END, desc + RX_REG_OFFSET_DESC1); + moxart_desc_write(RX_DESC1_END, desc + RX_REG_OFFSET_DESC1); priv->rx_head = 0; @@ -201,14 +211,14 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) napi); struct net_device *ndev = priv->ndev; struct sk_buff *skb; - void __iomem *desc; + void *desc; unsigned int desc0, len; int rx_head = priv->rx_head; int rx = 0; while (rx < budget) { desc = priv->rx_desc_base + (RX_REG_DESC_SIZE * rx_head); - desc0 = readl(desc + RX_REG_OFFSET_DESC0); + desc0 = moxart_desc_read(desc + RX_REG_OFFSET_DESC0); if (desc0 & RX_DESC0_DMA_OWN) break; @@ -250,7 +260,7 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) priv->stats.multicast++; rx_next: - writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); + moxart_desc_write(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); rx_head = RX_NEXT(rx_head); priv->rx_head = rx_head; @@ -310,7 +320,7 @@ static irqreturn_t moxart_mac_interrupt(int irq, void *dev_id) static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) { struct moxart_mac_priv_t *priv = netdev_priv(ndev); - void __iomem *desc; + void *desc; unsigned int len; unsigned int tx_head = priv->tx_head; u32 txdes1; @@ -319,7 +329,7 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) desc = priv->tx_desc_base + (TX_REG_DESC_SIZE * tx_head); spin_lock_irq(&priv->txlock); - if (readl(desc + TX_REG_OFFSET_DESC0) & TX_DESC0_DMA_OWN) { + if (moxart_desc_read(desc + TX_REG_OFFSET_DESC0) & TX_DESC0_DMA_OWN) { net_dbg_ratelimited("no TX space for packet\n"); priv->stats.tx_dropped++; goto out_unlock; @@ -337,9 +347,9 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) priv->tx_len[tx_head] = len; priv->tx_skb[tx_head] = skb; - writel(priv->tx_mapping[tx_head], + moxart_desc_write(priv->tx_mapping[tx_head], desc + TX_REG_OFFSET_DESC2 + TX_DESC2_ADDRESS_PHYS); - writel(skb->data, + moxart_desc_write((uintptr_t)skb->data, desc + TX_REG_OFFSET_DESC2 + TX_DESC2_ADDRESS_VIRT); if (skb->len < ETH_ZLEN) { @@ -354,8 +364,8 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); if (tx_head == TX_DESC_NUM_MASK) txdes1 |= TX_DESC1_END; - writel(txdes1, desc + TX_REG_OFFSET_DESC1); - writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); + moxart_desc_write(txdes1, desc + TX_REG_OFFSET_DESC1); + moxart_desc_write(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); /* start to send packet */ writel(0xffffffff, priv->base + REG_TX_POLL_DEMAND); diff --git a/drivers/net/ethernet/moxa/moxart_ether.h b/drivers/net/ethernet/moxa/moxart_ether.h index 2be9280d608c..93a9563ac7c6 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.h +++ b/drivers/net/ethernet/moxa/moxart_ether.h @@ -300,7 +300,7 @@ struct moxart_mac_priv_t { dma_addr_t rx_base; dma_addr_t rx_mapping[RX_DESC_NUM]; - void __iomem *rx_desc_base; + void *rx_desc_base; unsigned char *rx_buf_base; unsigned char *rx_buf[RX_DESC_NUM]; unsigned int rx_head; @@ -308,7 +308,7 @@ struct moxart_mac_priv_t { dma_addr_t tx_base; dma_addr_t tx_mapping[TX_DESC_NUM]; - void __iomem *tx_desc_base; + void *tx_desc_base; unsigned char *tx_buf_base; unsigned char *tx_buf[RX_DESC_NUM]; unsigned int tx_head; From patchwork Wed Jan 27 14:04:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101069 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2604035lbb; Wed, 27 Jan 2016 06:09:35 -0800 (PST) X-Received: by 10.98.7.74 with SMTP id b71mr42991037pfd.38.1453903775179; Wed, 27 Jan 2016 06:09:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si9752310pfk.172.2016.01.27.06.09.34; Wed, 27 Jan 2016 06:09:35 -0800 (PST) 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 S933141AbcA0OJd (ORCPT + 30 others); Wed, 27 Jan 2016 09:09:33 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:53211 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932694AbcA0OHm (ORCPT ); Wed, 27 Jan 2016 09:07:42 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0LvN23-1ZygP20QZ1-010fhg; Wed, 27 Jan 2016 15:07:07 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, "Maciej W. Rozycki" , linux-kernel@vger.kernel.org Subject: [PATCH 5/9] net: fddi/defxx: avoid warning about uninitialized variable use Date: Wed, 27 Jan 2016 15:04:55 +0100 Message-Id: <1453903507-3427225-6-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:ck224WuWEXiS4C87PPJmnarn1tFkJX3DqXN82A4qbDYj1w161Fw YUjJRiV980K6eZbFUIGXqqcpoA79ThrV/zHSeS6iU+lLdFpxS5gEjfGPlwLS17jkHGugUyF Yd/FdX6pgj3PdJES+5O25fRhiEfG+LHZttw+f+3hmaSCrQZAHF0VrFZV5Y/pDGyAf+sPfSN SdO4cDPq9C93kY4MRuErg== X-UI-Out-Filterresults: notjunk:1; V01:K0:8KnfbbC16+s=:yMYEMXuyshxvghHcYLU0Ax bgHzEGCx1cxysX2AurW2rJLSqd4cH6U44JCkf5TlhzEsBQaa5B/cdiP+9CFw/kCpukLUBrmGR nMVdgiDPSxVll0Ctow8JRTGyaWocQOT24VkUKucGb9RWA6nbIfCVonZm29nsL26fLjaq0+GQK YeO8taZZwag2QmvO4uKBogap6T0F7FgCmPgVa0WTSksBEYcI0jZFthg8IO56LrwwE241EK5El 8i71ZB7RKTMqiIE6+WqCzoQCwO6107MLFoGvyMc2Ia5e4Xn7kdrVuIMBA18T+TweP1NJhtbfb hUNueSp6hofkz0P1ob0vIdOiXBciR0n7gVG83PKWlvIXoVRDS/bkOpcNDoG6uHIVh6jkxNvpJ qDHPYTAIyNerG+M8K2AZSRfppypeJnWGIrA89AVNxboLKYaGCHD2IzEBI+Xhjb3SiliJrNX7u vOk7GRKN464m0nP+CAiu4uSqiTV0XBWOSAfFrpt7t51p8VDsgg3QyR6RfwgM/DBWZtcPl79D7 PVyAL5a2OIjddz9M9b/HON4DA0lr7QtfpiS5MdVF2uyAoDHymWZgsP5v+yuy9etENv1gh6OfQ +uCAVQK1NxvgKbaHH++JnXRlUgTHK4glqq8w9HMRW75qaLV7L3NqxcfVnA6sCi/lNxmz4xt6E TzgpEBIx7kiZ8/MJXouEEEnAxWPtKj9etZuSs4OFVkx7Tjw4mwZ2Mdi3z7gch4VNYbMc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The defxx driver can be configured for different kinds of buses, and appears to be handling this correctly, but the compiler cannot see how it always initializes the bar_start and bar_length fields it uses depending on the configured bus, so we get a warning with recent gcc versions: fddi/defxx.c: In function 'dfx_pci_unregister': fddi/defxx.c:3726:3: warning: 'bar_len' may be used uninitialized in this function [-Wmaybe-uninitialized] release_mem_region(bar_start[0], bar_len[0]); fddi/defxx.c:3701:18: note: 'bar_len' was declared here resource_size_t bar_len[3]; /* resource lengths */ fddi/defxx.c:3726:3: warning: 'bar_start' may be used uninitialized in this function [-Wmaybe-uninitialized] release_mem_region(bar_start[0], bar_len[0]); fddi/defxx.c:3700:18: note: 'bar_start' was declared here resource_size_t bar_start[3]; /* pointers to ports */ ^ fddi/defxx.c: In function 'dfx_pci_register': fddi/defxx.c:617:18: warning: 'bar_len' may be used uninitialized in this function [-Wmaybe-uninitialized] bp->base.mem = ioremap_nocache(bar_start[0], bar_len[0]); fddi/defxx.c:537:18: note: 'bar_len' was declared here resource_size_t bar_len[3]; /* resource length */ fddi/defxx.c:1125:2: warning: 'bar_start' may be used uninitialized in this function [-Wmaybe-uninitialized] pr_info("%s: %s at %s addr = 0x%llx, IRQ = %d, Hardware addr = %pMF\n", fddi/defxx.c:536:18: note: 'bar_start' was declared here resource_size_t bar_start[3]; /* pointers to ports */ This adds code to ensure that the BAR values are initialized even in the impossible case when a device gets probed that does not belong to any bus. This shuts up the warning. Signed-off-by: Arnd Bergmann --- drivers/net/fddi/defxx.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.0 diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c index 7f975a2c8990..e7cdd1226d39 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c @@ -484,6 +484,11 @@ static void dfx_get_bars(struct device *bdev, bar_start[2] = bar_start[1] = 0; bar_len[2] = bar_len[1] = 0; } + if (!(dfx_bus_pci || dfx_bus_eisa || dfx_bus_tc)) { + dev_err(bdev, "invalid bus configuration\n"); + bar_start[2] = bar_start[1] = bar_start[0] = 0; + bar_len[2] = bar_len[1] = bar_len[0] = 0; + } } static const struct net_device_ops dfx_netdev_ops = { From patchwork Wed Jan 27 14:04:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101071 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2603018lbb; Wed, 27 Jan 2016 06:08:01 -0800 (PST) X-Received: by 10.98.93.131 with SMTP id n3mr42639929pfj.9.1453903681422; Wed, 27 Jan 2016 06:08:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k67si9759582pfb.171.2016.01.27.06.08.01; Wed, 27 Jan 2016 06:08:01 -0800 (PST) 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 S932974AbcA0OH6 (ORCPT + 30 others); Wed, 27 Jan 2016 09:07:58 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:62853 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932493AbcA0OHv (ORCPT ); Wed, 27 Jan 2016 09:07:51 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0LjiA5-1ZnA3q0GU5-00boEU; Wed, 27 Jan 2016 15:07:19 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, Jon Mason , linux-kernel@vger.kernel.org Subject: [PATCH 6/9] net: vxge: avoid unused function warnings Date: Wed, 27 Jan 2016 15:04:56 +0100 Message-Id: <1453903507-3427225-7-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:Nlg/1tNSnzmCfDTs0J0PBzcsbTRb8x7R4gnlyXUPZhWvKgAg8FR yK43/rzXUIUTHN2MoVQEMKrXJhycWMjb8zgJ+zorWdBYZ+VLTVtO2lmuiQpfeVwffNKGuym 0UqgiMlLmZvMR4OESj5vT7wNXeSNCEWOzQzypWh4dLQrFq+8mhnoFvUTtfq5kR9X3UZ1A/P mlwaGGM+mHkyiPQZ8ymXQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Fbin2IAb0SM=:LZlUFAvSIplmxAuEeDHoma SIEmx/nhJCmU0YmgJLlAd2WWB+kww5sygopsaSd/93NxE2zZvMBloMspikuG0g4oOcMALXGCL k0Qoe2rUfJj7uR4HFHnA9CR3+Mbjwol7Xy3uJlQaxYrvFtRR+0SrAC71ByV6wS9SeWvaY4MuO /vCbWRJ1Nyd6csRaucGE/M0hEwUnEoUjNj6VSvNeU9qt9W8BMkIhHJZ5uX04F7uC4hf51aSS/ miGSFGNtRevCFVCTYg97LxHEAP3Ahn51eF6p/uBuPMaHtOFSb/+azl/amD5AnZEDUZfV5ebWs 7V5j6Pg4RKnAElm3Jg/gICclnDwGj97ps36mHTbLeEaGqoXJYi7qD8BWmAswp/cB0yaHe4ZWH DCPJjLHPuyXjrbmV22sTi17Que1kGbIByDJEm7V7TXCcqovltpoJP3aNVe+kRsO9S1LufjZjq 0j9nvlO03iMAqrC/KKN2F2eWbSVTfIsr9mvA494x9Yr1Ih6WLMBIvhBRjGGn0KvepVrQonPZ5 QDtVrKyix8LZIOopBQG/ntfOqqQcq5a+U+kf5QxgKIYXUJTjnkZCzvfgzPBgbkFOoanV8wkq5 3CgeBJBqduZ8chtfSXz7P8FBJlcqmTZ4Umj04StSJh5y5ACOkMk/8AlD0LZvAwcoavck7E9mP 3AHOAtdTn0JnDWmL05bUu8gLQ01OujP+UNxpQvGNAeRBT7KEqvwNQ2osUxfAa3NYi4ws= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_PCI_MSI is disabled, we get warnings about unused functions in the vxge driver: drivers/net/ethernet/neterion/vxge/vxge-main.c:2121:13: warning: 'adaptive_coalesce_tx_interrupts' defined but not used [-Wunused-function] drivers/net/ethernet/neterion/vxge/vxge-main.c:2149:13: warning: 'adaptive_coalesce_rx_interrupts' defined but not used [-Wunused-function] We could add another #ifdef here, but it's nicer to avoid those warnings for good by converting the existing #ifdef to if(IS_ENABLED()), which has the same effect but provides better compile-time coverage in general, and lets the compiler understand better when the function is intentionally unused. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/neterion/vxge/vxge-main.c | 31 ++++++++++---------------- 1 file changed, 12 insertions(+), 19 deletions(-) -- 2.7.0 diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 50d5604833ed..e0993eba5df3 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -2223,8 +2223,6 @@ static irqreturn_t vxge_isr_napi(int irq, void *dev_id) return IRQ_NONE; } -#ifdef CONFIG_PCI_MSI - static irqreturn_t vxge_tx_msix_handle(int irq, void *dev_id) { struct vxge_fifo *fifo = (struct vxge_fifo *)dev_id; @@ -2442,16 +2440,13 @@ static void vxge_rem_msix_isr(struct vxgedev *vdev) if (vdev->config.intr_type == MSI_X) pci_disable_msix(vdev->pdev); } -#endif static void vxge_rem_isr(struct vxgedev *vdev) { -#ifdef CONFIG_PCI_MSI - if (vdev->config.intr_type == MSI_X) { + if (IS_ENABLED(CONFIG_PCI_MSI) && + vdev->config.intr_type == MSI_X) { vxge_rem_msix_isr(vdev); - } else -#endif - if (vdev->config.intr_type == INTA) { + } else if (vdev->config.intr_type == INTA) { synchronize_irq(vdev->pdev->irq); free_irq(vdev->pdev->irq, vdev); } @@ -2460,11 +2455,10 @@ static void vxge_rem_isr(struct vxgedev *vdev) static int vxge_add_isr(struct vxgedev *vdev) { int ret = 0; -#ifdef CONFIG_PCI_MSI int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0; int pci_fun = PCI_FUNC(vdev->pdev->devfn); - if (vdev->config.intr_type == MSI_X) + if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) ret = vxge_enable_msix(vdev); if (ret) { @@ -2475,7 +2469,7 @@ static int vxge_add_isr(struct vxgedev *vdev) vdev->config.intr_type = INTA; } - if (vdev->config.intr_type == MSI_X) { + if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) { for (intr_idx = 0; intr_idx < (vdev->no_of_vpath * VXGE_HW_VPATH_MSIX_ACTIVE); intr_idx++) { @@ -2576,9 +2570,8 @@ static int vxge_add_isr(struct vxgedev *vdev) vdev->vxge_entries[intr_cnt].in_use = 1; vdev->vxge_entries[intr_cnt].arg = &vdev->vpaths[0]; } -INTA_MODE: -#endif +INTA_MODE: if (vdev->config.intr_type == INTA) { snprintf(vdev->desc[0], VXGE_INTR_STRLEN, "%s:vxge:INTA", vdev->ndev->name); @@ -3889,12 +3882,12 @@ static void vxge_device_config_init(struct vxge_hw_device_config *device_config, if (max_mac_vpath > VXGE_MAX_MAC_ADDR_COUNT) max_mac_vpath = VXGE_MAX_MAC_ADDR_COUNT; -#ifndef CONFIG_PCI_MSI - vxge_debug_init(VXGE_ERR, - "%s: This Kernel does not support " - "MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME); - *intr_type = INTA; -#endif + if (!IS_ENABLED(CONFIG_PCI_MSI)) { + vxge_debug_init(VXGE_ERR, + "%s: This Kernel does not support " + "MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME); + *intr_type = INTA; + } /* Configure whether MSI-X or IRQL. */ switch (*intr_type) { From patchwork Wed Jan 27 14:04:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101051 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2603122lbb; Wed, 27 Jan 2016 06:08:11 -0800 (PST) X-Received: by 10.66.164.102 with SMTP id yp6mr42093177pab.25.1453903691196; Wed, 27 Jan 2016 06:08:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ui8si9344755pab.38.2016.01.27.06.08.10; Wed, 27 Jan 2016 06:08:11 -0800 (PST) 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 S933030AbcA0OIF (ORCPT + 30 others); Wed, 27 Jan 2016 09:08:05 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:62738 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932971AbcA0OH7 (ORCPT ); Wed, 27 Jan 2016 09:07:59 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0MLWss-1aOyib2WR8-000YsD; Wed, 27 Jan 2016 15:07:27 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, Nicolas Ferre , linux-kernel@vger.kernel.org Subject: [PATCH 7/9] net: macb: avoid uninitialized variables Date: Wed, 27 Jan 2016 15:04:57 +0100 Message-Id: <1453903507-3427225-8-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:pWLipCgDndAP7lGoFNJPGyTxAdbvZi5SzmN1XcLd8TmcWNMqIsT pwImpmNJJSwTB/RIBU9XdOlDBgrA3BEVf4MO50WpRbqhTLmi1i3W55KVTK47rwC0xYinioz TRI2kTEEvyLbs8OSrPY9tam/BavU+hHDrh8aGwfHGmXhyE06J5RQtVXI8yTrNGLqPsFUHJB ym/7+M19NnRN7KQwcR0Hg== X-UI-Out-Filterresults: notjunk:1; V01:K0:HPE7fHPqAA0=:nkVXeLGHde3G/IzlKlGeen lU2NfbK9mgmtYl0b/4L35hwyUk1EuVLaNWyXeB3TD6e2VkBdTeqG/WWnsTeUpS7UOEe74X7Cx U6LqC1/daU5DqyR7iC0Tot9HQQPtxxArkq3MUmY40FOUswVGh5AP/mUO1xFOarRU1uDBk/2S5 GqRln15m1NYZj4fkDlCxr+Xz4a01uW+GVRRlTjr/r0PHLHgZH1gkFOafr41oq6mUZzvRxBhX+ CmCSwL4Dp4gMfIJjPvnPljKkH+McKB0nIq9xPcxcjDNWX10ZvzcKDk+SsYnmXlhjP/MO8wwVW 4EEab3NamfMLd1y1+DbHGNG65MQuJYIWQ5oi0rBiTOuwxZb4ekj/2gES0YUdvZCTyZeWsVkm1 eYpxShvRjXihpufbF2wMT90QHZvfKpfD6qXTjmrYTx/kDOfBMhTkstKLEnzrjnxUubV3Vqfs9 cEPKtyjZo1A43YcngAK+rWrsNyh6m64zZ6vhFHUrrmgVb2WtgNKf8yE8R6NfTH9cJd+VoKWBw yUo5RMjV2yoHvI0XwFlQcTU2jVUFJ0ASDf4dB1bKrUZOzQ69hBcnloNOBoIE0QIamP1al0aXy qDNp97t0Yk2ySlORTQ7+dsFjasxokY/dGzVZAWDO7fj0ptE6Ffo90j24lEIOfPTiwy6Zti/4W /IS01k9PhvSV895aidXAZmHYECVgzMrnTI6g0dU6+NXTq77iQXMzU4wxHt/OGk62kDzg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The macb_clk_init function returns three clock pointers, unless the it fails to get the first ones. We correctly handle the failure case by propagating the error from macb_probe, but gcc does not realize this and incorrectly warns about a later use of those: In file included from /git/arm-soc/drivers/net/ethernet/cadence/macb.c:12:0: drivers/net/ethernet/cadence/macb.c: In function 'macb_probe': include/linux/clk.h:484:2: error: 'tx_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized] clk_disable(clk); ^ drivers/net/ethernet/cadence/macb.c:2822:28: note: 'tx_clk' was declared here struct clk *pclk, *hclk, *tx_clk; ^ In file included from /git/arm-soc/drivers/net/ethernet/cadence/macb.c:12:0: include/linux/clk.h:484:2: error: 'hclk' may be used uninitialized in this function [-Werror=maybe-uninitialized] clk_disable(clk); ^ drivers/net/ethernet/cadence/macb.c:2822:21: note: 'hclk' was declared here struct clk *pclk, *hclk, *tx_clk; ^ This shuts up the misleading warnings by ensuring that the macb_clk_init() always stores something into all three pointers. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/cadence/macb.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.0 Acked-by: Nicolas Ferre diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 9d9984a87d42..d3aa74f9db79 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -2268,6 +2268,7 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk, { int err; + *tx_clk = *hclk = NULL; *pclk = devm_clk_get(&pdev->dev, "pclk"); if (IS_ERR(*pclk)) { err = PTR_ERR(*pclk); From patchwork Wed Jan 27 14:04:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101068 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2603325lbb; Wed, 27 Jan 2016 06:08:28 -0800 (PST) X-Received: by 10.66.102.106 with SMTP id fn10mr43289188pab.60.1453903708714; Wed, 27 Jan 2016 06:08:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fk1si9764814pad.35.2016.01.27.06.08.28; Wed, 27 Jan 2016 06:08:28 -0800 (PST) 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 S933065AbcA0OI0 (ORCPT + 30 others); Wed, 27 Jan 2016 09:08:26 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:51346 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbcA0OIW (ORCPT ); Wed, 27 Jan 2016 09:08:22 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0LzCmv-1a2YHH0W5x-014XKE; Wed, 27 Jan 2016 15:07:50 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, =?utf-8?b?TcOlbnMgUnVsbGfDpXJk?= , linux-kernel@vger.kernel.org Subject: [PATCH 8/9] net: nb8800: avoid uninitialized variable warning Date: Wed, 27 Jan 2016 15:04:58 +0100 Message-Id: <1453903507-3427225-9-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:Zi9m2E7sNbWRHP6o/ojA12AMkfI3oSRNXPbkFH6rQw8krjCqj32 3UtMO+zeoIeGKc+ZkC7k/HYHN6YyoGdlLpMEY7MG4qWzLIMw+kkinh+ZstHGY2HIAglGyuN 49u9rVS0HQGlM0dndbMRjw5GPBlh3e7LzjvITgCvshGVd5kcRxd9o+7C0t2AJBEVMhCpZE5 N6Dp/XQBdA1aoDm13dlZA== X-UI-Out-Filterresults: notjunk:1; V01:K0:D3Nnmw2zh6g=:XgjAu/qfCMMZdSq7jo2Un4 t3CRr36Dpcf6JfiN2Bbl+qvVJPQhgVyuV5DHMrgDNrPDNlNLrz8RxeCgZOfe64lohOTEmGbRk BUzcDFuxiGIf7/bvXmcTDoqgXKoXMyljxPIlZJuoq3YM2yoT9UUZ/GH+Ojz1qdgBgDQHqPCG8 9BrU9CiTVJwMQMkFeQRSLr8X6+SQNZBApQ+GUUbSq2WsL4BSe8bIGIkqrnd+e23Yv+NFRVsbd wNWRdflQUe/MDci1JIuVzhe2CGk2nqDv+EaztwD2/nOASoaRf9If7Nz8wI80Qj9kpN2beiFl1 6UrKxXY1eWOYmdKC78BtWdTVjJKo9gVUAV+oRJA4nY3u8JIZ7aAXs6oXa1OlGPKgDQkNJGioc W7YgDDRgdqSMS3LJIh/lOJ3yJyZVvucohdoULHHkhZ1TfhGwC6b85ultulJEUL1L6AxbOz4P4 +sLa6S4GQ6Cdt5D7BWchYmwhV8IG4hquT9M7API+wtFIY2MaZ+mh5QUdws0aS8LDYEFqFWHce unP4ETvcRzpTNI0JmSVzA0jjyl7DFtPOwPNBf1p1IyZBzxH05teMstlI3xcc1h6UbyKaIRh6G RsTksn9ms4PMcWuv3c+tyRxFO4qGcdEl7YcDRGZn2zFKnE8us3PIGpTYvBATp8PkA/mZmD6M9 /Bd3nY6oC/WeISuoSvf98R2WPIkBoz18bfaPrwG5lpco+jvSmjRQrlpQsLv55M3pX9q0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nb8800_poll() function initializes the 'next' variable in the loop looking for new input data. We know this will be called at least once because 'budget' is a guaranteed to be a positive number when we enter the function, but the compiler doesn't know that and warns when the variable is used later: drivers/net/ethernet/aurora/nb8800.c: In function 'nb8800_poll': drivers/net/ethernet/aurora/nb8800.c:350:21: warning: 'next' may be used uninitialized in this function [-Wmaybe-uninitialized] Changing the 'while() {}' loop to 'do {} while()' makes it obvious to the compiler what is going on so it no longer warns. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/aurora/nb8800.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.0 Acked-by: Mans Rullgard diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c index ecc4a334c507..f71ab2647a3b 100644 --- a/drivers/net/ethernet/aurora/nb8800.c +++ b/drivers/net/ethernet/aurora/nb8800.c @@ -302,7 +302,7 @@ static int nb8800_poll(struct napi_struct *napi, int budget) nb8800_tx_done(dev); again: - while (work < budget) { + do { struct nb8800_rx_buf *rxb; unsigned int len; @@ -330,7 +330,7 @@ again: rxd->report = 0; last = next; work++; - } + } while (work < budget); if (work) { priv->rx_descs[last].desc.config |= DESC_EOC; From patchwork Wed Jan 27 14:04:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101070 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2603639lbb; Wed, 27 Jan 2016 06:08:57 -0800 (PST) X-Received: by 10.98.42.135 with SMTP id q129mr42140357pfq.13.1453903737162; Wed, 27 Jan 2016 06:08:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si1795812pfd.42.2016.01.27.06.08.56; Wed, 27 Jan 2016 06:08:57 -0800 (PST) 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 S933131AbcA0OIv (ORCPT + 30 others); Wed, 27 Jan 2016 09:08:51 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:49522 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932708AbcA0OIn (ORCPT ); Wed, 27 Jan 2016 09:08:43 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0LjiA5-1ZnA4X0nRx-00boEU; Wed, 27 Jan 2016 15:08:00 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , netdev@vger.kernel.org, Prashant Sreedharan , Michael Chan , linux-kernel@vger.kernel.org Subject: [PATCH 9/9] net: tg3: avoid uninitialized variable warning Date: Wed, 27 Jan 2016 15:04:59 +0100 Message-Id: <1453903507-3427225-10-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453903507-3427225-1-git-send-email-arnd@arndb.de> References: <1453903507-3427225-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:Dw2uUYStqQxxR8NotsSB+UQvTkysL85mD0c7HPXXB3Ct78QH6BE XfVPRnbROVPIXTmTUVhB9m2r2dI9oxhja1STXXNOtNWEoFrHatLyr0BcJPS7Nbn1dvcX6NX aLIfAZkSUyxQVQqS4HFS7ZEreVc/FBKz3XeaiaxybXFYeyOoo5ipqK0MidgIR+9v2UdMM/C G4L7N/kl9qDj1yKw6F5gA== X-UI-Out-Filterresults: notjunk:1; V01:K0:idBzTdFgf7Q=:vQRc6zfLBg6/5LJhQ6dr/p ac/+dtY+wUmfkYJ5ivMOmKJ3F0AcTBP5nKewi9nQXm1g+ezfevbVVfOfOPtaVAEvcU3+zbprv yjRpQPlMcZHI6p5ZsUqB7A89FtldmSePCFeH8bxFVYTjLZnu0LRQw5k3lG6nmZSw2sx0AFpoV oa0S4vFbizLeustMHllkUk4VrEcyK3VRWxCp4g+JOdzxYdWpseqHQ/y0Hm3kuSsmfSFqfBI59 vi8/TE/UEQM0Yyxc5gsaqPRO524LjVGfOTuNrBnoNU8sbmJTyPOCPmZkNW+03rRQelEpaOVBc K+zTHHjlLge9VaG5IPBl9UUcuZaKe5QwlTAk03Myzekk1MG8tRlOguLbzhKagfnO5/12mDMl+ WA5AeuPjxTNETZNUDCxtW99/vUkBi20lbEj0LH+OWLxhRAkvih1IfiWcrxTovnDPJ8XPKcNgq 0JhRlBr7jxtKjotcI/gYxHgUa9jsTFf9wKLP3xRjbMXFgByNFcFksXmCiSVpLxiaE4TJiVvPw xMWsFwyB4hbH13NcIuYI12JG9eZ0132Svm6Oh56WDc9wfKPOXyAEAAADck7dpty5pWyAgSlck nijuVBhAjs2tUpH/7cs4KbxeN4fIpX4cwjJ+ddL/K40jeZiAbtCKed5P17aoQzuhTyhcglARd dQ84rcePld8BVbKi/A5ZWlH/f6nVFHavhybOHNC5RsTjzWRUuP5k+UpsgBqyUKVxCiZc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The tg3_set_eeprom() function correctly initializes the 'start' variable, but gcc generates a false warning: drivers/net/ethernet/broadcom/tg3.c: In function 'tg3_set_eeprom': drivers/net/ethernet/broadcom/tg3.c:12057:4: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized] I have not come up with a way to restructure the code in a way that avoids the warning without making it less readable, so this adds an initialization for the declaration to shut up that warning. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/broadcom/tg3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 9293675df7ba..49eea8981332 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -12016,7 +12016,7 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, int ret; u32 offset, len, b_offset, odd_len; u8 *buf; - __be32 start, end; + __be32 start = 0, end; if (tg3_flag(tp, NO_NVRAM) || eeprom->magic != TG3_EEPROM_MAGIC)