adb: clean up empty lines in .c and .h files
This commit is contained in:
parent
3149873ac3
commit
06261cf209
@ -45,7 +45,7 @@ enum {
|
|||||||
ADB_DEVICE_MOUSE = 0x03,
|
ADB_DEVICE_MOUSE = 0x03,
|
||||||
ADB_DEVICE_TABLET = 0x04,
|
ADB_DEVICE_TABLET = 0x04,
|
||||||
ADB_DEVICE_MODEM = 0x05,
|
ADB_DEVICE_MODEM = 0x05,
|
||||||
|
|
||||||
ADB_DEVICE_MISC = 0x07
|
ADB_DEVICE_MISC = 0x07
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,4 +78,3 @@ extern devclass_t adb_devclass;
|
|||||||
extern driver_t adb_driver;
|
extern driver_t adb_driver;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -99,13 +99,13 @@ adb_bus_attach(device_t dev)
|
|||||||
* the bus. Enumerating the ADB involves receiving packets,
|
* the bus. Enumerating the ADB involves receiving packets,
|
||||||
* which works best with interrupts enabled.
|
* which works best with interrupts enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (config_intrhook_establish(&sc->enum_hook) != 0)
|
if (config_intrhook_establish(&sc->enum_hook) != 0)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
adb_bus_enumerate(void *xdev)
|
adb_bus_enumerate(void *xdev)
|
||||||
{
|
{
|
||||||
@ -127,7 +127,7 @@ adb_bus_enumerate(void *xdev)
|
|||||||
sc->devinfo[i].address = i;
|
sc->devinfo[i].address = i;
|
||||||
sc->devinfo[i].default_address = 0;
|
sc->devinfo[i].default_address = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset ADB bus */
|
/* Reset ADB bus */
|
||||||
adb_send_raw_packet_sync(dev,0,ADB_COMMAND_BUS_RESET,0,0,NULL,NULL);
|
adb_send_raw_packet_sync(dev,0,ADB_COMMAND_BUS_RESET,0,0,NULL,NULL);
|
||||||
DELAY(1500);
|
DELAY(1500);
|
||||||
@ -142,7 +142,7 @@ adb_bus_enumerate(void *xdev)
|
|||||||
do {
|
do {
|
||||||
reply = adb_send_raw_packet_sync(dev,i,
|
reply = adb_send_raw_packet_sync(dev,i,
|
||||||
ADB_COMMAND_TALK,3,0,NULL,NULL);
|
ADB_COMMAND_TALK,3,0,NULL,NULL);
|
||||||
|
|
||||||
if (reply) {
|
if (reply) {
|
||||||
/* If we got a response, relocate to next_free */
|
/* If we got a response, relocate to next_free */
|
||||||
r3 = sc->devinfo[i].register3;
|
r3 = sc->devinfo[i].register3;
|
||||||
@ -197,7 +197,6 @@ static int adb_bus_detach(device_t dev)
|
|||||||
{
|
{
|
||||||
return (bus_generic_detach(dev));
|
return (bus_generic_detach(dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
adb_probe_nomatch(device_t dev, device_t child)
|
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,
|
ADB_RECEIVE_PACKET(sc->children[addr],status,
|
||||||
(command & 0x0f) >> 2,command & 0x03,len,data);
|
(command & 0x0f) >> 2,command & 0x03,len,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,9 +242,9 @@ adb_print_child(device_t dev, device_t child)
|
|||||||
{
|
{
|
||||||
struct adb_devinfo *dinfo;
|
struct adb_devinfo *dinfo;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
dinfo = device_get_ivars(child);
|
dinfo = device_get_ivars(child);
|
||||||
|
|
||||||
retval += bus_print_child_header(dev,child);
|
retval += bus_print_child_header(dev,child);
|
||||||
printf(" at device %d",dinfo->address);
|
printf(" at device %d",dinfo->address);
|
||||||
retval += bus_print_child_footer(dev, child);
|
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));
|
sc = device_get_softc(device_get_parent(dev));
|
||||||
dinfo = device_get_ivars(dev);
|
dinfo = device_get_ivars(dev);
|
||||||
|
|
||||||
command_byte |= dinfo->address << 4;
|
command_byte |= dinfo->address << 4;
|
||||||
command_byte |= command << 2;
|
command_byte |= command << 2;
|
||||||
command_byte |= reg;
|
command_byte |= reg;
|
||||||
@ -281,7 +280,7 @@ adb_set_autopoll(device_t dev, u_char enable)
|
|||||||
|
|
||||||
sc = device_get_softc(device_get_parent(dev));
|
sc = device_get_softc(device_get_parent(dev));
|
||||||
dinfo = device_get_ivars(dev);
|
dinfo = device_get_ivars(dev);
|
||||||
|
|
||||||
mod = enable << dinfo->address;
|
mod = enable << dinfo->address;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
sc->autopoll_mask |= mod;
|
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;
|
int i = 1;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
|
|
||||||
command_byte |= to << 4;
|
command_byte |= to << 4;
|
||||||
command_byte |= command << 2;
|
command_byte |= command << 2;
|
||||||
command_byte |= reg;
|
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_softc *sc;
|
||||||
struct adb_devinfo *dinfo;
|
struct adb_devinfo *dinfo;
|
||||||
size_t result;
|
size_t result;
|
||||||
|
|
||||||
dinfo = device_get_ivars(dev);
|
dinfo = device_get_ivars(dev);
|
||||||
sc = device_get_softc(device_get_parent(dev));
|
sc = device_get_softc(device_get_parent(dev));
|
||||||
|
|
||||||
result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address,
|
result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address,
|
||||||
ADB_COMMAND_LISTEN, reg, len, (u_char *)data, NULL);
|
ADB_COMMAND_LISTEN, reg, len, (u_char *)data, NULL);
|
||||||
|
|
||||||
result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address,
|
result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address,
|
||||||
ADB_COMMAND_TALK, reg, 0, NULL, NULL);
|
ADB_COMMAND_TALK, reg, 0, NULL, NULL);
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ static device_method_t abtn_methods[] = {
|
|||||||
|
|
||||||
/* ADB interface */
|
/* ADB interface */
|
||||||
DEVMETHOD(adb_receive_packet, abtn_receive_packet),
|
DEVMETHOD(adb_receive_packet, abtn_receive_packet),
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -159,4 +158,3 @@ abtn_receive_packet(device_t dev, u_char status,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,6 @@ static device_method_t adb_kbd_methods[] = {
|
|||||||
|
|
||||||
/* ADB interface */
|
/* ADB interface */
|
||||||
DEVMETHOD(adb_receive_packet, adb_kbd_receive_packet),
|
DEVMETHOD(adb_receive_packet, adb_kbd_receive_packet),
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -282,7 +281,7 @@ ms_to_ticks(int ms)
|
|||||||
|
|
||||||
return ms/(1000/hz);
|
return ms/(1000/hz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
adb_kbd_attach(device_t dev)
|
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),
|
callout_reset(&sc->sc_repeater, ms_to_ticks(sc->sc_kbd.kb_delay2),
|
||||||
akbd_repeat, sc);
|
akbd_repeat, sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
akbd_configure(int flags)
|
akbd_configure(int flags)
|
||||||
{
|
{
|
||||||
@ -666,7 +665,7 @@ akbd_read_char(keyboard_t *kbd, int wait)
|
|||||||
key & ~SCAN_PREFIX;
|
key & ~SCAN_PREFIX;
|
||||||
sc->at_buffered_char[1] = 0;
|
sc->at_buffered_char[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = (key & SCAN_PREFIX_E0) ? 0xe0 : 0xe1;
|
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:
|
case KDSETLED:
|
||||||
KBD_LED_VAL(kbd) = *(int *)data;
|
KBD_LED_VAL(kbd) = *(int *)data;
|
||||||
|
|
||||||
if (!sc->have_led_control)
|
if (!sc->have_led_control)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -890,4 +889,3 @@ adb_fn_keys(SYSCTL_HANDLER_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEV_MODULE(akbd, akbd_modevent, NULL);
|
DEV_MODULE(akbd, akbd_modevent, NULL);
|
||||||
|
|
||||||
|
@ -107,7 +107,6 @@ static device_method_t adb_mouse_methods[] = {
|
|||||||
|
|
||||||
/* ADB interface */
|
/* ADB interface */
|
||||||
DEVMETHOD(adb_receive_packet, adb_mouse_receive_packet),
|
DEVMETHOD(adb_receive_packet, adb_mouse_receive_packet),
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -145,7 +144,7 @@ adb_mouse_probe(device_t dev)
|
|||||||
device_set_desc(dev,"ADB Mouse");
|
device_set_desc(dev,"ADB Mouse");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
adb_mouse_attach(device_t dev)
|
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->packet_read_len) {
|
||||||
if (sc->xdelta == 0 && sc->ydelta == 0 &&
|
if (sc->xdelta == 0 && sc->ydelta == 0 &&
|
||||||
sc->buttons == sc->last_buttons) {
|
sc->buttons == sc->last_buttons) {
|
||||||
|
|
||||||
if (flag & O_NONBLOCK) {
|
if (flag & O_NONBLOCK) {
|
||||||
mtx_unlock(&sc->sc_mtx);
|
mtx_unlock(&sc->sc_mtx);
|
||||||
return EWOULDBLOCK;
|
return EWOULDBLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Otherwise, block on new data */
|
/* Otherwise, block on new data */
|
||||||
error = cv_wait_sig(&sc->sc_cv, &sc->sc_mtx);
|
error = cv_wait_sig(&sc->sc_cv, &sc->sc_mtx);
|
||||||
if (error) {
|
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->packet[7] = ~((uint8_t)(sc->buttons >> 3)) & 0x7f;
|
||||||
|
|
||||||
|
|
||||||
sc->last_buttons = sc->buttons;
|
sc->last_buttons = sc->buttons;
|
||||||
sc->xdelta = 0;
|
sc->xdelta = 0;
|
||||||
sc->ydelta = 0;
|
sc->ydelta = 0;
|
||||||
@ -579,7 +575,6 @@ ams_read(struct cdev *dev, struct uio *uio, int flag)
|
|||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ams_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
|
ams_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
|
||||||
struct thread *p)
|
struct thread *p)
|
||||||
@ -616,12 +611,12 @@ ams_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
|
|||||||
sc->mode.packetsize = 5;
|
sc->mode.packetsize = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
case MOUSE_GETLEVEL:
|
case MOUSE_GETLEVEL:
|
||||||
*(int *)addr = sc->mode.level;
|
*(int *)addr = sc->mode.level;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MOUSE_GETSTATUS: {
|
case MOUSE_GETSTATUS: {
|
||||||
mousestatus_t *status = (mousestatus_t *) addr;
|
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;
|
sc->last_buttons = sc->buttons;
|
||||||
|
|
||||||
mtx_unlock(&sc->sc_mtx);
|
mtx_unlock(&sc->sc_mtx);
|
||||||
|
|
||||||
break; }
|
break; }
|
||||||
default:
|
default:
|
||||||
return ENOTTY;
|
return ENOTTY;
|
||||||
|
@ -36,13 +36,12 @@ enum {
|
|||||||
ADB_COMMAND_BUS_RESET = 0
|
ADB_COMMAND_BUS_RESET = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct adb_softc {
|
struct adb_softc {
|
||||||
device_t sc_dev;
|
device_t sc_dev;
|
||||||
device_t parent;
|
device_t parent;
|
||||||
|
|
||||||
struct intr_config_hook enum_hook;
|
struct intr_config_hook enum_hook;
|
||||||
|
|
||||||
volatile int sync_packet;
|
volatile int sync_packet;
|
||||||
volatile int packet_reply;
|
volatile int packet_reply;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user