twidjoy
struct twidjoy *twidjoy = serio_get_drvdata(serio);
twidjoy->idx = 0; /* this byte starts a new packet */
else if (twidjoy->idx == 0)
if (twidjoy->idx < TWIDJOY_MAX_LENGTH)
twidjoy->data[twidjoy->idx++] = data;
if (twidjoy->idx == TWIDJOY_MAX_LENGTH) {
twidjoy_process_packet(twidjoy);
twidjoy->idx = 0;
struct twidjoy *twidjoy = serio_get_drvdata(serio);
input_unregister_device(twidjoy->dev);
kfree(twidjoy);
struct twidjoy *twidjoy;
twidjoy = kzalloc_obj(*twidjoy);
if (!twidjoy || !input_dev)
twidjoy->dev = input_dev;
snprintf(twidjoy->phys, sizeof(twidjoy->phys), "%s/input0", serio->phys);
input_dev->phys = twidjoy->phys;
serio_set_drvdata(serio, twidjoy);
err = input_register_device(twidjoy->dev);
kfree(twidjoy);
static void twidjoy_process_packet(struct twidjoy *twidjoy)
struct input_dev *dev = twidjoy->dev;
unsigned char *data = twidjoy->data;