KVM: Simplify kvm_pit_timer
authorAvi Kivity <avi@redhat.com>
Thu, 26 Jul 2012 15:01:52 +0000 (18:01 +0300)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 1 Aug 2012 03:21:07 +0000 (00:21 -0300)
'timer_mode_mask' is unused
'tscdeadline' is unused
't_ops' only adds needless indirection
'vcpu' is unused

Remove.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/i8254.c
arch/x86/kvm/i8254.h

index 1d8e75702d950092d5ed1aa230135b8d3f23dd73..a9e187a5b19939e2819fc0653027af0dc14e12f8 100644 (file)
@@ -272,17 +272,6 @@ static void destroy_pit_timer(struct kvm_pit *pit)
        flush_kthread_work(&pit->expired);
 }
 
-static bool kpit_is_periodic(struct kvm_pit_timer *ktimer)
-{
-       struct kvm_kpit_state *ps = container_of(ktimer, struct kvm_kpit_state,
-                                                pit_timer);
-       return ps->is_periodic;
-}
-
-static struct kvm_pit_timer_ops kpit_ops = {
-       .is_periodic = kpit_is_periodic,
-};
-
 static void pit_do_work(struct kthread_work *work)
 {
        struct kvm_pit *pit = container_of(work, struct kvm_pit, expired);
@@ -330,7 +319,7 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data)
                queue_kthread_work(&pt->worker, &pt->expired);
        }
 
-       if (ktimer->t_ops->is_periodic(ktimer)) {
+       if (pt->pit_state.is_periodic) {
                hrtimer_add_expires_ns(&ktimer->timer, ktimer->period);
                return HRTIMER_RESTART;
        } else
@@ -357,7 +346,6 @@ static void create_pit_timer(struct kvm *kvm, u32 val, int is_period)
        ps->is_periodic = is_period;
 
        pt->timer.function = pit_timer_fn;
-       pt->t_ops = &kpit_ops;
        pt->kvm = ps->pit->kvm;
 
        atomic_set(&pt->pending, 0);
index 3351816e8b327478e52decdeddb18d0379b6f2e1..c9bbcb889c4003ff4d68e6eb3d6280eaccc01b87 100644 (file)
@@ -24,17 +24,9 @@ struct kvm_kpit_channel_state {
 struct kvm_pit_timer {
        struct hrtimer timer;
        s64 period;                             /* unit: ns */
-       u32 timer_mode_mask;
-       u64 tscdeadline;
        atomic_t pending;                       /* accumulated triggered timers */
        bool reinject;
-       struct kvm_pit_timer_ops *t_ops;
        struct kvm *kvm;
-       struct kvm_vcpu *vcpu;
-};
-
-struct kvm_pit_timer_ops {
-       bool (*is_periodic)(struct kvm_pit_timer *);
 };
 
 struct kvm_kpit_state {