Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Stop using the compatibility macros USB_ATTACH()...



details:   https://anonhg.NetBSD.org/src/rev/8dc9ee6325ad
branches:  trunk
changeset: 758387:8dc9ee6325ad
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Nov 03 22:28:31 2010 +0000

description:
Stop using the compatibility macros USB_ATTACH(), USB_DETACH(),
USB_MATCH(), et cetera.  These files produce the same assembly
(according to objdump -d) before and after the change, except for
if_cue.c where two adjacent instructions inexplicably change order.

diffstat:

 sys/dev/usb/if_atu.c  |  226 ++++++++++++++++++++++++------------------------
 sys/dev/usb/if_aue.c  |   12 +-
 sys/dev/usb/if_axe.c  |   26 ++--
 sys/dev/usb/if_cue.c  |  155 +++++++++++++++++---------------
 sys/dev/usb/if_kue.c  |  152 +++++++++++++++++---------------
 sys/dev/usb/if_otus.c |    5 +-
 sys/dev/usb/if_rum.c  |  135 +++++++++++++++-------------
 sys/dev/usb/if_udav.c |  229 +++++++++++++++++++++++++-----------------------
 sys/dev/usb/if_upl.c  |  129 ++++++++++++++------------
 sys/dev/usb/if_ural.c |  123 ++++++++++++++------------
 sys/dev/usb/if_url.c  |  233 +++++++++++++++++++++++++------------------------
 sys/dev/usb/if_zyd.c  |    8 +-
 12 files changed, 749 insertions(+), 684 deletions(-)

diffs (truncated from 5271 to 300 lines):

diff -r 663c9e73a2a5 -r 8dc9ee6325ad sys/dev/usb/if_atu.c
--- a/sys/dev/usb/if_atu.c      Wed Nov 03 21:46:36 2010 +0000
+++ b/sys/dev/usb/if_atu.c      Wed Nov 03 22:28:31 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_atu.c,v 1.39 2010/08/14 21:01:26 jym Exp $ */
+/*     $NetBSD: if_atu.c,v 1.40 2010/11/03 22:28:31 dyoung Exp $ */
 /*     $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
 /*
  * Copyright (c) 2003, 2004
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.39 2010/08/14 21:01:26 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.40 2010/11/03 22:28:31 dyoung Exp $");
 
 
 #include <sys/param.h>
@@ -243,7 +243,7 @@
 #ifdef ATU_DEBUG
        if (atudebug) {
                DPRINTFN(20, ("%s: req=%02x val=%02x ind=%02x "
-                   "len=%02x\n", USBDEVNAME(sc->atu_dev), request,
+                   "len=%02x\n", device_xname(sc->atu_dev), request,
                    value, index, length));
        }
 #endif /* ATU_DEBUG */
@@ -262,11 +262,11 @@
        if (atudebug) {
                if (type & UT_READ) {
                        DPRINTFN(20, ("%s: transfered 0x%x bytes in\n",
-                           USBDEVNAME(sc->atu_dev), total_len));
+                           device_xname(sc->atu_dev), total_len));
                } else {
                        if (total_len != length)
                                DPRINTF(("%s: wrote only %x bytes\n",
-                                   USBDEVNAME(sc->atu_dev), total_len));
+                                   device_xname(sc->atu_dev), total_len));
                }
        }
 #endif /* ATU_DEBUG */
@@ -307,7 +307,7 @@
        u_int8_t                statusreq[6];
 
        DPRINTFN(15, ("%s: wait-completion: cmd=%02x\n",
-           USBDEVNAME(sc->atu_dev), cmd));
+           device_xname(sc->atu_dev), cmd));
 
        while (1) {
                err = atu_get_cmd_status(sc, cmd, statusreq);
@@ -317,7 +317,7 @@
 #ifdef ATU_DEBUG
                if (atudebug) {
                        DPRINTFN(20, ("%s: status=%s cmd=%02x\n",
-                           USBDEVNAME(sc->atu_dev),
+                           device_xname(sc->atu_dev),
                        ether_sprintf(statusreq), cmd));
                }
 #endif /* ATU_DEBUG */
@@ -328,7 +328,7 @@
                 */
                if ((statusreq[5] == STATUS_IDLE) && (idle_count++ > 20)) {
                        DPRINTF(("%s: idle_count > 20!\n",
-                           USBDEVNAME(sc->atu_dev)));
+                           device_xname(sc->atu_dev)));
                        return 0;
                }
 
