Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/dtor/input:
  Input: iforce - remove some pointless casts
  Input: psmouse - add support for Intellimouse 4.0
  Input: atkbd - fix HANGEUL/HANJA keys
  Input: fix misspelling of Hangeul key
  Input: via-pmu - add input device support
  Input: rearrange exports
  Input: fix formatting to better follow CodingStyle
  Input: reset name, phys and uniq when unregistering
  Input: return correct size when reading modalias attribute
  Input: change my e-mail address in MAINTAINERS file
  Input: fix potential overflows in driver/input/keyboard
  Input: fix potential overflows in driver/input/touchscreen
  Input: fix potential overflows in driver/input/joystick
  Input: fix potential overflows in driver/input/mouse
  Input: fix accuracy of fixp-arith.h
  Input: iforce - use ENOSPC instead of ENOMEM
  Input: constify drivers/char/keyboard.c
  • Loading branch information
Linus Torvalds committed Jun 26, 2006
2 parents 954b36d + e2e8115 commit cdf4f38
Show file tree
Hide file tree
Showing 45 changed files with 515 additions and 248 deletions.
3 changes: 2 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,8 @@ S: Supported

INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS
P: Dmitry Torokhov
M: dtor_core@ameritech.net
M: dmitry.torokhov@gmail.com
M: dtor@mail.ru
L: linux-input@atrey.karlin.mff.cuni.cz
L: linux-joystick@atrey.karlin.mff.cuni.cz
T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git
Expand Down
16 changes: 9 additions & 7 deletions drivers/char/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struc
*/
static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs)
{
static unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' };
static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' };
value = ret_diacr[value];
k_deadunicode(vc, value, up_flag, regs);
}
Expand Down Expand Up @@ -711,8 +711,8 @@ static void k_cur(struct vc_data *vc, unsigned char value, char up_flag, struct

static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs)
{
static const char *pad_chars = "0123456789+-*/\015,.?()#";
static const char *app_map = "pqrstuvwxylSRQMnnmPQS";
static const char pad_chars[] = "0123456789+-*/\015,.?()#";
static const char app_map[] = "pqrstuvwxylSRQMnnmPQS";

if (up_flag)
return; /* no action, if this is a key release */
Expand Down Expand Up @@ -1037,7 +1037,7 @@ static void kbd_refresh_leds(struct input_handle *handle)
#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\
((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001))

static unsigned short x86_keycodes[256] =
static const unsigned short x86_keycodes[256] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
Expand Down Expand Up @@ -1075,11 +1075,13 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode,
put_queue(vc, 0x1d | up_flag);
put_queue(vc, 0x45 | up_flag);
return 0;
case KEY_HANGUEL:
if (!up_flag) put_queue(vc, 0xf1);
case KEY_HANGEUL:
if (!up_flag)
put_queue(vc, 0xf2);
return 0;
case KEY_HANJA:
if (!up_flag) put_queue(vc, 0xf2);
if (!up_flag)
put_queue(vc, 0xf1);
return 0;
}

Expand Down
10 changes: 8 additions & 2 deletions drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,19 @@ static int evdev_fasync(int fd, struct file *file, int on)
{
int retval;
struct evdev_list *list = file->private_data;

retval = fasync_helper(fd, file, on, &list->fasync);

return retval < 0 ? retval : 0;
}

static int evdev_flush(struct file * file, fl_owner_t id)
static int evdev_flush(struct file *file, fl_owner_t id)
{
struct evdev_list *list = file->private_data;
if (!list->evdev->exist) return -ENODEV;

if (!list->evdev->exist)
return -ENODEV;

return input_flush_device(&list->evdev->handle, file);
}

Expand Down Expand Up @@ -300,6 +305,7 @@ static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count
static unsigned int evdev_poll(struct file *file, poll_table *wait)
{
struct evdev_list *list = file->private_data;

poll_wait(file, &list->evdev->wait, wait);
return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) |
(list->evdev->exist ? 0 : (POLLHUP | POLLERR));
Expand Down
85 changes: 57 additions & 28 deletions drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
MODULE_DESCRIPTION("Input core");
MODULE_LICENSE("GPL");

