From patchwork Mon Dec 21 05:18:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glen Lee X-Patchwork-Id: 7893181 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 59053BEEE5 for ; Mon, 21 Dec 2015 05:16:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4ED37202E9 for ; Mon, 21 Dec 2015 05:16:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 31222202B8 for ; Mon, 21 Dec 2015 05:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751191AbbLUFQf (ORCPT ); Mon, 21 Dec 2015 00:16:35 -0500 Received: from eusmtp01.atmel.com ([212.144.249.243]:11424 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750840AbbLUFQf (ORCPT ); Mon, 21 Dec 2015 00:16:35 -0500 Received: from glen-ubuntu.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server id 14.3.235.1; Mon, 21 Dec 2015 06:16:31 +0100 From: Glen Lee To: CC: , , , , , , , , Subject: [PATCH RESEND 15/46] staging: wilc1000: wilc_sdio_cmd52: return linux error value Date: Mon, 21 Dec 2015 14:18:19 +0900 Message-ID: <1450675130-17866-16-git-send-email-glen.lee@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450675130-17866-1-git-send-email-glen.lee@atmel.com> References: <1450675130-17866-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=-6.9 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 changes return value with linux error value, not 1 or 0. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan_sdio.c | 6 ++-- drivers/staging/wilc1000/wilc_sdio.c | 51 +++++++++++++++++++----------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index a918de9..e25811d 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -51,11 +51,9 @@ int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd) sdio_release_host(func); - if (ret < 0) { + if (ret) dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret); - return 0; - } - return 1; + return ret; } diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index d1b023a..fa1adcf 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -38,6 +38,7 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; + int ret; /** * Review: BIG ENDIAN @@ -47,21 +48,24 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) cmd.raw = 0; cmd.address = 0x10c; cmd.data = (u8)adr; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10c data...\n"); goto _fail_; } cmd.address = 0x10d; cmd.data = (u8)(adr >> 8); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10d data...\n"); goto _fail_; } cmd.address = 0x10e; cmd.data = (u8)(adr >> 16); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10e data...\n"); goto _fail_; } @@ -75,20 +79,23 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; + int ret; cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; cmd.address = 0x10; cmd.data = (u8)block_size; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10 data...\n"); goto _fail_; } cmd.address = 0x11; cmd.data = (u8)(block_size >> 8); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x11 data...\n"); goto _fail_; } @@ -108,19 +115,22 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; + int ret; cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; cmd.address = 0x110; cmd.data = (u8)block_size; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x110 data...\n"); goto _fail_; } cmd.address = 0x111; cmd.data = (u8)(block_size >> 8); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x111 data...\n"); goto _fail_; } @@ -150,7 +160,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.raw = 0; cmd.address = addr; cmd.data = data; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; @@ -288,7 +299,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.function = 0; cmd.raw = 0; cmd.address = addr; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; @@ -430,7 +442,7 @@ static int sdio_init(struct wilc *wilc) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; - int loop; + int loop, ret; u32 chipid; memset(&g_sdio, 0, sizeof(wilc_sdio_t)); @@ -452,7 +464,8 @@ static int sdio_init(struct wilc *wilc) cmd.raw = 1; cmd.address = 0x100; cmd.data = 0x80; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, enable csa...\n"); goto _fail_; } @@ -474,7 +487,8 @@ static int sdio_init(struct wilc *wilc) cmd.raw = 1; cmd.address = 0x2; cmd.data = 0x2; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, set IOE register...\n"); goto _fail_; @@ -490,7 +504,8 @@ static int sdio_init(struct wilc *wilc) loop = 3; do { cmd.data = 0; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, get IOR register...\n"); goto _fail_; @@ -520,7 +535,8 @@ static int sdio_init(struct wilc *wilc) cmd.raw = 1; cmd.address = 0x4; cmd.data = 0x3; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, set IEN register...\n"); goto _fail_; } @@ -548,7 +564,6 @@ _fail_: static int sdio_read_size(struct wilc *wilc, u32 *size) { - u32 tmp; sdio_cmd52_t cmd; @@ -667,7 +682,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.data = reg; ret = wilc_sdio_cmd52(wilc, &cmd); - if (!ret) { + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); @@ -697,7 +712,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.data = BIT(i); ret = wilc_sdio_cmd52(wilc, &cmd); - if (!ret) { + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); @@ -744,7 +759,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.address = 0xf6; cmd.data = vmm_ctl; ret = wilc_sdio_cmd52(wilc, &cmd); - if (!ret) { + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__);