> I read sys/dev/usb/if_cdce.c and found sc->cdce_unit is refered but
> none initializes. Maybe the fix is required like this :-
>
[...]
> + sc->cdce_unit = self->dv_unit;
I really dislike variables that serve no purpose. The same thing is
available straight out of struct device. I've also fixed if_cdcef
(and checked that it compiles on the zaurus where it is used).
Index: if_cdce.c
===
RCS file: /cvs/src/sys/dev/usb/if_cdce.c,v
retrieving revision 1.57
diff -u -p -u -r1.57 if_cdce.c
--- if_cdce.c 15 Nov 2013 10:17:39 - 1.57
+++ if_cdce.c 3 Dec 2013 21:08:23 -
@@ -324,7 +324,7 @@ found:
getmicrotime(&now);
macaddr_lo = htonl(now.tv_usec << 8);
bcopy(&macaddr_lo, &sc->cdce_arpcom.ac_enaddr[2],
sizeof(u_int32_t));
- sc->cdce_arpcom.ac_enaddr[5] = (u_int8_t)(sc->cdce_unit);
+ sc->cdce_arpcom.ac_enaddr[5] = (u_int8_t)(sc->cdce_dev.dv_unit);
} else {
for (i = 0; i < ETHER_ADDR_LEN * 2; i++) {
int c = UGETW(eaddr_str.bString[i]);
Index: if_cdcef.c
===
RCS file: /cvs/src/sys/dev/usb/if_cdcef.c,v
retrieving revision 1.31
diff -u -p -u -r1.31 if_cdcef.c
--- if_cdcef.c 11 Nov 2013 10:09:40 - 1.31
+++ if_cdcef.c 3 Dec 2013 21:13:54 -
@@ -79,7 +79,6 @@ struct cdcef_softc {
#define GET_IFP(sc) (&(sc)->sc_arpcom.ac_if)
int sc_rxeof_errors;
- int sc_unit;
int sc_listening;
};
@@ -243,7 +242,7 @@ cdcef_attach(struct device *parent, stru
macaddr_hi = htons(0x2acb);
bcopy(&macaddr_hi, &sc->sc_arpcom.ac_enaddr[0], sizeof(u_int16_t));
bcopy(&ticks, &sc->sc_arpcom.ac_enaddr[2], sizeof(u_int32_t));
- sc->sc_arpcom.ac_enaddr[5] = (u_int8_t)(sc->sc_unit);
+ sc->sc_arpcom.ac_enaddr[5] = (u_int8_t)(sc->sc_dev.bdev.dv_unit);
printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr));
Index: if_cdcereg.h
===
RCS file: /cvs/src/sys/dev/usb/if_cdcereg.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 if_cdcereg.h
--- if_cdcereg.h11 Nov 2013 12:38:16 - 1.5
+++ if_cdcereg.h3 Dec 2013 21:06:22 -
@@ -80,7 +80,6 @@ struct cdce_softc {
struct usbd_pipe*cdce_bulkin_pipe;
int cdce_bulkout_no;
struct usbd_pipe*cdce_bulkout_pipe;
- int cdce_unit;
struct cdce_cdatacdce_cdata;
int cdce_rxeof_errors;
u_int16_tcdce_flags;