From fc81a7032577914bac149316323d225e6c268a18 Mon Sep 17 00:00:00 2001 From: Robert Mustacchi Date: Wed, 8 Jun 2011 12:49:42 -0700 Subject: HVM-328 replace container_of with offsetof calculations --- kvm_vmx.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'kvm_vmx.c') diff --git a/kvm_vmx.c b/kvm_vmx.c index c66ec7a..c999041 100644 --- a/kvm_vmx.c +++ b/kvm_vmx.c @@ -178,13 +178,8 @@ typedef struct vcpu_vmx { static struct vcpu_vmx * to_vmx(struct kvm_vcpu *vcpu) { -#ifdef XXX_KVM_DOESNTCOMPILE - return (container_of(vcpu, struct vcpu_vmx, vcpu)); -#else - /* assumes vcpu is first field in vcpu_vmx */ - /* because gcc with kernel flags complains about container_of */ - return ((struct vcpu_vmx *)vcpu); -#endif + return ((struct vcpu_vmx *)((uintptr_t)vcpu - + offsetof(struct vcpu_vmx, vcpu))); } typedef struct vmcs_config { -- cgit v1.2.3