Use C99 initializers for pipe and bus methods.
authormpi <mpi@openbsd.org>
Wed, 4 Jun 2014 12:28:21 +0000 (12:28 +0000)
committermpi <mpi@openbsd.org>
Wed, 4 Jun 2014 12:28:21 +0000 (12:28 +0000)
Apart from improving readability, this will help us reduce the number of
no-op functions now that some of them are optional.

ok ratchov@

sys/dev/usb/ehci.c
sys/dev/usb/ohci.c
sys/dev/usb/uhci.c

index d4b063c..18f4f3e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ehci.c,v 1.156 2014/05/30 13:24:59 mpi Exp $ */
+/*     $OpenBSD: ehci.c,v 1.157 2014/06/04 12:28:21 mpi Exp $ */
 /*     $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $        */
 
 /*
@@ -216,65 +216,65 @@ void              ehci_dump_exfer(struct ehci_xfer *);
 #define ehci_active_intr_list(ex) ((ex)->inext.tqe_prev != NULL)
 
 struct usbd_bus_methods ehci_bus_methods = {
-       ehci_open,
-       ehci_softintr,
-       ehci_poll,
-       ehci_allocx,
-       ehci_freex,
+       .open_pipe = ehci_open,
+       .soft_intr = ehci_softintr,
+       .do_poll = ehci_poll,
+       .allocx = ehci_allocx,
+       .freex = ehci_freex,
 };
 
 struct usbd_pipe_methods ehci_root_ctrl_methods = {
-       ehci_root_ctrl_transfer,
-       ehci_root_ctrl_start,
-       ehci_root_ctrl_abort,
-       ehci_root_ctrl_close,
-       ehci_noop,
-       ehci_root_ctrl_done,
+       .transfer = ehci_root_ctrl_transfer,
+       .start = ehci_root_ctrl_start,
+       .abort = ehci_root_ctrl_abort,
+       .close = ehci_root_ctrl_close,
+       .cleartoggle = ehci_noop,
+       .done = ehci_root_ctrl_done,
 };
 
 struct usbd_pipe_methods ehci_root_intr_methods = {
-       ehci_root_intr_transfer,
-       ehci_root_intr_start,
-       ehci_root_intr_abort,
-       ehci_root_intr_close,
-       ehci_noop,
-       ehci_root_intr_done,
+       .transfer = ehci_root_intr_transfer,
+       .start = ehci_root_intr_start,
+       .abort = ehci_root_intr_abort,
+       .close = ehci_root_intr_close,
+       .cleartoggle = ehci_noop,
+       .done = ehci_root_intr_done,
 };
 
 struct usbd_pipe_methods ehci_device_ctrl_methods = {
-       ehci_device_ctrl_transfer,
-       ehci_device_ctrl_start,
-       ehci_device_ctrl_abort,
-       ehci_device_ctrl_close,
-       ehci_noop,
-       ehci_device_ctrl_done,
+       .transfer = ehci_device_ctrl_transfer,
+       .start = ehci_device_ctrl_start,
+       .abort = ehci_device_ctrl_abort,
+       .close = ehci_device_ctrl_close,
+       .cleartoggle = ehci_noop,
+       .done = ehci_device_ctrl_done,
 };
 
 struct usbd_pipe_methods ehci_device_intr_methods = {
-       ehci_device_intr_transfer,
-       ehci_device_intr_start,
-       ehci_device_intr_abort,
-       ehci_device_intr_close,
-       ehci_device_clear_toggle,
-       ehci_device_intr_done,
+       .transfer = ehci_device_intr_transfer,
+       .start = ehci_device_intr_start,
+       .abort = ehci_device_intr_abort,
+       .close = ehci_device_intr_close,
+       .cleartoggle = ehci_device_clear_toggle,
+       .done = ehci_device_intr_done,
 };
 
 struct usbd_pipe_methods ehci_device_bulk_methods = {
-       ehci_device_bulk_transfer,
-       ehci_device_bulk_start,
-       ehci_device_bulk_abort,
-       ehci_device_bulk_close,
-       ehci_device_clear_toggle,
-       ehci_device_bulk_done,
+       .transfer = ehci_device_bulk_transfer,
+       .start = ehci_device_bulk_start,
+       .abort = ehci_device_bulk_abort,
+       .close = ehci_device_bulk_close,
+       .cleartoggle = ehci_device_clear_toggle,
+       .done = ehci_device_bulk_done,
 };
 
 struct usbd_pipe_methods ehci_device_isoc_methods = {
-       ehci_device_isoc_transfer,
-       ehci_device_isoc_start,
-       ehci_device_isoc_abort,
-       ehci_device_isoc_close,
-       ehci_noop,
-       ehci_device_isoc_done,
+       .transfer = ehci_device_isoc_transfer,
+       .start = ehci_device_isoc_start,
+       .abort = ehci_device_isoc_abort,
+       .close = ehci_device_isoc_close,
+       .cleartoggle = ehci_noop,
+       .done = ehci_device_isoc_done,
 };
 
 /*
index df9d213..c0f6af1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ohci.c,v 1.131 2014/05/30 13:24:59 mpi Exp $ */
+/*     $OpenBSD: ohci.c,v 1.132 2014/06/04 12:28:21 mpi Exp $ */
 /*     $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
@@ -232,65 +232,65 @@ struct ohci_pipe {
 #define OHCI_INTR_ENDPT 1
 
 struct usbd_bus_methods ohci_bus_methods = {
-       ohci_open,
-       ohci_softintr,
-       ohci_poll,
-       ohci_allocx,
-       ohci_freex,
+       .open_pipe = ohci_open,
+       .soft_intr = ohci_softintr,
+       .do_poll = ohci_poll,
+       .allocx = ohci_allocx,
+       .freex = ohci_freex,
 };
 
 struct usbd_pipe_methods ohci_root_ctrl_methods = {
-       ohci_root_ctrl_transfer,
-       ohci_root_ctrl_start,
-       ohci_root_ctrl_abort,
-       ohci_root_ctrl_close,
-       ohci_noop,
-       ohci_root_ctrl_done,
+       .transfer = ohci_root_ctrl_transfer,
+       .start = ohci_root_ctrl_start,
+       .abort = ohci_root_ctrl_abort,
+       .close = ohci_root_ctrl_close,
+       .cleartoggle = ohci_noop,
+       .done = ohci_root_ctrl_done,
 };
 
 struct usbd_pipe_methods ohci_root_intr_methods = {
-       ohci_root_intr_transfer,
-       ohci_root_intr_start,
-       ohci_root_intr_abort,
-       ohci_root_intr_close,
-       ohci_noop,
-       ohci_root_intr_done,
+       .transfer = ohci_root_intr_transfer,
+       .start = ohci_root_intr_start,
+       .abort = ohci_root_intr_abort,
+       .close = ohci_root_intr_close,
+       .cleartoggle = ohci_noop,
+       .done = ohci_root_intr_done,
 };
 
 struct usbd_pipe_methods ohci_device_ctrl_methods = {
-       ohci_device_ctrl_transfer,
-       ohci_device_ctrl_start,
-       ohci_device_ctrl_abort,
-       ohci_device_ctrl_close,
-       ohci_noop,
-       ohci_device_ctrl_done,
+       .transfer = ohci_device_ctrl_transfer,
+       .start = ohci_device_ctrl_start,
+       .abort = ohci_device_ctrl_abort,
+       .close = ohci_device_ctrl_close,
+       .cleartoggle = ohci_noop,
+       .done = ohci_device_ctrl_done,
 };
 
 struct usbd_pipe_methods ohci_device_intr_methods = {
-       ohci_device_intr_transfer,
-       ohci_device_intr_start,
-       ohci_device_intr_abort,
-       ohci_device_intr_close,
-       ohci_device_clear_toggle,
-       ohci_device_intr_done,
+       .transfer = ohci_device_intr_transfer,
+       .start = ohci_device_intr_start,
+       .abort = ohci_device_intr_abort,
+       .close = ohci_device_intr_close,
+       .cleartoggle = ohci_device_clear_toggle,
+       .done = ohci_device_intr_done,
 };
 
 struct usbd_pipe_methods ohci_device_bulk_methods = {
-       ohci_device_bulk_transfer,
-       ohci_device_bulk_start,
-       ohci_device_bulk_abort,
-       ohci_device_bulk_close,
-       ohci_device_clear_toggle,
-       ohci_device_bulk_done,
+       .transfer = ohci_device_bulk_transfer,
+       .start = ohci_device_bulk_start,
+       .abort = ohci_device_bulk_abort,
+       .close = ohci_device_bulk_close,
+       .cleartoggle = ohci_device_clear_toggle,
+       .done = ohci_device_bulk_done,
 };
 
 struct usbd_pipe_methods ohci_device_isoc_methods = {
-       ohci_device_isoc_transfer,
-       ohci_device_isoc_start,
-       ohci_device_isoc_abort,
-       ohci_device_isoc_close,
-       ohci_noop,
-       ohci_device_isoc_done,
+       .transfer = ohci_device_isoc_transfer,
+       .start = ohci_device_isoc_start,
+       .abort = ohci_device_isoc_abort,
+       .close = ohci_device_isoc_close,
+       .cleartoggle = ohci_noop,
+       .done = ohci_device_isoc_done,
 };
 
 int
index 0084194..fe1dc39 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uhci.c,v 1.122 2014/05/30 13:24:59 mpi Exp $  */
+/*     $OpenBSD: uhci.c,v 1.123 2014/06/04 12:28:21 mpi Exp $  */
 /*     $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
@@ -250,65 +250,65 @@ UREAD4(struct uhci_softc *sc, bus_size_t r)
 #define UHCI_INTR_ENDPT 1
 
 struct usbd_bus_methods uhci_bus_methods = {
-       uhci_open,
-       uhci_softintr,
-       uhci_poll,
-       uhci_allocx,
-       uhci_freex,
+       .open_pipe = uhci_open,
+       .soft_intr = uhci_softintr,
+       .do_poll = uhci_poll,
+       .allocx = uhci_allocx,
+       .freex = uhci_freex,
 };
 
 struct usbd_pipe_methods uhci_root_ctrl_methods = {
-       uhci_root_ctrl_transfer,
-       uhci_root_ctrl_start,
-       uhci_root_ctrl_abort,
-       uhci_root_ctrl_close,
-       uhci_noop,
-       uhci_root_ctrl_done,
+       .transfer = uhci_root_ctrl_transfer,
+       .start = uhci_root_ctrl_start,
+       .abort = uhci_root_ctrl_abort,
+       .close = uhci_root_ctrl_close,
+       .cleartoggle = uhci_noop,
+       .done = uhci_root_ctrl_done,
 };
 
 struct usbd_pipe_methods uhci_root_intr_methods = {
-       uhci_root_intr_transfer,
-       uhci_root_intr_start,
-       uhci_root_intr_abort,
-       uhci_root_intr_close,
-       uhci_noop,
-       uhci_root_intr_done,
+       .transfer = uhci_root_intr_transfer,
+       .start = uhci_root_intr_start,
+       .abort = uhci_root_intr_abort,
+       .close = uhci_root_intr_close,
+       .cleartoggle = uhci_noop,
+       .done = uhci_root_intr_done,
 };
 
 struct usbd_pipe_methods uhci_device_ctrl_methods = {
-       uhci_device_ctrl_transfer,
-       uhci_device_ctrl_start,
-       uhci_device_ctrl_abort,
-       uhci_device_ctrl_close,
-       uhci_noop,
-       uhci_device_ctrl_done,
+       .transfer = uhci_device_ctrl_transfer,
+       .start = uhci_device_ctrl_start,
+       .abort = uhci_device_ctrl_abort,
+       .close = uhci_device_ctrl_close,
+       .cleartoggle = uhci_noop,
+       .done = uhci_device_ctrl_done,
 };
 
 struct usbd_pipe_methods uhci_device_intr_methods = {
-       uhci_device_intr_transfer,
-       uhci_device_intr_start,
-       uhci_device_intr_abort,
-       uhci_device_intr_close,
-       uhci_device_clear_toggle,
-       uhci_device_intr_done,
+       .transfer = uhci_device_intr_transfer,
+       .start = uhci_device_intr_start,
+       .abort = uhci_device_intr_abort,
+       .close = uhci_device_intr_close,
+       .cleartoggle = uhci_device_clear_toggle,
+       .done = uhci_device_intr_done,
 };
 
 struct usbd_pipe_methods uhci_device_bulk_methods = {
-       uhci_device_bulk_transfer,
-       uhci_device_bulk_start,
-       uhci_device_bulk_abort,
-       uhci_device_bulk_close,
-       uhci_device_clear_toggle,
-       uhci_device_bulk_done,
+       .transfer = uhci_device_bulk_transfer,
+       .start = uhci_device_bulk_start,
+       .abort = uhci_device_bulk_abort,
+       .close = uhci_device_bulk_close,
+       .cleartoggle = uhci_device_clear_toggle,
+       .done = uhci_device_bulk_done,
 };
 
 struct usbd_pipe_methods uhci_device_isoc_methods = {
-       uhci_device_isoc_transfer,
-       uhci_device_isoc_start,
-       uhci_device_isoc_abort,
-       uhci_device_isoc_close,
-       uhci_noop,
-       uhci_device_isoc_done,
+       .transfer = uhci_device_isoc_transfer,
+       .start = uhci_device_isoc_start,
+       .abort = uhci_device_isoc_abort,
+       .close = uhci_device_isoc_close,
+       .cleartoggle = uhci_noop,
+       .done = uhci_device_isoc_done,
 };
 
 #define uhci_add_intr_list(sc, ex) \