EXPORT_SYMBOL(input_allocate_device);
EXPORT_SYMBOL(input_register_device);
EXPORT_SYMBOL(input_unregister_device);
EXPORT_SYMBOL(input_register_handler);
EXPORT_SYMBOL(input_unregister_handler);
EXPORT_SYMBOL(input_grab_device);
EXPORT_SYMBOL(input_release_device);
EXPORT_SYMBOL(input_open_device);
EXPORT_SYMBOL(input_close_device);
EXPORT_SYMBOL(input_accept_process);
EXPORT_SYMBOL(input_flush_device);
EXPORT_SYMBOL(input_event);
EXPORT_SYMBOL_GPL(input_class);

#define INPUT_DEVICES 256

static LIST_HEAD(input_dev_list);
Expand All @@ -63,11 +49,13 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
case EV_SYN:
switch (code) {
case SYN_CONFIG:
if (dev->event) dev->event(dev, type, code, value);
if (dev->event)
dev->event(dev, type, code, value);
break;

case SYN_REPORT:
if (dev->sync) return;
if (dev->sync)
return;
dev->sync = 1;
break;
}
Expand Down Expand Up @@ -136,7 +124,8 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
if (code > MSC_MAX || !test_bit(code, dev->mscbit))
return;

if (dev->event) dev->event(dev, type, code, value);
if (dev->event)
dev->event(dev, type, code, value);

break;

Expand All @@ -146,7 +135,9 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
return;

change_bit(code, dev->led);
if (dev->event) dev->event(dev, type, code, value);

if (dev->event)
dev->event(dev, type, code, value);

break;

Expand All @@ -158,21 +149,25 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
if (!!test_bit(code, dev->snd) != !!value)
change_bit(code, dev->snd);

if (dev->event) dev->event(dev, type, code, value);
if (dev->event)
dev->event(dev, type, code, value);

break;

case EV_REP:

if (code > REP_MAX || value < 0 || dev->rep[code] == value) return;
if (code > REP_MAX || value < 0 || dev->rep[code] == value)
return;

dev->rep[code] = value;
if (dev->event) dev->event(dev, type, code, value);
if (dev->event)
dev->event(dev, type, code, value);

break;

case EV_FF:
if (dev->event) dev->event(dev, type, code, value);
if (dev->event)
dev->event(dev, type, code, value);
break;
}

Expand All @@ -186,6 +181,7 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
if (handle->open)
handle->handler->event(handle, type, code, value);
}
EXPORT_SYMBOL(input_event);

static void input_repeat_key(unsigned long data)
{
Expand All @@ -208,6 +204,7 @@ int input_accept_process(struct input_handle *handle, struct file *file)

return 0;
}
EXPORT_SYMBOL(input_accept_process);

int input_grab_device(struct input_handle *handle)
{
Expand All @@ -217,12 +214,14 @@ int input_grab_device(struct input_handle *handle)
handle->dev->grab = handle;
return 0;
}
EXPORT_SYMBOL(input_grab_device);

void input_release_device(struct input_handle *handle)
{
if (handle->dev->grab == handle)
handle->dev->grab = NULL;
}
EXPORT_SYMBOL(input_release_device);

int input_open_device(struct input_handle *handle)
{
Expand All @@ -245,6 +244,7 @@ int input_open_device(struct input_handle *handle)

return err;
}
EXPORT_SYMBOL(input_open_device);

int input_flush_device(struct input_handle* handle, struct file* file)
{
Expand All @@ -253,6 +253,7 @@ int input_flush_device(struct input_handle* handle, struct file* file)

return 0;
}
EXPORT_SYMBOL(input_flush_device);

