From 06261cf2090264fdd594602458c44b519e53aca9 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Tue, 1 Sep 2020 21:34:24 +0000 Subject: [PATCH] adb: clean up empty lines in .c and .h files --- sys/dev/adb/adb.h | 3 +-- sys/dev/adb/adb_bus.c | 27 +++++++++++++-------------- sys/dev/adb/adb_buttons.c | 2 -- sys/dev/adb/adb_kbd.c | 10 ++++------ sys/dev/adb/adb_mouse.c | 12 +++--------- sys/dev/adb/adbvar.h | 3 +-- 6 files changed, 22 insertions(+), 35 deletions(-) diff --git a/sys/dev/adb/adb.h b/sys/dev/adb/adb.h index 623dda13402f..6b007c469597 100644 --- a/sys/dev/adb/adb.h +++ b/sys/dev/adb/adb.h @@ -45,7 +45,7 @@ enum { ADB_DEVICE_MOUSE = 0x03, ADB_DEVICE_TABLET = 0x04, ADB_DEVICE_MODEM = 0x05, - + ADB_DEVICE_MISC = 0x07 }; @@ -78,4 +78,3 @@ extern devclass_t adb_devclass; extern driver_t adb_driver; #endif - diff --git a/sys/dev/adb/adb_bus.c b/sys/dev/adb/adb_bus.c index 4c504a65a93d..8c300c83df10 100644 --- a/sys/dev/adb/adb_bus.c +++ b/sys/dev/adb/adb_bus.c @@ -99,13 +99,13 @@ adb_bus_attach(device_t dev) * the bus. Enumerating the ADB involves receiving packets, * which works best with interrupts enabled. */ - + if (config_intrhook_establish(&sc->enum_hook) != 0) return (ENOMEM); return (0); } - + static void adb_bus_enumerate(void *xdev) { @@ -127,7 +127,7 @@ adb_bus_enumerate(void *xdev) sc->devinfo[i].address = i; sc->devinfo[i].default_address = 0; } - + /* Reset ADB bus */ adb_send_raw_packet_sync(dev,0,ADB_COMMAND_BUS_RESET,0,0,NULL,NULL); DELAY(1500); @@ -142,7 +142,7 @@ adb_bus_enumerate(void *xdev) do { reply = adb_send_raw_packet_sync(dev,i, ADB_COMMAND_TALK,3,0,NULL,NULL); - + if (reply) { /* If we got a response, relocate to next_free */ r3 = sc->devinfo[i].register3; @@ -197,7 +197,6 @@ static int adb_bus_detach(device_t dev) { return (bus_generic_detach(dev)); } - static void adb_probe_nomatch(device_t dev, device_t child) @@ -234,7 +233,7 @@ adb_receive_raw_packet(device_t dev, u_char status, u_char command, int len, ADB_RECEIVE_PACKET(sc->children[addr],status, (command & 0x0f) >> 2,command & 0x03,len,data); } - + return (0); } @@ -243,9 +242,9 @@ adb_print_child(device_t dev, device_t child) { struct adb_devinfo *dinfo; int retval = 0; - + dinfo = device_get_ivars(child); - + retval += bus_print_child_header(dev,child); printf(" at device %d",dinfo->address); retval += bus_print_child_footer(dev, child); @@ -262,7 +261,7 @@ adb_send_packet(device_t dev, u_char command, u_char reg, int len, u_char *data) sc = device_get_softc(device_get_parent(dev)); dinfo = device_get_ivars(dev); - + command_byte |= dinfo->address << 4; command_byte |= command << 2; command_byte |= reg; @@ -281,7 +280,7 @@ adb_set_autopoll(device_t dev, u_char enable) sc = device_get_softc(device_get_parent(dev)); dinfo = device_get_ivars(dev); - + mod = enable << dinfo->address; if (enable) { sc->autopoll_mask |= mod; @@ -323,7 +322,7 @@ adb_send_raw_packet_sync(device_t dev, uint8_t to, uint8_t command, int i = 1; sc = device_get_softc(dev); - + command_byte |= to << 4; command_byte |= command << 2; command_byte |= reg; @@ -410,13 +409,13 @@ adb_write_register(device_t dev, u_char reg, size_t len, void *data) struct adb_softc *sc; struct adb_devinfo *dinfo; size_t result; - + dinfo = device_get_ivars(dev); sc = device_get_softc(device_get_parent(dev)); - + result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, ADB_COMMAND_LISTEN, reg, len, (u_char *)data, NULL); - + result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, ADB_COMMAND_TALK, reg, 0, NULL, NULL); diff --git a/sys/dev/adb/adb_buttons.c b/sys/dev/adb/adb_buttons.c index 3d8726e152b2..4534f5b2a2e7 100644 --- a/sys/dev/adb/adb_buttons.c +++ b/sys/dev/adb/adb_buttons.c @@ -69,7 +69,6 @@ static device_method_t abtn_methods[] = { /* ADB interface */ DEVMETHOD(adb_receive_packet, abtn_receive_packet), - { 0, 0 } }; @@ -159,4 +158,3 @@ abtn_receive_packet(device_t dev, u_char status, } return 0; } - diff --git a/sys/dev/adb/adb_kbd.c b/sys/dev/adb/adb_kbd.c index e2dba622ecd8..d765e73ed351 100644 --- a/sys/dev/adb/adb_kbd.c +++ b/sys/dev/adb/adb_kbd.c @@ -102,7 +102,6 @@ static device_method_t adb_kbd_methods[] = { /* ADB interface */ DEVMETHOD(adb_receive_packet, adb_kbd_receive_packet), - { 0, 0 } }; @@ -282,7 +281,7 @@ ms_to_ticks(int ms) return ms/(1000/hz); } - + static int adb_kbd_attach(device_t dev) { @@ -502,7 +501,7 @@ akbd_repeat(void *xsc) { callout_reset(&sc->sc_repeater, ms_to_ticks(sc->sc_kbd.kb_delay2), akbd_repeat, sc); } - + static int akbd_configure(int flags) { @@ -666,7 +665,7 @@ akbd_read_char(keyboard_t *kbd, int wait) key & ~SCAN_PREFIX; sc->at_buffered_char[1] = 0; } - + key = (key & SCAN_PREFIX_E0) ? 0xe0 : 0xe1; } } @@ -756,7 +755,7 @@ static int akbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data) case KDSETLED: KBD_LED_VAL(kbd) = *(int *)data; - + if (!sc->have_led_control) break; @@ -890,4 +889,3 @@ adb_fn_keys(SYSCTL_HANDLER_ARGS) } DEV_MODULE(akbd, akbd_modevent, NULL); - diff --git a/sys/dev/adb/adb_mouse.c b/sys/dev/adb/adb_mouse.c index 2dfdd6e381d1..6f6f9d633b52 100644 --- a/sys/dev/adb/adb_mouse.c +++ b/sys/dev/adb/adb_mouse.c @@ -107,7 +107,6 @@ static device_method_t adb_mouse_methods[] = { /* ADB interface */ DEVMETHOD(adb_receive_packet, adb_mouse_receive_packet), - { 0, 0 } }; @@ -145,7 +144,7 @@ adb_mouse_probe(device_t dev) device_set_desc(dev,"ADB Mouse"); return (0); } - + static int adb_mouse_attach(device_t dev) { @@ -509,13 +508,11 @@ ams_read(struct cdev *dev, struct uio *uio, int flag) if (!sc->packet_read_len) { if (sc->xdelta == 0 && sc->ydelta == 0 && sc->buttons == sc->last_buttons) { - if (flag & O_NONBLOCK) { mtx_unlock(&sc->sc_mtx); return EWOULDBLOCK; } - /* Otherwise, block on new data */ error = cv_wait_sig(&sc->sc_cv, &sc->sc_mtx); if (error) { @@ -557,7 +554,6 @@ ams_read(struct cdev *dev, struct uio *uio, int flag) sc->packet[7] = ~((uint8_t)(sc->buttons >> 3)) & 0x7f; - sc->last_buttons = sc->buttons; sc->xdelta = 0; sc->ydelta = 0; @@ -579,7 +575,6 @@ ams_read(struct cdev *dev, struct uio *uio, int flag) return (error); } - static int ams_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p) @@ -616,12 +611,12 @@ ams_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, sc->mode.packetsize = 5; break; } - + return EINVAL; case MOUSE_GETLEVEL: *(int *)addr = sc->mode.level; break; - + case MOUSE_GETSTATUS: { mousestatus_t *status = (mousestatus_t *) addr; @@ -646,7 +641,6 @@ ams_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, sc->last_buttons = sc->buttons; mtx_unlock(&sc->sc_mtx); - break; } default: return ENOTTY; diff --git a/sys/dev/adb/adbvar.h b/sys/dev/adb/adbvar.h index 5f8184e102bb..b382e2f597f5 100644 --- a/sys/dev/adb/adbvar.h +++ b/sys/dev/adb/adbvar.h @@ -36,13 +36,12 @@ enum { ADB_COMMAND_BUS_RESET = 0 }; - struct adb_softc { device_t sc_dev; device_t parent; struct intr_config_hook enum_hook; - + volatile int sync_packet; volatile int packet_reply;