Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58501
b: refs/heads/master
c: 7deeed1
h: refs/heads/master
i:
  58499: bb32960
v: v3
  • Loading branch information
Benjamin Gilbert authored and Jens Axboe committed Jul 10, 2007
1 parent a1c08f4 commit a8ea375
Show file tree
Hide file tree
Showing 33 changed files with 1,132 additions and 1,624 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 65f88f89c94d877794a6006f210d75d2974a182e
refs/heads/master: 7deeed13170e634adc4552ff94588d6301a3da83
2 changes: 1 addition & 1 deletion trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ W: http://www.openib.org/
T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
S: Supported

INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS
INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS
P: Dmitry Torokhov
M: dmitry.torokhov@gmail.com
M: dtor@mail.ru
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/char/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,8 @@ static const unsigned short x86_keycodes[256] =
284,285,309, 0,312, 91,327,328,329,331,333,335,336,337,338,339,
367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349,
360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355,
103,104,105,275,287,279,258,106,274,107,294,364,358,363,362,361,
291,108,381,281,290,272,292,305,280, 99,112,257,306,359,113,114,
103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361,
291,108,381,281,290,272,292,305,280, 99,112,257,258,359,113,114,
264,117,271,374,379,265,266, 93, 94, 95, 85,259,375,260, 90,116,
377,109,111,277,278,282,283,295,296,297,299,300,301,293,303,307,
308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330,
Expand Down
84 changes: 42 additions & 42 deletions trunk/drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ struct evdev {
wait_queue_head_t wait;
struct evdev_client *grab;
struct list_head client_list;
struct device dev;
};

struct evdev_client {
Expand Down Expand Up @@ -95,10 +94,8 @@ static int evdev_flush(struct file *file, fl_owner_t id)
return input_flush_device(&evdev->handle, file);
}

static void evdev_free(struct device *dev)
static void evdev_free(struct evdev *evdev)
{
struct evdev *evdev = container_of(dev, struct evdev, dev);

evdev_table[evdev->minor] = NULL;
kfree(evdev);
}
Expand All @@ -117,10 +114,12 @@ static int evdev_release(struct inode *inode, struct file *file)
list_del(&client->node);
kfree(client);

if (!--evdev->open && evdev->exist)
input_close_device(&evdev->handle);

put_device(&evdev->dev);
if (!--evdev->open) {
if (evdev->exist)
input_close_device(&evdev->handle);
else
evdev_free(evdev);
}

return 0;
}
Expand All @@ -140,32 +139,24 @@ static int evdev_open(struct inode *inode, struct file *file)
if (!evdev || !evdev->exist)
return -ENODEV;

get_device(&evdev->dev);

client = kzalloc(sizeof(struct evdev_client), GFP_KERNEL);
if (!client) {
error = -ENOMEM;
goto err_put_evdev;
}
if (!client)
return -ENOMEM;

client->evdev = evdev;
list_add_tail(&client->node, &evdev->client_list);

if (!evdev->open++ && evdev->exist) {
error = input_open_device(&evdev->handle);
if (error)
goto err_free_client;
if (error) {
list_del(&client->node);
kfree(client);
return error;
}
}

file->private_data = client;
return 0;

err_free_client:
list_del(&client->node);
kfree(client);
err_put_evdev:
put_device(&evdev->dev);
return error;
}

#ifdef CONFIG_COMPAT
Expand Down Expand Up @@ -634,6 +625,8 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
const struct input_device_id *id)
{
struct evdev *evdev;
struct class_device *cdev;
dev_t devt;
int minor;
int error;

Expand All @@ -656,32 +649,38 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
evdev->handle.name = evdev->name;
evdev->handle.handler = handler;
evdev->handle.private = evdev;
snprintf(evdev->name, sizeof(evdev->name), "event%d", minor);

snprintf(evdev->dev.bus_id, sizeof(evdev->dev.bus_id),
"event%d", minor);
evdev->dev.class = &input_class;
evdev->dev.parent = &dev->dev;
evdev->dev.devt = MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor);
evdev->dev.release = evdev_free;
device_initialize(&evdev->dev);
sprintf(evdev->name, "event%d", minor);

evdev_table[minor] = evdev;

error = device_add(&evdev->dev);
if (error)
devt = MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),

cdev = class_device_create(&input_class, &dev->cdev, devt,
dev->cdev.dev, evdev->name);
if (IS_ERR(cdev)) {
error = PTR_ERR(cdev);
goto err_free_evdev;
}

/* temporary symlink to keep userspace happy */
error = sysfs_create_link(&input_class.subsys.kobj,
&cdev->kobj, evdev->name);
if (error)
goto err_cdev_destroy;

error = input_register_handle(&evdev->handle);
if (error)
goto err_delete_evdev;
goto err_remove_link;

return 0;

err_delete_evdev:
device_del(&evdev->dev);
err_remove_link:
sysfs_remove_link(&input_class.subsys.kobj, evdev->name);
err_cdev_destroy:
class_device_destroy(&input_class, devt);
err_free_evdev:
put_device(&evdev->dev);
kfree(evdev);
evdev_table[minor] = NULL;
return error;
}

Expand All @@ -691,8 +690,10 @@ static void evdev_disconnect(struct input_handle *handle)
struct evdev_client *client;

input_unregister_handle(handle);
device_del(&evdev->dev);

sysfs_remove_link(&input_class.subsys.kobj, evdev->name);
class_device_destroy(&input_class,
MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
evdev->exist = 0;

if (evdev->open) {
Expand All @@ -701,9 +702,8 @@ static void evdev_disconnect(struct input_handle *handle)
list_for_each_entry(client, &evdev->client_list, node)
kill_fasync(&client->fasync, SIGIO, POLL_HUP);
wake_up_interruptible(&evdev->wait);
}

put_device(&evdev->dev);
} else
evdev_free(evdev);
}

static const struct input_device_id evdev_ids[] = {
Expand Down
Loading

0 comments on commit a8ea375

Please sign in to comment.