All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 2/3] sdio: pass unknown cis tuples to sdio drivers
@ 2009-09-07 18:47 ` Albert Herranz
  0 siblings, 0 replies; 5+ messages in thread
From: Albert Herranz @ 2009-09-07 18:47 UTC (permalink / raw)
  To: bcm43xx-dev; +Cc: linux-mmc, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 12 bytes --]




      

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0117-sdio-pass-unknown-cis-tuples-to-sdio-drivers.patch --]
[-- Type: text/x-patch; name="0117-sdio-pass-unknown-cis-tuples-to-sdio-drivers.patch", Size: 3405 bytes --]

From bb888461dceb85e43b9c1fc9559f012dfeb19688 Mon Sep 17 00:00:00 2001
From: Albert Herranz <albert_herranz@yahoo.es>
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 <albert_herranz@yahoo.es>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH RFC 2/3] sdio: pass unknown cis tuples to sdio drivers
@ 2009-09-07 18:47 ` Albert Herranz
  0 siblings, 0 replies; 5+ messages in thread
From: Albert Herranz @ 2009-09-07 18:47 UTC (permalink / raw)
  To: bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w
  Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA, linux-wireless-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 12 bytes --]




      

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0117-sdio-pass-unknown-cis-tuples-to-sdio-drivers.patch --]
[-- Type: text/x-patch; name="0117-sdio-pass-unknown-cis-tuples-to-sdio-drivers.patch", Size: 3405 bytes --]

From bb888461dceb85e43b9c1fc9559f012dfeb19688 Mon Sep 17 00:00:00 2001
From: Albert Herranz <albert_herranz@yahoo.es>
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 <albert_herranz@yahoo.es>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH RFC 2/3] sdio: pass unknown cis tuples to sdio drivers
  2009-09-07 18:47 ` Albert Herranz
  (?)
  (?)
@ 2009-09-07 18:55 ` Michael Buesch
  2009-09-14 19:52   ` Pierre Ossman
  -1 siblings, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2009-09-07 18:55 UTC (permalink / raw)
  To: Albert Herranz; +Cc: bcm43xx-dev, linux-mmc, linux-wireless

On Monday 07 September 2009 20:47:12 Albert Herranz wrote:
> 
>       

Please also submit to the SDIO maintainer.

-- 
Greetings, Michael.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RFC 2/3] sdio: pass unknown cis tuples to sdio drivers
  2009-09-07 18:47 ` Albert Herranz
  (?)
@ 2009-09-07 18:55 ` Michael Buesch
  -1 siblings, 0 replies; 5+ messages in thread
From: Michael Buesch @ 2009-09-07 18:55 UTC (permalink / raw)
  To: Albert Herranz; +Cc: bcm43xx-dev, linux-mmc, linux-wireless

On Monday 07 September 2009 20:47:12 Albert Herranz wrote:
> 
>       

Please also submit to the SDIO maintainer.

-- 
Greetings, Michael.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RFC 2/3] sdio: pass unknown cis tuples to sdio drivers
  2009-09-07 18:55 ` Michael Buesch
@ 2009-09-14 19:52   ` Pierre Ossman
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Ossman @ 2009-09-14 19:52 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Albert Herranz, bcm43xx-dev, linux-mmc, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

On Mon, 7 Sep 2009 20:55:58 +0200
Michael Buesch <mb@bu3sch.de> wrote:

> On Monday 07 September 2009 20:47:12 Albert Herranz wrote:
> > 
> >       
> 
> Please also submit to the SDIO maintainer.
> 

There isn't one anymore, so submitting to this list is the correct
method.

Rgds
-- 
     -- Pierre Ossman

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-14 19:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-07 18:47 [PATCH RFC 2/3] sdio: pass unknown cis tuples to sdio drivers Albert Herranz
2009-09-07 18:47 ` Albert Herranz
2009-09-07 18:55 ` Michael Buesch
2009-09-07 18:55 ` Michael Buesch
2009-09-14 19:52   ` Pierre Ossman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.