Skip to contentSkip to conversation

Driver core changes for 2.5.69

PATCH New Greg KH 1 participant 4 messages May 9, 2003

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 Driver core changes for 2.5.69

Hi,

Here are three small changesets that fix up some stuff in the driver class code. They do the following:
- restore back the driver link in the sysfs class representation that I removed based on my previous class changes.
- fix the cpu frequency code to work properly again (I messed up when porting it to the new class code.)
- remove an unneeded line in the class code.

Please pull from: bk://kernel.bkbits.net/gregkh/linux/class-2.5

thanks,

greg k-h

 drivers/base/class.c |   18 +++++++++++++++++-
 include/linux/cpu.h  |    1 +
 kernel/cpufreq.c     |    2 ++
 3 files changed, 20 insertions(+), 1 deletion(-)

-----

Greg Kroah-Hartman:
o driver core: remove unneeded line in class code
o driver core: Add driver symlink to class devices in sysfs

Jonathan Corbet:
o cpufreq class fix

author
#1 lore raw

PATCH 1/1 Driver core changes for 2.5.69

ChangeSet 1.1096, 2003/05/09 16:25:57-07:00, [email protected]

[PATCH] cpufreq class fix

 include/linux/cpu.h |    1 +
 kernel/cpufreq.c    |    2 ++
 2 files changed, 3 insertions(+)
include/linux/cpu.h +1 -0
diff -Nru a/include/linux/cpu.h b/include/linux/cpu.h
@@ -29,6 +29,7 @@
 };
 
 extern int register_cpu(struct cpu *, int, struct node *);
+extern struct class cpu_class;
 
 /* Stop CPUs going up and down. */
 extern struct semaphore cpucontrol;
kernel/cpufreq.c +2 -0
diff -Nru a/kernel/cpufreq.c b/kernel/cpufreq.c
@@ -22,6 +22,7 @@
 #include <linux/spinlock.h>
 #include <linux/device.h>
 #include <linux/slab.h>
+#include <linux/cpu.h>
 
 /**
  * The "cpufreq driver" - the arch- or hardware-dependend low
@@ -115,6 +116,7 @@
 extern struct device_class cpu_devclass;
 
 static struct class_interface cpufreq_interface = {
+        .class =	&cpu_class,
         .add =		&cpufreq_add_dev,
         .remove =	&cpufreq_remove_dev,
 };
author
#2 lore raw

ChangeSet 1.1097, 2003/05/09 16:26:28-07:00, [email protected]

[PATCH] driver core: Add driver symlink to class devices in sysfs.

Thanks to Mike Anderson for the idea for this.

 drivers/base/class.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+)
drivers/base/class.c +17 -0
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
@@ -133,6 +133,21 @@
 		sysfs_remove_link(&class_dev->kobj, "device");
 }
 
+static int class_device_driver_link(struct class_device * class_dev)
+{
+	if ((class_dev->dev) && (class_dev->dev->driver))
+		return sysfs_create_link(&class_dev->kobj,
+					 &class_dev->dev->driver->kobj, "driver");
+	return 0;
+}
+
+static void class_device_driver_unlink(struct class_device * class_dev)
+{
+	if ((class_dev->dev) && (class_dev->dev->driver))
+		sysfs_remove_link(&class_dev->kobj, "driver");
+}
+
+
 #define to_class_dev(obj) container_of(obj,struct class_device,kobj)
 #define to_class_dev_attr(_attr) container_of(_attr,struct class_device_attribute,attr)
 
@@ -265,6 +280,7 @@
 	}
 
 	class_device_dev_link(class_dev);
+	class_device_driver_link(class_dev);
 
  register_done:
 	if (error && parent)
@@ -298,6 +314,7 @@
 
 	if (class_dev->dev) {
 		class_device_dev_unlink(class_dev);
+		class_device_driver_unlink(class_dev);
 		put_device(class_dev->dev);
 	}
 	
author
#3 lore raw

ChangeSet 1.1098, 2003/05/09 16:26:48-07:00, [email protected]

[PATCH] driver core: remove unneeded line in class code.

Thanks to Jonathan Corbet for pointing this out.

 drivers/base/class.c |    1 -
 1 files changed, 1 deletion(-)
drivers/base/class.c +0 -1
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
@@ -259,7 +259,6 @@
 
 	/* first, register with generic layer. */
 	strncpy(class_dev->kobj.name, class_dev->class_id, KOBJ_NAME_LEN);
-	kobj_set_kset_s(class_dev, class_subsys);
 	kobj_set_kset_s(class_dev, class_obj_subsys);
 	if (parent)
 		class_dev->kobj.parent = &parent->subsys.kset.kobj;