From e0245332509782f5dce8b14e744cfd2146e970e6 Mon Sep 17 00:00:00 2001 From: Scott Long Date: Sun, 9 Dec 2018 06:16:54 +0000 Subject: Don't allocate the config_intrhook separately from the softc, it's small enough that it costs more code to handle the malloc/free than it saves. --- sys/cam/cam_xpt.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'sys/cam') diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 3ce61e7f6198..0679ca9cea49 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -129,7 +129,7 @@ struct xpt_softc { TAILQ_HEAD(,cam_eb) xpt_busses; u_int bus_generation; - struct intr_config_hook *xpt_config_hook; + struct intr_config_hook xpt_config_hook; int boot_delay; struct callout boot_callout; @@ -982,17 +982,8 @@ xpt_init(void *dummy) /* * Register a callback for when interrupts are enabled. */ - xsoftc.xpt_config_hook = - (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook), - M_CAMXPT, M_NOWAIT | M_ZERO); - if (xsoftc.xpt_config_hook == NULL) { - printf("xpt_init: Cannot malloc config hook " - "- failing attach\n"); - return (ENOMEM); - } - xsoftc.xpt_config_hook->ich_func = xpt_config; - if (config_intrhook_establish(xsoftc.xpt_config_hook) != 0) { - free (xsoftc.xpt_config_hook, M_CAMXPT); + xsoftc.xpt_config_hook.ich_func = xpt_config; + if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) { printf("xpt_init: config_intrhook_establish failed " "- failing attach\n"); } @@ -5245,9 +5236,7 @@ xpt_finishconfig_task(void *context, int pending) xpt_for_all_devices(xptpassannouncefunc, NULL); /* Release our hook so that the boot can continue. */ - config_intrhook_disestablish(xsoftc.xpt_config_hook); - free(xsoftc.xpt_config_hook, M_CAMXPT); - xsoftc.xpt_config_hook = NULL; + config_intrhook_disestablish(&xsoftc.xpt_config_hook); free(context, M_CAMXPT); } -- cgit v1.2.3