public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BK PATCH] Driver Core update for 2.6.4
@ 2004-03-15 23:55 Greg KH
  2004-03-15 23:59 ` [PATCH] " Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:55 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel

Hi,

Here are a few driver core changes for 2.6.3.  They have all been in the -mm
tree with the exception of the kref patch, which has been reviewed on lkml.
These patches add a few more sysfs class entries, clean up the cdev interface
and add the kref structure.

Please pull from:
	bk://kernel.bkbits.net/gregkh/linux/driver-2.6

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for
those who want to see them.

 drivers/base/Makefile                  |    5 ++
 drivers/base/bus.c                     |    4 -
 drivers/base/class.c                   |   16 ++++--
 drivers/base/class_simple.c            |    4 -
 drivers/base/core.c                    |    4 -
 drivers/base/driver.c                  |    4 -
 drivers/base/power/Makefile            |    4 +
 drivers/base/power/main.c              |    4 -
 drivers/base/power/shutdown.c          |    4 -
 drivers/base/sys.c                     |    4 -
 drivers/char/drm/drm_stub.h            |   35 +++++++++++++-
 drivers/char/lp.c                      |   16 +++++-
 drivers/char/misc.c                    |    1 
 drivers/char/tty_io.c                  |   80 ++++++++++++++++++---------------
 drivers/ieee1394/amdtp.c               |    3 -
 drivers/ieee1394/dv1394.c              |    4 -
 drivers/ieee1394/raw1394.c             |    4 -
 drivers/ieee1394/video1394.c           |    3 -
 drivers/input/input.c                  |    4 +
 drivers/net/ppp_generic.c              |   21 ++++++++
 drivers/pci/hotplug/pci_hotplug_core.c |   14 -----
 drivers/s390/char/tape_class.c         |    7 --
 drivers/scsi/sg.c                      |    7 +-
 drivers/scsi/st.c                      |   39 ++++++++++------
 fs/char_dev.c                          |   26 +++-------
 include/linux/cdev.h                   |    4 -
 include/linux/kobject.h                |    8 +++
 include/linux/kref.h                   |   32 +++++++++++++
 lib/Makefile                           |    3 +
 lib/kref.c                             |   60 ++++++++++++++++++++++++
 net/netlink/netlink_dev.c              |   20 +++++++-
 31 files changed, 301 insertions(+), 143 deletions(-)
-----

Andrew Morton:
  o cdev: warning fix

Chris Wright:
  o class_simple cleanup in sg
  o class_simple cleanup in misc
  o class_simple cleanup in input
  o class_simple clean up in lp
  o Patch to hook up PPP to simple class sysfs support

Greg Kroah-Hartman:
  o kref: add kref structure to kernel tree
  o remove cdev_set_name completely as it is not needed
  o PCI Hotplug: use the new decl_subsys_name() macro instead of rolling our own
  o Kobject: add decl_subsys_name() macro for users who want to set the subsystem name
  o Driver core: make CONFIG_DEBUG_DRIVER implementation a whole lot cleaner

Jonathan Corbet:
  o cdev 2/2: hide cdev->kobj
  o cdev 1/2: Eliminate /sys/cdev

Leann Ogasawara:
  o add sysfs simple class support for DRI char device
  o Fix class_register() always returns 0
  o Add sysfs simple class support for netlink


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:55 [BK PATCH] Driver Core update for 2.6.4 Greg KH
@ 2004-03-15 23:59 ` Greg KH
  2004-03-15 23:59   ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.1, 2004/03/09 14:25:46-08:00, greg@kroah.com

Driver core: make CONFIG_DEBUG_DRIVER implementation a whole lot cleaner


 drivers/base/Makefile         |    5 +++++
 drivers/base/bus.c            |    4 ----
 drivers/base/class.c          |    4 ----
 drivers/base/class_simple.c   |    4 ----
 drivers/base/core.c           |    4 ----
 drivers/base/driver.c         |    4 ----
 drivers/base/power/Makefile   |    4 ++++
 drivers/base/power/main.c     |    4 ----
 drivers/base/power/shutdown.c |    4 ----
 drivers/base/sys.c            |    4 ----
 10 files changed, 9 insertions(+), 32 deletions(-)


diff -Nru a/drivers/base/Makefile b/drivers/base/Makefile
--- a/drivers/base/Makefile	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/Makefile	Mon Mar 15 15:30:28 2004
@@ -6,3 +6,8 @@
 obj-y			+= power/
 obj-$(CONFIG_FW_LOADER)	+= firmware_class.o
 obj-$(CONFIG_NUMA)	+= node.o