@@ -389,7 +389,7 @@
                return (err);
 
        DPRINTFN(15, ("%s: sendmib : waitcompletion...\n",
-           USBDEVNAME(sc->atu_dev)));
+           device_xname(sc->atu_dev)));
        return atu_wait_completion(sc, CMD_SET_MIB, NULL);
 }
 
@@ -430,7 +430,7 @@
        err = atu_send_command(sc, (u_int8_t *)&Request, sizeof(Request));
        if (err) {
                DPRINTF(("%s: start ibss failed!\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return err;
        }
 
@@ -438,7 +438,7 @@
        err = atu_wait_completion(sc, CMD_START_IBSS, NULL);
        if (err) {
                DPRINTF(("%s: error waiting for start_ibss\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return err;
        }
 
@@ -446,12 +446,12 @@
        err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_BSSID, sc->atu_bssid);
        if (err) {
                DPRINTF(("%s: could not get BSSID!\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return err;
        }
 
        DPRINTF(("%s: started a new IBSS (BSSID=%s)\n",
-           USBDEVNAME(sc->atu_dev), ether_sprintf(sc->atu_bssid)));
+           device_xname(sc->atu_dev), ether_sprintf(sc->atu_bssid)));
        return 0;
 }
 #endif
@@ -499,7 +499,7 @@
 #ifdef ATU_DEBUG
        if (atudebug) {
                DPRINTFN(20, ("%s: scan cmd len=%02zx\n",
-                   USBDEVNAME(sc->atu_dev), sizeof(Scan)));
+                   device_xname(sc->atu_dev), sizeof(Scan)));
        }
 #endif /* ATU_DEBUG */
 
@@ -551,7 +551,7 @@
                        return err;
 
                DPRINTFN(10, ("%s: radio turned %s\n",
-                   USBDEVNAME(sc->atu_dev), state ? "on" : "off"));
+                   device_xname(sc->atu_dev), state ? "on" : "off"));
                sc->atu_radio_on = state;
        }
        return 0;
@@ -568,20 +568,20 @@
        struct atu_cmd_card_config      cmd;
        u_int8_t                        reg_domain;
 
-       DPRINTFN(10, ("%s: sending mac-addr\n", USBDEVNAME(sc->atu_dev)));
+       DPRINTFN(10, ("%s: sending mac-addr\n", device_xname(sc->atu_dev)));
        err = atu_send_mib(sc, MIB_MAC_ADDR__ADDR, ic->ic_myaddr);
        if (err) {
                DPRINTF(("%s: error setting mac-addr\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return err;
        }
 
        /*
-       DPRINTF(("%s: sending reg-domain\n", USBDEVNAME(sc->atu_dev)));
+       DPRINTF(("%s: sending reg-domain\n", device_xname(sc->atu_dev)));
        err = atu_send_mib(sc, MIB_PHY__REG_DOMAIN, NR(0x30));
        if (err) {
                DPRINTF(("%s: error setting mac-addr\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return err;
        }
        */
@@ -653,15 +653,15 @@
        err = atu_get_mib(sc, MIB_PHY__REG_DOMAIN, &reg_domain);
        if (err) {
                DPRINTF(("%s: could not get regdomain!\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
        } else {
                DPRINTF(("%s: in reg domain 0x%x according to the "
-                   "adapter\n", USBDEVNAME(sc->atu_dev), reg_domain));
+                   "adapter\n", device_xname(sc->atu_dev), reg_domain));
        }
 
 #ifdef ATU_DEBUG
        if (atudebug) {
-               DPRINTFN(20, ("%s: configlen=%02zx\n", USBDEVNAME(sc->atu_dev),
+               DPRINTFN(20, ("%s: configlen=%02zx\n", device_xname(sc->atu_dev),
                    sizeof(cmd)));
        }
 #endif /* ATU_DEBUG */
@@ -707,7 +707,7 @@
                return err;
 
        DPRINTFN(10, ("%s: completed initial config\n",
-          USBDEVNAME(sc->atu_dev)));
+          device_xname(sc->atu_dev)));
        return 0;
 }
 
@@ -725,8 +725,8 @@
        USETW(join.Size, sizeof(join) - 4);
 
        DPRINTFN(15, ("%s: pre-join sc->atu_bssid=%s\n",
-           USBDEVNAME(sc->atu_dev), ether_sprintf(sc->atu_bssid)));
-       DPRINTFN(15, ("%s: mode=%d\n", USBDEVNAME(sc->atu_dev),
+           device_xname(sc->atu_dev), ether_sprintf(sc->atu_bssid)));
+       DPRINTFN(15, ("%s: mode=%d\n", device_xname(sc->atu_dev),
            sc->atu_mode));
        memcpy(join.bssid, node->ni_bssid, IEEE80211_ADDR_LEN);
        memset(join.essid, 0x00, 32);
@@ -742,25 +742,25 @@
        join.reserved = 0x00;
 
        DPRINTFN(10, ("%s: trying to join BSSID=%s\n",
-           USBDEVNAME(sc->atu_dev), ether_sprintf(join.bssid)));
+           device_xname(sc->atu_dev), ether_sprintf(join.bssid)));
        err = atu_send_command(sc, (u_int8_t *)&join, sizeof(join));
        if (err) {
                DPRINTF(("%s: ERROR trying to join IBSS\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return err;
        }
        err = atu_wait_completion(sc, CMD_JOIN, &status);
        if (err) {
                DPRINTF(("%s: error joining BSS!\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return err;
        }
        if (status != STATUS_COMPLETE) {
                DPRINTF(("%s: error joining... [status=%02x]\n",
-                   USBDEVNAME(sc->atu_dev), status));
+                   device_xname(sc->atu_dev), status));
                return status;
        } else {
-               DPRINTFN(10, ("%s: joined BSS\n", USBDEVNAME(sc->atu_dev)));
+               DPRINTFN(10, ("%s: joined BSS\n", device_xname(sc->atu_dev)));
        }
        return err;
 }
@@ -842,7 +842,7 @@
                            status);
                        if (err) {
                                DPRINTF(("%s: dfu_getstatus failed!\n",
-                                   USBDEVNAME(sc->atu_dev)));
+                                   device_xname(sc->atu_dev)));
                                return;
                        }
                        /* success means state => DnLoadIdle */
