timer: Remove init_timer_deferrable() in favor of timer_setup()

This refactors the only users of init_timer_deferrable() to use
the new timer_setup() and from_timer(). Removes definition of
init_timer_deferrable().

Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: David S. Miller <[email protected]> # for networking parts
Acked-by: Sebastian Reichel <[email protected]> # for drivers/hsi parts
Cc: [email protected]
Cc: Petr Mladek <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Lai Jiangshan <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: [email protected]
Cc: Chris Metcalf <[email protected]>
Cc: [email protected]
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Wim Van Sebroeck <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Ursula Braun <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: Harish Patil <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Manish Chopra <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: Heiko Carstens <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Julian Wiedmann <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Mark Gross <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: "Martin K. Petersen" <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: [email protected]
Cc: Sebastian Reichel <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Stefan Richter <[email protected]>
Cc: Michael Reed <[email protected]>
Cc: [email protected]
Cc: Martin Schwidefsky <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: Sudip Mukherjee <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
This commit is contained in:
Kees Cook 2017-10-04 16:26:59 -07:00 • committed by Thomas Gleixner
commit df7e828c1b
6 changed files with 34 additions and 40 deletions

View file

@ -464,10 +464,10 @@ static void ssip_error(struct hsi_client *cl)
hsi_async_read(cl, msg);
}
static void ssip_keep_alive(unsigned long data)
static void ssip_keep_alive(struct timer_list *t)
{
struct hsi_client *cl = (struct hsi_client *)data;
struct ssi_protocol *ssi = hsi_client_drvdata(cl);
struct ssi_protocol *ssi = from_timer(ssi, t, keep_alive);
struct hsi_client *cl = ssi->cl;
dev_dbg(&cl->device, "Keep alive kick in: m(%d) r(%d) s(%d)\n",
ssi->main_state, ssi->recv_state, ssi->send_state);
@ -490,9 +490,19 @@ static void ssip_keep_alive(unsigned long data)
spin_unlock(&ssi->lock);
}
static void ssip_wd(unsigned long data)
static void ssip_rx_wd(struct timer_list *t)
{
struct hsi_client *cl = (struct hsi_client *)data;
struct ssi_protocol *ssi = from_timer(ssi, t, rx_wd);
struct hsi_client *cl = ssi->cl;
dev_err(&cl->device, "Watchdog trigerred\n");
ssip_error(cl);
}
static void ssip_tx_wd(unsigned long data)
{
struct ssi_protocol *ssi = from_timer(ssi, t, tx_wd);
struct hsi_client *cl = ssi->cl;
dev_err(&cl->device, "Watchdog trigerred\n");
ssip_error(cl);
@ -1084,15 +1094,9 @@ static int ssi_protocol_probe(struct device *dev)
}
spin_lock_init(&ssi->lock);
init_timer_deferrable(&ssi->rx_wd);
init_timer_deferrable(&ssi->tx_wd);
init_timer(&ssi->keep_alive);
ssi->rx_wd.data = (unsigned long)cl;
ssi->rx_wd.function = ssip_wd;
ssi->tx_wd.data = (unsigned long)cl;
ssi->tx_wd.function = ssip_wd;
ssi->keep_alive.data = (unsigned long)cl;
ssi->keep_alive.function = ssip_keep_alive;
timer_setup(&ssi->rx_wd, ssip_rx_wd, TIMER_DEFERRABLE);
timer_setup(&ssi->tx_wd, ssip_tx_wd, TIMER_DEFERRABLE);
timer_setup(&ssi->keep_alive, ssip_keep_alive, 0);
INIT_LIST_HEAD(&ssi->txqueue);
INIT_LIST_HEAD(&ssi->cmdqueue);
atomic_set(&ssi->tx_usecnt, 0);