Skip to contentSkip to conversation

Convert CS4236B driver - 2.5.44 (3/4)

PATCH New Adam Belay 1 participant 1 message Oct 23, 2002

Subsystems (2)
lore
Share & tools
lore

Adam Belay

author
#0 lore raw

PATCH 1/1 Convert CS4236B driver - 2.5.44 (3/4)

This patch converts the CS4236B sound card driver to the new PnP APIs. Also it makes pnp_driver_register return the number of matches during the driver add. This should serve as a sample driver, along with the serial and parport_pc.

Applies against 2.5.44.

Thanks,
Adam

drivers/pnp/driver.c +11 -1
diff -ur a/drivers/pnp/driver.c b/drivers/pnp/driver.c
@@ -151,6 +151,8 @@
 int pnp_register_driver(struct pnp_driver *drv)
 {
 	int count;
+	struct list_head *pos;
+
 	pnp_dbg("the driver '%s' has been registered", drv->name);
 
 	drv->driver.name = drv->name;
@@ -159,7 +161,15 @@
 	drv->driver.remove = pnp_device_remove;
 
 	count = driver_register(&drv->driver);
-	return count ? count : 1;
+
+	/* get the number of initial matches */
+	if (count >= 0){
+		count = 0;
+		list_for_each(pos,&drv->driver.devices){
+			count++;
+		}
+	}
+	return count;
 }
 
 void pnp_unregister_driver(struct pnp_driver *drv)
include/linux/pnp.h +0 -1
diff -ur a/include/linux/pnp.h b/include/linux/pnp.h
@@ -94,7 +94,6 @@
 	int  (*probe)  (struct pnp_dev *dev, const struct pnp_id *card_id,
 		 	const struct pnp_id *dev_id);
 	void (*remove) (struct pnp_dev *dev);
-	struct device * (*legacy) (void);
 	struct device_driver	driver;
 };
 
sound/oss/ad1848.c +0 -5
diff -ur a/sound/oss/ad1848.c b/sound/oss/ad1848.c
@@ -3026,8 +3026,6 @@
 {
 	char *busname = bus->name[0] ? bus->name : ad1848_isapnp_list[slot].name;
 
-	printk(KERN_INFO "ad1848: %s detected\n", busname);
-
 	/* Initialize this baby. */
 
 	if(ad1848_init_generic(bus, hw_config, slot)) {
@@ -3039,9 +3037,6 @@
 		       hw_config->dma2);
 		return 1;
 	}
-	else
-		printk(KERN_INFO "ad1848: Failed to initialize %s\n", busname);
-
 	return 0;
 }
 
sound/oss/cs4232.c +34 -54

179 lines not on this page · raw message