1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Expand USB_DETACH, USB_ATTACH and USB_MATCH inline. No functional

change, and MD5's appear to be the same.
This commit is contained in:
Warner Losh 2007-06-13 05:37:59 +00:00
parent ef72318f0e
commit 778e5b6687
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170655
30 changed files with 158 additions and 79 deletions

View File

@ -612,7 +612,8 @@ aue_reset(struct aue_softc *sc)
/*
* Probe for a Pegasus chip.
*/
USB_MATCH(aue)
static int
aue_match(device_t self)
{
USB_MATCH_START(aue, uaa);
@ -627,7 +628,8 @@ USB_MATCH(aue)
* Attach the interface. Allocate softc structures, do ifmedia
* setup and ethernet/BPF attach.
*/
USB_ATTACH(aue)
static int
aue_attach(device_t self)
{
USB_ATTACH_START(aue, sc, uaa);
u_char eaddr[ETHER_ADDR_LEN];

View File

@ -379,7 +379,8 @@ axe_reset(struct axe_softc *sc)
/*
* Probe for a AX88172 chip.
*/
USB_MATCH(axe)
static int
axe_match(device_t self)
{
USB_MATCH_START(axe, uaa);
struct axe_type *t;
@ -403,7 +404,8 @@ USB_MATCH(axe)
* Attach the interface. Allocate softc structures, do ifmedia
* setup and ethernet/BPF attach.
*/
USB_ATTACH(axe)
static int
axe_attach(device_t self)
{
USB_ATTACH_START(axe, sc, uaa);
u_char eaddr[ETHER_ADDR_LEN];

View File

@ -108,7 +108,8 @@ static const struct cdce_type cdce_devs[] = {
};
#define cdce_lookup(v, p) ((const struct cdce_type *)usb_lookup(cdce_devs, v, p))
USB_MATCH(cdce)
static int
cdce_match(device_t self)
{
USB_MATCH_START(cdce, uaa);
usb_interface_descriptor_t *id;
@ -130,7 +131,8 @@ USB_MATCH(cdce)
return (UMATCH_NONE);
}
USB_ATTACH(cdce)
static int
cdce_attach(device_t self)
{
USB_ATTACH_START(cdce, sc, uaa);
struct ifnet *ifp;
@ -317,7 +319,8 @@ USB_ATTACH(cdce)
return 0;
}
USB_DETACH(cdce)
static int
cdce_detach(device_t self)
{
USB_DETACH_START(cdce, sc);
struct ifnet *ifp;

View File

@ -404,7 +404,8 @@ cue_reset(struct cue_softc *sc)
/*
* Probe for a Pegasus chip.
*/
USB_MATCH(cue)
static int
cue_match(device_t self)
{
USB_MATCH_START(cue, uaa);
struct cue_type *t;
@ -428,7 +429,8 @@ USB_MATCH(cue)
* Attach the interface. Allocate softc structures, do ifmedia
* setup and ethernet/BPF attach.
*/
USB_ATTACH(cue)
static int
cue_attach(device_t self)
{
USB_ATTACH_START(cue, sc, uaa);
u_char eaddr[ETHER_ADDR_LEN];

View File

@ -377,7 +377,8 @@ kue_reset(struct kue_softc *sc)
/*
* Probe for a KLSI chip.
*/
USB_MATCH(kue)
static int
kue_match(device_t self)
{
USB_MATCH_START(kue, uaa);
struct kue_type *t;
@ -401,7 +402,8 @@ USB_MATCH(kue)
* Attach the interface. Allocate softc structures, do
* setup and ethernet/BPF attach.
*/
USB_ATTACH(kue)
static int
kue_attach(device_t self)
{
USB_ATTACH_START(kue, sc, uaa);
struct ifnet *ifp;

View File

@ -547,7 +547,8 @@ rue_reset(struct rue_softc *sc)
* Probe for a RTL8150 chip.
*/
USB_MATCH(rue)
static int
rue_match(device_t self)
{
USB_MATCH_START(rue, uaa);
struct rue_type *t;
@ -572,7 +573,8 @@ USB_MATCH(rue)
* setup and ethernet/BPF attach.
*/
USB_ATTACH(rue)
static int
rue_attach(device_t self)
{
USB_ATTACH_START(rue, sc, uaa);
u_char eaddr[ETHER_ADDR_LEN];

View File

@ -359,7 +359,8 @@ static const struct rfprog {
USB_DECLARE_DRIVER(rum);
USB_MATCH(rum)
static int
rum_match(device_t self)
{
USB_MATCH_START(rum, uaa);
@ -370,7 +371,8 @@ USB_MATCH(rum)
UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
}
USB_ATTACH(rum)
static int
rum_attach(device_t self)
{
USB_ATTACH_START(rum, sc, uaa);
struct ieee80211com *ic = &sc->sc_ic;
@ -568,7 +570,8 @@ USB_ATTACH(rum)
return 0;
}
USB_DETACH(rum)
static int
rum_detach(device_t self)
{
USB_DETACH_START(rum, sc);
struct ieee80211com *ic = &sc->sc_ic;

View File

@ -264,7 +264,8 @@ static const struct udav_type {
/* Probe */
USB_MATCH(udav)
static int
udav_match(device_t self)
{
USB_MATCH_START(udav, uaa);
@ -276,7 +277,8 @@ USB_MATCH(udav)
}
/* Attach */
USB_ATTACH(udav)
static int
udav_attach(device_t self)
{
USB_ATTACH_START(udav, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -480,7 +482,8 @@ USB_ATTACH(udav)
}
/* detach */
USB_DETACH(udav)
static int
udav_detach(device_t self)
{
USB_DETACH_START(udav, sc);
struct ifnet *ifp = GET_IFP(sc);

View File

@ -346,7 +346,8 @@ static const struct {
USB_DECLARE_DRIVER(ural);
USB_MATCH(ural)
static int
ural_match(device_t self)
{
USB_MATCH_START(ural, uaa);
@ -357,7 +358,8 @@ USB_MATCH(ural)
UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
}
USB_ATTACH(ural)
static int
ural_attach(device_t self)
{
USB_ATTACH_START(ural, sc, uaa);
struct ifnet *ifp;
@ -507,7 +509,8 @@ USB_ATTACH(ural)
return 0;
}
USB_DETACH(ural)
static int
ural_detach(device_t self)
{
USB_DETACH_START(ural, sc);
struct ieee80211com *ic = &sc->sc_ic;

View File

@ -258,7 +258,8 @@ MODULE_DEPEND(ubsa, usb, 1, 1, 1);
MODULE_DEPEND(ubsa, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
MODULE_VERSION(ubsa, UBSA_MODVER);
USB_MATCH(ubsa)
static int
ubsa_match(device_t self)
{
USB_MATCH_START(ubsa, uaa);
int i;
@ -275,7 +276,8 @@ USB_MATCH(ubsa)
return (UMATCH_NONE);
}
USB_ATTACH(ubsa)
static int
ubsa_attach(device_t self)
{
USB_ATTACH_START(ubsa, sc, uaa);
usbd_device_handle dev;
@ -404,7 +406,8 @@ USB_ATTACH(ubsa)
return ENXIO;
}
USB_DETACH(ubsa)
static int
ubsa_detach(device_t self)
{
USB_DETACH_START(ubsa, sc);
int rv;

View File

@ -179,7 +179,8 @@ static t_modem_t ubsermodem;
USB_DECLARE_DRIVER(ubser);
USB_MATCH(ubser)
static int
ubser_match(device_t self)
{
USB_MATCH_START(ubser, uaa);
usb_string_descriptor_t us;
@ -218,7 +219,8 @@ USB_MATCH(ubser)
return (UMATCH_NONE);
}
USB_ATTACH(ubser)
static int
ubser_attach(device_t self)
{
USB_ATTACH_START(ubser, sc, uaa);
usbd_device_handle udev = uaa->device;
@ -411,7 +413,8 @@ USB_ATTACH(ubser)
return ENXIO;
}
USB_DETACH(ubser)
static int
ubser_detach(device_t self)
{
USB_DETACH_START(ubser, sc);
int i;

View File

@ -216,7 +216,8 @@ static void udbp_out_transfer_cb (usbd_xfer_handle xfer,
USB_DECLARE_DRIVER(udbp);
USB_MATCH(udbp)
static int
udbp_match(device_t self)
{
USB_MATCH_START(udbp, uaa);
usb_interface_descriptor_t *id;
@ -248,7 +249,8 @@ USB_MATCH(udbp)
return (UMATCH_NONE);
}
USB_ATTACH(udbp)
static int
udbp_attach(device_t self)
{
USB_ATTACH_START(udbp, sc, uaa);
usbd_interface_handle iface = uaa->iface;
@ -404,7 +406,8 @@ USB_ATTACH(udbp)
}
USB_DETACH(udbp)
static int
udbp_detach(device_t self)
{
USB_DETACH_START(udbp, sc);

View File

@ -100,7 +100,8 @@ struct ufm_softc {
USB_DECLARE_DRIVER(ufm);
USB_MATCH(ufm)
static int
ufm_match(device_t self)
{
USB_MATCH_START(ufm, uaa);
usb_device_descriptor_t *dd;
@ -119,7 +120,8 @@ USB_MATCH(ufm)
return UMATCH_NONE;
}
USB_ATTACH(ufm)
static int
ufm_attach(device_t self)
{
USB_ATTACH_START(ufm, sc, uaa);
usb_endpoint_descriptor_t *edesc;

View File

@ -260,7 +260,8 @@ DRIVER_MODULE(ufoma, uhub, ufoma_driver, ucom_devclass, usbd_driver_load, 0);
MODULE_DEPEND(ufoma, usb, 1, 1, 1);
MODULE_DEPEND(ufoma, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
USB_MATCH(ufoma)
static int
ufoma_match(device_t self)
{
USB_MATCH_START(ufoma, uaa);
usb_interface_descriptor_t *id;
@ -298,7 +299,8 @@ USB_MATCH(ufoma)
return ret;
}
USB_ATTACH(ufoma)
static int
ufoma_attach(device_t self)
{
USB_ATTACH_START(ufoma, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -414,7 +416,8 @@ USB_ATTACH(ufoma)
return EIO;
}
USB_DETACH(ufoma)
static int
ufoma_detach(device_t self)
{
USB_DETACH_START(ufoma, sc);
int rv = 0;

View File

@ -133,7 +133,8 @@ struct ucom_callback uftdi_callback = {
uftdi_write,
};
USB_MATCH(uftdi)
static int
uftdi_match(device_t self)
{
USB_MATCH_START(uftdi, uaa);
@ -183,7 +184,8 @@ USB_MATCH(uftdi)
return (UMATCH_NONE);
}
USB_ATTACH(uftdi)
static int
uftdi_attach(device_t self)
{
USB_ATTACH_START(uftdi, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -385,7 +387,8 @@ uftdi_activate(device_t self, enum devact act)
}
#endif
#if 1
USB_DETACH(uftdi)
static int
uftdi_detach(device_t self)
{
USB_DETACH_START(uftdi, sc);

View File

@ -177,7 +177,8 @@ static int uhid_do_ioctl(struct uhid_softc *, u_long, caddr_t, int,
USB_DECLARE_DRIVER(uhid);
USB_MATCH(uhid)
static int
uhid_match(device_t self)
{
USB_MATCH_START(uhid, uaa);
usb_interface_descriptor_t *id;
@ -204,7 +205,8 @@ USB_MATCH(uhid)
return (UMATCH_IFACECLASS_GENERIC);
}
USB_ATTACH(uhid)
static int
uhid_attach(device_t self)
{
USB_ATTACH_START(uhid, sc, uaa);
usbd_interface_handle iface = uaa->iface;
@ -335,7 +337,8 @@ uhid_activate(device_t self, enum devact act)
}
#endif
USB_DETACH(uhid)
static int
uhid_detach(device_t self)
{
USB_DETACH_START(uhid, sc);
int s;

View File

@ -136,7 +136,8 @@ static driver_t uhubroot_driver = {
sizeof(struct uhub_softc)
};
USB_MATCH(uhub)
static int
uhub_match(device_t self)
{
USB_MATCH_START(uhub, uaa);
usb_device_descriptor_t *dd = usbd_get_device_descriptor(uaa->device);
@ -534,7 +535,8 @@ uhub_explore(usbd_device_handle dev)
* Called from process context when the hub is gone.
* Detach all devices on active ports.
*/
USB_DETACH(uhub)
static int
uhub_detach(device_t self)
{
USB_DETACH_START(uhub, sc);
struct usbd_hub *hub = sc->sc_hub->hub;

View File

@ -129,7 +129,8 @@ static const struct uipaq_type uipaq_devs[] = {
#define uipaq_lookup(v, p) ((const struct uipaq_type *)usb_lookup(uipaq_devs, v, p))
USB_MATCH(uipaq)
static int
uipaq_match(device_t self)
{
USB_MATCH_START(uipaq, uaa);

View File

@ -126,7 +126,8 @@ static int ukbd_driver_load(module_t mod, int what, void *arg);
USB_DECLARE_DRIVER_INIT(ukbd, DEVMETHOD(device_resume, ukbd_resume));
USB_MATCH(ukbd)
static int
ukbd_match(device_t self)
{
USB_MATCH_START(ukbd, uaa);
@ -149,7 +150,8 @@ USB_MATCH(ukbd)
return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO);
}
USB_ATTACH(ukbd)
static int
ukbd_attach(device_t self)
{
USB_ATTACH_START(ukbd, sc, uaa);
usbd_interface_handle iface = uaa->iface;

View File

@ -167,7 +167,8 @@ void ieee1284_print_id(char *);
USB_DECLARE_DRIVER(ulpt);
USB_MATCH(ulpt)
static int
ulpt_match(device_t self)
{
USB_MATCH_START(ulpt, uaa);
usb_interface_descriptor_t *id;
@ -186,7 +187,8 @@ USB_MATCH(ulpt)
return (UMATCH_NONE);
}
USB_ATTACH(ulpt)
static int
ulpt_attach(device_t self)
{
USB_ATTACH_START(ulpt, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -335,7 +337,8 @@ USB_ATTACH(ulpt)
}
USB_DETACH(ulpt)
static int
ulpt_detach(device_t self)
{
USB_DETACH_START(ulpt, sc);
int s;

View File

@ -910,7 +910,8 @@ umass_match_proto(struct umass_softc *sc, usbd_interface_handle iface,
return(UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO);
}
USB_MATCH(umass)
static int
umass_match(device_t self)
{
USB_MATCH_START(umass, uaa);
struct umass_softc *sc = device_get_softc(self);
@ -921,7 +922,8 @@ USB_MATCH(umass)
return(umass_match_proto(sc, uaa->iface, uaa->device));
}
USB_ATTACH(umass)
static int
umass_attach(device_t self)
{
USB_ATTACH_START(umass, sc, uaa);
usb_interface_descriptor_t *id;
@ -1175,7 +1177,8 @@ USB_ATTACH(umass)
return 0;
}
USB_DETACH(umass)
static int
umass_detach(device_t self)
{
USB_DETACH_START(umass, sc);
int err = 0;

View File

@ -138,7 +138,8 @@ MODULE_DEPEND(umct, usb, 1, 1, 1);
MODULE_DEPEND(umct, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
MODULE_VERSION(umct, 1);
USB_MATCH(umct)
static int
umct_match(device_t self)
{
USB_MATCH_START(umct, uaa);
int i;
@ -156,7 +157,8 @@ USB_MATCH(umct)
return (UMATCH_NONE);
}
USB_ATTACH(umct)
static int
umct_attach(device_t self)
{
USB_ATTACH_START(umct, sc, uaa);
usbd_device_handle dev;
@ -273,7 +275,8 @@ USB_ATTACH(umct)
return ENXIO;
}
USB_DETACH(umct)
static int
umct_detach(device_t self)
{
USB_DETACH_START(umct, sc);
int rv;

View File

@ -227,7 +227,8 @@ MODULE_DEPEND(umodem, usb, 1, 1, 1);
MODULE_DEPEND(umodem, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
MODULE_VERSION(umodem, UMODEM_MODVER);
USB_MATCH(umodem)
static int
umodem_match(device_t self)
{
USB_MATCH_START(umodem, uaa);
usb_interface_descriptor_t *id;
@ -270,7 +271,8 @@ USB_MATCH(umodem)
return ret;
}
USB_ATTACH(umodem)
static int
umodem_attach(device_t self)
{
USB_ATTACH_START(umodem, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -804,7 +806,8 @@ umodem_set_comm_feature(struct umodem_softc *sc, int feature, int state)
return (USBD_NORMAL_COMPLETION);
}
USB_DETACH(umodem)
static int
umodem_detach(device_t self)
{
USB_DETACH_START(umodem, sc);
int rv = 0;

View File

@ -159,7 +159,8 @@ static struct cdevsw ums_cdevsw = {
USB_DECLARE_DRIVER(ums);
USB_MATCH(ums)
static int
ums_match(device_t self)
{
USB_MATCH_START(ums, uaa);
usb_interface_descriptor_t *id;
@ -187,7 +188,8 @@ USB_MATCH(ums)
return (ret);
}
USB_ATTACH(ums)
static int
ums_attach(device_t self)
{
USB_ATTACH_START(ums, sc, uaa);
usbd_interface_handle iface = uaa->iface;

View File

@ -318,7 +318,8 @@ SYSCTL_PROC(_hw_usb_uplcom, OID_AUTO, interval, CTLTYPE_INT | CTLFLAG_RW,
0, sizeof(int), sysctl_hw_usb_uplcom_interval,
"I", "uplcom interrupt pipe interval");
USB_MATCH(uplcom)
static int
uplcom_match(device_t self)
{
USB_MATCH_START(uplcom, uaa);
int i;
@ -337,7 +338,8 @@ USB_MATCH(uplcom)
return (UMATCH_NONE);
}
USB_ATTACH(uplcom)
static int
uplcom_attach(device_t self)
{
USB_ATTACH_START(uplcom, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -544,7 +546,8 @@ USB_ATTACH(uplcom)
return ENXIO;
}
USB_DETACH(uplcom)
static int
uplcom_detach(device_t self)
{
USB_DETACH_START(uplcom, sc);
int rv = 0;

View File

@ -154,7 +154,8 @@ struct urio_softc {
USB_DECLARE_DRIVER(urio);
USB_MATCH(urio)
static int
urio_match(device_t self)
{
USB_MATCH_START(urio, uaa);
usb_device_descriptor_t *dd;
@ -176,7 +177,8 @@ USB_MATCH(urio)
return UMATCH_NONE;
}
USB_ATTACH(urio)
static int
urio_attach(device_t self)
{
USB_ATTACH_START(urio, sc, uaa);
usbd_device_handle udev;
@ -592,7 +594,8 @@ urio_activate(device_t self, enum devact act)
return (0);
}
USB_DETACH(urio)
static int
urio_detach(device_t self)
{
USB_DETACH_START(urio, sc);
struct urio_endpoint *sce;

View File

@ -190,13 +190,15 @@ USB_DECLARE_DRIVER_INIT(usb,
MODULE_VERSION(usb, 1);
USB_MATCH(usb)
static int
usb_match(device_t self)
{
DPRINTF(("usbd_match\n"));
return (UMATCH_GENERIC);
}
USB_ATTACH(usb)
static int
usb_attach(device_t self)
{
struct usb_softc *sc = device_get_softc(self);
void *aux = device_get_ivars(self);
@ -821,7 +823,8 @@ usb_schedsoftintr(usbd_bus_handle bus)
#endif /* USB_USE_SOFTINTR */
}
USB_DETACH(usb)
static int
usb_detach(device_t self)
{
USB_DETACH_START(usb, sc);
struct usb_event ue;

View File

@ -300,7 +300,8 @@ static void uscanner_do_close(struct uscanner_softc *);
USB_DECLARE_DRIVER(uscanner);
USB_MATCH(uscanner)
static int
uscanner_match(device_t self)
{
USB_MATCH_START(uscanner, uaa);
@ -311,7 +312,8 @@ USB_MATCH(uscanner)
UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
USB_ATTACH(uscanner)
static int
uscanner_attach(device_t self)
{
USB_ATTACH_START(uscanner, sc, uaa);
usb_interface_descriptor_t *id = 0;
@ -626,7 +628,8 @@ uscanner_activate(device_t self, enum devact act)
}
#endif
USB_DETACH(uscanner)
static int
uscanner_detach(device_t self)
{
USB_DETACH_START(uscanner, sc);
int s;

View File

@ -244,7 +244,8 @@ static const struct uvisor_type uvisor_devs[] = {
#define uvisor_lookup(v, p) ((const struct uvisor_type *)usb_lookup(uvisor_devs, v, p))
USB_MATCH(uvisor)
static int
uvisor_match(device_t self)
{
USB_MATCH_START(uvisor, uaa);
@ -258,7 +259,8 @@ USB_MATCH(uvisor)
UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
USB_ATTACH(uvisor)
static int
uvisor_attach(device_t self)
{
USB_ATTACH_START(uvisor, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -395,7 +397,8 @@ uvisor_activate(device_t self, enum devact act)
#endif
USB_DETACH(uvisor)
static int
uvisor_detach(device_t self)
{
USB_DETACH_START(uvisor, sc);
int rv = 0;

View File

@ -294,7 +294,8 @@ SYSCTL_PROC(_hw_usb_uvscom, OID_AUTO, interval, CTLTYPE_INT | CTLFLAG_RW,
0, sizeof(int), sysctl_hw_usb_uvscom_interval,
"I", "uvscom interrpt pipe interval");
USB_MATCH(uvscom)
static int
uvscom_match(device_t self)
{
USB_MATCH_START(uvscom, uaa);
@ -305,7 +306,8 @@ USB_MATCH(uvscom)
UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
USB_ATTACH(uvscom)
static int
uvscom_attach(device_t self)
{
USB_ATTACH_START(uvscom, sc, uaa);
usbd_device_handle dev = uaa->device;
@ -430,7 +432,8 @@ USB_ATTACH(uvscom)
return ENXIO;
}
USB_DETACH(uvscom)
static int
uvscom_detach(device_t self)
{
USB_DETACH_START(uvscom, sc);
int rv = 0;