From patchwork Mon Sep 7 18:47:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Albert Herranz X-Patchwork-Id: 46132 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n87IrviB015810 for ; Mon, 7 Sep 2009 18:53:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754218AbZIGSxw (ORCPT ); Mon, 7 Sep 2009 14:53:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754223AbZIGSxw (ORCPT ); Mon, 7 Sep 2009 14:53:52 -0400 Received: from web28308.mail.ukl.yahoo.com ([87.248.110.127]:32797 "HELO web28308.mail.ukl.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754217AbZIGSxv (ORCPT ); Mon, 7 Sep 2009 14:53:51 -0400 Received: (qmail 95663 invoked by uid 60001); 7 Sep 2009 18:47:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s1024; t=1252349233; bh=sX9+smG/Jd5i8OEtj8EY6SpPa6Tz5JB2Ik3GJeGZ3o0=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=CFgnrsrw9M4U1X1b/2j1YL5Rg4joRyJ8OR/g5tUb9HZKPKdbVCAx+tlqCj626dEOXo8zBALJCn0PEqf7O3aYm9m9j7l0zl2msxbgS7nnjgD+S03/nTtwI0qPgtkMhdlc7o2IhnGeQTLrld9m4+sJhzw/un8Y4gIsJy+a0LmV0FU= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.es; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=uqMwoELl1/TqzvSTeFCN3ZvU2n36FTcMYLWQ/SJdrfV7d4HKrNI59VYUcggpkbYYrcIPJjBI4JFwdCAmQTSD/GMaudvKMRZqi1fnDIVvGGDPneW+Zuiw6kJAeMDXu1nntsUkH/owKxH4dw1oX+oDD58/+53gMQMj1X1OML3KERU=; Message-ID: <80555.93921.qm@web28308.mail.ukl.yahoo.com> X-YMail-OSG: nci6LM4VM1mGzFXRu20PDzi7rYFqX5UF2lzmbLVzwJmEvEOexcZOFh6Qay3s_o.AnfG.pvWiQ4ui_zpcC.YdUtN839CvPEIayJvUBsxvHDlI150K43F.eHYw3YX02oi1dak6nd85azT94JuAyz98g8wsbEP6hWTIa1NYYoTb7F4js5WHgEIhR9tZbDkO3f3AglcAUfZcLbjOPv67ngrTNfENt1vAOX6.3zsMA8S3.TyRjcS5h26zo37Polajo_MWk7BoylIZx8cTRDoFJyHuik7ndlrKVt1TCXYdpS_3IIB4zIXU4OxFojM9DMURc5S4DceciQ-- Received: from [81.38.33.208] by web28308.mail.ukl.yahoo.com via HTTP; Mon, 07 Sep 2009 18:47:12 GMT X-Mailer: YahooMailClassic/6.1.2 YahooMailWebService/0.7.338.2 Date: Mon, 7 Sep 2009 18:47:12 +0000 (GMT) From: Albert Herranz Subject: [PATCH RFC 2/3] sdio: pass unknown cis tuples to sdio drivers To: bcm43xx-dev@lists.berlios.de Cc: linux-mmc@vger.kernel.org, linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From bb888461dceb85e43b9c1fc9559f012dfeb19688 Mon Sep 17 00:00:00 2001 From: Albert Herranz Date: Tue, 18 Aug 2009 21:24:11 +0200 Subject: [PATCH] sdio: pass unknown cis tuples to sdio drivers Some manufactures provide vendor information in non-vendor specific CIS tuples. For example, Broadcom uses an Extended Function tuple to provide the MAC address on some of their network cards, as in the case of the Nintendo Wii WLAN daughter card. This patch allows passing correct tuples unknown to the SDIO core to a matching SDIO driver instead of rejecting them and failing. Signed-off-by: Albert Herranz --- drivers/mmc/core/sdio_cis.c | 46 +++++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c index 963f293..87934ac 100644 --- a/drivers/mmc/core/sdio_cis.c +++ b/drivers/mmc/core/sdio_cis.c @@ -123,8 +123,9 @@ static int cistpl_funce_func(struct sdio_func *func, vsn = func->card->cccr.sdio_vsn; min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42; + /* let the SDIO driver take care of unknown tuples */ if (size < min_size || buf[0] != 1) - return -EINVAL; + return -EILSEQ; /* TPLFE_MAX_BLK_SIZE */ func->max_blksize = buf[12] | (buf[13] << 8); @@ -154,13 +155,7 @@ static int cistpl_funce(struct mmc_card *card, struct sdio_func *func, else ret = cistpl_funce_common(card, buf, size); - if (ret) { - printk(KERN_ERR "%s: bad CISTPL_FUNCE size %u " - "type %u\n", mmc_hostname(card->host), size, buf[0]); - return ret; - } - - return 0; + return ret; } typedef int (tpl_parse_t)(struct mmc_card *, struct sdio_func *, @@ -253,21 +248,12 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func) for (i = 0; i < ARRAY_SIZE(cis_tpl_list); i++) if (cis_tpl_list[i].code == tpl_code) break; - if (i >= ARRAY_SIZE(cis_tpl_list)) { - /* this tuple is unknown to the core */ - this->next = NULL; - this->code = tpl_code; - this->size = tpl_link; - *prev = this; - prev = &this->next; - printk(KERN_DEBUG - "%s: queuing CIS tuple 0x%02x length %u\n", - mmc_hostname(card->host), tpl_code, tpl_link); - } else { + if (i < ARRAY_SIZE(cis_tpl_list)) { const struct cis_tpl *tpl = cis_tpl_list + i; if (tpl_link < tpl->min_size) { printk(KERN_ERR - "%s: bad CIS tuple 0x%02x (length = %u, expected >= %u)\n", + "%s: bad CIS tuple 0x%02x" + " (length = %u, expected >= %u)\n", mmc_hostname(card->host), tpl_code, tpl_link, tpl->min_size); ret = -EINVAL; @@ -275,7 +261,25 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func) ret = tpl->parse(card, func, this->data, tpl_link); } - kfree(this); + /* already successfully parsed, not needed anymore */ + if (!ret) + kfree(this); + } else { + /* unknown tuple */ + ret = -EILSEQ; + } + + if (ret == -EILSEQ) { + /* this tuple is unknown to the core */ + this->next = NULL; + this->code = tpl_code; + this->size = tpl_link; + *prev = this; + prev = &this->next; + pr_debug("%s: queuing CIS tuple 0x%02x length %u\n", + mmc_hostname(card->host), tpl_code, tpl_link); + /* keep on analyzing tuples */ + ret = 0; } ptr += tpl_link; -- 1.6.0.4