+
+ifeq ($(CONFIG_DEBUG_DRIVER),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/bus.c	Mon Mar 15 15:30:28 2004
@@ -9,10 +9,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/errno.h>
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/class.c	Mon Mar 15 15:30:28 2004
@@ -11,10 +11,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff -Nru a/drivers/base/class_simple.c b/drivers/base/class_simple.c
--- a/drivers/base/class_simple.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/class_simple.c	Mon Mar 15 15:30:28 2004
@@ -9,10 +9,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/device.h>
 #include <linux/kdev_t.h>
 #include <linux/err.h>
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/core.c	Mon Mar 15 15:30:28 2004
@@ -9,10 +9,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/init.h>
diff -Nru a/drivers/base/driver.c b/drivers/base/driver.c
--- a/drivers/base/driver.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/driver.c	Mon Mar 15 15:30:28 2004
@@ -9,10 +9,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/errno.h>
diff -Nru a/drivers/base/power/Makefile b/drivers/base/power/Makefile
--- a/drivers/base/power/Makefile	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/power/Makefile	Mon Mar 15 15:30:28 2004
@@ -1,2 +1,6 @@
 obj-y			:= shutdown.o
 obj-$(CONFIG_PM)	+= main.o suspend.o resume.o runtime.o sysfs.o
+
+ifeq ($(CONFIG_DEBUG_DRIVER),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
diff -Nru a/drivers/base/power/main.c b/drivers/base/power/main.c
--- a/drivers/base/power/main.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/power/main.c	Mon Mar 15 15:30:28 2004
@@ -20,10 +20,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/device.h>
 #include "power.h"
 
diff -Nru a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
--- a/drivers/base/power/shutdown.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/power/shutdown.c	Mon Mar 15 15:30:28 2004
@@ -9,10 +9,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/device.h>
 #include <asm/semaphore.h>
 
diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
--- a/drivers/base/sys.c	Mon Mar 15 15:30:28 2004
+++ b/drivers/base/sys.c	Mon Mar 15 15:30:28 2004
@@ -13,10 +13,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_DEBUG_DRIVER
-#define DEBUG	1
-#endif
-
 #include <linux/sysdev.h>
 #include <linux/err.h>
 #include <linux/module.h>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59 ` [PATCH] " Greg KH
@ 2004-03-15 23:59   ` Greg KH
  2004-03-15 23:59     ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.2, 2004/03/10 16:04:33-08:00, chrisw@osdl.org

[PATCH] Patch to hook up PPP to simple class sysfs support

* Hanna Linder (hannal@us.ibm.com) wrote:
> +		ppp_class = class_simple_create(THIS_MODULE, "ppp");
> +		class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");

What happens if that class_simple_create() fails?  Actually,
class_simple_device_add could fail too, but doesn't seem anybody is
checking for that.

>  		err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
>  				S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
> -		if (err)
> +		if (err) {
>  			unregister_chrdev(PPP_MAJOR, "ppp");
> +			class_simple_device_remove(MKDEV(PPP_MAJOR,0));
> +		}

need to destroy the class on error path to avoid leak.

> @@ -2540,6 +2547,7 @@ static void __exit ppp_cleanup(void)
>  	if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
>  		printk(KERN_ERR "PPP: failed to unregister PPP device\n");
>  	devfs_remove("ppp");
> +	class_simple_device_remove(MKDEV(PPP_MAJOR, 0));

ditto.  this will leak and would cause oops on reload of module.

something like below.


 drivers/net/ppp_generic.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletion(-)


diff -Nru a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
--- a/drivers/net/ppp_generic.c	Mon Mar 15 15:30:17 2004
+++ b/drivers/net/ppp_generic.c	Mon Mar 15 15:30:17 2004
@@ -45,6 +45,7 @@
 #include <linux/smp_lock.h>
 #include <linux/rwsem.h>
 #include <linux/stddef.h>
+#include <linux/device.h>
 #include <net/slhc_vj.h>
 #include <asm/atomic.h>
 
@@ -271,6 +272,8 @@
 static int ppp_disconnect_channel(struct channel *pch);
 static void ppp_destroy_channel(struct channel *pch);
 
+static struct class_simple *ppp_class;
+
 /* Translates a PPP protocol number to a NP index (NP == network protocol) */
 static inline int proto_to_npindex(int proto)
 {
@@ -804,15 +807,29 @@
 	printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
 	err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
 	if (!err) {
+		ppp_class = class_simple_create(THIS_MODULE, "ppp");
+		if (IS_ERR(ppp_class)) {
+			err = PTR_ERR(ppp_class);
+			goto out_chrdev;
+		}
+		class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
 		err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
 				S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
 		if (err)
-			unregister_chrdev(PPP_MAJOR, "ppp");
+			goto out_class;
 	}
 
+out:
 	if (err)
 		printk(KERN_ERR "failed to register PPP device (%d)\n", err);
 	return err;
+
+out_class:
+	class_simple_device_remove(MKDEV(PPP_MAJOR,0));
+	class_simple_destroy(ppp_class);
+out_chrdev:
+	unregister_chrdev(PPP_MAJOR, "ppp");
+	goto out;
 }
 
 /*
@@ -2545,6 +2562,8 @@
 	if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
 		printk(KERN_ERR "PPP: failed to unregister PPP device\n");
 	devfs_remove("ppp");
+	class_simple_device_remove(MKDEV(PPP_MAJOR, 0));
+	class_simple_destroy(ppp_class);
 }
 
 /*


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59   ` Greg KH
@ 2004-03-15 23:59     ` Greg KH
  2004-03-15 23:59       ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.3, 2004/03/10 16:05:00-08:00, chrisw@osdl.org

[PATCH] class_simple clean up in lp

Error condition isn't caught on class_simple_create, and
parport_register_driver failure doesn't do proper cleanup.


 drivers/char/lp.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)


diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
--- a/drivers/char/lp.c	Mon Mar 15 15:30:05 2004
+++ b/drivers/char/lp.c	Mon Mar 15 15:30:05 2004
@@ -869,7 +869,7 @@
 
 int __init lp_init (void)
 {
-	int i;
+	int i, err = 0;
 
 	if (parport_nr[0] == LP_PARPORT_OFF)
 		return 0;
@@ -900,10 +900,15 @@
 
 	devfs_mk_dir("printers");
 	lp_class = class_simple_create(THIS_MODULE, "printer");
+	if (IS_ERR(lp_class)) {
+		err = PTR_ERR(lp_class);
+		goto out_devfs;
+	}
 
 	if (parport_register_driver (&lp_driver)) {
 		printk (KERN_ERR "lp: unable to register with parport\n");
-		return -EIO;
+		err = -EIO;
+		goto out_class;
 	}
 
 	if (!lp_count) {
@@ -915,6 +920,13 @@
 	}
 
 	return 0;
+
+out_class:
+	class_simple_destroy(lp_class);
+out_devfs:
+	devfs_remove("printers");
+	unregister_chrdev(LP_MAJOR, "lp");
+	return err;
 }
 
 static int __init lp_init_module (void)


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59           ` Greg KH
@ 2004-03-15 23:59             ` Greg KH
  2004-03-15 23:59               ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.7, 2004/03/10 17:34:33-08:00, ogasawara@osdl.org

[PATCH] Add sysfs simple class support for netlink

Patch adds sysfs simple class support for netlink character device
(Major 36).  Feedback appreciated.  Thanks,


 net/netlink/netlink_dev.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)


diff -Nru a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c
--- a/net/netlink/netlink_dev.c	Mon Mar 15 15:29:27 2004
+++ b/net/netlink/netlink_dev.c	Mon Mar 15 15:29:27 2004
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/smp_lock.h>
+#include <linux/device.h>
 
 #include <asm/bitops.h>
 #include <asm/system.h>
@@ -34,6 +35,7 @@
 
 static long open_map;
 static struct socket *netlink_user[MAX_LINKS];
+static struct class_simple *netlink_class;
 
 /*
  *	Device operations
@@ -229,17 +231,26 @@
 		return -EIO;
 	}
 
+	netlink_class = class_simple_create(THIS_MODULE, "netlink");
+	if (IS_ERR(netlink_class)) {
+		printk (KERN_ERR "Error creating netlink class.\n");
+		unregister_chrdev(NETLINK_MAJOR, "netlink");
+		return PTR_ERR(netlink_class);
+	}
+
 	devfs_mk_dir("netlink");
 
 	/*  Someone tell me the official names for the uppercase ones  */
 	for (i = 0; i < ARRAY_SIZE(entries); i++) {
 		devfs_mk_cdev(MKDEV(NETLINK_MAJOR, entries[i].minor),
 			S_IFCHR|S_IRUSR|S_IWUSR, "netlink/%s", entries[i].name);
+		class_simple_device_add(netlink_class, MKDEV(NETLINK_MAJOR, entries[i].minor), NULL, "%s", entries[i].name);
 	}
 
 	for (i = 0; i < 16; i++) {
 		devfs_mk_cdev(MKDEV(NETLINK_MAJOR, i + 16),
 			S_IFCHR|S_IRUSR|S_IWUSR, "netlink/tap%d", i);
+		class_simple_device_add(netlink_class, MKDEV(NETLINK_MAJOR, i + 16), NULL, "tap%d", i);
 	}
 
 	return 0;
@@ -249,11 +260,16 @@
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(entries); i++)
+	for (i = 0; i < ARRAY_SIZE(entries); i++) {
 		devfs_remove("netlink/%s", entries[i].name);
-	for (i = 0; i < 16; i++)
+		class_simple_device_remove(MKDEV(NETLINK_MAJOR, entries[i].minor));
+	}
+	for (i = 0; i < 16; i++) {
 		devfs_remove("netlink/tap%d", i);
+		class_simple_device_remove(MKDEV(NETLINK_MAJOR, i + 16));
+	}
 	devfs_remove("netlink");
+	class_simple_destroy(netlink_class);
 	unregister_chrdev(NETLINK_MAJOR, "netlink");
 }
 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59     ` Greg KH
@ 2004-03-15 23:59       ` Greg KH
  2004-03-15 23:59         ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.4, 2004/03/10 16:05:28-08:00, chrisw@osdl.org

[PATCH] class_simple cleanup in input

Doesn't catch error on class_simple_add, and existing error return paths
forget to class_simple_destroy.


 drivers/input/input.c |    4 ++++
 1 files changed, 4 insertions(+)


diff -Nru a/drivers/input/input.c b/drivers/input/input.c
--- a/drivers/input/input.c	Mon Mar 15 15:29:55 2004
+++ b/drivers/input/input.c	Mon Mar 15 15:29:55 2004
@@ -727,6 +727,8 @@
 	int retval = -ENOMEM;
 
 	input_class = class_simple_create(THIS_MODULE, "input");
+	if (IS_ERR(input_class))
+		return PTR_ERR(input_class);
 	input_proc_init();
 	retval = register_chrdev(INPUT_MAJOR, "input", &input_fops);
 	if (retval) {
@@ -734,6 +736,7 @@
 		remove_proc_entry("devices", proc_bus_input_dir);
 		remove_proc_entry("handlers", proc_bus_input_dir);
 		remove_proc_entry("input", proc_bus);
+		class_simple_destroy(input_class);
 		return retval;
 	}
 
@@ -743,6 +746,7 @@
 		remove_proc_entry("handlers", proc_bus_input_dir);
 		remove_proc_entry("input", proc_bus);
 		unregister_chrdev(INPUT_MAJOR, "input");
+		class_simple_destroy(input_class);
 	}
 	return retval;
 }


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59       ` Greg KH
@ 2004-03-15 23:59         ` Greg KH
  2004-03-15 23:59           ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.5, 2004/03/10 16:05:50-08:00, chrisw@osdl.org

[PATCH] class_simple cleanup in misc

Error path doesn't class_simple_destroy.


 drivers/char/misc.c |    1 +
 1 files changed, 1 insertion(+)


diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
--- a/drivers/char/misc.c	Mon Mar 15 15:29:45 2004
+++ b/drivers/char/misc.c	Mon Mar 15 15:29:45 2004
@@ -342,6 +342,7 @@
 	if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
 		printk("unable to get major %d for misc devices\n",
 		       MISC_MAJOR);
+		class_simple_destroy(misc_class);
 		return -EIO;
 	}
 	return 0;


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59         ` Greg KH
@ 2004-03-15 23:59           ` Greg KH
  2004-03-15 23:59             ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.6, 2004/03/10 16:06:14-08:00, chrisw@osdl.org

[PATCH] class_simple cleanup in sg

The only spot that seems to care about class_simple_device_add possibly
failing, but it gets the wrong error test.


 drivers/scsi/sg.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
--- a/drivers/scsi/sg.c	Mon Mar 15 15:29:36 2004
+++ b/drivers/scsi/sg.c	Mon Mar 15 15:29:36 2004
@@ -1439,7 +1439,7 @@
 				MKDEV(SCSI_GENERIC_MAJOR, k), 
 				cl_dev->dev, "%s", 
 				disk->disk_name);
-		if (NULL == sg_class_member)
+		if (IS_ERR(sg_class_member))
 			printk(KERN_WARNING "sg_add: "
 				"class_simple_device_add failed\n");
 		class_set_devdata(sg_class_member, sdp);


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59             ` Greg KH
@ 2004-03-15 23:59               ` Greg KH
  2004-03-15 23:59                 ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.8, 2004/03/11 10:57:27-08:00, ogasawara@osdl.org

[PATCH] Fix class_register() always returns 0

I noticed that the class_register() function in drivers/base/class.c
always returns 0 and thus will never fail.  Patch below inserts simple
error checking to return any errors if they occur.  Feedback welcome.
Thanks,


 drivers/base/class.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)


diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c	Mon Mar 15 15:29:19 2004
+++ b/drivers/base/class.c	Mon Mar 15 15:29:19 2004
@@ -102,13 +102,21 @@
 
 int class_register(struct class * cls)
 {
+	int error;
+
 	pr_debug("device class '%s': registering\n",cls->name);
 
 	INIT_LIST_HEAD(&cls->children);
 	INIT_LIST_HEAD(&cls->interfaces);
-	kobject_set_name(&cls->subsys.kset.kobj,cls->name);
+	error = kobject_set_name(&cls->subsys.kset.kobj,cls->name);
+	if (error)
+		return error;
+
 	subsys_set_kset(cls,class_subsys);
-	subsystem_register(&cls->subsys);
+
+	error = subsystem_register(&cls->subsys);
+	if (error)
+		return error;
 
 	return 0;
 }


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                 ` Greg KH
@ 2004-03-15 23:59                   ` Greg KH
  2004-03-15 23:59                     ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.10, 2004/03/11 13:22:16-08:00, greg@kroah.com

PCI Hotplug: use the new decl_subsys_name() macro instead of rolling our own.


 drivers/pci/hotplug/pci_hotplug_core.c |   14 +-------------
 1 files changed, 1 insertion(+), 13 deletions(-)


diff -Nru a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
--- a/drivers/pci/hotplug/pci_hotplug_core.c	Mon Mar 15 15:29:01 2004
+++ b/drivers/pci/hotplug/pci_hotplug_core.c	Mon Mar 15 15:29:01 2004
@@ -104,19 +104,7 @@
 	.release = &hotplug_slot_release,
 };
 
-/* 
- * We create a struct subsystem on our own and not use decl_subsys so
- * we can have a sane name "slots" in sysfs, yet still keep a good
- * global variable name "pci_hotplug_slots_subsys.
- * If the decl_subsys() #define ever changes, this declaration will
- * need to be update to make sure everything is initialized properly.
- */
-struct subsystem pci_hotplug_slots_subsys = {
-	.kset = {
-		.kobj = { .name = "slots" },
-		.ktype = &hotplug_slot_ktype,
-	}
-};
+decl_subsys_name(pci_hotplug_slots, slots, &hotplug_slot_ktype, NULL);
 
 /* these strings match up with the values in pci_bus_speed */
 static char *pci_bus_speed_strings[] = {


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59               ` Greg KH
@ 2004-03-15 23:59                 ` Greg KH
  2004-03-15 23:59                   ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.9, 2004/03/11 13:21:13-08:00, greg@kroah.com

Kobject: add decl_subsys_name() macro for users who want to set the subsystem name


 include/linux/kobject.h |    8 ++++++++
 1 files changed, 8 insertions(+)


diff -Nru a/include/linux/kobject.h b/include/linux/kobject.h
--- a/include/linux/kobject.h	Mon Mar 15 15:29:10 2004
+++ b/include/linux/kobject.h	Mon Mar 15 15:29:10 2004
@@ -151,6 +151,14 @@
 		.hotplug_ops =_hotplug_ops, \
 	} \
 }
+#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \
+struct subsystem _varname##_subsys = { \
+	.kset = { \
+		.kobj = { .name = __stringify(_name) }, \
+		.ktype = _type, \
+		.hotplug_ops =_hotplug_ops, \
+	} \
+}
 
 
 /**


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                   ` Greg KH
@ 2004-03-15 23:59                     ` Greg KH
  2004-03-15 23:59                       ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.11, 2004/03/11 16:35:34-08:00, ogasawara@osdl.org

[PATCH] add sysfs simple class support for DRI char device

Patch adds sysfs simple class support for DRI character device (Major
226).  Also, adds some error checking.


 drivers/char/drm/drm_stub.h |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)


diff -Nru a/drivers/char/drm/drm_stub.h b/drivers/char/drm/drm_stub.h
--- a/drivers/char/drm/drm_stub.h	Mon Mar 15 15:28:51 2004
+++ b/drivers/char/drm/drm_stub.h	Mon Mar 15 15:28:51 2004
@@ -35,6 +35,8 @@
 
 #define DRM_STUB_MAXCARDS 16	/* Enough for one machine */
 
+static struct class_simple *drm_class;
+
 /** Stub list. One for each minor. */
 static struct drm_stub_list {
 	const char             *name;
@@ -117,6 +119,7 @@
 			DRM(stub_root) = DRM(proc_init)(dev, i, DRM(stub_root),
 							&DRM(stub_list)[i]
 							.dev_root);
+			class_simple_device_add(drm_class, MKDEV(DRM_MAJOR, i), NULL, name);
 			return i;
 		}
 	}
@@ -141,6 +144,7 @@
 	DRM(proc_cleanup)(minor, DRM(stub_root),
 			  DRM(stub_list)[minor].dev_root);
 	if (minor) {
+		class_simple_device_remove(MKDEV(DRM_MAJOR, minor));
 		inter_module_put("drm");
 	} else {
 		inter_module_unregister("drm");
@@ -148,6 +152,8 @@
 			  sizeof(*DRM(stub_list)) * DRM_STUB_MAXCARDS,
 			  DRM_MEM_STUB);
 		unregister_chrdev(DRM_MAJOR, "drm");
+		class_simple_device_remove(MKDEV(DRM_MAJOR, minor));
+		class_simple_destroy(drm_class);
 	}
 	return 0;
 }
@@ -170,10 +176,23 @@
 		       drm_device_t *dev)
 {
 	struct drm_stub_info *i = NULL;
+	int ret1;
+	int ret2;
 
 	DRM_DEBUG("\n");
-	if (register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops)))
+	ret1 = register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops));
+	if (!ret1) {
+		drm_class = class_simple_create(THIS_MODULE, "drm");
+		if (IS_ERR(drm_class)) {
+			printk (KERN_ERR "Error creating drm class.\n");
+			unregister_chrdev(DRM_MAJOR, "drm");
+			return PTR_ERR(drm_class);
+		}
+	}
+	else if (ret1 == -EBUSY)
 		i = (struct drm_stub_info *)inter_module_get("drm");
+	else
+		return -1;
 
 	if (i) {
 				/* Already registered */
@@ -186,8 +205,18 @@
 		DRM_DEBUG("calling inter_module_register\n");
 		inter_module_register("drm", THIS_MODULE, &DRM(stub_info));
 	}
-	if (DRM(stub_info).info_register)
-		return DRM(stub_info).info_register(name, fops, dev);
+	if (DRM(stub_info).info_register) {
+		ret2 = DRM(stub_info).info_register(name, fops, dev);
+		if (ret2) {
+			if (!ret1) {
+			unregister_chrdev(DRM_MAJOR, "drm");
+			class_simple_destroy(drm_class);
+			}
+			if (!i)
+				inter_module_unregister("drm");
+		}
+		return ret2;
+	}
 	return -1;
 }
 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                           ` Greg KH
@ 2004-03-15 23:59                             ` Greg KH
  2004-03-15 23:59                               ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.15, 2004/03/15 14:36:49-08:00, akpm@osdl.org

[PATCH] cdev: warning fix

Against Jon's cdev stuff


 drivers/char/tty_io.c |    1 -
 1 files changed, 1 deletion(-)


diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	Mon Mar 15 15:28:13 2004
+++ b/drivers/char/tty_io.c	Mon Mar 15 15:28:13 2004
@@ -2234,7 +2234,6 @@
 	int error;
         int i;
 	dev_t dev;
-	char *s;
 	void **p = NULL;
 
 	if (driver->flags & TTY_DRIVER_INSTALLED)


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                             ` Greg KH
@ 2004-03-15 23:59                               ` Greg KH
  2004-03-16  7:04                                 ` Christoph Hellwig
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.16, 2004/03/15 14:39:18-08:00, greg@kroah.com

kref: add kref structure to kernel tree.

Based on the kobject structure, but much smaller and simpler to use.


 include/linux/kref.h |   32 +++++++++++++++++++++++++++
 lib/Makefile         |    3 ++
 lib/kref.c           |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)


diff -Nru a/include/linux/kref.h b/include/linux/kref.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/kref.h	Mon Mar 15 15:28:04 2004
@@ -0,0 +1,32 @@
+/*
+ * kref.c - library routines for handling generic reference counted objects
+ *
+ * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2004 IBM Corp.
+ *
+ * based on kobject.h which was:
+ * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org>
+ * Copyright (C) 2002-2003 Open Source Development Labs
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+#if defined(__KERNEL__) && !defined(_KREF_H_)
+#define _KREF_H_
+
+#include <linux/types.h>
+#include <asm/atomic.h>
+
+
+struct kref {
+	atomic_t refcount;
+	void (*release)(struct kref *kref);
+};
+
+void kref_init(struct kref *kref, void (*release)(struct kref *));
+struct kref *kref_get(struct kref *kref);
+void kref_put(struct kref *kref);
+
+
+#endif /* _KREF_H_ */
diff -Nru a/lib/Makefile b/lib/Makefile
--- a/lib/Makefile	Mon Mar 15 15:28:04 2004
+++ b/lib/Makefile	Mon Mar 15 15:28:04 2004
@@ -8,6 +8,9 @@
 	 kobject.o idr.o div64.o parser.o int_sqrt.o \
 	 bitmap.o extable.o
 
+# hack for now till some static code uses krefs, then it can move up above...
+obj-y += kref.o
+
 lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
 lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
 
diff -Nru a/lib/kref.c b/lib/kref.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/lib/kref.c	Mon Mar 15 15:28:04 2004
@@ -0,0 +1,60 @@
+/*
+ * kref.c - library routines for handling generic reference counted objects
+ *
+ * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2004 IBM Corp.
+ *
+ * based on lib/kobject.c which was:
+ * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org>
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+/* #define DEBUG */
+
+#include <linux/kref.h>
+#include <linux/module.h>
+
+/**
+ * kref_init - initialize object.
+ * @kref: object in question.
+ * @release: pointer to a function that will clean up the object
+ *	     when the last reference to the object is released.
+ *	     This pointer is required.
+ */
+void kref_init(struct kref *kref, void (*release)(struct kref *kref))
+{
+	WARN_ON(release == NULL);
+	atomic_set(&kref->refcount,1);
+	kref->release = release;
+}
+
+/**
+ * kref_get - increment refcount for object.
+ * @kref: object.
+ */
+struct kref *kref_get(struct kref *kref)
+{
+	WARN_ON(!atomic_read(&kref->refcount));
+	atomic_inc(&kref->refcount);
+	return kref;
+}
+
+/**
+ * kref_put - decrement refcount for object.
+ * @kref: object.
+ *
+ * Decrement the refcount, and if 0, call kref->release().
+ */
+void kref_put(struct kref *kref)
+{
+	if (atomic_dec_and_test(&kref->refcount)) {
+		pr_debug("kref cleaning up\n");
+		kref->release(kref);
+	}
+}
+
+EXPORT_SYMBOL(kref_init);
+EXPORT_SYMBOL(kref_get);
+EXPORT_SYMBOL(kref_put);


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                     ` Greg KH
@ 2004-03-15 23:59                       ` Greg KH
  2004-03-15 23:59                         ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.12, 2004/03/12 15:20:28-08:00, corbet@lwn.net

[PATCH] cdev 1/2: Eliminate /sys/cdev

This is the first of two patches designed to make life easier for authors
of device driver books - and, with luck, driver authors too.

/sys/cdev is, according to Al, a mistake which was never really meant to
exist.  I believe nothing uses it currently - there isn't a whole lot there
to use.  Its existence takes up system resources, and also requires drivers
to deal with the cdev's embedded kobject in their failure paths.  The
following patch (against 2.6.4) makes it all go away.

OK, almost all.  We have to keep (but not register) cdev_subsys because
it's rwsem is needed to control access to cdev_map.


 drivers/char/tty_io.c |   10 +++-------
 fs/char_dev.c         |   26 ++++++++------------------
 2 files changed, 11 insertions(+), 25 deletions(-)


diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	Mon Mar 15 15:28:42 2004
+++ b/drivers/char/tty_io.c	Mon Mar 15 15:28:42 2004
@@ -2175,8 +2175,6 @@
 EXPORT_SYMBOL(tty_register_device);
 EXPORT_SYMBOL(tty_unregister_device);
 
-static struct kobject tty_kobj = {.name = "tty"};
-
 struct tty_driver *alloc_tty_driver(int lines)
 {
 	struct tty_driver *driver;
@@ -2276,7 +2274,6 @@
 		driver->termios_locked = NULL;
 	}
 
-	driver->cdev.kobj.parent = &tty_kobj;
 	strcpy(driver->cdev.kobj.name, driver->name);
 	for (s = strchr(driver->cdev.kobj.name, '/'); s; s = strchr(s, '/'))
 		*s = '!';
@@ -2400,7 +2397,9 @@
 }
 
 postcore_initcall(tty_class_init);
