init_input_dev(&nkbd->dev); nkbd->dev.keycode = nkbd->keycode; nkbd->dev.keycodesize = sizeof(unsigned char); nkbd->dev.keycodemax = ARRAY_SIZE(nkbd_keycode); nkbd->dev.private = nkbd;
input_dev->name = "Newton Keyboard"; input_dev->phys = nkbd->phys; input_dev->id.bustype = BUS_RS232; input_dev->id.vendor = SERIO_NEWTON; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; input_dev->cdev.dev = &serio->dev; input_dev->private = nkbd;  input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); input_dev->keycode = nkbd->keycode; input_dev->keycodesize = sizeof(unsigned char); input_dev->keycodemax = ARRAY_SIZE(nkbd_keycode); for (i = 0; i < 128; i++) set_bit(nkbd->keycode[i], input_dev->keybit); clear_bit(0, input_dev->keybit);
static int nkbd_connect(struct serio *serio, struct serio_driver *drv){	struct nkbd *nkbd;	int i;	int err;	if (!(nkbd = kmalloc(sizeof(struct nkbd), GFP_KERNEL)))		return -ENOMEM;	memset(nkbd, 0, sizeof(struct nkbd));	nkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);	nkbd->serio = serio;	init_input_dev(&nkbd->dev);	nkbd->dev.keycode = nkbd->keycode;	nkbd->dev.keycodesize = sizeof(unsigned char);	nkbd->dev.keycodemax = ARRAY_SIZE(nkbd_keycode);	nkbd->dev.private = nkbd;	serio_set_drvdata(serio, nkbd);	err = serio_open(serio, drv);	if (err) {		serio_set_drvdata(serio, NULL);		kfree(nkbd);		return err;	}	memcpy(nkbd->keycode, nkbd_keycode, sizeof(nkbd->keycode));	for (i = 0; i < 128; i++)		set_bit(nkbd->keycode[i], nkbd->dev.keybit);	clear_bit(0, nkbd->dev.keybit);	sprintf(nkbd->phys, "%s/input0", serio->phys);	nkbd->dev.name = nkbd_name;	nkbd->dev.phys = nkbd->phys;	nkbd->dev.id.bustype = BUS_RS232;	nkbd->dev.id.vendor = SERIO_NEWTON;	nkbd->dev.id.product = 0x0001;	nkbd->dev.id.version = 0x0100;	nkbd->dev.dev = &serio->dev;	input_register_device(&nkbd->dev);	printk(KERN_INFO "input: %s on %s\n", nkbd_name, serio->phys);	return 0;}