[additional patch for -mm 1/1] pcmcia: work around bug in libsysfs

Dominik Brodowski linux at dominikbrodowski.net
Wed May 4 10:40:17 EDT 2005


Work around a bug in sysfsutils -- before writing, it checks whether the
content is already the same in the file. It does _not_ check whether the
size of the content is the same, meaning that zero-size files never get
anything written to. While it'll be fixed in sysfsutils-1.3.0, work around
this bug nonetheless.

Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>

Index: 2.6.12-rc3+/drivers/pcmcia/rsrc_nonstatic.c
===================================================================
--- 2.6.12-rc3+.orig/drivers/pcmcia/rsrc_nonstatic.c	2005-05-04 11:34:18.000000000 +0200
+++ 2.6.12-rc3+/drivers/pcmcia/rsrc_nonstatic.c	2005-05-04 11:35:22.000000000 +0200
@@ -882,6 +882,10 @@
 
 	down(&rsrc_sem);
 	data = s->resource_data;
+	if (data->io_db.next == &data->io_db) {
+		up(&rsrc_sem);
+		return sprintf(buf, "<none>\n");
+	}
 
 	for (p = data->io_db.next; p != &data->io_db; p = p->next) {
 		if (ret > (PAGE_SIZE - 10))
@@ -934,6 +938,10 @@
 
 	down(&rsrc_sem);
 	data = s->resource_data;
+	if (data->mem_db.next == &data->mem_db) {
+		up(&rsrc_sem);
+		return sprintf(buf, "<none>\n");
+	}
 
 	for (p = data->mem_db.next; p != &data->mem_db; p = p->next) {
 		if (ret > (PAGE_SIZE - 10))



More information about the linux-pcmcia mailing list