LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Add SDIO 'type' parameter to sysfs
@ 2008-02-22 17:46 Andy Shevchenko
  2008-02-23  2:47 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2008-02-22 17:46 UTC (permalink / raw)
  To: linux-kernel

Hi!

Add 'type' attribute of the SDIO device to represent Standard Function
interface code in the human readable form.
---
 drivers/mmc/core/sdio_bus.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 233d0f9..db8990d 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -24,6 +24,35 @@
 #define to_sdio_driver(d)      container_of(d, struct sdio_driver, drv)
 
 /* show configuration fields */
+static ssize_t type_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	struct sdio_func *func;
+
+	func = dev_to_sdio_func (dev);
+
+	switch (func->class) {
+		case 0x0:
+			return sprintf (buf, "Non-standard");
+		case 0x1:
+			return sprintf (buf, "UART");
+		case 0x2:
+			return sprintf (buf, "Bluetooth (Type-A)");
+		case 0x3:
+			return sprintf (buf, "Bluetooth (Type-B)");
+		case 0x4:
+			return sprintf (buf, "GPS");
+		case 0x5:
+			return sprintf (buf, "Camera");
+		case 0x6:
+			return sprintf (buf, "PHS");
+		case 0x7:
+			return sprintf (buf, "WLAN");
+	}
+	/* 0x08-0x0E Reserved for future */
+	return sprintf (buf, "Reserved");
+}
+
 #define sdio_config_attr(field, format_string)				\
 static ssize_t								\
 field##_show(struct device *dev, struct device_attribute *attr, char *buf)				\
@@ -47,6 +76,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 }
 
 static struct device_attribute sdio_dev_attrs[] = {
+	__ATTR_RO(type),
 	__ATTR_RO(class),
 	__ATTR_RO(vendor),
 	__ATTR_RO(device),
-- 
1.5.2.5

-- 
With best regards,
Andy Shevchenko.      mailto: andy@smile.org.ua



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

* Re: [PATCH] Add SDIO 'type' parameter to sysfs
  2008-02-22 17:46 [PATCH] Add SDIO 'type' parameter to sysfs Andy Shevchenko
@ 2008-02-23  2:47 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2008-02-23  2:47 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel

Hi Andy,

> Add 'type' attribute of the SDIO device to represent Standard Function
> interface code in the human readable form.

these kind of things should not be part of the Linux kernel. A  
userspace tool (call it lssdio if you want) should handle it.

Regards

Marcel


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

end of thread, other threads:[~2008-02-23  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-22 17:46 [PATCH] Add SDIO 'type' parameter to sysfs Andy Shevchenko
2008-02-23  2:47 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).