Skip to content

Commit

Permalink
x86/lguest/timer: Migrate to new set-state interface
Browse files Browse the repository at this point in the history
Migrate lguest driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

We weren't doing anything while switching modes other than in shutdown
mode and so those are not implemented.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-and-tested-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: linaro-kernel@lists.linaro.org
Cc: Alexander Kuleshov <kuleshovmail@gmail.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: lguest@lists.ozlabs.org (open list:LGUEST)
Link: http://lkml.kernel.org/r/b96f1c308f4523255c5394a4e6e13f2b67685402.1437042675.git.viresh.kumar@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Viresh Kumar authored and Thomas Gleixner committed Jul 30, 2015
1 parent 5054e1e commit c2e13cc
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions arch/x86/lguest/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,31 +985,19 @@ static int lguest_clockevent_set_next_event(unsigned long delta,
return 0;
}

static void lguest_clockevent_set_mode(enum clock_event_mode mode,
struct clock_event_device *evt)
{
switch (mode) {
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
/* A 0 argument shuts the clock down. */
hcall(LHCALL_SET_CLOCKEVENT, 0, 0, 0, 0);
break;
case CLOCK_EVT_MODE_ONESHOT:
/* This is what we expect. */
break;
case CLOCK_EVT_MODE_PERIODIC:
BUG();
case CLOCK_EVT_MODE_RESUME:
break;
}
static int lguest_clockevent_shutdown(struct clock_event_device *evt)
{
/* A 0 argument shuts the clock down. */
hcall(LHCALL_SET_CLOCKEVENT, 0, 0, 0, 0);
return 0;
}

/* This describes our primitive timer chip. */
static struct clock_event_device lguest_clockevent = {
.name = "lguest",
.features = CLOCK_EVT_FEAT_ONESHOT,
.set_next_event = lguest_clockevent_set_next_event,
.set_mode = lguest_clockevent_set_mode,
.set_state_shutdown = lguest_clockevent_shutdown,
.rating = INT_MAX,
.mult = 1,
.shift = 0,
Expand Down

0 comments on commit c2e13cc

Please sign in to comment.