[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1305840792-25877-6-git-send-email-jim.cromie@gmail.com>
Date: Thu, 19 May 2011 15:33:08 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: linux-kernel@...r.kernel.org
Cc: gregkh@...e.de, Jim Cromie <jim.cromie@...il.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
Roland Dreier <roland@...nel.org>,
Sean Hefty <sean.hefty@...el.com>, linux-rdma@...r.kernel.org
Subject: [PATCH 05/23] use register_chrdev_ids in drivers/infiniband/
Since new api passes dev_t*, hoist inline MKDEV out to local var
assignment, and replace other inline MKDEVs with new var.
This patch brought to you by coccinelle/spatch,
with some manual rework afterwards.
cc: Hal Rosenstock <hal.rosenstock@...il.com>
cc: Roland Dreier <roland@...nel.org>
cc: Sean Hefty <sean.hefty@...el.com>
cc: linux-rdma@...r.kernel.org
@ rcr_md @
identifier f;
expression major, minor;
expression ct, name;
@@
f(...) {
// ++ gives multiple inserts, needed for tty_io.c, fix up manually
// fresh identifier apparently also helps here
++ dev_t devt;
++ devt = MKDEV(major,minor);
<+...
- register_chrdev_region
+ register_chrdev_ids
(
- MKDEV(major,minor),
+ &devt,
ct, name)
...+>
}
@ all_md depends on rcr_md @ // where above changes made, also do
identifier f;
expression major, minor;
@@
f(...) {
dev_t devt;
devt = MKDEV(major,minor);
<+...
- MKDEV(major,minor)
+ devt
...+>
}
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
drivers/infiniband/core/ucm.c | 2 +-
drivers/infiniband/core/user_mad.c | 7 ++++---
drivers/infiniband/core/uverbs_main.c | 3 ++-
drivers/infiniband/hw/ipath/ipath_file_ops.c | 2 +-
drivers/infiniband/hw/qib/qib_file_ops.c | 2 +-
5 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index 08f948d..472a7b2 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1244,7 +1244,7 @@ static int find_overflow_devnum(void)
int ret;
if (!overflow_maj) {
- ret = alloc_chrdev_region(&overflow_maj, 0, IB_UCM_MAX_DEVICES,
+ ret = register_chrdev_ids(&overflow_maj, IB_UCM_MAX_DEVICES,
"infiniband_cm");
if (ret) {
printk(KERN_ERR "ucm: couldn't register dynamic device number\n");
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index cd1996d..7352683 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -980,7 +980,8 @@ static int find_overflow_devnum(void)
int ret;
if (!overflow_maj) {
- ret = alloc_chrdev_region(&overflow_maj, 0, IB_UMAD_MAX_PORTS * 2,
+ ret = register_chrdev_ids(&overflow_maj,
+ IB_UMAD_MAX_PORTS * 2,
"infiniband_mad");
if (ret) {
printk(KERN_ERR "user_mad: couldn't register dynamic device number\n");
@@ -1180,8 +1181,8 @@ static int __init ib_umad_init(void)
{
int ret;
- ret = register_chrdev_region(base_dev, IB_UMAD_MAX_PORTS * 2,
- "infiniband_mad");
+ ret = register_chrdev_ids(&base_dev, IB_UMAD_MAX_PORTS * 2,
+ "infiniband_mad");
if (ret) {
printk(KERN_ERR "user_mad: couldn't register device number\n");
goto out;
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index ec83e9f..2f92115 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -711,7 +711,8 @@ static int find_overflow_devnum(void)
int ret;
if (!overflow_maj) {
- ret = alloc_chrdev_region(&overflow_maj, 0, IB_UVERBS_MAX_DEVICES,
+ ret = register_chrdev_ids(&overflow_maj,
+ IB_UVERBS_MAX_DEVICES,
"infiniband_verbs");
if (ret) {
printk(KERN_ERR "user_verbs: couldn't register dynamic device number\n");
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index ee79a2d..04abb61 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -2519,7 +2519,7 @@ static int user_init(void)
{
int ret;
- ret = register_chrdev_region(dev, IPATH_NMINORS, IPATH_DRV_NAME);
+ ret = register_chrdev_ids(&dev, IPATH_NMINORS, IPATH_DRV_NAME);
if (ret < 0) {
printk(KERN_ERR IPATH_DRV_NAME ": Could not register "
"chrdev region (err %d)\n", -ret);
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c
index 406fca5..a5ecea2 100644
--- a/drivers/infiniband/hw/qib/qib_file_ops.c
+++ b/drivers/infiniband/hw/qib/qib_file_ops.c
@@ -2238,7 +2238,7 @@ int __init qib_dev_init(void)
{
int ret;
- ret = alloc_chrdev_region(&qib_dev, 0, QIB_NMINORS, QIB_DRV_NAME);
+ ret = register_chrdev_ids(&qib_dev, QIB_NMINORS, QIB_DRV_NAME);
if (ret < 0) {
printk(KERN_ERR QIB_DRV_NAME ": Could not allocate "
"chrdev region (err %d)\n", -ret);
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists