svn commit: r341756 - head/sys/cam
Scott Long
scottl at FreeBSD.org
Sun Dec 9 06:16:55 UTC 2018
Author: scottl
Date: Sun Dec 9 06:16:54 2018
New Revision: 341756
URL: https://svnweb.freebsd.org/changeset/base/341756
Log:
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.
Modified:
head/sys/cam/cam_xpt.c
Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c Sun Dec 9 06:10:11 2018 (r341755)
+++ head/sys/cam/cam_xpt.c Sun Dec 9 06:16:54 2018 (r341756)
@@ -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);
}
More information about the svn-src-all
mailing list