void input_close_device(struct input_handle *handle)
{
Expand All @@ -268,6 +269,7 @@ void input_close_device(struct input_handle *handle)

mutex_unlock(&dev->mutex);
}
EXPORT_SYMBOL(input_close_device);

static void input_link_handle(struct input_handle *handle)
{
Expand Down Expand Up @@ -335,9 +337,11 @@ static inline void input_wakeup_procfs_readers(void)
static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait)
{
int state = input_devices_state;

poll_wait(file, &input_devices_poll_wait, wait);
if (state != input_devices_state)
return POLLIN | POLLRDNORM;

return 0;
}

Expand Down Expand Up @@ -629,7 +633,7 @@ static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf)

len = input_print_modalias(buf, PAGE_SIZE, id, 1);

return max_t(int, len, PAGE_SIZE);
return min_t(int, len, PAGE_SIZE);
}
static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL);

Expand Down Expand Up @@ -862,6 +866,7 @@ struct class input_class = {
.release = input_dev_release,
.uevent = input_dev_uevent,
};
EXPORT_SYMBOL_GPL(input_class);

struct input_dev *input_allocate_device(void)
{
Expand All @@ -872,12 +877,27 @@ struct input_dev *input_allocate_device(void)
dev->dynalloc = 1;
dev->cdev.class = &input_class;
class_device_initialize(&dev->cdev);
mutex_init(&dev->mutex);
INIT_LIST_HEAD(&dev->h_list);
INIT_LIST_HEAD(&dev->node);
}

return dev;
}
EXPORT_SYMBOL(input_allocate_device);

void input_free_device(struct input_dev *dev)
{
if (dev) {

mutex_lock(&dev->mutex);
dev->name = dev->phys = dev->uniq = NULL;
mutex_unlock(&dev->mutex);

input_put_device(dev);
}
}
EXPORT_SYMBOL(input_free_device);

int input_register_device(struct input_dev *dev)
{
Expand All @@ -895,7 +915,6 @@ int input_register_device(struct input_dev *dev)
return -EINVAL;
}

mutex_init(&dev->mutex);
set_bit(EV_SYN, dev->evbit);

/*
Expand Down Expand Up @@ -956,12 +975,14 @@ int input_register_device(struct input_dev *dev)
fail1: class_device_del(&dev->cdev);
return error;
}
EXPORT_SYMBOL(input_register_device);

void input_unregister_device(struct input_dev *dev)
{
struct list_head * node, * next;
struct list_head *node, *next;

if (!dev) return;
if (!dev)
return;

del_timer_sync(&dev->timer);

Expand All @@ -979,16 +1000,22 @@ void input_unregister_device(struct input_dev *dev)
sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group);
class_device_unregister(&dev->cdev);

mutex_lock(&dev->mutex);
dev->name = dev->phys = dev->uniq = NULL;
mutex_unlock(&dev->mutex);

input_wakeup_procfs_readers();
}
EXPORT_SYMBOL(input_unregister_device);

void input_register_handler(struct input_handler *handler)
{
struct input_dev *dev;
struct input_handle *handle;
struct input_device_id *id;

if (!handler) return;
if (!handler)
return;

INIT_LIST_HEAD(&handler->h_list);

Expand All @@ -1005,10 +1032,11 @@ void input_register_handler(struct input_handler *handler)

input_wakeup_procfs_readers();
}
EXPORT_SYMBOL(input_register_handler);

void input_unregister_handler(struct input_handler *handler)
{
struct list_head * node, * next;
struct list_head *node, *next;

list_for_each_safe(node, next, &handler->h_list) {
struct input_handle * handle = to_handle_h(node);
Expand All @@ -1024,6 +1052,7 @@ void input_unregister_handler(struct input_handler *handler)

input_wakeup_procfs_readers();
}
EXPORT_SYMBOL(input_unregister_handler);

static int input_open_file(struct inode *inode, struct file *file)
{
Expand Down
Loading

0 comments on commit cdf4f38

Please sign in to comment.