- 
+
+/* 3/2004 jmc: why do these devices exist? */
+
 static struct cdev tty_cdev, console_cdev;
 #ifdef CONFIG_UNIX98_PTYS
 static struct cdev ptmx_cdev;
@@ -2430,9 +2429,6 @@
 		panic("Couldn't register /dev/console driver\n");
 	devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console");
 	class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 1), NULL, "console");
-
-	tty_kobj.kset = tty_cdev.kobj.kset;
-	kobject_register(&tty_kobj);
 
 #ifdef CONFIG_UNIX98_PTYS
 	strcpy(ptmx_cdev.kobj.name, "dev.ptmx");
diff -Nru a/fs/char_dev.c b/fs/char_dev.c
--- a/fs/char_dev.c	Mon Mar 15 15:28:42 2004
+++ b/fs/char_dev.c	Mon Mar 15 15:28:42 2004
@@ -340,15 +340,9 @@
 
 int cdev_add(struct cdev *p, dev_t dev, unsigned count)
 {
-	int err = kobject_add(&p->kobj);
-	if (err)
-		return err;
-	err = kobj_map(cdev_map, dev, count, NULL, exact_match, exact_lock, p);
-	if (err)
-		kobject_del(&p->kobj);
 	p->dev = dev;
 	p->count = count;
-	return err;
+	return kobj_map(cdev_map, dev, count, NULL, exact_match, exact_lock, p);
 }
 
 static void cdev_unmap(dev_t dev, unsigned count)
@@ -359,7 +353,6 @@
 void cdev_del(struct cdev *p)
 {
 	cdev_unmap(p->dev, p->count);
-	kobject_del(&p->kobj);
 	kobject_put(&p->kobj);
 }
 
@@ -407,18 +400,12 @@
 	.release	= cdev_dynamic_release,
 };
 
-static struct kset kset_dynamic = {
-	.subsys = &cdev_subsys,
-	.kobj = {.name = "major",},
-	.ktype = &ktype_cdev_dynamic,
-};
-
 struct cdev *cdev_alloc(void)
 {
 	struct cdev *p = kmalloc(sizeof(struct cdev), GFP_KERNEL);
 	if (p) {
 		memset(p, 0, sizeof(struct cdev));
-		p->kobj.kset = &kset_dynamic;
+		p->kobj.ktype = &ktype_cdev_dynamic;
 		INIT_LIST_HEAD(&p->list);
 		kobject_init(&p->kobj);
 	}
@@ -428,7 +415,6 @@
 void cdev_init(struct cdev *cdev, struct file_operations *fops)
 {
 	INIT_LIST_HEAD(&cdev->list);
-	kobj_set_kset_s(cdev, cdev_subsys);
 	cdev->kobj.ktype = &ktype_cdev_default;
 	kobject_init(&cdev->kobj);
 	cdev->ops = fops;
@@ -444,8 +430,12 @@
 
 void __init chrdev_init(void)
 {
-	subsystem_register(&cdev_subsys);
-	kset_register(&kset_dynamic);
+/*
+ * Keep cdev_subsys around because (and only because) the kobj_map code
+ * depends on the rwsem it contains.  We don't make it public in sysfs,
+ * however.
+ */
+	subsystem_init(&cdev_subsys);
 	cdev_map = kobj_map_init(base_probe, &cdev_subsys);
 }
 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                       ` Greg KH
@ 2004-03-15 23:59                         ` Greg KH
  2004-03-15 23:59                           ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.13, 2004/03/12 15:20:49-08:00, corbet@lwn.net

[PATCH] cdev 2/2: hide cdev->kobj

The existing cdev interface requires users to deal with the embedded
kobject in two places:

- The kobject name field must be set before adding the cdev, and
- Should cdev_add() fail, a call to kobject_put() is required.

IMO, this exposure of the embedded kobject makes the interface more brittle
and harder to understand.  It's also unnecessary.  With the removal of
/sys/cdev, a call to cdev_del() will nicely replace kobject_put(), and the
name setting is easily wrapped.

This is against 2.6.4, but depends on the /sys/cdev removal patch.


 drivers/char/tty_io.c          |   12 ++++++------
 drivers/ieee1394/amdtp.c       |    2 +-
 drivers/ieee1394/dv1394.c      |    2 +-
 drivers/ieee1394/raw1394.c     |    3 ++-
 drivers/ieee1394/video1394.c   |    2 +-
 drivers/s390/char/tape_class.c |    4 ++--
 drivers/scsi/sg.c              |    4 ++--
 drivers/scsi/st.c              |    5 ++---
 include/linux/cdev.h           |    2 ++
 9 files changed, 19 insertions(+), 17 deletions(-)


diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/char/tty_io.c	Mon Mar 15 15:28:33 2004
@@ -2274,14 +2274,14 @@
 		driver->termios_locked = NULL;
 	}
 
-	strcpy(driver->cdev.kobj.name, driver->name);
+	cdev_set_name(&driver->cdev, driver->name);
 	for (s = strchr(driver->cdev.kobj.name, '/'); s; s = strchr(s, '/'))
 		*s = '!';
 	cdev_init(&driver->cdev, &tty_fops);
 	driver->cdev.owner = driver->owner;
 	error = cdev_add(&driver->cdev, dev, driver->num);
 	if (error) {
-		kobject_del(&driver->cdev.kobj);
+		cdev_del(&driver->cdev);
 		unregister_chrdev_region(dev, driver->num);
 		driver->ttys = NULL;
 		driver->termios = driver->termios_locked = NULL;
@@ -2414,7 +2414,7 @@
  */
 static int __init tty_init(void)
 {
-	strcpy(tty_cdev.kobj.name, "dev.tty");
+	cdev_set_name(&tty_cdev, "dev.tty");
 	cdev_init(&tty_cdev, &tty_fops);
 	if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
@@ -2422,7 +2422,7 @@
 	devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty");
 	class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty");
 
-	strcpy(console_cdev.kobj.name, "dev.console");
+	cdev_set_name(&console_cdev, "dev.console");
 	cdev_init(&console_cdev, &console_fops);
 	if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
@@ -2431,7 +2431,7 @@
 	class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 1), NULL, "console");
 
 #ifdef CONFIG_UNIX98_PTYS
-	strcpy(ptmx_cdev.kobj.name, "dev.ptmx");
+	cdev_set_name(&ptmx_cdev, "dev.ptmx");
 	cdev_init(&ptmx_cdev, &tty_fops);
 	if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
@@ -2441,7 +2441,7 @@
 #endif
 
 #ifdef CONFIG_VT
-	strcpy(vc0_cdev.kobj.name, "dev.vc0");
+	cdev_set_name(&vc0_cdev, "dev.vc0");
 	cdev_init(&vc0_cdev, &console_fops);
 	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
diff -Nru a/drivers/ieee1394/amdtp.c b/drivers/ieee1394/amdtp.c
--- a/drivers/ieee1394/amdtp.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/ieee1394/amdtp.c	Mon Mar 15 15:28:33 2004
@@ -1266,7 +1266,7 @@
 {
 	cdev_init(&amdtp_cdev, &amdtp_fops);
 	amdtp_cdev.owner = THIS_MODULE;
-	kobject_set_name(&amdtp_cdev.kobj, "amdtp");
+	cdev_set_name(&amdtp_cdev, "amdtp");
 	if (cdev_add(&amdtp_cdev, IEEE1394_AMDTP_DEV, 16)) {
 		HPSB_ERR("amdtp: unable to add char device");
  		return -EIO;
diff -Nru a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
--- a/drivers/ieee1394/dv1394.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/ieee1394/dv1394.c	Mon Mar 15 15:28:33 2004
@@ -2616,7 +2616,7 @@
 
 	cdev_init(&dv1394_cdev, &dv1394_fops);
 	dv1394_cdev.owner = THIS_MODULE;
-	kobject_set_name(&dv1394_cdev.kobj, "dv1394");
+	cdev_set_name(&dv1394_cdev, "dv1394");
 	ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16);
 	if (ret) {
 		printk(KERN_ERR "dv1394: unable to register character device\n");
diff -Nru a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
--- a/drivers/ieee1394/raw1394.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/ieee1394/raw1394.c	Mon Mar 15 15:28:33 2004
@@ -2746,9 +2746,10 @@
 
 	cdev_init(&raw1394_cdev, &raw1394_fops);
 	raw1394_cdev.owner = THIS_MODULE;
-	kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
+	cdev_set_name(&raw1394_cdev, RAW1394_DEVICE_NAME);
 	ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1);
 	if (ret) {
+		/* jmc: leaves reference to (static) raw1394_cdev */
                 HPSB_ERR("raw1394 failed to register minor device block");
                 devfs_remove(RAW1394_DEVICE_NAME);
                 hpsb_unregister_highlevel(&raw1394_highlevel);
diff -Nru a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
--- a/drivers/ieee1394/video1394.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/ieee1394/video1394.c	Mon Mar 15 15:28:33 2004
@@ -1457,7 +1457,7 @@
 
 	cdev_init(&video1394_cdev, &video1394_fops);
 	video1394_cdev.owner = THIS_MODULE;
-	kobject_set_name(&video1394_cdev.kobj, VIDEO1394_DRIVER_NAME);
+	cdev_set_name(&video1394_cdev, VIDEO1394_DRIVER_NAME);
 	ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
 	if (ret) {
 		PRINT_G(KERN_ERR, "video1394: unable to get minor device block");
diff -Nru a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c
--- a/drivers/s390/char/tape_class.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/s390/char/tape_class.c	Mon Mar 15 15:28:33 2004
@@ -46,13 +46,13 @@
 	cdev->owner = fops->owner;
 	cdev->ops   = fops;
 	cdev->dev   = dev;
-	strcpy(cdev->kobj.name, devname);
+	cdev_set_name(cdev, devname);
 	for (s = strchr(cdev->kobj.name, '/'); s; s = strchr(s, '/'))
 		*s = '!';
 
 	rc = cdev_add(cdev, cdev->dev, 1);
 	if (rc) {
-		kobject_put(&cdev->kobj);
+		cdev_del(cdev);
 		return ERR_PTR(rc);
 	}
 	class_simple_device_add(tape_class, cdev->dev, device, "%s", devname);
diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
--- a/drivers/scsi/sg.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/scsi/sg.c	Mon Mar 15 15:28:33 2004
@@ -1409,7 +1409,7 @@
 	SCSI_LOG_TIMEOUT(3, printk("sg_add: dev=%d \n", k));
 	memset(sdp, 0, sizeof(*sdp));
 	sprintf(disk->disk_name, "sg%d", k);
-	strncpy(cdev->kobj.name, disk->disk_name, KOBJ_NAME_LEN);
+	cdev_set_name(cdev, disk->disk_name);
 	cdev->owner = THIS_MODULE;
 	cdev->ops = &sg_fops;
 	disk->major = SCSI_GENERIC_MAJOR;
@@ -1462,7 +1462,7 @@
 out:
 	put_disk(disk);
 	if (cdev)
-		kobject_put(&cdev->kobj);
+		cdev_del(cdev);
 	return error;
 }
 
diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c	Mon Mar 15 15:28:33 2004
+++ b/drivers/scsi/st.c	Mon Mar 15 15:28:33 2004
@@ -3888,8 +3888,7 @@
 				       dev_num);
 				goto out_free_tape;
 			}
-			snprintf(cdev->kobj.name, KOBJ_NAME_LEN, "%sm%d%s", disk->disk_name,
-				 mode, j ? "n" : "");
+			cdev_set_name(cdev, "%sm%d%s", disk->disk_name, mode, j ? "n" : "");
 			cdev->owner = THIS_MODULE;
 			cdev->ops = &st_fops;
 
@@ -3944,7 +3943,7 @@
 		}
 	}
 	if (cdev)
