On Tue, Sep 15, 2009 at 07:16:25AM -0400, Mike Frysinger wrote: > On Tue, Sep 15, 2009 at 01:52, Dmitry Torokhov wrote: > > On Mon, Sep 14, 2009 at 08:18:48PM +0200, Javier Herrero wrote: > >> It has a bit long since last time I touched the driver, so I should also > >> try to refresh my memory about it :). I suppose that you're right in the > >> double allocation issue (I took another keyboard driver as a starting > >> point and probably the double allocation was already there...), so feel > >> free to introduce the change and I will test it as soon as I can. > >> > >> About the exact scancode - key mapping, the reason is that since the > >> FPGA opencores device already implements a translation table, I found > >> that another translation table sounded a bit redundant. > > > > OK, below is what I have now... One concern though - don't we need to do > > request_mem_region/ioremap for the addr_res? > > i think so ... these operations are nops on a Blackfin CPU which is > probably why it "just works". > Surely request_mem_region is not a nop? I think even if uoremap is a nop we need to convert the driver since it does not have to be on a Blackfin, does it? > > +struct opencores_kbd { > > + struct input_dev *input; > > + void __iomem *addr; > > + int irq; > > + struct resource *irq_res; > > the irq_res member is no longer needed > > +#define NUM_KEYS 128 > > + unsigned short keycodes[NUM_KEYS]; > > since this is the only usage of NUM_KEYS, could just inline it now ... > > > + error = request_irq(irq, &opencores_kbd_isr, > > + IRQF_TRIGGER_RISING, pdev->name, opencores_kbd); > > + if (error) { > > + dev_err(&pdev->dev, "unable to claim irq %d\n", irq); > > + goto err_free_mem; > > + } > > + > > + error = input_register_device(input); > > + if (error) { > > + dev_err(&pdev->dev, "unable to register input device\n"); > > + goto err_free_irq; > > + } > > the input layer can handle input even if it's not registered ? The device can survive input events as soon as it was allocated with input_allocate_device() but of course the event will not get anywhere. This is a property that I intend to keep since it is very convenient. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html