From owner-svn-src-user@FreeBSD.ORG Sun Oct 3 08:08:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14EAF106566B; Sun, 3 Oct 2010 08:08:17 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02A5C8FC08; Sun, 3 Oct 2010 08:08:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9388GoF068205; Sun, 3 Oct 2010 08:08:17 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9388Gdm068187; Sun, 3 Oct 2010 08:08:16 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010030808.o9388Gdm068187@svn.freebsd.org> From: Weongyo Jeong Date: Sun, 3 Oct 2010 08:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213378 - in user/weongyo/usb/sys/dev/usb: . controller input misc net quirk serial storage wlan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2010 08:08:17 -0000 Author: weongyo Date: Sun Oct 3 08:08:16 2010 New Revision: 213378 URL: http://svn.freebsd.org/changeset/base/213378 Log: Removes unnecessary spaces and style(9) Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c user/weongyo/usb/sys/dev/usb/controller/atmegadci.c user/weongyo/usb/sys/dev/usb/controller/avr32dci.c user/weongyo/usb/sys/dev/usb/controller/ehci.c user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c user/weongyo/usb/sys/dev/usb/controller/musb_otg.c user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/uhci.c user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/controller/uss820dci.c user/weongyo/usb/sys/dev/usb/input/atp.c user/weongyo/usb/sys/dev/usb/input/uep.c user/weongyo/usb/sys/dev/usb/input/uhid.c user/weongyo/usb/sys/dev/usb/input/ukbd.c user/weongyo/usb/sys/dev/usb/input/ums.c user/weongyo/usb/sys/dev/usb/misc/udbp.c user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_cdce.c user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_udav.c user/weongyo/usb/sys/dev/usb/net/uhso.c user/weongyo/usb/sys/dev/usb/quirk/usb_quirk.c user/weongyo/usb/sys/dev/usb/serial/u3g.c user/weongyo/usb/sys/dev/usb/serial/uark.c user/weongyo/usb/sys/dev/usb/serial/ubsa.c user/weongyo/usb/sys/dev/usb/serial/ubser.c user/weongyo/usb/sys/dev/usb/serial/uchcom.c user/weongyo/usb/sys/dev/usb/serial/ucycom.c user/weongyo/usb/sys/dev/usb/serial/ufoma.c user/weongyo/usb/sys/dev/usb/serial/uftdi.c user/weongyo/usb/sys/dev/usb/serial/ugensa.c user/weongyo/usb/sys/dev/usb/serial/uipaq.c user/weongyo/usb/sys/dev/usb/serial/ulpt.c user/weongyo/usb/sys/dev/usb/serial/umct.c user/weongyo/usb/sys/dev/usb/serial/umodem.c user/weongyo/usb/sys/dev/usb/serial/umoscom.c user/weongyo/usb/sys/dev/usb/serial/uplcom.c user/weongyo/usb/sys/dev/usb/serial/uslcom.c user/weongyo/usb/sys/dev/usb/serial/uvisor.c user/weongyo/usb/sys/dev/usb/serial/uvscom.c user/weongyo/usb/sys/dev/usb/storage/umass.c user/weongyo/usb/sys/dev/usb/storage/urio.c user/weongyo/usb/sys/dev/usb/storage/ustorage_fs.c user/weongyo/usb/sys/dev/usb/usb_busdma.c user/weongyo/usb/sys/dev/usb/usb_compat_linux.c user/weongyo/usb/sys/dev/usb/usb_dev.c user/weongyo/usb/sys/dev/usb/usb_device.c user/weongyo/usb/sys/dev/usb/usb_generic.c user/weongyo/usb/sys/dev/usb/usb_handle_request.c user/weongyo/usb/sys/dev/usb/usb_hid.c user/weongyo/usb/sys/dev/usb/usb_hub.c user/weongyo/usb/sys/dev/usb/usb_lookup.c user/weongyo/usb/sys/dev/usb/usb_msctest.c user/weongyo/usb/sys/dev/usb/usb_request.c user/weongyo/usb/sys/dev/usb/usb_transfer.c user/weongyo/usb/sys/dev/usb/wlan/if_rum.c user/weongyo/usb/sys/dev/usb/wlan/if_run.c user/weongyo/usb/sys/dev/usb/wlan/if_uath.c user/weongyo/usb/sys/dev/usb/wlan/if_ural.c user/weongyo/usb/sys/dev/usb/wlan/if_zyd.c Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/at91dci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -1738,7 +1738,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_DEVICE: switch (req->bRequest) { case UR_SET_ADDRESS: @@ -1754,7 +1753,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_ENDPOINT: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1783,7 +1781,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_ENDPOINT: switch (req->bRequest) { case UR_GET_STATUS: @@ -1792,7 +1789,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_INTERFACE: switch (req->bRequest) { case UR_SET_INTERFACE: @@ -1804,7 +1800,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_INTERFACE: switch (req->bRequest) { case UR_GET_INTERFACE: @@ -1815,17 +1810,14 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_CLASS_INTERFACE: case UT_WRITE_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_READ_CLASS_INTERFACE: case UT_READ_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_WRITE_CLASS_DEVICE: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1837,7 +1829,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_CLASS_OTHER: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1853,7 +1844,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_CLASS_OTHER: switch (req->bRequest) { case UR_GET_TT_STATE: @@ -1864,7 +1854,6 @@ at91dci_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_CLASS_DEVICE: switch (req->bRequest) { case UR_GET_DESCRIPTOR: @@ -1971,11 +1960,9 @@ tr_handle_clear_port_feature: case UHF_PORT_SUSPEND: at91dci_wakeup_peer(sc); break; - case UHF_PORT_ENABLE: sc->sc_flags.port_enabled = 0; break; - case UHF_PORT_TEST: case UHF_PORT_INDICATOR: case UHF_C_PORT_ENABLE: Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -1587,7 +1587,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_DEVICE: switch (req->bRequest) { case UR_SET_ADDRESS: @@ -1603,7 +1602,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_ENDPOINT: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1632,7 +1630,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_ENDPOINT: switch (req->bRequest) { case UR_GET_STATUS: @@ -1641,7 +1638,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_INTERFACE: switch (req->bRequest) { case UR_SET_INTERFACE: @@ -1653,7 +1649,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_INTERFACE: switch (req->bRequest) { case UR_GET_INTERFACE: @@ -1664,17 +1659,14 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_CLASS_INTERFACE: case UT_WRITE_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_READ_CLASS_INTERFACE: case UT_READ_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_WRITE_CLASS_DEVICE: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1686,7 +1678,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_CLASS_OTHER: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1702,7 +1693,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_CLASS_OTHER: switch (req->bRequest) { case UR_GET_TT_STATE: @@ -1713,7 +1703,6 @@ atmegadci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_CLASS_DEVICE: switch (req->bRequest) { case UR_GET_DESCRIPTOR: @@ -1820,11 +1809,9 @@ tr_handle_clear_port_feature: case UHF_PORT_SUSPEND: atmegadci_wakeup_peer(sc); break; - case UHF_PORT_ENABLE: sc->sc_flags.port_enabled = 0; break; - case UHF_PORT_TEST: case UHF_PORT_INDICATOR: case UHF_C_PORT_ENABLE: Modified: user/weongyo/usb/sys/dev/usb/controller/avr32dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -1520,7 +1520,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_DEVICE: switch (req->bRequest) { case UR_SET_ADDRESS: @@ -1536,7 +1535,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_ENDPOINT: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1565,7 +1563,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_ENDPOINT: switch (req->bRequest) { case UR_GET_STATUS: @@ -1574,7 +1571,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_INTERFACE: switch (req->bRequest) { case UR_SET_INTERFACE: @@ -1586,7 +1582,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_INTERFACE: switch (req->bRequest) { case UR_GET_INTERFACE: @@ -1597,17 +1592,14 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_CLASS_INTERFACE: case UT_WRITE_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_READ_CLASS_INTERFACE: case UT_READ_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_WRITE_CLASS_DEVICE: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1619,7 +1611,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_CLASS_OTHER: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1635,7 +1626,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_CLASS_OTHER: switch (req->bRequest) { case UR_GET_TT_STATE: @@ -1646,7 +1636,6 @@ avr32dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_CLASS_DEVICE: switch (req->bRequest) { case UR_GET_DESCRIPTOR: @@ -1683,12 +1672,10 @@ tr_handle_get_descriptor: len = sizeof(avr32dci_langtab); ptr = (const void *)&avr32dci_langtab; goto tr_valid; - case 1: /* Vendor */ len = sizeof(avr32dci_vendor); ptr = (const void *)&avr32dci_vendor; goto tr_valid; - case 2: /* Product */ len = sizeof(avr32dci_product); ptr = (const void *)&avr32dci_product; @@ -1753,11 +1740,9 @@ tr_handle_clear_port_feature: case UHF_PORT_SUSPEND: avr32dci_wakeup_peer(sc); break; - case UHF_PORT_ENABLE: sc->sc_flags.port_enabled = 0; break; - case UHF_PORT_TEST: case UHF_PORT_INDICATOR: case UHF_C_PORT_ENABLE: Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -3057,7 +3057,6 @@ ehci_roothub_exec(struct usb_device *ude len = sizeof(ehci_odevd); ptr = (const void *)&ehci_odevd; break; - case UDESC_CONFIG: if ((value & 0xff) != 0) { err = USB_ERR_IOERROR; @@ -3066,21 +3065,17 @@ ehci_roothub_exec(struct usb_device *ude len = sizeof(ehci_confd); ptr = (const void *)&ehci_confd; break; - case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ str_ptr = "\001"; break; - case 1: /* Vendor */ str_ptr = sc->sc_vendor; break; - case 2: /* Product */ str_ptr = "EHCI root HUB"; break; - default: str_ptr = ""; break; @@ -3345,21 +3340,17 @@ ehci_roothub_exec(struct usb_device *ude DPRINTF("ehci port %d reset, status = 0x%08x\n", index, v); break; - case UHF_PORT_POWER: DPRINTFN(3, "set port power %d\n", index); EOWRITE4(sc, port, v | EHCI_PS_PP); break; - case UHF_PORT_TEST: DPRINTFN(3, "set port test %d\n", index); break; - case UHF_PORT_INDICATOR: DPRINTFN(3, "set port ind %d\n", index); EOWRITE4(sc, port, v | EHCI_PS_PIC); break; - default: err = USB_ERR_IOERROR; goto done; Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -316,7 +316,7 @@ ehci_pci_attach(device_t self) * some common cases. */ device_printf(self, "pre-2.0 USB revision (ignored)\n"); - /* fallthrough */ + /* FALLTHROUGH */ case PCI_USB_REV_2_0: break; default: @@ -429,11 +429,9 @@ ehci_pci_attach(device_t self) break; } break; - case PCI_EHCI_VENDORID_VIA: ehci_pci_via_quirk(self); break; - default: break; } Modified: user/weongyo/usb/sys/dev/usb/controller/musb_otg.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Sun Oct 3 08:08:16 2010 (r213378) @@ -2195,7 +2195,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_DEVICE: switch (req->bRequest) { case UR_SET_ADDRESS: @@ -2211,7 +2210,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_ENDPOINT: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -2240,7 +2238,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_ENDPOINT: switch (req->bRequest) { case UR_GET_STATUS: @@ -2249,7 +2246,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_INTERFACE: switch (req->bRequest) { case UR_SET_INTERFACE: @@ -2261,7 +2257,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_INTERFACE: switch (req->bRequest) { case UR_GET_INTERFACE: @@ -2272,17 +2267,14 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_CLASS_INTERFACE: case UT_WRITE_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_READ_CLASS_INTERFACE: case UT_READ_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_WRITE_CLASS_DEVICE: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -2294,7 +2286,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_WRITE_CLASS_OTHER: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -2310,7 +2301,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_CLASS_OTHER: switch (req->bRequest) { case UR_GET_TT_STATE: @@ -2321,7 +2311,6 @@ musbotg_roothub_exec(struct usb_device * goto tr_stalled; } break; - case UT_READ_CLASS_DEVICE: switch (req->bRequest) { case UR_GET_DESCRIPTOR: @@ -2428,11 +2417,9 @@ tr_handle_clear_port_feature: case UHF_PORT_SUSPEND: musbotg_wakeup_peer(sc); break; - case UHF_PORT_ENABLE: sc->sc_flags.port_enabled = 0; break; - case UHF_PORT_TEST: case UHF_PORT_INDICATOR: case UHF_C_PORT_ENABLE: Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -2107,7 +2107,6 @@ ohci_roothub_exec(struct usb_device *ude len = sizeof(ohci_devd); ptr = (const void *)&ohci_devd; break; - case UDESC_CONFIG: if ((value & 0xff) != 0) { err = USB_ERR_IOERROR; @@ -2116,21 +2115,17 @@ ohci_roothub_exec(struct usb_device *ude len = sizeof(ohci_confd); ptr = (const void *)&ohci_confd; break; - case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ str_ptr = "\001"; break; - case 1: /* Vendor */ str_ptr = sc->sc_vendor; break; - case 2: /* Product */ str_ptr = "OHCI root HUB"; break; - default: str_ptr = ""; break; @@ -2141,7 +2136,6 @@ ohci_roothub_exec(struct usb_device *ude sizeof(sc->sc_hub_desc.temp), str_ptr); break; - default: err = USB_ERR_IOERROR; goto done; @@ -2268,7 +2262,6 @@ ohci_roothub_exec(struct usb_device *ude 8 + ((sc->sc_noport + 7) / 8); len = sc->sc_hub_desc.hubd.bDescLength; break; - case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE): len = 16; bzero(sc->sc_hub_desc.temp, 16); Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -2428,7 +2428,6 @@ uhci_roothub_exec(struct usb_device *ude len = sizeof(uhci_devd); ptr = (const void *)&uhci_devd; break; - case UDESC_CONFIG: if ((value & 0xff) != 0) { err = USB_ERR_IOERROR; @@ -2437,21 +2436,17 @@ uhci_roothub_exec(struct usb_device *ude len = sizeof(uhci_confd); ptr = (const void *)&uhci_confd; break; - case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ str_ptr = "\001"; break; - case 1: /* Vendor */ str_ptr = sc->sc_vendor; break; - case 2: /* Product */ str_ptr = "UHCI root HUB"; break; - default: str_ptr = ""; break; @@ -2462,7 +2457,6 @@ uhci_roothub_exec(struct usb_device *ude sizeof(sc->sc_hub_desc.temp), str_ptr); break; - default: err = USB_ERR_IOERROR; goto done; Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 3 08:08:16 2010 (r213378) @@ -310,22 +310,18 @@ usb_bus_attach(void *arg, int npending) speed = USB_SPEED_FULL; device_printf(bus->bdev, "12Mbps Full Speed USB v1.0\n"); break; - case USB_REV_1_1: speed = USB_SPEED_FULL; device_printf(bus->bdev, "12Mbps Full Speed USB v1.1\n"); break; - case USB_REV_2_0: speed = USB_SPEED_HIGH; device_printf(bus->bdev, "480Mbps High Speed USB v2.0\n"); break; - case USB_REV_2_5: speed = USB_SPEED_VARIABLE; device_printf(bus->bdev, "480Mbps Wireless USB v2.5\n"); break; - default: device_printf(bus->bdev, "Unsupported USB revision\n"); return; Modified: user/weongyo/usb/sys/dev/usb/controller/uss820dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Sun Oct 3 08:08:16 2010 (r213378) @@ -1795,7 +1795,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_DEVICE: switch (req->bRequest) { case UR_SET_ADDRESS: @@ -1811,7 +1810,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_ENDPOINT: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1840,7 +1838,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_ENDPOINT: switch (req->bRequest) { case UR_GET_STATUS: @@ -1849,7 +1846,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_INTERFACE: switch (req->bRequest) { case UR_SET_INTERFACE: @@ -1861,7 +1857,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_INTERFACE: switch (req->bRequest) { case UR_GET_INTERFACE: @@ -1872,17 +1867,14 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_CLASS_INTERFACE: case UT_WRITE_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_READ_CLASS_INTERFACE: case UT_READ_VENDOR_INTERFACE: /* XXX forward */ break; - case UT_WRITE_CLASS_DEVICE: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1894,7 +1886,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_WRITE_CLASS_OTHER: switch (req->bRequest) { case UR_CLEAR_FEATURE: @@ -1910,7 +1901,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_CLASS_OTHER: switch (req->bRequest) { case UR_GET_TT_STATE: @@ -1921,7 +1911,6 @@ uss820dci_roothub_exec(struct usb_device goto tr_stalled; } break; - case UT_READ_CLASS_DEVICE: switch (req->bRequest) { case UR_GET_DESCRIPTOR: @@ -2028,11 +2017,9 @@ tr_handle_clear_port_feature: case UHF_PORT_SUSPEND: uss820dci_wakeup_peer(sc); break; - case UHF_PORT_ENABLE: sc->sc_flags.port_enabled = 0; break; - case UHF_PORT_TEST: case UHF_PORT_INDICATOR: case UHF_C_PORT_ENABLE: Modified: user/weongyo/usb/sys/dev/usb/input/atp.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/atp.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/input/atp.c Sun Oct 3 08:08:16 2010 (r213378) @@ -531,7 +531,6 @@ atp_reset_callback(struct usb_xfer *xfer usbd_xfer_set_frames(xfer, 2); usbd_transfer_submit(xfer); break; - case USB_ST_TRANSFERRED: default: break; @@ -730,7 +729,6 @@ atp_interpret_sensor_data(const int8_t * if (axis == X && num > 16) arr[i+16] = sensor_data[di+40]; } - break; case ATP_PROT_GEYSER2: case ATP_PROT_GEYSER3: @@ -814,14 +812,12 @@ atp_detect_pspans(int *p, u_int num_sens state = ATP_PSPAN_INCREASING; maxp = p[i]; break; - case ATP_PSPAN_INCREASING: if (p[i] > maxp) maxp = p[i]; else if (p[i] <= (maxp >> 1)) state = ATP_PSPAN_DECREASING; break; - case ATP_PSPAN_DECREASING: if (p[i] > p[i - 1]) { /* @@ -1931,7 +1927,7 @@ atp_intr(struct usb_xfer *xfer, usb_erro } } else sc->sc_idlecount = 0; - + /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: /* check if we can put more data into the FIFO */ @@ -1942,7 +1938,6 @@ atp_intr(struct usb_xfer *xfer, usb_erro usbd_transfer_submit(xfer); } break; - default: /* Error */ if (error != USB_ERR_CANCELLED) { /* try clear stall first */ Modified: user/weongyo/usb/sys/dev/usb/input/uep.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/uep.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/input/uep.c Sun Oct 3 08:08:16 2010 (r213378) @@ -257,6 +257,7 @@ uep_intr_callback(struct usb_xfer *xfer, len -= pkt_len; } } + /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: /* check if we can put more data into the FIFO */ @@ -266,7 +267,6 @@ uep_intr_callback(struct usb_xfer *xfer, usbd_transfer_submit(xfer); } break; - default: if (error != USB_ERR_CANCELLED) { /* try clear stall first */ Modified: user/weongyo/usb/sys/dev/usb/input/uhid.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/uhid.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/input/uhid.c Sun Oct 3 08:08:16 2010 (r213378) @@ -182,7 +182,7 @@ uhid_intr_callback(struct usb_xfer *xfer /* ignore it */ DPRINTF("ignored transfer, %d bytes\n", actlen); } - + /* FALLTHROUGH */ case USB_ST_SETUP: re_submit: if (usb_fifo_put_bytes_max( @@ -191,7 +191,6 @@ re_submit: usbd_transfer_submit(xfer); } return; - default: /* Error */ if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ @@ -273,7 +272,6 @@ uhid_write_callback(struct usb_xfer *xfe usbd_transfer_submit(xfer); } return; - default: tr_error: /* bomb out */ @@ -296,9 +294,7 @@ uhid_read_callback(struct usb_xfer *xfer usb_fifo_put_data(sc->sc_fifo.fp[USB_FIFO_RX], pc, sizeof(req), sc->sc_isize, 1); return; - case USB_ST_SETUP: - if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) > 0) { uhid_fill_get_report (&req, sc->sc_iface_no, UHID_INPUT_REPORT, @@ -312,7 +308,6 @@ uhid_read_callback(struct usb_xfer *xfer usbd_transfer_submit(xfer); } return; - default: /* Error */ /* bomb out */ usb_fifo_put_data_error(sc->sc_fifo.fp[USB_FIFO_RX]); @@ -504,7 +499,6 @@ uhid_ioctl(struct usb_fifo *fifo, u_long break; /* descriptor length only */ error = copyout(sc->sc_repdesc_ptr, ugd->ugd_data, size); break; - case USB_SET_IMMED: if (!(fflags & FREAD)) { error = EPERM; @@ -525,7 +519,6 @@ uhid_ioctl(struct usb_fifo *fifo, u_long mtx_unlock(&sc->sc_mtx); } break; - case USB_GET_REPORT: if (!(fflags & FREAD)) { error = EPERM; @@ -551,7 +544,6 @@ uhid_ioctl(struct usb_fifo *fifo, u_long error = uhid_get_report(sc, ugd->ugd_report_type, id, NULL, ugd->ugd_data, size); break; - case USB_SET_REPORT: if (!(fflags & FWRITE)) { error = EPERM; @@ -577,11 +569,9 @@ uhid_ioctl(struct usb_fifo *fifo, u_long error = uhid_set_report(sc, ugd->ugd_report_type, id, NULL, ugd->ugd_data, size); break; - case USB_GET_REPORT_ID: *(int *)addr = 0; /* XXX: we only support reportid 0? */ break; - default: error = EINVAL; break; Modified: user/weongyo/usb/sys/dev/usb/input/ukbd.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ukbd.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/input/ukbd.c Sun Oct 3 08:08:16 2010 (r213378) @@ -630,6 +630,7 @@ ukbd_intr_callback(struct usb_xfer *xfer ukbd_start_timer(sc); } } + /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: if (sc->sc_inputs < UKBD_IN_BUF_FULL) { @@ -638,7 +639,6 @@ tr_setup: } else DPRINTF("input queue is full!\n"); break; - default: /* Error */ DPRINTF("error=%s\n", usbd_errstr(error)); @@ -699,7 +699,6 @@ ukbd_set_leds_callback(struct usb_xfer * usbd_transfer_submit(xfer); } break; - default: /* Error */ DPRINTFN(1, "error=%s\n", usbd_errstr(error)); break; @@ -1348,25 +1347,21 @@ next_code: sc->sc_composed_char *= 10; sc->sc_composed_char += keycode - 0x40; goto check_composed; - case 0x4B: case 0x4C: case 0x4D: /* keypad 4,5,6 */ sc->sc_composed_char *= 10; sc->sc_composed_char += keycode - 0x47; goto check_composed; - case 0x4F: case 0x50: case 0x51: /* keypad 1,2,3 */ sc->sc_composed_char *= 10; sc->sc_composed_char += keycode - 0x4E; goto check_composed; - case 0x52: /* keypad 0 */ sc->sc_composed_char *= 10; goto check_composed; - /* key released, no interest here */ case SCAN_RELEASE | 0x47: case SCAN_RELEASE | 0x48: @@ -1379,10 +1374,8 @@ next_code: case SCAN_RELEASE | 0x51: /* keypad 1,2,3 */ case SCAN_RELEASE | 0x52: /* keypad 0 */ goto next_code; - case 0x38: /* left alt key */ break; - default: if (sc->sc_composed_char > 0) { sc->sc_flags &= ~UKBD_FLAG_COMPOSE; @@ -1478,7 +1471,6 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, return (EINVAL); } break; - case KDGETLED: /* get keyboard LED */ *(int *)arg = KBD_LED_VAL(kbd); break; @@ -1524,7 +1516,6 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, /* set LEDs and quit */ return (ukbd_ioctl(kbd, KDSETLED, arg)); - case KDSETREPEAT: /* set keyboard repeat rate (new * interface) */ if (!KBD_HAS_DEVICE(kbd)) @@ -1539,7 +1530,6 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, kbd->kb_delay1 = ((int *)arg)[0]; kbd->kb_delay2 = ((int *)arg)[1]; return (0); - #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD4) || defined(COMPAT_43) case _IO('K', 67): @@ -1550,7 +1540,6 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, case KDSETRAD: /* set keyboard repeat rate (old * interface) */ return (ukbd_set_typematic(kbd, *(int *)arg)); - case PIO_KEYMAP: /* set keyboard translation table */ case PIO_KEYMAPENT: /* set keyboard translation table * entry */ Modified: user/weongyo/usb/sys/dev/usb/input/ums.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ums.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/input/ums.c Sun Oct 3 08:08:16 2010 (r213378) @@ -320,6 +320,7 @@ ums_intr_callback(struct usb_xfer *xfer, ums_put_queue(sc, dx, dy, dz, dt, buttons); } } + /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: /* check if we can put more data into the FIFO */ @@ -329,7 +330,6 @@ tr_setup: usbd_transfer_submit(xfer); } break; - default: /* Error */ if (error != USB_ERR_CANCELLED) { /* try clear stall first */ @@ -808,11 +808,9 @@ ums_ioctl(struct usb_fifo *fifo, u_long case MOUSE_GETHWINFO: *(mousehw_t *)addr = sc->sc_hw; break; - case MOUSE_GETMODE: *(mousemode_t *)addr = sc->sc_mode; break; - case MOUSE_SETMODE: mode = *(mousemode_t *)addr; @@ -848,11 +846,9 @@ ums_ioctl(struct usb_fifo *fifo, u_long } ums_reset_buf(sc); break; - case MOUSE_GETLEVEL: *(int *)addr = sc->sc_mode.level; break; - case MOUSE_SETLEVEL: if (*(int *)addr < 0 || *(int *)addr > 1) { error = EINVAL; @@ -881,7 +877,6 @@ ums_ioctl(struct usb_fifo *fifo, u_long } ums_reset_buf(sc); break; - case MOUSE_GETSTATUS:{ mousestatus_t *status = (mousestatus_t *)addr; Modified: user/weongyo/usb/sys/dev/usb/misc/udbp.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/misc/udbp.c Sun Oct 3 04:33:58 2010 (r213377) +++ user/weongyo/usb/sys/dev/usb/misc/udbp.c Sun Oct 3 08:08:16 2010 (r213378) @@ -275,11 +275,9 @@ udbp_modload(module_t mod, int event, vo NG_UDBP_NODE_TYPE, error); } break; - case MOD_UNLOAD: error = ng_rmtype(&ng_udbp_typestruct); break; - default: error = EOPNOTSUPP; break; @@ -409,7 +407,6 @@ udbp_bulk_read_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - /* allocate new mbuf */ MGETHDR(m, M_DONTWAIT, MT_DATA); @@ -429,7 +426,7 @@ udbp_bulk_read_callback(struct usb_xfer *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Oct 3 23:40:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFCF4106564A; Sun, 3 Oct 2010 23:40:54 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CFA48FC08; Sun, 3 Oct 2010 23:40:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o93Nesnd093800; Sun, 3 Oct 2010 23:40:54 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o93NesP0093778; Sun, 3 Oct 2010 23:40:54 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010032340.o93NesP0093778@svn.freebsd.org> From: Weongyo Jeong Date: Sun, 3 Oct 2010 23:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213392 - in user/weongyo/usb/sys/dev/usb: . controller input misc net quirk serial storage template X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2010 23:40:54 -0000 Author: weongyo Date: Sun Oct 3 23:40:54 2010 New Revision: 213392 URL: http://svn.freebsd.org/changeset/base/213392 Log: Removes unnecessary parentheses. Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c user/weongyo/usb/sys/dev/usb/controller/atmegadci.c user/weongyo/usb/sys/dev/usb/controller/avr32dci.c user/weongyo/usb/sys/dev/usb/controller/ehci.c user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c user/weongyo/usb/sys/dev/usb/controller/musb_otg.c user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c user/weongyo/usb/sys/dev/usb/controller/uhci.c user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/controller/uss820dci.c user/weongyo/usb/sys/dev/usb/input/atp.c user/weongyo/usb/sys/dev/usb/input/uep.c user/weongyo/usb/sys/dev/usb/input/uhid.c user/weongyo/usb/sys/dev/usb/input/ukbd.c user/weongyo/usb/sys/dev/usb/input/ums.c user/weongyo/usb/sys/dev/usb/misc/udbp.c user/weongyo/usb/sys/dev/usb/misc/ufm.c user/weongyo/usb/sys/dev/usb/net/if_cdce.c user/weongyo/usb/sys/dev/usb/quirk/usb_quirk.c user/weongyo/usb/sys/dev/usb/serial/uark.c user/weongyo/usb/sys/dev/usb/serial/ubser.c user/weongyo/usb/sys/dev/usb/serial/ucycom.c user/weongyo/usb/sys/dev/usb/serial/ufoma.c user/weongyo/usb/sys/dev/usb/serial/uftdi.c user/weongyo/usb/sys/dev/usb/serial/ulpt.c user/weongyo/usb/sys/dev/usb/serial/umodem.c user/weongyo/usb/sys/dev/usb/serial/umoscom.c user/weongyo/usb/sys/dev/usb/serial/usb_serial.c user/weongyo/usb/sys/dev/usb/storage/umass.c user/weongyo/usb/sys/dev/usb/storage/urio.c user/weongyo/usb/sys/dev/usb/storage/ustorage_fs.c user/weongyo/usb/sys/dev/usb/template/usb_template.c user/weongyo/usb/sys/dev/usb/template/usb_template_mtp.c user/weongyo/usb/sys/dev/usb/usb_busdma.c user/weongyo/usb/sys/dev/usb/usb_compat_linux.c user/weongyo/usb/sys/dev/usb/usb_dev.c user/weongyo/usb/sys/dev/usb/usb_device.c user/weongyo/usb/sys/dev/usb/usb_generic.c user/weongyo/usb/sys/dev/usb/usb_handle_request.c user/weongyo/usb/sys/dev/usb/usb_hid.c user/weongyo/usb/sys/dev/usb/usb_hub.c user/weongyo/usb/sys/dev/usb/usb_lookup.c user/weongyo/usb/sys/dev/usb/usb_parse.c user/weongyo/usb/sys/dev/usb/usb_request.c user/weongyo/usb/sys/dev/usb/usb_transfer.c user/weongyo/usb/sys/dev/usb/usb_util.c Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/at91dci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -344,8 +344,8 @@ at91dci_setup_rx(struct at91dci_td *td) sc = AT9100_DCI_PC2SC(td->pc); /* sneak peek the set address */ - if ((req.bmRequestType == UT_WRITE_DEVICE) && - (req.bRequest == UR_SET_ADDRESS)) + if (req.bmRequestType == UT_WRITE_DEVICE && + req.bRequest == UR_SET_ADDRESS) sc->sc_dv_addr = req.wValue[0] & 0x7F; else sc->sc_dv_addr = 0xFF; @@ -492,7 +492,7 @@ repeat: */ /* check if we are complete */ - if ((td->remainder == 0) || got_short) { + if (td->remainder == 0 || got_short) { if (td->short_pkt) { /* we are complete */ return (0); @@ -1568,8 +1568,8 @@ at91dci_device_isoc_fs_enter(struct usb_ */ temp = (nframes - xfer->endpoint->isoc_next) & AT91_UDP_FRM_MASK; - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { + if (xfer->endpoint->is_synced == 0 || + temp < xfer->nframes) { /* * If there is data underflow or the endpoint queue is * empty we schedule the transfer a few frames ahead Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -289,8 +289,8 @@ atmegadci_setup_rx(struct atmegadci_td * td->remainder = 0; /* sneak peek the set address */ - if ((req.bmRequestType == UT_WRITE_DEVICE) && - (req.bRequest == UR_SET_ADDRESS)) { + if (req.bmRequestType == UT_WRITE_DEVICE && + req.bRequest == UR_SET_ADDRESS) { sc->sc_dv_addr = req.wValue[0] & 0x7F; /* must write address before ZLP */ ATMEGA_WRITE_1(sc, ATMEGA_UDADDR, sc->sc_dv_addr); @@ -415,7 +415,7 @@ repeat: ATMEGA_WRITE_1(sc, ATMEGA_UEINTX, ATMEGA_UEINTX_FIFOCON ^ 0xFF); /* check if we are complete */ - if ((td->remainder == 0) || got_short) { + if (td->remainder == 0 || got_short) { if (td->short_pkt) { /* we are complete */ return (0); @@ -1415,8 +1415,8 @@ atmegadci_device_isoc_fs_enter(struct us */ temp = (nframes - xfer->endpoint->isoc_next) & ATMEGA_FRAME_MASK; - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { + if (xfer->endpoint->is_synced == 0 || + temp < xfer->nframes) { /* * If there is data underflow or the pipe queue is * empty we schedule the transfer a few frames ahead Modified: user/weongyo/usb/sys/dev/usb/controller/avr32dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -313,8 +313,8 @@ avr32dci_setup_rx(struct avr32dci_td *td td->remainder = 0; /* sneak peek the set address */ - if ((req.bmRequestType == UT_WRITE_DEVICE) && - (req.bRequest == UR_SET_ADDRESS)) { + if (req.bmRequestType == UT_WRITE_DEVICE && + req.bRequest == UR_SET_ADDRESS) { sc->sc_dv_addr = req.wValue[0] & 0x7F; /* must write address before ZLP */ avr32dci_mod_ctrl(sc, 0, AVR32_CTRL_DEV_FADDR_EN | @@ -427,7 +427,7 @@ repeat: AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(td->ep_no), AVR32_EPTSTA_RX_BK_RDY); /* check if we are complete */ - if ((td->remainder == 0) || got_short) { + if (td->remainder == 0 || got_short) { if (td->short_pkt) { /* we are complete */ return (0); @@ -1348,8 +1348,8 @@ avr32dci_device_isoc_fs_enter(struct usb */ temp = (nframes - xfer->pipe->isoc_next) & AVR32_FRAME_MASK; - if ((xfer->pipe->is_synced == 0) || - (temp < xfer->nframes)) { + if (xfer->pipe->is_synced == 0 || + temp < xfer->nframes) { /* * If there is data underflow or the pipe queue is * empty we schedule the transfer a few frames ahead @@ -1989,8 +1989,8 @@ avr32dci_ep_init(struct usb_device *udev /* not supported */ return; } - if ((udev->speed != USB_SPEED_FULL) && - (udev->speed != USB_SPEED_HIGH)) { + if (udev->speed != USB_SPEED_FULL && + udev->speed != USB_SPEED_HIGH) { /* not supported */ return; } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -549,8 +549,8 @@ ehci_suspend(ehci_softc_t *sc) for (i = 1; i <= sc->sc_noport; i++) { cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_PE) == EHCI_PS_PE)) { + if ((cmd & EHCI_PS_PO) == 0 && + (cmd & EHCI_PS_PE) == EHCI_PS_PE) { EOWRITE4(sc, EHCI_PORTSC(i), cmd | EHCI_PS_SUSP); } @@ -613,8 +613,8 @@ ehci_resume(ehci_softc_t *sc) hcr = 0; for (i = 1; i <= sc->sc_noport; i++) { cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { + if ((cmd & EHCI_PS_PO) == 0 && + (cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP) { EOWRITE4(sc, EHCI_PORTSC(i), cmd | EHCI_PS_FPR); hcr = 1; @@ -627,8 +627,8 @@ ehci_resume(ehci_softc_t *sc) for (i = 1; i <= sc->sc_noport; i++) { cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { + if ((cmd & EHCI_PS_PO) == 0 && + (cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP) { EOWRITE4(sc, EHCI_PORTSC(i), cmd & ~EHCI_PS_FPR); } @@ -2120,7 +2120,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru td_no++; - if ((td_no == 8) || (nframes == 0)) { + if (td_no == 8 || nframes == 0) { /* remove HS-TD from schedule */ EHCI_REMOVE_HS_TD(td, *pp_last); pp_last++; @@ -2146,8 +2146,8 @@ ehci_device_done(struct usb_xfer *xfer, DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n", xfer, xfer->endpoint, error); - if ((methods == &ehci_device_bulk_methods) || - (methods == &ehci_device_ctrl_methods)) { + if (methods == &ehci_device_bulk_methods || + methods == &ehci_device_ctrl_methods) { #ifdef USB_DEBUG if (ehcidebug > 8) { DPRINTF("nexttog=%d; data after transfer:\n", @@ -2443,8 +2443,8 @@ ehci_device_isoc_fs_enter(struct usb_xfe buf_offset = (nframes - xfer->endpoint->isoc_next) & (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - if ((xfer->endpoint->is_synced == 0) || - (buf_offset < xfer->nframes)) { + if (xfer->endpoint->is_synced == 0 || + buf_offset < xfer->nframes) { /* * If there is data underflow or the pipe queue is empty we * schedule the transfer a few frames ahead of the current @@ -2725,8 +2725,8 @@ ehci_device_isoc_hs_enter(struct usb_xfe buf_offset = (nframes - xfer->endpoint->isoc_next) & (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - if ((xfer->endpoint->is_synced == 0) || - (buf_offset < (((xfer->nframes << shift) + 7) / 8))) { + if (xfer->endpoint->is_synced == 0 || + buf_offset < (((xfer->nframes << shift) + 7) / 8)) { /* * If there is data underflow or the pipe queue is empty we * schedule the transfer a few frames ahead of the current @@ -2808,7 +2808,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe td_no++; - if ((td_no == 8) || (nframes == 0)) { + if (td_no == 8 || nframes == 0) { /* the rest of the transfers are not active, if any */ for (x = td_no; x != 8; x++) td->itd_status[x] = 0; /* not active */ @@ -3135,8 +3135,7 @@ ehci_roothub_exec(struct usb_device *ude case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_OTHER): DPRINTFN(9, "UR_CLEAR_PORT_FEATURE\n"); - if ((index < 1) || - (index > sc->sc_noport)) { + if (index < 1 || index > sc->sc_noport) { err = USB_ERR_IOERROR; goto done; } @@ -3225,8 +3224,7 @@ ehci_roothub_exec(struct usb_device *ude case C(UR_GET_STATUS, UT_READ_CLASS_OTHER): DPRINTFN(9, "get port status i=%d\n", index); - if ((index < 1) || - (index > sc->sc_noport)) { + if (index < 1 || index > sc->sc_noport) { err = USB_ERR_IOERROR; goto done; } @@ -3274,8 +3272,7 @@ ehci_roothub_exec(struct usb_device *ude case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE): break; case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER): - if ((index < 1) || - (index > sc->sc_noport)) { + if (index < 1 || index > sc->sc_noport) { err = USB_ERR_IOERROR; goto done; } @@ -3639,11 +3636,11 @@ ehci_ep_init(struct usb_device *udev, st return; } if (udev->device_index != sc->sc_addr) { - if ((udev->speed != USB_SPEED_HIGH) && - ((udev->hs_hub_addr == 0) || - (udev->hs_port_no == 0) || - (udev->parent_hs_hub == NULL) || - (udev->parent_hs_hub->hub == NULL))) { + if (udev->speed != USB_SPEED_HIGH && + (udev->hs_hub_addr == 0 || + udev->hs_port_no == 0 || + udev->parent_hs_hub == NULL || + udev->parent_hs_hub->hub == NULL)) { /* We need a transaction translator */ goto done; } @@ -3698,8 +3695,8 @@ ehci_device_resume(struct usb_device *ud if (xfer->xroot->udev == udev) { methods = xfer->endpoint->methods; - if ((methods == &ehci_device_bulk_methods) || - (methods == &ehci_device_ctrl_methods)) { + if (methods == &ehci_device_bulk_methods || + methods == &ehci_device_ctrl_methods) { EHCI_APPEND_QH(xfer->qh_start[xfer->curr_dma_set], sc->sc_async_p_last); } @@ -3730,8 +3727,8 @@ ehci_device_suspend(struct usb_device *u if (xfer->xroot->udev == udev) { methods = xfer->endpoint->methods; - if ((methods == &ehci_device_bulk_methods) || - (methods == &ehci_device_ctrl_methods)) { + if (methods == &ehci_device_bulk_methods || + methods == &ehci_device_ctrl_methods) { EHCI_REMOVE_QH(xfer->qh_start[xfer->curr_dma_set], sc->sc_async_p_last); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -228,9 +228,9 @@ ehci_pci_match(device_t self) break; } - if ((pci_get_class(self) == PCIC_SERIALBUS) - && (pci_get_subclass(self) == PCIS_SERIALBUS_USB) - && (pci_get_progif(self) == PCI_INTERFACE_EHCI)) + if (pci_get_class(self) == PCIC_SERIALBUS && + pci_get_subclass(self) == PCIS_SERIALBUS_USB && + pci_get_progif(self) == PCI_INTERFACE_EHCI) return ("EHCI (generic) USB 2.0 controller"); return (NULL); /* dunno */ } @@ -280,8 +280,8 @@ ehci_pci_via_quirk(device_t self) { uint32_t val; - if ((pci_get_device(self) == 0x3104) && - ((pci_get_revid(self) & 0xf0) == 0x60)) { + if (pci_get_device(self) == 0x3104 && + (pci_get_revid(self) & 0xf0) == 0x60) { /* Correct schedule sleep time to 10us */ val = pci_read_config(self, 0x4b, 1); if (val & 0x20) Modified: user/weongyo/usb/sys/dev/usb/controller/musb_otg.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Sun Oct 3 23:40:54 2010 (r213392) @@ -321,8 +321,8 @@ musbotg_setup_rx(struct musbotg_td *td) sc->sc_ep0_busy = 1; /* sneak peek the set address */ - if ((req.bmRequestType == UT_WRITE_DEVICE) && - (req.bRequest == UR_SET_ADDRESS)) + if (req.bmRequestType == UT_WRITE_DEVICE && + req.bRequest == UR_SET_ADDRESS) sc->sc_dv_addr = req.wValue[0] & 0x7F; else sc->sc_dv_addr = 0xFF; @@ -465,7 +465,7 @@ musbotg_setup_data_rx(struct musbotg_td } /* check if we are complete */ - if ((td->remainder == 0) || got_short) { + if (td->remainder == 0 || got_short) { if (td->short_pkt) { /* we are complete */ sc->sc_ep0_cmd = MUSB2_MASK_CSR0L_RXPKTRDY_CLR; @@ -749,7 +749,7 @@ repeat: MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRL, 0); /* check if we are complete */ - if ((td->remainder == 0) || got_short) { + if (td->remainder == 0 || got_short) { if (td->short_pkt) { /* we are complete */ return (0); @@ -2023,8 +2023,7 @@ musbotg_device_isoc_enter(struct usb_xfe else fs_frames = xfer->nframes; - if ((xfer->endpoint->is_synced == 0) || - (temp < fs_frames)) { + if (xfer->endpoint->is_synced == 0 || temp < fs_frames) { /* * If there is data underflow or the pipe queue is * empty we schedule the transfer a few frames ahead @@ -2554,8 +2553,8 @@ musbotg_xfer_setup(struct usb_setup_para parm->hc_max_packet_size = 0x400; parm->hc_max_frame_size = 0x400; - if ((parm->methods == &musbotg_device_isoc_methods) || - (parm->methods == &musbotg_device_intr_methods)) + if (parm->methods == &musbotg_device_isoc_methods || + parm->methods == &musbotg_device_intr_methods) parm->hc_max_packet_count = 3; else parm->hc_max_packet_count = 1; @@ -2651,8 +2650,8 @@ musbotg_ep_init(struct usb_device *udev, /* not supported */ return; } - if ((udev->speed != USB_SPEED_FULL) && - (udev->speed != USB_SPEED_HIGH)) { + if (udev->speed != USB_SPEED_FULL && + udev->speed != USB_SPEED_HIGH) { /* not supported */ return; } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -987,7 +987,7 @@ ohci_check_transfer_sub(struct usb_xfer * Check if we reached the last packet * or if there is a short packet: */ - if (((td_next & (~0xF)) == OHCI_TD_NEXT_END) || phy_start) { + if ((td_next & (~0xF)) == OHCI_TD_NEXT_END || phy_start) { /* follow alt next */ td = td->alt_next; break; @@ -1335,7 +1335,7 @@ restart: temp->len -= average; } - if ((td_next == td_alt_next) && temp->setup_alt_next) { + if (td_next == td_alt_next && temp->setup_alt_next) { /* we need to receive these frames one by one ! */ td->td_flags &= htole32(~OHCI_TD_INTR_MASK); td->td_flags |= htole32(OHCI_TD_SET_DI(1)); Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -187,9 +187,9 @@ ohci_pci_match(device_t self) default: break; } - if ((pci_get_class(self) == PCIC_SERIALBUS) && - (pci_get_subclass(self) == PCIS_SERIALBUS_USB) && - (pci_get_progif(self) == PCI_INTERFACE_OHCI)) + if (pci_get_class(self) == PCIC_SERIALBUS && + pci_get_subclass(self) == PCIS_SERIALBUS_USB && + pci_get_progif(self) == PCI_INTERFACE_OHCI) return ("OHCI (generic) USB controller"); return (NULL); } Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -2853,9 +2853,9 @@ alloc_dma_set: td = page_info.buffer; /* init TD */ - if ((parm->methods == &uhci_device_bulk_methods) || - (parm->methods == &uhci_device_ctrl_methods) || - (parm->methods == &uhci_device_intr_methods)) { + if (parm->methods == &uhci_device_bulk_methods || + parm->methods == &uhci_device_ctrl_methods || + parm->methods == &uhci_device_intr_methods) { /* set depth first bit */ td->td_self = htole32(page_info.physaddr | UHCI_PTR_TD | UHCI_PTR_VF); Modified: user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -247,9 +247,9 @@ uhci_pci_match(device_t self) break; } - if ((pci_get_class(self) == PCIC_SERIALBUS) && - (pci_get_subclass(self) == PCIS_SERIALBUS_USB) && - (pci_get_progif(self) == PCI_INTERFACE_UHCI)) + if (pci_get_class(self) == PCIC_SERIALBUS && + pci_get_subclass(self) == PCIS_SERIALBUS_USB && + pci_get_progif(self) == PCI_INTERFACE_UHCI) return ("UHCI (generic) USB controller"); return (NULL); } Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 3 23:40:54 2010 (r213392) @@ -346,8 +346,8 @@ usb_bus_attach(void *arg, int npending) err = usb_probe_and_attach(child, USB_IFACE_INDEX_ANY); if (!err) { - if ((bus->devices[USB_ROOT_HUB_ADDR] == NULL) || - (bus->devices[USB_ROOT_HUB_ADDR]->hub == NULL)) + if (bus->devices[USB_ROOT_HUB_ADDR] == NULL || + bus->devices[USB_ROOT_HUB_ADDR]->hub == NULL) err = USB_ERR_NO_ROOT_HUB; } } else Modified: user/weongyo/usb/sys/dev/usb/controller/uss820dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Sun Oct 3 23:40:54 2010 (r213392) @@ -321,8 +321,8 @@ uss820dci_setup_rx(struct uss820dci_td * td->remainder = 0; /* sneak peek the set address */ - if ((req.bmRequestType == UT_WRITE_DEVICE) && - (req.bRequest == UR_SET_ADDRESS)) + if (req.bmRequestType == UT_WRITE_DEVICE && + req.bRequest == UR_SET_ADDRESS) sc->sc_dv_addr = req.wValue[0] & 0x7F; else sc->sc_dv_addr = 0xFF; @@ -485,7 +485,7 @@ repeat: USS820_RXCON, rx_cntl); /* check if we are complete */ - if ((td->remainder == 0) || got_short) { + if (td->remainder == 0 || got_short) { if (td->short_pkt) { /* we are complete */ return (0); @@ -543,9 +543,8 @@ repeat: if (tx_flag & USS820_TXFLG_TXFIF1) return (1); /* not complete */ } - if ((!td->support_multi_buffer) && - (tx_flag & (USS820_TXFLG_TXFIF0 | - USS820_TXFLG_TXFIF1))) + if (!td->support_multi_buffer && + (tx_flag & (USS820_TXFLG_TXFIF0 | USS820_TXFLG_TXFIF1))) return (1); /* not complete */ count = td->max_packet_size; if (td->remainder < count) { @@ -1387,15 +1386,15 @@ uss820dci_init(struct uss820dci_softc *s USS820_TXCON_ATM); } } else { - if ((pf->max_in_frame_size <= 8) && - (sc->sc_flags.mcsr_feat)) { + if (pf->max_in_frame_size <= 8 && + sc->sc_flags.mcsr_feat) { temp = (USS820_TXCON_FFSZ_8_512 | USS820_TXCON_ATM); } else if (pf->max_in_frame_size <= 16) { temp = (USS820_TXCON_FFSZ_16_64 | USS820_TXCON_ATM); - } else if ((pf->max_in_frame_size <= 32) && - (sc->sc_flags.mcsr_feat)) { + } else if (pf->max_in_frame_size <= 32 && + sc->sc_flags.mcsr_feat) { temp = (USS820_TXCON_FFSZ_32_1024 | USS820_TXCON_ATM); } else { /* 64 bytes */ @@ -1623,8 +1622,8 @@ uss820dci_device_isoc_fs_enter(struct us */ temp = (nframes - xfer->endpoint->isoc_next) & USS820_SOFL_MASK; - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { + if (xfer->endpoint->is_synced == 0 || + temp < xfer->nframes) { /* * If there is data underflow or the pipe queue is * empty we schedule the transfer a few frames ahead Modified: user/weongyo/usb/sys/dev/usb/input/atp.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/atp.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/input/atp.c Sun Oct 3 23:40:54 2010 (r213392) @@ -486,7 +486,7 @@ atp_set_device_mode(device_t dev, interf usb_device_request_t req; usb_error_t err; - if ((mode != RAW_SENSOR_MODE) && (mode != HID_MODE)) + if (mode != RAW_SENSOR_MODE && mode != HID_MODE) return (ENXIO); sc = device_get_softc(dev); @@ -850,8 +850,8 @@ atp_detect_pspans(int *p, u_int num_sens /* post-process the spans */ for (i = 0; i < num_spans; i++) { /* filter away unwanted pressure spans */ - if ((spans[i].cum < atp_pspan_min_cum_pressure) || - (spans[i].width > atp_pspan_max_width)) { + if (spans[i].cum < atp_pspan_min_cum_pressure || + spans[i].width > atp_pspan_max_width) { if ((i + 1) < num_spans) { memcpy(&spans[i], &spans[i + 1], (num_spans - i - 1) * sizeof(atp_pspan)); @@ -954,7 +954,7 @@ atp_match_strokes_against_pspans(struct stroke->components[axis].matched = TRUE; /* Take care to repeat at the multi-span. */ - if ((repeat_count > 0) && (j == repeat_index)) + if (repeat_count > 0 && j == repeat_index) repeat_count--; else pspans[j].matched = TRUE; @@ -1049,7 +1049,7 @@ atp_update_strokes(struct atp_softc *sc, if (pspans_x[i].matched == FALSE) break; for (j = 0; j < n_ypspans; j++) if (pspans_y[j].matched == FALSE) break; - if ((i < n_xpspans) && (j < n_ypspans)) { + if (i < n_xpspans && j < n_ypspans) { #ifdef USB_DEBUG if (atp_debug >= ATP_LLEVEL_INFO) { printf("unmatched pspans:"); @@ -1068,7 +1068,7 @@ atp_update_strokes(struct atp_softc *sc, printf("\n"); } #endif /* USB_DEBUG */ - if ((n_xpspans == 1) && (n_ypspans == 1)) + if (n_xpspans == 1 && n_ypspans == 1) /* The common case of a single pair of new pspans. */ atp_add_stroke(sc, &pspans_x[0], &pspans_y[0]); else @@ -1204,12 +1204,12 @@ atp_add_new_strokes(struct atp_softc *sc /* Take care to repeat at the multi-pspan. */ if (repeat_count > 0) { - if ((repeat_axis == X) && - (repeat_index == i)) { + if (repeat_axis == X && + repeat_index == i) { i--; /* counter loop increment */ repeat_count--; - } else if ((repeat_axis == Y) && - (repeat_index == j)) { + } else if (repeat_axis == Y && + repeat_index == j) { j--; /* counter loop increment */ repeat_count--; } @@ -1269,8 +1269,8 @@ atp_advance_stroke_state(struct atp_soft u_int i; for (i = 0; i < sc->sc_n_strokes; i++) { - if ((&sc->sc_strokes[i] == stroke) || - (sc->sc_strokes[i].type != ATP_STROKE_TOUCH)) + if (&sc->sc_strokes[i] == stroke || + sc->sc_strokes[i].type != ATP_STROKE_TOUCH) continue; if (timevalcmp(&sc->sc_strokes[i].ctime, @@ -1312,8 +1312,8 @@ atp_convert_to_slide(struct atp_softc *s stroke->type = ATP_STROKE_SLIDE; /* Are we at the beginning of a double-click-n-drag? */ - if ((sc->sc_n_strokes == 1) && - ((sc->sc_state & ATP_ZOMBIES_EXIST) == 0) && + if (sc->sc_n_strokes == 1 && + (sc->sc_state & ATP_ZOMBIES_EXIST) == 0 && timevalcmp(&stroke->ctime, &sc->sc_reap_time, >)) { struct timeval delta; struct timeval window = { @@ -1343,8 +1343,8 @@ atp_terminate_stroke(struct atp_softc *s if (s->flags & ATSF_ZOMBIE) return; - if ((s->type == ATP_STROKE_TOUCH) && - (s->age > atp_stroke_maturity_threshold)) { + if (s->type == ATP_STROKE_TOUCH && + s->age > atp_stroke_maturity_threshold) { s->flags |= ATSF_ZOMBIE; /* If no zombies exist, then prepare to reap zombies later. */ @@ -1453,7 +1453,7 @@ atp_compute_smoothening_scale_ratio(atp_ vel_squared = dxdt * dxdt + dydt * dydt; vel_squared_smooth = (3 * stroke->velocity_squared + vel_squared) >> 2; stroke->velocity_squared = vel_squared_smooth; /* retained as history */ - if ((vel_squared == 0) || (vel_squared_smooth == 0)) + if (vel_squared == 0 || vel_squared_smooth == 0) return; /* returning (numerator == 0) will imply zero movement*/ /* @@ -1465,7 +1465,7 @@ atp_compute_smoothening_scale_ratio(atp_ */ /* Keep within the bounds of the square-root table. */ - while ((vel_squared > N) || (vel_squared_smooth > N)) { + while (vel_squared > N || vel_squared_smooth > N) { /* Dividing uniformly by 2 won't disturb the final ratio. */ vel_squared >>= 1; vel_squared_smooth >>= 1; @@ -1502,7 +1502,7 @@ atp_compute_stroke_movement(atp_stroke * /* Get the scale ratio and smoothen movement. */ atp_compute_smoothening_scale_ratio(stroke, &num, &denom); - if ((num == 0) || (denom == 0)) { + if (num == 0 || denom == 0) { stroke->components[X].movement = 0; stroke->components[Y].movement = 0; stroke->velocity_squared >>= 1; /* Erode velocity_squared. */ @@ -1630,8 +1630,8 @@ atp_probe(device_t self) if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); - if ((uaa->info.bInterfaceClass != UICLASS_HID) || - (uaa->info.bInterfaceProtocol != UIPROTO_MOUSE)) + if (uaa->info.bInterfaceClass != UICLASS_HID || + uaa->info.bInterfaceProtocol != UIPROTO_MOUSE) return (ENXIO); return (usbd_lookup_id_by_uaa(atp_devs, sizeof(atp_devs), uaa)); @@ -1840,13 +1840,13 @@ atp_intr(struct usb_xfer *xfer, usb_erro DPRINTFN(ATP_LLEVEL_INFO, "button %s\n", ((sc->sc_status.button & MOUSE_BUTTON1DOWN) ? "pressed" : "released")); - } else if ((sc->sc_status.obutton == 0) && - (sc->sc_status.button == 0) && - (tap_fingers != 0)) { + } else if (sc->sc_status.obutton == 0 && + sc->sc_status.button == 0 && + tap_fingers != 0) { /* Ignore single-finger taps at the edges. */ - if ((tap_fingers == 1) && - ((reaped_xlocs[0] <= sc->sc_left_margin) || - (reaped_xlocs[0] > sc->sc_right_margin))) + if (tap_fingers == 1 && + (reaped_xlocs[0] <= sc->sc_left_margin || + reaped_xlocs[0] > sc->sc_right_margin)) tap_fingers = 0; DPRINTFN(ATP_LLEVEL_INFO, "tap_fingers: %u\n", tap_fingers); @@ -1861,8 +1861,8 @@ atp_intr(struct usb_xfer *xfer, usb_erro for (u_int i = 0; i < sc->sc_n_strokes; i++) { atp_stroke *stroke = &sc->sc_strokes[i]; - if ((stroke->components[X].movement) || - (stroke->components[Y].movement)) { + if (stroke->components[X].movement || + stroke->components[Y].movement) { dx += stroke->components[X].movement; dy += stroke->components[Y].movement; n_movements++; @@ -1901,9 +1901,9 @@ atp_intr(struct usb_xfer *xfer, usb_erro * remained idle beyond a threshold, we reinitialize * it to silence the interrupts. */ - if ((sc->sc_status.flags == 0) && - (sc->sc_n_strokes == 0) && - (sc->sc_status.button == 0)) { + if (sc->sc_status.flags == 0 && + sc->sc_n_strokes == 0 && + sc->sc_status.button == 0) { sc->sc_idlecount++; if (sc->sc_idlecount >= ATP_IDLENESS_THRESHOLD) { DPRINTFN(ATP_LLEVEL_INFO, "idle\n"); @@ -2008,7 +2008,7 @@ atp_start_read(struct usb_fifo *fifo) if (rate > 1000) rate = 1000; /* Check for set rate */ - if ((rate > 0) && (sc->sc_xfer[ATP_INTR_DT] != NULL)) { + if (rate > 0 && sc->sc_xfer[ATP_INTR_DT] != NULL) { /* Stop current transfer, if any */ usbd_transfer_stop(sc->sc_xfer[ATP_INTR_DT]); /* Set new interval */ @@ -2089,7 +2089,7 @@ atp_ioctl(struct usb_fifo *fifo, u_long if (mode.level == -1) /* Don't change the current setting */ ; - else if ((mode.level < 0) || (mode.level > 1)) { + else if (mode.level < 0 || mode.level > 1) { error = EINVAL; goto done; } Modified: user/weongyo/usb/sys/dev/usb/input/uep.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/uep.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/input/uep.c Sun Oct 3 23:40:54 2010 (r213392) @@ -296,13 +296,13 @@ uep_probe(device_t dev) if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); - if ((uaa->info.idVendor == USB_VENDOR_EGALAX) && - ((uaa->info.idProduct == USB_PRODUCT_EGALAX_TPANEL) || - (uaa->info.idProduct == USB_PRODUCT_EGALAX_TPANEL2))) + if (uaa->info.idVendor == USB_VENDOR_EGALAX && + (uaa->info.idProduct == USB_PRODUCT_EGALAX_TPANEL || + uaa->info.idProduct == USB_PRODUCT_EGALAX_TPANEL2)) return (BUS_PROBE_SPECIFIC); - if ((uaa->info.idVendor == USB_VENDOR_EGALAX2) && - (uaa->info.idProduct == USB_PRODUCT_EGALAX2_TPANEL)) + if (uaa->info.idVendor == USB_VENDOR_EGALAX2 && + uaa->info.idProduct == USB_PRODUCT_EGALAX2_TPANEL) return (BUS_PROBE_SPECIFIC); return (ENXIO); Modified: user/weongyo/usb/sys/dev/usb/input/uhid.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/uhid.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/input/uhid.c Sun Oct 3 23:40:54 2010 (r213392) @@ -171,8 +171,8 @@ uhid_intr_callback(struct usb_xfer *xfer * If the ID byte is non zero we allow descriptors * having multiple sizes: */ - if ((actlen >= sc->sc_isize) || - ((actlen > 0) && (sc->sc_iid != 0))) { + if (actlen >= sc->sc_isize || + (actlen > 0 && sc->sc_iid != 0)) { /* limit report length to the maximum */ if (actlen > sc->sc_isize) actlen = sc->sc_isize; @@ -594,9 +594,9 @@ uhid_probe(device_t dev) } if (uaa->info.bInterfaceClass != UICLASS_HID) { /* the Xbox 360 gamepad doesn't use the HID class */ - if ((uaa->info.bInterfaceClass != UICLASS_VENDOR) || - (uaa->info.bInterfaceSubClass != UISUBCLASS_XBOX360_CONTROLLER) || - (uaa->info.bInterfaceProtocol != UIPROTO_XBOX360_GAMEPAD)) + if (uaa->info.bInterfaceClass != UICLASS_VENDOR || + uaa->info.bInterfaceSubClass != UISUBCLASS_XBOX360_CONTROLLER || + uaa->info.bInterfaceProtocol != UIPROTO_XBOX360_GAMEPAD) return (ENXIO); } if (usb_test_quirk(uaa, UQ_HID_IGNORE)) @@ -656,9 +656,9 @@ uhid_attach(device_t dev) sc->sc_repdesc_ptr = &uhid_graphire3_4x5_report_descr; sc->sc_flags |= UHID_FLAG_STATIC_DESC; } - } else if ((uaa->info.bInterfaceClass == UICLASS_VENDOR) && - (uaa->info.bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER) && - (uaa->info.bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD)) { + } else if (uaa->info.bInterfaceClass == UICLASS_VENDOR && + uaa->info.bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER && + uaa->info.bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD) { /* the Xbox 360 gamepad has no report descriptor */ sc->sc_repdesc_size = sizeof(uhid_xb360gp_report_descr); sc->sc_repdesc_ptr = &uhid_xb360gp_report_descr; Modified: user/weongyo/usb/sys/dev/usb/input/ukbd.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ukbd.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/input/ukbd.c Sun Oct 3 23:40:54 2010 (r213392) @@ -744,8 +744,8 @@ ukbd_probe(device_t dev) if (uaa->info.bInterfaceClass != UICLASS_HID) return (ENXIO); - if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) && - (uaa->info.bInterfaceProtocol == UIPROTO_BOOT_KEYBOARD)) { + if (uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT && + uaa->info.bInterfaceProtocol == UIPROTO_BOOT_KEYBOARD) { if (usb_test_quirk(uaa, UQ_KBD_IGNORE)) return (ENXIO); else @@ -1140,8 +1140,7 @@ ukbd_check_char(keyboard_t *kbd) if (ukbd_polls_other_thread(sc)) return (0); - if ((sc->sc_composed_char > 0) && - (!(sc->sc_flags & UKBD_FLAG_COMPOSE))) + if (sc->sc_composed_char > 0 && !(sc->sc_flags & UKBD_FLAG_COMPOSE)) return (1); return (ukbd_check(kbd)); } @@ -1251,8 +1250,8 @@ ukbd_read_char(keyboard_t *kbd, int wait next_code: /* do we have a composed char to return ? */ - if ((sc->sc_composed_char > 0) && - (!(sc->sc_flags & UKBD_FLAG_COMPOSE))) { + if (sc->sc_composed_char > 0 && + !(sc->sc_flags & UKBD_FLAG_COMPOSE)) { action = sc->sc_composed_char; sc->sc_composed_char = 0; @@ -1604,7 +1603,7 @@ ukbd_is_polling(struct ukbd_softc *sc) return (1); /* polling */ delta = ticks - sc->sc_poll_tick_last; - if ((delta < 0) || (delta >= hz)) { + if (delta < 0 || delta >= hz) { sc->sc_poll_detected = 0; return (0); /* not polling */ } @@ -1729,10 +1728,10 @@ ukbd_key2scan(struct ukbd_softc *sc, int 0x5c, /* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */ }; - if ((code >= 89) && (code < (89 + (sizeof(scan) / sizeof(scan[0]))))) + if (code >= 89 && code < (89 + (sizeof(scan) / sizeof(scan[0])))) code = scan[code - 89]; /* Pause/Break */ - if ((code == 104) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R)))) + if (code == 104 && !(shift & (MOD_CONTROL_L | MOD_CONTROL_R))) code = (0x45 | SCAN_PREFIX_E1 | SCAN_PREFIX_CTL); if (shift & (MOD_SHIFT_L | MOD_SHIFT_R)) code &= ~SCAN_PREFIX_SHIFT; Modified: user/weongyo/usb/sys/dev/usb/input/ums.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ums.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/input/ums.c Sun Oct 3 23:40:54 2010 (r213392) @@ -229,26 +229,26 @@ ums_intr_callback(struct usb_xfer *xfer, } else { id = 0; if (sc->sc_info[0].sc_flags & UMS_FLAG_SBU) { - if ((*buf == 0x14) || (*buf == 0x15)) + if (*buf == 0x14 || *buf == 0x15) goto tr_setup; } } repeat: - if ((info->sc_flags & UMS_FLAG_W_AXIS) && - (id == info->sc_iid_w)) + if (info->sc_flags & UMS_FLAG_W_AXIS && + id == info->sc_iid_w) dw += hid_get_data(buf, len, &info->sc_loc_w); - if ((info->sc_flags & UMS_FLAG_X_AXIS) && - (id == info->sc_iid_x)) + if (info->sc_flags & UMS_FLAG_X_AXIS && + id == info->sc_iid_x) dx += hid_get_data(buf, len, &info->sc_loc_x); - if ((info->sc_flags & UMS_FLAG_Y_AXIS) && - (id == info->sc_iid_y)) + if (info->sc_flags & UMS_FLAG_Y_AXIS && + id == info->sc_iid_y) dy = -hid_get_data(buf, len, &info->sc_loc_y); - if ((info->sc_flags & UMS_FLAG_Z_AXIS) && - (id == info->sc_iid_z)) { + if (info->sc_flags & UMS_FLAG_Z_AXIS && + id == info->sc_iid_z) { int32_t temp; temp = hid_get_data(buf, len, &info->sc_loc_z); if (info->sc_flags & UMS_FLAG_REVZ) @@ -256,8 +256,8 @@ ums_intr_callback(struct usb_xfer *xfer, dz -= temp; } - if ((info->sc_flags & UMS_FLAG_T_AXIS) && - (id == info->sc_iid_t)) + if (info->sc_flags & UMS_FLAG_T_AXIS && + id == info->sc_iid_t) dt -= hid_get_data(buf, len, &info->sc_loc_t); for (i = 0; i < info->sc_buttons; i++) { @@ -367,8 +367,8 @@ ums_probe(device_t dev) if (uaa->info.bInterfaceClass != UICLASS_HID) return (ENXIO); - if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) && - (uaa->info.bInterfaceProtocol == UIPROTO_MOUSE)) + if (uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT && + uaa->info.bInterfaceProtocol == UIPROTO_MOUSE) return (BUS_PROBE_GENERIC); error = usbd_req_get_hid_desc(uaa->device, NULL, @@ -684,7 +684,7 @@ ums_start_read(struct usb_fifo *fifo) if (rate > 1000) rate = 1000; /* Check for set rate */ - if ((rate > 0) && (sc->sc_xfer[UMS_INTR_DT] != NULL)) { + if (rate > 0 && sc->sc_xfer[UMS_INTR_DT] != NULL) { DPRINTF("Setting pollrate = %d\n", rate); /* Stop current transfer, if any */ usbd_transfer_stop(sc->sc_xfer[UMS_INTR_DT]); @@ -816,7 +816,7 @@ ums_ioctl(struct usb_fifo *fifo, u_long if (mode.level == -1) ; /* don't change the current setting */ - else if ((mode.level < 0) || (mode.level > 1)) { + else if (mode.level < 0 || mode.level > 1) { error = EINVAL; goto done; } else Modified: user/weongyo/usb/sys/dev/usb/misc/udbp.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/misc/udbp.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/misc/udbp.c Sun Oct 3 23:40:54 2010 (r213392) @@ -300,21 +300,21 @@ udbp_probe(device_t dev) * compare the revision id in the device descriptor with 0x101 Or go * search the file usbdevs.h. Maybe the device is already in there. */ - if (((uaa->info.idVendor == USB_VENDOR_NETCHIP) && - (uaa->info.idProduct == USB_PRODUCT_NETCHIP_TURBOCONNECT))) + if (uaa->info.idVendor == USB_VENDOR_NETCHIP && + uaa->info.idProduct == USB_PRODUCT_NETCHIP_TURBOCONNECT) return (0); - if (((uaa->info.idVendor == USB_VENDOR_PROLIFIC) && - ((uaa->info.idProduct == USB_PRODUCT_PROLIFIC_PL2301) || - (uaa->info.idProduct == USB_PRODUCT_PROLIFIC_PL2302)))) + if (uaa->info.idVendor == USB_VENDOR_PROLIFIC && + (uaa->info.idProduct == USB_PRODUCT_PROLIFIC_PL2301 || + uaa->info.idProduct == USB_PRODUCT_PROLIFIC_PL2302)) return (0); - if ((uaa->info.idVendor == USB_VENDOR_ANCHOR) && - (uaa->info.idProduct == USB_PRODUCT_ANCHOR_EZLINK)) + if (uaa->info.idVendor == USB_VENDOR_ANCHOR && + uaa->info.idProduct == USB_PRODUCT_ANCHOR_EZLINK) return (0); - if ((uaa->info.idVendor == USB_VENDOR_GENESYS) && - (uaa->info.idProduct == USB_PRODUCT_GENESYS_GL620USB)) + if (uaa->info.idVendor == USB_VENDOR_GENESYS && + uaa->info.idProduct == USB_PRODUCT_GENESYS_GL620USB) return (0); return (ENXIO); @@ -479,8 +479,7 @@ udbp_bulk_read_complete(node_p node, hoo if (m) { sc->sc_bulk_in_buffer = NULL; - if ((sc->sc_hook == NULL) || - NG_HOOK_NOT_VALID(sc->sc_hook)) { + if (sc->sc_hook == NULL || NG_HOOK_NOT_VALID(sc->sc_hook)) { DPRINTF("No upstream hook\n"); goto done; } @@ -832,8 +831,8 @@ ng_udbp_disconnect(hook_p hook) mtx_unlock(&sc->sc_mtx); } - if ((NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0) - && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook)))) + if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0 && + NG_NODE_IS_VALID(NG_HOOK_NODE(hook))) ng_rmnode_self(NG_HOOK_NODE(hook)); return (error); Modified: user/weongyo/usb/sys/dev/usb/misc/ufm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/misc/ufm.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/misc/ufm.c Sun Oct 3 23:40:54 2010 (r213392) @@ -126,8 +126,8 @@ ufm_probe(device_t dev) if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); - if ((uaa->info.idVendor == USB_VENDOR_CYPRESS) && - (uaa->info.idProduct == USB_PRODUCT_CYPRESS_FMRADIO)) + if (uaa->info.idVendor == USB_VENDOR_CYPRESS && + uaa->info.idProduct == USB_PRODUCT_CYPRESS_FMRADIO) return (0); return (ENXIO); } Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdce.c Sun Oct 3 22:24:14 2010 (r213391) +++ user/weongyo/usb/sys/dev/usb/net/if_cdce.c Sun Oct 3 23:40:54 2010 (r213392) @@ -451,7 +451,7 @@ cdce_attach(device_t dev) (uaa->device, NULL, uaa->info.bIfaceIndex, UDESC_CS_INTERFACE, 0 - 1, UDESCSUB_CDC_UNION, 0 - 1); - if ((ud == NULL) || (ud->bLength < sizeof(*ud)) || + if (ud == NULL || ud->bLength < sizeof(*ud) || (sc->sc_flags & CDCE_FLAG_NO_UNION)) { DPRINTFN(1, "No union descriptor!\n"); sc->sc_ifaces_index[0] = uaa->info.bIfaceIndex; @@ -512,7 +512,7 @@ alloc_transfers: if (error) break; #if CDCE_HAVE_NCM - if ((i == 0) && (cdce_ncm_init(sc) == 0)) + if (i == 0 && cdce_ncm_init(sc) == 0) pcfg = cdce_ncm_config; #endif error = usbd_transfer_setup(uaa->device, @@ -533,7 +533,7 @@ alloc_transfers: (uaa->device, NULL, uaa->info.bIfaceIndex, UDESC_CS_INTERFACE, 0 - 1, UDESCSUB_CDC_ENF, 0 - 1); - if ((ued == NULL) || (ued->bLength < sizeof(*ued))) + if (ued == NULL || ued->bLength < sizeof(*ued)) error = USB_ERR_INVAL; else { error = usbd_req_get_string_any(uaa->device, NULL, @@ -1151,10 +1151,10 @@ cdce_ncm_bulk_read_callback(struct usb_x usbd_copy_out(pc, 0, &(sc->sc_ncm.hdr), sizeof(sc->sc_ncm.hdr)); - if ((sc->sc_ncm.hdr.dwSignature[0] != 'N') || - (sc->sc_ncm.hdr.dwSignature[1] != 'C') || - (sc->sc_ncm.hdr.dwSignature[2] != 'M') || - (sc->sc_ncm.hdr.dwSignature[3] != 'H')) { + if (sc->sc_ncm.hdr.dwSignature[0] != 'N' || + sc->sc_ncm.hdr.dwSignature[1] != 'C' || + sc->sc_ncm.hdr.dwSignature[2] != 'M' || + sc->sc_ncm.hdr.dwSignature[3] != 'H') { DPRINTFN(1, "invalid HDR signature: " "0x%02x:0x%02x:0x%02x:0x%02x\n", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Oct 4 02:40:20 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4E10106564A; Mon, 4 Oct 2010 02:40:20 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A48678FC0A; Mon, 4 Oct 2010 02:40:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o942eKkd097615; Mon, 4 Oct 2010 02:40:20 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o942eKJf097613; Mon, 4 Oct 2010 02:40:20 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010040240.o942eKJf097613@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 4 Oct 2010 02:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213396 - user/weongyo/usb/sys/dev/usb/controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2010 02:40:20 -0000 Author: weongyo Date: Mon Oct 4 02:40:20 2010 New Revision: 213396 URL: http://svn.freebsd.org/changeset/base/213396 Log: Only prints a message if `stop' is 0 that it didn't check `stop' variable. Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Mon Oct 4 01:08:31 2010 (r213395) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Mon Oct 4 02:40:20 2010 (r213396) @@ -829,7 +829,7 @@ ehci_dump_sqtds(ehci_softc_t *sc, ehci_q stop = 0; for (i = 0; sqtd && (i < 20) && !stop; sqtd = sqtd->obj_next, i++) stop = ehci_dump_sqtd(sc, sqtd); - if (sqtd) + if (sqtd != NULL && stop == 0) printf("dump aborted, too many TDs\n"); } From owner-svn-src-user@FreeBSD.ORG Mon Oct 4 05:56:30 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54113106566B; Mon, 4 Oct 2010 05:56:30 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41F3F8FC13; Mon, 4 Oct 2010 05:56:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o945uUlv001947; Mon, 4 Oct 2010 05:56:30 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o945uT9R001917; Mon, 4 Oct 2010 05:56:29 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010040556.o945uT9R001917@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 4 Oct 2010 05:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213397 - in user/weongyo/usb/sys/dev/usb: . controller input net serial storage template wlan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2010 05:56:30 -0000 Author: weongyo Date: Mon Oct 4 05:56:29 2010 New Revision: 213397 URL: http://svn.freebsd.org/changeset/base/213397 Log: Removes unnecessary spaces. Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c user/weongyo/usb/sys/dev/usb/controller/atmegadci.c user/weongyo/usb/sys/dev/usb/controller/avr32dci.c user/weongyo/usb/sys/dev/usb/controller/ehci.c user/weongyo/usb/sys/dev/usb/controller/musb_otg.c user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/uhci.c user/weongyo/usb/sys/dev/usb/controller/uss820dci.c user/weongyo/usb/sys/dev/usb/input/atp.c user/weongyo/usb/sys/dev/usb/input/uhid.c user/weongyo/usb/sys/dev/usb/input/ukbd.c user/weongyo/usb/sys/dev/usb/input/ums.c user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_cdce.c user/weongyo/usb/sys/dev/usb/net/uhso.c user/weongyo/usb/sys/dev/usb/serial/ubser.c user/weongyo/usb/sys/dev/usb/serial/ucycom.c user/weongyo/usb/sys/dev/usb/storage/umass.c user/weongyo/usb/sys/dev/usb/template/usb_template.c user/weongyo/usb/sys/dev/usb/usb_busdma.c user/weongyo/usb/sys/dev/usb/usb_compat_linux.c user/weongyo/usb/sys/dev/usb/usb_dev.c user/weongyo/usb/sys/dev/usb/usb_generic.c user/weongyo/usb/sys/dev/usb/usb_hub.c user/weongyo/usb/sys/dev/usb/usb_msctest.c user/weongyo/usb/sys/dev/usb/usb_transfer.c user/weongyo/usb/sys/dev/usb/wlan/if_rum.c user/weongyo/usb/sys/dev/usb/wlan/if_run.c user/weongyo/usb/sys/dev/usb/wlan/if_ural.c Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/at91dci.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci.c Mon Oct 4 05:56:29 2010 (r213397) @@ -926,7 +926,6 @@ at91dci_setup_standard_chain(struct usb_ if (temp.len == 0) { /* make sure that we send an USB packet */ temp.short_pkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -1104,7 +1103,6 @@ at91dci_standard_done_sub(struct usb_xfe /* this USB frame is complete */ error = 0; break; - } while (0); /* update transfer cache */ @@ -2103,16 +2101,12 @@ at91dci_xfer_setup(struct usb_setup_para if (parm->methods == &at91dci_device_ctrl_methods) { ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; - } else if (parm->methods == &at91dci_device_bulk_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else if (parm->methods == &at91dci_device_intr_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else if (parm->methods == &at91dci_device_isoc_fs_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else ntd = 0; Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Mon Oct 4 05:56:29 2010 (r213397) @@ -839,7 +839,6 @@ atmegadci_setup_standard_chain(struct us if (temp.len == 0) { /* make sure that we send an USB packet */ temp.short_pkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -997,7 +996,6 @@ atmegadci_standard_done_sub(struct usb_x /* this USB frame is complete */ error = 0; break; - } while (0); /* update transfer cache */ Modified: user/weongyo/usb/sys/dev/usb/controller/avr32dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Mon Oct 4 05:56:29 2010 (r213397) @@ -810,7 +810,6 @@ avr32dci_setup_standard_chain(struct usb if (temp.len == 0) { /* make sure that we send an USB packet */ temp.short_pkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -971,7 +970,6 @@ avr32dci_standard_done_sub(struct usb_xf /* this USB frame is complete */ error = 0; break; - } while (0); /* update transfer cache */ Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1612,7 +1612,6 @@ restart: /* send a Zero Length Packet, ZLP, last */ temp->shortpkt = 1; average = 0; - } else { average = temp->average; @@ -1655,7 +1654,6 @@ restart: td->qtd_buffer[1] = 0; td->qtd_buffer_hi[1] = 0; - } else { uint8_t x; @@ -1857,7 +1855,6 @@ ehci_setup_standard_chain(struct usb_xfe if (temp.len == 0) { /* make sure that we send an USB packet */ temp.shortpkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -3434,7 +3431,6 @@ ehci_xfer_setup(struct usb_setup_params nqh = 1; nqtd = ((2 * xfer->nframes) + 1 /* STATUS */ + (xfer->max_data_length / xfer->max_hc_frame_size)); - } else if (parm->methods == &ehci_device_bulk_methods) { parm->hc_max_packet_size = 0x400; parm->hc_max_packet_count = 1; @@ -3446,7 +3442,6 @@ ehci_xfer_setup(struct usb_setup_params nqh = 1; nqtd = ((2 * xfer->nframes) + (xfer->max_data_length / xfer->max_hc_frame_size)); - } else if (parm->methods == &ehci_device_intr_methods) { if (parm->speed == USB_SPEED_HIGH) { parm->hc_max_packet_size = 0x400; @@ -3467,7 +3462,6 @@ ehci_xfer_setup(struct usb_setup_params nqh = 1; nqtd = ((2 * xfer->nframes) + (xfer->max_data_length / xfer->max_hc_frame_size)); - } else if (parm->methods == &ehci_device_isoc_fs_methods) { parm->hc_max_packet_size = 0x3FF; parm->hc_max_packet_count = 1; @@ -3477,7 +3471,6 @@ ehci_xfer_setup(struct usb_setup_params usbd_transfer_setup_sub(parm); nsitd = xfer->nframes; - } else if (parm->methods == &ehci_device_isoc_hs_methods) { parm->hc_max_packet_size = 0x400; parm->hc_max_packet_count = 3; @@ -3488,7 +3481,6 @@ ehci_xfer_setup(struct usb_setup_params nitd = ((xfer->nframes + 7) / 8) << usbd_xfer_get_fps_shift(xfer); - } else { parm->hc_max_packet_size = 0x400; parm->hc_max_packet_count = 1; Modified: user/weongyo/usb/sys/dev/usb/controller/musb_otg.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1161,7 +1161,6 @@ musbotg_setup_standard_chain(struct usb_ if (temp.len == 0) { /* make sure that we send an USB packet */ temp.short_pkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -1244,7 +1243,6 @@ musbotg_ep_int_set(struct usb_xfer *xfer else temp &= ~MUSB2_MASK_EPINT(ep_no); MUSB2_WRITE_2(sc, MUSB2_REG_INTRXE, temp); - } else { temp = MUSB2_READ_2(sc, MUSB2_REG_INTTXE); if (on) @@ -1345,7 +1343,6 @@ musbotg_standard_done_sub(struct usb_xfe /* this USB frame is complete */ error = 0; break; - } while (0); /* update transfer cache */ @@ -2566,16 +2563,12 @@ musbotg_xfer_setup(struct usb_setup_para */ if (parm->methods == &musbotg_device_ctrl_methods) { ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ; - } else if (parm->methods == &musbotg_device_bulk_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else if (parm->methods == &musbotg_device_intr_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else if (parm->methods == &musbotg_device_isoc_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else ntd = 0; Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1281,7 +1281,6 @@ restart: /* send a Zero Length Packet, ZLP, last */ temp->shortpkt = 1; average = 0; - } else { average = temp->average; @@ -1319,7 +1318,6 @@ restart: td->td_cbp = 0; td->td_be = 0; td->len = 0; - } else { usbd_get_page(temp->pc, buf_offset, &buf_res); td->td_cbp = htole32(buf_res.physaddr); @@ -1473,7 +1471,6 @@ ohci_setup_standard_chain(struct usb_xfe if (temp.len == 0) { /* make sure that we send an USB packet */ temp.shortpkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -2368,7 +2365,6 @@ ohci_xfer_setup(struct usb_setup_params ntd = ((2 * xfer->nframes) + 1 /* STATUS */ + (xfer->max_data_length / xfer->max_hc_frame_size)); nqh = 1; - } else if (parm->methods == &ohci_device_bulk_methods) { xfer->status |= XFER_STATUS_DMAENABLE; @@ -2378,7 +2374,6 @@ ohci_xfer_setup(struct usb_setup_params ntd = ((2 * xfer->nframes) + (xfer->max_data_length / xfer->max_hc_frame_size)); nqh = 1; - } else if (parm->methods == &ohci_device_intr_methods) { xfer->status |= XFER_STATUS_DMAENABLE; @@ -2388,7 +2383,6 @@ ohci_xfer_setup(struct usb_setup_params ntd = ((2 * xfer->nframes) + (xfer->max_data_length / xfer->max_hc_frame_size)); nqh = 1; - } else if (parm->methods == &ohci_device_isoc_methods) { xfer->status |= XFER_STATUS_DMAENABLE; @@ -2399,7 +2393,6 @@ ohci_xfer_setup(struct usb_setup_params 1 /* EXTRA */ ); ntd = 0; nqh = 1; - } else { usbd_transfer_setup_sub(parm); Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Mon Oct 4 05:56:29 2010 (r213397) @@ -238,7 +238,6 @@ uhci_mem_layout_fixup(struct uhci_mem_la htole32(UHCI_TD_PID_IN)) { td->fix_pc = ml->fix_pc; usb_pc_cpu_invalidate(ml->fix_pc); - } else { td->fix_pc = NULL; @@ -251,7 +250,6 @@ uhci_mem_layout_fixup(struct uhci_mem_la /* prepare next fixup */ ml->fix_pc++; - } else { td->td_buffer = htole32(ml->buf_res.physaddr); td->fix_pc = NULL; @@ -1076,7 +1074,6 @@ uhci_non_isoc_done_sub(struct usb_xfer * DPRINTF("Invalid status length, " "0x%04x/0x%04x bytes\n", len, td->len); status |= UHCI_TD_STALLED; - } else if ((xfer->aframes != xfer->nframes) && (len > 0)) { if (td->fix_pc) { usbd_get_page(td->fix_pc, 0, &res); @@ -1504,7 +1501,6 @@ restart: temp->shortpkt = 1; temp->td_token |= htole32(UHCI_TD_SET_MAXLEN(0)); average = 0; - } else { average = temp->average; @@ -1540,7 +1536,6 @@ restart: td->len = 0; td->td_buffer = 0; td->fix_pc = NULL; - } else { /* update remaining length */ temp->len -= average; @@ -1688,7 +1683,6 @@ uhci_setup_standard_chain(struct usb_xfe if (temp.len == 0) { /* make sure that we send an USB packet */ temp.shortpkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -2137,11 +2131,9 @@ uhci_device_isoc_enter(struct usb_xfer * */ td->td_buffer = 0; td->fix_pc = NULL; - } else { /* fill out buffer pointer and do fixup, if any */ uhci_mem_layout_fixup(&ml, td); - } /* update status */ @@ -2622,7 +2614,6 @@ uhci_roothub_exec(struct usb_device *ude usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 500); sc->sc_isresumed |= (1 << index); - } else if (x & UHCI_PORTSC_SUSP) status |= UPS_SUSPEND; status |= UPS_PORT_POWER; @@ -2752,7 +2743,6 @@ uhci_xfer_setup(struct usb_setup_params nqh = 1; ntd = ((2 * xfer->nframes) + 1 /* STATUS */ + (xfer->max_data_length / xfer->max_frame_size)); - } else if (parm->methods == &uhci_device_bulk_methods) { xfer->status |= XFER_STATUS_DMAENABLE; xfer->status |= XFER_STATUS_DMA_NOPOSTSYNC; @@ -2762,7 +2752,6 @@ uhci_xfer_setup(struct usb_setup_params nqh = 1; ntd = ((2 * xfer->nframes) + (xfer->max_data_length / xfer->max_frame_size)); - } else if (parm->methods == &uhci_device_intr_methods) { xfer->status |= XFER_STATUS_DMAENABLE; xfer->status |= XFER_STATUS_DMA_NOPOSTSYNC; @@ -2772,7 +2761,6 @@ uhci_xfer_setup(struct usb_setup_params nqh = 1; ntd = ((2 * xfer->nframes) + (xfer->max_data_length / xfer->max_frame_size)); - } else if (parm->methods == &uhci_device_isoc_methods) { xfer->status |= XFER_STATUS_DMAENABLE; xfer->status |= XFER_STATUS_DMA_NOPOSTSYNC; @@ -2781,7 +2769,6 @@ uhci_xfer_setup(struct usb_setup_params nqh = 0; ntd = xfer->nframes; - } else { usbd_transfer_setup_sub(parm); Modified: user/weongyo/usb/sys/dev/usb/controller/uss820dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Mon Oct 4 05:56:29 2010 (r213397) @@ -894,7 +894,6 @@ uss820dci_setup_standard_chain(struct us if (temp.len == 0) { /* make sure that we send an USB packet */ temp.short_pkt = 0; - } else { /* regular data transfer */ if ((xfer->flags & USBD_FORCE_SHORT_XFER) != 0) @@ -1092,7 +1091,6 @@ uss820dci_standard_done_sub(struct usb_x /* this USB frame is complete */ error = 0; break; - } while (0); /* update transfer cache */ @@ -2147,16 +2145,12 @@ uss820dci_xfer_setup(struct usb_setup_pa */ if (parm->methods == &uss820dci_device_ctrl_methods) { ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ; - } else if (parm->methods == &uss820dci_device_bulk_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else if (parm->methods == &uss820dci_device_intr_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else if (parm->methods == &uss820dci_device_isoc_fs_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else ntd = 0; Modified: user/weongyo/usb/sys/dev/usb/input/atp.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/atp.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/input/atp.c Mon Oct 4 05:56:29 2010 (r213397) @@ -267,7 +267,6 @@ static const struct usb_device_id atp_de /* 17 inch PowerBook */ { USB_VPI(USB_VENDOR_APPLE, 0x020d, ATP_DEV_PARAMS_PBOOK_17) }, - }; /* Modified: user/weongyo/usb/sys/dev/usb/input/uhid.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/uhid.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/input/uhid.c Mon Oct 4 05:56:29 2010 (r213397) @@ -246,7 +246,6 @@ uhid_write_callback(struct usb_xfer *xfe if (actlen != 1) goto tr_error; usbd_copy_out(pc, 0, &id, 1); - } else return; if (size) @@ -635,7 +634,6 @@ uhid_attach(device_t dev) sc->sc_repdesc_size = sizeof(uhid_graphire_report_descr); sc->sc_repdesc_ptr = &uhid_graphire_report_descr; sc->sc_flags |= UHID_FLAG_STATIC_DESC; - } else if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE3_4X5) { static uint8_t reportbuf[] = {2, 2, 2}; Modified: user/weongyo/usb/sys/dev/usb/input/ukbd.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ukbd.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/input/ukbd.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1753,7 +1753,6 @@ ukbd_key2scan(struct ukbd_softc *sc, int return ((code & SCAN_PREFIX_E0) ? 0xe0 : 0xe1); } return (code); - } #endif /* UKBD_EMULATE_ATSCANCODE */ Modified: user/weongyo/usb/sys/dev/usb/input/ums.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ums.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/input/ums.c Mon Oct 4 05:56:29 2010 (r213397) @@ -225,7 +225,6 @@ ums_intr_callback(struct usb_xfer *xfer, len--; buf++; - } else { id = 0; if (sc->sc_info[0].sc_flags & UMS_FLAG_SBU) { @@ -569,7 +568,6 @@ ums_attach(device_t dev) /* Announce device */ device_printf(dev, "3 buttons and [XYZ] " "coordinates ID=0\n"); - } else { /* Search the HID descriptor and announce device */ for (i = 0; i < UMS_INFO_MAX; i++) @@ -750,7 +748,6 @@ ums_put_queue(struct ums_softc *sc, int3 } usb_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf, sc->sc_mode.packetsize, 1); - } else DPRINTF("Buffer full, discarded packet\n"); } Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Mon Oct 4 05:56:29 2010 (r213397) @@ -920,7 +920,6 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, m->m_pkthdr.len); usbd_m_copy_in(pc, 0, m, 0, m->m_pkthdr.len); - } else { usbd_xfer_set_frame_len(xfer, 0, (m->m_pkthdr.len + 2)); Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdce.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/net/if_cdce.c Mon Oct 4 05:56:29 2010 (r213397) @@ -546,7 +546,6 @@ alloc_transfers: sc->sc_eaddr[0] = 0x2a; memcpy(&sc->sc_eaddr[1], &ticks, sizeof(uint32_t)); sc->sc_eaddr[5] = device_get_unit(dev); - } else { bzero(sc->sc_eaddr, sizeof(sc->sc_eaddr)); Modified: user/weongyo/usb/sys/dev/usb/net/uhso.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/uhso.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/net/uhso.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1492,7 +1492,6 @@ uhso_ucom_start_write(struct ucom_softc &sc->sc_tty[ucom->sc_local_unit]); usbd_transfer_start( sc->sc_tty[ucom->sc_local_unit].ht_xfer[UHSO_CTRL_WRITE]); - } else if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_BULK) usbd_transfer_start(sc->sc_xfer[UHSO_BULK_ENDPT_WRITE]); Modified: user/weongyo/usb/sys/dev/usb/serial/ubser.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ubser.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/serial/ubser.c Mon Oct 4 05:56:29 2010 (r213397) @@ -403,7 +403,6 @@ tr_setup: break; } ubser_inc_tx_unit(sc); - } while (sc->sc_curr_tx_unit != first_unit); return; default: /* Error */ Modified: user/weongyo/usb/sys/dev/usb/serial/ucycom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ucycom.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/serial/ucycom.c Mon Oct 4 05:56:29 2010 (r213397) @@ -555,7 +555,6 @@ tr_setup: goto tr_setup; } return; - } } Modified: user/weongyo/usb/sys/dev/usb/storage/umass.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/storage/umass.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/storage/umass.c Mon Oct 4 05:56:29 2010 (r213397) @@ -965,7 +965,6 @@ umass_attach(device_t dev) /* skip reset first time */ sc->sc_last_xfer_index = UMASS_T_BBB_COMMAND; - } else if (sc->sc_proto & (UMASS_PROTO_CBI | UMASS_PROTO_CBI_I)) { err = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, umass_cbi_config, @@ -973,7 +972,6 @@ umass_attach(device_t dev) /* skip reset first time */ sc->sc_last_xfer_index = UMASS_T_CBI_COMMAND; - } else err = USB_ERR_INVAL; @@ -1295,7 +1293,6 @@ umass_t_bbb_command_callback(struct usb_ default: /* Error */ umass_tr_error(xfer, error); return; - } } @@ -1733,7 +1730,6 @@ tr_transferred: default: /* Error */ umass_tr_error(xfer, error); break; - } } Modified: user/weongyo/usb/sys/dev/usb/template/usb_template.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/template/usb_template.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/template/usb_template.c Mon Oct 4 05:56:29 2010 (r213397) @@ -740,7 +740,6 @@ handle_endpoint_desc: ed->bEndpointAddress = ep_curr->hw_endpoint_out; } - } else { /* compute the maximum frame size */ if (ep_curr->max_frame_size < wMaxPacketSize) @@ -825,7 +824,6 @@ usb_hw_ep_resolve(struct usb_device *ude } dd->bMaxPacketSize = mps; - } else { /* We only have one choice */ if (mps == 255) Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_busdma.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/usb_busdma.c Mon Oct 4 05:56:29 2010 (r213397) @@ -908,7 +908,6 @@ usb_bdma_work_loop(struct usb_xfer_queue pg += (xfer->frlengths[nframes] / USB_PAGE_SIZE); pg += 2; } - } if (info->dma_error) { USB_BUS_LOCK(info->bus); Modified: user/weongyo/usb/sys/dev/usb/usb_compat_linux.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_compat_linux.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/usb_compat_linux.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1557,7 +1557,6 @@ tr_setup: /* setup data transfer direction and length */ urb->bsd_isread = (ptr[0] & UT_READ) ? 1 : 0; urb->bsd_length_rem = ptr[6] | (ptr[7] << 8); - } else { /* setup data transfer direction */ Modified: user/weongyo/usb/sys/dev/usb/usb_dev.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_dev.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/usb_dev.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1395,7 +1395,6 @@ usb_write(struct cdev *dev, struct uio * f->flag_have_fragment = 1; USB_IF_PREPEND(&f->free_q, m); } - } while (uio->uio_resid > 0); done: mtx_unlock(f->priv_mtx); Modified: user/weongyo/usb/sys/dev/usb/usb_generic.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_generic.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/usb_generic.c Mon Oct 4 05:56:29 2010 (r213397) @@ -669,7 +669,6 @@ ugen_get_cdesc(struct usb_fifo *f, struc if (cdesc == NULL) return (ENXIO); free_data = 0; - } else { if (usbd_req_get_config_desc_full(udev, NULL, &cdesc, M_USBDEV, @@ -1072,7 +1071,6 @@ ugen_fs_copy_in(struct usb_fifo *f, uint isread = 0; n = 1; offset = sizeof(*req); - } else { /* Device and Host mode */ if (USB_GET_DATA_ISREAD(xfer)) Modified: user/weongyo/usb/sys/dev/usb/usb_hub.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_hub.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/usb_hub.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1403,7 +1403,6 @@ usbd_fs_isoc_schedule_isoc_time_expand(s usbd_fs_isoc_schedule_init_sub(fss_a); fss_a++; } - } else { *pp_start = NULL; *pp_end = NULL; @@ -2044,7 +2043,6 @@ repeat: temp = usbd_get_dma_delay(udev); if (temp != 0) usb_pause_mtx(NULL, USB_MS_TO_TICKS(temp)); - } /* suspend current port */ err = usbd_req_set_port_feature(udev->parent_hub, Modified: user/weongyo/usb/sys/dev/usb/usb_msctest.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_msctest.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/usb_msctest.c Mon Oct 4 05:56:29 2010 (r213397) @@ -391,7 +391,6 @@ bbb_data_write_callback(struct usb_xfer else bbb_transfer_start(sc, ST_DATA_WR_CS); return; - } } Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Mon Oct 4 05:56:29 2010 (r213397) @@ -480,12 +480,10 @@ usbd_transfer_setup_sub(struct usb_setup xfer->max_packet_count = 1; parm->bufsize = 0; /* automatic setup length */ usbd_update_max_frame_size(xfer); - } else { parm->err = USB_ERR_ZERO_MAXP; goto done; } - } else zmps = 0; @@ -1237,7 +1235,6 @@ usbd_setup_ctrl_transfer(struct usb_xfer } /* get data length */ len = xfer->sumlen; - } else { /* the size of the SETUP structure is hardcoded ! */ if (xfer->frlengths[0] != sizeof(struct usb_device_request)) { @@ -1956,7 +1953,6 @@ usbd_callback_ss_done_defer(struct usb_x pq->recurse_2 = 0; } return; - } /*------------------------------------------------------------------------* @@ -2653,12 +2649,10 @@ usb_command_wrapper(struct usb_xfer_queu DPRINTFN(6, "cb %p (enter)\n", pq->curr); (pq->command) (pq); DPRINTFN(6, "cb %p (leave)\n", pq->curr); - } while (!pq->recurse_2); /* clear first recurse flag */ pq->recurse_1 = 0; - } else { /* clear second recurse flag */ pq->recurse_2 = 0; Modified: user/weongyo/usb/sys/dev/usb/wlan/if_rum.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_rum.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/wlan/if_rum.c Mon Oct 4 05:56:29 2010 (r213397) @@ -2256,7 +2256,6 @@ rum_scan_start(struct ieee80211com *ic) rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); rum_set_bssid(sc, ifp->if_broadcastaddr); RUM_UNLOCK(sc); - } static void @@ -2268,7 +2267,6 @@ rum_scan_end(struct ieee80211com *ic) rum_enable_tsf_sync(sc); rum_set_bssid(sc, sc->sc_bssid); RUM_UNLOCK(sc); - } static void Modified: user/weongyo/usb/sys/dev/usb/wlan/if_run.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_run.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/wlan/if_run.c Mon Oct 4 05:56:29 2010 (r213397) @@ -2171,7 +2171,6 @@ run_key_delete(struct ieee80211vap *vap, k0->wk_pad = k->wk_pad; ieee80211_runtask(ic, &sc->cmdq_task); return (1); /* return fake success */ - } static void @@ -4279,7 +4278,6 @@ run_rt3070_rf_init(struct run_softc *sc) run_read(sc, RT3070_LDO_CFG0, &tmp); tmp = (tmp & ~0x0f000000) | 0x0d000000; run_write(sc, RT3070_LDO_CFG0, tmp); - } else if (sc->mac_ver == 0x3071) { run_rt3070_rf_read(sc, 6, &rf); run_rt3070_rf_write(sc, 6, rf | 0x40); @@ -4296,7 +4294,6 @@ run_rt3070_rf_init(struct run_softc *sc) /* patch LNA_PE_G1 */ run_read(sc, RT3070_GPIO_SWITCH, &tmp); run_write(sc, RT3070_GPIO_SWITCH, tmp & ~0x20); - } else if (sc->mac_ver == 0x3572) { run_rt3070_rf_read(sc, 6, &rf); run_rt3070_rf_write(sc, 6, rf | 0x40); @@ -4479,7 +4476,6 @@ run_rt3070_rf_setup(struct run_softc *sc run_rt3070_rf_read(sc, 16, &rf); rf = (rf & ~0x07) | sc->txmixgain_2ghz; run_rt3070_rf_write(sc, 16, rf); - } else if (sc->mac_ver == 0x3071) { /* enable DC filter */ if (sc->mac_rev >= 0x0201) @@ -4504,7 +4500,6 @@ run_rt3070_rf_setup(struct run_softc *sc sc->patch_dac ? 0x2c : 0x0f); } else run_write(sc, RT2860_TX_SW_CFG2, 0); - } else if (sc->mac_ver == 0x3070) { if (sc->mac_rev >= 0x0201) { /* enable DC filter */ Modified: user/weongyo/usb/sys/dev/usb/wlan/if_ural.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_ural.c Mon Oct 4 02:40:20 2010 (r213396) +++ user/weongyo/usb/sys/dev/usb/wlan/if_ural.c Mon Oct 4 05:56:29 2010 (r213397) @@ -1597,7 +1597,6 @@ ural_scan_end(struct ieee80211com *ic) ural_enable_tsf_sync(sc); ural_set_bssid(sc, sc->sc_bssid); RAL_UNLOCK(sc); - } static void From owner-svn-src-user@FreeBSD.ORG Tue Oct 5 23:27:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59A63106564A; Tue, 5 Oct 2010 23:27:06 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48CAA8FC15; Tue, 5 Oct 2010 23:27:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o95NR6IB075864; Tue, 5 Oct 2010 23:27:06 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o95NR6As075856; Tue, 5 Oct 2010 23:27:06 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010052327.o95NR6As075856@svn.freebsd.org> From: Weongyo Jeong Date: Tue, 5 Oct 2010 23:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213466 - in user/weongyo/usb/sys/dev/usb: . controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2010 23:27:06 -0000 Author: weongyo Date: Tue Oct 5 23:27:06 2010 New Revision: 213466 URL: http://svn.freebsd.org/changeset/base/213466 Log: Removes magic parm.size[0, 1, 2, 3, 4, 5, 6]. Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c user/weongyo/usb/sys/dev/usb/controller/atmegadci.c user/weongyo/usb/sys/dev/usb/controller/avr32dci.c user/weongyo/usb/sys/dev/usb/controller/musb_otg.c user/weongyo/usb/sys/dev/usb/controller/uss820dci.c user/weongyo/usb/sys/dev/usb/usb_transfer.c user/weongyo/usb/sys/dev/usb/usb_transfer.h Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/at91dci.c Tue Oct 5 23:24:58 2010 (r213465) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci.c Tue Oct 5 23:27:06 2010 (r213466) @@ -2138,13 +2138,13 @@ at91dci_xfer_setup(struct usb_setup_para } /* align data */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->needbufsize = roundup(parm->needbufsize, USB_HOST_ALIGN); for (n = 0; n != ntd; n++) { struct at91dci_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); + td = USB_ADD_BYTES(parm->buf, parm->needbufsize); /* init TD */ td->io_tag = sc->sc_io_tag; @@ -2158,7 +2158,7 @@ at91dci_xfer_setup(struct usb_setup_para last_obj = td; } - parm->size[0] += sizeof(*td); + parm->needbufsize += sizeof(*td); } xfer->td_start[0] = last_obj; Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Tue Oct 5 23:24:58 2010 (r213465) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Tue Oct 5 23:27:06 2010 (r213466) @@ -2007,13 +2007,13 @@ atmegadci_xfer_setup(struct usb_setup_pa } /* align data */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->needbufsize = roundup(parm->needbufsize, USB_HOST_ALIGN); for (n = 0; n != ntd; n++) { struct atmegadci_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); + td = USB_ADD_BYTES(parm->buf, parm->needbufsize); /* init TD */ td->max_packet_size = xfer->max_packet_size; @@ -2024,7 +2024,7 @@ atmegadci_xfer_setup(struct usb_setup_pa last_obj = td; } - parm->size[0] += sizeof(*td); + parm->needbufsize += sizeof(*td); } xfer->td_start[0] = last_obj; Modified: user/weongyo/usb/sys/dev/usb/controller/avr32dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Tue Oct 5 23:24:58 2010 (r213465) +++ user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Tue Oct 5 23:27:06 2010 (r213466) @@ -1936,7 +1936,7 @@ avr32dci_xfer_setup(struct usb_setup_par return; } /* align data */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->needbufsize = roundup(parm->needbufsize, USB_HOST_ALIGN); for (n = 0; n != ntd; n++) { struct avr32dci_td *td; @@ -1944,7 +1944,7 @@ avr32dci_xfer_setup(struct usb_setup_par if (parm->buf) { uint32_t temp; - td = USB_ADD_BYTES(parm->buf, parm->size[0]); + td = USB_ADD_BYTES(parm->buf, parm->needbufsize); /* init TD */ td->max_packet_size = xfer->max_packet_size; @@ -1959,7 +1959,7 @@ avr32dci_xfer_setup(struct usb_setup_par last_obj = td; } - parm->size[0] += sizeof(*td); + parm->needbufsize += sizeof(*td); } xfer->td_start[0] = last_obj; Modified: user/weongyo/usb/sys/dev/usb/controller/musb_otg.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Tue Oct 5 23:24:58 2010 (r213465) +++ user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Tue Oct 5 23:27:06 2010 (r213466) @@ -2600,13 +2600,13 @@ musbotg_xfer_setup(struct usb_setup_para } /* align data */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->needbufsize = roundup(parm->needbufsize, USB_HOST_ALIGN); for (n = 0; n != ntd; n++) { struct musbotg_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); + td = USB_ADD_BYTES(parm->buf, parm->needbufsize); /* init TD */ td->max_frame_size = xfer->max_frame_size; @@ -2615,7 +2615,7 @@ musbotg_xfer_setup(struct usb_setup_para last_obj = td; } - parm->size[0] += sizeof(*td); + parm->needbufsize += sizeof(*td); } xfer->td_start[0] = last_obj; Modified: user/weongyo/usb/sys/dev/usb/controller/uss820dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Tue Oct 5 23:24:58 2010 (r213465) +++ user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Tue Oct 5 23:27:06 2010 (r213466) @@ -2182,13 +2182,13 @@ uss820dci_xfer_setup(struct usb_setup_pa } /* align data */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->needbufsize = roundup(parm->needbufsize, USB_HOST_ALIGN); for (n = 0; n != ntd; n++) { struct uss820dci_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); + td = USB_ADD_BYTES(parm->buf, parm->needbufsize); /* init TD */ td->io_tag = sc->sc_io_tag; @@ -2202,7 +2202,7 @@ uss820dci_xfer_setup(struct usb_setup_pa last_obj = td; } - parm->size[0] += sizeof(*td); + parm->needbufsize += sizeof(*td); } xfer->td_start[0] = last_obj; Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Tue Oct 5 23:24:58 2010 (r213465) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Tue Oct 5 23:27:06 2010 (r213466) @@ -578,11 +578,11 @@ usbd_transfer_setup_sub(struct usb_setup if ((xfer->flags & USBD_EXT_BUFFER) == 0) { /* align data */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->needbufsize = roundup(parm->needbufsize, USB_HOST_ALIGN); if (parm->buf) { xfer->local_buffer = - USB_ADD_BYTES(parm->buf, parm->size[0]); + USB_ADD_BYTES(parm->buf, parm->needbufsize); xfer->local_buflen = parm->bufsize; usbd_xfer_set_frame_offset(xfer, 0, 0); @@ -590,10 +590,10 @@ usbd_transfer_setup_sub(struct usb_setup if (type == UE_CONTROL && n_frbuffers > 1) usbd_xfer_set_frame_offset(xfer, REQ_SIZE, 1); } - parm->size[0] += parm->bufsize; + parm->needbufsize += parm->bufsize; /* align data again */ - parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + parm->needbufsize = roundup(parm->needbufsize, USB_HOST_ALIGN); } /* * Compute maximum buffer size @@ -762,14 +762,18 @@ usbd_transfer_setup(struct usb_device *u info = USB_ADD_BYTES(buf, 0); info->memory_base = buf; - info->memory_size = parm.size[0]; + info->memory_size = parm.needbufsize; #if USB_HAVE_BUSDMA - info->dma_page_cache_start = USB_ADD_BYTES(buf, parm.size[4]); - info->dma_page_cache_end = USB_ADD_BYTES(buf, parm.size[5]); + info->dma_page_cache_start = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_DMA_PAGECACHE]); + info->dma_page_cache_end = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); #endif - info->xfer_page_cache_start = USB_ADD_BYTES(buf, parm.size[5]); - info->xfer_page_cache_end = USB_ADD_BYTES(buf, parm.size[2]); + info->xfer_page_cache_start = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); + info->xfer_page_cache_end = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE_END]); cv_init(&info->cv_drain, "WDRAIN"); @@ -806,9 +810,9 @@ usbd_transfer_setup(struct usb_device *u udev->bus->non_giant_callback_tq; } /* reset sizes */ - parm.size[0] = 0; + parm.needbufsize = 0; parm.buf = buf; - parm.size[0] += sizeof(info[0]); + parm.needbufsize += sizeof(info[0]); for (setup = setup_start, n = 0; setup != setup_end; setup++, n++) { @@ -830,7 +834,8 @@ usbd_transfer_setup(struct usb_device *u } /* align data properly */ - parm.size[0] += ((-parm.size[0]) & (USB_HOST_ALIGN - 1)); + parm.needbufsize = roundup(parm.needbufsize, + USB_HOST_ALIGN); /* store current setup pointer */ parm.curr_setup = setup; @@ -840,7 +845,7 @@ usbd_transfer_setup(struct usb_device *u * Common initialization of the * "usb_xfer" structure. */ - xfer = USB_ADD_BYTES(buf, parm.size[0]); + xfer = USB_ADD_BYTES(buf, parm.needbufsize); xfer->address = udev->address; xfer->priv_sc = priv_sc; xfer->xroot = info; @@ -863,7 +868,7 @@ usbd_transfer_setup(struct usb_device *u /* set transfer endpoint pointer */ xfer->endpoint = ep; - parm.size[0] += sizeof(xfer[0]); + parm.needbufsize += sizeof(xfer[0]); parm.methods = xfer->endpoint->methods; parm.curr_xfer = xfer; @@ -923,10 +928,10 @@ usbd_transfer_setup(struct usb_device *u goto done; } /* align data properly */ - parm.size[0] += ((-parm.size[0]) & (USB_HOST_ALIGN - 1)); + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); /* store offset temporarily */ - parm.size[1] = parm.size[0]; + parm.bufoffset[USB_SETUP_DMA_TAG] = parm.needbufsize; /* * The number of DMA tags required depends on @@ -943,62 +948,67 @@ usbd_transfer_setup(struct usb_device *u parm.dma_tag_p += parm.dma_tag_max; - parm.size[0] += ((uint8_t *)parm.dma_tag_p) - + parm.needbufsize += ((uint8_t *)parm.dma_tag_p) - ((uint8_t *)0); /* align data properly */ - parm.size[0] += ((-parm.size[0]) & (USB_HOST_ALIGN - 1)); + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); /* store offset temporarily */ - parm.size[3] = parm.size[0]; + parm.bufoffset[USB_SETUP_DMA_PAGE] = parm.needbufsize; - parm.size[0] += ((uint8_t *)parm.dma_page_ptr) - + parm.needbufsize += ((uint8_t *)parm.dma_page_ptr) - ((uint8_t *)0); /* align data properly */ - parm.size[0] += ((-parm.size[0]) & (USB_HOST_ALIGN - 1)); + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); /* store offset temporarily */ - parm.size[4] = parm.size[0]; + parm.bufoffset[USB_SETUP_DMA_PAGECACHE] = parm.needbufsize; - parm.size[0] += ((uint8_t *)parm.dma_page_cache_ptr) - + parm.needbufsize += ((uint8_t *)parm.dma_page_cache_ptr) - ((uint8_t *)0); /* store end offset temporarily */ - parm.size[5] = parm.size[0]; + parm.bufoffset[USB_SETUP_XFER_PAGECACHE] = parm.needbufsize; - parm.size[0] += ((uint8_t *)parm.xfer_page_cache_ptr) - + parm.needbufsize += ((uint8_t *)parm.xfer_page_cache_ptr) - ((uint8_t *)0); /* store end offset temporarily */ - parm.size[2] = parm.size[0]; + parm.bufoffset[USB_SETUP_XFER_PAGECACHE_END] = parm.needbufsize; /* align data properly */ - parm.size[0] += ((-parm.size[0]) & (USB_HOST_ALIGN - 1)); + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - parm.size[6] = parm.size[0]; + parm.bufoffset[USB_SETUP_XFERLEN] = parm.needbufsize; - parm.size[0] += ((uint8_t *)parm.xfer_length_ptr) - + parm.needbufsize += ((uint8_t *)parm.xfer_length_ptr) - ((uint8_t *)0); /* align data properly */ - parm.size[0] += ((-parm.size[0]) & (USB_HOST_ALIGN - 1)); + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); /* allocate zeroed memory */ - buf = malloc(parm.size[0], M_USB, M_WAITOK | M_ZERO); + buf = malloc(parm.needbufsize, M_USB, M_WAITOK | M_ZERO); if (buf == NULL) { parm.err = USB_ERR_NOMEM; DPRINTFN(0, "cannot allocate memory block for " "configuration (%d bytes)\n", - parm.size[0]); + parm.needbufsize); goto done; } - parm.dma_tag_p = USB_ADD_BYTES(buf, parm.size[1]); - parm.dma_page_ptr = USB_ADD_BYTES(buf, parm.size[3]); - parm.dma_page_cache_ptr = USB_ADD_BYTES(buf, parm.size[4]); - parm.xfer_page_cache_ptr = USB_ADD_BYTES(buf, parm.size[5]); - parm.xfer_length_ptr = USB_ADD_BYTES(buf, parm.size[6]); + parm.dma_tag_p = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_DMA_TAG]); + parm.dma_page_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_DMA_PAGE]); + parm.dma_page_cache_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_DMA_PAGECACHE]); + parm.xfer_page_cache_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); + parm.xfer_length_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFERLEN]); } done: Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.h Tue Oct 5 23:24:58 2010 (r213465) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.h Tue Oct 5 23:27:06 2010 (r213466) @@ -90,7 +90,16 @@ struct usb_setup_params { void *buf; usb_frlength_t *xfer_length_ptr; - usb_size_t size[7]; + usb_size_t needbufsize; +#define USB_SETUP_DMA_TAG 0 +#define USB_SETUP_DMA_PAGECACHE 1 +#define USB_SETUP_DMA_PAGE 2 +#define USB_SETUP_XFER_PAGECACHE 3 +#define USB_SETUP_XFER_PAGECACHE_END 4 +#define USB_SETUP_XFERLEN 5 +#define USB_SETUP_MAX 6 + usb_size_t bufoffset[USB_SETUP_MAX]; + usb_frlength_t bufsize; usb_frlength_t bufsize_max; From owner-svn-src-user@FreeBSD.ORG Wed Oct 6 19:32:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5240A1065670; Wed, 6 Oct 2010 19:32:12 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 412F48FC17; Wed, 6 Oct 2010 19:32:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o96JWCUi015873; Wed, 6 Oct 2010 19:32:12 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o96JWCF7015871; Wed, 6 Oct 2010 19:32:12 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010061932.o96JWCF7015871@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 6 Oct 2010 19:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213491 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2010 19:32:12 -0000 Author: weongyo Date: Wed Oct 6 19:32:12 2010 New Revision: 213491 URL: http://svn.freebsd.org/changeset/base/213491 Log: A code cleanup of usbd_transfer_setup() to remove `while (1)'. It's seperated into two step and added comments what each step's doing. Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Wed Oct 6 18:51:22 2010 (r213490) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Wed Oct 6 19:32:12 2010 (r213491) @@ -700,20 +700,16 @@ usbd_transfer_setup(struct usb_device *u const struct usb_config *setup_end = setup_start + n_setup; const struct usb_config *setup; struct usb_endpoint *ep; - struct usb_xfer_root *info; + struct usb_xfer_root *info = NULL; struct usb_xfer *xfer; + enum usb_dev_speed speed = usbd_get_speed(udev); void *buf = NULL; uint16_t n; - uint16_t refcount; - - parm.err = 0; - refcount = 0; - info = NULL; + uint16_t refcount = 0; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "usbd_transfer_setup can sleep!"); - /* do some checking first */ if (n_setup == 0) { DPRINTFN(6, "setup array has zero length!\n"); return (USB_ERR_INVAL); @@ -722,293 +718,312 @@ usbd_transfer_setup(struct usb_device *u DPRINTFN(6, "ifaces array is NULL!\n"); return (USB_ERR_INVAL); } + if (speed >= USB_SPEED_MAX) { + DPRINTFN(6, "invalid USB speed (%d)\n", speed); + return (USB_ERR_INVAL); + } if (xfer_mtx == NULL) { DPRINTFN(6, "using global lock\n"); xfer_mtx = &Giant; } - /* sanity checks */ - for (setup = setup_start, n = 0; - setup != setup_end; setup++, n++) { + + /* + * To set up USB xfer structures, usbd_transfer_setup() has TWO step + * approach. In step 1 it handles exceptional cases, calculates + * the buffer size and set `struct usb_setup_params' structure + * properly before going into step 2. In step 2 it's doing real job + * to set up a xfer. + */ + + bzero(&parm, sizeof(parm)); + parm.udev = udev; + parm.speed = speed; + parm.hc_max_packet_count = 1; + parm.buf = NULL; + parm.needbufsize = sizeof(info[0]); + + /* + * Step 1: handle exceptional cases and calculate the buffer size. + * + * Please see parm.needbufsize and parm.bufoffset[] carefully to set + * up the buffer layout. It'd finally allocate just one virtually + * linear kernel buffer which has several sections for DMA page + * structures, xfer page structures and etc. + */ + + for (setup = setup_start, n = 0; setup != setup_end; setup++, n++) { if (setup->bufsize == (usb_frlength_t)-1) { - parm.err = USB_ERR_BAD_BUFSIZE; DPRINTF("invalid bufsize\n"); + parm.err = USB_ERR_BAD_BUFSIZE; + goto done; } if (setup->callback == NULL) { - parm.err = USB_ERR_NO_CALLBACK; DPRINTF("no callback\n"); + parm.err = USB_ERR_NO_CALLBACK; + goto done; } - ppxfer[n] = NULL; - } + USB_ASSERT(ppxfer[n] == NULL, ("ppxfer[%d] != NULL", n)); - if (parm.err) - goto done; - bzero(&parm, sizeof(parm)); + /* see if there is a matching endpoint */ + ep = usbd_get_endpoint(udev, ifaces[setup->if_index], setup); + if (ep == NULL || ep->methods == NULL) { + if ((setup->flags & USBD_NO_PIPE_OK) != 0) + continue; + if (setup->usb_mode != USB_MODE_DUAL && + setup->usb_mode != udev->flags.usb_mode) + continue; + parm.err = USB_ERR_NO_PIPE; + goto done; + } - parm.udev = udev; - parm.speed = usbd_get_speed(udev); - parm.hc_max_packet_count = 1; + /* align data properly */ + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - if (parm.speed >= USB_SPEED_MAX) { - parm.err = USB_ERR_INVAL; - goto done; - } - /* setup all transfers */ - while (1) { - if (buf) { - /* - * Initialize the "usb_xfer_root" structure, - * which is common for all our USB transfers. - */ - info = USB_ADD_BYTES(buf, 0); + /* store current setup pointer */ + parm.curr_setup = setup; - info->memory_base = buf; - info->memory_size = parm.needbufsize; + /* + * Setup a dummy xfer, hence we are writing to the "usb_xfer" + * structure pointed to by "xfer" before we have allocated any + * memory: + */ + xfer = &dummy; + bzero(&dummy, sizeof(dummy)); + refcount++; + + /* set transfer endpoint pointer */ + xfer->endpoint = ep; + + parm.needbufsize += sizeof(xfer[0]); + parm.methods = xfer->endpoint->methods; + parm.curr_xfer = xfer; -#if USB_HAVE_BUSDMA - info->dma_page_cache_start = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_DMA_PAGECACHE]); - info->dma_page_cache_end = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); -#endif - info->xfer_page_cache_start = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); - info->xfer_page_cache_end = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_XFER_PAGECACHE_END]); + /* + * Call the Host or Device controller transfer + * setup routine: + */ + (udev->bus->methods->xfer_setup) (&parm); + if (parm.err) + goto done; + } + USB_ASSERT(refcount != 0, ("refcount == 0")); - cv_init(&info->cv_drain, "WDRAIN"); + /* align data properly */ + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - info->xfer_mtx = xfer_mtx; -#if USB_HAVE_BUSDMA - usb_dma_tag_setup(&info->dma_parent_tag, - parm.dma_tag_p, udev->bus->dma_parent_tag[0].tag, - xfer_mtx, &usb_bdma_done_event, 32, parm.dma_tag_max); -#endif + /* store offset temporarily */ + parm.bufoffset[USB_SETUP_DMA_TAG] = parm.needbufsize; - info->bus = udev->bus; - info->udev = udev; + /* + * The number of DMA tags required depends on the number of endpoints. + * The current estimate for maximum number of DMA tags per endpoint + * is two. + */ + parm.dma_tag_max += 2 * MIN(n_setup, USB_EP_MAX); - TAILQ_INIT(&info->done_q.head); - info->done_q.command = &usbd_callback_wrapper; -#if USB_HAVE_BUSDMA - TAILQ_INIT(&info->dma_q.head); - info->dma_q.command = &usb_bdma_work_loop; -#endif - TASK_INIT(&info->done_task, 0, usb_callback_proc, info); + /* + * DMA tags for QH, TD, Data and more. + */ + parm.dma_tag_max += 8; - /* - * In device side mode control endpoint - * requests need to run from a separate - * context, else there is a chance of - * deadlock! - */ - if (setup_start == usb_control_ep_cfg) - info->done_tq = udev->bus->control_xfer_tq; - else if (xfer_mtx == &Giant) - info->done_tq = udev->bus->giant_callback_tq; - else - info->done_tq = - udev->bus->non_giant_callback_tq; - } - /* reset sizes */ - parm.needbufsize = 0; - parm.buf = buf; - parm.needbufsize += sizeof(info[0]); - - for (setup = setup_start, n = 0; - setup != setup_end; setup++, n++) { - /* skip USB transfers without callbacks: */ - if (setup->callback == NULL) - continue; - /* see if there is a matching endpoint */ - ep = usbd_get_endpoint(udev, - ifaces[setup->if_index], setup); - - if (ep == NULL || ep->methods == NULL) { - if ((setup->flags & USBD_NO_PIPE_OK) != 0) - continue; - if (setup->usb_mode != USB_MODE_DUAL && - setup->usb_mode != udev->flags.usb_mode) - continue; - parm.err = USB_ERR_NO_PIPE; - goto done; - } + parm.dma_tag_p += parm.dma_tag_max; - /* align data properly */ - parm.needbufsize = roundup(parm.needbufsize, - USB_HOST_ALIGN); + parm.needbufsize += ((uint8_t *)parm.dma_tag_p) - ((uint8_t *)0); - /* store current setup pointer */ - parm.curr_setup = setup; + /* align data properly */ + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - if (buf) { - /* - * Common initialization of the - * "usb_xfer" structure. - */ - xfer = USB_ADD_BYTES(buf, parm.needbufsize); - xfer->address = udev->address; - xfer->priv_sc = priv_sc; - xfer->xroot = info; + /* store offset temporarily */ + parm.bufoffset[USB_SETUP_DMA_PAGE] = parm.needbufsize; - usb_callout_init_mtx(&xfer->timeout_handle, - &udev->bus->bus_mtx, 0); - } else { - /* - * Setup a dummy xfer, hence we are - * writing to the "usb_xfer" - * structure pointed to by "xfer" - * before we have allocated any - * memory: - */ - xfer = &dummy; - bzero(&dummy, sizeof(dummy)); - refcount++; - } + parm.needbufsize += ((uint8_t *)parm.dma_page_ptr) - ((uint8_t *)0); - /* set transfer endpoint pointer */ - xfer->endpoint = ep; + /* align data properly */ + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - parm.needbufsize += sizeof(xfer[0]); - parm.methods = xfer->endpoint->methods; - parm.curr_xfer = xfer; + /* store offset temporarily */ + parm.bufoffset[USB_SETUP_DMA_PAGECACHE] = parm.needbufsize; - /* - * Call the Host or Device controller transfer - * setup routine: - */ - (udev->bus->methods->xfer_setup) (&parm); + parm.needbufsize += ((uint8_t *)parm.dma_page_cache_ptr) - + ((uint8_t *)0); - /* check for error */ - if (parm.err) - goto done; + /* store end offset temporarily */ + parm.bufoffset[USB_SETUP_XFER_PAGECACHE] = parm.needbufsize; - if (buf) { - /* - * Increment the endpoint refcount. This - * basically prevents setting a new - * configuration and alternate setting - * when USB transfers are in use on - * the given interface. Search the USB - * code for "endpoint->refcount_alloc" if you - * want more information. - */ - USB_BUS_LOCK(info->bus); - if (xfer->endpoint->refcount_alloc >= USB_EP_REF_MAX) - parm.err = USB_ERR_INVAL; - - xfer->endpoint->refcount_alloc++; - - if (xfer->endpoint->refcount_alloc == 0) - panic("usbd_transfer_setup(): Refcount wrapped to zero\n"); - USB_BUS_UNLOCK(info->bus); + parm.needbufsize += ((uint8_t *)parm.xfer_page_cache_ptr) - + ((uint8_t *)0); - /* - * Whenever we set ppxfer[] then we - * also need to increment the - * "setup_refcount": - */ - info->setup_refcount++; + /* store end offset temporarily */ + parm.bufoffset[USB_SETUP_XFER_PAGECACHE_END] = parm.needbufsize; - /* - * Transfer is successfully setup and - * can be used: - */ - ppxfer[n] = xfer; - } + /* align data properly */ + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - /* check for error */ - if (parm.err) - goto done; - } + parm.bufoffset[USB_SETUP_XFERLEN] = parm.needbufsize; - if (buf || parm.err) - goto done; - if (refcount == 0) { - /* no transfers - nothing to do ! */ - goto done; - } - /* align data properly */ - parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - - /* store offset temporarily */ - parm.bufoffset[USB_SETUP_DMA_TAG] = parm.needbufsize; - - /* - * The number of DMA tags required depends on - * the number of endpoints. The current estimate - * for maximum number of DMA tags per endpoint - * is two. - */ - parm.dma_tag_max += 2 * MIN(n_setup, USB_EP_MAX); + parm.needbufsize += ((uint8_t *)parm.xfer_length_ptr) - ((uint8_t *)0); - /* - * DMA tags for QH, TD, Data and more. - */ - parm.dma_tag_max += 8; + /* align data properly */ + parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - parm.dma_tag_p += parm.dma_tag_max; + /* allocate zeroed memory */ + buf = malloc(parm.needbufsize, M_USB, M_WAITOK | M_ZERO); - parm.needbufsize += ((uint8_t *)parm.dma_tag_p) - - ((uint8_t *)0); + if (buf == NULL) { + parm.err = USB_ERR_NOMEM; + DPRINTFN(0, "cannot allocate memory block for " + "configuration (%d bytes)\n", parm.needbufsize); + goto done; + } + parm.dma_tag_p = USB_ADD_BYTES(buf, parm.bufoffset[USB_SETUP_DMA_TAG]); + parm.dma_page_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_DMA_PAGE]); + parm.dma_page_cache_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_DMA_PAGECACHE]); + parm.xfer_page_cache_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); + parm.xfer_length_ptr = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFERLEN]); - /* align data properly */ - parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); + /* + * Step 2: fills the allocated buffer with valid values. + * + * The allocated buffer at above would have all informations and + * USB buffers to send or receive USB transfers. + */ - /* store offset temporarily */ - parm.bufoffset[USB_SETUP_DMA_PAGE] = parm.needbufsize; + /* + * Initialize the "usb_xfer_root" structure, which is common for all + * our USB transfers. + */ + info = USB_ADD_BYTES(buf, 0); - parm.needbufsize += ((uint8_t *)parm.dma_page_ptr) - - ((uint8_t *)0); + info->memory_base = buf; + info->memory_size = parm.needbufsize; - /* align data properly */ - parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); +#if USB_HAVE_BUSDMA + info->dma_page_cache_start = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_DMA_PAGECACHE]); + info->dma_page_cache_end = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); +#endif + info->xfer_page_cache_start = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); + info->xfer_page_cache_end = USB_ADD_BYTES(buf, + parm.bufoffset[USB_SETUP_XFER_PAGECACHE_END]); - /* store offset temporarily */ - parm.bufoffset[USB_SETUP_DMA_PAGECACHE] = parm.needbufsize; + cv_init(&info->cv_drain, "WDRAIN"); - parm.needbufsize += ((uint8_t *)parm.dma_page_cache_ptr) - - ((uint8_t *)0); + info->xfer_mtx = xfer_mtx; +#if USB_HAVE_BUSDMA + usb_dma_tag_setup(&info->dma_parent_tag, + parm.dma_tag_p, udev->bus->dma_parent_tag[0].tag, + xfer_mtx, &usb_bdma_done_event, 32, parm.dma_tag_max); +#endif - /* store end offset temporarily */ - parm.bufoffset[USB_SETUP_XFER_PAGECACHE] = parm.needbufsize; + info->bus = udev->bus; + info->udev = udev; - parm.needbufsize += ((uint8_t *)parm.xfer_page_cache_ptr) - - ((uint8_t *)0); + TAILQ_INIT(&info->done_q.head); + info->done_q.command = &usbd_callback_wrapper; +#if USB_HAVE_BUSDMA + TAILQ_INIT(&info->dma_q.head); + info->dma_q.command = &usb_bdma_work_loop; +#endif + TASK_INIT(&info->done_task, 0, usb_callback_proc, info); - /* store end offset temporarily */ - parm.bufoffset[USB_SETUP_XFER_PAGECACHE_END] = parm.needbufsize; + /* + * In device side mode control endpoint requests need to run from + * a separate context, else there is a chance of deadlock! + */ + if (setup_start == usb_control_ep_cfg) + info->done_tq = udev->bus->control_xfer_tq; + else if (xfer_mtx == &Giant) + info->done_tq = udev->bus->giant_callback_tq; + else + info->done_tq = udev->bus->non_giant_callback_tq; + + /* reset sizes */ + parm.needbufsize = 0; + parm.buf = buf; + parm.needbufsize += sizeof(info[0]); + + for (setup = setup_start, n = 0; setup != setup_end; setup++, n++) { + /* see if there is a matching endpoint */ + ep = usbd_get_endpoint(udev, ifaces[setup->if_index], setup); + if (ep == NULL || ep->methods == NULL) { + if ((setup->flags & USBD_NO_PIPE_OK) != 0) + continue; + if (setup->usb_mode != USB_MODE_DUAL && + setup->usb_mode != udev->flags.usb_mode) + continue; + /* never happen */ + panic("no pipe"); + } /* align data properly */ parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); - parm.bufoffset[USB_SETUP_XFERLEN] = parm.needbufsize; + /* store current setup pointer */ + parm.curr_setup = setup; - parm.needbufsize += ((uint8_t *)parm.xfer_length_ptr) - - ((uint8_t *)0); + /* Common initialization of the "usb_xfer" structure. */ + xfer = USB_ADD_BYTES(buf, parm.needbufsize); + xfer->address = udev->address; + xfer->priv_sc = priv_sc; + xfer->xroot = info; + + usb_callout_init_mtx(&xfer->timeout_handle, + &udev->bus->bus_mtx, 0); + + /* set transfer endpoint pointer */ + xfer->endpoint = ep; + + parm.needbufsize += sizeof(xfer[0]); + parm.methods = xfer->endpoint->methods; + parm.curr_xfer = xfer; - /* align data properly */ - parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); + /* + * Call the Host or Device controller transfer + * setup routine: + */ + (udev->bus->methods->xfer_setup) (&parm); - /* allocate zeroed memory */ - buf = malloc(parm.needbufsize, M_USB, M_WAITOK | M_ZERO); + /* check for error */ + if (parm.err) + goto done; - if (buf == NULL) { - parm.err = USB_ERR_NOMEM; - DPRINTFN(0, "cannot allocate memory block for " - "configuration (%d bytes)\n", - parm.needbufsize); + /* + * Increment the endpoint refcount. This basically prevents + * setting a new configuration and alternate setting + * when USB transfers are in use on the given interface. + * Search the USB code for "endpoint->refcount_alloc" if you + * want more information. + */ + USB_BUS_LOCK(info->bus); + if (xfer->endpoint->refcount_alloc >= USB_EP_REF_MAX) { + USB_BUS_UNLOCK(info->bus); + parm.err = USB_ERR_INVAL; goto done; } - parm.dma_tag_p = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_DMA_TAG]); - parm.dma_page_ptr = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_DMA_PAGE]); - parm.dma_page_cache_ptr = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_DMA_PAGECACHE]); - parm.xfer_page_cache_ptr = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_XFER_PAGECACHE]); - parm.xfer_length_ptr = USB_ADD_BYTES(buf, - parm.bufoffset[USB_SETUP_XFERLEN]); + + xfer->endpoint->refcount_alloc++; + + if (xfer->endpoint->refcount_alloc == 0) + panic("usbd_transfer_setup(): Refcount wrapped" + " to zero\n"); + USB_BUS_UNLOCK(info->bus); + + /* + * Whenever we set ppxfer[] then we also need to increment the + * "setup_refcount": + */ + info->setup_refcount++; + + /* + * Transfer is successfully setup and can be used: + */ + ppxfer[n] = xfer; } done: From owner-svn-src-user@FreeBSD.ORG Wed Oct 6 23:04:07 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5FB11065670; Wed, 6 Oct 2010 23:04:07 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A58528FC16; Wed, 6 Oct 2010 23:04:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o96N47kT020909; Wed, 6 Oct 2010 23:04:07 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o96N47nC020903; Wed, 6 Oct 2010 23:04:07 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010062304.o96N47nC020903@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 6 Oct 2010 23:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213500 - in user/weongyo/usb/sys/dev/usb: . controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2010 23:04:07 -0000 Author: weongyo Date: Wed Oct 6 23:04:07 2010 New Revision: 213500 URL: http://svn.freebsd.org/changeset/base/213500 Log: Rewrites USB_DMATAG_TO_XROOT macro to remove linux-like container_of() macro. Sometimes it's useful because it don't need to handle the parent pointer but it's not intuitive. Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/usb_busdma.c user/weongyo/usb/sys/dev/usb/usb_busdma.h user/weongyo/usb/sys/dev/usb/usb_transfer.c user/weongyo/usb/sys/dev/usb/usb_transfer.h Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Wed Oct 6 22:41:32 2010 (r213499) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Wed Oct 6 23:04:07 2010 (r213500) @@ -473,7 +473,7 @@ usb_bus_mem_alloc_all(struct usb_bus *bu #if USB_HAVE_BUSDMA usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, - dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX); + dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX, NULL); if (bus->busmem_func != NULL) bus->busmem_func(bus, usb_bus_mem_alloc_all_cb); #endif Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_busdma.c Wed Oct 6 22:41:32 2010 (r213499) +++ user/weongyo/usb/sys/dev/usb/usb_busdma.c Wed Oct 6 23:04:07 2010 (r213500) @@ -767,7 +767,7 @@ usb_dma_tag_find(struct usb_dma_parent_t void usb_dma_tag_setup(struct usb_dma_parent_tag *udpt, struct usb_dma_tag *udt, bus_dma_tag_t dmat, struct mtx *mtx, usb_dma_callback_t *func, - uint8_t ndmabits, uint8_t nudt) + uint8_t ndmabits, uint8_t nudt, void *priv) { bzero(udpt, sizeof(*udpt)); @@ -786,6 +786,7 @@ usb_dma_tag_setup(struct usb_dma_parent_ udpt->utag_first = udt; udpt->utag_max = nudt; udpt->dma_bits = ndmabits; + udpt->priv = priv; while (nudt--) { bzero(udt, sizeof(*udt)); Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_busdma.h Wed Oct 6 22:41:32 2010 (r213499) +++ user/weongyo/usb/sys/dev/usb/usb_busdma.h Wed Oct 6 23:04:07 2010 (r213500) @@ -115,6 +115,11 @@ struct usb_dma_parent_tag { uint8_t dma_error; /* set if DMA load operation failed */ uint8_t dma_bits; /* number of DMA address lines */ uint8_t utag_max; /* number of USB DMA tags */ + /* + * pointer to struct usb_xfer_root. But it'd be NULL if + * `struct usb_dma_parent_tag' is for controller/usb_controller.c + */ + void *priv; }; #else struct usb_dma_parent_tag {}; /* empty struct */ @@ -151,7 +156,8 @@ void usb_bdma_pre_sync(struct usb_xfer * void usb_bdma_work_loop(struct usb_xfer_queue *pq); void usb_dma_tag_setup(struct usb_dma_parent_tag *udpt, struct usb_dma_tag *udt, bus_dma_tag_t dmat, struct mtx *mtx, - usb_dma_callback_t *func, uint8_t ndmabits, uint8_t nudt); + usb_dma_callback_t *func, uint8_t ndmabits, uint8_t nudt, + void *priv); void usb_dma_tag_unsetup(struct usb_dma_parent_tag *udpt); void usb_pc_cpu_flush(struct usb_page_cache *pc); void usb_pc_cpu_invalidate(struct usb_page_cache *pc); Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Wed Oct 6 22:41:32 2010 (r213499) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Wed Oct 6 23:04:07 2010 (r213500) @@ -918,7 +918,7 @@ usbd_transfer_setup(struct usb_device *u #if USB_HAVE_BUSDMA usb_dma_tag_setup(&info->dma_parent_tag, parm.dma_tag_p, udev->bus->dma_parent_tag[0].tag, - xfer_mtx, &usb_bdma_done_event, 32, parm.dma_tag_max); + xfer_mtx, &usb_bdma_done_event, 32, parm.dma_tag_max, info); #endif info->bus = udev->bus; Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.h Wed Oct 6 22:41:32 2010 (r213499) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.h Wed Oct 6 23:04:07 2010 (r213500) @@ -29,10 +29,7 @@ #include -#define USB_DMATAG_TO_XROOT(dpt) \ - ((struct usb_xfer_root *)( \ - ((uint8_t *)(dpt)) - \ - ((uint8_t *)&((struct usb_xfer_root *)0)->dma_parent_tag))) +#define USB_DMATAG_TO_XROOT(dpt) ((struct usb_xfer_root *)(dpt)->priv) /* * The following structure is used to keep information about memory From owner-svn-src-user@FreeBSD.ORG Wed Oct 6 23:13:30 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6301106566C; Wed, 6 Oct 2010 23:13:30 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C11B8FC0C; Wed, 6 Oct 2010 23:13:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o96NDUpD021124; Wed, 6 Oct 2010 23:13:30 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o96NDUXG021122; Wed, 6 Oct 2010 23:13:30 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010062313.o96NDUXG021122@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 6 Oct 2010 23:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213501 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2010 23:13:30 -0000 Author: weongyo Date: Wed Oct 6 23:13:30 2010 New Revision: 213501 URL: http://svn.freebsd.org/changeset/base/213501 Log: Uses USB_P2U macro that it's doing same thing. Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Wed Oct 6 23:04:07 2010 (r213500) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Wed Oct 6 23:13:30 2010 (r213501) @@ -828,7 +828,7 @@ usbd_transfer_setup(struct usb_device *u parm.dma_tag_p += parm.dma_tag_max; - parm.needbufsize += ((uint8_t *)parm.dma_tag_p) - ((uint8_t *)0); + parm.needbufsize += USB_P2U(parm.dma_tag_p); /* align data properly */ parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); @@ -836,7 +836,7 @@ usbd_transfer_setup(struct usb_device *u /* store offset temporarily */ parm.bufoffset[USB_SETUP_DMA_PAGE] = parm.needbufsize; - parm.needbufsize += ((uint8_t *)parm.dma_page_ptr) - ((uint8_t *)0); + parm.needbufsize += USB_P2U(parm.dma_page_ptr); /* align data properly */ parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); @@ -844,14 +844,12 @@ usbd_transfer_setup(struct usb_device *u /* store offset temporarily */ parm.bufoffset[USB_SETUP_DMA_PAGECACHE] = parm.needbufsize; - parm.needbufsize += ((uint8_t *)parm.dma_page_cache_ptr) - - ((uint8_t *)0); + parm.needbufsize += USB_P2U(parm.dma_page_cache_ptr); /* store end offset temporarily */ parm.bufoffset[USB_SETUP_XFER_PAGECACHE] = parm.needbufsize; - parm.needbufsize += ((uint8_t *)parm.xfer_page_cache_ptr) - - ((uint8_t *)0); + parm.needbufsize += USB_P2U(parm.xfer_page_cache_ptr); /* store end offset temporarily */ parm.bufoffset[USB_SETUP_XFER_PAGECACHE_END] = parm.needbufsize; @@ -861,7 +859,7 @@ usbd_transfer_setup(struct usb_device *u parm.bufoffset[USB_SETUP_XFERLEN] = parm.needbufsize; - parm.needbufsize += ((uint8_t *)parm.xfer_length_ptr) - ((uint8_t *)0); + parm.needbufsize += USB_P2U(parm.xfer_length_ptr); /* align data properly */ parm.needbufsize = roundup(parm.needbufsize, USB_HOST_ALIGN); From owner-svn-src-user@FreeBSD.ORG Wed Oct 6 23:47:52 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5B901065679; Wed, 6 Oct 2010 23:47:52 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89C7C8FC1F; Wed, 6 Oct 2010 23:47:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o96Nlqr8021788; Wed, 6 Oct 2010 23:47:52 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o96NlqTw021779; Wed, 6 Oct 2010 23:47:52 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010062347.o96NlqTw021779@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 6 Oct 2010 23:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213502 - user/weongyo/usb/sys/dev/usb/controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2010 23:47:52 -0000 Author: weongyo Date: Wed Oct 6 23:47:52 2010 New Revision: 213502 URL: http://svn.freebsd.org/changeset/base/213502 Log: Cleans up ..._BUS2SC() macros that don't need to use container_of()-like macros because the usb_bus already knows how to get the softc pointer. Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c user/weongyo/usb/sys/dev/usb/controller/atmegadci.c user/weongyo/usb/sys/dev/usb/controller/avr32dci.c user/weongyo/usb/sys/dev/usb/controller/ehci.c user/weongyo/usb/sys/dev/usb/controller/musb_otg.c user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/uhci.c user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/at91dci.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci.c Wed Oct 6 23:47:52 2010 (r213502) @@ -81,9 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define AT9100_DCI_BUS2SC(bus) \ - ((struct at91dci_softc *)(((uint8_t *)(bus)) - \ - ((uint8_t *)&(((struct at91dci_softc *)0)->sc_bus)))) +#define AT9100_DCI_BUS2SC(bus) (device_get_softc((bus)->parent)) #define AT9100_DCI_PC2SC(pc) \ AT9100_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Wed Oct 6 23:47:52 2010 (r213502) @@ -73,9 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define ATMEGA_BUS2SC(bus) \ - ((struct atmegadci_softc *)(((uint8_t *)(bus)) - \ - ((uint8_t *)&(((struct atmegadci_softc *)0)->sc_bus)))) +#define ATMEGA_BUS2SC(bus) (device_get_softc((bus)->parent)) #define ATMEGA_PC2SC(pc) \ ATMEGA_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) Modified: user/weongyo/usb/sys/dev/usb/controller/avr32dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Wed Oct 6 23:47:52 2010 (r213502) @@ -73,9 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define AVR32_BUS2SC(bus) \ - ((struct avr32dci_softc *)(((uint8_t *)(bus)) - \ - ((uint8_t *)&(((struct avr32dci_softc *)0)->sc_bus)))) +#define AVR32_BUS2SC(bus) (device_get_softc((bus)->parent)) #define AVR32_PC2SC(pc) \ AVR32_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Wed Oct 6 23:47:52 2010 (r213502) @@ -84,9 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define EHCI_BUS2SC(bus) \ - ((ehci_softc_t *)(((uint8_t *)(bus)) - \ - ((uint8_t *)&(((ehci_softc_t *)0)->sc_bus)))) +#define EHCI_BUS2SC(bus) (device_get_softc((bus)->parent)) #ifdef USB_DEBUG static int ehcidebug = 0; Modified: user/weongyo/usb/sys/dev/usb/controller/musb_otg.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Wed Oct 6 23:47:52 2010 (r213502) @@ -75,9 +75,7 @@ #define MUSBOTG_INTR_ENDPT 1 -#define MUSBOTG_BUS2SC(bus) \ - ((struct musbotg_softc *)(((uint8_t *)(bus)) - \ - USB_P2U(&(((struct musbotg_softc *)0)->sc_bus)))) +#define MUSBOTG_BUS2SC(bus) (device_get_softc((bus)->parent)) #define MUSBOTG_PC2SC(pc) \ MUSBOTG_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Wed Oct 6 23:47:52 2010 (r213502) @@ -73,9 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define OHCI_BUS2SC(bus) \ - ((ohci_softc_t *)(((uint8_t *)(bus)) - \ - ((uint8_t *)&(((ohci_softc_t *)0)->sc_bus)))) +#define OHCI_BUS2SC(bus) (device_get_softc((bus)->parent)) #ifdef USB_DEBUG static int ohcidebug = 0; Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Wed Oct 6 23:47:52 2010 (r213502) @@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$"); #include #define alt_next next -#define UHCI_BUS2SC(bus) \ - ((uhci_softc_t *)(((uint8_t *)(bus)) - \ - ((uint8_t *)&(((uhci_softc_t *)0)->sc_bus)))) +#define UHCI_BUS2SC(bus) (device_get_softc((bus)->parent)) #ifdef USB_DEBUG static int uhcidebug = 0; Modified: user/weongyo/usb/sys/dev/usb/controller/uss820dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Wed Oct 6 23:13:30 2010 (r213501) +++ user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Wed Oct 6 23:47:52 2010 (r213502) @@ -69,9 +69,7 @@ #include #include -#define USS820_DCI_BUS2SC(bus) \ - ((struct uss820dci_softc *)(((uint8_t *)(bus)) - \ - ((uint8_t *)&(((struct uss820dci_softc *)0)->sc_bus)))) +#define USS820_DCI_BUS2SC(bus) (device_get_softc((bus)->parent)) #define USS820_DCI_PC2SC(pc) \ USS820_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) From owner-svn-src-user@FreeBSD.ORG Thu Oct 7 17:35:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88105106566B; Thu, 7 Oct 2010 17:35:10 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AA8E8FC0A; Thu, 7 Oct 2010 17:35:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o97HZAV6048030; Thu, 7 Oct 2010 17:35:10 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o97HZAw0048027; Thu, 7 Oct 2010 17:35:10 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010071735.o97HZAw0048027@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 7 Oct 2010 17:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213524 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2010 17:35:10 -0000 Author: weongyo Date: Thu Oct 7 17:35:10 2010 New Revision: 213524 URL: http://svn.freebsd.org/changeset/base/213524 Log: Removes recurse_1 and recurse_2 variables of `struct usb_xfer_queue' that it's replaced as `status'. Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c user/weongyo/usb/sys/dev/usb/usbdi.h Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 7 17:26:22 2010 (r213523) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 7 17:35:10 2010 (r213524) @@ -1964,18 +1964,15 @@ usbd_callback_ss_done_defer(struct usb_x if (pq->curr != xfer) usbd_transfer_enqueue(pq, xfer); - if (!pq->recurse_1) { + if ((pq->status & USB_XFER_QUEUE_HOLD) == 0) { /* * We have to postpone the callback due to the fact we * will have a Lock Order Reversal, LOR, if we try to * proceed ! */ taskqueue_enqueue(info->done_tq, &info->done_task); - } else { - /* clear second recurse flag */ - pq->recurse_2 = 0; - } - return; + } else + pq->status |= USB_XFER_QUEUE_CONTINUE; } /*------------------------------------------------------------------------* @@ -2653,11 +2650,10 @@ usb_command_wrapper(struct usb_xfer_queu pq->curr = NULL; } - if (!pq->recurse_1) { + if ((pq->status & USB_XFER_QUEUE_HOLD) == 0) { do { - /* set both recurse flags */ - pq->recurse_1 = 1; - pq->recurse_2 = 1; + pq->status |= USB_XFER_QUEUE_HOLD; + pq->status &= ~USB_XFER_QUEUE_CONTINUE; if (pq->curr == NULL) { xfer = TAILQ_FIRST(&pq->head); @@ -2672,14 +2668,11 @@ usb_command_wrapper(struct usb_xfer_queu DPRINTFN(6, "cb %p (enter)\n", pq->curr); (pq->command) (pq); DPRINTFN(6, "cb %p (leave)\n", pq->curr); - } while (!pq->recurse_2); + } while ((pq->status & USB_XFER_QUEUE_CONTINUE) != 0); - /* clear first recurse flag */ - pq->recurse_1 = 0; - } else { - /* clear second recurse flag */ - pq->recurse_2 = 0; - } + pq->status &= ~USB_XFER_QUEUE_HOLD; + } else + pq->status |= USB_XFER_QUEUE_CONTINUE; } /*------------------------------------------------------------------------* Modified: user/weongyo/usb/sys/dev/usb/usbdi.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usbdi.h Thu Oct 7 17:26:22 2010 (r213523) +++ user/weongyo/usb/sys/dev/usb/usbdi.h Thu Oct 7 17:35:10 2010 (r213524) @@ -122,8 +122,16 @@ struct usb_xfer_queue { TAILQ_HEAD(, usb_xfer) head; struct usb_xfer *curr; /* current USB transfer processed */ void (*command) (struct usb_xfer_queue *pq); - uint8_t recurse_1:1; - uint8_t recurse_2:1; + int status; +/* + * During this status is set any `info->done_task' wouldn't queued and + * `command' callback at above wouldn't called. It's to avoid recursive calls. + * + * XXX need another approach to make easy to understand? + */ +#define USB_XFER_QUEUE_HOLD (1 << 0) +/* If set, processing the xfer queue would be continue. */ +#define USB_XFER_QUEUE_CONTINUE (1 << 1) }; /* From owner-svn-src-user@FreeBSD.ORG Thu Oct 7 17:49:20 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50E95106567A; Thu, 7 Oct 2010 17:49:20 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E0728FC12; Thu, 7 Oct 2010 17:49:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o97HnKSs048345; Thu, 7 Oct 2010 17:49:20 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o97HnKpI048343; Thu, 7 Oct 2010 17:49:20 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010071749.o97HnKpI048343@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 7 Oct 2010 17:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213525 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2010 17:49:20 -0000 Author: weongyo Date: Thu Oct 7 17:49:19 2010 New Revision: 213525 URL: http://svn.freebsd.org/changeset/base/213525 Log: Enhances a comment what xfer_setup is really doing. Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 7 17:35:10 2010 (r213524) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 7 17:49:19 2010 (r213525) @@ -799,8 +799,9 @@ usbd_transfer_setup(struct usb_device *u parm.curr_xfer = xfer; /* - * Call the Host or Device controller transfer - * setup routine: + * Call the Host or Device controller transfer setup routine + * that at this point it'd calculate the buffer size only + * because parm->buf is NULL. */ (udev->bus->methods->xfer_setup) (&parm); if (parm.err) From owner-svn-src-user@FreeBSD.ORG Fri Oct 8 01:17:22 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91B3C106566C; Fri, 8 Oct 2010 01:17:22 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EF788FC08; Fri, 8 Oct 2010 01:17:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o981HMOk073618; Fri, 8 Oct 2010 01:17:22 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o981HMdb073610; Fri, 8 Oct 2010 01:17:22 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010080117.o981HMdb073610@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 8 Oct 2010 01:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213538 - in user/weongyo/usb/sys/dev/usb: . net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 01:17:22 -0000 Author: weongyo Date: Fri Oct 8 01:17:22 2010 New Revision: 213538 URL: http://svn.freebsd.org/changeset/base/213538 Log: Defines the helper macro SLEEPOUT_RUN_TASK to enqueue the task. Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_udav.c user/weongyo/usb/sys/dev/usb/usb_sleepout.h Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:03:30 2010 (r213537) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:17:22 2010 (r213538) @@ -1151,8 +1151,7 @@ aue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, - &sc->sc_setmulti); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 01:03:30 2010 (r213537) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 01:17:22 2010 (r213538) @@ -1297,8 +1297,7 @@ axe_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, - &sc->sc_setmulti); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 01:03:30 2010 (r213537) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 01:17:22 2010 (r213538) @@ -777,8 +777,7 @@ cue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, - &sc->sc_setmulti); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); break; default: error = ether_ioctl(ifp, command, data); Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 01:03:30 2010 (r213537) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 01:17:22 2010 (r213538) @@ -821,8 +821,7 @@ kue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, - &sc->sc_setmulti); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); break; default: error = ether_ioctl(ifp, command, data); Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 01:03:30 2010 (r213537) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 01:17:22 2010 (r213538) @@ -1055,8 +1055,7 @@ rue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, - &sc->sc_setmulti); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 01:03:30 2010 (r213537) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 01:17:22 2010 (r213538) @@ -993,8 +993,7 @@ udav_ioctl(struct ifnet *ifp, u_long com case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, - &sc->sc_setmulti); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/usb_sleepout.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_sleepout.h Fri Oct 8 01:03:30 2010 (r213537) +++ user/weongyo/usb/sys/dev/usb/usb_sleepout.h Fri Oct 8 01:17:22 2010 (r213538) @@ -35,6 +35,9 @@ struct sleepout_task { void *st_arg; }; +#define SLEEPOUT_RUN_TASK(_so, _task) \ + taskqueue_enqueue((_so)->s_taskqueue, (_task)) + void sleepout_create(struct sleepout *, const char *); void sleepout_free(struct sleepout *); void sleepout_init(struct sleepout *, struct sleepout_task *, int); From owner-svn-src-user@FreeBSD.ORG Fri Oct 8 01:52:01 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B50131065670; Fri, 8 Oct 2010 01:52:01 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1C8C8FC1D; Fri, 8 Oct 2010 01:52:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o981q1gx074419; Fri, 8 Oct 2010 01:52:01 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o981q1gJ074407; Fri, 8 Oct 2010 01:52:01 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010080152.o981q1gJ074407@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 8 Oct 2010 01:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213540 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 01:52:01 -0000 Author: weongyo Date: Fri Oct 8 01:52:01 2010 New Revision: 213540 URL: http://svn.freebsd.org/changeset/base/213540 Log: o fixes a regression that setting the promiscuous mode should be happened at the taskqueue. It's to avoid a `sleepable after non-sleepable' because ioctl handler could be called with holding bpf mtx which is a default mutex. o defines SLEEPOUT_DRAIN_TASK helper. Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_auereg.h user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_axereg.h user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_cuereg.h user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_ruereg.h user/weongyo/usb/sys/dev/usb/net/if_udav.c user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:52:01 2010 (r213540) @@ -230,7 +230,8 @@ static void aue_setmulti_locked(struct a static void aue_rxflush(struct aue_softc *); static int aue_rxbuf(struct aue_softc *, struct usb_page_cache *, unsigned int, unsigned int); -static void aue_setpromisc(struct aue_softc *); +static void aue_setpromisc(void *, int); +static void aue_setpromisc_locked(struct aue_softc *); static void aue_init_locked(struct aue_softc *); static void aue_watchdog(void *); @@ -709,6 +710,7 @@ aue_attach(device_t dev) sleepout_create(&sc->sc_sleepout, "aue sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setmulti, 0, aue_setmulti, sc); + TASK_INIT(&sc->sc_setpromisc, 0, aue_setpromisc, sc); iface_index = AUE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, @@ -764,7 +766,8 @@ aue_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER); if (sc->sc_miibus != NULL) @@ -1032,7 +1035,7 @@ aue_init_locked(struct aue_softc *sc) aue_csr_write_1(sc, AUE_PAR0 + i, IF_LLADDR(ifp)[i]); /* update promiscuous setting */ - aue_setpromisc(sc); + aue_setpromisc_locked(sc); /* Load the multicast filter. */ aue_setmulti_locked(sc); @@ -1050,7 +1053,17 @@ aue_init_locked(struct aue_softc *sc) } static void -aue_setpromisc(struct aue_softc *sc) +aue_setpromisc(void *arg, int npending) +{ + struct aue_softc *sc = arg; + + AUE_LOCK(sc); + aue_setpromisc_locked(sc); + AUE_UNLOCK(sc); +} + +static void +aue_setpromisc_locked(struct aue_softc *sc) { struct ifnet *ifp = sc->sc_ifp; @@ -1140,7 +1153,8 @@ aue_ioctl(struct ifnet *ifp, u_long comm AUE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - aue_setpromisc(sc); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + &sc->sc_setpromisc); else aue_init_locked(sc); } else Modified: user/weongyo/usb/sys/dev/usb/net/if_auereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct 8 01:52:01 2010 (r213540) @@ -222,6 +222,7 @@ struct aue_softc { struct sleepout sc_sleepout; struct sleepout_task sc_watchdog; struct task sc_setmulti; + struct task sc_setpromisc; }; #define AUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 01:52:01 2010 (r213540) @@ -206,6 +206,8 @@ static void axe_start_locked(struct ifne static void axe_tick(struct axe_softc *); static void axe_stop(struct axe_softc *); static void axe_setmulti_locked(struct axe_softc *); +static void axe_setpromisc(void *, int); +static void axe_setpromisc_locked(struct axe_softc *); static const struct usb_config axe_config[AXE_N_TRANSFER] = { [AXE_BULK_DT_WR] = { @@ -787,6 +789,7 @@ axe_attach(device_t dev) sleepout_create(&sc->sc_sleepout, "axe sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setmulti, 0, axe_setmulti, sc); + TASK_INIT(&sc->sc_setpromisc, 0, axe_setpromisc, sc); iface_index = AXE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, @@ -846,7 +849,8 @@ axe_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER); if (sc->sc_miibus != NULL) @@ -1232,7 +1236,17 @@ axe_init_locked(struct axe_softc *sc) } static void -axe_setpromisc(struct axe_softc *sc) +axe_setpromisc(void *arg, int npending) +{ + struct axe_softc *sc = arg; + + AXE_LOCK(sc); + axe_setpromisc_locked(sc); + AXE_UNLOCK(sc); +} + +static void +axe_setpromisc_locked(struct axe_softc *sc) { struct ifnet *ifp = sc->sc_ifp; uint16_t rxmode; @@ -1286,7 +1300,8 @@ axe_ioctl(struct ifnet *ifp, u_long comm AXE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - axe_setpromisc(sc); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + &sc->sc_setpromisc); else axe_init_locked(sc); } else Modified: user/weongyo/usb/sys/dev/usb/net/if_axereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axereg.h Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_axereg.h Fri Oct 8 01:52:01 2010 (r213540) @@ -210,6 +210,7 @@ struct axe_softc { struct sleepout sc_sleepout; struct sleepout_task sc_watchdog; struct task sc_setmulti; + struct task sc_setpromisc; int sc_phyno; int sc_flags; Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 01:52:01 2010 (r213540) @@ -131,6 +131,8 @@ static int cue_rxbuf(struct cue_softc *, static void cue_rxflush(struct cue_softc *); static void cue_stop(struct cue_softc *); static void cue_watchdog(void *); +static void cue_setpromisc(void *, int); +static void cue_setpromisc_locked(struct cue_softc *); #ifdef USB_DEBUG static int cue_debug = 0; @@ -286,7 +288,17 @@ cue_mchash(const uint8_t *addr) } static void -cue_setpromisc(struct cue_softc *sc) +cue_setpromisc(void *arg, int npending) +{ + struct cue_softc *sc = arg; + + CUE_LOCK(sc); + cue_setpromisc_locked(sc); + CUE_UNLOCK(sc); +} + +static void +cue_setpromisc_locked(struct cue_softc *sc) { struct ifnet *ifp = sc->sc_ifp; @@ -406,6 +418,7 @@ cue_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); sleepout_create(&sc->sc_sleepout, "cue sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_setpromisc, 0, cue_setpromisc, sc); TASK_INIT(&sc->sc_setmulti, 0, cue_setmulti, sc); iface_index = CUE_IFACE_IDX; @@ -454,7 +467,8 @@ cue_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER); if (ifp != NULL) { CUE_LOCK(sc); @@ -643,7 +657,7 @@ cue_init_locked(struct cue_softc *sc) cue_csr_write_1(sc, CUE_ETHCTL, CUE_ETHCTL_RX_ON | CUE_ETHCTL_MCAST_ON); /* Load the multicast filter */ - cue_setpromisc(sc); + cue_setpromisc_locked(sc); /* * Set the number of RX and TX buffers that we want @@ -766,7 +780,8 @@ cue_ioctl(struct ifnet *ifp, u_long comm CUE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - cue_setpromisc(sc); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + &sc->sc_setpromisc); else cue_init_locked(sc); } else Modified: user/weongyo/usb/sys/dev/usb/net/if_cuereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Fri Oct 8 01:52:01 2010 (r213540) @@ -126,6 +126,7 @@ struct cue_softc { struct usb_xfer *sc_xfer[CUE_N_TRANSFER]; struct sleepout sc_sleepout; struct sleepout_task sc_watchdog; + struct task sc_setpromisc; struct task sc_setmulti; struct ifqueue sc_rxq; /* ethernet address from eeprom */ Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 01:52:01 2010 (r213540) @@ -527,7 +527,7 @@ kue_detach(device_t dev) struct kue_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->sc_ifp; - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER); if (ifp != NULL) { KUE_LOCK(sc); Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 01:52:01 2010 (r213540) @@ -160,6 +160,8 @@ static void rue_start(struct ifnet *); static void rue_start_locked(struct ifnet *); static void rue_stop(struct rue_softc *); static void rue_watchdog(void *); +static void rue_setpromisc(void *, int); +static void rue_setpromisc_locked(struct rue_softc *); static const struct usb_config rue_config[RUE_N_TRANSFER] = { [RUE_BULK_DT_WR] = { @@ -451,7 +453,17 @@ rue_miibus_statchg(device_t dev) } static void -rue_setpromisc(struct rue_softc *sc) +rue_setpromisc(void *arg, int npending) +{ + struct rue_softc *sc = arg; + + RUE_LOCK(sc); + rue_setpromisc_locked(sc); + RUE_UNLOCK(sc); +} + +static void +rue_setpromisc_locked(struct rue_softc *sc) { struct ifnet *ifp = sc->sc_ifp; @@ -588,6 +600,7 @@ rue_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); sleepout_create(&sc->sc_sleepout, "rue sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_setpromisc, 0, rue_setpromisc, sc); TASK_INIT(&sc->sc_setmulti, 0, rue_setmulti, sc); iface_index = RUE_IFACE_IDX; @@ -644,7 +657,8 @@ rue_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER); if (sc->sc_miibus != NULL) device_delete_child(sc->sc_dev, sc->sc_miibus); @@ -957,7 +971,7 @@ rue_init_locked(struct rue_softc *sc) rue_csr_write_2(sc, RUE_RCR, RUE_RCR_CONFIG|RUE_RCR_AB); /* Load the multicast filter */ - rue_setpromisc(sc); + rue_setpromisc_locked(sc); /* Load the multicast filter. */ rue_setmulti(sc, 0); @@ -1044,7 +1058,8 @@ rue_ioctl(struct ifnet *ifp, u_long comm RUE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - rue_setpromisc(sc); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + &sc->sc_setpromisc); else rue_init_locked(sc); } else Modified: user/weongyo/usb/sys/dev/usb/net/if_ruereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Fri Oct 8 01:52:01 2010 (r213540) @@ -178,6 +178,7 @@ struct rue_softc { struct usb_xfer *sc_xfer[RUE_N_TRANSFER]; struct sleepout sc_sleepout; struct sleepout_task sc_watchdog; + struct task sc_setpromisc; struct task sc_setmulti; struct ifqueue sc_rxq; /* ethernet address from eeprom */ Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 01:52:01 2010 (r213540) @@ -116,7 +116,8 @@ static void udav_start(struct ifnet *); static void udav_start_locked(struct ifnet *); static void udav_setmulti(void *, int); static void udav_stop(struct udav_softc *); -static void udav_setpromisc(struct udav_softc *); +static void udav_setpromisc(void *, int); +static void udav_setpromisc_locked(struct udav_softc *); static void udav_watchdog(void *); static miibus_readreg_t udav_miibus_readreg; @@ -250,6 +251,7 @@ udav_attach(device_t dev) sleepout_create(&sc->sc_sleepout, "axe sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setmulti, 0, udav_setmulti, sc); + TASK_INIT(&sc->sc_setpromisc, 0, udav_setpromisc, sc); iface_index = UDAV_IFACE_INDEX; error = usbd_transfer_setup(uaa->device, &iface_index, @@ -304,7 +306,8 @@ udav_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER); if (sc->sc_miibus != NULL) @@ -469,7 +472,7 @@ udav_init_locked(struct udav_softc *sc) UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_DIS_LONG | UDAV_RCR_DIS_CRC); /* load multicast filter and update promiscious mode bit */ - udav_setpromisc(sc); + udav_setpromisc_locked(sc); /* enable RX */ UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_RXEN); @@ -557,7 +560,17 @@ udav_setmulti(void *arg, int npending) } static void -udav_setpromisc(struct udav_softc *sc) +udav_setpromisc(void *arg, int npending) +{ + struct udav_softc *sc = arg; + + UDAV_LOCK(sc); + udav_setpromisc_locked(sc); + UDAV_UNLOCK(sc); +} + +static void +udav_setpromisc_locked(struct udav_softc *sc) { struct ifnet *ifp = sc->sc_ifp; uint8_t rxmode; @@ -982,7 +995,8 @@ udav_ioctl(struct ifnet *ifp, u_long com UDAV_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - udav_setpromisc(sc); + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + &sc->sc_setpromisc); else udav_init_locked(sc); } else Modified: user/weongyo/usb/sys/dev/usb/net/if_udavreg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Fri Oct 8 01:47:14 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Fri Oct 8 01:52:01 2010 (r213540) @@ -161,6 +161,7 @@ struct udav_softc { struct sleepout sc_sleepout; struct sleepout_task sc_watchdog; struct task sc_setmulti; + struct task sc_setpromisc; struct ifqueue sc_rxq; /* ethernet address from eeprom */ uint8_t sc_eaddr[ETHER_ADDR_LEN]; From owner-svn-src-user@FreeBSD.ORG Fri Oct 8 01:54:27 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCE771065670; Fri, 8 Oct 2010 01:54:27 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C97DD8FC14; Fri, 8 Oct 2010 01:54:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o981sRp0074542; Fri, 8 Oct 2010 01:54:27 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o981sREx074534; Fri, 8 Oct 2010 01:54:27 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010080154.o981sREx074534@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 8 Oct 2010 01:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213542 - in user/weongyo/usb/sys/dev/usb: . net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 01:54:27 -0000 Author: weongyo Date: Fri Oct 8 01:54:27 2010 New Revision: 213542 URL: http://svn.freebsd.org/changeset/base/213542 Log: A trivial macro renaming. Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_udav.c user/weongyo/usb/sys/dev/usb/usb_sleepout.h Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:53:33 2010 (r213541) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:54:27 2010 (r213542) @@ -766,8 +766,8 @@ aue_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER); if (sc->sc_miibus != NULL) @@ -1153,7 +1153,7 @@ aue_ioctl(struct ifnet *ifp, u_long comm AUE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else aue_init_locked(sc); @@ -1165,7 +1165,7 @@ aue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 01:53:33 2010 (r213541) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 01:54:27 2010 (r213542) @@ -849,8 +849,8 @@ axe_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER); if (sc->sc_miibus != NULL) @@ -1300,7 +1300,7 @@ axe_ioctl(struct ifnet *ifp, u_long comm AXE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else axe_init_locked(sc); @@ -1312,7 +1312,7 @@ axe_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 01:53:33 2010 (r213541) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 01:54:27 2010 (r213542) @@ -467,8 +467,8 @@ cue_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER); if (ifp != NULL) { CUE_LOCK(sc); @@ -780,7 +780,7 @@ cue_ioctl(struct ifnet *ifp, u_long comm CUE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else cue_init_locked(sc); @@ -792,7 +792,7 @@ cue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); break; default: error = ether_ioctl(ifp, command, data); Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 01:53:33 2010 (r213541) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 01:54:27 2010 (r213542) @@ -527,7 +527,7 @@ kue_detach(device_t dev) struct kue_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->sc_ifp; - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER); if (ifp != NULL) { KUE_LOCK(sc); @@ -821,7 +821,7 @@ kue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); break; default: error = ether_ioctl(ifp, command, data); Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 01:53:33 2010 (r213541) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 01:54:27 2010 (r213542) @@ -657,8 +657,8 @@ rue_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER); if (sc->sc_miibus != NULL) device_delete_child(sc->sc_dev, sc->sc_miibus); @@ -1058,7 +1058,7 @@ rue_ioctl(struct ifnet *ifp, u_long comm RUE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else rue_init_locked(sc); @@ -1070,7 +1070,7 @@ rue_ioctl(struct ifnet *ifp, u_long comm case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 01:53:33 2010 (r213541) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 01:54:27 2010 (r213542) @@ -306,8 +306,8 @@ udav_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; sleepout_drain(&sc->sc_watchdog); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); - SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setpromisc); + SLEEPOUT_DRAINTASK(&sc->sc_sleepout, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER); if (sc->sc_miibus != NULL) @@ -995,7 +995,7 @@ udav_ioctl(struct ifnet *ifp, u_long com UDAV_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else udav_init_locked(sc); @@ -1007,7 +1007,7 @@ udav_ioctl(struct ifnet *ifp, u_long com case SIOCDELMULTI: if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) - SLEEPOUT_RUN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); + SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: user/weongyo/usb/sys/dev/usb/usb_sleepout.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_sleepout.h Fri Oct 8 01:53:33 2010 (r213541) +++ user/weongyo/usb/sys/dev/usb/usb_sleepout.h Fri Oct 8 01:54:27 2010 (r213542) @@ -35,8 +35,10 @@ struct sleepout_task { void *st_arg; }; -#define SLEEPOUT_RUN_TASK(_so, _task) \ +#define SLEEPOUT_RUNTASK(_so, _task) \ taskqueue_enqueue((_so)->s_taskqueue, (_task)) +#define SLEEPOUT_DRAINTASK(_so, _task) \ + taskqueue_drain((_so)->s_taskqueue, (_task)) void sleepout_create(struct sleepout *, const char *); void sleepout_free(struct sleepout *); From owner-svn-src-user@FreeBSD.ORG Fri Oct 8 20:34:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C536106566B; Fri, 8 Oct 2010 20:34:24 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CB868FC0C; Fri, 8 Oct 2010 20:34:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o98KYOc6012948; Fri, 8 Oct 2010 20:34:24 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o98KYOFV012941; Fri, 8 Oct 2010 20:34:24 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010082034.o98KYOFV012941@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 8 Oct 2010 20:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213617 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 20:34:24 -0000 Author: weongyo Date: Fri Oct 8 20:34:23 2010 New Revision: 213617 URL: http://svn.freebsd.org/changeset/base/213617 Log: Adds a comment why the taskqueue is used. Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_udav.c Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 20:33:43 2010 (r213616) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 20:34:23 2010 (r213617) @@ -1163,6 +1163,7 @@ aue_ioctl(struct ifnet *ifp, u_long comm break; case SIOCADDMULTI: case SIOCDELMULTI: + /* To avoid LOR by in_multi_mtx (netinet/in_mcast.c) */ if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 20:33:43 2010 (r213616) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 20:34:23 2010 (r213617) @@ -1310,6 +1310,7 @@ axe_ioctl(struct ifnet *ifp, u_long comm break; case SIOCADDMULTI: case SIOCDELMULTI: + /* To avoid LOR by in_multi_mtx (netinet/in_mcast.c) */ if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 20:33:43 2010 (r213616) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 20:34:23 2010 (r213617) @@ -790,6 +790,7 @@ cue_ioctl(struct ifnet *ifp, u_long comm break; case SIOCADDMULTI: case SIOCDELMULTI: + /* To avoid LOR by in_multi_mtx (netinet/in_mcast.c) */ if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 20:33:43 2010 (r213616) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 20:34:23 2010 (r213617) @@ -819,6 +819,7 @@ kue_ioctl(struct ifnet *ifp, u_long comm break; case SIOCADDMULTI: case SIOCDELMULTI: + /* To avoid LOR by in_multi_mtx (netinet/in_mcast.c) */ if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 20:33:43 2010 (r213616) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 20:34:23 2010 (r213617) @@ -1068,6 +1068,7 @@ rue_ioctl(struct ifnet *ifp, u_long comm break; case SIOCADDMULTI: case SIOCDELMULTI: + /* To avoid LOR by in_multi_mtx (netinet/in_mcast.c) */ if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 20:33:43 2010 (r213616) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 20:34:23 2010 (r213617) @@ -1005,6 +1005,7 @@ udav_ioctl(struct ifnet *ifp, u_long com break; case SIOCADDMULTI: case SIOCDELMULTI: + /* To avoid LOR by in_multi_mtx (netinet/in_mcast.c) */ if (ifp->if_flags & IFF_UP && ifp->if_drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setmulti); From owner-svn-src-user@FreeBSD.ORG Fri Oct 8 21:54:34 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AB4B1065672; Fri, 8 Oct 2010 21:54:34 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A73F8FC18; Fri, 8 Oct 2010 21:54:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o98LsYmv015497; Fri, 8 Oct 2010 21:54:34 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o98LsXlA015481; Fri, 8 Oct 2010 21:54:33 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010082154.o98LsXlA015481@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 8 Oct 2010 21:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213633 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 21:54:34 -0000 Author: weongyo Date: Fri Oct 8 21:54:33 2010 New Revision: 213633 URL: http://svn.freebsd.org/changeset/base/213633 Log: Fixes a regression that device up and down wasn't synchronous. To make it synchronous sx(9) is used only for up / down cases though in the previous the taskqueue was used. Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_auereg.h user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_axereg.h user/weongyo/usb/sys/dev/usb/net/if_cdce.c user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_cuereg.h user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_kuereg.h user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_ruereg.h user/weongyo/usb/sys/dev/usb/net/if_udav.c user/weongyo/usb/sys/dev/usb/net/if_udavreg.h user/weongyo/usb/sys/dev/usb/net/uhso.c Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 21:54:33 2010 (r213633) @@ -225,6 +225,7 @@ static int aue_ioctl(struct ifnet *, u_l static void aue_start(struct ifnet *); static void aue_start_locked(struct ifnet *); static void aue_init(void *); +static void aue_stop_locked(struct aue_softc *); static void aue_setmulti(void *, int); static void aue_setmulti_locked(struct aue_softc *); static void aue_rxflush(struct aue_softc *); @@ -707,6 +708,7 @@ aue_attach(device_t dev) sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sx_init(&sc->sc_sx, "aue sxlock"); sleepout_create(&sc->sc_sleepout, "aue sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setmulti, 0, aue_setmulti, sc); @@ -780,6 +782,7 @@ aue_detach(device_t dev) if_free(ifp); } sleepout_free(&sc->sc_sleepout); + sx_destroy(&sc->sc_sx); mtx_destroy(&sc->sc_mtx); return (0); @@ -1012,9 +1015,11 @@ aue_init(void *arg) { struct aue_softc *sc = arg; + AUE_SXLOCK(sc); AUE_LOCK(sc); aue_init_locked(sc); AUE_UNLOCK(sc); + AUE_SXUNLOCK(sc); } static void @@ -1121,6 +1126,17 @@ aue_ifmedia_sts(struct ifnet *ifp, struc static void aue_stop(struct aue_softc *sc) { + + AUE_SXLOCK(sc); + AUE_LOCK(sc); + aue_stop_locked(sc); + AUE_UNLOCK(sc); + AUE_SXUNLOCK(sc); +} + +static void +aue_stop_locked(struct aue_softc *sc) +{ struct ifnet *ifp = sc->sc_ifp; AUE_LOCK_ASSERT(sc, MA_OWNED); @@ -1146,20 +1162,24 @@ aue_ioctl(struct ifnet *ifp, u_long comm struct aue_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct mii_data *mii = GET_MII(sc); - int error = 0; + int error = 0, drv_flags, flags; switch (command) { case SIOCSIFFLAGS: + /* Avoids race and LOR between mutex and sx lock. */ AUE_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + AUE_UNLOCK(sc); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if (drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else - aue_init_locked(sc); + aue_init(sc); } else aue_stop(sc); - AUE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: user/weongyo/usb/sys/dev/usb/net/if_auereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct 8 21:54:33 2010 (r213633) @@ -208,6 +208,7 @@ struct aue_softc { struct usb_device *sc_udev; /* used by uether_do_request() */ struct usb_xfer *sc_xfer[AUE_N_TRANSFER]; struct mtx sc_mtx; + struct sx sc_sx; struct ifqueue sc_rxq; /* ethernet address from eeprom */ uint8_t sc_eaddr[ETHER_ADDR_LEN]; @@ -225,6 +226,8 @@ struct aue_softc { struct task sc_setpromisc; }; +#define AUE_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define AUE_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) #define AUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define AUE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define AUE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 21:54:33 2010 (r213633) @@ -205,6 +205,7 @@ static void axe_start(struct ifnet *); static void axe_start_locked(struct ifnet *); static void axe_tick(struct axe_softc *); static void axe_stop(struct axe_softc *); +static void axe_stop_locked(struct axe_softc *); static void axe_setmulti_locked(struct axe_softc *); static void axe_setpromisc(void *, int); static void axe_setpromisc_locked(struct axe_softc *); @@ -786,6 +787,7 @@ axe_attach(device_t dev) sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sx_init(&sc->sc_sx, "axe sxlock"); sleepout_create(&sc->sc_sleepout, "axe sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setmulti, 0, axe_setmulti, sc); @@ -863,6 +865,7 @@ axe_detach(device_t dev) if_free(ifp); } sleepout_free(&sc->sc_sleepout); + sx_destroy(&sc->sc_sx); mtx_destroy(&sc->sc_mtx); return (0); @@ -1169,9 +1172,11 @@ axe_init(void *arg) { struct axe_softc *sc = arg; + AXE_SXLOCK(sc); AXE_LOCK(sc); axe_init_locked(sc); AXE_UNLOCK(sc); + AXE_SXUNLOCK(sc); } static void @@ -1183,7 +1188,7 @@ axe_init_locked(struct axe_softc *sc) AXE_LOCK_ASSERT(sc, MA_OWNED); /* Cancel pending I/O */ - axe_stop(sc); + axe_stop_locked(sc); /* Set MAC address. */ if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) @@ -1268,6 +1273,17 @@ axe_setpromisc_locked(struct axe_softc * static void axe_stop(struct axe_softc *sc) { + + AXE_SXLOCK(sc); + AXE_LOCK(sc); + axe_stop_locked(sc); + AXE_UNLOCK(sc); + AXE_SXUNLOCK(sc); +} + +static void +axe_stop_locked(struct axe_softc *sc) +{ struct ifnet *ifp = sc->sc_ifp; AXE_LOCK_ASSERT(sc, MA_OWNED); @@ -1293,20 +1309,24 @@ axe_ioctl(struct ifnet *ifp, u_long comm struct axe_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct mii_data *mii = GET_MII(sc); - int error = 0; + int error = 0, drv_flags, flags; switch (command) { case SIOCSIFFLAGS: + /* Avoids race and LOR between mutex and sx lock. */ AXE_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + AXE_UNLOCK(sc); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if (drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else - axe_init_locked(sc); + axe_init(sc); } else axe_stop(sc); - AXE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: user/weongyo/usb/sys/dev/usb/net/if_axereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axereg.h Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_axereg.h Fri Oct 8 21:54:33 2010 (r213633) @@ -201,6 +201,7 @@ struct axe_softc { device_t sc_miibus; struct usb_device *sc_udev; /* used by uether_do_request() */ struct mtx sc_mtx; + struct sx sc_sx; struct usb_xfer *sc_xfer[AXE_N_TRANSFER]; /* ethernet address from eeprom */ @@ -221,6 +222,8 @@ struct axe_softc { uint8_t sc_phyaddrs[2]; }; +#define AXE_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define AXE_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) #define AXE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define AXE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define AXE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdce.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_cdce.c Fri Oct 8 21:54:33 2010 (r213633) @@ -111,6 +111,7 @@ static void cdce_start(struct ifnet *); static void cdce_start_locked(struct ifnet *); static void cdce_init(void *); static void cdce_init_locked(struct cdce_softc *); +static void cdce_stop_locked(struct cdce_softc *); static int cdce_rxmbuf(struct cdce_softc *, struct mbuf *, unsigned int); static struct mbuf *cdce_newbuf(void); static void cdce_rxflush(struct cdce_softc *); @@ -446,6 +447,7 @@ cdce_attach(device_t dev) sc->sc_flags = USB_GET_DRIVER_INFO(uaa); mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sx_init(&sc->sc_sx, "cdce sxlock"); ud = usbd_find_descriptor (uaa->device, NULL, uaa->info.bIfaceIndex, @@ -615,6 +617,7 @@ cdce_detach(device_t dev) ether_ifdetach(ifp); if_free(ifp); } + sx_destroy(&sc->sc_sx); mtx_destroy(&sc->sc_mtx); return (0); } @@ -773,9 +776,11 @@ cdce_init(void *arg) { struct cdce_softc *sc = arg; + CDCE_SXLOCK(sc); CDCE_LOCK(sc); cdce_init_locked(sc); CDCE_UNLOCK(sc); + CDCE_SXUNLOCK(sc); } static void @@ -801,6 +806,17 @@ cdce_init_locked(struct cdce_softc *sc) static void cdce_stop(struct cdce_softc *sc) { + + CDCE_SXLOCK(sc); + CDCE_LOCK(sc); + cdce_stop_locked(sc); + CDCE_UNLOCK(sc); + CDCE_SXUNLOCK(sc); +} + +static void +cdce_stop_locked(struct cdce_softc *sc) +{ struct ifnet *ifp = sc->sc_ifp; CDCE_LOCK_ASSERT(sc, MA_OWNED); @@ -1333,17 +1349,21 @@ static int cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct cdce_softc *sc = ifp->if_softc; - int error = 0; + int error = 0, drv_flags, flags; switch (command) { case SIOCSIFFLAGS: + /* Avoids race and LOR between mutex and sx lock. */ CDCE_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - cdce_init_locked(sc); + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + CDCE_UNLOCK(sc); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if ((drv_flags & IFF_DRV_RUNNING) == 0) + cdce_init(sc); } else cdce_stop(sc); - CDCE_UNLOCK(sc); break; default: error = ether_ioctl(ifp, command, data); Modified: user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h Fri Oct 8 21:54:33 2010 (r213633) @@ -75,6 +75,7 @@ struct cdce_softc { device_t sc_dev; struct usb_device *sc_udev; /* used by uether_do_request() */ struct mtx sc_mtx; + struct sx sc_sx; struct usb_xfer *sc_xfer[CDCE_N_TRANSFER]; struct ifqueue sc_rxq; /* ethernet address from eeprom */ @@ -92,6 +93,8 @@ struct cdce_softc { uint8_t sc_ifaces_index[2]; }; +#define CDCE_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define CDCE_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) #define CDCE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define CDCE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define CDCE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 21:54:33 2010 (r213633) @@ -130,6 +130,7 @@ static int cue_rxbuf(struct cue_softc *, unsigned int, unsigned int); static void cue_rxflush(struct cue_softc *); static void cue_stop(struct cue_softc *); +static void cue_stop_locked(struct cue_softc *); static void cue_watchdog(void *); static void cue_setpromisc(void *, int); static void cue_setpromisc_locked(struct cue_softc *); @@ -416,6 +417,7 @@ cue_attach(device_t dev) sc->sc_dev = dev; sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sx_init(&sc->sc_sx, "cue sxlock"); sleepout_create(&sc->sc_sleepout, "cue sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setpromisc, 0, cue_setpromisc, sc); @@ -478,6 +480,7 @@ cue_detach(device_t dev) if_free(ifp); } sleepout_free(&sc->sc_sleepout); + sx_destroy(&sc->sc_sx); mtx_destroy(&sc->sc_mtx); return (0); @@ -629,9 +632,11 @@ cue_init(void *arg) { struct cue_softc *sc = arg; + CUE_SXLOCK(sc); CUE_LOCK(sc); cue_init_locked(sc); CUE_UNLOCK(sc); + CUE_SXUNLOCK(sc); } static void @@ -645,7 +650,7 @@ cue_init_locked(struct cue_softc *sc) /* * Cancel pending I/O and free all RX/TX buffers. */ - cue_stop(sc); + cue_stop_locked(sc); #if 0 cue_reset(sc); #endif @@ -687,6 +692,17 @@ cue_init_locked(struct cue_softc *sc) static void cue_stop(struct cue_softc *sc) { + + CUE_SXLOCK(sc); + CUE_LOCK(sc); + cue_stop_locked(sc); + CUE_UNLOCK(sc); + CUE_SXUNLOCK(sc); +} + +static void +cue_stop_locked(struct cue_softc *sc) +{ struct ifnet *ifp = sc->sc_ifp; CUE_LOCK_ASSERT(sc, MA_OWNED); @@ -773,20 +789,24 @@ static int cue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct cue_softc *sc = ifp->if_softc; - int error = 0; + int error = 0, drv_flags, flags; switch (command) { case SIOCSIFFLAGS: + /* Avoids race and LOR between mutex and sx lock. */ CUE_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + CUE_UNLOCK(sc); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if (drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else - cue_init_locked(sc); + cue_init(sc); } else cue_stop(sc); - CUE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: user/weongyo/usb/sys/dev/usb/net/if_cuereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Fri Oct 8 21:54:33 2010 (r213633) @@ -121,6 +121,7 @@ enum { struct cue_softc { struct ifnet *sc_ifp; struct mtx sc_mtx; + struct sx sc_sx; device_t sc_dev; struct usb_device *sc_udev; /* used by uether_do_request() */ struct usb_xfer *sc_xfer[CUE_N_TRANSFER]; @@ -135,6 +136,8 @@ struct cue_softc { #define CUE_FLAG_LINK 0x0001 /* got a link */ }; +#define CUE_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define CUE_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) #define CUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define CUE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define CUE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 21:54:33 2010 (r213633) @@ -166,6 +166,7 @@ static int kue_load_fw(struct kue_softc static void kue_reset(struct kue_softc *); static void kue_init(void *); static void kue_init_locked(struct kue_softc *); +static void kue_stop_locked(struct kue_softc *); static int kue_ioctl(struct ifnet *, u_long, caddr_t); static void kue_start(struct ifnet *); static void kue_start_locked(struct ifnet *); @@ -472,6 +473,7 @@ kue_attach(device_t dev) sc->sc_dev = dev; sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sx_init(&sc->sc_sx, "kue sxlock"); sleepout_create(&sc->sc_sleepout, "kue sleepout"); TASK_INIT(&sc->sc_setmulti, 0, kue_setmulti, sc); @@ -537,6 +539,7 @@ kue_detach(device_t dev) if_free(ifp); } sleepout_free(&sc->sc_sleepout); + sx_destroy(&sc->sc_sx); mtx_destroy(&sc->sc_mtx); free(sc->sc_mcfilters, M_USBDEV); @@ -750,9 +753,11 @@ kue_init(void *arg) { struct kue_softc *sc = arg; + KUE_SXLOCK(sc); KUE_LOCK(sc); kue_init_locked(sc); KUE_UNLOCK(sc); + KUE_SXUNLOCK(sc); } static void @@ -788,6 +793,17 @@ kue_init_locked(struct kue_softc *sc) static void kue_stop(struct kue_softc *sc) { + + KUE_SXLOCK(sc); + KUE_LOCK(sc); + kue_stop_locked(sc); + KUE_UNLOCK(sc); + KUE_SXUNLOCK(sc); +} + +static void +kue_stop_locked(struct kue_softc *sc) +{ struct ifnet *ifp = sc->sc_ifp; KUE_LOCK_ASSERT(sc, MA_OWNED); @@ -805,17 +821,21 @@ static int kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct kue_softc *sc = ifp->if_softc; - int error = 0; + int error = 0, drv_flags, flags; switch (command) { case SIOCSIFFLAGS: + /* Avoids race and LOR between mutex and sx lock. */ KUE_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - kue_init_locked(sc); + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + KUE_UNLOCK(sc); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if ((drv_flags & IFF_DRV_RUNNING) == 0) + kue_init(sc); } else kue_stop(sc); - KUE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: user/weongyo/usb/sys/dev/usb/net/if_kuereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Fri Oct 8 21:54:33 2010 (r213633) @@ -129,6 +129,7 @@ struct kue_softc { struct usb_device *sc_udev; /* used by uether_do_request() */ struct usb_xfer *sc_xfer[KUE_N_TRANSFER]; struct mtx sc_mtx; + struct sx sc_sx; struct sleepout sc_sleepout; struct task sc_setmulti; struct ifqueue sc_rxq; @@ -141,6 +142,8 @@ struct kue_softc { uint16_t sc_rxfilt; }; +#define KUE_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define KUE_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) #define KUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define KUE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define KUE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 21:54:33 2010 (r213633) @@ -159,6 +159,7 @@ static int rue_ioctl(struct ifnet *, u_l static void rue_start(struct ifnet *); static void rue_start_locked(struct ifnet *); static void rue_stop(struct rue_softc *); +static void rue_stop_locked(struct rue_softc *); static void rue_watchdog(void *); static void rue_setpromisc(void *, int); static void rue_setpromisc_locked(struct rue_softc *); @@ -942,9 +943,11 @@ rue_init(void *arg) { struct rue_softc *sc = arg; + RUE_SXLOCK(sc); RUE_LOCK(sc); rue_init_locked(sc); RUE_UNLOCK(sc); + RUE_SXUNLOCK(sc); } static void @@ -962,7 +965,7 @@ rue_init_locked(struct rue_softc *sc) /* Set MAC address */ rue_write_mem(sc, RUE_IDR0, IF_LLADDR(ifp), ETHER_ADDR_LEN); - rue_stop(sc); + rue_stop_locked(sc); /* * Set the initial TX and RX configuration. @@ -1026,6 +1029,17 @@ rue_ifmedia_sts(struct ifnet *ifp, struc static void rue_stop(struct rue_softc *sc) { + + RUE_SXLOCK(sc); + RUE_LOCK(sc); + rue_stop_locked(sc); + RUE_UNLOCK(sc); + RUE_SXUNLOCK(sc); +} + +static void +rue_stop_locked(struct rue_softc *sc) +{ struct ifnet *ifp = sc->sc_ifp; RUE_LOCK_ASSERT(sc, MA_OWNED); @@ -1051,20 +1065,24 @@ rue_ioctl(struct ifnet *ifp, u_long comm struct rue_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct mii_data *mii = GET_MII(sc); - int error = 0; + int error = 0, drv_flags, flags; switch (command) { case SIOCSIFFLAGS: + /* Avoids race and LOR between mutex and sx lock. */ RUE_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + RUE_UNLOCK(sc); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if (drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else - rue_init_locked(sc); + rue_init(sc); } else rue_stop(sc); - RUE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: user/weongyo/usb/sys/dev/usb/net/if_ruereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Fri Oct 8 21:54:33 2010 (r213633) @@ -174,6 +174,7 @@ struct rue_softc { device_t sc_dev; device_t sc_miibus; struct mtx sc_mtx; + struct sx sc_sx; struct usb_device *sc_udev; /* used by uether_do_request() */ struct usb_xfer *sc_xfer[RUE_N_TRANSFER]; struct sleepout sc_sleepout; @@ -187,6 +188,8 @@ struct rue_softc { #define RUE_FLAG_LINK 0x0001 }; +#define RUE_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define RUE_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) #define RUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define RUE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define RUE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 21:54:33 2010 (r213633) @@ -111,6 +111,7 @@ static int udav_ifmedia_upd(struct ifnet static void udav_ifmedia_status(struct ifnet *, struct ifmediareq *); static void udav_init(void *); static void udav_init_locked(struct udav_softc *); +static void udav_stop_locked(struct udav_softc *); static int udav_ioctl(struct ifnet *, u_long, caddr_t); static void udav_start(struct ifnet *); static void udav_start_locked(struct ifnet *); @@ -248,6 +249,7 @@ udav_attach(device_t dev) sc->sc_udev = uaa->device; sc->sc_flags = USB_GET_DRIVER_INFO(uaa); mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sx_init(&sc->sc_sx, "udav sxlock"); sleepout_create(&sc->sc_sleepout, "axe sleepout"); sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setmulti, 0, udav_setmulti, sc); @@ -320,6 +322,7 @@ udav_detach(device_t dev) if_free(ifp); } sleepout_free(&sc->sc_sleepout); + sx_destroy(&sc->sc_sx); mtx_destroy(&sc->sc_mtx); return (0); @@ -443,9 +446,11 @@ udav_init(void *arg) { struct udav_softc *sc = arg; + UDAV_SXLOCK(sc); UDAV_LOCK(sc); udav_init_locked(sc); UDAV_UNLOCK(sc); + UDAV_SXUNLOCK(sc); } static void @@ -458,7 +463,7 @@ udav_init_locked(struct udav_softc *sc) /* * Cancel pending I/O */ - udav_stop(sc); + udav_stop_locked(sc); /* set MAC address */ udav_csr_write(sc, UDAV_PAR, IF_LLADDR(ifp), ETHER_ADDR_LEN); @@ -832,6 +837,17 @@ tr_setup: static void udav_stop(struct udav_softc *sc) { + + UDAV_SXLOCK(sc); + UDAV_LOCK(sc); + udav_stop_locked(sc); + UDAV_UNLOCK(sc); + UDAV_SXUNLOCK(sc); +} + +static void +udav_stop_locked(struct udav_softc *sc) +{ struct ifnet *ifp = sc->sc_ifp; UDAV_LOCK_ASSERT(sc, MA_OWNED); @@ -988,20 +1004,24 @@ udav_ioctl(struct ifnet *ifp, u_long com struct udav_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct mii_data *mii = GET_MII(sc); - int error = 0; + int error = 0, drv_flags, flags; switch (command) { case SIOCSIFFLAGS: + /* Avoids race and LOR between mutex and sx lock. */ UDAV_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + UDAV_UNLOCK(sc); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if (drv_flags & IFF_DRV_RUNNING) SLEEPOUT_RUNTASK(&sc->sc_sleepout, &sc->sc_setpromisc); else - udav_init_locked(sc); + udav_init(sc); } else udav_stop(sc); - UDAV_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: user/weongyo/usb/sys/dev/usb/net/if_udavreg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Fri Oct 8 21:54:33 2010 (r213633) @@ -158,6 +158,7 @@ struct udav_softc { struct usb_device *sc_udev; struct usb_xfer *sc_xfer[UDAV_N_TRANSFER]; struct mtx sc_mtx; + struct sx sc_sx; struct sleepout sc_sleepout; struct sleepout_task sc_watchdog; struct task sc_setmulti; @@ -170,6 +171,8 @@ struct udav_softc { #define UDAV_FLAG_EXT_PHY 0x0040 }; +#define UDAV_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define UDAV_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) #define UDAV_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define UDAV_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define UDAV_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) Modified: user/weongyo/usb/sys/dev/usb/net/uhso.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/uhso.c Fri Oct 8 21:29:48 2010 (r213632) +++ user/weongyo/usb/sys/dev/usb/net/uhso.c Fri Oct 8 21:54:33 2010 (r213633) @@ -78,6 +78,7 @@ struct uhso_softc { device_t sc_dev; struct usb_device *sc_udev; struct mtx sc_mtx; + struct sx sc_sx; uint32_t sc_type; /* Interface definition */ int sc_radio; @@ -106,6 +107,9 @@ struct uhso_softc { int sc_line; }; +#define UHSO_SXLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#define UHSO_SXUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) + #define UHSO_MAX_MTU 2048 /* @@ -461,6 +465,7 @@ static void uhso_ucom_cfg_set_rts(struct static void uhso_if_init(void *); static void uhso_if_start(struct ifnet *); static void uhso_if_stop(struct uhso_softc *); +static void uhso_if_stop_locked(struct uhso_softc *); static int uhso_if_ioctl(struct ifnet *, u_long, caddr_t); static int uhso_if_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct route *); @@ -548,6 +553,7 @@ uhso_attach(device_t self) sc->sc_dev = self; sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, "uhso", NULL, MTX_DEF); + sx_init(&sc->sc_sx, "uhso sxlock"); sc->sc_ucom = NULL; sc->sc_ttys = 0; @@ -681,7 +687,7 @@ uhso_detach(device_t self) callout_drain(&sc->sc_c); free_unr(uhso_ifnet_unit, sc->sc_ifp->if_dunit); mtx_lock(&sc->sc_mtx); - uhso_if_stop(sc); + uhso_if_stop_locked(sc); bpfdetach(sc->sc_ifp); if_detach(sc->sc_ifp); if_free(sc->sc_ifp); @@ -689,6 +695,7 @@ uhso_detach(device_t self) usbd_transfer_unsetup(sc->sc_if_xfer, UHSO_IFNET_MAX); } + sx_destroy(&sc->sc_sx); mtx_destroy(&sc->sc_mtx); return (0); } @@ -1801,21 +1808,25 @@ static int uhso_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct uhso_softc *sc; + int drv_flags, flags; sc = ifp->if_softc; switch (cmd) { case SIOCSIFFLAGS: - if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + /* Avoids race and LOR between mutex and sx lock. */ + mtx_lock(&sc->sc_mtx); + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; + mtx_unlock(&sc->sc_mtx); + /* device up and down is synchronous using sx(9) lock */ + if (flags & IFF_UP) { + if (!(drv_flags & IFF_DRV_RUNNING)) uhso_if_init(sc); } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - mtx_lock(&sc->sc_mtx); + if (drv_flags & IFF_DRV_RUNNING) uhso_if_stop(sc); - mtx_unlock(&sc->sc_mtx); - } } break; case SIOCSIFADDR: @@ -1835,12 +1846,14 @@ uhso_if_init(void *priv) struct uhso_softc *sc = priv; struct ifnet *ifp = sc->sc_ifp; + UHSO_SXLOCK(sc); mtx_lock(&sc->sc_mtx); - uhso_if_stop(sc); + uhso_if_stop_locked(sc); ifp = sc->sc_ifp; ifp->if_flags |= IFF_UP; ifp->if_drv_flags |= IFF_DRV_RUNNING; mtx_unlock(&sc->sc_mtx); + UHSO_SXUNLOCK(sc); UHSO_DPRINTF(2, "ifnet initialized\n"); } @@ -1889,6 +1902,17 @@ static void uhso_if_stop(struct uhso_softc *sc) { + UHSO_SXLOCK(sc); + mtx_lock(&sc->sc_mtx); + uhso_if_stop_locked(sc); + mtx_unlock(&sc->sc_mtx); + UHSO_SXUNLOCK(sc); +} + +static void +uhso_if_stop_locked(struct uhso_softc *sc) +{ + usbd_transfer_stop(sc->sc_if_xfer[UHSO_IFNET_READ]); usbd_transfer_stop(sc->sc_if_xfer[UHSO_IFNET_WRITE]); sc->sc_ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);