Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 2020 13:02:23 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367952 - head/sys/dev/tws
Message-ID:  <202011231302.0AND2NCw044056@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Nov 23 13:02:23 2020
New Revision: 367952
URL: https://svnweb.freebsd.org/changeset/base/367952

Log:
  Make tws(4) use xpt_alloc_ccb()/xpt_free_ccb() instead of malloc/free.
  
  Reviewed by:	imp
  MFC after:	2 weeks
  Sponsored by:	NetApp, Inc.
  Sponsored by:	Klara, Inc.
  Differential Revision:	https://reviews.freebsd.org/D26841

Modified:
  head/sys/dev/tws/tws.c

Modified: head/sys/dev/tws/tws.c
==============================================================================
--- head/sys/dev/tws/tws.c	Mon Nov 23 12:59:56 2020	(r367951)
+++ head/sys/dev/tws/tws.c	Mon Nov 23 13:02:23 2020	(r367952)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 
 #include <cam/cam.h>
 #include <cam/cam_ccb.h>
+#include <cam/cam_xpt.h>
 
 MALLOC_DEFINE(M_TWS, "twsbuf", "buffers used by tws driver");
 int tws_queue_depth = TWS_MAX_REQS;
@@ -412,7 +413,7 @@ tws_detach(device_t dev)
     callout_drain(&sc->stats_timer);
     free(sc->reqs, M_TWS);
     free(sc->sense_bufs, M_TWS);
-    free(sc->scan_ccb, M_TWS);
+    xpt_free_ccb(sc->scan_ccb);
     if (sc->ioctl_data_mem)
             bus_dmamem_free(sc->data_tag, sc->ioctl_data_mem, sc->ioctl_data_map);
     if (sc->data_tag)
@@ -597,7 +598,7 @@ tws_init(struct tws_softc *sc)
                       M_WAITOK | M_ZERO);
     sc->sense_bufs = malloc(sizeof(struct tws_sense) * tws_queue_depth, M_TWS,
                       M_WAITOK | M_ZERO);
-    sc->scan_ccb = malloc(sizeof(union ccb), M_TWS, M_WAITOK | M_ZERO);
+    sc->scan_ccb = xpt_alloc_ccb();
     if (bus_dmamem_alloc(sc->data_tag, (void **)&sc->ioctl_data_mem,
             (BUS_DMA_NOWAIT | BUS_DMA_ZERO), &sc->ioctl_data_map)) {
         device_printf(sc->tws_dev, "Cannot allocate ioctl data mem\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011231302.0AND2NCw044056>