From 9358cceb978705b8eb9e5358606f4e40ebb5ab62 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 13 Dec 2019 19:56:48 +0000 Subject: [PATCH] Use callout(9) instead of deprecated timeout(9). Reviewed by: imp Tested by: Scott Benesh Differential Revision: https://reviews.freebsd.org/D22598 --- sys/dev/smartpqi/smartpqi_defines.h | 4 ++-- sys/dev/smartpqi/smartpqi_main.c | 12 ++++++------ sys/dev/smartpqi/smartpqi_misc.c | 13 ++++++------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/sys/dev/smartpqi/smartpqi_defines.h b/sys/dev/smartpqi/smartpqi_defines.h index 62f5c25f7c8e..0dfc64ecdbfb 100644 --- a/sys/dev/smartpqi/smartpqi_defines.h +++ b/sys/dev/smartpqi/smartpqi_defines.h @@ -856,8 +856,8 @@ typedef struct OS_SPECIFIC { struct cam_path *path; struct task event_task; struct cdev *cdev; - struct callout_handle wellness_periodic; /* periodic event handling */ - struct callout_handle heartbeat_timeout_id; /* heart beat event handling */ + struct callout wellness_periodic; /* periodic event handling */ + struct callout heartbeat_timeout_id; /* heart beat event handling */ eventhandler_tag eh; } OS_SPECIFIC_T; diff --git a/sys/dev/smartpqi/smartpqi_main.c b/sys/dev/smartpqi/smartpqi_main.c index 6b32abedd9b2..91f3577fdff0 100644 --- a/sys/dev/smartpqi/smartpqi_main.c +++ b/sys/dev/smartpqi/smartpqi_main.c @@ -324,6 +324,8 @@ smartpqi_attach(device_t dev) mtx_init(&softs->os_specific.cam_lock, "cam_lock", NULL, MTX_DEF); softs->os_specific.mtx_init = TRUE; mtx_init(&softs->os_specific.map_lock, "map_lock", NULL, MTX_DEF); + callout_init(&softs->os_specific.wellness_periodic, 1); + callout_init(&softs->os_specific.heartbeat_timeout_id, 1); /* * Create DMA tag for mapping buffers into controller-addressable space. @@ -355,8 +357,8 @@ smartpqi_attach(device_t dev) } os_start_heartbeat_timer((void *)softs); /* Start the heart-beat timer */ - softs->os_specific.wellness_periodic = timeout( os_wellness_periodic, - softs, 120*hz); + callout_reset(&softs->os_specific.wellness_periodic, 120*hz, + os_wellness_periodic, softs); /* Register our shutdown handler. */ softs->os_specific.eh = EVENTHANDLER_REGISTER(shutdown_final, smartpqi_shutdown, softs, SHUTDOWN_PRI_DEFAULT); @@ -410,11 +412,9 @@ smartpqi_detach(device_t dev) EVENTHANDLER_DEREGISTER(shutdown_final, softs->os_specific.eh); /* kill the periodic event */ - untimeout(os_wellness_periodic, softs, - softs->os_specific.wellness_periodic); + callout_drain(&softs->os_specific.wellness_periodic); /* Kill the heart beat event */ - untimeout(os_start_heartbeat_timer, softs, - softs->os_specific.heartbeat_timeout_id); + callout_drain(&softs->os_specific.heartbeat_timeout_id); smartpqi_shutdown(softs); destroy_char_dev(softs); diff --git a/sys/dev/smartpqi/smartpqi_misc.c b/sys/dev/smartpqi/smartpqi_misc.c index 9bf5e8c07db5..88739853b229 100644 --- a/sys/dev/smartpqi/smartpqi_misc.c +++ b/sys/dev/smartpqi/smartpqi_misc.c @@ -69,8 +69,8 @@ void os_wellness_periodic(void *data) } /* reschedule ourselves */ - softs->os_specific.wellness_periodic = timeout(os_wellness_periodic, - softs, OS_HOST_WELLNESS_TIMEOUT * hz); + callout_schedule(&softs->os_specific.wellness_periodic, + OS_HOST_WELLNESS_TIMEOUT * hz); } /* @@ -81,8 +81,7 @@ void os_stop_heartbeat_timer(pqisrc_softstate_t *softs) DBG_FUNC("IN\n"); /* Kill the heart beat event */ - untimeout(os_start_heartbeat_timer, softs, - softs->os_specific.heartbeat_timeout_id); + callout_stop(&softs->os_specific.heartbeat_timeout_id); DBG_FUNC("OUT\n"); } @@ -97,9 +96,9 @@ void os_start_heartbeat_timer(void *data) pqisrc_heartbeat_timer_handler(softs); if (!pqisrc_ctrl_offline(softs)) { - softs->os_specific.heartbeat_timeout_id = - timeout(os_start_heartbeat_timer, softs, - OS_FW_HEARTBEAT_TIMER_INTERVAL * hz); + callout_reset(&softs->os_specific.heartbeat_timeout_id, + OS_FW_HEARTBEAT_TIMER_INTERVAL * hz, + os_start_heartbeat_timer, softs); } DBG_FUNC("OUT\n");