diff options
author | imp <imp@FreeBSD.org> | 2007-06-21 14:42:34 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2007-06-21 14:42:34 +0000 |
commit | d4fd7053d478e89ca3be425ced1a36ebf68d553e (patch) | |
tree | ed0dd4914af2fd4bc48d4d26d7e7b701359acf47 /sys/dev/usb/umass.c | |
parent | ac6798a72c8fe23cdd0de3feb6488518edba738c (diff) | |
download | FreeBSD-src-d4fd7053d478e89ca3be425ced1a36ebf68d553e.zip FreeBSD-src-d4fd7053d478e89ca3be425ced1a36ebf68d553e.tar.gz |
Latest round of usb cleanups:
o Consistently use device_foo_t and bus_foo_t for functions implementing
device_foo and bus_foo respectively. Adjust those routines that were wrong
(we should do this throughout the tree).
o make all the modules depend on usb. Otherwise these modules won't
load.
o ucycom doesn't need usb_port.h
o Minor unifdefing
o uhub, umass, ums, urio, uscanner conversion complete.
o ukbd: Remove the NO_SET_PROTO quirk (fixes a PR 77940). NetBSD removed
their check and setting the proto a long time ago.
o umodem panic fixed. UQ_ASSUME_CM_OVER_DATA quirk removed because I've never
seen a umodem that needed this rejection for proection (this gets rid of
~20% of the quirks).
Approved by: re@ (kensmith)
PR: 77940
Diffstat (limited to 'sys/dev/usb/umass.c')
-rw-r--r-- | sys/dev/usb/umass.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index b928349..c42a0f2 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -115,7 +115,6 @@ #include <sys/bus.h> #include <sys/sysctl.h> -#include <dev/usb/usb_port.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> @@ -645,7 +644,7 @@ struct umass_softc { unsigned char cam_scsi_command2[CAM_MAX_CDBLEN]; struct scsi_sense cam_scsi_sense; struct scsi_sense cam_scsi_test_unit_ready; - usb_callout_t cam_scsi_rescan_ch; + struct callout cam_scsi_rescan_ch; int timeout; /* in msecs */ @@ -685,7 +684,27 @@ static uint8_t fake_inq_data[SHORT_INQUIRY_LENGTH] = { }; /* USB device probe/attach/detach functions */ -USB_DECLARE_DRIVER(umass); +static device_probe_t umass_match; +static device_attach_t umass_attach; +static device_detach_t umass_detach; + +static device_method_t umass_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, umass_match), + DEVMETHOD(device_attach, umass_attach), + DEVMETHOD(device_detach, umass_detach), + + { 0, 0 } +}; + +static driver_t umass_driver = { + "umass", + umass_methods, + sizeof(struct umass_softc) +}; + +static devclass_t umass_devclass; + static int umass_match_proto (struct umass_softc *sc, usbd_interface_handle iface, usbd_device_handle udev); @@ -784,7 +803,8 @@ static void umass_dump_buffer (struct umass_softc *sc, u_int8_t *buffer, int buflen, int printlen); #endif -MODULE_DEPEND(umass, cam, 1,1,1); +MODULE_DEPEND(umass, cam, 1, 1, 1); +MODULE_DEPEND(umass, usb, 1, 1, 1); /* * USB device probe/attach/detach @@ -924,7 +944,8 @@ umass_match(device_t self) static int umass_attach(device_t self) { - USB_ATTACH_START(umass, sc, uaa); + struct umass_softc *sc = device_get_softc(self); + struct usb_attach_arg *uaa = device_get_ivars(self); usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; int i; @@ -937,7 +958,7 @@ umass_attach(device_t self) sc->sc_dev = self; sc->iface = uaa->iface; sc->ifaceno = uaa->ifaceno; - usb_callout_init(sc->cam_scsi_rescan_ch); + callout_init(&sc->cam_scsi_rescan_ch, 0); /* initialise the proto and drive values in the umass_softc (again) */ (void) umass_match_proto(sc, sc->iface, uaa->device); @@ -1179,7 +1200,7 @@ umass_attach(device_t self) static int umass_detach(device_t self) { - USB_DETACH_START(umass, sc); + struct umass_softc *sc = device_get_softc(self); int err = 0; int i; @@ -1196,7 +1217,7 @@ umass_detach(device_t self) if (sc->intrin_pipe) usbd_abort_pipe(sc->intrin_pipe); - usb_uncallout_drain(sc->cam_scsi_rescan_ch, umass_cam_rescan, sc); + callout_drain(&sc->cam_scsi_rescan_ch); if ((sc->proto & UMASS_PROTO_SCSI) || (sc->proto & UMASS_PROTO_ATAPI) || (sc->proto & UMASS_PROTO_UFI) || @@ -2339,7 +2360,7 @@ umass_cam_attach(struct umass_softc *sc) * completed, when interrupts have been enabled. */ - usb_callout(sc->cam_scsi_rescan_ch, MS_TO_TICKS(200), + callout_reset(&sc->cam_scsi_rescan_ch, MS_TO_TICKS(200), umass_cam_rescan, sc); } |