From: "Peter E. Berger" <pberger@xxxxxxxxxxx> Add edge_heartbeat_reschedule() helper function and call it from edge_startup() and edge_resume(). Signed-off-by: Peter E. Berger <pberger@xxxxxxxxxxx> --- drivers/usb/serial/io_ti.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 0ef51ee..194e469 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2391,6 +2391,15 @@ static void edge_heartbeat_work(struct work_struct *work) schedule_delayed_work(&serial->heartbeat_work, FW_HEARTBEAT_SECS * HZ); } +static inline void edge_heartbeat_reschedule(struct edgeport_serial + *edge_serial) +{ + if (edge_serial->fw_version > FW_HEARTBEAT_VERSION_CUTOFF) { + schedule_delayed_work(&edge_serial->heartbeat_work, + FW_HEARTBEAT_SECS * HZ); + } +} + static int edge_startup(struct usb_serial *serial) { struct edgeport_serial *edge_serial; @@ -2439,10 +2448,7 @@ static int edge_startup(struct usb_serial *serial) } INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work); - if (edge_serial->fw_version > FW_HEARTBEAT_VERSION_CUTOFF) { - schedule_delayed_work(&edge_serial->heartbeat_work, - FW_HEARTBEAT_SECS * HZ); - } + edge_heartbeat_reschedule(edge_serial); return 0; } @@ -2576,10 +2582,7 @@ static int edge_resume(struct usb_serial *serial) { struct edgeport_serial *edge_serial = usb_get_serial_data(serial); - if (edge_serial->fw_version > FW_HEARTBEAT_VERSION_CUTOFF) { - schedule_delayed_work(&edge_serial->heartbeat_work, - FW_HEARTBEAT_SECS * HZ); - } + edge_heartbeat_reschedule(edge_serial); return 0; } -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html