From owner-svn-src-user@FreeBSD.ORG Sat Oct 2 02:29: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 AC531106564A; Sat, 2 Oct 2010 02:29: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 9A1F58FC0A; Sat, 2 Oct 2010 02:29: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 o922TAK6024133; Sat, 2 Oct 2010 02:29:10 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o922TAma024126; Sat, 2 Oct 2010 02:29:10 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010020229.o922TAma024126@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 2 Oct 2010 02:29: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: r213343 - in user/weongyo/usb/sys/dev/usb: . controller input misc net quirk 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: Sat, 02 Oct 2010 02:29:10 -0000 Author: weongyo Date: Sat Oct 2 02:29:10 2010 New Revision: 213343 URL: http://svn.freebsd.org/changeset/base/213343 Log: no braces for single statement. Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/atmegadci.c user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.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_ixp4xx.c user/weongyo/usb/sys/dev/usb/controller/ehci_mv.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/musb_otg_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.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/controller/uss820dci_atmelarm.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/misc/udbp.c user/weongyo/usb/sys/dev/usb/misc/ufm.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_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/usb_serial.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/template/usb_template.c user/weongyo/usb/sys/dev/usb/template/usb_template_cdce.c user/weongyo/usb/sys/dev/usb/template/usb_template_msc.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_debug.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_mbuf.c user/weongyo/usb/sys/dev/usb/usb_msctest.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 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 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 Sat Oct 2 01:29:09 2010 (r213342) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci.c Sat Oct 2 02:29:10 2010 (r213343) @@ -204,9 +204,8 @@ at91dci_get_hw_ep_profile(struct usb_dev if (ep_addr < AT91_UDP_EP_MAX) { *ppf = (at91dci_ep_profile + ep_addr); - } else { + } else *ppf = NULL; - } } static void @@ -216,9 +215,8 @@ at91dci_clocks_on(struct at91dci_softc * if (sc->sc_flags.clocks_off && sc->sc_flags.port_powered) { DPRINTFN(5, "\n"); - if (sc->sc_clocks_on) { + if (sc->sc_clocks_on) (sc->sc_clocks_on) (sc->sc_clocks_arg); - } sc->sc_flags.clocks_off = 0; /* enable Transceiver */ @@ -236,9 +234,8 @@ at91dci_clocks_off(struct at91dci_softc /* disable Transceiver */ AT91_UDP_WRITE_4(sc, AT91_UDP_TXVC, AT91_UDP_TXVC_DIS); - if (sc->sc_clocks_off) { + if (sc->sc_clocks_off) (sc->sc_clocks_off) (sc->sc_clocks_arg); - } sc->sc_flags.clocks_off = 1; } } @@ -270,9 +267,8 @@ static void at91dci_wakeup_peer(struct at91dci_softc *sc) { - if (!(sc->sc_flags.status_suspend)) { + if (!(sc->sc_flags.status_suspend)) return; - } AT91_UDP_WRITE_4(sc, AT91_UDP_GSTATE, AT91_UDP_GSTATE_ESR); @@ -315,9 +311,8 @@ at91dci_setup_rx(struct at91dci_td *td) AT91_UDP_CSR_RXSETUP | AT91_UDP_CSR_TXCOMP); - if (!(csr & AT91_UDP_CSR_RXSETUP)) { + if (!(csr & AT91_UDP_CSR_RXSETUP)) goto not_complete; - } /* clear did stall */ td->did_stall = 0; @@ -352,16 +347,14 @@ at91dci_setup_rx(struct at91dci_td *td) if ((req.bmRequestType == UT_WRITE_DEVICE) && (req.bRequest == UR_SET_ADDRESS)) { sc->sc_dv_addr = req.wValue[0] & 0x7F; - } else { + } else sc->sc_dv_addr = 0xFF; - } /* sneak peek the endpoint direction */ if (req.bmRequestType & UE_DIR_IN) { csr |= AT91_UDP_CSR_DIR; - } else { + } else csr &= ~AT91_UDP_CSR_DIR; - } /* write the direction of the control transfer */ AT91_CSR_ACK(csr, temp); @@ -462,9 +455,8 @@ repeat: usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ - if (buf_res.length > count) { + if (buf_res.length > count) buf_res.length = count; - } /* receive data */ bus_space_read_multi_1(td->io_tag, td->io_hdl, td->fifo_reg, buf_res.buffer, buf_res.length); @@ -507,9 +499,8 @@ repeat: } /* else need to receive a zero length packet */ } - if (--to) { + if (--to) goto repeat; - } return (1); /* not complete */ } @@ -567,9 +558,8 @@ repeat: usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ - if (buf_res.length > count) { + if (buf_res.length > count) buf_res.length = count; - } /* transmit data */ bus_space_write_multi_1(td->io_tag, td->io_hdl, td->fifo_reg, buf_res.buffer, buf_res.length); @@ -587,14 +577,12 @@ repeat: /* check remainder */ if (td->remainder == 0) { - if (td->short_pkt) { + if (td->short_pkt) return (0); /* complete */ - } /* else we need to transmit a short packet */ } - if (--to) { + if (--to) goto repeat; - } return (1); /* not complete */ } @@ -625,12 +613,10 @@ repeat: AT91_UDP_CSR_TXCOMP); /* check status */ - if (csr & AT91_UDP_CSR_TXPKTRDY) { + if (csr & AT91_UDP_CSR_TXPKTRDY) goto not_complete; - } - if (!(csr & AT91_UDP_CSR_TXCOMP)) { + if (!(csr & AT91_UDP_CSR_TXCOMP)) goto not_complete; - } sc = AT9100_DCI_PC2SC(td->pc); if (sc->sc_dv_addr != 0xFF) { /* @@ -671,9 +657,8 @@ at91dci_xfer_do_fifo(struct usb_xfer *xf /* operation in progress */ break; } - if (((void *)td) == xfer->td_transfer_last) { + if (((void *)td) == xfer->td_transfer_last) goto done; - } if (td->error) { goto done; } else if (td->remainder > 0) { @@ -681,9 +666,8 @@ at91dci_xfer_do_fifo(struct usb_xfer *xf * We had a short transfer. If there is no alternate * next, stop processing ! */ - if (!td->alt_next) { + if (!td->alt_next) goto done; - } } /* * Fetch the next transfer descriptor and transfer @@ -705,9 +689,8 @@ done: /* update FIFO bank flag and multi buffer */ if (td->fifo_bank) { sc->sc_ep_flags[temp].fifo_bank = 1; - } else { + } else sc->sc_ep_flags[temp].fifo_bank = 0; - } /* compute all actual lengths */ at91dci_standard_done(xfer); @@ -910,9 +893,8 @@ at91dci_setup_standard_chain(struct usb_ at91dci_setup_standard_chain_sub(&temp); } x = 1; - } else { + } else x = 0; - } if (x != xfer->nframes) { if (xfer->endpointno & UE_DIR_IN) { @@ -925,9 +907,8 @@ at91dci_setup_standard_chain(struct usb_ /* setup "pc" pointer */ temp.pc = xfer->frbuffers + x; - } else { + } else need_sync = 0; - } while (x != xfer->nframes) { /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -937,12 +918,10 @@ at91dci_setup_standard_chain(struct usb_ if (x == xfer->nframes) { if ((xfer->status & XFER_STATUS_CTRLXFER) != 0) { if ((xfer->status & - XFER_STATUS_CTRLACTIVE) != 0) { + XFER_STATUS_CTRLACTIVE) != 0) temp.setup_alt_next = 0; - } - } else { + } else temp.setup_alt_next = 0; - } } if (temp.len == 0) { /* make sure that we send an USB packet */ @@ -1092,9 +1071,8 @@ at91dci_standard_done_sub(struct usb_xfe */ if (len > xfer->frlengths[xfer->aframes]) { td->error = 1; - } else { + } else xfer->frlengths[xfer->aframes] -= len; - } } /* Check for transfer error */ if (td->error) { @@ -1109,9 +1087,8 @@ at91dci_standard_done_sub(struct usb_xfe /* follow alt next */ if (td->alt_next) { td = td->obj_next; - } else { + } else td = NULL; - } } else { /* the transfer is finished */ td = NULL; @@ -1146,28 +1123,24 @@ at91dci_standard_done(struct usb_xfer *x xfer->td_transfer_cache = xfer->td_transfer_first; if ((xfer->status & XFER_STATUS_CTRLXFER) != 0) { - if ((xfer->status & XFER_STATUS_CTRLHDR) != 0) { + if ((xfer->status & XFER_STATUS_CTRLHDR) != 0) err = at91dci_standard_done_sub(xfer); - } xfer->aframes = 1; - if (xfer->td_transfer_cache == NULL) { + if (xfer->td_transfer_cache == NULL) goto done; - } } while (xfer->aframes != xfer->nframes) { err = at91dci_standard_done_sub(xfer); xfer->aframes++; - if (xfer->td_transfer_cache == NULL) { + if (xfer->td_transfer_cache == NULL) goto done; - } } if ((xfer->status & XFER_STATUS_CTRLXFER) != 0 && - (xfer->status & XFER_STATUS_CTRLACTIVE) == 0) { + (xfer->status & XFER_STATUS_CTRLACTIVE) == 0) err = at91dci_standard_done_sub(xfer); - } done: at91dci_device_done(xfer, err); } @@ -1283,9 +1256,8 @@ at91dci_clear_stall_sub(struct at91dci_s temp = (AT91_UDP_CSR_RX_DATA_BK0 | AT91_UDP_CSR_RX_DATA_BK1); } - } else { + } else temp = 0; - } /* clear FORCESTALL */ temp |= AT91_UDP_CSR_STALLSENT; @@ -1309,12 +1281,10 @@ at91dci_clear_stall_sub(struct at91dci_s csr_val |= AT91_UDP_CSR_ET_BULK; } else if (ep_type == UE_INTERRUPT) { csr_val |= AT91_UDP_CSR_ET_INT; - } else { + } else csr_val |= AT91_UDP_CSR_ET_ISO; - } - if (ep_dir & UE_DIR_IN) { + if (ep_dir & UE_DIR_IN) csr_val |= AT91_UDP_CSR_ET_DIR_IN; - } } /* enable endpoint */ @@ -1364,9 +1334,8 @@ at91dci_init(struct at91dci_softc *sc) USB_BUS_LOCK(&sc->sc_bus); /* turn on clocks */ - if (sc->sc_clocks_on) { + if (sc->sc_clocks_on) (sc->sc_clocks_on) (sc->sc_clocks_arg); - } /* wait a little for things to stabilise */ usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); @@ -1912,16 +1881,14 @@ at91dci_roothub_exec(struct usb_device * tr_handle_get_descriptor: switch (value >> 8) { case UDESC_DEVICE: - if (value & 0xff) { + if (value & 0xff) goto tr_stalled; - } len = sizeof(at91dci_devd); ptr = (const void *)&at91dci_devd; goto tr_valid; case UDESC_CONFIG: - if (value & 0xff) { + if (value & 0xff) goto tr_stalled; - } len = sizeof(at91dci_confd); ptr = (const void *)&at91dci_confd; goto tr_valid; @@ -1961,16 +1928,14 @@ tr_handle_get_status: goto tr_valid; tr_handle_set_address: - if (value & 0xFF00) { + if (value & 0xFF00) goto tr_stalled; - } sc->sc_rt_addr = value; goto tr_valid; tr_handle_set_config: - if (value >= 2) { + if (value >= 2) goto tr_stalled; - } sc->sc_conf = value; goto tr_valid; @@ -1995,9 +1960,8 @@ tr_handle_clear_halt: goto tr_valid; tr_handle_clear_port_feature: - if (index != 1) { + if (index != 1) goto tr_stalled; - } DPRINTFN(9, "UR_CLEAR_PORT_FEATURE on port %d\n", index); switch (value) { @@ -2034,9 +1998,8 @@ tr_handle_clear_port_feature: goto tr_valid; tr_handle_set_port_feature: - if (index != 1) { + if (index != 1) goto tr_stalled; - } DPRINTFN(9, "UR_SET_PORT_FEATURE\n"); switch (value) { @@ -2062,9 +2025,8 @@ tr_handle_get_port_status: DPRINTFN(9, "UR_GET_PORT_STATUS\n"); - if (index != 1) { + if (index != 1) goto tr_stalled; - } if (sc->sc_flags.status_vbus) { at91dci_clocks_on(sc); at91dci_pull_up(sc); @@ -2076,19 +2038,15 @@ tr_handle_get_port_status: /* Select FULL-speed and Device Side Mode */ value = UPS_PORT_MODE_DEVICE; - if (sc->sc_flags.port_powered) { + if (sc->sc_flags.port_powered) value |= UPS_PORT_POWER; - } - if (sc->sc_flags.port_enabled) { + if (sc->sc_flags.port_enabled) value |= UPS_PORT_ENABLED; - } if (sc->sc_flags.status_vbus && - sc->sc_flags.status_bus_reset) { + sc->sc_flags.status_bus_reset) value |= UPS_CURRENT_CONNECT_STATUS; - } - if (sc->sc_flags.status_suspend) { + if (sc->sc_flags.status_suspend) value |= UPS_SUSPEND; - } USETW(sc->sc_hub_temp.ps.wPortStatus, value); value = 0; @@ -2102,17 +2060,15 @@ tr_handle_get_port_status: bzero(sc->sc_ep_flags, sizeof(sc->sc_ep_flags)); } } - if (sc->sc_flags.change_suspend) { + if (sc->sc_flags.change_suspend) value |= UPS_C_SUSPEND; - } USETW(sc->sc_hub_temp.ps.wPortChange, value); len = sizeof(sc->sc_hub_temp.ps); goto tr_valid; tr_handle_get_class_descriptor: - if (value & 0xFF) { + if (value & 0xFF) goto tr_stalled; - } ptr = (const void *)&at91dci_hubd; len = sizeof(at91dci_hubd); goto tr_valid; @@ -2167,16 +2123,14 @@ at91dci_xfer_setup(struct usb_setup_para } else if (parm->methods == &at91dci_device_isoc_fs_methods) { ntd = xfer->nframes + 1 /* SYNC */ ; - } else { + } else ntd = 0; - } /* * check if "usbd_transfer_setup_sub" set an error */ - if (parm->err) { + if (parm->err) return; - } /* * allocate transfer descriptors */ @@ -2214,9 +2168,8 @@ at91dci_xfer_setup(struct usb_setup_para td->max_packet_size = xfer->max_packet_size; td->status_reg = AT91_UDP_CSR(ep_no); td->fifo_reg = AT91_UDP_FDR(ep_no); - if (pf->support_multi_buffer) { + if (pf->support_multi_buffer) td->support_multi_buffer = 1; - } td->obj_next = last_obj; last_obj = td; Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c Sat Oct 2 01:29:09 2010 (r213342) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c Sat Oct 2 02:29:10 2010 (r213343) @@ -199,19 +199,16 @@ at91_udp_attach(device_t dev) rid = 0; sc->sc_dci.sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); - if (!(sc->sc_dci.sc_irq_res)) { + if (!(sc->sc_dci.sc_irq_res)) goto error; - } rid = 1; sc->sc_vbus_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); - if (!(sc->sc_vbus_irq_res)) { + if (!(sc->sc_vbus_irq_res)) goto error; - } sc->sc_dci.sc_bus.bdev = device_add_child(dev, "usbus", -1); - if (!(sc->sc_dci.sc_bus.bdev)) { + if (!(sc->sc_dci.sc_bus.bdev)) goto error; - } device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); #if (__FreeBSD_version >= 700031) @@ -237,9 +234,8 @@ at91_udp_attach(device_t dev) goto error; } err = at91dci_init(&sc->sc_dci); - if (!err) { + if (!err) err = device_probe_and_attach(sc->sc_dci.sc_bus.bdev); - } if (err) { goto error; } else { Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Sat Oct 2 01:29:09 2010 (r213342) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Sat Oct 2 02:29:10 2010 (r213343) @@ -212,9 +212,8 @@ atmegadci_wakeup_peer(struct atmegadci_s { uint8_t temp; - if (!sc->sc_flags.status_suspend) { + if (!sc->sc_flags.status_suspend) return; - } temp = ATMEGA_READ_1(sc, ATMEGA_UDCON); ATMEGA_WRITE_1(sc, ATMEGA_UDCON, temp | ATMEGA_UDCON_RMWKUP); @@ -256,9 +255,8 @@ atmegadci_setup_rx(struct atmegadci_td * DPRINTFN(5, "UEINTX=0x%02x\n", temp); - if (!(temp & ATMEGA_UEINTX_RXSTPI)) { + if (!(temp & ATMEGA_UEINTX_RXSTPI)) goto not_complete; - } /* clear did stall */ td->did_stall = 0; /* get the packet byte count */ @@ -296,9 +294,8 @@ atmegadci_setup_rx(struct atmegadci_td * sc->sc_dv_addr = req.wValue[0] & 0x7F; /* must write address before ZLP */ ATMEGA_WRITE_1(sc, ATMEGA_UDADDR, sc->sc_dv_addr); - } else { + } else sc->sc_dv_addr = 0xFF; - } /* Clear SETUP packet interrupt and all other previous interrupts */ ATMEGA_WRITE_1(sc, ATMEGA_UEINTX, 0); @@ -399,9 +396,8 @@ repeat: usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ - if (buf_res.length > count) { + if (buf_res.length > count) buf_res.length = count; - } /* receive data */ ATMEGA_READ_MULTI_1(sc, ATMEGA_UEDATX, buf_res.buffer, buf_res.length); @@ -426,9 +422,8 @@ repeat: } /* else need to receive a zero length packet */ } - if (--to) { + if (--to) goto repeat; - } not_complete: /* we only want to know if there is a SETUP packet or OUT packet */ ATMEGA_WRITE_1(sc, ATMEGA_UEIENX, @@ -484,9 +479,8 @@ repeat: usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ - if (buf_res.length > count) { + if (buf_res.length > count) buf_res.length = count; - } /* transmit data */ ATMEGA_WRITE_MULTI_1(sc, ATMEGA_UEDATX, buf_res.buffer, buf_res.length); @@ -505,14 +499,12 @@ repeat: /* check remainder */ if (td->remainder == 0) { - if (td->short_pkt) { + if (td->short_pkt) return (0); /* complete */ - } /* else we need to transmit a short packet */ } - if (--to) { + if (--to) goto repeat; - } not_complete: /* we only want to know if there is a SETUP packet or free IN packet */ ATMEGA_WRITE_1(sc, ATMEGA_UEIENX, @@ -577,9 +569,8 @@ atmegadci_xfer_do_fifo(struct usb_xfer * /* operation in progress */ break; } - if (((void *)td) == xfer->td_transfer_last) { + if (((void *)td) == xfer->td_transfer_last) goto done; - } if (td->error) { goto done; } else if (td->remainder > 0) { @@ -587,9 +578,8 @@ atmegadci_xfer_do_fifo(struct usb_xfer * * We had a short transfer. If there is no alternate * next, stop processing ! */ - if (!td->alt_next) { + if (!td->alt_next) goto done; - } } /* * Fetch the next transfer descriptor and transfer @@ -816,9 +806,8 @@ atmegadci_setup_standard_chain(struct us atmegadci_setup_standard_chain_sub(&temp); } x = 1; - } else { + } else x = 0; - } if (x != xfer->nframes) { if (xfer->endpointno & UE_DIR_IN) { @@ -831,9 +820,8 @@ atmegadci_setup_standard_chain(struct us /* setup "pc" pointer */ temp.pc = xfer->frbuffers + x; - } else { + } else need_sync = 0; - } while (x != xfer->nframes) { /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -843,12 +831,10 @@ atmegadci_setup_standard_chain(struct us if (x == xfer->nframes) { if ((xfer->status & XFER_STATUS_CTRLXFER) != 0) { if ((xfer->status & - XFER_STATUS_CTRLACTIVE) != 0) { + XFER_STATUS_CTRLACTIVE) != 0) temp.setup_alt_next = 0; - } - } else { + } else temp.setup_alt_next = 0; - } } if (temp.len == 0) { /* make sure that we send an USB packet */ @@ -978,9 +964,8 @@ atmegadci_standard_done_sub(struct usb_x */ if (len > xfer->frlengths[xfer->aframes]) { td->error = 1; - } else { + } else xfer->frlengths[xfer->aframes] -= len; - } } /* Check for transfer error */ if (td->error) { @@ -995,9 +980,8 @@ atmegadci_standard_done_sub(struct usb_x /* follow alt next */ if (td->alt_next) { td = td->obj_next; - } else { + } else td = NULL; - } } else { /* the transfer is finished */ td = NULL; @@ -1032,28 +1016,24 @@ atmegadci_standard_done(struct usb_xfer xfer->td_transfer_cache = xfer->td_transfer_first; if ((xfer->status & XFER_STATUS_CTRLXFER) != 0) { - if ((xfer->status & XFER_STATUS_CTRLHDR) != 0) { + if ((xfer->status & XFER_STATUS_CTRLHDR) != 0) err = atmegadci_standard_done_sub(xfer); - } xfer->aframes = 1; - if (xfer->td_transfer_cache == NULL) { + if (xfer->td_transfer_cache == NULL) goto done; - } } while (xfer->aframes != xfer->nframes) { err = atmegadci_standard_done_sub(xfer); xfer->aframes++; - if (xfer->td_transfer_cache == NULL) { + if (xfer->td_transfer_cache == NULL) goto done; - } } if ((xfer->status & XFER_STATUS_CTRLXFER) != 0 && - (xfer->status & XFER_STATUS_CTRLACTIVE) == 0) { + (xfer->status & XFER_STATUS_CTRLACTIVE) == 0) err = atmegadci_standard_done_sub(xfer); - } done: atmegadci_device_done(xfer, err); } @@ -1155,12 +1135,10 @@ atmegadci_clear_stall_sub(struct atmegad temp = ATMEGA_UECFG0X_EPTYPE2; } else if (ep_type == UE_INTERRUPT) { temp = ATMEGA_UECFG0X_EPTYPE3; - } else { + } else temp = ATMEGA_UECFG0X_EPTYPE1; - } - if (ep_dir & UE_DIR_IN) { + if (ep_dir & UE_DIR_IN) temp |= ATMEGA_UECFG0X_EPDIR; - } /* two banks, 64-bytes wMaxPacket */ ATMEGA_WRITE_1(sc, ATMEGA_UECFG0X, temp); ATMEGA_WRITE_1(sc, ATMEGA_UECFG1X, @@ -1752,16 +1730,14 @@ atmegadci_roothub_exec(struct usb_device tr_handle_get_descriptor: switch (value >> 8) { case UDESC_DEVICE: - if (value & 0xff) { + if (value & 0xff) goto tr_stalled; - } len = sizeof(atmegadci_devd); ptr = (const void *)&atmegadci_devd; goto tr_valid; case UDESC_CONFIG: - if (value & 0xff) { + if (value & 0xff) goto tr_stalled; - } len = sizeof(atmegadci_confd); ptr = (const void *)&atmegadci_confd; goto tr_valid; @@ -1801,16 +1777,14 @@ tr_handle_get_status: goto tr_valid; tr_handle_set_address: - if (value & 0xFF00) { + if (value & 0xFF00) goto tr_stalled; - } sc->sc_rt_addr = value; goto tr_valid; tr_handle_set_config: - if (value >= 2) { + if (value >= 2) goto tr_stalled; - } sc->sc_conf = value; goto tr_valid; @@ -1835,9 +1809,8 @@ tr_handle_clear_halt: goto tr_valid; tr_handle_clear_port_feature: - if (index != 1) { + if (index != 1) goto tr_stalled; - } DPRINTFN(9, "UR_CLEAR_PORT_FEATURE on port %d\n", index); switch (value) { @@ -1911,9 +1884,8 @@ tr_handle_clear_port_feature: goto tr_valid; tr_handle_set_port_feature: - if (index != 1) { + if (index != 1) goto tr_stalled; - } DPRINTFN(9, "UR_SET_PORT_FEATURE\n"); switch (value) { @@ -1939,9 +1911,8 @@ tr_handle_get_port_status: DPRINTFN(9, "UR_GET_PORT_STATUS\n"); - if (index != 1) { + if (index != 1) goto tr_stalled; - } if (sc->sc_flags.status_vbus) { atmegadci_clocks_on(sc); atmegadci_pull_up(sc); @@ -1953,37 +1924,30 @@ tr_handle_get_port_status: /* Select FULL-speed and Device Side Mode */ value = UPS_PORT_MODE_DEVICE; - if (sc->sc_flags.port_powered) { + if (sc->sc_flags.port_powered) value |= UPS_PORT_POWER; - } - if (sc->sc_flags.port_enabled) { + if (sc->sc_flags.port_enabled) value |= UPS_PORT_ENABLED; - } if (sc->sc_flags.status_vbus && - sc->sc_flags.status_bus_reset) { + sc->sc_flags.status_bus_reset) value |= UPS_CURRENT_CONNECT_STATUS; - } - if (sc->sc_flags.status_suspend) { + if (sc->sc_flags.status_suspend) value |= UPS_SUSPEND; - } USETW(sc->sc_hub_temp.ps.wPortStatus, value); value = 0; - if (sc->sc_flags.change_connect) { + if (sc->sc_flags.change_connect) value |= UPS_C_CONNECT_STATUS; - } - if (sc->sc_flags.change_suspend) { + if (sc->sc_flags.change_suspend) value |= UPS_C_SUSPEND; - } USETW(sc->sc_hub_temp.ps.wPortChange, value); len = sizeof(sc->sc_hub_temp.ps); goto tr_valid; tr_handle_get_class_descriptor: - if (value & 0xFF) { + if (value & 0xFF) goto tr_stalled; - } ptr = (const void *)&atmegadci_hubd; len = sizeof(atmegadci_hubd); goto tr_valid; @@ -2028,9 +1992,8 @@ atmegadci_xfer_setup(struct usb_setup_pa if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; - } else { + } else ntd = xfer->nframes + 1 /* SYNC */ ; - } /* * check if "usbd_transfer_setup_sub" set an error @@ -2067,9 +2030,8 @@ atmegadci_xfer_setup(struct usb_setup_pa /* init TD */ td->max_packet_size = xfer->max_packet_size; td->ep_no = ep_no; - if (pf->support_multi_buffer) { + if (pf->support_multi_buffer) td->support_multi_buffer = 1; - } td->obj_next = last_obj; last_obj = td; Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.c Sat Oct 2 01:29:09 2010 (r213342) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.c Sat Oct 2 02:29:10 2010 (r213343) @@ -120,13 +120,11 @@ atmegadci_attach(device_t dev) rid = 0; sc->sc_otg.sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); - if (!(sc->sc_otg.sc_irq_res)) { + if (!(sc->sc_otg.sc_irq_res)) goto error; - } sc->sc_otg.sc_bus.bdev = device_add_child(dev, "usbus", -1); - if (!(sc->sc_otg.sc_bus.bdev)) { + if (!(sc->sc_otg.sc_bus.bdev)) goto error; - } device_set_ivars(sc->sc_otg.sc_bus.bdev, &sc->sc_otg.sc_bus); err = bus_setup_intr(dev, sc->sc_otg.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, @@ -136,12 +134,10 @@ atmegadci_attach(device_t dev) goto error; } err = atmegadci_init(&sc->sc_otg); - if (!err) { + if (!err) err = device_probe_and_attach(sc->sc_otg.sc_bus.bdev); - } - if (err) { + if (err) goto error; - } return (0); error: Modified: user/weongyo/usb/sys/dev/usb/controller/avr32dci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Sat Oct 2 01:29:09 2010 (r213342) +++ user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Sat Oct 2 02:29:10 2010 (r213343) @@ -249,9 +249,8 @@ static void avr32dci_wakeup_peer(struct avr32dci_softc *sc) { - if (!sc->sc_flags.status_suspend) { + if (!sc->sc_flags.status_suspend) return; - } avr32dci_mod_ctrl(sc, AVR32_CTRL_DEV_REWAKEUP, 0); /* wait 8 milliseconds */ @@ -286,9 +285,8 @@ avr32dci_setup_rx(struct avr32dci_td *td DPRINTFN(5, "EPTSTA(%u)=0x%08x\n", td->ep_no, temp); - if (!(temp & AVR32_EPTSTA_RX_SETUP)) { + if (!(temp & AVR32_EPTSTA_RX_SETUP)) goto not_complete; - } /* clear did stall */ td->did_stall = 0; /* get the packet byte count */ @@ -322,9 +320,8 @@ avr32dci_setup_rx(struct avr32dci_td *td avr32dci_mod_ctrl(sc, 0, AVR32_CTRL_DEV_FADDR_EN | AVR32_CTRL_DEV_ADDR); avr32dci_mod_ctrl(sc, sc->sc_dv_addr, 0); - } else { + } else sc->sc_dv_addr = 0xFF; - } /* clear SETUP packet interrupt */ AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(td->ep_no), AVR32_EPTSTA_RX_SETUP); @@ -413,9 +410,8 @@ repeat: usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ - if (buf_res.length > count) { + if (buf_res.length > count) buf_res.length = count; - } /* receive data */ bcopy(sc->physdata + (AVR32_EPTSTA_CURRENT_BANK(temp) << td->bank_shift) + @@ -438,9 +434,8 @@ repeat: } /* else need to receive a zero length packet */ } - if (--to) { + if (--to) goto repeat; - } not_complete: return (1); /* not complete */ } @@ -487,9 +482,8 @@ repeat: usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ - if (buf_res.length > count) { + if (buf_res.length > count) buf_res.length = count; - } /* transmit data */ bcopy(buf_res.buffer, sc->physdata + (AVR32_EPTSTA_CURRENT_BANK(temp) << td->bank_shift) + @@ -506,14 +500,12 @@ repeat: /* check remainder */ if (td->remainder == 0) { - if (td->short_pkt) { + if (td->short_pkt) return (0); /* complete */ - } /* else we need to transmit a short packet */ } - if (--to) { + if (--to) goto repeat; - } not_complete: return (1); /* not complete */ } @@ -568,9 +560,8 @@ avr32dci_xfer_do_fifo(struct usb_xfer *x /* operation in progress */ break; } - if (((void *)td) == xfer->td_transfer_last) { + if (((void *)td) == xfer->td_transfer_last) goto done; - } if (td->error) { goto done; } else if (td->remainder > 0) { @@ -578,9 +569,8 @@ avr32dci_xfer_do_fifo(struct usb_xfer *x * We had a short transfer. If there is no alternate * next, stop processing ! */ - if (!td->alt_next) { + if (!td->alt_next) goto done; - } } /* * Fetch the next transfer descriptor and transfer @@ -787,9 +777,8 @@ avr32dci_setup_standard_chain(struct usb avr32dci_setup_standard_chain_sub(&temp); } x = 1; - } else { + } else x = 0; - } if (x != xfer->nframes) { if (xfer->endpoint & UE_DIR_IN) { @@ -802,9 +791,8 @@ avr32dci_setup_standard_chain(struct usb /* setup "pc" pointer */ temp.pc = xfer->frbuffers + x; - } else { + } else need_sync = 0; - } while (x != xfer->nframes) { /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -814,12 +802,10 @@ avr32dci_setup_standard_chain(struct usb if (x == xfer->nframes) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***