Commit 28614ba4 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] misc devfs_register cleanups

Avoid a bunch of non-NULL first arguments.
parent 3736e632
...@@ -488,7 +488,7 @@ static int ubd_new_disk(int major, u64 size, char *name, int unit, ...@@ -488,7 +488,7 @@ static int ubd_new_disk(int major, u64 size, char *name, int unit,
struct gendisk **disk_out, devfs_handle_t dir_handle, struct gendisk **disk_out, devfs_handle_t dir_handle,
devfs_handle_t *handle_out) devfs_handle_t *handle_out)
{ {
char devfs_name[sizeof("nnnnnn\0")]; char devfs_name[sizeof("ubd/nnnnnn\0")];
struct gendisk *disk; struct gendisk *disk;
int minor = unit << UBD_SHIFT; int minor = unit << UBD_SHIFT;
...@@ -505,8 +505,8 @@ static int ubd_new_disk(int major, u64 size, char *name, int unit, ...@@ -505,8 +505,8 @@ static int ubd_new_disk(int major, u64 size, char *name, int unit,
*disk_out = disk; *disk_out = disk;
/* /dev/ubd/N style names */ /* /dev/ubd/N style names */
sprintf(devfs_name, "%d", unit); sprintf(devfs_name, "ubd/%d", unit);
*handle_out = devfs_register(dir_handle, devfs_name, *handle_out = devfs_register(NULL, devfs_name,
0, major, minor, 0, major, minor,
S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP | S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP, &ubd_blops, NULL); S_IWGRP, &ubd_blops, NULL);
......
...@@ -1095,9 +1095,9 @@ static int swim3_add_device(struct device_node *swim) ...@@ -1095,9 +1095,9 @@ static int swim3_add_device(struct device_node *swim)
printk(KERN_INFO "fd%d: SWIM3 floppy controller %s\n", floppy_count, printk(KERN_INFO "fd%d: SWIM3 floppy controller %s\n", floppy_count,
mediabay ? "in media bay" : ""); mediabay ? "in media bay" : "");
sprintf(floppy_name, "%s%d", floppy_devfs_handle ? "" : "floppy",
floppy_count); sprintf(floppy_name, "floppy/%d", floppy_count);
floppy_handle = devfs_register(floppy_devfs_handle, floppy_name, floppy_handle = devfs_register(NULL, floppy_name,
DEVFS_FL_DEFAULT, FLOPPY_MAJOR, floppy_count, DEVFS_FL_DEFAULT, FLOPPY_MAJOR, floppy_count,
S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP, S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP,
&floppy_fops, NULL); &floppy_fops, NULL);
......
...@@ -444,15 +444,14 @@ static devfs_handle_t handles[MAX_DEVICES]; ...@@ -444,15 +444,14 @@ static devfs_handle_t handles[MAX_DEVICES];
static void ipmi_new_smi(int if_num) static void ipmi_new_smi(int if_num)
{ {
char name[2]; char name[10];
if (if_num > MAX_DEVICES) if (if_num > MAX_DEVICES)
return; return;
name[0] = if_num + '0'; snprinf(name, sizeof(name), "ipmidev/%d", if_num);
name[1] = '\0';
handles[if_num] = devfs_register(devfs_handle, name, DEVFS_FL_NONE, handles[if_num] = devfs_register(NULL, name, DEVFS_FL_NONE,
ipmi_major, if_num, ipmi_major, if_num,
S_IFCHR | S_IRUSR | S_IWUSR, S_IFCHR | S_IRUSR | S_IWUSR,
&ipmi_fops, NULL); &ipmi_fops, NULL);
......
...@@ -1251,7 +1251,7 @@ static int video1394_init(struct ti_ohci *ohci) ...@@ -1251,7 +1251,7 @@ static int video1394_init(struct ti_ohci *ohci)
{ {
struct video_card *video; struct video_card *video;
unsigned long flags; unsigned long flags;
char name[16]; char name[24];
int minor; int minor;
video = kmalloc(sizeof(struct video_card), GFP_KERNEL); video = kmalloc(sizeof(struct video_card), GFP_KERNEL);
...@@ -1270,9 +1270,9 @@ static int video1394_init(struct ti_ohci *ohci) ...@@ -1270,9 +1270,9 @@ static int video1394_init(struct ti_ohci *ohci)
video->id = ohci->id; video->id = ohci->id;
video->ohci = ohci; video->ohci = ohci;
sprintf(name, "%d", video->id); sprintf(name, "%s/%d", VIDEO1394_DRIVER_NAME, video->id);
minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + video->id; minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + video->id;
video->devfs = devfs_register(devfs_handle, name, DEVFS_FL_DEFAULT, video->devfs = devfs_register(NULL, name, DEVFS_FL_DEFAULT,
IEEE1394_MAJOR, minor, IEEE1394_MAJOR, minor,
S_IFCHR | S_IRUSR | S_IWUSR, S_IFCHR | S_IRUSR | S_IWUSR,
&video1394_fops, NULL); &video1394_fops, NULL);
......
...@@ -178,6 +178,7 @@ dasd_state_new_to_known(dasd_device_t *device) ...@@ -178,6 +178,7 @@ dasd_state_new_to_known(dasd_device_t *device)
umode_t devfs_perm; umode_t devfs_perm;
devfs_handle_t dir; devfs_handle_t dir;
int major, minor; int major, minor;
char buf[20];
/* Increase reference count of bdev. */ /* Increase reference count of bdev. */
if (bdget(MKDEV(device->gdp->major, device->gdp->first_minor)) == NULL) if (bdget(MKDEV(device->gdp->major, device->gdp->first_minor)) == NULL)
...@@ -198,7 +199,9 @@ dasd_state_new_to_known(dasd_device_t *device) ...@@ -198,7 +199,9 @@ dasd_state_new_to_known(dasd_device_t *device)
devfs_perm = S_IFBLK | S_IRUSR; devfs_perm = S_IFBLK | S_IRUSR;
else else
devfs_perm = S_IFBLK | S_IRUSR | S_IWUSR; devfs_perm = S_IFBLK | S_IRUSR | S_IWUSR;
device->devfs_entry = devfs_register(dir, "device", DEVFS_FL_DEFAULT,
snprintf(buf, sizeof(buf), "dasd/%04x/device", device->devno);
device->devfs_entry = devfs_register(NULL, buf, 0,
major, minor << DASD_PARTN_BITS, major, minor << DASD_PARTN_BITS,
devfs_perm, devfs_perm,
&dasd_device_operations, NULL); &dasd_device_operations, NULL);
......
...@@ -74,8 +74,7 @@ fs3270_init(void) ...@@ -74,8 +74,7 @@ fs3270_init(void)
} }
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
fs3270_devfs_dir = devfs_mk_dir("3270"); fs3270_devfs_dir = devfs_mk_dir("3270");
fs3270_devfs_tub = fs3270_devfs_tub = devfs_register(NULL, "3270/tub", 0,
devfs_register(fs3270_devfs_dir, "tub", DEVFS_FL_DEFAULT,
IBM_FS3270_MAJOR, 0, IBM_FS3270_MAJOR, 0,
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
&fs3270_fops, NULL); &fs3270_fops, NULL);
......
...@@ -684,7 +684,7 @@ int hiddev_connect(struct hid_device *hid) ...@@ -684,7 +684,7 @@ int hiddev_connect(struct hid_device *hid)
struct hiddev *hiddev; struct hiddev *hiddev;
int minor, i; int minor, i;
int retval; int retval;
char devfs_name[16]; char devfs_name[24];
for (i = 0; i < hid->maxcollection; i++) for (i = 0; i < hid->maxcollection; i++)
if (hid->collection[i].type == if (hid->collection[i].type ==
...@@ -715,8 +715,8 @@ int hiddev_connect(struct hid_device *hid) ...@@ -715,8 +715,8 @@ int hiddev_connect(struct hid_device *hid)
hiddev->hid = hid; hiddev->hid = hid;
hiddev->exist = 1; hiddev->exist = 1;
sprintf(devfs_name, "hiddev%d", minor); sprintf(devfs_name, "usb/hid/hiddev%d", minor);
hiddev->devfs = devfs_register(hiddev_devfs_handle, devfs_name, hiddev->devfs = devfs_register(NULL, devfs_name,
DEVFS_FL_DEFAULT, USB_MAJOR, minor + HIDDEV_MINOR_BASE, DEVFS_FL_DEFAULT, USB_MAJOR, minor + HIDDEV_MINOR_BASE,
S_IFCHR | S_IRUGO | S_IWUSR, &hiddev_fops, NULL); S_IFCHR | S_IRUGO | S_IWUSR, &hiddev_fops, NULL);
hid->minor = minor; hid->minor = minor;
......
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