-		kobject_put(&cdev->kobj);
+		cdev_del(cdev);
 	write_lock(&st_dev_arr_lock);
 	scsi_tapes[dev_num] = NULL;
 	st_nr_dev--;
diff -Nru a/include/linux/cdev.h b/include/linux/cdev.h
--- a/include/linux/cdev.h	Mon Mar 15 15:28:33 2004
+++ b/include/linux/cdev.h	Mon Mar 15 15:28:33 2004
@@ -25,5 +25,7 @@
 
 void cd_forget(struct inode *);
 
+#define cdev_set_name(cdev, args...) kobject_set_name(&((cdev)->kobj), ##args)
+
 #endif
 #endif


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                         ` Greg KH
@ 2004-03-15 23:59                           ` Greg KH
  2004-03-15 23:59                             ` Greg KH
  0 siblings, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-15 23:59 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1608.84.14, 2004/03/12 16:22:36-08:00, greg@kroah.com

remove cdev_set_name completely as it is not needed.


 drivers/char/tty_io.c          |    7 -------
 drivers/ieee1394/amdtp.c       |    1 -
 drivers/ieee1394/dv1394.c      |    1 -
 drivers/ieee1394/raw1394.c     |    1 -
 drivers/ieee1394/video1394.c   |    1 -
 drivers/s390/char/tape_class.c |    3 ---
 drivers/scsi/sg.c              |    1 -
 drivers/scsi/st.c              |    1 -
 include/linux/cdev.h           |    2 --
 9 files changed, 18 deletions(-)


diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/char/tty_io.c	Mon Mar 15 15:28:23 2004
@@ -2274,9 +2274,6 @@
 		driver->termios_locked = NULL;
 	}
 
-	cdev_set_name(&driver->cdev, driver->name);
-	for (s = strchr(driver->cdev.kobj.name, '/'); s; s = strchr(s, '/'))
-		*s = '!';
 	cdev_init(&driver->cdev, &tty_fops);
 	driver->cdev.owner = driver->owner;
 	error = cdev_add(&driver->cdev, dev, driver->num);
@@ -2414,7 +2411,6 @@
  */
 static int __init tty_init(void)
 {
-	cdev_set_name(&tty_cdev, "dev.tty");
 	cdev_init(&tty_cdev, &tty_fops);
 	if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
@@ -2422,7 +2418,6 @@
 	devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty");
 	class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty");
 
-	cdev_set_name(&console_cdev, "dev.console");
 	cdev_init(&console_cdev, &console_fops);
 	if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
@@ -2431,7 +2426,6 @@
 	class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 1), NULL, "console");
 
 #ifdef CONFIG_UNIX98_PTYS
-	cdev_set_name(&ptmx_cdev, "dev.ptmx");
 	cdev_init(&ptmx_cdev, &tty_fops);
 	if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
@@ -2441,7 +2435,6 @@
 #endif
 
 #ifdef CONFIG_VT
-	cdev_set_name(&vc0_cdev, "dev.vc0");
 	cdev_init(&vc0_cdev, &console_fops);
 	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
diff -Nru a/drivers/ieee1394/amdtp.c b/drivers/ieee1394/amdtp.c
--- a/drivers/ieee1394/amdtp.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/ieee1394/amdtp.c	Mon Mar 15 15:28:23 2004
@@ -1266,7 +1266,6 @@
 {
 	cdev_init(&amdtp_cdev, &amdtp_fops);
 	amdtp_cdev.owner = THIS_MODULE;
-	cdev_set_name(&amdtp_cdev, "amdtp");
 	if (cdev_add(&amdtp_cdev, IEEE1394_AMDTP_DEV, 16)) {
 		HPSB_ERR("amdtp: unable to add char device");
  		return -EIO;
diff -Nru a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
--- a/drivers/ieee1394/dv1394.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/ieee1394/dv1394.c	Mon Mar 15 15:28:23 2004
@@ -2616,7 +2616,6 @@
 
 	cdev_init(&dv1394_cdev, &dv1394_fops);
 	dv1394_cdev.owner = THIS_MODULE;
-	cdev_set_name(&dv1394_cdev, "dv1394");
 	ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16);
 	if (ret) {
 		printk(KERN_ERR "dv1394: unable to register character device\n");
diff -Nru a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
--- a/drivers/ieee1394/raw1394.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/ieee1394/raw1394.c	Mon Mar 15 15:28:23 2004
@@ -2746,7 +2746,6 @@
 
 	cdev_init(&raw1394_cdev, &raw1394_fops);
 	raw1394_cdev.owner = THIS_MODULE;
-	cdev_set_name(&raw1394_cdev, RAW1394_DEVICE_NAME);
 	ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1);
 	if (ret) {
 		/* jmc: leaves reference to (static) raw1394_cdev */
diff -Nru a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
--- a/drivers/ieee1394/video1394.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/ieee1394/video1394.c	Mon Mar 15 15:28:23 2004
@@ -1457,7 +1457,6 @@
 
 	cdev_init(&video1394_cdev, &video1394_fops);
 	video1394_cdev.owner = THIS_MODULE;
-	cdev_set_name(&video1394_cdev, VIDEO1394_DRIVER_NAME);
 	ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
 	if (ret) {
 		PRINT_G(KERN_ERR, "video1394: unable to get minor device block");
diff -Nru a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c
--- a/drivers/s390/char/tape_class.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/s390/char/tape_class.c	Mon Mar 15 15:28:23 2004
@@ -46,9 +46,6 @@
 	cdev->owner = fops->owner;
 	cdev->ops   = fops;
 	cdev->dev   = dev;
-	cdev_set_name(cdev, devname);
-	for (s = strchr(cdev->kobj.name, '/'); s; s = strchr(s, '/'))
-		*s = '!';
 
 	rc = cdev_add(cdev, cdev->dev, 1);
 	if (rc) {
diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
--- a/drivers/scsi/sg.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/scsi/sg.c	Mon Mar 15 15:28:23 2004
@@ -1409,7 +1409,6 @@
 	SCSI_LOG_TIMEOUT(3, printk("sg_add: dev=%d \n", k));
 	memset(sdp, 0, sizeof(*sdp));
 	sprintf(disk->disk_name, "sg%d", k);
-	cdev_set_name(cdev, disk->disk_name);
 	cdev->owner = THIS_MODULE;
 	cdev->ops = &sg_fops;
 	disk->major = SCSI_GENERIC_MAJOR;
diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c	Mon Mar 15 15:28:23 2004
+++ b/drivers/scsi/st.c	Mon Mar 15 15:28:23 2004
@@ -3888,7 +3888,6 @@
 				       dev_num);
 				goto out_free_tape;
 			}
-			cdev_set_name(cdev, "%sm%d%s", disk->disk_name, mode, j ? "n" : "");
 			cdev->owner = THIS_MODULE;
 			cdev->ops = &st_fops;
 
diff -Nru a/include/linux/cdev.h b/include/linux/cdev.h
--- a/include/linux/cdev.h	Mon Mar 15 15:28:23 2004
+++ b/include/linux/cdev.h	Mon Mar 15 15:28:23 2004
@@ -25,7 +25,5 @@
 
 void cd_forget(struct inode *);
 
-#define cdev_set_name(cdev, args...) kobject_set_name(&((cdev)->kobj), ##args)
-
 #endif
 #endif


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-15 23:59                               ` Greg KH
@ 2004-03-16  7:04                                 ` Christoph Hellwig
  2004-03-16  9:51                                   ` Andrew Morton
  0 siblings, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2004-03-16  7:04 UTC (permalink / raw)
  To: Greg KH, torvalds; +Cc: linux-kernel

