[parisc-linux-cvs] tidy register_parisc_device
Matthew Wilcox
willy@ldl.fc.hp.com
Thu, 04 Oct 2001 17:30:48 -0600
-pa39.
Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/drivers.c,v
retrieving revision 1.26
diff -u -p -r1.26 drivers.c
--- drivers.c 2001/10/02 20:58:42 1.26
+++ drivers.c 2001/10/04 23:19:12
@@ -244,24 +244,18 @@ int register_parisc_device(struct parisc
return 1;
write_lock(&pa_lock);
-
- driver = pa_drivers;
-
+
/* Locate a driver which agrees to manage this device. */
- while (driver) {
- if (match_device(driver, dev)) {
- if (driver->probe(dev) == 0) {
- dev->driver = driver;
- write_unlock(&pa_lock);
- return 1;
- }
- }
- driver = driver->next;
+ for (driver = pa_drivers; driver; driver = driver->next) {
+ if (!match_device(driver,dev))
+ continue;
+ if (driver->probe(dev) == 0)
+ break;
}
+ dev->driver = driver;
write_unlock(&pa_lock);
-
- return 0;
+ return driver != NULL;
}