+ return-class-device-pointer-from-tty_register_device.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     return class device pointer from tty_register_device()

has been added to the -mm tree.  Its filename is

     return-class-device-pointer-from-tty_register_device.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this


From: Hansjoerg Lipp <hjlipp@xxxxxx>

Let tty_register_device() return a pointer to the class device it creates. 
This allows registrants to add their own sysfs files under the class device
node.

Signed-off-by: Hansjoerg Lipp <hjlipp@xxxxxx>
Signed-off-by: Tilman Schmidt <tilman@xxxxxxx>
Cc: Greg KH <greg@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/char/tty_io.c |   11 +++++++----
 include/linux/tty.h   |    4 +++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff -puN drivers/char/tty_io.c~return-class-device-pointer-from-tty_register_device drivers/char/tty_io.c
--- devel/drivers/char/tty_io.c~return-class-device-pointer-from-tty_register_device	2006-04-23 15:32:26.000000000 -0700
+++ devel-akpm/drivers/char/tty_io.c	2006-04-23 15:32:26.000000000 -0700
@@ -2961,12 +2961,14 @@ static struct class *tty_class;
  *	This field is optional, if there is no known struct device for this
  *	tty device it can be set to NULL safely.
  *
+ * Returns a pointer to the class device (or ERR_PTR(-Efoo) on error).
+ *
  * This call is required to be made to register an individual tty device if
  * the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set.  If that
  * bit is not set, this function should not be called.
  */
-void tty_register_device(struct tty_driver *driver, unsigned index,
-			 struct device *device)
+struct class_device *tty_register_device(struct tty_driver *driver,
+					 unsigned index, struct device *device)
 {
 	char name[64];
 	dev_t dev = MKDEV(driver->major, driver->minor_start) + index;
@@ -2974,7 +2976,7 @@ void tty_register_device(struct tty_driv
 	if (index >= driver->num) {
 		printk(KERN_ERR "Attempt to register invalid tty line number "
 		       " (%d).\n", index);
-		return;
+		return ERR_PTR(-EINVAL);
 	}
 
 	devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
@@ -2984,7 +2986,8 @@ void tty_register_device(struct tty_driv
 		pty_line_name(driver, index, name);
 	else
 		tty_line_name(driver, index, name);
-	class_device_create(tty_class, NULL, dev, device, "%s", name);
+
+	return class_device_create(tty_class, NULL, dev, device, "%s", name);
 }
 
 /**
diff -puN include/linux/tty.h~return-class-device-pointer-from-tty_register_device include/linux/tty.h
--- devel/include/linux/tty.h~return-class-device-pointer-from-tty_register_device	2006-04-23 15:32:26.000000000 -0700
+++ devel-akpm/include/linux/tty.h	2006-04-23 15:32:26.000000000 -0700
@@ -291,7 +291,9 @@ extern int tty_register_ldisc(int disc, 
 extern int tty_unregister_ldisc(int disc);
 extern int tty_register_driver(struct tty_driver *driver);
 extern int tty_unregister_driver(struct tty_driver *driver);
-extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev);
+extern struct class_device *tty_register_device(struct tty_driver *driver,
+						unsigned index,
+						struct device *dev);
 extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
 extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
 			     int buflen);
_

Patches currently in -mm which might be from hjlipp@xxxxxx are

origin.patch
return-class-device-pointer-from-tty_register_device.patch
i4l-gigaset-move-sysfs-entry-to-tty-class.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux