From patchwork Wed Nov 18 06:11:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glen Lee X-Patchwork-Id: 7644921 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 6067F9F392 for ; Wed, 18 Nov 2015 06:09:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 828CC20630 for ; Wed, 18 Nov 2015 06:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E52A2062B for ; Wed, 18 Nov 2015 06:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754756AbbKRGJQ (ORCPT ); Wed, 18 Nov 2015 01:09:16 -0500 Received: from eusmtp01.atmel.com ([212.144.249.242]:20665 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754391AbbKRGJP (ORCPT ); Wed, 18 Nov 2015 01:09:15 -0500 Received: from glen-ubuntu.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, 18 Nov 2015 07:09:09 +0100 From: Glen Lee To: CC: , , , , , , , , Subject: [PATCH 09/16] staging: wilc1000: wilc_spi_read: pass struct wilc Date: Wed, 18 Nov 2015 15:11:30 +0900 Message-ID: <1447827097-9436-10-git-send-email-glen.lee@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447827097-9436-1-git-send-email-glen.lee@atmel.com> References: <1447827097-9436-1-git-send-email-glen.lee@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=-7.5 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 This patch adds new function parameter struct wilc and use it instead of global variable wilc_dev, and pass wilc to the functions as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++-- drivers/staging/wilc1000/linux_wlan_spi.h | 2 +- drivers/staging/wilc1000/wilc_spi.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 7be750b..5066191 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -112,9 +112,9 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) return ret; } -int wilc_spi_read(u8 *rb, u32 rlen) +int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) { - struct spi_device *spi = to_spi_device(wilc_dev->dev); + struct spi_device *spi = to_spi_device(wilc->dev); int ret; if (rlen > 0) { diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index 41d47dc..16f0b9f 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -6,6 +6,6 @@ int wilc_spi_init(void); int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len); -int wilc_spi_read(u8 *rb, u32 rlen); +int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen); int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen); #endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 0d89a282..f5db2fc 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -365,7 +365,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (!wilc_spi_read(&b[ix], nbytes)) { + if (!wilc_spi_read(wilc, &b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; goto _error_; @@ -375,7 +375,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_read(crc, 2)) { + if (!wilc_spi_read(wilc, crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; goto _error_; @@ -406,7 +406,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, **/ retry = 10; do { - if (!wilc_spi_read(&rsp, 1)) { + if (!wilc_spi_read(wilc, &rsp, 1)) { PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); result = N_FAIL; break; @@ -422,7 +422,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (!wilc_spi_read(&b[ix], nbytes)) { + if (!wilc_spi_read(wilc, &b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; break; @@ -432,7 +432,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_read(crc, 2)) { + if (!wilc_spi_read(wilc, crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; break;