From b0a2dc66152aa409860e02804169b0007244ebd7 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Fri, 1 Sep 2017 23:21:24 -0700 Subject: [PATCH] scsi: isci: Convert timers to use timer_setup() In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Intel SCU Linux support Cc: Artur Paszkiewicz Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Artur Paszkiewicz --- drivers/scsi/isci/host.c | 12 ++++++------ drivers/scsi/isci/isci.h | 6 ++---- drivers/scsi/isci/phy.c | 4 ++-- drivers/scsi/isci/port.c | 4 ++-- drivers/scsi/isci/port_config.c | 8 ++++---- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 609dafd661d1..13b37cdffa8e 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c @@ -958,9 +958,9 @@ static enum sci_status sci_controller_start_next_phy(struct isci_host *ihost) return status; } -static void phy_startup_timeout(unsigned long data) +static void phy_startup_timeout(struct timer_list *t) { - struct sci_timer *tmr = (struct sci_timer *)data; + struct sci_timer *tmr = from_timer(tmr, t, timer); struct isci_host *ihost = container_of(tmr, typeof(*ihost), phy_timer); unsigned long flags; enum sci_status status; @@ -1592,9 +1592,9 @@ static const struct sci_base_state sci_controller_state_table[] = { [SCIC_FAILED] = {} }; -static void controller_timeout(unsigned long data) +static void controller_timeout(struct timer_list *t) { - struct sci_timer *tmr = (struct sci_timer *)data; + struct sci_timer *tmr = from_timer(tmr, t, timer); struct isci_host *ihost = container_of(tmr, typeof(*ihost), timer); struct sci_base_state_machine *sm = &ihost->sm; unsigned long flags; @@ -1737,9 +1737,9 @@ static u8 max_spin_up(struct isci_host *ihost) MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT); } -static void power_control_timeout(unsigned long data) +static void power_control_timeout(struct timer_list *t) { - struct sci_timer *tmr = (struct sci_timer *)data; + struct sci_timer *tmr = from_timer(tmr, t, timer); struct isci_host *ihost = container_of(tmr, typeof(*ihost), power_control.timer); struct isci_phy *iphy; unsigned long flags; diff --git a/drivers/scsi/isci/isci.h b/drivers/scsi/isci/isci.h index 234ab46fce33..680e30947671 100644 --- a/drivers/scsi/isci/isci.h +++ b/drivers/scsi/isci/isci.h @@ -498,12 +498,10 @@ struct sci_timer { }; static inline -void sci_init_timer(struct sci_timer *tmr, void (*fn)(unsigned long)) +void sci_init_timer(struct sci_timer *tmr, void (*fn)(struct timer_list *t)) { - tmr->timer.function = fn; - tmr->timer.data = (unsigned long) tmr; tmr->cancel = 0; - init_timer(&tmr->timer); + timer_setup(&tmr->timer, fn, 0); } static inline void sci_mod_timer(struct sci_timer *tmr, unsigned long msec) diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index cb87b2ef7c92..1deca8c5a94f 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c @@ -315,9 +315,9 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, return SCI_SUCCESS; } -static void phy_sata_timeout(unsigned long data) +static void phy_sata_timeout(struct timer_list *t) { - struct sci_timer *tmr = (struct sci_timer *)data; + struct sci_timer *tmr = from_timer(tmr, t, timer); struct isci_phy *iphy = container_of(tmr, typeof(*iphy), sata_timer); struct isci_host *ihost = iphy->owning_port->owning_controller; unsigned long flags; diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index a4dd5c91508c..1df45f028ea7 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c @@ -769,9 +769,9 @@ bool sci_port_link_detected(struct isci_port *iport, struct isci_phy *iphy) return true; } -static void port_timeout(unsigned long data) +static void port_timeout(struct timer_list *t) { - struct sci_timer *tmr = (struct sci_timer *)data; + struct sci_timer *tmr = from_timer(tmr, t, timer); struct isci_port *iport = container_of(tmr, typeof(*iport), timer); struct isci_host *ihost = iport->owning_controller; unsigned long flags; diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c index ac879745ef80..edb7be786c65 100644 --- a/drivers/scsi/isci/port_config.c +++ b/drivers/scsi/isci/port_config.c @@ -319,10 +319,10 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host *ihost, return sci_port_configuration_agent_validate_ports(ihost, port_agent); } -static void mpc_agent_timeout(unsigned long data) +static void mpc_agent_timeout(struct timer_list *t) { u8 index; - struct sci_timer *tmr = (struct sci_timer *)data; + struct sci_timer *tmr = from_timer(tmr, t, timer); struct sci_port_configuration_agent *port_agent; struct isci_host *ihost; unsigned long flags; @@ -654,10 +654,10 @@ static void sci_apc_agent_link_down( } /* configure the phys into ports when the timer fires */ -static void apc_agent_timeout(unsigned long data) +static void apc_agent_timeout(struct timer_list *t) { u32 index; - struct sci_timer *tmr = (struct sci_timer *)data; + struct sci_timer *tmr = from_timer(tmr, t, timer); struct sci_port_configuration_agent *port_agent; struct isci_host *ihost; unsigned long flags;