Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
static int ubt_modevent(module_t, int, void *); | static int ubt_modevent(module_t, int, void *); | ||||
static device_probe_t ubt_probe; | static device_probe_t ubt_probe; | ||||
static device_attach_t ubt_attach; | static device_attach_t ubt_attach; | ||||
static device_detach_t ubt_detach; | static device_detach_t ubt_detach; | ||||
static void ubt_task_schedule(ubt_softc_p, int); | static void ubt_task_schedule(ubt_softc_p, int); | ||||
static task_fn_t ubt_task; | static task_fn_t ubt_task; | ||||
#define ubt_xfer_start(sc, i) usbd_transfer_start((sc)->sc_xfer[(i)]) | #define ubt_xfer_start(sc, i) usbd_transfer_start((sc)->sc_xfer[(i)]) | ||||
hselasky: usbd_transfer_start() is already NULL safe. No need to check for NULL here! | |||||
Done Inline ActionsAh,OK. I see the usbd_transfer_start() code.I will revert this macro change. naito.yuichiro_gmail.com: Ah,OK. I see the usbd_transfer_start() code.I will revert this macro change. | |||||
/* Netgraph methods */ | /* Netgraph methods */ | ||||
static ng_constructor_t ng_ubt_constructor; | static ng_constructor_t ng_ubt_constructor; | ||||
static ng_shutdown_t ng_ubt_shutdown; | static ng_shutdown_t ng_ubt_shutdown; | ||||
static ng_newhook_t ng_ubt_newhook; | static ng_newhook_t ng_ubt_newhook; | ||||
static ng_connect_t ng_ubt_connect; | static ng_connect_t ng_ubt_connect; | ||||
static ng_disconnect_t ng_ubt_disconnect; | static ng_disconnect_t ng_ubt_disconnect; | ||||
static ng_rcvmsg_t ng_ubt_rcvmsg; | static ng_rcvmsg_t ng_ubt_rcvmsg; | ||||
static ng_rcvdata_t ng_ubt_rcvdata; | static ng_rcvdata_t ng_ubt_rcvdata; | ||||
static int ng_usb_isoc_enable = 1; | |||||
SYSCTL_INT(_net_bluetooth, OID_AUTO, usb_isoc_enable, CTLFLAG_RDTUN | CTLFLAG_MPSAFE, | |||||
Not Done Inline ActionsShould be CTLFLAG_RWTUN . hselasky: Should be CTLFLAG_RWTUN . | |||||
Not Done Inline Actionsnodes should be CTLFLAG_RW hselasky: nodes should be CTLFLAG_RW | |||||
Done Inline ActionsI will change to CTLFLAG_RW. naito.yuichiro_gmail.com: I will change to CTLFLAG_RW. | |||||
&ng_usb_isoc_enable, 0, "enable isochronous transfers"); | |||||
/* Queue length */ | /* Queue length */ | ||||
Not Done Inline Actions, 1, should just be , 0, . This field is only used for constants. --HPS hselasky: , 1, should just be , 0, . This field is only used for constants.
--HPS | |||||
Done Inline ActionsOK. I'll change to , 0,. naito.yuichiro_gmail.com: OK. I'll change to , 0,. | |||||
static const struct ng_parse_struct_field ng_ubt_node_qlen_type_fields[] = | static const struct ng_parse_struct_field ng_ubt_node_qlen_type_fields[] = | ||||
{ | { | ||||
{ "queue", &ng_parse_int32_type, }, | { "queue", &ng_parse_int32_type, }, | ||||
{ "qlen", &ng_parse_int32_type, }, | { "qlen", &ng_parse_int32_type, }, | ||||
{ NULL, } | { NULL, } | ||||
}; | }; | ||||
static const struct ng_parse_type ng_ubt_node_qlen_type = | static const struct ng_parse_type ng_ubt_node_qlen_type = | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 573 Lines • ▼ Show 20 Lines | ubt_attach(device_t dev) | ||||
if (wMaxPacketSize > 0 && | if (wMaxPacketSize > 0 && | ||||
usbd_set_alt_interface_index(uaa->device, 1, alt_index)) { | usbd_set_alt_interface_index(uaa->device, 1, alt_index)) { | ||||
UBT_ALERT(sc, "could not set alternate setting %d " \ | UBT_ALERT(sc, "could not set alternate setting %d " \ | ||||
"for interface 1!\n", alt_index); | "for interface 1!\n", alt_index); | ||||
goto detach; | goto detach; | ||||
} | } | ||||
/* Setup transfers for both interfaces */ | /* Setup transfers for both interfaces */ | ||||
if (usbd_transfer_setup(uaa->device, iface_index, sc->sc_xfer, | if (usbd_transfer_setup(uaa->device, iface_index, sc->sc_xfer, ubt_config, | ||||
ubt_config, UBT_N_TRANSFER, sc, &sc->sc_if_mtx)) { | ng_usb_isoc_enable ? UBT_N_TRANSFER : UBT_IF_1_ISOC_DT_RD1, | ||||
sc, &sc->sc_if_mtx)) { | |||||
UBT_ALERT(sc, "could not allocate transfers\n"); | UBT_ALERT(sc, "could not allocate transfers\n"); | ||||
goto detach; | goto detach; | ||||
} | } | ||||
/* Claim all interfaces belonging to the Bluetooth part */ | /* Claim all interfaces belonging to the Bluetooth part */ | ||||
for (i = 1;; i++) { | for (i = 1;; i++) { | ||||
iface = usbd_get_iface(uaa->device, i); | iface = usbd_get_iface(uaa->device, i); | ||||
if (iface == NULL) | if (iface == NULL) | ||||
▲ Show 20 Lines • Show All 791 Lines • ▼ Show 20 Lines | if (task_flags & UBT_FLAG_T_START_ALL) { | ||||
* Start both read and write isoc. transfers by default. | * Start both read and write isoc. transfers by default. | ||||
* Get them going all the time even if we have nothing | * Get them going all the time even if we have nothing | ||||
* to send to avoid any delays. | * to send to avoid any delays. | ||||
*/ | */ | ||||
ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_RD1); | ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_RD1); | ||||
ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_RD2); | ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_RD2); | ||||
ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_WR1); | ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_WR1); | ||||
ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_WR2); | ubt_xfer_start(sc, UBT_IF_1_ISOC_DT_WR2); | ||||
Not Done Inline ActionsThis might get out of sync. Please remove this "if" and ensure xfer pointers are checked for NULL. hselasky: This might get out of sync.
Please remove this "if" and ensure xfer pointers are checked for… | |||||
mtx_unlock(&sc->sc_if_mtx); | mtx_unlock(&sc->sc_if_mtx); | ||||
} | } | ||||
/* Start outgoing control transfer */ | /* Start outgoing control transfer */ | ||||
if (task_flags & UBT_FLAG_T_START_CTRL) { | if (task_flags & UBT_FLAG_T_START_CTRL) { | ||||
mtx_lock(&sc->sc_if_mtx); | mtx_lock(&sc->sc_if_mtx); | ||||
ubt_xfer_start(sc, UBT_IF_0_CTRL_DT_WR); | ubt_xfer_start(sc, UBT_IF_0_CTRL_DT_WR); | ||||
▲ Show 20 Lines • Show All 449 Lines • Show Last 20 Lines |
usbd_transfer_start() is already NULL safe. No need to check for NULL here!