From owner-p4-projects@FreeBSD.ORG Tue Oct 12 14:44:48 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AF3201065674; Tue, 12 Oct 2010 14:44:48 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 641DA1065670 for ; Tue, 12 Oct 2010 14:44:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 4E7C88FC0A for ; Tue, 12 Oct 2010 14:44:48 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9CEimcp013511 for ; Tue, 12 Oct 2010 14:44:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9CEim7A013508 for perforce@freebsd.org; Tue, 12 Oct 2010 14:44:48 GMT (envelope-from hselasky@FreeBSD.org) Date: Tue, 12 Oct 2010 14:44:48 GMT Message-Id: <201010121444.o9CEim7A013508@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 184619 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 14:44:49 -0000 http://p4web.freebsd.org/@@184619?ac=10 Change 184619 by hselasky@hselasky_laptop001 on 2010/10/12 14:44:02 IFC Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_dev.c#48 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_dev.h#19 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_device.c#81 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_hub.c#60 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_msctest.c#18 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_msctest.h#8 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_request.c#44 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#188 integrate .. //depot/projects/usb/src/sys/dev/usb/wlan/if_run.c#21 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_dev.c#48 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_dev.c,v 1.39 2010/06/11 19:27:21 avg Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_dev.c,v 1.41 2010/10/04 22:21:30 hselasky Exp $ */ /*- * Copyright (c) 2006-2008 Hans Petter Selasky. All rights reserved. * @@ -153,8 +153,6 @@ static TAILQ_HEAD(, usb_symlink) usb_sym_head; static struct sx usb_sym_lock; -static struct cv usb_enum_cv; -static int usb_enum_tick; struct mtx usb_ref_lock; @@ -174,21 +172,6 @@ } /*------------------------------------------------------------------------* - * usb_enum_broadcast - * - * This function is used to wakeup userland threads waiting for USB - * enumeration. - *------------------------------------------------------------------------*/ -void -usb_enum_broadcast(void) -{ - mtx_lock(&usb_ref_lock); - usb_enum_tick = ticks; - cv_broadcast(&usb_enum_cv); - mtx_unlock(&usb_ref_lock); -} - -/*------------------------------------------------------------------------* * usb_ref_device * * This function is used to atomically refer an USB device by its @@ -951,8 +934,6 @@ { mtx_init(&usb_ref_lock, "USB ref mutex", NULL, MTX_DEF); sx_init(&usb_sym_lock, "USB sym mutex"); - cv_init(&usb_enum_cv, "USB enumeration"); - TAILQ_INIT(&usb_sym_head); /* check the UGEN methods */ @@ -983,18 +964,9 @@ if (usb_dev != NULL) { destroy_dev(usb_dev); usb_dev = NULL; - } - - /* wake up any left-overs */ - usb_enum_broadcast(); - - /* wait for any left-overs to return */ - pause("WENUM", hz / 2); - mtx_destroy(&usb_ref_lock); sx_destroy(&usb_sym_lock); - cv_destroy(&usb_enum_cv); } SYSUNINIT(usb_dev_uninit, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_dev_uninit, NULL); @@ -1505,76 +1477,37 @@ { union { struct usb_read_dir *urd; - struct usb_wait_enumeration *uwe; void* data; } u; - int error; - int delta; - int timeout; + int err; u.data = data; switch (cmd) { case USB_READ_DIR: - error = usb_read_symlink(u.urd->urd_data, + err = usb_read_symlink(u.urd->urd_data, u.urd->urd_startentry, u.urd->urd_maxlen); break; case USB_DEV_QUIRK_GET: case USB_QUIRK_NAME_GET: case USB_DEV_QUIRK_ADD: case USB_DEV_QUIRK_REMOVE: - error = usb_quirk_ioctl_p(cmd, data, fflag, td); + err = usb_quirk_ioctl_p(cmd, data, fflag, td); break; case USB_GET_TEMPLATE: *(int *)data = usb_template; - error = 0; + err = 0; break; case USB_SET_TEMPLATE: - error = priv_check(curthread, PRIV_DRIVER); - if (error) + err = priv_check(curthread, PRIV_DRIVER); + if (err) break; usb_template = *(int *)data; break; - case USB_WAIT_ENUMERATION: - mtx_lock(&usb_ref_lock); - /* - * Check if there was a recent enumeration or - * detach event. Else wait for the next - * enumeration event. - */ - delta = ticks - usb_enum_tick; - if ((delta >= 0) && (delta <= (hz / 4))) { - error = 0; - } else if (u.uwe->timeout != 0) { - - /* subtract post-delay from timeout */ - timeout = u.uwe->timeout; - if (timeout >= 251) - timeout -= 250; - else - timeout = 1; - - /* wait for enumeration or timeout */ - error = cv_timedwait_sig(&usb_enum_cv, - &usb_ref_lock, USB_MS_TO_TICKS(timeout)); - - /* timeouts are not considered errors */ - if (error == EWOULDBLOCK) - error = 0; - } else { - /* wait for enumeration */ - error = cv_wait_sig(&usb_enum_cv, - &usb_ref_lock); - } - mtx_unlock(&usb_ref_lock); - - /* Wait a little bit for stuff to stabilise */ - usb_pause_mtx(NULL, hz / 4); - break; default: - error = ENOTTY; + err = ENOTTY; break; } - return (error); + return (err); } static int ==== //depot/projects/usb/src/sys/dev/usb/usb_dev.h#19 (text+ko) ==== @@ -150,6 +150,5 @@ void usb_free_symlink(struct usb_symlink *ps); int usb_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len); -void usb_enum_broadcast(void); #endif /* _USB_DEV_H_ */ ==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#81 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_device.c,v 1.64 2010/09/02 04:39:45 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_device.c,v 1.65 2010/10/04 23:18:05 hselasky Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -145,28 +145,19 @@ const char * usb_get_manufacturer(struct usb_device *udev) { - if ((udev != NULL) && (udev->manufacturer != NULL)) - return (udev->manufacturer); - else - return ("Unknown"); + return (udev->manufacturer ? udev->manufacturer : "Unknown"); } const char * usb_get_product(struct usb_device *udev) { - if ((udev != NULL) && (udev->product != NULL)) - return (udev->product); - else - return (""); + return (udev->product ? udev->product : ""); } const char * usb_get_serial(struct usb_device *udev) { - if ((udev != NULL) && (udev->serial != NULL)) - return (udev->serial); - else - return (""); + return (udev->serial ? udev->serial : ""); } /*------------------------------------------------------------------------* @@ -2443,8 +2434,6 @@ device_get_nameunit(device_get_parent(udev->bus->bdev))); devctl_queue_data(data); - - usb_enum_broadcast(); } #endif ==== //depot/projects/usb/src/sys/dev/usb/usb_hub.c#60 (text+ko) ==== @@ -1,8 +1,8 @@ -/* $FreeBSD: src/sys/dev/usb/usb_hub.c,v 1.41 2010/09/02 04:39:45 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_hub.c,v 1.43 2010/10/04 23:18:05 hselasky Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -798,8 +798,8 @@ * The subclass for USB HUBs is currently ignored because it * is 0 for some and 1 for others. */ - if ((uaa->info.bConfigIndex == 0) && - (uaa->info.bDeviceClass == UDCLASS_HUB)) + if (uaa->info.bConfigIndex == 0 && + uaa->info.bDeviceClass == UDCLASS_HUB) return (0); return (ENXIO); @@ -909,7 +909,7 @@ } if (!udev->flags.self_powered && parent_hub && - (!parent_hub->flags.self_powered)) { + !parent_hub->flags.self_powered) { DPRINTFN(0, "Bus powered HUB connected to " "bus powered HUB. HUB ignored\n"); goto error; @@ -2313,7 +2313,6 @@ /* check if all devices on the HUB are suspended */ for (x = 0; x != nports; x++) { - child = usb_bus_port_get_device(udev->bus, udev->hub->ports + x); @@ -2330,7 +2329,6 @@ if (usb_peer_can_wakeup(udev) && usb_device_20_compatible(udev)) { - /* * This request needs to be done before we set * "udev->flags.self_suspended": @@ -2362,7 +2360,6 @@ USB_BUS_UNLOCK(udev->bus); if (err != 0) { - if (usb_peer_can_wakeup(udev) && usb_device_20_compatible(udev)) { /* allow device to do remote wakeup */ ==== //depot/projects/usb/src/sys/dev/usb/usb_msctest.c#18 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_msctest.c,v 1.15 2010/02/14 20:05:12 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_msctest.c,v 1.18 2010/10/12 09:41:42 glebius Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -97,6 +97,7 @@ static uint8_t scsi_huawei_eject[] = { 0x11, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -467,7 +468,6 @@ sc->data_rem = data_len; sc->data_timeout = (data_timeout + USB_MS_HZ); sc->actlen = 0; - sc->data_ptr = data_ptr; sc->cmd_len = cmd_len; bzero(&sc->cbw.CBWCDB, sizeof(sc->cbw.CBWCDB)); bcopy(cmd_ptr, &sc->cbw.CBWCDB, cmd_len); @@ -619,6 +619,15 @@ &scsi_huawei_eject, sizeof(scsi_huawei_eject), USB_MS_HZ); break; + case MSC_EJECT_TCT: + /* + * TCTMobile needs DIR_IN flag. To get it, we + * supply a dummy data with the command. + */ + err = bbb_command_start(sc, DIR_IN, 0, &sc->buffer, + sizeof(sc->buffer), &scsi_tct_eject, + sizeof(scsi_tct_eject), USB_MS_HZ); + break; default: printf("usb_msc_eject: unknown eject method (%d)\n", method); break; ==== //depot/projects/usb/src/sys/dev/usb/usb_msctest.h#8 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_msctest.h,v 1.7 2010/02/14 20:05:12 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_msctest.h,v 1.8 2010/10/06 14:29:00 glebius Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -33,6 +33,7 @@ MSC_EJECT_ZTESTOR, MSC_EJECT_CMOTECH, MSC_EJECT_HUAWEI, + MSC_EJECT_TCT, }; int usb_iface_is_cdrom(struct usb_device *udev, ==== //depot/projects/usb/src/sys/dev/usb/usb_request.c#44 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_request.c,v 1.30 2010/05/12 23:40:44 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_request.c,v 1.32 2010/10/04 23:18:05 hselasky Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. @@ -447,12 +447,6 @@ if (hr_func != NULL) { DPRINTF("Handle Request function is set\n"); - /* check for dry run */ - if (flags & USB_DRY_RUN) { - DPRINTF("Dry run\n"); - goto done; - } - desc = NULL; temp = 0; @@ -509,11 +503,6 @@ err = USB_ERR_NOMEM; goto done; } - /* check for dry run */ - if (flags & USB_DRY_RUN) { - DPRINTF("Dry run\n"); - goto done; - } #ifdef USB_REQ_DEBUG /* Get debug bits */ @@ -1035,14 +1024,13 @@ * and a few more to avoid any problems with scripts * and daemons. */ - if (((*s >= 'a') && (*s <= 'z')) || - ((*s >= 'A') && (*s <= 'Z')) || - ((*s >= '0') && (*s <= '9')) || - (*s == '-') || - (*s == '+') || - (*s == ' ') || - (*s == '.') || - (*s == ',')) { + if (isalpha(*s) || + isdigit(*s) || + *s == '-' || + *s == '+' || + *s == ' ' || + *s == '.' || + *s == ',') { /* allowed */ s++; } ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#188 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_transfer.c,v 1.41 2010/09/02 04:01:18 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_transfer.c,v 1.42 2010/10/04 23:18:05 hselasky Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -2630,10 +2630,10 @@ * If we have a non-hardware induced error we * need to do the DMA delay! */ - if ((xfer->error != 0) && (!xfer->flags_int.did_dma_delay) && - ((xfer->error == USB_ERR_CANCELLED) || - (xfer->error == USB_ERR_TIMEOUT) || - (bus->methods->start_dma_delay != NULL))) { + if (xfer->error != 0 && !xfer->flags_int.did_dma_delay && + (xfer->error == USB_ERR_CANCELLED || + xfer->error == USB_ERR_TIMEOUT || + bus->methods->start_dma_delay != NULL)) { usb_timeout_t temp; @@ -2917,10 +2917,10 @@ USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); /* check that we have a valid case */ - if ((udev->flags.usb_mode == USB_MODE_HOST) && - (udev->parent_hub != NULL) && - (udev->bus->methods->clear_stall != NULL) && - (ep->methods != NULL)) { + if (udev->flags.usb_mode == USB_MODE_HOST && + udev->parent_hub != NULL && + udev->bus->methods->clear_stall != NULL && + ep->methods != NULL) { (udev->bus->methods->clear_stall) (udev, ep); } } ==== //depot/projects/usb/src/sys/dev/usb/wlan/if_run.c#21 (text+ko) ==== @@ -1767,6 +1767,7 @@ struct ieee80211com *ic = vap->iv_ic; struct run_softc *sc = ic->ic_ifp->if_softc; struct run_vap *rvp = RUN_VAP(vap); + struct ieee80211_node *ni; enum ieee80211_state ostate; uint32_t sta[3]; uint32_t tmp;