Date: Sat, 2 Oct 2010 02:46:32 +0000 (UTC) From: Weongyo Jeong <weongyo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r213344 - user/weongyo/usb/sys/dev/usb Message-ID: <201010020246.o922kWQB024496@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: weongyo Date: Sat Oct 2 02:46:32 2010 New Revision: 213344 URL: http://svn.freebsd.org/changeset/base/213344 Log: White space tweaks and style(9) Modified: user/weongyo/usb/sys/dev/usb/usb_bus.h 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_compat_linux.h user/weongyo/usb/sys/dev/usb/usb_controller.h 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_device.h user/weongyo/usb/sys/dev/usb/usb_dynamic.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_hub.h user/weongyo/usb/sys/dev/usb/usb_mbuf.h 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_request.h user/weongyo/usb/sys/dev/usb/usb_sleepout.c 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_bus.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_bus.h Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_bus.h Sat Oct 2 02:46:32 2010 (r213344) @@ -94,7 +94,7 @@ struct usb_bus { uint8_t devices_max; /* maximum number of USB devices */ uint8_t do_probe; /* set if USB BUS should be re-probed */ - /* + /* * The scratch area can only be used inside the explore thread * belonging to the give serial bus. */ Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_busdma.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_busdma.c Sat Oct 2 02:46:32 2010 (r213344) @@ -485,10 +485,10 @@ usb_pc_alloc_mem(struct usb_page_cache * goto error; if (align != 1) { /* - * The alignment must be greater or equal to the - * "size" else the object can be split between two - * memory pages and we get a problem! - */ + * The alignment must be greater or equal to the + * "size" else the object can be split between two + * memory pages and we get a problem! + */ while (align < size) align *= 2; #if 1 Modified: user/weongyo/usb/sys/dev/usb/usb_compat_linux.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_compat_linux.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_compat_linux.c Sat Oct 2 02:46:32 2010 (r213344) @@ -394,11 +394,11 @@ usb_submit_urb(struct urb *urb, uint16_t } /* - * Check to see if the urb is in the process of being killed - * and stop a urb that is in the process of being killed from - * being re-submitted (e.g. from its completion callback - * function). - */ + * Check to see if the urb is in the process of being killed + * and stop a urb that is in the process of being killed from + * being re-submitted (e.g. from its completion callback + * function). + */ if (urb->kill_count != 0) { err = -EPERM; goto done; @@ -871,8 +871,10 @@ usb_linux_create_usb_device(struct usb_d (iface_index == 0)) break; if (p_uhe) { - bcopy(ed, &p_uhe->desc, sizeof(p_uhe->desc)); - p_uhe->bsd_iface_index = iface_index - 1; + bcopy(ed, &p_uhe->desc, + sizeof(p_uhe->desc)); + p_uhe->bsd_iface_index = + iface_index - 1; TAILQ_INIT(&p_uhe->bsd_urb_list); p_uhe++; } @@ -886,7 +888,8 @@ usb_linux_create_usb_device(struct usb_d if (id->bLength < sizeof(*id)) break; if (p_uhi) { - bcopy(id, &p_uhi->desc, sizeof(p_uhi->desc)); + bcopy(id, &p_uhi->desc, + sizeof(p_uhi->desc)); p_uhi->desc.bNumEndpoints = 0; p_uhi->endpoint = p_uhe; p_uhi->string = ""; @@ -898,9 +901,11 @@ usb_linux_create_usb_device(struct usb_d if (iface_no_curr != iface_no) { if (p_ui) { p_ui->altsetting = p_uhi - 1; - p_ui->cur_altsetting = p_uhi - 1; + p_ui->cur_altsetting = + p_uhi - 1; p_ui->num_altsetting = 1; - p_ui->bsd_iface_index = iface_index; + p_ui->bsd_iface_index = + iface_index; p_ui->linux_udev = udev; p_ui++; } @@ -960,9 +965,11 @@ usb_alloc_urb(uint16_t iso_packets, uint * FreeBSD specific magic value to ask for control transfer * memory allocation: */ - size = sizeof(*urb) + sizeof(struct usb_device_request) + mem_flags; + size = sizeof(*urb) + sizeof(struct usb_device_request) + + mem_flags; } else - size = sizeof(*urb) + (iso_packets * sizeof(urb->iso_frame_desc[0])); + size = sizeof(*urb) + + (iso_packets * sizeof(urb->iso_frame_desc[0])); urb = malloc(size, M_USBDEV, M_WAITOK | M_ZERO); if (urb) { @@ -1076,7 +1083,8 @@ usb_ifnum_to_if(struct usb_device *dev, * usb_buffer_alloc *------------------------------------------------------------------------*/ void * -usb_buffer_alloc(struct usb_device *dev, usb_size_t size, uint16_t mem_flags, uint8_t *dma_addr) +usb_buffer_alloc(struct usb_device *dev, usb_size_t size, uint16_t mem_flags, + uint8_t *dma_addr) { return (malloc(size, M_USBDEV, M_WAITOK | M_ZERO)); @@ -1321,7 +1329,8 @@ usb_linux_isoc_callback(struct usb_xfer for (x = 0; x < urb->number_of_packets; x++) { uipd = urb->iso_frame_desc + x; if (uipd->length > xfer->frlengths[x]) { - if (urb->transfer_flags & URB_SHORT_NOT_OK) { + if (urb->transfer_flags & + URB_SHORT_NOT_OK) { /* XXX should be EREMOTEIO */ uipd->status = -EPIPE; } else @@ -1387,11 +1396,13 @@ tr_setup: urb = usbd_xfer_get_priv(xfer); } - urb->bsd_isread = (uhe->desc.bEndpointAddress & UE_DIR_IN) ? 1 : 0; + urb->bsd_isread = + (uhe->desc.bEndpointAddress & UE_DIR_IN) ? 1 : 0; if (xfer->flags.ext_buffer) { /* set virtual address to load */ - usbd_xfer_set_frame_data(xfer, 0, urb->transfer_buffer, 0); + usbd_xfer_set_frame_data(xfer, 0, + urb->transfer_buffer, 0); } if (!(urb->bsd_isread)) { /* copy out data with regard to the URB */ @@ -1534,9 +1545,9 @@ tr_setup: if ((xfer->status & XFER_STATUS_CTRLXFER) != 0) { /* - * USB control transfers need special handling. - * First copy in the header, then copy in data! - */ + * USB control transfers need special handling. + * First copy in the header, then copy in data! + */ if (!xfer->flags.ext_buffer) { usbd_copy_in(xfer->frbuffers, 0, urb->setup_packet, REQ_SIZE); @@ -1661,7 +1672,7 @@ usb_bulk_msg(struct usb_device *udev, st if (urb == NULL) return (-ENOMEM); - usb_fill_bulk_urb(urb, udev, uhe, data, len, + usb_fill_bulk_urb(urb, udev, uhe, data, len, usb_linux_wait_complete, NULL); err = usb_start_wait_urb(urb, timeout, pactlen); Modified: user/weongyo/usb/sys/dev/usb/usb_compat_linux.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_compat_linux.h Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_compat_linux.h Sat Oct 2 02:46:32 2010 (r213344) @@ -56,12 +56,12 @@ struct usb_driver { const char *name; int (*probe) (struct usb_interface *intf, - const struct usb_device_id *id); + const struct usb_device_id *id); void (*disconnect) (struct usb_interface *intf); int (*ioctl) (struct usb_interface *intf, unsigned int code, - void *buf); + void *buf); int (*suspend) (struct usb_interface *intf, pm_message_t message); int (*resume) (struct usb_interface *intf); @@ -264,7 +264,7 @@ struct urb { uint8_t bsd_isread; uint8_t kill_count; /* FreeBSD specific */ - struct usb_iso_packet_descriptor iso_frame_desc[]; /* (in) ISO ONLY */ + struct usb_iso_packet_descriptor iso_frame_desc[]; /* (in) ISO ONLY */ }; /* various prototypes */ @@ -291,7 +291,8 @@ void *usb_buffer_alloc(struct usb_devi uint16_t mem_flags, uint8_t *dma_addr); void *usbd_get_intfdata(struct usb_interface *intf); -void usb_buffer_free(struct usb_device *dev, usb_size_t size, void *addr, uint8_t dma_addr); +void usb_buffer_free(struct usb_device *dev, usb_size_t size, void *addr, + uint8_t dma_addr); void usb_free_urb(struct urb *urb); void usb_init_urb(struct urb *urb); void usb_kill_urb(struct urb *urb); Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Oct 2 02:46:32 2010 (r213344) @@ -96,9 +96,12 @@ struct usb_bus_methods { /* USB Device mode only - Mandatory */ - void (*get_hw_ep_profile) (struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr); - void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep, uint8_t *did_stall); - void (*clear_stall) (struct usb_device *udev, struct usb_endpoint *ep); + void (*get_hw_ep_profile) (struct usb_device *udev, + const struct usb_hw_ep_profile **ppf, uint8_t ep_addr); + void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, + struct usb_endpoint *ep, uint8_t *did_stall); + void (*clear_stall) (struct usb_device *udev, + struct usb_endpoint *ep); /* Optional transfer polling support */ @@ -194,7 +197,7 @@ struct usb_temp_setup { int usb_bus_struct_init(struct usb_bus *bus, device_t dev, struct usb_device **udevs, uint8_t udevsmax, void (*busmem_func)(struct usb_bus *, - usb_bus_mem_callback_t *)); + usb_bus_mem_callback_t *)); void usb_bus_struct_fini(struct usb_bus *bus); void usb_bus_mem_flush_all(struct usb_bus *bus); uint16_t usb_isoc_time_expand(struct usb_bus *bus, Modified: user/weongyo/usb/sys/dev/usb/usb_dev.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_dev.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_dev.c Sat Oct 2 02:46:32 2010 (r213344) @@ -97,7 +97,7 @@ TUNABLE_INT("hw.usb.dev.debug", &usb_fif /* prototypes */ -static int usb_fifo_open(struct usb_cdev_privdata *, +static int usb_fifo_open(struct usb_cdev_privdata *, struct usb_fifo *, int); static void usb_fifo_close(struct usb_fifo *, int); static void usb_dev_init(void *); @@ -112,9 +112,12 @@ static struct usb_endpoint *usb_dev_get_ static void usb_loc_fill(struct usb_fs_privdata *, struct usb_cdev_privdata *); static void usb_close(void *); -static usb_error_t usb_ref_device(struct usb_cdev_privdata *, struct usb_cdev_refdata *, int); -static usb_error_t usb_usb_ref_device(struct usb_cdev_privdata *, struct usb_cdev_refdata *); -static void usb_unref_device(struct usb_cdev_privdata *, struct usb_cdev_refdata *); +static usb_error_t usb_ref_device(struct usb_cdev_privdata *, + struct usb_cdev_refdata *, int); +static usb_error_t usb_usb_ref_device(struct usb_cdev_privdata *, + struct usb_cdev_refdata *); +static void usb_unref_device(struct usb_cdev_privdata *, + struct usb_cdev_refdata *); static d_open_t usb_open; static d_ioctl_t usb_ioctl; @@ -183,7 +186,7 @@ usb_loc_fill(struct usb_fs_privdata* pd, * Else: Failure. *------------------------------------------------------------------------*/ static usb_error_t -usb_ref_device(struct usb_cdev_privdata *cpd, +usb_ref_device(struct usb_cdev_privdata *cpd, struct usb_cdev_refdata *crd, int need_uref) { struct usb_fifo **ppf; @@ -223,7 +226,7 @@ usb_ref_device(struct usb_cdev_privdata mtx_lock(&usb_ref_lock); - /* + /* * Set "is_uref" after grabbing the default SX lock */ crd->is_uref = 1; @@ -637,7 +640,7 @@ usb_dev_get_ep(struct usb_device *udev, * Else: Failure *------------------------------------------------------------------------*/ static int -usb_fifo_open(struct usb_cdev_privdata *cpd, +usb_fifo_open(struct usb_cdev_privdata *cpd, struct usb_fifo *f, int fflags) { int err; @@ -930,7 +933,8 @@ usb_dev_init_post(void *arg) DPRINTFN(0, "Could not create usb bus device\n"); } -SYSINIT(usb_dev_init_post, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, usb_dev_init_post, NULL); +SYSINIT(usb_dev_init_post, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, + usb_dev_init_post, NULL); static void usb_dev_uninit(void *arg) @@ -939,13 +943,13 @@ usb_dev_uninit(void *arg) if (usb_dev != NULL) { destroy_dev(usb_dev); usb_dev = NULL; - } mtx_destroy(&usb_ref_lock); sx_destroy(&usb_sym_lock); } -SYSUNINIT(usb_dev_uninit, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_dev_uninit, NULL); +SYSUNINIT(usb_dev_uninit, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, + usb_dev_uninit, NULL); static int usb_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr, @@ -957,11 +961,9 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_lo case FIODTYPE: *(int *)addr = 0; /* character device */ break; - case FIONBIO: /* handled by upper FS layer */ break; - case FIOASYNC: if (*(int *)addr) { if (f->async_p != NULL) { @@ -972,7 +974,6 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_lo } else f->async_p = NULL; break; - /* XXX this is not the most general solution */ case TIOCSPGRP: if (f->async_p == NULL) { @@ -995,7 +996,8 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_lo * usb_ioctl - cdev callback *------------------------------------------------------------------------*/ static int -usb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int fflag, struct thread* td) +usb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int fflag, + struct thread* td) { struct usb_cdev_refdata refs; struct usb_cdev_privdata* cpd; @@ -1009,7 +1011,7 @@ usb_ioctl(struct cdev *dev, u_long cmd, if (err != 0) return (err); - /* + /* * Performance optimisation: We try to check for IOCTL's that * don't need the USB reference first. Then we grab the USB * reference if we need it! @@ -1678,7 +1680,8 @@ usb_fifo_attach(struct usb_device *udev, * Initialize device private data - this is used to find the * actual USB device itself. */ - pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, M_WAITOK | M_ZERO); + pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, + M_WAITOK | M_ZERO); pd->bus_index = device_get_unit(udev->bus->bdev); pd->dev_index = udev->device_index; pd->ep_addr = -1; /* not an endpoint */ @@ -1743,7 +1746,7 @@ usb_fifo_free_buffer(struct usb_fifo *f) } static void -usb_fifo_cleanup(void* ptr) +usb_fifo_cleanup(void* ptr) { free(ptr, M_USBDEV); @@ -1762,7 +1765,7 @@ usb_fifo_detach(struct usb_fifo_sc *f_sc f_sc->fp[USB_FIFO_RX] = NULL; if (f_sc->dev != NULL) { - destroy_dev_sched_cb(f_sc->dev, + destroy_dev_sched_cb(f_sc->dev, usb_fifo_cleanup, f_sc->dev->si_drv1); f_sc->dev = NULL; } Modified: user/weongyo/usb/sys/dev/usb/usb_device.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_device.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_device.c Sat Oct 2 02:46:32 2010 (r213344) @@ -92,7 +92,7 @@ static void usbd_clear_stall_proc(void * usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t); static void usbd_set_device_strings(struct usb_device *); #if USB_HAVE_UGEN -static void usb_notify_addq(const char *type, struct usb_device *); +static void usb_notify_addq(const char *, struct usb_device *); static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); static struct cdev *usb_make_dev(struct usb_device *, int, int); static void usb_cdev_create(struct usb_device *); @@ -675,7 +675,10 @@ usb_config_parse(struct usb_device *udev } else { /* reset endpoint */ memset(ep, 0, sizeof(*ep)); - /* make sure we don't zero the endpoint again */ + /* + * make sure we don't zero + * the endpoint again + */ ep->iface_index = USB_IFACE_INDEX_ANY; } } @@ -699,7 +702,7 @@ usb_config_parse(struct usb_device *udev /* check for specific interface match */ if (cmd == USB_CFG_INIT) { - if ((iface_index != USB_IFACE_INDEX_ANY) && + if ((iface_index != USB_IFACE_INDEX_ANY) && (iface_index != ips.iface_index)) { /* wrong interface */ do_init = 0; @@ -741,7 +744,7 @@ usb_config_parse(struct usb_device *udev ep = udev->endpoints + temp; if (do_init) { - usb_init_endpoint(udev, + usb_init_endpoint(udev, ips.iface_index, ed, ep); } @@ -762,7 +765,7 @@ usb_config_parse(struct usb_device *udev udev->ifaces = NULL; if (udev->ifaces_max != 0) { udev->ifaces = malloc(sizeof(*iface) * udev->ifaces_max, - M_USB, M_WAITOK | M_ZERO); + M_USB, M_WAITOK | M_ZERO); if (udev->ifaces == NULL) { err = USB_ERR_NOMEM; goto done; @@ -770,7 +773,7 @@ usb_config_parse(struct usb_device *udev } if (ep_max != 0) { udev->endpoints = malloc(sizeof(*ep) * ep_max, - M_USB, M_WAITOK | M_ZERO); + M_USB, M_WAITOK | M_ZERO); if (udev->endpoints == NULL) { err = USB_ERR_NOMEM; goto done; @@ -842,7 +845,7 @@ usbd_set_alt_interface_index(struct usb_ goto done; } if (iface->alt_index == alt_index) { - /* + /* * Optimise away duplicate setting of * alternate setting in USB Host Mode! */ @@ -910,9 +913,9 @@ usbd_set_endpoint_stall(struct usb_devic if ((et != UE_BULK) && (et != UE_INTERRUPT)) { /* - * Should not stall control - * nor isochronous endpoints. - */ + * Should not stall control + * nor isochronous endpoints. + */ DPRINTF("Invalid endpoint\n"); return (0); } @@ -1150,7 +1153,8 @@ attached: if (udev->flags.peer_suspended) { err = DEVICE_SUSPEND(iface->subdev); if (err) - device_printf(iface->subdev, "Suspend failed\n"); + device_printf(iface->subdev, + "Suspend failed\n"); } return (0); /* success */ } @@ -1317,7 +1321,8 @@ done: * be executed on an USB device. *------------------------------------------------------------------------*/ static void -usb_suspend_resume_sub(struct usb_device *udev, device_t dev, uint8_t do_suspend) +usb_suspend_resume_sub(struct usb_device *udev, device_t dev, + uint8_t do_suspend) { int err; @@ -1576,7 +1581,8 @@ usb_alloc_device(device_t parent_dev, st /* Setup USB descriptors */ err = (usb_temp_setup_by_index_p) (udev, usb_template); if (err) { - DPRINTFN(0, "setting up USB template failed maybe the USB " + DPRINTFN(0, + "setting up USB template failed maybe the USB " "template module has not been loaded\n"); goto done; } @@ -1751,7 +1757,8 @@ repeat_set_config: err = 0; goto config_done; } - if (!config_quirk && config_index + 1 < udev->ddesc.bNumConfigurations) { + if (!config_quirk && + config_index + 1 < udev->ddesc.bNumConfigurations) { if ((udev->cdesc->bNumInterface < 2) && usbd_get_no_descriptors(udev->cdesc, UDESC_ENDPOINT) == 0) { DPRINTFN(0, "Found no endpoints, trying next config\n"); Modified: user/weongyo/usb/sys/dev/usb/usb_device.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_device.h Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_device.h Sat Oct 2 02:46:32 2010 (r213344) @@ -208,7 +208,8 @@ void usb_devinfo(struct usb_device *udev void usb_free_device(struct usb_device *, uint8_t); void usb_linux_free_device(struct usb_device *dev); uint8_t usb_peer_can_wakeup(struct usb_device *udev); -struct usb_endpoint *usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep); +struct usb_endpoint *usb_endpoint_foreach(struct usb_device *udev, + struct usb_endpoint *ep); void usb_set_device_state(struct usb_device *udev, enum usb_dev_state state); void usbd_enum_lock(struct usb_device *); Modified: user/weongyo/usb/sys/dev/usb/usb_dynamic.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_dynamic.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_dynamic.c Sat Oct 2 02:46:32 2010 (r213344) @@ -60,7 +60,8 @@ static usb_quirk_ioctl_t usb_quirk_ioctl /* global variables */ usb_handle_req_t *usb_temp_get_desc_p = &usb_temp_get_desc_w; -usb_temp_setup_by_index_t *usb_temp_setup_by_index_p = &usb_temp_setup_by_index_w; +usb_temp_setup_by_index_t *usb_temp_setup_by_index_p = + &usb_temp_setup_by_index_w; usb_temp_unsetup_t *usb_temp_unsetup_p = &usb_temp_unsetup_w; usb_test_quirk_t *usb_test_quirk_p = &usb_test_quirk_w; usb_quirk_ioctl_t *usb_quirk_ioctl_p = &usb_quirk_ioctl_w; @@ -88,7 +89,8 @@ usb_quirk_ioctl_w(unsigned long cmd, cad } static usb_error_t -usb_temp_get_desc_w(struct usb_device *udev, struct usb_device_request *req, const void **pPtr, uint16_t *pLength) +usb_temp_get_desc_w(struct usb_device *udev, struct usb_device_request *req, + const void **pPtr, uint16_t *pLength) { /* stall */ Modified: user/weongyo/usb/sys/dev/usb/usb_generic.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_generic.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_generic.c Sat Oct 2 02:46:32 2010 (r213344) @@ -74,7 +74,7 @@ #define UGEN_BULK_FS_BUFFER_SIZE (64*32) /* bytes */ #define UGEN_BULK_HS_BUFFER_SIZE (1024*32) /* bytes */ -#define UGEN_HW_FRAMES 50 /* number of milliseconds per transfer */ +#define UGEN_HW_FRAMES 50 /* number of milliseconds per transfer */ /* function prototypes */ @@ -102,13 +102,14 @@ static int ugen_set_config(struct usb_fi static int ugen_set_interface(struct usb_fifo *, uint8_t, uint8_t); static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *); static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *); -static int ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd); +static int ugen_get_iface_driver(struct usb_fifo *, + struct usb_gen_descriptor *); static int usb_gen_fill_deviceinfo(struct usb_fifo *, struct usb_device_info *); static int ugen_re_enumerate(struct usb_fifo *); static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int); static uint8_t ugen_fs_get_complete(struct usb_fifo *, uint8_t *); -static int ugen_fs_uninit(struct usb_fifo *f); +static int ugen_fs_uninit(struct usb_fifo *); /* structures */ @@ -427,7 +428,8 @@ ugen_ctrl_read_callback(struct usb_xfer } USB_IF_POLL(&f->free_q, m); if (m) { - usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_xfer_set_frame_len(xfer, 0, + usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); } break; @@ -805,8 +807,10 @@ usb_gen_fill_deviceinfo(struct usb_fifo di->udi_addr = udev->address; di->udi_index = udev->device_index; strlcpy(di->udi_serial, usb_get_serial(udev), sizeof(di->udi_serial)); - strlcpy(di->udi_vendor, usb_get_manufacturer(udev), sizeof(di->udi_vendor)); - strlcpy(di->udi_product, usb_get_product(udev), sizeof(di->udi_product)); + strlcpy(di->udi_vendor, usb_get_manufacturer(udev), + sizeof(di->udi_vendor)); + strlcpy(di->udi_product, usb_get_product(udev), + sizeof(di->udi_product)); usb_printbcd(di->udi_release, sizeof(di->udi_release), UGETW(udev->ddesc.bcdDevice)); di->udi_vendorNo = UGETW(udev->ddesc.idVendor); @@ -1412,7 +1416,8 @@ ugen_ioctl(struct usb_fifo *f, u_long cm usb_config[0].type = ed->bmAttributes & UE_XFERTYPE; usb_config[0].endpoint = ed->bEndpointAddress & UE_ADDR; - usb_config[0].direction = ed->bEndpointAddress & (UE_DIR_OUT | UE_DIR_IN); + usb_config[0].direction = + ed->bEndpointAddress & (UE_DIR_OUT | UE_DIR_IN); usb_config[0].interval = USB_DEFAULT_INTERVAL; usb_config[0].flags.proxy_buffer = 1; usb_config[0].callback = &ugen_ctrl_fs_callback; Modified: user/weongyo/usb/sys/dev/usb/usb_handle_request.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_handle_request.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_handle_request.c Sat Oct 2 02:46:32 2010 (r213344) @@ -734,9 +734,9 @@ tr_valid: rem = usbd_xfer_max_len(xfer); if ((rem != max_len) && (is_complete != 0)) { /* - * If we don't transfer the data we can transfer, then - * the transfer is short ! - */ + * If we don't transfer the data we can transfer, then + * the transfer is short ! + */ xfer->flags.force_short_xfer = 1; xfer->nframes = 2; } else { Modified: user/weongyo/usb/sys/dev/usb/usb_hid.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_hid.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_hid.c Sat Oct 2 02:46:32 2010 (r213344) @@ -353,7 +353,7 @@ hid_get_item(struct hid_data *s, struct } else s->ncount = c->loc.count; - /* + /* * The "top" loop will return * one and one item: */ @@ -504,9 +504,9 @@ hid_get_item(struct hid_data *s, struct if ((s->nusage < MAXUSAGE) && (c->usage_minimum <= c->usage_maximum)) { /* add usage range */ - s->usages_min[s->nusage] = + s->usages_min[s->nusage] = c->usage_minimum; - s->usages_max[s->nusage] = + s->usages_max[s->nusage] = c->usage_maximum; s->nusage ++; } else @@ -655,7 +655,7 @@ hid_get_data_sub(const uint8_t *buf, usb if (hsize > 32) hsize = 32; - /* Get data in a safe way */ + /* Get data in a safe way */ data = 0; rpos = (hpos / 8); n = (hsize + 7) / 8; @@ -689,10 +689,11 @@ hid_get_data(const uint8_t *buf, usb_siz } uint32_t -hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, struct hid_location *loc) +hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, + struct hid_location *loc) { - return (hid_get_data_sub(buf, len, loc, 0)); + return (hid_get_data_sub(buf, len, loc, 0)); } /*------------------------------------------------------------------------* Modified: user/weongyo/usb/sys/dev/usb/usb_hub.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_hub.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_hub.c Sat Oct 2 02:46:32 2010 (r213344) @@ -27,7 +27,7 @@ */ /* - * USB spec: http://www.usb.org/developers/docs/usbspec.zip + * USB spec: http://www.usb.org/developers/docs/usbspec.zip */ #include <sys/stdint.h> @@ -200,7 +200,8 @@ uhub_intr_callback(struct usb_xfer *xfer * the USB stack. */ usbd_xfer_set_stall(xfer); - usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_xfer_set_frame_len(xfer, 0, + usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); } break; @@ -341,7 +342,7 @@ repeat: } /* USB Host Mode */ /* wait for maximum device power up time */ - usb_pause_mtx(NULL, + usb_pause_mtx(NULL, USB_MS_TO_TICKS(USB_PORT_POWERUP_DELAY)); /* reset port, which implies enabling it */ @@ -860,7 +861,8 @@ uhub_detach(device_t dev) /* Detach all ports */ for (x = 0; x != hub->nports; x++) { - child = usb_bus_port_get_device(sc->sc_udev->bus, hub->ports + x); + child = usb_bus_port_get_device(sc->sc_udev->bus, + hub->ports + x); if (child == NULL) continue; @@ -967,8 +969,10 @@ uhub_child_location_string(device_t pare buf[0] = '\0'; goto done; } - snprintf(buf, buflen, "bus=%u hubaddr=%u port=%u devaddr=%u interface=%u", - (res.udev->parent_hub != NULL) ? res.udev->parent_hub->device_index : 0, + snprintf(buf, buflen, + "bus=%u hubaddr=%u port=%u devaddr=%u interface=%u", + (res.udev->parent_hub != NULL) ? + res.udev->parent_hub->device_index : 0, res.portno, device_get_unit(res.udev->bus->bdev), res.udev->device_index, res.iface_index); done: @@ -1131,11 +1135,11 @@ usb_hs_bandwidth_adjust(struct usb_devic if (speed == USB_SPEED_LOW) len *= 8; /* - * The Host Controller Driver should have - * performed checks so that the lookup - * below does not result in a NULL pointer - * access. - */ + * The Host Controller Driver should have + * performed checks so that the lookup + * below does not result in a NULL pointer + * access. + */ hub = udev->parent_hs_hub->hub; if (slot >= USB_HS_MICRO_FRAMES_MAX) { @@ -1236,8 +1240,8 @@ usb_hs_bandwidth_alloc(struct usb_xfer * break; } - DPRINTFN(11, "slot=%d, mask=0x%02x\n", - xfer->endpoint->usb_uframe, + DPRINTFN(11, "slot=%d, mask=0x%02x\n", + xfer->endpoint->usb_uframe, xfer->endpoint->usb_smask >> xfer->endpoint->usb_uframe); } @@ -1269,11 +1273,11 @@ usb_hs_bandwidth_free(struct usb_xfer *x slot = xfer->endpoint->usb_uframe; mask = xfer->endpoint->usb_smask; - /* free microframe slot(s): */ + /* free microframe slot(s): */ usb_hs_bandwidth_adjust(udev, -xfer->max_frame_size, slot, mask >> slot); - DPRINTFN(11, "slot=%d, mask=0x%02x\n", + DPRINTFN(11, "slot=%d, mask=0x%02x\n", slot, mask >> slot); xfer->endpoint->usb_uframe = 0; @@ -1497,7 +1501,7 @@ usb_bus_port_set_device(struct usb_bus * /* * There is only one case where we don't * have an USB port, and that is the Root Hub! - */ + */ if (up) { if (udev) { up->device_index = device_index; @@ -2014,7 +2018,8 @@ repeat: NULL, udev->port_no, UHF_PORT_SUSPEND); /* resume settle time */ - usb_pause_mtx(NULL, USB_MS_TO_TICKS(USB_PORT_RESUME_DELAY)); + usb_pause_mtx(NULL, + USB_MS_TO_TICKS(USB_PORT_RESUME_DELAY)); } DPRINTF("Suspend was cancelled!\n"); return; @@ -2076,7 +2081,7 @@ usbd_set_power_mode(struct usb_device *u (power_mode != USB_POWER_MODE_OFF)) power_mode = USB_POWER_MODE_SAVE; - power_mode = usbd_filter_power_mode(udev, power_mode); + power_mode = usbd_filter_power_mode(udev, power_mode); udev->power_mode = power_mode; /* update copy of power mode */ Modified: user/weongyo/usb/sys/dev/usb/usb_hub.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_hub.h Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_hub.h Sat Oct 2 02:46:32 2010 (r213344) @@ -28,7 +28,7 @@ #define _USB_HUB_H_ /* - * The following structure defines an USB port. + * The following structure defines an USB port. */ struct usb_port { uint8_t restartcnt; Modified: user/weongyo/usb/sys/dev/usb/usb_mbuf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_mbuf.h Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_mbuf.h Sat Oct 2 02:46:32 2010 (r213344) @@ -43,45 +43,45 @@ struct usb_mbuf { uint8_t unused:7; }; -#define USB_IF_ENQUEUE(ifq, m) do { \ - (m)->usb_nextpkt = NULL; \ - if ((ifq)->ifq_tail == NULL) \ - (ifq)->ifq_head = (m); \ - else \ - (ifq)->ifq_tail->usb_nextpkt = (m); \ - (ifq)->ifq_tail = (m); \ - (ifq)->ifq_len++; \ - } while (0) - -#define USB_IF_DEQUEUE(ifq, m) do { \ - (m) = (ifq)->ifq_head; \ - if (m) { \ - if (((ifq)->ifq_head = (m)->usb_nextpkt) == NULL) { \ - (ifq)->ifq_tail = NULL; \ - } \ - (m)->usb_nextpkt = NULL; \ - (ifq)->ifq_len--; \ - } \ - } while (0) - -#define USB_IF_PREPEND(ifq, m) do { \ - (m)->usb_nextpkt = (ifq)->ifq_head; \ - if ((ifq)->ifq_tail == NULL) { \ - (ifq)->ifq_tail = (m); \ - } \ - (ifq)->ifq_head = (m); \ - (ifq)->ifq_len++; \ - } while (0) +#define USB_IF_ENQUEUE(ifq, m) do { \ + (m)->usb_nextpkt = NULL; \ + if ((ifq)->ifq_tail == NULL) \ + (ifq)->ifq_head = (m); \ + else \ + (ifq)->ifq_tail->usb_nextpkt = (m); \ + (ifq)->ifq_tail = (m); \ + (ifq)->ifq_len++; \ +} while (0) + +#define USB_IF_DEQUEUE(ifq, m) do { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->usb_nextpkt) == NULL) { \ + (ifq)->ifq_tail = NULL; \ + } \ + (m)->usb_nextpkt = NULL; \ + (ifq)->ifq_len--; \ + } \ +} while (0) + +#define USB_IF_PREPEND(ifq, m) do { \ + (m)->usb_nextpkt = (ifq)->ifq_head; \ + if ((ifq)->ifq_tail == NULL) { \ + (ifq)->ifq_tail = (m); \ + } \ + (ifq)->ifq_head = (m); \ + (ifq)->ifq_len++; \ +} while (0) #define USB_IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) #define USB_IF_QLEN(ifq) ((ifq)->ifq_len) #define USB_IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) #define USB_MBUF_RESET(m) do { \ - (m)->cur_data_ptr = (m)->min_data_ptr; \ - (m)->cur_data_len = (m)->max_data_len; \ - (m)->last_packet = 0; \ - } while (0) + (m)->cur_data_ptr = (m)->min_data_ptr; \ + (m)->cur_data_len = (m)->max_data_len; \ + (m)->last_packet = 0; \ +} while (0) /* prototypes */ void *usb_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq, Modified: user/weongyo/usb/sys/dev/usb/usb_msctest.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_msctest.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_msctest.c Sat Oct 2 02:46:32 2010 (r213344) @@ -284,7 +284,8 @@ bbb_command_callback(struct usb_xfer *xf USETDW(sc->cbw.dCBWSignature, CBWSIGNATURE); USETDW(sc->cbw.dCBWTag, tag); USETDW(sc->cbw.dCBWDataTransferLength, (uint32_t)sc->data_len); - sc->cbw.bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT); + sc->cbw.bCBWFlags = + ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT); sc->cbw.bCBWLUN = sc->lun; sc->cbw.bCDBLength = sc->cmd_len; if (sc->cbw.bCDBLength > sizeof(sc->cbw.CBWCDB)) { Modified: user/weongyo/usb/sys/dev/usb/usb_request.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_request.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_request.c Sat Oct 2 02:46:32 2010 (r213344) @@ -24,7 +24,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - */ + */ #include <sys/stdint.h> #include <sys/stddef.h> @@ -248,7 +248,7 @@ usb_do_clear_stall_callback(struct usb_x case USB_ST_SETUP: tr_setup: if (to == 0) - break; /* no endpoints - nothing to do */ + break; /* no endpoints - nothing to do */ if ((ep < ep_first) || (ep >= ep_end)) ep = ep_first; /* endpoint wrapped around */ if (ep->edesc && @@ -539,7 +539,7 @@ usbd_do_request_flags(struct usb_device if (dbg.ds_delay > 0) { usb_pause_mtx( xfer->xroot->xfer_mtx, - USB_MS_TO_TICKS(dbg.ds_delay)); + USB_MS_TO_TICKS(dbg.ds_delay)); /* make sure we don't time out */ start_ticks = ticks; } @@ -1405,8 +1405,8 @@ usbd_req_set_protocol(struct usb_device * Else: Failure *------------------------------------------------------------------------*/ usb_error_t -usbd_req_set_report(struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, - uint8_t iface_index, uint8_t type, uint8_t id) +usbd_req_set_report(struct usb_device *udev, struct mtx *mtx, + void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id) { struct usb_interface *iface = usbd_get_iface(udev, iface_index); struct usb_device_request req; @@ -1579,7 +1579,7 @@ usbd_req_re_enumerate(struct usb_device retry: err = usbd_req_reset_port(parent_hub, mtx, udev->port_no); if (err) { - DPRINTFN(0, "addr=%d, port reset failed, %s\n", + DPRINTFN(0, "addr=%d, port reset failed, %s\n", old_addr, usbd_errstr(err)); goto done; } @@ -1620,7 +1620,7 @@ retry: err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); if (err) { DPRINTFN(0, "addr=%d, getting device " - "descriptor failed, %s\n", old_addr, + "descriptor failed, %s\n", old_addr, usbd_errstr(err)); goto done; } Modified: user/weongyo/usb/sys/dev/usb/usb_request.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_request.h Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_request.h Sat Oct 2 02:46:32 2010 (r213344) @@ -69,7 +69,9 @@ usb_error_t usbd_req_set_hub_feature(str usb_error_t usbd_req_set_port_feature(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint16_t sel); usb_error_t usbd_req_re_enumerate(struct usb_device *udev, struct mtx *mtx); -usb_error_t usbd_req_clear_device_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel); -usb_error_t usbd_req_set_device_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel); +usb_error_t usbd_req_clear_device_feature(struct usb_device *udev, + struct mtx *mtx, uint16_t sel); +usb_error_t usbd_req_set_device_feature(struct usb_device *udev, + struct mtx *mtx, uint16_t sel); #endif /* _USB_REQUEST_H_ */ Modified: user/weongyo/usb/sys/dev/usb/usb_sleepout.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_sleepout.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_sleepout.c Sat Oct 2 02:46:32 2010 (r213344) @@ -119,5 +119,4 @@ sleepout_drain(struct sleepout_task *st) taskqueue_drain(s->s_taskqueue, &st->st_task); return (callout_drain(&st->st_callout)); - } Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Sat Oct 2 02:29:10 2010 (r213343) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Sat Oct 2 02:46:32 2010 (r213344) @@ -22,7 +22,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - */ + */ #include <sys/stdint.h> #include <sys/stddef.h> @@ -107,7 +107,7 @@ static void usbd_callback_wrapper(struct static void usb_dma_delay_done_cb(void *); static void usbd_transfer_start_cb(void *); static uint8_t usbd_callback_wrapper_sub(struct usb_xfer *); -static void usbd_get_std_packet_size(struct usb_std_packet_size *ptr, +static void usbd_get_std_packet_size(struct usb_std_packet_size *ptr, uint8_t type, enum usb_dev_speed speed); /*------------------------------------------------------------------------* @@ -443,7 +443,7 @@ usbd_transfer_setup_sub(struct usb_setup else if (xfer->interval > 16) xfer->interval = (1<<(16-4)); else - xfer->interval = + xfer->interval = (1 << (xfer->interval-4)); break; case USB_SPEED_HIGH: @@ -1225,9 +1225,9 @@ usbd_setup_ctrl_transfer(struct usb_xfer } /* - * Check if there is a control - * transfer in progress: - */ + * Check if there is a control + * transfer in progress: + */ if ((xfer->status & XFER_STATUS_CTRLACTIVE) != 0) { if ((xfer->status & XFER_STATUS_CTRLHDR) != 0) { /* clear send header flag */ @@ -1253,10 +1253,10 @@ usbd_setup_ctrl_transfer(struct usb_xfer /* check number of frames */ if (xfer->nframes != 1) { /* - * We need to receive the setup - * message first so that we know the - * data direction! - */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010020246.o922kWQB024496>