aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joydev.c
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>2009-05-09 19:08:04 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-05-11 03:11:43 -0400
commit3d5cb60ef3042ac479dab82e5a945966a0d54d53 (patch)
tree08793f3c88b8d218fc934b3769bcc4e2aee993c9 /drivers/input/joydev.c
parent7e044e056a6aa0dc695db50461d7b326fde15e8b (diff)
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>
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r--drivers/input/joydev.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 4224f0112849..15bb41195bea 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -39,7 +39,6 @@ struct joydev {
39 int exist; 39 int exist;
40 int open; 40 int open;
41 int minor; 41 int minor;
42 char name[16];
43 struct input_handle handle; 42 struct input_handle handle;
44 wait_queue_head_t wait; 43 wait_queue_head_t wait;
45 struct list_head client_list; 44 struct list_head client_list;
@@ -537,12 +536,14 @@ static int joydev_ioctl_common(struct joydev *joydev,
537 default: 536 default:
538 if ((cmd & ~IOCSIZE_MASK) == JSIOCGNAME(0)) { 537 if ((cmd & ~IOCSIZE_MASK) == JSIOCGNAME(0)) {
539 int len; 538 int len;
540 if (!dev->name) 539 const char *name = dev_name(&dev->dev);
540
541 if (!name)
541 return 0; 542 return 0;
542 len = strlen(dev->name) + 1; 543 len = strlen(name) + 1;
543 if (len > _IOC_SIZE(cmd)) 544 if (len > _IOC_SIZE(cmd))
544 len = _IOC_SIZE(cmd); 545 len = _IOC_SIZE(cmd);
545 if (copy_to_user(argp, dev->name, len)) 546 if (copy_to_user(argp, name, len))
546 return -EFAULT; 547 return -EFAULT;
547 return len; 548 return len;
548 } 549 }
@@ -742,13 +743,13 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
742 mutex_init(&joydev->mutex); 743 mutex_init(&joydev->mutex);
743 init_waitqueue_head(&joydev->wait); 744 init_waitqueue_head(&joydev->wait);
744 745
745 snprintf(joydev->name, sizeof(joydev->name), "js%d", minor); 746 dev_set_name(&joydev->dev, "js%d", minor);
746 joydev->exist = 1; 747 joydev->exist = 1;
747 joydev->minor = minor; 748 joydev->minor = minor;
748 749
749 joydev->exist = 1; 750 joydev->exist = 1;
750 joydev->handle.dev = input_get_device(dev); 751 joydev->handle.dev = input_get_device(dev);
751 joydev->handle.name = joydev->name; 752 joydev->handle.name = dev_name(&joydev->dev);
752 joydev->handle.handler = handler; 753 joydev->handle.handler = handler;
753 joydev->handle.private = joydev; 754 joydev->handle.private = joydev;
754 755
@@ -797,7 +798,6 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
797 } 798 }
798 } 799 }
799 800
800 dev_set_name(&joydev->dev, joydev->name);
801 joydev->dev.devt = MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor); 801 joydev->dev.devt = MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor);
802 joydev->dev.class = &input_class; 802 joydev->dev.class = &input_class;
803 joydev->dev.parent = &dev->dev; 803 joydev->dev.parent = &dev->dev;