public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] print_dev_t for 2.6.0-test1-mm
Date: Wed, 16 Jul 2003 11:46:09 -0700	[thread overview]
Message-ID: <20030716184609.GA1913@kroah.com> (raw)

Hi,

Here's a patch against 2.6.0-test1-mm that fixes up the different places
where we export a dev_t to userspace.  This fixes all of the compiler
warnings that were previously reported with these files.

If I should put the print_dev_t() function in a different header file,
please let me know.

thanks,

greg k-h


diff -Naur -X /home/greg/linux/dontdiff linux-2.6.0-test1-mm/drivers/block/genhd.c linux-2.6.0-test1-mm-gregkh/drivers/block/genhd.c
--- linux-2.6.0-test1-mm/drivers/block/genhd.c	2003-07-13 20:34:02.000000000 -0700
+++ linux-2.6.0-test1-mm-gregkh/drivers/block/genhd.c	2003-07-16 11:34:34.755238792 -0700
@@ -336,7 +336,7 @@
 static ssize_t disk_dev_read(struct gendisk * disk, char *page)
 {
 	dev_t base = MKDEV(disk->major, disk->first_minor); 
-	return sprintf(page, "%04x\n", (unsigned)base);
+	return print_dev_t(page, base);
 }
 static ssize_t disk_range_read(struct gendisk * disk, char *page)
 {
diff -Naur -X /home/greg/linux/dontdiff linux-2.6.0-test1-mm/drivers/char/tty_io.c linux-2.6.0-test1-mm-gregkh/drivers/char/tty_io.c
--- linux-2.6.0-test1-mm/drivers/char/tty_io.c	2003-07-13 20:34:49.000000000 -0700
+++ linux-2.6.0-test1-mm-gregkh/drivers/char/tty_io.c	2003-07-16 11:35:40.205288872 -0700
@@ -2106,7 +2106,7 @@
 static ssize_t show_dev(struct class_device *class_dev, char *buf)
 {
 	struct tty_dev *tty_dev = to_tty_dev(class_dev);
-	return sprintf(buf, "%04lx\n", (unsigned long)tty_dev->dev);
+	return print_dev_t(buf, tty_dev->dev);
 }
 static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
 
diff -Naur -X /home/greg/linux/dontdiff linux-2.6.0-test1-mm/drivers/i2c/i2c-dev.c linux-2.6.0-test1-mm-gregkh/drivers/i2c/i2c-dev.c
--- linux-2.6.0-test1-mm/drivers/i2c/i2c-dev.c	2003-07-13 20:36:48.000000000 -0700
+++ linux-2.6.0-test1-mm-gregkh/drivers/i2c/i2c-dev.c	2003-07-16 11:36:23.060773848 -0700
@@ -118,7 +118,7 @@
 static ssize_t show_dev(struct class_device *class_dev, char *buf)
 {
 	struct i2c_dev *i2c_dev = to_i2c_dev(class_dev);
-	return sprintf(buf, "%04x\n", MKDEV(I2C_MAJOR, i2c_dev->minor));
+	return print_dev_t(buf, MKDEV(I2C_MAJOR, i2c_dev->minor));
 }
 static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
 
diff -Naur -X /home/greg/linux/dontdiff linux-2.6.0-test1-mm/drivers/usb/core/file.c linux-2.6.0-test1-mm-gregkh/drivers/usb/core/file.c
--- linux-2.6.0-test1-mm/drivers/usb/core/file.c	2003-07-16 11:25:05.269813736 -0700
+++ linux-2.6.0-test1-mm-gregkh/drivers/usb/core/file.c	2003-07-16 11:33:27.193509736 -0700
@@ -93,7 +93,7 @@
 {
 	struct usb_interface *intf = class_dev_to_usb_interface(class_dev);
 	dev_t dev = MKDEV(USB_MAJOR, intf->minor);
-	return sprintf(buf, "%04lx\n", (unsigned long)dev);
+	return print_dev_t(buf, dev);
 }
 static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
 
diff -Naur -X /home/greg/linux/dontdiff linux-2.6.0-test1-mm/include/linux/kdev_t.h linux-2.6.0-test1-mm-gregkh/include/linux/kdev_t.h
--- linux-2.6.0-test1-mm/include/linux/kdev_t.h	2003-07-16 11:25:05.868722688 -0700
+++ linux-2.6.0-test1-mm-gregkh/include/linux/kdev_t.h	2003-07-16 11:33:05.754768920 -0700
@@ -103,6 +103,11 @@
 	return mk_kdev(ma, mi);
 }
 
+static inline int print_dev_t(char *buffer, dev_t dev)
+{
+	return sprintf(buffer, "%04lx\n", (unsigned long)dev);
+}
+
 #else /* __KERNEL__ */
 
 /*

             reply	other threads:[~2003-07-16 18:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-16 18:46 Greg KH [this message]
2003-07-16 20:09 ` [PATCH] print_dev_t for 2.6.0-test1-mm Andrew Morton
2003-07-16 21:02   ` Greg KH
2003-07-16 21:13     ` Andrew Morton
2003-07-16 21:34       ` Andries Brouwer
2003-07-16 21:39         ` Andrew Morton
2003-07-16 22:10           ` H. Peter Anvin
2003-07-16 22:20           ` Andries Brouwer
2003-07-16 22:21             ` Andrew Morton
2003-07-16 23:44               ` Andries Brouwer
2003-07-16 23:49                 ` Andrew Morton
2003-07-17  8:27                   ` Joel Becker
2003-07-17  8:47                     ` Roman Zippel
2003-07-17  9:15                       ` Joel Becker
2003-07-17  9:24                         ` Andrew Morton
2003-07-17 10:10                           ` Trond Myklebust
2003-07-17 11:46                           ` Andries Brouwer
2003-07-17 11:52                         ` Alan Cox
2003-07-17 10:26                   ` Andries Brouwer
2003-07-17 10:46                     ` Miquel van Smoorenburg
2003-07-17 11:19                       ` Andries Brouwer
2003-07-17 11:46                         ` Miquel van Smoorenburg
2003-07-17 21:55                         ` Andrew Morton
2003-07-17 22:24                           ` Andries Brouwer
2003-07-17 22:43                             ` Joel Becker
2003-07-17 23:11                               ` Andries Brouwer
2003-07-17 23:49                                 ` Miquel van Smoorenburg
2003-07-18  0:04                                   ` Andries Brouwer
2003-07-18  0:04                                 ` Joel Becker
2003-07-18  1:05                                   ` Andries Brouwer
2003-07-18  8:06                                     ` Joel Becker
2003-07-17  3:00             ` H. Peter Anvin
     [not found]             ` <200307170300.UAA24096@cesium.transmeta.com>
2003-07-17 10:43               ` Andries Brouwer
2003-07-20 14:33                 ` H. Peter Anvin
2003-07-16 21:36       ` Greg KH
2003-07-16 22:00         ` Andrew Morton
2003-07-16 22:11           ` what's left for 64 bit dev_t Greg KH
2003-07-16 22:19             ` Andrew Morton
2003-07-16 22:48               ` Greg KH
2003-07-17  3:02                 ` H. Peter Anvin
2003-07-17 13:59               ` Andries Brouwer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030716184609.GA1913@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox