Lines Matching refs:gf2k

61 struct gf2k {  struct
155 static void gf2k_read(struct gf2k *gf2k, unsigned char *data) in gf2k_read() argument
157 struct input_dev *dev = gf2k->dev; in gf2k_read()
160 for (i = 0; i < 4 && i < gf2k_axes[gf2k->id]; i++) in gf2k_read()
163 for (i = 0; i < 2 && i < gf2k_axes[gf2k->id] - 4; i++) in gf2k_read()
168 for (i = 0; i < gf2k_hats[gf2k->id]; i++) in gf2k_read()
173 for (i = 0; i < gf2k_joys[gf2k->id]; i++) in gf2k_read()
176 for (i = 0; i < gf2k_pads[gf2k->id]; i++) in gf2k_read()
188 struct gf2k *gf2k = gameport_get_drvdata(gameport); in gf2k_poll() local
191 gf2k->reads++; in gf2k_poll()
193 if (gf2k_read_packet(gf2k->gameport, gf2k_length[gf2k->id], data) < gf2k_length[gf2k->id]) in gf2k_poll()
194 gf2k->bads++; in gf2k_poll()
196 gf2k_read(gf2k, data); in gf2k_poll()
201 struct gf2k *gf2k = input_get_drvdata(dev); in gf2k_open() local
203 gameport_start_polling(gf2k->gameport); in gf2k_open()
209 struct gf2k *gf2k = input_get_drvdata(dev); in gf2k_close() local
211 gameport_stop_polling(gf2k->gameport); in gf2k_close()
220 struct gf2k *gf2k; in gf2k_connect() local
225 gf2k = kzalloc(sizeof(struct gf2k), GFP_KERNEL); in gf2k_connect()
227 if (!gf2k || !input_dev) { in gf2k_connect()
232 gf2k->gameport = gameport; in gf2k_connect()
233 gf2k->dev = input_dev; in gf2k_connect()
235 gameport_set_drvdata(gameport, gf2k); in gf2k_connect()
254 if (!(gf2k->id = GB(7,2,0) | GB(3,3,2) | GB(0,3,5))) { in gf2k_connect()
260 if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) && in gf2k_connect()
261 (gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) { in gf2k_connect()
266 gf2k->id = 6; in gf2k_connect()
269 if (gf2k->id > GF2K_ID_MAX || !gf2k_axes[gf2k->id]) { in gf2k_connect()
271 gameport->phys, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]); in gf2k_connect()
279 snprintf(gf2k->phys, sizeof(gf2k->phys), "%s/input0", gameport->phys); in gf2k_connect()
281 gf2k->length = gf2k_lens[gf2k->id]; in gf2k_connect()
283 input_dev->name = gf2k_names[gf2k->id]; in gf2k_connect()
284 input_dev->phys = gf2k->phys; in gf2k_connect()
287 input_dev->id.product = gf2k->id; in gf2k_connect()
291 input_set_drvdata(input_dev, gf2k); in gf2k_connect()
298 for (i = 0; i < gf2k_axes[gf2k->id]; i++) in gf2k_connect()
301 for (i = 0; i < gf2k_hats[gf2k->id]; i++) in gf2k_connect()
304 for (i = 0; i < gf2k_joys[gf2k->id]; i++) in gf2k_connect()
307 for (i = 0; i < gf2k_pads[gf2k->id]; i++) in gf2k_connect()
310 gf2k_read_packet(gameport, gf2k->length, data); in gf2k_connect()
311 gf2k_read(gf2k, data); in gf2k_connect()
313 for (i = 0; i < gf2k_axes[gf2k->id]; i++) { in gf2k_connect()
324 err = input_register_device(gf2k->dev); in gf2k_connect()
333 kfree(gf2k); in gf2k_connect()
339 struct gf2k *gf2k = gameport_get_drvdata(gameport); in gf2k_disconnect() local
341 input_unregister_device(gf2k->dev); in gf2k_disconnect()
344 kfree(gf2k); in gf2k_disconnect()