mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@suse.de, Jim Cromie <jim.cromie@gmail.com>,
	devel@driverdev.osuosl.org
Subject: [PATCH 09/23] use register_chrdev_ids in drivers/staging/
Date: Thu, 19 May 2011 15:33:12 -0600	[thread overview]
Message-ID: <1305840792-25877-10-git-send-email-jim.cromie@gmail.com> (raw)
In-Reply-To: <1305840792-25877-1-git-send-email-jim.cromie@gmail.com>

cc: Greg Kroah-Hartman <gregkh@suse.de>
cc: devel@driverdev.osuosl.org
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 drivers/staging/comedi/comedi_fops.c             |   15 ++++++---------
 drivers/staging/cs5535_gpio/cs5535_gpio.c        |   10 +---------
 drivers/staging/iio/industrialio-core.c          |    2 +-
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    2 +-
 4 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index e7e72b8..55f831f 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1960,6 +1960,7 @@ static int __init comedi_init(void)
 {
 	int i;
 	int retval;
+	dev_t devt = MKDEV(COMEDI_MAJOR, 0);
 
 	printk(KERN_INFO "comedi: version " COMEDI_RELEASE
 	       " - http://www.comedi.org\n");
@@ -1983,24 +1984,21 @@ static int __init comedi_init(void)
 	memset(comedi_file_info_table, 0,
 	       sizeof(struct comedi_device_file_info *) * COMEDI_NUM_MINORS);
 
-	retval = register_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
-					COMEDI_NUM_MINORS, "comedi");
+	retval = register_chrdev_ids(&devt, COMEDI_NUM_MINORS, "comedi");
 	if (retval)
 		return -EIO;
 	cdev_init(&comedi_cdev, &comedi_fops);
 	comedi_cdev.owner = THIS_MODULE;
 	kobject_set_name(&comedi_cdev.kobj, "comedi");
-	if (cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS)) {
-		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
-					 COMEDI_NUM_MINORS);
+	if (cdev_add(&comedi_cdev, devt, COMEDI_NUM_MINORS)) {
+		unregister_chrdev_region(devt, COMEDI_NUM_MINORS);
 		return -EIO;
 	}
 	comedi_class = class_create(THIS_MODULE, "comedi");
 	if (IS_ERR(comedi_class)) {
 		printk(KERN_ERR "comedi: failed to create class");
 		cdev_del(&comedi_cdev);
-		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
-					 COMEDI_NUM_MINORS);
+		unregister_chrdev_region(devt, COMEDI_NUM_MINORS);
 		return PTR_ERR(comedi_class);
 	}
 
@@ -2014,8 +2012,7 @@ static int __init comedi_init(void)
 		if (minor < 0) {
 			comedi_cleanup_legacy_minors();
 			cdev_del(&comedi_cdev);
-			unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
-						 COMEDI_NUM_MINORS);
+			unregister_chrdev_region(devt, COMEDI_NUM_MINORS);
 			return minor;
 		}
 	}
diff --git a/drivers/staging/cs5535_gpio/cs5535_gpio.c b/drivers/staging/cs5535_gpio/cs5535_gpio.c
index b25f9d1..539a08a 100644
--- a/drivers/staging/cs5535_gpio/cs5535_gpio.c
+++ b/drivers/staging/cs5535_gpio/cs5535_gpio.c
@@ -223,15 +223,7 @@ static int __init cs5535_gpio_init(void)
 		return -ENODEV;
 	}
 
-	if (major) {
-		dev_id = MKDEV(major, 0);
-		retval = register_chrdev_region(dev_id, CS5535_GPIO_COUNT,
-						NAME);
-	} else {
-		retval = alloc_chrdev_region(&dev_id, 0, CS5535_GPIO_COUNT,
-					     NAME);
-		major = MAJOR(dev_id);
-	}
+	retval = register_chrdev_ids(&dev_id, CS5535_GPIO_COUNT, NAME);
 
 	if (retval) {
 		release_region(gpio_base, CS5535_GPIO_SIZE);
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 1795ee1..1ef7198 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -443,7 +443,7 @@ static int __init iio_dev_init(void)
 {
 	int err;
 
-	err = alloc_chrdev_region(&iio_devt, 0, IIO_DEV_MAX, "iio");
+	err = register_chrdev_ids(&iio_devt, IIO_DEV_MAX, "iio");
 	if (err < 0)
 		printk(KERN_ERR "%s: failed to allocate char dev region\n",
 		       __FILE__);
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index c43c7e3..ec7773f 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -349,7 +349,7 @@ static int __devinit omap34_xx_bridge_probe(struct platform_device *pdev)
 		goto err1;
 
 	/* use 2.6 device model */
-	err = alloc_chrdev_region(&dev, 0, 1, driver_name);
+	err = register_chrdev_ids(&dev, 1, driver_name);
 	if (err) {
 		pr_err("%s: Can't get major %d\n", __func__, driver_major);
 		goto err1;
-- 
1.7.4.4


  parent reply	other threads:[~2011-05-19 21:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 21:33 [PATCH 00/23] add register_chrdev_ids() to char_dev.c, API Jim Cromie
2011-05-19 21:33 ` [PATCH 02/23] reimplement alloc_chrdev_region with register_chrdev_ids Jim Cromie
2011-05-19 21:33 ` [PATCH 03/23] use register_chrdev_ids to replace (register|alloc)_chrdev_region Jim Cromie
2011-05-19 21:33 ` [PATCH 04/23] use register_chrdev_ids in drivers/tty/ Jim Cromie
2011-05-19 21:33 ` [PATCH 05/23] use register_chrdev_ids in drivers/infiniband/ Jim Cromie
2011-05-19 21:33 ` [PATCH 06/23] use register_chrdev_ids in drivers/media/ Jim Cromie
2011-05-21 12:48   ` Mauro Carvalho Chehab
2011-05-19 21:33 ` [PATCH 07/23] use register_chrdev_ids in drivers/s390/ Jim Cromie
2011-05-19 21:33 ` [PATCH 08/23] use register_chrdev_ids in drivers/scsi/ Jim Cromie
2011-05-20 15:42   ` Boaz Harrosh
2011-05-21  4:21     ` Jim Cromie
2011-05-21  7:59       ` Boaz Harrosh
2011-05-19 21:33 ` Jim Cromie [this message]
2011-05-19 22:44 ` [PATCH 00/23] add register_chrdev_ids() to char_dev.c, API Greg KH
2011-05-21  5:15   ` Jim Cromie
2011-05-21 21:14     ` Greg KH
2011-05-22 14:55       ` Greg KH

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=1305840792-25877-10-git-send-email-jim.cromie@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --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

all inboxes | Powered by JetHome®