linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: Clean up maple keyboard driver
@ 2008-06-15 19:43 Adrian McMenamin
  2008-07-18 22:43 ` Paul Mundt
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian McMenamin @ 2008-06-15 19:43 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: lkml, linux-input, linux-sh, Paul Mundt

Have a single probe function instead of a probe and a connect function.
Also tidy a comment.
1 files changed, 33 insertions(+), 48 deletions(-)


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 94e9b3f..37ad346 100644
--- a/drivers/input/keyboard/maple_keyb.c
+++ b/drivers/input/keyboard/maple_keyb.c
@@ -144,8 +144,8 @@ static void dc_kbd_callback(struct mapleq *mq)
 	unsigned long *buf = mq->recvbuf;
 
 	/*
-	 * We should always be getting the lock because the only
-	 * time it may be locked if driver is in cleanup phase.
+	 * We should always get the lock because the only
+	 * time it may be locked is if driver is in cleanup phase.
 	 */
 	if (likely(mutex_trylock(&maple_keyb_mutex))) {
 
@@ -158,63 +158,73 @@ static void dc_kbd_callback(struct mapleq *mq)
 	}
 }
 
-static int dc_kbd_connect(struct maple_device *mdev)
+
+/* allow the keyboard to be used */
+static int probe_maple_kbd(struct device *dev)
 {
-	int i, error;
+	struct maple_device *mdev = to_maple_dev(dev);
+	struct maple_driver *mdrv = to_maple_driver(dev->driver);
 	struct dc_kbd *kbd;
-	struct input_dev *dev;
+	struct input_dev *idev;
+	int error, i;
 
 	kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
 	if (!kbd) {
 		error = -ENOMEM;
 		goto fail_kbd;
 	}
-	dev = input_allocate_device();
-	if (!dev) {
+
+	idev = input_allocate_device();
+	if (!idev) {
 		error = -ENOMEM;
 		goto fail_dev;
 	}
 
 	mdev->private_data = kbd;
 
-	kbd->dev = dev;
+	kbd->dev = idev;
 	memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode));
 
-	dev->name = mdev->product_name;
-	dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
-	dev->keycode = kbd->keycode;
-	dev->keycodesize = sizeof(unsigned short);
-	dev->keycodemax = ARRAY_SIZE(kbd->keycode);
-	dev->id.bustype = BUS_HOST;
-	dev->dev.parent = &mdev->dev;
+	idev->name = mdev->product_name;
+	idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+	idev->keycode = kbd->keycode;
+	idev->keycodesize = sizeof(unsigned short);
+	idev->keycodemax = ARRAY_SIZE(kbd->keycode);
+	idev->id.bustype = BUS_HOST;
+	idev->dev.parent = &mdev->dev;
 
 	for (i = 0; i < NR_SCANCODES; i++)
-		__set_bit(dc_kbd_keycode[i], dev->keybit);
-	__clear_bit(KEY_RESERVED, dev->keybit);
+		__set_bit(dc_kbd_keycode[i], idev->keybit);
+	__clear_bit(KEY_RESERVED, idev->keybit);
 
-	input_set_capability(dev, EV_MSC, MSC_SCAN);
-	input_set_drvdata(dev, kbd);
+	input_set_capability(idev, EV_MSC, MSC_SCAN);
+	input_set_drvdata(idev, kbd);
 
-	error = input_register_device(dev);
+	error = input_register_device(idev);
 	if (error)
 		goto fail;
 
 	/* Maple polling is locked to VBLANK - which may be just 50/s */
 	maple_getcond_callback(mdev, dc_kbd_callback, HZ/50,
 		MAPLE_FUNC_KEYBOARD);
-	return 0;
+
+	mdev->driver = mdrv;
+
+	return error;
 
 fail:
-	input_free_device(dev);
+	input_free_device(idev);
 fail_dev:
 	kfree(kbd);
 fail_kbd:
 	mdev->private_data = NULL;
 	return error;
+
 }
 
-static void dc_kbd_disconnect(struct maple_device *mdev)
+static int remove_maple_kbd(struct device *dev)
 {
+	struct maple_device *mdev = to_maple_dev(dev);
 	struct dc_kbd *kbd;
 
 	mutex_lock(&maple_keyb_mutex);
@@ -225,36 +235,11 @@ static void dc_kbd_disconnect(struct maple_device *mdev)
 	kfree(kbd);
 
 	mutex_unlock(&maple_keyb_mutex);
-}
-
-/* allow the keyboard to be used */
-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);
-	int error;
-
-	error = dc_kbd_connect(mdev);
-	if (error)
-		return error;
-
-	mdev->driver = mdrv;
-
-	return 0;
-}
-
-static int remove_maple_kbd(struct device *dev)
-{
-	struct maple_device *mdev = to_maple_dev(dev);
-
-	dc_kbd_disconnect(mdev);
 	return 0;
 }
 
 static struct maple_driver dc_kbd_driver = {
 	.function = MAPLE_FUNC_KEYBOARD,
-	.connect = dc_kbd_connect,
-	.disconnect = dc_kbd_disconnect,
 	.drv = {
 		.name = "Dreamcast_keyboard",
 		.probe = probe_maple_kbd,


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] input: Clean up maple keyboard driver
  2008-06-15 19:43 [PATCH] input: Clean up maple keyboard driver Adrian McMenamin
@ 2008-07-18 22:43 ` Paul Mundt
  2008-07-19 12:17   ` Adrian McMenamin
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mundt @ 2008-07-18 22:43 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: Dmitry Torokhov, lkml, linux-input, linux-sh

On Sun, Jun 15, 2008 at 08:43:39PM +0100, Adrian McMenamin wrote:
> Have a single probe function instead of a probe and a connect function.
> Also tidy a comment.
> 1 files changed, 33 insertions(+), 48 deletions(-)
> 
> 
> Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>

Ok, so I was going to take this through my tree, but it doesn't apply any
more. Please send an updated version that can be merged.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] input: Clean up maple keyboard driver
  2008-07-18 22:43 ` Paul Mundt
