- memcpy(port, &i8042_aux_port, sizeof(struct serio));
- memcpy(values, &i8042_aux_values, sizeof(struct i8042_values));
- sprintf(i8042_mux_names[index], "i8042 Aux-%d Port", index);
- sprintf(i8042_mux_phys[index], I8042_MUX_PHYS_DESC, index + 1);
- sprintf(i8042_mux_short[index], "AUX%d", index);
- port->name = i8042_mux_names[index];
- port->phys = i8042_mux_phys[index];
- port->driver = values;
- values->name = i8042_mux_short[index];
- values->mux = index;
+ struct serio *serio;
+ struct i8042_port *port = &i8042_ports[I8042_MUX_PORT_NO + index];
+
+ serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+ if (!serio)
+ return -ENOMEM;
+
+ serio->id.type = SERIO_8042;
+ serio->write = i8042_aux_write;
+ serio->open = i8042_open;
+ serio->close = i8042_close;
+ serio->start = i8042_start;
+ serio->stop = i8042_stop;
+ serio->port_data = port;
+ serio->dev.parent = &i8042_platform_device->dev;
+ snprintf(serio->name, sizeof(serio->name), "i8042 Aux-%d Port", index);
+ snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, index + 1);
+
+ *port = i8042_ports[I8042_AUX_PORT_NO];
+ port->exists = 0;
+ snprintf(port->name, sizeof(port->name), "AUX%d", index);
+ port->mux = index;
+ port->serio = serio;
+
+ return i8042_port_register(port);