diff mbox

[v3,3/5] KVM: move kvm_get_kvm to kvm_host.h

Message ID 1477895706-22824-4-git-send-email-jike.song@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jike Song Oct. 31, 2016, 6:35 a.m. UTC
So that external users like vfio can call it without introducing
symbol-level dependency.

Signed-off-by: Jike Song <jike.song@intel.com>
---
 include/linux/kvm_host.h | 5 ++++-
 virt/kvm/kvm_main.c      | 6 ------
 2 files changed, 4 insertions(+), 7 deletions(-)

Comments

Paolo Bonzini Oct. 31, 2016, 8:33 a.m. UTC | #1
> So that external users like vfio can call it without introducing
> symbol-level dependency.
> 
> Signed-off-by: Jike Song <jike.song@intel.com>
> ---
>  include/linux/kvm_host.h | 5 ++++-
>  virt/kvm/kvm_main.c      | 6 ------
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 01c0b9c..e1e877af 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -526,7 +526,10 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned
> vcpu_align,
>  		  struct module *module);
>  void kvm_exit(void);
>  
> -void kvm_get_kvm(struct kvm *kvm);
> +static inline void kvm_get_kvm(struct kvm *kvm)
> +{
> +	atomic_inc(&kvm->users_count);
> +}
>  void kvm_put_kvm(struct kvm *kvm);
>  
>  static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int
>  as_id)
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 348d6fd..e25359b 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -740,12 +740,6 @@ static void kvm_destroy_vm(struct kvm *kvm)
>  	mmdrop(mm);
>  }
>  
> -void kvm_get_kvm(struct kvm *kvm)
> -{
> -	atomic_inc(&kvm->users_count);
> -}
> -EXPORT_SYMBOL_GPL(kvm_get_kvm);
> -
>  void kvm_put_kvm(struct kvm *kvm)
>  {
>  	if (atomic_dec_and_test(&kvm->users_count))
> --
> 1.9.1
> 
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 01c0b9c..e1e877af 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -526,7 +526,10 @@  int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
 		  struct module *module);
 void kvm_exit(void);
 
-void kvm_get_kvm(struct kvm *kvm);
+static inline void kvm_get_kvm(struct kvm *kvm)
+{
+	atomic_inc(&kvm->users_count);
+}
 void kvm_put_kvm(struct kvm *kvm);
 
 static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 348d6fd..e25359b 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -740,12 +740,6 @@  static void kvm_destroy_vm(struct kvm *kvm)
 	mmdrop(mm);
 }
 
-void kvm_get_kvm(struct kvm *kvm)
-{
-	atomic_inc(&kvm->users_count);
-}
-EXPORT_SYMBOL_GPL(kvm_get_kvm);
-
 void kvm_put_kvm(struct kvm *kvm)
 {
 	if (atomic_dec_and_test(&kvm->users_count))