On Mon, Mar 15, 2004 at 03:59:09PM -0800, Greg KH wrote:
> ChangeSet 1.1608.84.16, 2004/03/15 14:39:18-08:00, greg@kroah.com
> 
> kref: add kref structure to kernel tree.
> 
> Based on the kobject structure, but much smaller and simpler to use.

Didn't everyone who reviewed this say it's useless bloat.  Andi even got
so far as calling it obsfucation, given that hides simple things behind
an overly complex and wastefull abstraction.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-16  7:04                                 ` Christoph Hellwig
@ 2004-03-16  9:51                                   ` Andrew Morton
  0 siblings, 0 replies; 24+ messages in thread
From: Andrew Morton @ 2004-03-16  9:51 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: greg, torvalds, linux-kernel

Christoph Hellwig <hch@infradead.org> wrote:
>
> On Mon, Mar 15, 2004 at 03:59:09PM -0800, Greg KH wrote:
> > ChangeSet 1.1608.84.16, 2004/03/15 14:39:18-08:00, greg@kroah.com
> > 
> > kref: add kref structure to kernel tree.
> > 
> > Based on the kobject structure, but much smaller and simpler to use.
> 
> Didn't everyone who reviewed this say it's useless bloat.

No.

bix:/usr/src/25> wc -l include/linux/kref.h lib/kref.c
     32 include/linux/kref.h
     60 lib/kref.c
     92 total

