Skip to content

Commit

Permalink
switch device_get_devnode() and ->devnode() to umode_t *
Browse files Browse the repository at this point in the history
both callers of device_get_devnode() are only interested in lower 16bits
and nobody tries to return anything wider than 16bit anyway.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jan 4, 2012
1 parent 7d54fa6 commit 2c9ede5
Show file tree
Hide file tree
Showing 31 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier =
.notifier_call = cpuid_class_cpu_callback,
};

static char *cpuid_devnode(struct device *dev, mode_t *mode)
static char *cpuid_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
}
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/msr.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static struct notifier_block __refdata msr_class_cpu_notifier = {
.notifier_call = msr_class_cpu_callback,
};

static char *msr_devnode(struct device *dev, mode_t *mode)
static char *msr_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
}
Expand Down
2 changes: 1 addition & 1 deletion block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ EXPORT_SYMBOL_GPL(bsg_register_queue);

static struct cdev bsg_cdev;

static char *bsg_devnode(struct device *dev, mode_t *mode)
static char *bsg_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ struct class block_class = {
.name = "block",
};

static char *block_devnode(struct device *dev, mode_t *mode)
static char *block_devnode(struct device *dev, umode_t *mode)
{
struct gendisk *disk = dev_to_disk(dev);

Expand Down
4 changes: 2 additions & 2 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
if (MAJOR(dev->devt)) {
const char *tmp;
const char *name;
mode_t mode = 0;
umode_t mode = 0;

add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt));
add_uevent_var(env, "MINOR=%u", MINOR(dev->devt));
Expand Down Expand Up @@ -1182,7 +1182,7 @@ static struct device *next_device(struct klist_iter *i)
* freed by the caller.
*/
const char *device_get_devnode(struct device *dev,
mode_t *mode, const char **tmp)
umode_t *mode, const char **tmp)
{
char *s;

Expand Down
2 changes: 1 addition & 1 deletion drivers/base/devtmpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static struct req {
struct completion done;
int err;
const char *name;
mode_t mode; /* 0 => delete */
umode_t mode; /* 0 => delete */
struct device *dev;
} *requests;

Expand Down
2 changes: 1 addition & 1 deletion drivers/block/aoe/aoechr.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static const struct file_operations aoe_fops = {
.llseek = noop_llseek,
};

static char *aoe_devnode(struct device *dev, mode_t *mode)
static char *aoe_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2817,7 +2817,7 @@ static const struct block_device_operations pktcdvd_ops = {
.check_events = pkt_check_events,
};

static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode)
static char *pktcdvd_devnode(struct gendisk *gd, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ static const struct file_operations kmsg_fops = {

static const struct memdev {
const char *name;
mode_t mode;
umode_t mode;
const struct file_operations *fops;
struct backing_dev_info *dev_info;
} devlist[] = {
Expand Down Expand Up @@ -901,7 +901,7 @@ static const struct file_operations memory_fops = {
.llseek = noop_llseek,
};

static char *mem_devnode(struct device *dev, mode_t *mode)
static char *mem_devnode(struct device *dev, umode_t *mode)
{
if (mode && devlist[MINOR(dev->devt)].mode)
*mode = devlist[MINOR(dev->devt)].mode;
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ int misc_deregister(struct miscdevice *misc)
EXPORT_SYMBOL(misc_register);
EXPORT_SYMBOL(misc_deregister);

static char *misc_devnode(struct device *dev, mode_t *mode)
static char *misc_devnode(struct device *dev, umode_t *mode)
{
struct miscdevice *c = dev_get_drvdata(dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ static const struct file_operations raw_ctl_fops = {

static struct cdev raw_cdev;

static char *raw_devnode(struct device *dev, mode_t *mode)
static char *raw_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/tile-srom.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static struct device_attribute srom_dev_attrs[] = {
__ATTR_NULL
};

static char *srom_devnode(struct device *dev, mode_t *mode)
static char *srom_devnode(struct device *dev, umode_t *mode)
{
*mode = S_IRUGO | S_IWUSR;
return kasprintf(GFP_KERNEL, "srom/%s", dev_name(dev));
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int drm_class_resume(struct device *dev)
return 0;
}

static char *drm_devnode(struct device *dev, mode_t *mode)
static char *drm_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/usbhid/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ static const struct file_operations hiddev_fops = {
.llseek = noop_llseek,
};

static char *hiddev_devnode(struct device *dev, mode_t *mode)
static char *hiddev_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3659,7 +3659,7 @@ static struct kobj_type cm_port_obj_type = {
.release = cm_release_port_obj
};

static char *cm_devnode(struct device *dev, mode_t *mode)
static char *cm_devnode(struct device *dev, umode_t *mode)
{
if (mode)
*mode = 0666;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/user_mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ static void ib_umad_remove_one(struct ib_device *device)
kref_put(&umad_dev->ref, ib_umad_release_dev);
}

static char *umad_devnode(struct device *dev, mode_t *mode)
static char *umad_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ static void ib_uverbs_remove_one(struct ib_device *device)
kfree(uverbs_dev);
}

static char *uverbs_devnode(struct device *dev, mode_t *mode)
static char *uverbs_devnode(struct device *dev, umode_t *mode)
{
if (mode)
*mode = 0666;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ static struct device_type input_dev_type = {
#endif
};

static char *input_devnode(struct device *dev, mode_t *mode)
static char *input_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/dvb/ddbridge/ddbridge-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,7 @@ static const struct file_operations ddb_fops = {
.open = ddb_open,
};

static char *ddb_devnode(struct device *device, mode_t *mode)
static char *ddb_devnode(struct device *device, umode_t *mode)
{
struct ddb *dev = dev_get_drvdata(device);

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/dvb/dvb-core/dvbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
return 0;
}

static char *dvb_devnode(struct device *dev, mode_t *mode)
static char *dvb_devnode(struct device *dev, umode_t *mode)
{
struct dvb_device *dvbdev = dev_get_drvdata(dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/rc/rc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ static void ir_close(struct input_dev *idev)
}

/* class for /sys/class/rc */
static char *ir_devnode(struct device *dev, mode_t *mode)
static char *ir_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3267,7 +3267,7 @@ void __init console_init(void)
}
}

static char *tty_devnode(struct device *dev, mode_t *mode)
static char *tty_devnode(struct device *dev, umode_t *mode)
{
if (!mode)
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/class/usblp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ static const struct file_operations usblp_fops = {
.llseek = noop_llseek,
};

static char *usblp_devnode(struct device *dev, mode_t *mode)
static char *usblp_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static struct usb_class {
struct class *class;
} *usb_class;

static char *usb_devnode(struct device *dev, mode_t *mode)
static char *usb_devnode(struct device *dev, umode_t *mode)
{
struct usb_class_driver *drv;

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ static const struct dev_pm_ops usb_device_pm_ops = {
#endif /* CONFIG_PM */


static char *usb_devnode(struct device *dev, mode_t *mode)
static char *usb_devnode(struct device *dev, umode_t *mode)
{
struct usb_device *usb_dev;

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/iowarrior.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static const struct file_operations iowarrior_fops = {
.llseek = noop_llseek,
};

static char *iowarrior_devnode(struct device *dev, mode_t *mode)
static char *iowarrior_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/legousbtower.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static const struct file_operations tower_fops = {
.llseek = tower_llseek,
};

static char *legousbtower_devnode(struct device *dev, mode_t *mode)
static char *legousbtower_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
}
Expand Down
6 changes: 3 additions & 3 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ struct class {
struct kobject *dev_kobj;

int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
char *(*devnode)(struct device *dev, mode_t *mode);
char *(*devnode)(struct device *dev, umode_t *mode);

void (*class_release)(struct class *class);
void (*dev_release)(struct device *dev);
Expand Down Expand Up @@ -423,7 +423,7 @@ struct device_type {
const char *name;
const struct attribute_group **groups;
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
char *(*devnode)(struct device *dev, mode_t *mode);
char *(*devnode)(struct device *dev, umode_t *mode);
void (*release)(struct device *dev);

const struct dev_pm_ops *pm;
Expand Down Expand Up @@ -720,7 +720,7 @@ extern int device_rename(struct device *dev, const char *new_name);
extern int device_move(struct device *dev, struct device *new_parent,
enum dpm_order dpm_order);
extern const char *device_get_devnode(struct device *dev,
mode_t *mode, const char **tmp);
umode_t *mode, const char **tmp);
extern void *dev_get_drvdata(const struct device *dev);
extern int dev_set_drvdata(struct device *dev, void *data);

Expand Down
2 changes: 1 addition & 1 deletion include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ struct gendisk {
* disks that can't be partitioned. */

char disk_name[DISK_NAME_LEN]; /* name of major driver */
char *(*devnode)(struct gendisk *gd, mode_t *mode);
char *(*devnode)(struct gendisk *gd, umode_t *mode);

unsigned int events; /* supported events */
unsigned int async_events; /* async events, subset of all */
Expand Down
2 changes: 1 addition & 1 deletion include/linux/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ extern struct bus_type usb_bus_type;
*/
struct usb_class_driver {
char *name;
char *(*devnode)(struct device *dev, mode_t *mode);
char *(*devnode)(struct device *dev, umode_t *mode);
const struct file_operations *fops;
int minor_base;
};
Expand Down
2 changes: 1 addition & 1 deletion sound/sound_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MODULE_DESCRIPTION("Core sound module");
MODULE_AUTHOR("Alan Cox");
MODULE_LICENSE("GPL");

static char *sound_devnode(struct device *dev, mode_t *mode)
static char *sound_devnode(struct device *dev, umode_t *mode)
{
if (MAJOR(dev->devt) == SOUND_MAJOR)
return NULL;
Expand Down

0 comments on commit 2c9ede5

Please sign in to comment.