From: Adrian McMenamin <adrian@newgolddream.dyndns.info>
To: Paul Mundt <lethal@linux-sh.org>
Cc: Greg KH <greg@kroah.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
dwmw2 <dwmw2@infradead.org>, linux-sh <linux-sh@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-input <linux-input@vger.kernel.org>,
MTD <linux-mtd@lists.infradead.org>
Subject: [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (3/3)
Date: Thu, 29 Jan 2009 00:18:07 +0000 [thread overview]
Message-ID: <1233188287.6734.32.camel@localhost.localdomain> (raw)
In-Reply-To: <1233187750.6734.27.camel@localhost.localdomain>
Consequential patch to the maple keyboard driver and general fix to the keyboard driver.
Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
---
diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c
index 22f17a5..8d3bb1d 100644
--- a/drivers/input/keyboard/maple_keyb.c
+++ b/drivers/input/keyboard/maple_keyb.c
@@ -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
@@ -159,22 +159,41 @@ 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);
+ if (!mdev) {
+ error = EINVAL;
+ goto fail;
+ }
+
+ mdrv = to_maple_driver(dev->driver);
+ if (!mdrv) {
+ error = EINVAL;
+ goto fail;
+ }
+
+ if (!(mdev->function & MAPLE_FUNC_KEYBOARD)) {
+ error = EINVAL;
+ goto fail;
+ }
kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
- idev = input_allocate_device();
- if (!kbd || !idev) {
- error = -ENOMEM;
+ 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));
@@ -195,7 +214,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,
@@ -207,11 +226,13 @@ 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);
- return error;
+fail:
+ return -error;
}
static int remove_maple_kbd(struct device *dev)
next prev parent reply other threads:[~2009-01-29 0:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 23:47 [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (0/3) Adrian McMenamin
2009-01-28 23:57 ` [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (1/3) Adrian McMenamin
2009-01-29 0:09 ` [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (2/3) Adrian McMenamin
2009-01-29 0:18 ` Adrian McMenamin [this message]
2009-01-29 2:57 ` [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (3/3) Paul Mundt
2009-01-29 10:34 ` Adrian McMenamin
2009-01-29 5:46 ` Mike Frysinger
2009-01-29 0:44 ` [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (2/3) Mike Frysinger
2009-01-29 0:49 ` Adrian McMenamin
2009-01-29 1:12 ` Mike Frysinger
2009-01-29 0:42 ` [PATCH RFC] sh: maple: Add support for SEGA Dreamcast VMU and clean up maple bus driver (1/3) Mike Frysinger
2009-01-29 3:13 ` Paul Mundt
2009-01-29 16:43 ` Adrian McMenamin
[not found] ` <3ca9ec7a13c1a13ea7be6c37bbdfdb0c.squirrel@newgolddream.dyndns.info>
2009-01-29 16:51 ` Adrian McMenamin
2009-01-30 9:55 ` Adrian McMenamin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233188287.6734.32.camel@localhost.localdomain \
--to=adrian@newgolddream.dyndns.info \
--cc=dmitry.torokhov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=greg@kroah.com \
--cc=lethal@linux-sh.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).