bix:/usr/src/25> size lib/kref.o
   text    data     bss     dec     hex filename
    368       0       0     368     170 lib/kref.o

>   Andi even got
> so far as calling it obsfucation, given that hides simple things behind
> an overly complex and wastefull abstraction.

eh?  If there is any argument against this code it is that it is so simple
that the thing which it abstracts is not worth abstracting.  But given that
it is so unwasteful, this seems unimportant.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
       [not found]     ` <1AjwZ-65D-15@gated-at.bofh.it>
@ 2004-03-16 16:14       ` Andi Kleen
  2004-03-16 19:40         ` Greg KH
  2004-03-19  9:17         ` Jamie Lokier
  0 siblings, 2 replies; 24+ messages in thread
From: Andi Kleen @ 2004-03-16 16:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Andrew Morton <akpm@osdl.org> writes:
>
> eh?  If there is any argument against this code it is that it is so simple
> that the thing which it abstracts is not worth abstracting.  But given that
> it is so unwasteful, this seems unimportant.

The bloat argument was about the additional pointer in the dynamic 
data structure (on a 64bit architecture it costs 12 bytes) 

Better would be to pass the callback to kref_put(), but then it would
be even better to just test the return value (callbacks are obfuscation
and should be avoided when not needed)

-Andi


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-16 16:14       ` Andi Kleen
@ 2004-03-16 19:40         ` Greg KH
  2004-03-17  0:01           ` Andi Kleen
  2004-03-19  9:17         ` Jamie Lokier
  1 sibling, 1 reply; 24+ messages in thread
