[patches 7/8] pcmcia: modify irq_mask via sysfs
Dominik Brodowski
linux at dominikbrodowski.de
Tue Jan 11 11:59:08 EST 2005
Allow to modify the per-socket irq_mask via sysfs. Note that you can only
clear bits from the mask, but not re-add bits.
Signed-off-by: Dominik Brodowski <linux at brodo.de>
---
drivers/pcmcia/socket_sysfs.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+)
Index: 2.6.10/drivers/pcmcia/socket_sysfs.c
===================================================================
--- 2.6.10.orig/drivers/pcmcia/socket_sysfs.c 2004-12-26 18:03:04.235952106 +0100
+++ 2.6.10/drivers/pcmcia/socket_sysfs.c 2004-12-26 18:03:18.722898460 +0100
@@ -122,6 +122,33 @@
static CLASS_DEVICE_ATTR(card_eject, 0200, NULL, pccard_store_eject);
+static ssize_t pccard_show_irq_mask(struct class_device *dev, char *buf)
+{
+ struct pcmcia_socket *s = to_socket(dev);
+ return sprintf(buf, "0x%04x\n", s->irq_mask);
+}
+
+static ssize_t pccard_store_irq_mask(struct class_device *dev, const char *buf, size_t count)
+{
+ ssize_t ret;
+ struct pcmcia_socket *s = to_socket(dev);
+ u32 mask;
+
+ if (!count)
+ return -EINVAL;
+
+ ret = sscanf (buf, "0x%x\n", &mask);
+
+ if (ret == 1) {
+ s->irq_mask &= mask;
+ ret = 0;
+ }
+
+ return ret ? ret : count;
+}
+static CLASS_DEVICE_ATTR(card_irq_mask, 0600, pccard_show_irq_mask, pccard_store_irq_mask);
+
+
static struct class_device_attribute *pccard_socket_attributes[] = {
&class_device_attr_card_type,
&class_device_attr_card_voltage,
@@ -129,6 +156,7 @@
&class_device_attr_card_vcc,
&class_device_attr_card_insert,
&class_device_attr_card_eject,
+ &class_device_attr_card_irq_mask,
NULL,
};
More information about the linux-pcmcia
mailing list