public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* after latest input updates, locomo keyboard kills boot
@ 2005-11-01  9:49 Pavel Machek
  2005-11-01 15:12 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2005-11-01  9:49 UTC (permalink / raw)
  To: dtor_core, vojtech, kernel list; +Cc: rpurdie, lenz

Hi!

drivers/input/keyboard/locomokbd.c:

struct locomokbd {
        unsigned char keycode[LOCOMOKBD_NUMKEYS];
        struct input_dev input;
	~~~~~~~~~~~~~~~~~~~~~~~

...and I guess that's the problem. What needs to be done? Just replace
it with struct input_dev *?

								Pavel
-- 
Thanks, Sharp!

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

* Re: after latest input updates, locomo keyboard kills boot
  2005-11-01  9:49 after latest input updates, locomo keyboard kills boot Pavel Machek
@ 2005-11-01 15:12 ` Dmitry Torokhov
  2005-11-01 19:05   ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2005-11-01 15:12 UTC (permalink / raw)
  To: Pavel Machek; +Cc: vojtech, kernel list, rpurdie, lenz

[-- Attachment #1: Type: text/plain, Size: 449 bytes --]

On 11/1/05, Pavel Machek <pavel@suse.cz> wrote:
> Hi!
>
> drivers/input/keyboard/locomokbd.c:
>
> struct locomokbd {
>        unsigned char keycode[LOCOMOKBD_NUMKEYS];
>        struct input_dev input;
>        ~~~~~~~~~~~~~~~~~~~~~~~
>
> ...and I guess that's the problem. What needs to be done? Just replace
> it with struct input_dev *?
>

Try the attached. BTW, shouldn't input->id.bus be BUS_HOST and not BUS_XTKBD?

--
Dmitry

[-- Attachment #2: input-dynalloc-locomo.patch --]
[-- Type: application/octet-stream, Size: 4692 bytes --]

Input: locomokbd - convert to dynamic input allocation

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/keyboard/locomokbd.c |   63 ++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 32 deletions(-)

Index: linux/drivers/input/keyboard/locomokbd.c
===================================================================
--- linux.orig/drivers/input/keyboard/locomokbd.c
+++ linux/drivers/input/keyboard/locomokbd.c
@@ -76,7 +76,7 @@ static unsigned char locomokbd_keycode[L
 
 struct locomokbd {
 	unsigned char keycode[LOCOMOKBD_NUMKEYS];
-	struct input_dev input;
+	struct input_dev *input;
 	char phys[32];
 
 	struct locomo_dev *ldev;
@@ -136,8 +136,7 @@ static void locomokbd_scankeyboard(struc
 
 	spin_lock_irqsave(&locomokbd->lock, flags);
 
-	if (regs)
-		input_regs(&locomokbd->input, regs);
+	input_regs(locomokbd->input, regs);
 
 	locomokbd_charge_all(membase);
 
@@ -152,16 +151,16 @@ static void locomokbd_scankeyboard(struc
 			scancode = SCANCODE(col, row);
 			if (rowd & KB_ROWMASK(row)) {
 				num_pressed += 1;
-				input_report_key(&locomokbd->input, locomokbd->keycode[scancode], 1);
+				input_report_key(locomokbd->input, locomokbd->keycode[scancode], 1);
 			} else {
-				input_report_key(&locomokbd->input, locomokbd->keycode[scancode], 0);
+				input_report_key(locomokbd->input, locomokbd->keycode[scancode], 0);
 			}
 		}
 		locomokbd_reset_col(membase, col);
 	}
 	locomokbd_activate_all(membase);
 
-	input_sync(&locomokbd->input);
+	input_sync(locomokbd->input);
 
 	/* if any keys are pressed, enable the timer */
 	if (num_pressed)
@@ -196,13 +195,15 @@ static void locomokbd_timer_callback(uns
 static int locomokbd_probe(struct locomo_dev *dev)
 {
 	struct locomokbd *locomokbd;
+	struct input_dev *input_dev;
 	int i, ret;
 
-	locomokbd = kmalloc(sizeof(struct locomokbd), GFP_KERNEL);
-	if (!locomokbd)
-		return -ENOMEM;
-
-	memset(locomokbd, 0, sizeof(struct locomokbd));
+	locomokbd = kzalloc(sizeof(struct locomokbd), GFP_KERNEL);
+	input_dev = input_allocate_device();
+	if (!locomokbd || !input_dev) {
+		ret = -ENOMEM;
+		goto free;
+	}
 
 	/* try and claim memory region */
 	if (!request_mem_region((unsigned long) dev->mapbase,
@@ -224,27 +225,26 @@ static int locomokbd_probe(struct locomo
 	locomokbd->timer.function = locomokbd_timer_callback;
 	locomokbd->timer.data = (unsigned long) locomokbd;
 
-	locomokbd->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+	locomokbd->input = input_dev;
+	strcpy(locomokbd->phys, "locomokbd/input0");
 
-	init_input_dev(&locomokbd->input);
-	locomokbd->input.keycode = locomokbd->keycode;
-	locomokbd->input.keycodesize = sizeof(unsigned char);
-	locomokbd->input.keycodemax = ARRAY_SIZE(locomokbd_keycode);
-	locomokbd->input.private = locomokbd;
+	input_dev->name = "LoCoMo keyboard";
+	input_dev->phys = locomokbd->phys;
+	input_dev->id.bustype = BUS_XTKBD;
+	input_dev->id.vendor = 0x0001;
+	input_dev->id.product = 0x0001;
+	input_dev->id.version = 0x0100;
+	input_dev->private = locomokbd;
+
+	input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+	input_dev->keycode = locomokbd->keycode;
+	input_dev->keycodesize = sizeof(unsigned char);
+	input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode);
 
 	memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode));
 	for (i = 0; i < LOCOMOKBD_NUMKEYS; i++)
-		set_bit(locomokbd->keycode[i], locomokbd->input.keybit);
-	clear_bit(0, locomokbd->input.keybit);
-
-	strcpy(locomokbd->phys, "locomokbd/input0");
-
-	locomokbd->input.name = "LoCoMo keyboard";
-	locomokbd->input.phys = locomokbd->phys;
-	locomokbd->input.id.bustype = BUS_XTKBD;
-	locomokbd->input.id.vendor = 0x0001;
-	locomokbd->input.id.product = 0x0001;
-	locomokbd->input.id.version = 0x0100;
+		set_bit(locomokbd->keycode[i], input_dev->keybit);
+	clear_bit(0, input_dev->keybit);
 
 	/* attempt to get the interrupt */
 	ret = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd);
@@ -253,9 +253,7 @@ static int locomokbd_probe(struct locomo
 		goto out;
 	}
 
-	input_register_device(&locomokbd->input);
-
-	printk(KERN_INFO "input: LoCoMo keyboard on locomokbd\n");
+	input_register_device(locomokbd->input);
 
 	return 0;
 
@@ -263,6 +261,7 @@ out:
 	release_mem_region((unsigned long) dev->mapbase, dev->length);
 	locomo_set_drvdata(dev, NULL);
 free:
+	input_free_device(input_dev)
 	kfree(locomokbd);
 
 	return ret;
@@ -276,7 +275,7 @@ static int locomokbd_remove(struct locom
 
 	del_timer_sync(&locomokbd->timer);
 
-	input_unregister_device(&locomokbd->input);
+	input_unregister_device(locomokbd->input);
 	locomo_set_drvdata(dev, NULL);
 
 	release_mem_region((unsigned long) dev->mapbase, dev->length);

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

* Re: after latest input updates, locomo keyboard kills boot
  2005-11-01 15:12 ` Dmitry Torokhov
@ 2005-11-01 19:05   ` Pavel Machek
  2005-11-01 20:50     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2005-11-01 19:05 UTC (permalink / raw)
  To: dtor_core; +Cc: vojtech, kernel list, rpurdie, lenz

Hi!

> > drivers/input/keyboard/locomokbd.c:
> >
> > struct locomokbd {
> >        unsigned char keycode[LOCOMOKBD_NUMKEYS];
> >        struct input_dev input;
> >        ~~~~~~~~~~~~~~~~~~~~~~~
> >
> > ...and I guess that's the problem. What needs to be done? Just replace
> > it with struct input_dev *?
> 
> Try the attached. BTW, shouldn't input->id.bus be BUS_HOST and not
> >BUS_XTKBD?

Yes, that helped, thanks a lot. Will you take care of merging, or
should I push it through akpm?
							Pavel

Fix compilation of locomokbd.

Signed-off-by: Pavel Machek <pavel@suse.cz>

---
commit ea66607091fbd8cfd2f0ab3a6218ec4d0ba399e4
tree 95f52c3742913a93cfdc6e15b43561cb1011ed2f
parent 5e047cfca8cb5833ac7c96d7c000270307316d1f
author <pavel@amd.(none)> Tue, 01 Nov 2005 20:03:07 +0100
committer <pavel@amd.(none)> Tue, 01 Nov 2005 20:03:07 +0100

 drivers/input/keyboard/locomokbd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -261,7 +261,7 @@ out:
 	release_mem_region((unsigned long) dev->mapbase, dev->length);
 	locomo_set_drvdata(dev, NULL);
 free:
-	input_free_device(input_dev)
+	input_free_device(input_dev);
 	kfree(locomokbd);
 
 	return ret;


Fix wrong bustype.

---
commit cb4e751101b0e359cec50565caba977c1e6d5709
tree b6779a09e5685efd00e72e5161f08bd6bc5b494a
parent ea66607091fbd8cfd2f0ab3a6218ec4d0ba399e4
author <pavel@amd.(none)> Tue, 01 Nov 2005 20:05:23 +0100
committer <pavel@amd.(none)> Tue, 01 Nov 2005 20:05:23 +0100

 drivers/input/keyboard/locomokbd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -230,7 +230,7 @@ static int locomokbd_probe(struct locomo
 
 	input_dev->name = "LoCoMo keyboard";
 	input_dev->phys = locomokbd->phys;
-	input_dev->id.bustype = BUS_XTKBD;
+	input_dev->id.bustype = BUS_HOST;
 	input_dev->id.vendor = 0x0001;
 	input_dev->id.product = 0x0001;
 	input_dev->id.version = 0x0100;


-- 
Thanks, Sharp!

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

* Re: after latest input updates, locomo keyboard kills boot
  2005-11-01 19:05   ` Pavel Machek
@ 2005-11-01 20:50     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2005-11-01 20:50 UTC (permalink / raw)
  To: Pavel Machek; +Cc: vojtech, kernel list, rpurdie, lenz

On 11/1/05, Pavel Machek <pavel@suse.cz> wrote:
> Hi!
>
> > > drivers/input/keyboard/locomokbd.c:
> > >
> > > struct locomokbd {
> > >        unsigned char keycode[LOCOMOKBD_NUMKEYS];
> > >        struct input_dev input;
> > >        ~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > > ...and I guess that's the problem. What needs to be done? Just replace
> > > it with struct input_dev *?
> >
> > Try the attached. BTW, shouldn't input->id.bus be BUS_HOST and not
> > >BUS_XTKBD?
>
> Yes, that helped, thanks a lot. Will you take care of merging, or
> should I push it through akpm?

I have couple more patches that I am going to ask Linus to pull (if
Vojtech blesses them).

--
Dmitry

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

end of thread, other threads:[~2005-11-01 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-01  9:49 after latest input updates, locomo keyboard kills boot Pavel Machek
2005-11-01 15:12 ` Dmitry Torokhov
2005-11-01 19:05   ` Pavel Machek
2005-11-01 20:50     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox