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.
This commit is contained in:
Scott Long 2018-12-09 06:16:54 +00:00
parent 617e85f387
commit e024533250
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341756

View File

@ -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);
}