Re: Warning/Oops report of the week of September 16th, 2008

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Cox
Date: Friday, September 26, 2008 - 3:28 am

> In the meantime, that warning is just best ignored entirely. It's not a 

How about a quickfix for the moment. This ought to do the job. BTW I
disagree that the link should be to first, it would be best a link to the
active driver IMHO.

Has been Torvalds-tested only (ie it compiled)

--

parport: quickfix the proc registration bug

From: Alan Cox <alan@redhat.com>

Ideally we should have a directory of drivers and a link to the 'active'
driver. For now just show the first device which is effectively the existing
semantics without a warning.

Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/parport/share.c   |   13 ++++++++++---
 drivers/serial/8250_pci.c |    4 ++--
 include/linux/parport.h   |    4 ++++
 3 files changed, 16 insertions(+), 5 deletions(-)


diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index a8a62bb..0750dcb 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -614,7 +614,10 @@ parport_register_device(struct parport *port, const char *name,
 	 * pardevice fields. -arca
 	 */
 	port->ops->init_state(tmp, tmp->state);
-	parport_device_proc_register(tmp);
+	if (test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
+		port->proc_device = tmp;
+		parport_device_proc_register(tmp);
+	}
 	return tmp;
 
  out_free_all:
@@ -646,10 +649,14 @@ void parport_unregister_device(struct pardevice *dev)
 	}
 #endif
 
-	parport_device_proc_unregister(dev);
-
 	port = dev->port->physport;
 
+	if (port->proc_device == dev) {
+		port->proc_device = NULL;
+		clear_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags);
+		parport_device_proc_unregister(dev);
+	}
+
 	if (port->cad == dev) {
 		printk(KERN_DEBUG "%s: %s forgot to release port\n",
 		       port->name, dev->name);
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 6a0d7cd..986252e 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -326,6 +326,10 @@ struct parport {
 	int spintime;
 	atomic_t ref_count;
 
+	unsigned long devflags;
+#define PARPORT_DEVPROC_REGISTERED	0
+	struct pardevice *proc_device;	/* Currently register proc device */
+
 	struct list_head full_list;
 	struct parport *slaves[3];
 };
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Warning/Oops report of the week of September 16th, 2008, Arjan van de Ven, (Tue Sep 16, 9:22 am)
Re: Warning/Oops report of the week of September 16th, 2008, Arjan van de Ven, (Wed Sep 24, 3:57 pm)
Re: Warning/Oops report of the week of September 16th, 2008, Alan Cox, (Fri Sep 26, 3:28 am)