Current-Users archive

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

build with KERNHIST



hello,

Attached patches should fix the build with USB_DEBUG on earmv6hf.

if_gscan.c:
- On 32-bit arch compiler complains about cast from 32-bit pointer to
  uintmax_t conversion.
- %s cannot be used in KERNHIST_LOG format string.
  KERNHIST_LOG copies address of string but not string itself.
  It may not work when driver is detached.

others:
- KERNHIST_LOG may print %d as a corrupted value on 32-bit arch.

By default USB_DEBUG is not enabled on GENERIC/earmv6hf,
that's why they are not reported in daily build.



--- src/sys/dev/usb/if_gscan.c.orig	2025-04-06 22:15:50.660578108 +0000
+++ src/sys/dev/usb/if_gscan.c	2025-04-25 20:23:54.458424079 +0000
@@ -202,7 +202,7 @@ gscan_rx(struct usbd_xfer *xfer, void *p
 		return;
 	}
 	if (status != USBD_NORMAL_COMPLETION) {
-		DPRINTF("rx error: %s\n", usbd_errstr(status), 0, 0, 0);
+		DPRINTF("rx error: %jd", status, 0, 0, 0);
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(sc->sc_rx_pipe);
 		if (++sc->sc_rx_nerr > 100) {
@@ -301,7 +301,7 @@ gscan_tx(struct usbd_xfer *xfer, void *p
 			mutex_exit(&sc->sc_txlock);
 			return;
 		}
-		DPRINTF("rx error: %s\n", usbd_errstr(status), 0, 0, 0);
+		DPRINTF("rx error: %jd", status, 0, 0, 0);
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(sc->sc_rx_pipe);
 	}
@@ -345,7 +345,7 @@ gscan_ifstart(struct ifnet *ifp)
 	    sizeof(struct gscan_frame), 0, 10000, gscan_tx);
         err = usbd_transfer(sc->sc_tx_xfer);
 	if (err != USBD_IN_PROGRESS) {
-		DPRINTF("start tx error: %s\n", usbd_errstr(err), 0, 0, 0);
+		DPRINTF("start tx error: %jd", err, 0, 0, 0);
 		if_statadd(ifp, if_oerrors, 1);
 	} else {
 		sc->sc_m_transmit = m;
--- src/sys/dev/usb/ehci.c.orig	2025-02-16 21:52:46.057983996 +0000
+++ src/sys/dev/usb/ehci.c	2025-04-24 04:08:20.608110349 +0000
@@ -1912,7 +1912,7 @@ ehci_dump_sitd(struct ehci_soft_itd *itd
 {
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-	DPRINTF("SITD %#jx next = %p prev = %#jx",
+	DPRINTF("SITD %#jx next = %jp prev = %#jx",
 	    (uintptr_t)itd, (uintptr_t)itd->frame_list.next,
 	    (uintptr_t)itd->frame_list.prev, 0);
 	DPRINTF("        xfernext=%#jx physaddr=%jX slot=%jd",
--- src/sys/dev/usb/uhci.c.orig	2024-10-07 20:16:53.074909669 +0000
+++ src/sys/dev/usb/uhci.c	2025-04-24 04:03:38.809020117 +0000
@@ -829,7 +829,7 @@ uhci_dump_td(uhci_soft_td_t *p)
 	    !!(le32toh(p->td.td_status) & UHCI_TD_IOS),
 	    !!(le32toh(p->td.td_status) & UHCI_TD_LS),
 	    !!(le32toh(p->td.td_status) & UHCI_TD_SPD), 0);
-	DPRINTF("errcnt  =%d actlen  =%d pid=%02x",
+	DPRINTF("errcnt  =%jd actlen  =%jd pid=%02jx",
 	    UHCI_TD_GET_ERRCNT(le32toh(p->td.td_status)),
 	    UHCI_TD_GET_ACTLEN(le32toh(p->td.td_status)),
 	    UHCI_TD_GET_PID(le32toh(p->td.td_token)), 0);
--- src/sys/dev/usb/ugen.c.orig	2024-03-29 20:48:58.140005185 +0000
+++ src/sys/dev/usb/ugen.c	2025-04-25 20:14:59.689635966 +0000
@@ -504,7 +504,7 @@ ugen_set_config(struct ugen_softc *sc, i
 		for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++)
 			if (sc->sc_is_open[endptno]) {
 				DPRINTFN(1,
-				     "ugen%jd - endpoint %d is open",
+				     "ugen%jd - endpoint %jd is open",
 				      device_unit(sc->sc_dev), endptno, 0, 0);
 				return USBD_IN_USE;
 			}
@@ -643,7 +643,7 @@ ugenopen(dev_t dev, int flag, int mode, 
 				goto out;
 			}
 			sce->ibuf = kmem_alloc(isize, KM_SLEEP);
-			DPRINTFN(5, "intr endpt=%d, isize=%d",
+			DPRINTFN(5, "intr endpt=%jd, isize=%jd",
 				     endpt, isize, 0, 0);
 			if (clalloc(&sce->q, UGEN_IBSIZE, 0) == -1) {
 				kmem_free(sce->ibuf, isize);
@@ -693,7 +693,7 @@ ugenopen(dev_t dev, int flag, int mode, 
 				KM_SLEEP);
 			sce->cur = sce->fill = sce->ibuf;
 			sce->limit = sce->ibuf + isize * UGEN_NISOFRAMES;
-			DPRINTFN(5, "isoc endpt=%d, isize=%d",
+			DPRINTFN(5, "isoc endpt=%jd, isize=%jd",
 				     endpt, isize, 0, 0);
 			err = usbd_open_pipe(sce->iface,
 				  edesc->bEndpointAddress, 0, &sce->pipeh);
@@ -903,7 +903,7 @@ ugen_do_read(struct ugen_softc *sc, int 
 		break;
 	case UE_BULK:
 		if (sce->state & UGEN_BULK_RA) {
-			DPRINTFN(5, "BULK_RA req: %zd used: %d",
+			DPRINTFN(5, "BULK_RA req: %jd used: %jd",
 				     uio->uio_resid, sce->ra_wb_used, 0, 0);
 			xfer = sce->ra_wb_xfer;
 
@@ -1097,7 +1097,7 @@ ugen_do_write(struct ugen_softc *sc, int
 					/* "ugenwb" */
 					error = cv_timedwait_sig(&sce->cv,
 					    &sc->sc_lock, mstohz(sce->timeout));
-					DPRINTFN(5, "woke, error=%d",
+					DPRINTFN(5, "woke, error=%jd",
 						    error, 0, 0, 0);
 					if (sc->sc_dying)
 						error = EIO;
@@ -1356,9 +1356,9 @@ ugenintr(struct usbd_xfer *xfer, void *a
 	usbd_get_xfer_status(xfer, NULL, NULL, &count, NULL);
 	ibuf = sce->ibuf;
 
-	DPRINTFN(5, "xfer=%#jx status=%d count=%d",
+	DPRINTFN(5, "xfer=%#jx status=%jd count=%jd",
 		     (uintptr_t)xfer, status, count, 0);
-	DPRINTFN(5, "          data = %02x %02x %02x",
+	DPRINTFN(5, "          data = %02jx %02jx %02jx",
 		     ibuf[0], ibuf[1], ibuf[2], 0);
 
 	mutex_enter(&sc->sc_lock);
@@ -1386,8 +1386,8 @@ ugen_isoc_rintr(struct usbd_xfer *xfer, 
 		return;
 
 	usbd_get_xfer_status(xfer, NULL, NULL, &count, NULL);
-	DPRINTFN(5, "xfer %ld, count=%d",
-	    (long)(req - sce->isoreqs), count, 0, 0);
+	DPRINTFN(5, "xfer %jd, count=%jd",
+	    (intmax_t)(req - sce->isoreqs), count, 0, 0);
 
 	mutex_enter(&sc->sc_lock);


Home | Main Index | Thread Index | Old Index