Commit 792dd4fc authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds
Browse files

ubd: stop defintining MAJOR_NR



MAJOR_NR isn't needed anymore since very early 2.5 kernels.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bf9ed57d
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
* James McMechan * James McMechan
*/ */
#define MAJOR_NR UBD_MAJOR
#define UBD_SHIFT 4 #define UBD_SHIFT 4
#include "linux/kernel.h" #include "linux/kernel.h"
...@@ -115,7 +114,7 @@ static struct block_device_operations ubd_blops = { ...@@ -115,7 +114,7 @@ static struct block_device_operations ubd_blops = {
}; };
/* Protected by ubd_lock */ /* Protected by ubd_lock */
static int fake_major = MAJOR_NR; static int fake_major = UBD_MAJOR;
static struct gendisk *ubd_gendisk[MAX_DEV]; static struct gendisk *ubd_gendisk[MAX_DEV];
static struct gendisk *fake_gendisk[MAX_DEV]; static struct gendisk *fake_gendisk[MAX_DEV];
...@@ -299,7 +298,7 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out) ...@@ -299,7 +298,7 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
} }
mutex_lock(&ubd_lock); mutex_lock(&ubd_lock);
if(fake_major != MAJOR_NR){ if (fake_major != UBD_MAJOR) {
*error_out = "Can't assign a fake major twice"; *error_out = "Can't assign a fake major twice";
goto out1; goto out1;
} }
...@@ -818,13 +817,13 @@ static int ubd_disk_register(int major, u64 size, int unit, ...@@ -818,13 +817,13 @@ static int ubd_disk_register(int major, u64 size, int unit,
disk->first_minor = unit << UBD_SHIFT; disk->first_minor = unit << UBD_SHIFT;
disk->fops = &ubd_blops; disk->fops = &ubd_blops;
set_capacity(disk, size / 512); set_capacity(disk, size / 512);
if(major == MAJOR_NR) if (major == UBD_MAJOR)
sprintf(disk->disk_name, "ubd%c", 'a' + unit); sprintf(disk->disk_name, "ubd%c", 'a' + unit);
else else
sprintf(disk->disk_name, "ubd_fake%d", unit); sprintf(disk->disk_name, "ubd_fake%d", unit);
/* sysfs register (not for ide fake devices) */ /* sysfs register (not for ide fake devices) */
if (major == MAJOR_NR) { if (major == UBD_MAJOR) {
ubd_devs[unit].pdev.id = unit; ubd_devs[unit].pdev.id = unit;
ubd_devs[unit].pdev.name = DRIVER_NAME; ubd_devs[unit].pdev.name = DRIVER_NAME;
ubd_devs[unit].pdev.dev.release = ubd_device_release; ubd_devs[unit].pdev.dev.release = ubd_device_release;
...@@ -871,13 +870,13 @@ static int ubd_add(int n, char **error_out) ...@@ -871,13 +870,13 @@ static int ubd_add(int n, char **error_out)
ubd_dev->queue->queuedata = ubd_dev; ubd_dev->queue->queuedata = ubd_dev;
blk_queue_max_hw_segments(ubd_dev->queue, MAX_SG); blk_queue_max_hw_segments(ubd_dev->queue, MAX_SG);
err = ubd_disk_register(MAJOR_NR, ubd_dev->size, n, &ubd_gendisk[n]); err = ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, &ubd_gendisk[n]);
if(err){ if(err){
*error_out = "Failed to register device"; *error_out = "Failed to register device";
goto out_cleanup; goto out_cleanup;
} }
if(fake_major != MAJOR_NR) if (fake_major != UBD_MAJOR)
ubd_disk_register(fake_major, ubd_dev->size, n, ubd_disk_register(fake_major, ubd_dev->size, n,
&fake_gendisk[n]); &fake_gendisk[n]);
...@@ -1059,10 +1058,10 @@ static int __init ubd_init(void) ...@@ -1059,10 +1058,10 @@ static int __init ubd_init(void)
char *error; char *error;
int i, err; int i, err;
if (register_blkdev(MAJOR_NR, "ubd")) if (register_blkdev(UBD_MAJOR, "ubd"))
return -1; return -1;
if (fake_major != MAJOR_NR) { if (fake_major != UBD_MAJOR) {
char name[sizeof("ubd_nnn\0")]; char name[sizeof("ubd_nnn\0")];
snprintf(name, sizeof(name), "ubd_%d", fake_major); snprintf(name, sizeof(name), "ubd_%d", fake_major);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment