From: mglocker Date: Sun, 28 Nov 2021 09:25:02 +0000 (+0000) Subject: Align with the recent memory allocation changes we did for the other X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6303db424330907927ce0df20e56b3b74ed5b7bc;p=openbsd Align with the recent memory allocation changes we did for the other USB HC drivers; M_DEVBUF -> M_USBHC. ok kettenis@ --- diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c index 7321f388dd1..9b9d1635f90 100644 --- a/sys/dev/usb/dwc2/dwc2.c +++ b/sys/dev/usb/dwc2/dwc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2.c,v 1.58 2021/07/30 18:56:01 mglocker Exp $ */ +/* $OpenBSD: dwc2.c,v 1.59 2021/11/28 09:25:02 mglocker Exp $ */ /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */ /*- @@ -1481,7 +1481,7 @@ dwc2_init(struct dwc2_softc *sc) pool_init(&sc->sc_qtdpool, sizeof(struct dwc2_qtd), 0, IPL_USB, 0, "dwc2qtd", NULL); - sc->sc_hsotg = malloc(sizeof(struct dwc2_hsotg), M_DEVBUF, + sc->sc_hsotg = malloc(sizeof(struct dwc2_hsotg), M_USBHC, M_ZERO | M_WAITOK); sc->sc_hsotg->hsotg_sc = sc; sc->sc_hsotg->dev = &sc->sc_bus.bdev; @@ -1517,7 +1517,7 @@ dwc2_init(struct dwc2_softc *sc) goto fail2; } - hsotg->core_params = malloc(sizeof(*hsotg->core_params), M_DEVBUF, + hsotg->core_params = malloc(sizeof(*hsotg->core_params), M_USBHC, M_ZERO | M_WAITOK); dwc2_set_all_params(hsotg->core_params, -1); @@ -1557,7 +1557,7 @@ dwc2_init(struct dwc2_softc *sc) fail2: err = -retval; - free(sc->sc_hsotg, M_DEVBUF, sizeof(struct dwc2_hsotg)); + free(sc->sc_hsotg, M_USBHC, sizeof(struct dwc2_hsotg)); softintr_disestablish(sc->sc_rhc_si); return err; diff --git a/sys/dev/usb/dwc2/dwc2_hcd.c b/sys/dev/usb/dwc2/dwc2_hcd.c index 8da32b4982a..a58de6bd4c2 100644 --- a/sys/dev/usb/dwc2/dwc2_hcd.c +++ b/sys/dev/usb/dwc2/dwc2_hcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_hcd.c,v 1.25 2021/09/04 10:19:28 mglocker Exp $ */ +/* $OpenBSD: dwc2_hcd.c,v 1.26 2021/11/28 09:25:02 mglocker Exp $ */ /* $NetBSD: dwc2_hcd.c,v 1.15 2014/11/24 10:14:14 skrll Exp $ */ /* @@ -1911,7 +1911,7 @@ dwc2_hcd_urb_alloc(struct dwc2_hsotg *hsotg, int iso_desc_count, u32 size = sizeof(*urb) + iso_desc_count * sizeof(struct dwc2_hcd_iso_packet_desc); - urb = malloc(size, M_DEVBUF, M_ZERO | mem_flags); + urb = malloc(size, M_USBHC, M_ZERO | mem_flags); if (urb) urb->packet_count = iso_desc_count; return urb; @@ -1925,7 +1925,7 @@ dwc2_hcd_urb_free(struct dwc2_hsotg *hsotg, struct dwc2_hcd_urb *urb, u32 size = sizeof(*urb) + iso_desc_count * sizeof(struct dwc2_hcd_iso_packet_desc); - free(urb, M_DEVBUF, size); + free(urb, M_USBHC, size); } void @@ -2236,7 +2236,7 @@ STATIC void dwc2_hcd_free(struct dwc2_hsotg *hsotg) dev_dbg(hsotg->dev, "HCD Free channel #%i, chan=%p\n", i, chan); hsotg->hc_ptr_array[i] = NULL; - free(chan, M_DEVBUF, sizeof(*chan)); + free(chan, M_USBHC, sizeof(*chan)); } } @@ -2247,7 +2247,7 @@ STATIC void dwc2_hcd_free(struct dwc2_hsotg *hsotg) hsotg->status_buf = NULL; } } else { - free(hsotg->status_buf, M_DEVBUF, DWC2_HCD_STATUS_BUF_SIZE); + free(hsotg->status_buf, M_USBHC, DWC2_HCD_STATUS_BUF_SIZE); hsotg->status_buf = NULL; } @@ -2268,7 +2268,7 @@ STATIC void dwc2_hcd_free(struct dwc2_hsotg *hsotg) taskq_destroy(hsotg->wq_otg); } - free(hsotg->core_params, M_DEVBUF, sizeof(*hsotg->core_params)); + free(hsotg->core_params, M_USBHC, sizeof(*hsotg->core_params)); hsotg->core_params = NULL; timeout_del(&hsotg->wkp_timer); } @@ -2304,13 +2304,13 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS hsotg->frame_num_array = malloc(sizeof(*hsotg->frame_num_array) * - FRAME_NUM_ARRAY_SIZE, M_DEVBUF, + FRAME_NUM_ARRAY_SIZE, M_USBHC, M_ZERO | M_WAITOK); if (!hsotg->frame_num_array) goto error1; hsotg->last_frame_num_array = malloc( sizeof(*hsotg->last_frame_num_array) * - FRAME_NUM_ARRAY_SIZE, M_DEVBUF, M_ZERO | M_WAITOK); + FRAME_NUM_ARRAY_SIZE, M_USBHC, M_ZERO | M_WAITOK); if (!hsotg->last_frame_num_array) goto error1; hsotg->last_frame_num = HFNUM_MAX_FRNUM; @@ -2362,7 +2362,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) memset(&hsotg->hc_ptr_array[0], 0, sizeof(hsotg->hc_ptr_array)); for (i = 0; i < num_channels; i++) { - channel = malloc(sizeof(*channel), M_DEVBUF, M_ZERO | M_WAITOK); + channel = malloc(sizeof(*channel), M_USBHC, M_ZERO | M_WAITOK); if (channel == NULL) goto error3; channel->hc_num = i; @@ -2395,7 +2395,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) hsotg->status_buf_dma = DMAADDR(&hsotg->status_buf_usbdma, 0); } } else - hsotg->status_buf = malloc(DWC2_HCD_STATUS_BUF_SIZE, M_DEVBUF, + hsotg->status_buf = malloc(DWC2_HCD_STATUS_BUF_SIZE, M_USBHC, M_ZERO | M_WAITOK); /* retval is already -ENOMEM */ @@ -2422,14 +2422,14 @@ error3: dwc2_hcd_release(hsotg); error2: if (hsotg->core_params != NULL) - free(hsotg->core_params, M_DEVBUF, sizeof(*hsotg->core_params)); + free(hsotg->core_params, M_USBHC, sizeof(*hsotg->core_params)); #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS if (hsotg->last_frame_num_array != NULL) - free(hsotg->last_frame_num_array, M_DEVBUF, + free(hsotg->last_frame_num_array, M_USBHC, sizeof(*hsotg->last_frame_num_array) * FRAME_NUM_ARRAY_SIZE); if (hsotg->frame_num_array != NULL) - free(hsotg->frame_num_array, M_DEVBUF, + free(hsotg->frame_num_array, M_USBHC, sizeof(*hsotg->frame_num_array) * FRAME_NUM_ARRAY_SIZE); #endif @@ -2460,7 +2460,7 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) dwc2_hcd_release(hsotg); #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS - free(hsotg->last_frame_num_array, M_DEVBUF, sizeof(*hsotg->last_frame_num_array) * FRAME_NUM_ARRAY_SIZE); - free(hsotg->frame_num_array, M_DEVBUF, sizeof(*hsotg->frame_num_array) * FRAME_NUM_ARRAY_SIZE); + free(hsotg->last_frame_num_array, M_USBHC, sizeof(*hsotg->last_frame_num_array) * FRAME_NUM_ARRAY_SIZE); + free(hsotg->frame_num_array, M_USBHC, sizeof(*hsotg->frame_num_array) * FRAME_NUM_ARRAY_SIZE); #endif } diff --git a/sys/dev/usb/dwc2/dwc2_hcdddma.c b/sys/dev/usb/dwc2/dwc2_hcdddma.c index a138cb2a2ff..78a33ad5854 100644 --- a/sys/dev/usb/dwc2/dwc2_hcdddma.c +++ b/sys/dev/usb/dwc2/dwc2_hcdddma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_hcdddma.c,v 1.19 2021/09/04 10:19:28 mglocker Exp $ */ +/* $OpenBSD: dwc2_hcdddma.c,v 1.20 2021/11/28 09:25:02 mglocker Exp $ */ /* $NetBSD: dwc2_hcdddma.c,v 1.6 2014/04/03 06:34:58 skrll Exp $ */ /* @@ -109,7 +109,7 @@ STATIC int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, qh->desc_list = KERNADDR(&qh->desc_list_usbdma, 0); qh->desc_list_dma = DMAADDR(&qh->desc_list_usbdma, 0); - qh->n_bytes = malloc(sizeof(u32) * dwc2_max_desc_num(qh), M_DEVBUF, + qh->n_bytes = malloc(sizeof(u32) * dwc2_max_desc_num(qh), M_USBHC, M_ZERO | M_WAITOK); if (!qh->n_bytes) { @@ -129,7 +129,7 @@ STATIC void dwc2_desc_list_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) qh->desc_list = NULL; } - free(qh->n_bytes, M_DEVBUF, sizeof(u32) * dwc2_max_desc_num(qh)); + free(qh->n_bytes, M_USBHC, sizeof(u32) * dwc2_max_desc_num(qh)); qh->n_bytes = NULL; }