From owner-p4-projects@FreeBSD.ORG Thu Nov 8 22:19:20 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E693016A469; Thu, 8 Nov 2007 22:19:19 +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 AA9DD16A420 for ; Thu, 8 Nov 2007 22:19:19 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 9AE8B13C4A6 for ; Thu, 8 Nov 2007 22:19:19 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lA8MJJBY001737 for ; Thu, 8 Nov 2007 22:19:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lA8MJJI8001734 for perforce@freebsd.org; Thu, 8 Nov 2007 22:19:19 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 8 Nov 2007 22:19:19 GMT Message-Id: <200711082219.lA8MJJI8001734@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 128847 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Nov 2007 22:19:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=128847 Change 128847 by hselasky@hselasky_laptop001 on 2007/11/08 22:19:02 Style USB code using "usb_style.sh". Affected files ... .. //depot/projects/usb/src/sys/dev/ata/ata-usb.c#23 edit .. //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#21 edit .. //depot/projects/usb/src/sys/dev/sound/usb/uaudioreg.h#7 edit .. //depot/projects/usb/src/sys/dev/usb/ehci.c#46 edit .. //depot/projects/usb/src/sys/dev/usb/ehci.h#19 edit .. //depot/projects/usb/src/sys/dev/usb/if_zydreg.h#7 edit .. //depot/projects/usb/src/sys/dev/usb/ohci.c#36 edit .. //depot/projects/usb/src/sys/dev/usb/ohci.h#15 edit .. //depot/projects/usb/src/sys/dev/usb/uhci.c#38 edit .. //depot/projects/usb/src/sys/dev/usb/uhci.h#16 edit .. //depot/projects/usb/src/sys/dev/usb/ukbd.c#26 edit .. //depot/projects/usb/src/sys/dev/usb/umass.c#30 edit .. //depot/projects/usb/src/sys/dev/usb/ums.c#27 edit .. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#10 edit .. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#6 edit .. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#47 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#38 edit .. //depot/projects/usb/src/sys/dev/usb/uscanner.c#14 edit .. //depot/projects/usb/src/sys/dev/usb/uvisor.c#24 edit Differences ... ==== //depot/projects/usb/src/sys/dev/ata/ata-usb.c#23 (text) ==== @@ -66,7 +66,7 @@ #define CBWCDBLENGTH 16 uint8_t cdb[CBWCDBLENGTH]; -} __packed; +} __packed; /* Command Status Wrapper */ struct bbb_csw { @@ -79,7 +79,7 @@ #define CSWSTATUS_GOOD 0x0 #define CSWSTATUS_FAILED 0x1 #define CSWSTATUS_PHASE 0x2 -} __packed; +} __packed; /* USB-ATA 'controller' softc */ struct atausb_softc { @@ -861,7 +861,7 @@ uint8_t product[16]; uint8_t revision[4]; /* uint8_t crap[60]; */ -} __packed; +} __packed; static int ata_usbchannel_begin_transaction(struct ata_request *request) ==== //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#21 (text+ko) ==== @@ -2682,7 +2682,7 @@ /* * "j" (output) <--- virtual wire <--- "id" (input) - * + * * if "j" has "id" on the input, then "id" have "j" on * the output, because they are connected: */ ==== //depot/projects/usb/src/sys/dev/sound/usb/uaudioreg.h#7 (text+ko) ==== @@ -81,7 +81,7 @@ uWord wTotalLength; uByte bInCollection; uByte baInterfaceNr[1]; -} __packed; +} __packed; struct usb_audio_streaming_interface_descriptor { uByte bLength; @@ -90,7 +90,7 @@ uByte bTerminalLink; uByte bDelay; uWord wFormatTag; -} __packed; +} __packed; struct usb_audio_streaming_endpoint_descriptor { uByte bLength; @@ -102,7 +102,7 @@ #define UA_SED_MAXPACKETSONLY 0x80 uByte bLockDelayUnits; uWord wLockDelay; -} __packed; +} __packed; struct usb_audio_streaming_type1_descriptor { uByte bLength; @@ -120,7 +120,7 @@ ((p)->tSamFreq[((n)*3)+2] << 16)) #define UA_SAMP_LO(p) UA_GETSAMP(p, 0) #define UA_SAMP_HI(p) UA_GETSAMP(p, 1) -} __packed; +} __packed; struct usb_audio_cluster { uByte bNrChannels; @@ -138,7 +138,7 @@ #define UA_CHANNEL_R_SIDE 0x0400 #define UA_CHANNEL_TOP 0x0800 uByte iChannelNames; -} __packed; +} __packed; /* Shared by all units and terminals */ struct usb_audio_unit { @@ -160,7 +160,7 @@ uWord wChannelConfig; uByte iChannelNames; /* uByte iTerminal; */ -} __packed; +} __packed; /* UDESCSUB_AC_OUTPUT */ struct usb_audio_output_terminal { @@ -172,7 +172,7 @@ uByte bAssocTerminal; uByte bSourceId; uByte iTerminal; -} __packed; +} __packed; /* UDESCSUB_AC_MIXER */ struct usb_audio_mixer_unit_0 { @@ -183,14 +183,14 @@ uByte bNrInPins; uByte baSourceId[0]; /* [bNrInPins] */ /* struct usb_audio_mixer_unit_1 */ -} __packed; +} __packed; struct usb_audio_mixer_unit_1 { uByte bNrChannels; uWord wChannelConfig; uByte iChannelNames; uByte bmControls[0]; /* [see source code] */ /* uByte iMixer; */ -} __packed; +} __packed; /* UDESCSUB_AC_SELECTOR */ struct usb_audio_selector_unit { @@ -201,7 +201,7 @@ uByte bNrInPins; uByte baSourceId[0]; /* [bNrInPins] */ /* uByte iSelector; */ -} __packed; +} __packed; /* UDESCSUB_AC_FEATURE */ struct usb_audio_feature_unit { @@ -213,7 +213,7 @@ uByte bControlSize; uByte bmaControls[0]; /* [bControlSize * x] */ /* uByte iFeature; */ -} __packed; +} __packed; /* UDESCSUB_AC_PROCESSING */ struct usb_audio_processing_unit_0 { @@ -225,7 +225,7 @@ uByte bNrInPins; uByte baSourceId[0]; /* [bNrInPins] */ /* struct usb_audio_processing_unit_1 */ -} __packed; +} __packed; struct usb_audio_processing_unit_1 { uByte bNrChannels; uWord wChannelConfig; @@ -233,13 +233,13 @@ uByte bControlSize; uByte bmControls[0]; /* [bControlSize] */ #define UA_PROC_ENABLE_MASK 1 -} __packed; +} __packed; struct usb_audio_processing_unit_updown { uByte iProcessing; uByte bNrModes; uWord waModes[0]; /* [bNrModes] */ -} __packed; +} __packed; /* UDESCSUB_AC_EXTENSION */ struct usb_audio_extension_unit_0 { @@ -251,7 +251,7 @@ uByte bNrInPins; uByte baSourceId[0]; /* [bNrInPins] */ /* struct usb_audio_extension_unit_1 */ -} __packed; +} __packed; struct usb_audio_extension_unit_1 { uByte bNrChannels; uWord wChannelConfig; @@ -261,7 +261,7 @@ #define UA_EXT_ENABLE_MASK 1 #define UA_EXT_ENABLE 1 /* uByte iExtension; */ -} __packed; +} __packed; /* USB terminal types */ #define UAT_UNDEFINED 0x0100 ==== //depot/projects/usb/src/sys/dev/usb/ehci.c#46 (text+ko) ==== @@ -1660,7 +1660,7 @@ /* * NOTE: The "average" variable is never zero after * exiting the loop above ! - * + * * NOTE: We have to subtract one from the offset to * ensure that we are computing the physical address * of a valid page ! @@ -2212,7 +2212,7 @@ /* * wait until the hardware has finished any possible * use of the transfer descriptor and QH - * + * * in case "need_delay" is set, wait until the next * isochronous frame is started */ @@ -2460,7 +2460,7 @@ /* * TODO: make some kind of automatic SMASK/CMASK selection * based on micro-frame usage - * + * * micro-frame usage (8 microframes per 1ms) */ td->sitd_back = htole32(EHCI_LINK_TERMINATE); @@ -3624,14 +3624,14 @@ /* * The proof for the "nqtd" formula is illustrated like * this: - * + * * | remainder +-----+---+ frm 0 | xxx | x | +-----+---++ frm 1 * | xxx | xx | +-----+----+ ... | - * + * * "xxx" means a completely full USB transfer descriptor - * + * * "x" and "xx" means a short USB packet - * + * * For the remainder of an USB transfer modulo * "max_data_length" we need two USB transfer descriptors. * One to transfer the remaining data and one to finalise ==== //depot/projects/usb/src/sys/dev/usb/ehci.h#19 (text+ko) ==== @@ -438,7 +438,7 @@ struct usbd_bus sc_bus; /* base device */ struct usbd_config_td sc_config_td; struct __callout sc_tmo_pcd; - LIST_HEAD(, usbd_xfer) sc_interrupt_list_head; + LIST_HEAD(, usbd_xfer) sc_interrupt_list_head; union ehci_hub_desc sc_hub_desc; struct usbd_std_root_transfer sc_root_ctrl; struct usbd_std_root_transfer sc_root_intr; ==== //depot/projects/usb/src/sys/dev/usb/if_zydreg.h#7 (text+ko) ==== @@ -1128,7 +1128,7 @@ uint16_t currentlength; uint8_t service; uint16_t nextframelen; -} __packed; +} __packed; struct zyd_rxstatusreport { uint8_t signalstrength; @@ -1139,14 +1139,14 @@ uint8_t modulationtype:1; uint8_t rxerrorreason:6; uint8_t errorindication:1; -} __packed; +} __packed; /* Appended length info for multiframe transmission */ struct zyd_rxleninfoapp { uWord len[3]; uWord marker; /* 0x697E */ #define ZYD_MULTIFRAME_MARKER 0x697E -} __packed; +} __packed; struct zyd_aw_pt_bi { uint32_t atim_wnd_period; @@ -1176,11 +1176,11 @@ /* RF2595: 24 */ uWord bit_values[ZYD_REQ_RFWRITE_BITS_MAX]; /* (CR203 & ~(RF_IF_LE | RF_CLK | RF_DATA)) | (bit ? RF_DATA : 0) */ -} __packed; +} __packed; struct zyd_macaddr { uint8_t addr[6]; -} __packed; +} __packed; /* Control interface @ EP 0 */ struct zyd_control { @@ -1190,7 +1190,7 @@ uint16_t index; uint16_t length; void *data; -} __packed; +} __packed; /* Int IN interface @ EP 3 (single register access) */ struct zyd_intinsingle { @@ -1200,7 +1200,7 @@ uWord sts3; uWord sts4; uWord sts5; -} __packed; +} __packed; /* Int/bulk OUT interface @ EP 4 (single register access) */ struct zyd_intoutsingle { @@ -1210,33 +1210,33 @@ uWord length; uWord data1; uWord data2; -} __packed; +} __packed; /* Register addr/data combo */ struct zyd_regadcombo { uWord addr; uWord data; -} __packed; +} __packed; /* Int IN interface @ EP 3 (multi register access) output */ struct zyd_intinmultioutput { uWord id; /* pairs of addr-data-addr-data-... */ struct zyd_regadcombo registers[15]; -} __packed; +} __packed; /* Int/bulk OUT interface @ EP 4 (multi register access) read */ struct zyd_intoutmultiread { uWord id; uWord addr[15]; -} __packed; +} __packed; /* Int/bulk OUT interface @ EP 4 (multi register access) write */ struct zyd_intoutmultiwrite { uWord id; /* pairs of addr-data-addr-data-... */ struct zyd_regadcombo registers[15]; -} __packed; +} __packed; /* Pairs of address and 16-bit data. For batch write. */ struct zyd_adpairs16 { ==== //depot/projects/usb/src/sys/dev/usb/ohci.c#36 (text+ko) ==== @@ -1748,7 +1748,7 @@ /* * wait until hardware has finished any possible use of the * transfer and QH - * + * * hardware finishes in 1 millisecond */ DELAY(need_delay ? (2 * 1000) : (5)); ==== //depot/projects/usb/src/sys/dev/usb/ohci.h#15 (text+ko) ==== @@ -312,7 +312,7 @@ struct usbd_bus sc_bus; /* base device */ struct usbd_config_td sc_config_td; struct __callout sc_tmo_rhsc; - LIST_HEAD(, usbd_xfer) sc_interrupt_list_head; + LIST_HEAD(, usbd_xfer) sc_interrupt_list_head; union ohci_hub_desc sc_hub_desc; struct usbd_std_root_transfer sc_root_ctrl; struct usbd_std_root_transfer sc_root_intr; ==== //depot/projects/usb/src/sys/dev/usb/uhci.c#38 (text+ko) ==== @@ -737,9 +737,9 @@ /* * uhci_dump_qhs displays all the QHs and TDs from the given QH * onwards Traverses sideways first, then down. - * + * * QH1 QH2 No QH TD2.1 TD2.2 TD1.1 etc. - * + * * TD2.x being the TDs queued at QH2 and QH1 being referenced from QH1. */ @@ -1979,7 +1979,7 @@ /* * wait until hardware has finished any possible use of the * transfer and QH - * + * * hardware finishes in 1 millisecond */ DELAY(need_delay ? ((3 * 1000) / 2) : UHCI_QH_REMOVE_DELAY); ==== //depot/projects/usb/src/sys/dev/usb/uhci.h#16 (text+ko) ==== @@ -265,7 +265,7 @@ struct usbd_page sc_hw_page; struct usbd_bus sc_bus; /* base device */ struct usbd_config_td sc_config_td; - LIST_HEAD(, usbd_xfer) sc_interrupt_list_head; + LIST_HEAD(, usbd_xfer) sc_interrupt_list_head; union uhci_hub_desc sc_hub_desc; struct usbd_std_root_transfer sc_root_ctrl; struct usbd_std_root_transfer sc_root_intr; ==== //depot/projects/usb/src/sys/dev/usb/ukbd.c#26 (text+ko) ==== @@ -238,7 +238,7 @@ static int ukbd_set_typematic(keyboard_t *kbd, int code); #ifdef UKBD_EMULATE_ATSCANCODE -static int +static int ukbd_key2scan(struct ukbd_softc *sc, int keycode, int shift, int up); ==== //depot/projects/usb/src/sys/dev/usb/umass.c#30 (text+ko) ==== @@ -2591,7 +2591,7 @@ /* * A HBA is attached to the CAM layer. - * + * * The CAM layer will then after a while start probing for devices on * the bus. The number of SIMs is limited to one. */ @@ -2768,7 +2768,7 @@ * Verify, depending on the operation to perform, that we either got * a valid sc, because an existing target was referenced, or * otherwise the SIM is addressed. - * + * * This avoids bombing out at a printf and does give the CAM layer some * sensible feedback on errors. */ ==== //depot/projects/usb/src/sys/dev/usb/ums.c#27 (text+ko) ==== @@ -270,8 +270,8 @@ sc->sc_status.dy += dy; sc->sc_status.dz += dz; /* - * sc->sc_status.dt += dt; *//* no way to export - * this yet + * sc->sc_status.dt += dt; + * no way to export this yet */ /* ==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#10 (text+ko) ==== @@ -72,29 +72,28 @@ * FreeBSD USB interface *------------------------------------------------------------------------*/ -static -LIST_HEAD(, usb_linux_softc) usb_linux_attached_list; - static LIST_HEAD(, usb_driver) usb_linux_driver_list; +static LIST_HEAD(, usb_linux_softc) usb_linux_attached_list; +static LIST_HEAD(, usb_driver) usb_linux_driver_list; - static device_method_t usb_linux_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, usb_linux_probe), - DEVMETHOD(device_attach, usb_linux_attach), - DEVMETHOD(device_detach, usb_linux_detach), - DEVMETHOD(device_suspend, usb_linux_suspend), - DEVMETHOD(device_resume, usb_linux_resume), - DEVMETHOD(device_shutdown, usb_linux_shutdown), +static device_method_t usb_linux_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, usb_linux_probe), + DEVMETHOD(device_attach, usb_linux_attach), + DEVMETHOD(device_detach, usb_linux_detach), + DEVMETHOD(device_suspend, usb_linux_suspend), + DEVMETHOD(device_resume, usb_linux_resume), + DEVMETHOD(device_shutdown, usb_linux_shutdown), - {0, 0} - }; + {0, 0} +}; - static driver_t usb_linux_driver = { - .name = "usb_linux", - .methods = usb_linux_methods, - .size = sizeof(struct usb_linux_softc), - }; +static driver_t usb_linux_driver = { + .name = "usb_linux", + .methods = usb_linux_methods, + .size = sizeof(struct usb_linux_softc), +}; - static devclass_t usb_linux_devclass; +static devclass_t usb_linux_devclass; DRIVER_MODULE(usb_linux, uhub, usb_linux_driver, usb_linux_devclass, usbd_driver_load, 0); MODULE_DEPEND(usb_linux, usb, 1, 1, 1); @@ -107,8 +106,8 @@ * If it finds a match the matching entry will be returned. * Else "NULL" will be returned. *------------------------------------------------------------------------*/ - static const struct usb_device_id * - usb_linux_lookup_id(const struct usb_device_id *id, struct usb_attach_arg *uaa) +static const struct usb_device_id * +usb_linux_lookup_id(const struct usb_device_id *id, struct usb_attach_arg *uaa) { usb_interface_descriptor_t *idesc; usb_device_descriptor_t *dd; @@ -630,7 +629,7 @@ /* * NOTE: we need to allocate real memory here so that we don't * transfer data to/from the stack! - * + * * 0xFFFF is a FreeBSD specific magic value. */ urb = usb_alloc_urb(0xFFFF, size); ==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#6 (text+ko) ==== @@ -325,7 +325,7 @@ struct usb_host_endpoint { struct usb_endpoint_descriptor desc; - TAILQ_HEAD(, urb) bsd_urb_list; + TAILQ_HEAD(, urb) bsd_urb_list; struct usbd_xfer *bsd_xfer[2]; ==== //depot/projects/usb/src/sys/dev/usb/usb_subr.c#47 (text+ko) ==== @@ -1199,7 +1199,7 @@ /* * ``bNumInterface'' is checked by * ``usbd_set_config_index()'' - * + * * ``USBD_CLR_IFACE_NO_PROBE()'' is run by * ``usbd_fill_iface_data()'', which is * called by ``usbd_set_config_index()'' @@ -2513,36 +2513,36 @@ * "used" queue and executing it must be atomic, with regard * to the "p_mtx" mutex. That means any attempt to queue a * command by another thread must be blocked until either: - * + * * 1) the command sleeps - * + * * 2) the command returns - * + * * Here is a practical example that shows how this helps * solving a problem: - * + * * Assume that you want to set the baud rate on a USB serial * device. During the programming of the device you don't * want to receive nor transmit any data, because it will be * garbage most likely anyway. The programming of our USB * device takes 20 milliseconds and it needs to call * functions that sleep. - * + * * Non-working solution: Before we queue the programming * command, we stop transmission and reception of data. Then * we queue a programming command. At the end of the * programming command we enable transmission and reception * of data. - * + * * Problem: If a second programming command is queued while the * first one is sleeping, we end up enabling transmission * and reception of data too early. - * + * * Working solution: Before we queue the programming command, * we stop transmission and reception of data. Then we queue * a programming command. Then we queue a second command * that only enables transmission and reception of data. - * + * * Why it works: If a second programming command is queued * while the first one is sleeping, then the queueing of a * second command to enable the data transfers, will cause @@ -2550,7 +2550,7 @@ * removed from the queue, and re-inserted after the last * baud rate programming command, which then gives the * desired result. - * + * * This example assumes that you use a "qcount" of zero. */ ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#38 (text+ko) ==== @@ -390,7 +390,7 @@ /* * BSD specific requirement: - * + * * In case we are transferring more than one USB frame * consisting of up to 3 USB packets, make sure that the USB * frame size is divisible by 8. This is supposed to @@ -862,10 +862,10 @@ * HINT: when you start/stop a transfer, it * might be a good idea to directly use the * "pxfer[]" structure: - * + * * usbd_transfer_start(sc->pxfer[0]); * usbd_transfer_stop(sc->pxfer[0]); - * + * * That way, if your code has many parts that * will not stop running under the same * lock, in other words "priv_mtx", the @@ -873,7 +873,7 @@ * usbd_transfer_stop functions will simply * return when they detect a NULL pointer * argument. - * + * * To avoid any races we clear the "pxfer[]" * pointer while holding the private mutex * of the driver: @@ -1541,11 +1541,11 @@ } /* * Handled cases: - * + * * 1) Start the first transfer queued. This transfer is always last on * the pipe transfer list! "le_next" is NULL. "le_prev" is also * NULL. - * + * * 2) Start the last transfer if it is already queued. We are most * likely resuming a control transfer. "le_next" is NULL. "le_prev" * is not NULL. ==== //depot/projects/usb/src/sys/dev/usb/uscanner.c#14 (text+ko) ==== @@ -129,7 +129,7 @@ /* * Prototypes for the character device handling routines. */ -static int32_t +static int32_t uscanner_open(struct usb_cdev *cdev, int32_t fflags, int32_t devtype, struct thread *td); static void uscanner_start_read(struct usb_cdev *cdev); ==== //depot/projects/usb/src/sys/dev/usb/uvisor.c#24 (text+ko) ==== @@ -118,7 +118,7 @@ uByte port_function_id; uByte port; } __packed connections[UVISOR_MAX_CONN]; -} __packed; +} __packed; #define UVISOR_CONNECTION_INFO_SIZE 18 @@ -149,7 +149,7 @@ uByte end_point_info; uWord reserved; } __packed connections[UVISOR_MAX_CONN]; -} __packed; +} __packed; struct uvisor_softc { struct ucom_super_softc sc_super_ucom;