Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133274
b: refs/heads/master
c: b233b28
h: refs/heads/master
v: v3
  • Loading branch information
Adrian McMenamin authored and Paul Mundt committed Feb 27, 2009
1 parent c53bcef commit eb2efa3
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 267 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: 41480ae7a383dcffa497decdd97b3cb2caaa18ec
refs/heads/master: b233b28eac0cc37d07c2d007ea08c86c778c5af4
4 changes: 2 additions & 2 deletions trunk/drivers/input/joystick/maplecontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Based on drivers/usb/iforce.c
*
* Copyright Yaegashi Takeshi, 2001
* Adrian McMenamin, 2008
* Adrian McMenamin, 2008 - 2009
*/

#include <linux/kernel.h>
Expand All @@ -29,7 +29,7 @@ static void dc_pad_callback(struct mapleq *mq)
struct maple_device *mapledev = mq->dev;
struct dc_pad *pad = maple_get_drvdata(mapledev);
struct input_dev *dev = pad->dev;
unsigned char *res = mq->recvbuf;
unsigned char *res = mq->recvbuf->buf;

buttons = ~le16_to_cpup((__le16 *)(res + 8));

Expand Down
37 changes: 22 additions & 15 deletions trunk/drivers/input/keyboard/maple_keyb.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* SEGA Dreamcast keyboard driver
* Based on drivers/usb/usbkbd.c
* Copyright YAEGASHI Takeshi, 2001
* Porting to 2.6 Copyright Adrian McMenamin, 2007, 2008
* Copyright (c) YAEGASHI Takeshi, 2001
* Porting to 2.6 Copyright (c) Adrian McMenamin, 2007 - 2009
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -33,7 +33,7 @@ static DEFINE_MUTEX(maple_keyb_mutex);

#define NR_SCANCODES 256

MODULE_AUTHOR("YAEGASHI Takeshi, Adrian McMenamin");
MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk");
MODULE_DESCRIPTION("SEGA Dreamcast keyboard driver");
MODULE_LICENSE("GPL");

Expand Down Expand Up @@ -115,7 +115,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd)
input_event(dev, EV_MSC, MSC_SCAN, code);
input_report_key(dev, keycode, 0);
} else
printk(KERN_DEBUG "maple_keyb: "
dev_dbg(&dev->dev,
"Unknown key (scancode %#x) released.",
code);
}
Expand All @@ -127,7 +127,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd)
input_event(dev, EV_MSC, MSC_SCAN, code);
input_report_key(dev, keycode, 1);
} else
printk(KERN_DEBUG "maple_keyb: "
dev_dbg(&dev->dev,
"Unknown key (scancode %#x) pressed.",
code);
}
Expand All @@ -140,7 +140,7 @@ static void dc_kbd_callback(struct mapleq *mq)
{
struct maple_device *mapledev = mq->dev;
struct dc_kbd *kbd = maple_get_drvdata(mapledev);
unsigned long *buf = mq->recvbuf;
unsigned long *buf = (unsigned long *)(mq->recvbuf->buf);

/*
* We should always get the lock because the only
Expand All @@ -159,22 +159,27 @@ static void dc_kbd_callback(struct mapleq *mq)

static int probe_maple_kbd(struct device *dev)
{
struct maple_device *mdev = to_maple_dev(dev);
struct maple_driver *mdrv = to_maple_driver(dev->driver);
struct maple_device *mdev;
struct maple_driver *mdrv;
int i, error;
struct dc_kbd *kbd;
struct input_dev *idev;

if (!(mdev->function & MAPLE_FUNC_KEYBOARD))
return -EINVAL;
mdev = to_maple_dev(dev);
mdrv = to_maple_driver(dev->driver);

kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
idev = input_allocate_device();
if (!kbd || !idev) {
if (!kbd) {
error = -ENOMEM;
goto fail;
}

idev = input_allocate_device();
if (!idev) {
error = -ENOMEM;
goto fail_idev_alloc;
}

kbd->dev = idev;
memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode));

Expand All @@ -195,7 +200,7 @@ static int probe_maple_kbd(struct device *dev)

error = input_register_device(idev);
if (error)
goto fail;
goto fail_register;

/* Maple polling is locked to VBLANK - which may be just 50/s */
maple_getcond_callback(mdev, dc_kbd_callback, HZ/50,
Expand All @@ -207,10 +212,12 @@ static int probe_maple_kbd(struct device *dev)

return error;

fail:
fail_register:
maple_set_drvdata(mdev, NULL);
input_free_device(idev);
fail_idev_alloc:
kfree(kbd);
maple_set_drvdata(mdev, NULL);
fail:
return error;
}

Expand Down
Loading

0 comments on commit eb2efa3

Please sign in to comment.