aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2018-12-09 06:16:54 +0000
committerScott Long <scottl@FreeBSD.org>2018-12-09 06:16:54 +0000
commite0245332509782f5dce8b14e744cfd2146e970e6 (patch)
tree9ea030af49fe5f2e9f56f63b9a4f46abbbaec15c
parent617e85f387b47aefafd84d55cde2565e0e266ef4 (diff)
downloadsrc-e0245332509782f5dce8b14e744cfd2146e970e6.tar.gz
src-e0245332509782f5dce8b14e744cfd2146e970e6.zip
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.
Notes
Notes: svn path=/head/; revision=341756
-rw-r--r--sys/cam/cam_xpt.c19
1 files changed, 4 insertions, 15 deletions
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);
}