@ 2008-07-19 12:17   ` Adrian McMenamin
  2008-07-20 23:55     ` Paul Mundt
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian McMenamin @ 2008-07-19 12:17 UTC (permalink / raw)
  To: Paul Mundt; +Cc: Dmitry Torokhov, lkml, linux-input, linux-sh

On Sat, 2008-07-19 at 07:43 +0900, Paul Mundt wrote:
> On Sun, Jun 15, 2008 at 08:43:39PM +0100, Adrian McMenamin wrote:
> > Have a single probe function instead of a probe and a connect function.
> > Also tidy a comment.
> > 1 files changed, 33 insertions(+), 48 deletions(-)
> > 
> > 
> > Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
> 
> Ok, so I was going to take this through my tree, but it doesn't apply any
> more. Please send an updated version that can be merged.

What is the problem? Is it just a badly formed patch or has something
changed elsewhere?

I'll have a look but as I have no issues I'm not sure what is wrong.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] input: Clean up maple keyboard driver
  2008-07-19 12:17   ` Adrian McMenamin
@ 2008-07-20 23:55     ` Paul Mundt
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Mundt @ 2008-07-20 23:55 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: Dmitry Torokhov, lkml, linux-input, linux-sh

On Sat, Jul 19, 2008 at 01:17:59PM +0100, Adrian McMenamin wrote:
> On Sat, 2008-07-19 at 07:43 +0900, Paul Mundt wrote:
> > On Sun, Jun 15, 2008 at 08:43:39PM +0100, Adrian McMenamin wrote:
> > > Have a single probe function instead of a probe and a connect function.
> > > Also tidy a comment.
> > > 1 files changed, 33 insertions(+), 48 deletions(-)
> > > 
> > > 
> > > Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
> > 
> > Ok, so I was going to take this through my tree, but it doesn't apply any
> > more. Please send an updated version that can be merged.
> 
> What is the problem? Is it just a badly formed patch or has something
> changed elsewhere?
> 
> I'll have a look but as I have no issues I'm not sure what is wrong.
> 
The problem is it doesnt apply, and the code it is against has also
changed. If you have no issues, you obviously havent tried to apply it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-20 23:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-15 19:43 [PATCH] input: Clean up maple keyboard driver Adrian McMenamin
2008-07-18 22:43 ` Paul Mundt
2008-07-19 12:17   ` Adrian McMenamin
2008-07-20 23:55     ` Paul Mundt

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).