Input: simplify name handling for certain input handles

For evdev, joydev and mousedev, instead of having a separate character array
holding name of the handle, use struct devce's name which is the same.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Thadeu Lima de Souza Cascardo 2009-05-09 16:08:04 -07:00 committed by Dmitry Torokhov
parent 7e044e056a
commit 3d5cb60ef3
3 changed files with 14 additions and 18 deletions

View file

@ -39,7 +39,6 @@ struct joydev {
int exist;
int open;
int minor;
char name[16];
struct input_handle handle;
wait_queue_head_t wait;
struct list_head client_list;
@ -537,12 +536,14 @@ static int joydev_ioctl_common(struct joydev *joydev,
default:
if ((cmd & ~IOCSIZE_MASK) == JSIOCGNAME(0)) {
int len;
if (!dev->name)
const char *name = dev_name(&dev->dev);
if (!name)
return 0;
len = strlen(dev->name) + 1;
len = strlen(name) + 1;
if (len > _IOC_SIZE(cmd))
len = _IOC_SIZE(cmd);
if (copy_to_user(argp, dev->name, len))
if (copy_to_user(argp, name, len))
return -EFAULT;
return len;
}
@ -742,13 +743,13 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
mutex_init(&joydev->mutex);
init_waitqueue_head(&joydev->wait);
snprintf(joydev->name, sizeof(joydev->name), "js%d", minor);
dev_set_name(&joydev->dev, "js%d", minor);
joydev->exist = 1;
joydev->minor = minor;
joydev->exist = 1;
joydev->handle.dev = input_get_device(dev);
joydev->handle.name = joydev->name;
joydev->handle.name = dev_name(&joydev->dev);
joydev->handle.handler = handler;
joydev->handle.private = joydev;
@ -797,7 +798,6 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
}
}
dev_set_name(&joydev->dev, joydev->name);
joydev->dev.devt = MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor);
joydev->dev.class = &input_class;
joydev->dev.parent = &dev->dev;