From patchwork Tue Nov 10 23:42:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7592911 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 527BF9F392 for ; Tue, 10 Nov 2015 23:47:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CEC7205F9 for ; Tue, 10 Nov 2015 23:47:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64E27205EB for ; Tue, 10 Nov 2015 23:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752691AbbKJXrG (ORCPT ); Tue, 10 Nov 2015 18:47:06 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:64605 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752046AbbKJXnA (ORCPT ); Tue, 10 Nov 2015 18:43:00 -0500 Received: from wuerfel.lan. ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0MJVXP-1ZyEdR3n5f-0032FY; Wed, 11 Nov 2015 00:42:55 +0100 From: Arnd Bergmann To: Greg Kroah-Hartman Cc: Johnny Kim , Austin Shin , Chris Park , Tony Cho , Glen Lee , Leo Kim , linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 12/20] staging/wilc1000: pass io_type to wilc_netdev_init Date: Wed, 11 Nov 2015 00:42:32 +0100 Message-Id: <1447198960-2760143-13-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.1.0.rc2 In-Reply-To: <1447198960-2760143-1-git-send-email-arnd@arndb.de> References: <1447198960-2760143-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:LcMBOdIAf1JHOmbr9OqW4Z+sjHHWEWeOWN9A4EYba41xdvEQR6e bMwl4w3gKCp93df6mA+pPbAfSL56WMQBbxsEHrmvpYZYLqUN/VIVoMZzoLqnsrj+VQ5qP3J Wu/HRWCO6IKwP1wC6vDLgiEUMT7gdDupyrNQLsFHfAhLxYWO9OhG/7vt8+REyHow7fS7gQ5 OllHeLtFdaB4zrmxUd+rg== X-UI-Out-Filterresults: notjunk:1; V01:K0:QneKJx8+BsM=:kNH1QNRnmdD0xzPWU2vg9k o7B1ZKT5+WXjnFrNdkY0QHPi+7edzvWCPXqheVjxFNsIsgWM2nwUI6pf0BGKToiiEzCMeB74K D+UQ98Kgai8CdNJszsrbSw0gqoGac9t9cfDvie2QfjGD7NgxOZN4lsTc3jxCYgGViCaqpLvHL pxCaBD4EoG+mnBv6sIbkZeC0yMxl8otbiLGaoZbR9zO/n/CqZuhgK1ske2Cw6OSYyT92aKh/P xtWDLW0RLOJ/jMqRNQ+VYQeKlFgOFUkNLWxWKI0WLwy8wHGxX7GZ2X6AcS0lXyUgEwZyD9WEg iNmUO3nbs4vGLhv/uyQm1tXI2H4/8ImMs5qKQbyGvHTUw3lMzZuTPsyPvDBrGM/meASDZ6Soq WLkFtVxq7ennO2dj4tdFMNlL8UEpmDhLf9GFVy7rQPIVf/3D3UGtE8meDDu47RE2HRFPbTyqq Ib0L7ZMU93Ped46uYtOrT/iougkH8AKcqvfSSsgJQ2/aqFX0AxyMf7RRYSzyE21aEjehqp3xG kkXrgipKMwLmZ4b8bBptc9d5smFHvW2A4kfKy46HHDQMK/15Wf65PSCFaL3W5fLuwVDq9kaaY TjZjKma1+yRm3hYzFc33gTNluBqxblE6wBCMgZ00OgXk3sA/BbGmWCi5JLEWJro/1sx+LU8vE Q15PQHTfudiwcTk0BXkz+/Xt7pGzMZAjTwy+wRD/ImXtUEmFi5ExBWYptCYz7To8eFVU= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to avoid some of the #ifdefs, this passes the io_type and device pointer as an argument to wilc_netdev_init. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/linux_wlan.c | 18 ++++-------------- drivers/staging/wilc1000/linux_wlan_sdio.c | 4 ++-- drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index faad01f6f2d1..b1707147aa7d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -25,11 +25,7 @@ #include -#ifdef WILC_SDIO #include "linux_wlan_sdio.h" -#else -#include "linux_wlan_spi.h" -#endif static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr); @@ -884,11 +880,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) wlan_init_locks(dev); -#ifdef WILC_SDIO - wl->io_type = HIF_SDIO; -#else - wl->io_type = HIF_SPI; -#endif ret = wilc_wlan_init(dev); if (ret < 0) { PRINT_ER("Initializing WILC_Wlan FAILED\n"); @@ -1426,7 +1417,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) #endif } -int wilc_netdev_init(struct wilc **wilc) +int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type) { int i; perInterface_wlan_t *nic; @@ -1439,7 +1430,7 @@ int wilc_netdev_init(struct wilc **wilc) return -ENOMEM; *wilc = wilc_dev; - + wilc_dev->io_type = io_type; register_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { @@ -1468,9 +1459,8 @@ int wilc_netdev_init(struct wilc **wilc) struct wireless_dev *wdev; wdev = wilc_create_wiphy(ndev); - #ifdef WILC_SDIO - SET_NETDEV_DEV(ndev, &wilc_sdio_func->dev); - #endif + if (dev) + SET_NETDEV_DEV(ndev, dev); if (!wdev) { PRINT_ER("Can't register WILC Wiphy\n"); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 8df69b2aff2d..d2843b949a1b 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -1,4 +1,5 @@ #include "wilc_wfi_netdevice.h" +#include "linux_wlan_sdio.h" #include #include @@ -113,7 +114,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id PRINT_D(INIT_DBG, "Initializing netdev\n"); wilc_sdio_func = func; - if (wilc_netdev_init(&wilc)) { + if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO)) { PRINT_ER("Couldn't initialize netdev\n"); return -1; } @@ -215,7 +216,6 @@ int wilc_sdio_set_default_speed(void) return linux_sdio_set_speed(sdio_default_speed); } - static int __init init_wilc_sdio_driver(void) { return sdio_register_driver(&wilc_bus); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 29dd9d4e5ff0..a459c502a8a8 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -9,9 +9,9 @@ #include #include +#include "linux_wlan_spi.h" #include "wilc_wfi_netdevice.h" #include "linux_wlan_common.h" -#include "linux_wlan_spi.h" #include "wilc_wlan_if.h" #define USE_SPI_DMA 0 /* johnny add */ @@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void) wilc_debugfs_init(); - ret = wilc_netdev_init(&wilc); + ret = wilc_netdev_init(&wilc, NULL, HIF_SPI); if (ret) { wilc_debugfs_remove(); return ret; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index a099f2877b6e..eae9ce175351 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -213,7 +213,7 @@ void linux_wlan_rx_complete(void); void linux_wlan_dbg(u8 *buff); int linux_wlan_lock_timeout(void *vp, u32 timeout); void wilc_netdev_cleanup(struct wilc *wilc); -int wilc_netdev_init(struct wilc **wilc); +int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value);