Skip to contentSkip to conversation

MCA sysfs part V - update smc-mca driver (and updates to API)

PATCH New J.E.J. Bottomley 1 participant 1 message Nov 23, 2002 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MCA sysfs part V - update smc-mca driver (and updates to API)

This tidies up the mca driver API and places it into its own file.

The main part converts the smc-mca driver to using the sysfs probe interface (and thus no-longer needs its entry in Space.c). I had to rename the io and irq parameters to be ultra_io and ultra_irq to prevent clashes.

I think this one concludes all the modifications to drivers of actual MCA cards I have access to.

James

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.847 -> 1.850
# drivers/net/Space.c 1.12 -> 1.13
# drivers/net/smc-mca.c 1.6 -> 1.7
# drivers/mca/mca-bus.c 1.2 -> 1.3

#	 include/linux/mca.h	1.4     -> 1.5    
#	drivers/mca/Makefile	1.2     -> 1.3    
#	               (new)	        -> 1.1     drivers/mca/mca-driver.c

#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/11/22 jejb@mulgrave.(none) 1.848

# add mca-driver handling
# 
# Tidies up the handling of MCA drivers
# --------------------------------------------
# 02/11/22	jejb@mulgrave.(none)	1.849
# update smc-mca to new MCA API
# 
# This updates to the new API and means that smc-mca is now probed similarly to a PCI device
# --------------------------------------------
# 02/11/22	jejb@mulgrave.(none)	1.850
# add mca-driver.c file
# --------------------------------------------
#
diff -Nru a/drivers/mca/Makefile b/drivers/mca/Makefile
--- a/drivers/mca/Makefile	Fri Nov 22 20:02:17 2002
+++ b/drivers/mca/Makefile	Fri Nov 22 20:02:17 2002
@@ -1,9 +1,9 @@
 # Makefile for the Linux MCA bus support

-obj-y := mca-bus.o mca-device.o mca-legacy.o
+obj-y := mca-bus.o mca-device.o mca-driver.o mca-legacy.o

obj-$(CONFIG_PROC_FS) += mca-proc.o

-export-objs := mca-bus.o mca-legacy.o mca-proc.o
+export-objs := mca-bus.o mca-legacy.o mca-proc.o mca-driver.o

include $(TOPDIR)/Rules.make

drivers/mca/mca-bus.c +6 -28
diff -Nru a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c
@@ -30,8 +30,6 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/list.h>
-#include <asm/io.h>
 
 /* Very few machines have more than one MCA bus.  However, there are
  * those that do (Voyager 35xx/5xxx), so we do it this way for future
@@ -50,15 +48,16 @@
 	struct mca_device *mca_dev = to_mca_device (dev);
 	struct mca_driver *mca_drv = to_mca_driver (drv);
 	const short *mca_ids = mca_drv->id_table;
+	int i;
 
 	if (!mca_ids)
 		return 0;
 
-	while (*mca_ids) {
-		if (*mca_ids == mca_dev->pos_id)
+	for(i = 0; mca_ids[i]; i++) {
+		if (mca_ids[i] == mca_dev->pos_id) {
+			mca_dev->index = i;
 			return 1;
-
-		mca_ids++;
+		}
 	}
 
 	return 0;
@@ -70,24 +69,6 @@
 };
 EXPORT_SYMBOL (mca_bus_type);
 
-int mca_driver_register (struct mca_driver *mca_drv)
-{
-	int r;
-	
-	mca_drv->driver.bus = &mca_bus_type;
-	if ((r = driver_register (&mca_drv->driver)) < 0)
-		return r;
-
-	return 1;
-}
-
-void mca_driver_unregister (struct mca_driver *mca_drv)
-{
-	bus_remove_driver (&mca_drv->driver);
-	driver_unregister (&mca_drv->driver);
-}
-
-
 static ssize_t mca_show_pos_id(struct device *dev, char *buf, size_t count,
 			       loff_t off)
 {
@@ -135,7 +116,7 @@
 static DEVICE_ATTR(id, S_IRUGO, mca_show_pos_id, NULL);
 static DEVICE_ATTR(pos, S_IRUGO, mca_show_pos, NULL);
 
-int __init mca_register_device (int bus, struct mca_device *mca_dev)
+int __init mca_register_device(int bus, struct mca_device *mca_dev)
 {
 	struct mca_bus *mca_bus = mca_root_busses[bus];
 
@@ -184,6 +165,3 @@
 {
 	return bus_register(&mca_bus_type);
 }
-
-EXPORT_SYMBOL (mca_driver_register);
-EXPORT_SYMBOL (mca_driver_unregister);
drivers/mca/mca-driver.c new file +47 -0

47 lines not on this page · raw message

drivers/net/Space.c +0 -4
diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c
@@ -48,7 +48,6 @@
 extern int hp100_probe(struct net_device *dev);
 extern int ultra_probe(struct net_device *dev);
 extern int ultra32_probe(struct net_device *dev);
-extern int ultramca_probe(struct net_device *dev);
 extern int wd_probe(struct net_device *dev);
 extern int el2_probe(struct net_device *dev);
 extern int ne_probe(struct net_device *dev);
@@ -192,9 +191,6 @@
 
 
 static struct devprobe mca_probes[] __initdata = {
-#ifdef CONFIG_ULTRAMCA 
-	{ultramca_probe, 0},
-#endif
 #ifdef CONFIG_NE2_MCA
 	{ne2_probe, 0},
 #endif
drivers/net/smc-mca.c +146 -150

393 lines not on this page · raw message

include/linux/mca.h +8 -6
diff -Nru a/include/linux/mca.h b/include/linux/mca.h
@@ -52,6 +52,9 @@
 	int			pos_id;
 	int			slot;
 
+	/* index into id_table, set by the bus match routine */
+	int			index;
+
 	/* is there a driver installed? 0 - No, 1 - Yes */
 	int			driver_loaded;
 	/* POS registers */
@@ -100,8 +103,6 @@
 #define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver)
 
 /* Ongoing supported API functions */
-extern int mca_driver_register(struct mca_driver *);
-extern int mca_register_device(int bus, struct mca_device *);
 extern struct mca_device *mca_find_device_by_slot(int slot);
 extern int mca_system_init(void);
 extern struct mca_bus *mca_attach_bus(int);
@@ -121,10 +122,11 @@
 
 extern struct bus_type mca_bus_type;
 
-static inline void mca_register_driver(struct mca_driver *drv)
-{
-	driver_register(&drv->driver);
-}
+extern int mca_register_driver(struct mca_driver *drv);
+extern void mca_unregister_driver(struct mca_driver *drv);
+
+/* WARNING: only called by the boot time device setup */
+extern int mca_register_device(int bus, struct mca_device *mca_dev);
 
 /* for now, include the legacy API */
 #include <linux/mca-legacy.h>