@@ -857,13 +857,13 @@
                        else
                                block_size = bytes_left;
                        DPRINTFN(15, ("%s: firmware block %d\n",
-                           USBDEVNAME(sc->atu_dev), block));
+                           device_xname(sc->atu_dev), block));
 
                        err = atu_usb_request(sc, DFU_DNLOAD, block++, 0,
                            block_size, ptr);
                        if (err) {
                                DPRINTF(("%s: dfu_dnload failed\n",
-                                   USBDEVNAME(sc->atu_dev)));
+                                   device_xname(sc->atu_dev)));
                                return;
                        }
 
@@ -876,7 +876,7 @@
                default:
                        usbd_delay_ms(sc->atu_udev, 100);
                        DPRINTFN(20, ("%s: sleeping for a while\n",
-                           USBDEVNAME(sc->atu_dev)));
+                           device_xname(sc->atu_dev)));
                        break;
                }
 
@@ -885,20 +885,20 @@
 
        if (state != DFUState_ManifestSync) {
                DPRINTF(("%s: state != manifestsync... eek!\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
        }
 
        err = atu_usb_request(sc, DFU_GETSTATUS, 0, 0, 6, status);
        if (err) {
                DPRINTF(("%s: dfu_getstatus failed!\n",
-                   USBDEVNAME(sc->atu_dev)));
+                   device_xname(sc->atu_dev)));
                return;
        }
 
-       DPRINTFN(15, ("%s: sending remap\n", USBDEVNAME(sc->atu_dev)));
+       DPRINTFN(15, ("%s: sending remap\n", device_xname(sc->atu_dev)));
        err = atu_usb_request(sc, DFU_REMAP, 0, 0, 0, NULL);
        if ((err) && !(sc->atu_quirk & ATU_QUIRK_NO_REMAP)) {
-               DPRINTF(("%s: remap failed!\n", USBDEVNAME(sc->atu_dev)));
+               DPRINTF(("%s: remap failed!\n", device_xname(sc->atu_dev)));
                return;
        }
 
@@ -940,12 +940,12 @@
                        block_size = bytes_left;
 
                DPRINTFN(15, ("%s: block:%d size:%d\n",
-                   USBDEVNAME(sc->atu_dev), block, block_size));
+                   device_xname(sc->atu_dev), block, block_size));
                err = atu_usb_request(sc, UT_WRITE_VENDOR_DEVICE, 0x0e,
                    0x0802, block, block_size, ptr);
                if (err) {
                        DPRINTF(("%s: could not load external firmware "
-                           "block\n", USBDEVNAME(sc->atu_dev)));
+                           "block\n", device_xname(sc->atu_dev)));
                        return;
                }
 
@@ -958,7 +958,7 @@
            block, 0, NULL);
        if (err) {



Home | Main Index | Thread Index | Old Index