From: Greg KH @ 2004-03-16 19:40 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, linux-kernel

On Tue, Mar 16, 2004 at 05:14:47PM +0100, Andi Kleen wrote:
> Andrew Morton <akpm@osdl.org> writes:
> >
> > eh?  If there is any argument against this code it is that it is so simple
> > that the thing which it abstracts is not worth abstracting.  But given that
> > it is so unwasteful, this seems unimportant.
> 
> The bloat argument was about the additional pointer in the dynamic 
> data structure (on a 64bit architecture it costs 12 bytes) 

Well balance that out against every usb driver re-implemeting the same
get/put logic with an atomic counter and that "bloat of a pointer" just
got lost in the noise of the extra kernel code size increase :)

> Better would be to pass the callback to kref_put(), but then it would
> be even better to just test the return value (callbacks are obfuscation
> and should be avoided when not needed)

You don't always have the same chunk of code doing the last kref_put()
as the one where we know the release function is at.  See the
kobject/driver model code for an example of this.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-16 19:40         ` Greg KH
@ 2004-03-17  0:01           ` Andi Kleen
  0 siblings, 0 replies; 24+ messages in thread
From: Andi Kleen @ 2004-03-17  0:01 UTC (permalink / raw)
  To: Greg KH; +Cc: Andi Kleen, Andrew Morton, linux-kernel

On Tue, Mar 16, 2004 at 11:40:39AM -0800, Greg KH wrote:
> On Tue, Mar 16, 2004 at 05:14:47PM +0100, Andi Kleen wrote:
> > Andrew Morton <akpm@osdl.org> writes:
> > >
> > > eh?  If there is any argument against this code it is that it is so simple
> > > that the thing which it abstracts is not worth abstracting.  But given that
> > > it is so unwasteful, this seems unimportant.
> > 
> > The bloat argument was about the additional pointer in the dynamic 
> > data structure (on a 64bit architecture it costs 12 bytes) 
> 
> Well balance that out against every usb driver re-implemeting the same
> get/put logic with an atomic counter and that "bloat of a pointer" just

Yes, all those one and two liners duplicated ... scary.

> got lost in the noise of the extra kernel code size increase :)

Have you ever looked how many instructions 
	
	if (!atomic_dec_and_test(&foo->ref))
		release(foo) 

generated? Code size makes no difference here at all.

Dynamic object bloat is much worse than code bloat anyways because you
can have thousands of these objects.

-Andi

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-16 16:14       ` Andi Kleen
  2004-03-16 19:40         ` Greg KH
@ 2004-03-19  9:17         ` Jamie Lokier
  2004-03-19 11:52           ` Giuseppe Bilotta
  1 sibling, 1 reply; 24+ messages in thread
From: Jamie Lokier @ 2004-03-19  9:17 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, linux-kernel

Andi Kleen wrote:
> > eh?  If there is any argument against this code it is that it is so simple
> > that the thing which it abstracts is not worth abstracting.  But given that
> > it is so unwasteful, this seems unimportant.
> 
> The bloat argument was about the additional pointer in the dynamic 
> data structure (on a 64bit architecture it costs 12 bytes) 

This is one place where C++-style vtable inheritance would help.
Many of those *_operations tables could logically derive from a kref_operations table.

I doubt if there is a nice to way to represent it with C macros, but
maybe there is.

-- Jamie

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Driver Core update for 2.6.4
  2004-03-19  9:17         ` Jamie Lokier
@ 2004-03-19 11:52           ` Giuseppe Bilotta
  0 siblings, 0 replies; 24+ messages in thread
From: Giuseppe Bilotta @ 2004-03-19 11:52 UTC (permalink / raw)
  To: linux-kernel

Jamie Lokier wrote:
> Andi Kleen wrote:
> > > eh?  If there is any argument against this code it is that it is so simple
> > > that the thing which it abstracts is not worth abstracting.  But given that
> > > it is so unwasteful, this seems unimportant.
> > 
> > The bloat argument was about the additional pointer in the dynamic 
> > data structure (on a 64bit architecture it costs 12 bytes) 
> 
> This is one place where C++-style vtable inheritance would help.
> Many of those *_operations tables could logically derive from a kref_operations table.
> 
> I doubt if there is a nice to way to represent it with C macros, but
> maybe there is.

(Stupid idea) Has anybody thought about using "Lightweight C++"?

-- 
Giuseppe "Oblomov" Bilotta

Can't you see
It all makes perfect sense
Expressed in dollar and cents
Pounds shillings and pence
                  (Roger Waters)


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2004-03-19 11:52 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-15 23:55 [BK PATCH] Driver Core update for 2.6.4 Greg KH
2004-03-15 23:59 ` [PATCH] " Greg KH
2004-03-15 23:59   ` Greg KH
2004-03-15 23:59     ` Greg KH
2004-03-15 23:59       ` Greg KH
2004-03-15 23:59         ` Greg KH
2004-03-15 23:59           ` Greg KH
2004-03-15 23:59             ` Greg KH
2004-03-15 23:59               ` Greg KH
2004-03-15 23:59                 ` Greg KH
2004-03-15 23:59                   ` Greg KH
2004-03-15 23:59                     ` Greg KH
2004-03-15 23:59                       ` Greg KH
2004-03-15 23:59                         ` Greg KH
2004-03-15 23:59                           ` Greg KH
2004-03-15 23:59                             ` Greg KH
2004-03-15 23:59                               ` Greg KH
2004-03-16  7:04                                 ` Christoph Hellwig
2004-03-16  9:51                                   ` Andrew Morton
     [not found] <1AajM-5vw-21@gated-at.bofh.it>
     [not found] ` <1Abpq-6Av-1@gated-at.bofh.it>
     [not found]   ` <1Aj3K-5Fn-9@gated-at.bofh.it>
     [not found]     ` <1AjwZ-65D-15@gated-at.bofh.it>
2004-03-16 16:14       ` Andi Kleen
2004-03-16 19:40         ` Greg KH
2004-03-17  0:01           ` Andi Kleen
2004-03-19  9:17         ` Jamie Lokier
2004-03-19 11:52           ` Giuseppe Bilotta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox