From patchwork Wed Oct 14 11:46:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Cho X-Patchwork-Id: 7392961 X-Patchwork-Delegate: kvalo@adurom.com 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 407A99F37F for ; Wed, 14 Oct 2015 11:48:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7580F2079C for ; Wed, 14 Oct 2015 11:48:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F15E206E8 for ; Wed, 14 Oct 2015 11:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932551AbbJNLsv (ORCPT ); Wed, 14 Oct 2015 07:48:51 -0400 Received: from eusmtp01.atmel.com ([212.144.249.242]:43753 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932433AbbJNLsr (ORCPT ); Wed, 14 Oct 2015 07:48:47 -0400 Received: from tony-itx.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.3.235.1; Wed, 14 Oct 2015 13:48:42 +0200 From: Tony Cho To: CC: , , , , , , , , , , , Subject: [PATCH 15/16] staging: wilc1000: introduce struct wilc_sdio for sdio data Date: Wed, 14 Oct 2015 20:46:43 +0900 Message-ID: <1444823204-16736-15-git-send-email-tony.cho@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444823204-16736-1-git-send-email-tony.cho@atmel.com> References: <1444823204-16736-1-git-send-email-tony.cho@atmel.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 From: Glen Lee This patch introduces struct wilc_sdio for sdio driver data. The wilc_sdio is allocated and set as driver data when the sdio is probed and deallocated when the sdio is removed. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/linux_wlan_sdio.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 5578ab2..7fd53be 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -21,6 +21,10 @@ #define MAX_SPEED (6 * 1000000) /* Max 50M */ #endif +struct wilc_sdio { + struct sdio_func *func; + struct wilc *wilc; +}; struct sdio_func *local_sdio_func; extern int wilc_netdev_init(void); @@ -112,14 +116,22 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd) static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { + struct wilc_sdio *wl_sdio; + PRINT_D(INIT_DBG, "probe function\n"); + wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL); + if (!wl_sdio) + return -ENOMEM; PRINT_D(INIT_DBG, "Initializing netdev\n"); local_sdio_func = func; if (wilc_netdev_init()) { PRINT_ER("Couldn't initialize netdev\n"); + kfree(wl_sdio); return -1; } + wl_sdio->func = func; + sdio_set_drvdata(func, wl_sdio); printk("Driver Initializing success\n"); return 0; @@ -127,7 +139,11 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id static void linux_sdio_remove(struct sdio_func *func) { + struct wilc_sdio *wl_sdio; + + wl_sdio = sdio_get_drvdata(func); wl_wlan_cleanup(); + kfree(wl_sdio); } struct sdio_driver wilc_bus = {