Date: Fri, 15 Sep 2006 10:39:16 -0400 From: John Baldwin <jhb@freebsd.org> To: Hans Petter Selasky <hselasky@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 106148 for review Message-ID: <200609151039.16523.jhb@freebsd.org> In-Reply-To: <200609151417.k8FEHSFx098273@repoman.freebsd.org> References: <200609151417.k8FEHSFx098273@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 15 September 2006 10:17, Hans Petter Selasky wrote: > http://perforce.freebsd.org/chv.cgi?CH=106148 > > Change 106148 by hselasky@hselasky_mini_itx on 2006/09/15 14:17:12 > > Initialize all driver_t structures by record. Bugfix: Some of the > modem drivers did not use the "ucom_devclass". Make sure that all > modem drivers use this devclass. That doesn't actually matter. Also, no other drivers use this style to initialize their driver_t. If you really wanted to do a change, you should change them to use DEFINE_CLASS macros to define a KOBJ class instead. BTW, why the devclass doesn't matter: the devclass_t is just a pointer to a device class. The device classes are based on the driver name, so if you add a new driver with the name "foo", it will look up the device class by name ("foo"), creating one if it doesn't exist. It then saves a pointer to that device class object in the devclass_t pointer specified in DRIVER_MODULE(). So, by making them all share the same devclass_t, they are all just going to overwrite the same pointer when the driver module loads. To be honest, most drivers don't even use the devclass pointer, and I'd actually like to axe it and make the few drivers that do care use 'devclass_find("foo")' when they need the devclass pointer instead. > Affected files ... > > .. //depot/projects/usb/src/sys/dev/usb/if_aue.c#9 edit > .. //depot/projects/usb/src/sys/dev/usb/if_axe.c#8 edit > .. //depot/projects/usb/src/sys/dev/usb/if_cdce.c#7 edit > .. //depot/projects/usb/src/sys/dev/usb/if_cue.c#8 edit > .. //depot/projects/usb/src/sys/dev/usb/if_kue.c#9 edit > .. //depot/projects/usb/src/sys/dev/usb/if_rue.c#7 edit > .. //depot/projects/usb/src/sys/dev/usb/if_udav.c#7 edit > .. //depot/projects/usb/src/sys/dev/usb/ucycom.c#6 edit > .. //depot/projects/usb/src/sys/dev/usb/ufm.c#6 edit > .. //depot/projects/usb/src/sys/dev/usb/ufoma.c#6 edit > .. //depot/projects/usb/src/sys/dev/usb/uftdi.c#7 edit > .. //depot/projects/usb/src/sys/dev/usb/umct.c#6 edit > > Differences ... > > ==== //depot/projects/usb/src/sys/dev/usb/if_aue.c#9 (text+ko) ==== > > @@ -375,9 +375,9 @@ > }; > > static driver_t aue_driver = { > - "aue", > - aue_methods, > - sizeof(struct aue_softc) > + .name = "aue", > + .methods = aue_methods, > + .size = sizeof(struct aue_softc) > }; > > static devclass_t aue_devclass; > > ==== //depot/projects/usb/src/sys/dev/usb/if_axe.c#8 (text+ko) ==== > > @@ -308,9 +308,9 @@ > }; > > static driver_t axe_driver = { > - "axe", > - axe_methods, > - sizeof(struct axe_softc) > + .name = "axe", > + .methods = axe_methods, > + .size = sizeof(struct axe_softc), > }; > > static devclass_t axe_devclass; > > ==== //depot/projects/usb/src/sys/dev/usb/if_cdce.c#7 (text+ko) ==== > > @@ -165,9 +165,9 @@ > }; > > static driver_t cdce_driver = { > - "cdce", > - cdce_methods, > - sizeof(struct cdce_softc) > + .name = "cdce", > + .methods = cdce_methods, > + .size = sizeof(struct cdce_softc), > }; > > static devclass_t cdce_devclass; > > ==== //depot/projects/usb/src/sys/dev/usb/if_cue.c#8 (text+ko) ==== > > @@ -228,9 +228,9 @@ > }; > > static driver_t cue_driver = { > - "cue", > - cue_methods, > - sizeof(struct cue_softc) > + .name = "cue", > + .methods = cue_methods, > + .size = sizeof(struct cue_softc), > }; > > static devclass_t cue_devclass; > > ==== //depot/projects/usb/src/sys/dev/usb/if_kue.c#9 (text+ko) ==== > > @@ -248,9 +248,9 @@ > }; > > static driver_t kue_driver = { > - "kue", > - kue_methods, > - sizeof(struct kue_softc) > + .name = "kue", > + .methods = kue_methods, > + .size = sizeof(struct kue_softc), > }; > > static devclass_t kue_devclass; > > ==== //depot/projects/usb/src/sys/dev/usb/if_rue.c#7 (text+ko) ==== > > @@ -317,9 +317,9 @@ > }; > > static driver_t rue_driver = { > - "rue", > - rue_methods, > - sizeof(struct rue_softc) > + .name = "rue", > + .methods = rue_methods, > + .size = sizeof(struct rue_softc), > }; > > static devclass_t rue_devclass; > > ==== //depot/projects/usb/src/sys/dev/usb/if_udav.c#7 (text+ko) ==== > > @@ -266,9 +266,9 @@ > }; > > static driver_t udav_driver = { > - "udav", > - udav_methods, > - sizeof(struct udav_softc) > + .name = "udav", > + .methods = udav_methods, > + .size = sizeof(struct udav_softc), > }; > > static devclass_t udav_devclass; > > ==== //depot/projects/usb/src/sys/dev/usb/ucycom.c#6 (text+ko) ==== > > @@ -193,14 +193,12 @@ > }; > > static driver_t ucycom_driver = { > - "ucycom", > - ucycom_methods, > - sizeof(struct ucycom_softc), > + .name = "ucom", > + .methods = ucycom_methods, > + .size = sizeof(struct ucycom_softc), > }; > > -static devclass_t ucycom_devclass; > - > -DRIVER_MODULE(ucycom, uhub, ucycom_driver, ucycom_devclass, usbd_driver_load, 0); > +DRIVER_MODULE(ucycom, uhub, ucycom_driver, ucom_devclass, usbd_driver_load, 0); > MODULE_VERSION(ucycom, 1); > MODULE_DEPEND(ucycom, usb, 1, 1, 1); > > > ==== //depot/projects/usb/src/sys/dev/usb/ufm.c#6 (text+ko) ==== > > @@ -143,9 +143,9 @@ > }; > > static driver_t ufm_driver = { > - "ufm", > - ufm_methods, > - sizeof(struct ufm_softc) > + .name = "ufm", > + .methods = ufm_methods, > + .size = sizeof(struct ufm_softc), > }; > > MODULE_DEPEND(ufm, usb, 1, 1, 1); > > ==== //depot/projects/usb/src/sys/dev/usb/ufoma.c#6 (text+ko) ==== > > @@ -400,13 +400,11 @@ > }; > > static driver_t ufoma_driver = { > - "ucom", > - ufoma_methods, > - sizeof(struct ufoma_softc) > + .name = "ucom", > + .methods = ufoma_methods, > + .size = sizeof(struct ufoma_softc), > }; > > -static devclass_t ucom_devclass; > - > 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); > > ==== //depot/projects/usb/src/sys/dev/usb/uftdi.c#7 (text+ko) ==== > > @@ -280,9 +280,9 @@ > }; > > static driver_t uftdi_driver = { > - "ucom", > - uftdi_methods, > - sizeof (struct uftdi_softc) > + .name = "ucom", > + .methods = uftdi_methods, > + .size = sizeof (struct uftdi_softc), > }; > > DRIVER_MODULE(uftdi, uhub, uftdi_driver, ucom_devclass, usbd_driver_load, 0); > > ==== //depot/projects/usb/src/sys/dev/usb/umct.c#6 (text+ko) ==== > > @@ -294,9 +294,9 @@ > }; > > static driver_t umct_driver = { > - "ucom", > - umct_methods, > - sizeof(struct umct_softc) > + .name = "ucom", > + .methods = umct_methods, > + .size = sizeof(struct umct_softc), > }; > > DRIVER_MODULE(umct, uhub, umct_driver, ucom_devclass, usbd_driver_load, 0); > -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609151039.16523.jhb>