diff mbox

[kvm-next,2/2] kvm: remove dead code

Message ID 20131229121308.58f2a077@nehalam.linuxnetplumber.net (mailing list archive)
State New, archived
Headers show

Commit Message

Stephen Hemminger Dec. 29, 2013, 8:13 p.m. UTC
The function kvm_io_bus_read_cookie is defined but never used
in current in-tree code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


--
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

Comments

Gleb Natapov Dec. 30, 2013, 7:37 a.m. UTC | #1
On Sun, Dec 29, 2013 at 12:13:08PM -0800, Stephen Hemminger wrote:
> The function kvm_io_bus_read_cookie is defined but never used
> in current in-tree code.
> 
It was added recently by Cornelia (copied) with intention to be used in s390
code. I assume the intention is still there.

> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> 
> --- a/include/linux/kvm_host.h	2013-12-27 13:12:19.409612858 -0800
> +++ b/include/linux/kvm_host.h	2013-12-27 13:12:42.261259369 -0800
> @@ -172,8 +172,6 @@ int kvm_io_bus_write_cookie(struct kvm *
>  			    int len, const void *val, long cookie);
>  int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
>  		    void *val);
> -int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
> -			   int len, void *val, long cookie);
>  int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
>  			    int len, struct kvm_io_device *dev);
>  int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
> --- a/virt/kvm/kvm_main.c	2013-12-27 13:12:19.413612796 -0800
> +++ b/virt/kvm/kvm_main.c	2013-12-27 13:12:42.261259369 -0800
> @@ -2937,33 +2937,6 @@ int kvm_io_bus_read(struct kvm *kvm, enu
>  	return r < 0 ? r : 0;
>  }
>  
> -/* kvm_io_bus_read_cookie - called under kvm->slots_lock */
> -int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
> -			   int len, void *val, long cookie)
> -{
> -	struct kvm_io_bus *bus;
> -	struct kvm_io_range range;
> -
> -	range = (struct kvm_io_range) {
> -		.addr = addr,
> -		.len = len,
> -	};
> -
> -	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
> -
> -	/* First try the device referenced by cookie. */
> -	if ((cookie >= 0) && (cookie < bus->dev_count) &&
> -	    (kvm_io_bus_cmp(&range, &bus->range[cookie]) == 0))
> -		if (!kvm_iodevice_read(bus->range[cookie].dev, addr, len,
> -				       val))
> -			return cookie;
> -
> -	/*
> -	 * cookie contained garbage; fall back to search and return the
> -	 * correct cookie value.
> -	 */
> -	return __kvm_io_bus_read(bus, &range, val);
> -}
>  
>  /* Caller must hold slots_lock. */
>  int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,

--
			Gleb.
--
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
Stephen Hemminger Dec. 30, 2013, 10:27 p.m. UTC | #2
On Mon, 30 Dec 2013 09:37:15 +0200
Gleb Natapov <gleb@minantech.com> wrote:

> On Sun, Dec 29, 2013 at 12:13:08PM -0800, Stephen Hemminger wrote:
> > The function kvm_io_bus_read_cookie is defined but never used
> > in current in-tree code.
> >   
> It was added recently by Cornelia (copied) with intention to be used in s390
> code. I assume the intention is still there.

The normal process is that the code is added in one patch just
before the code that uses it. Rather than the "if we build it they will come"
philosophy.
--
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
Paolo Bonzini Dec. 31, 2013, 3:18 p.m. UTC | #3
Il 30/12/2013 23:27, Stephen Hemminger ha scritto:
>> > It was added recently by Cornelia (copied) with intention to be used in s390
>> > code. I assume the intention is still there.
> The normal process is that the code is added in one patch just
> before the code that uses it. Rather than the "if we build it they will come"
> philosophy.

I'm fairly sure that was not the intention; rather, "we built it but we
haven't sent a pull request for whatever reason".

Paolo
--
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
Cornelia Huck Jan. 7, 2014, 1:14 p.m. UTC | #4
On Tue, 31 Dec 2013 16:18:40 +0100
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Il 30/12/2013 23:27, Stephen Hemminger ha scritto:
> >> > It was added recently by Cornelia (copied) with intention to be used in s390
> >> > code. I assume the intention is still there.
> > The normal process is that the code is added in one patch just
> > before the code that uses it. Rather than the "if we build it they will come"
> > philosophy.
> 
> I'm fairly sure that was not the intention; rather, "we built it but we
> haven't sent a pull request for whatever reason".

Actually, the intention was "let read offer the same interfaces as
write". I currently don't see any usage of the read interface from my
side; if you prefer to remove it, I won't object.

--
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

--- a/include/linux/kvm_host.h	2013-12-27 13:12:19.409612858 -0800
+++ b/include/linux/kvm_host.h	2013-12-27 13:12:42.261259369 -0800
@@ -172,8 +172,6 @@  int kvm_io_bus_write_cookie(struct kvm *
 			    int len, const void *val, long cookie);
 int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
 		    void *val);
-int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
-			   int len, void *val, long cookie);
 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 			    int len, struct kvm_io_device *dev);
 int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
--- a/virt/kvm/kvm_main.c	2013-12-27 13:12:19.413612796 -0800
+++ b/virt/kvm/kvm_main.c	2013-12-27 13:12:42.261259369 -0800
@@ -2937,33 +2937,6 @@  int kvm_io_bus_read(struct kvm *kvm, enu
 	return r < 0 ? r : 0;
 }
 
-/* kvm_io_bus_read_cookie - called under kvm->slots_lock */
-int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
-			   int len, void *val, long cookie)
-{
-	struct kvm_io_bus *bus;
-	struct kvm_io_range range;
-
-	range = (struct kvm_io_range) {
-		.addr = addr,
-		.len = len,
-	};
-
-	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
-
-	/* First try the device referenced by cookie. */
-	if ((cookie >= 0) && (cookie < bus->dev_count) &&
-	    (kvm_io_bus_cmp(&range, &bus->range[cookie]) == 0))
-		if (!kvm_iodevice_read(bus->range[cookie].dev, addr, len,
-				       val))
-			return cookie;
-
-	/*
-	 * cookie contained garbage; fall back to search and return the
-	 * correct cookie value.
-	 */
-	return __kvm_io_bus_read(bus, &range, val);
-}
 
 /* Caller must hold slots_lock. */
 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,