Linux virtualization list
 help / color / mirror / Atom feed
From: "K. Y. Srinivasan" <kys@microsoft.com>
To: gregkh@suse.de, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	ohering@suse.com, jbottomley@parallels.com, hch@infradead.org,
	linux-scsi@vger.kernel.org
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH 02/15] Staging: hv: storvsc: Cleanup storvsc_probe()
Date: Thu, 12 Jan 2012 12:37:55 -0800	[thread overview]
Message-ID: <1326400688-13544-2-git-send-email-kys@microsoft.com> (raw)
In-Reply-To: <1326400688-13544-1-git-send-email-kys@microsoft.com>

Cleanup storvsc_probe(). As part of this cleanup, get rid of
storvsc_get_ide_info() by inlining the necessary code.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/staging/hv/storvsc_drv.c |   30 ++++++++----------------------
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 1633b03..7561d29 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -791,18 +791,6 @@ static int storvsc_do_io(struct hv_device *device,
 	return ret;
 }
 
-static void storvsc_get_ide_info(struct hv_device *dev, int *target, int *path)
-{
-	*target =
-		dev->dev_instance.b[5] << 8 | dev->dev_instance.b[4];
-
-	*path =
-		dev->dev_instance.b[3] << 24 |
-		dev->dev_instance.b[2] << 16 |
-		dev->dev_instance.b[1] << 8  | dev->dev_instance.b[0];
-}
-
-
 static int storvsc_device_alloc(struct scsi_device *sdevice)
 {
 	struct stor_mem_pools *memp;
@@ -1457,7 +1445,6 @@ static int storvsc_probe(struct hv_device *device,
 	struct Scsi_Host *host;
 	struct hv_host_device *host_dev;
 	bool dev_is_ide = ((dev_id->driver_data == IDE_GUID) ? true : false);
-	int path = 0;
 	int target = 0;
 	struct storvsc_device *stor_device;
 
@@ -1490,9 +1477,6 @@ static int storvsc_probe(struct hv_device *device,
 	if (ret)
 		goto err_out1;
 
-	if (dev_is_ide)
-		storvsc_get_ide_info(device, &target, &path);
-
 	host_dev->path = stor_device->path_id;
 	host_dev->target = stor_device->target_id;
 
@@ -1512,12 +1496,14 @@ static int storvsc_probe(struct hv_device *device,
 
 	if (!dev_is_ide) {
 		scsi_scan_host(host);
-		return 0;
-	}
-	ret = scsi_add_device(host, 0, target, 0);
-	if (ret) {
-		scsi_remove_host(host);
-		goto err_out2;
+	} else {
+		target = (device->dev_instance.b[5] << 8 |
+			 device->dev_instance.b[4]);
+		ret = scsi_add_device(host, 0, target, 0);
+		if (ret) {
+			scsi_remove_host(host);
+			goto err_out2;
+		}
 	}
 	return 0;
 
-- 
1.7.4.1

  reply	other threads:[~2012-01-12 20:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12 20:37 [PATCH 0000/0015] Staging: hv: storvsc cleanup K. Y. Srinivasan
2012-01-12 20:37 ` [PATCH 01/15] Staging: hv: storvsc: Cleanup some comments K. Y. Srinivasan
2012-01-12 20:37   ` K. Y. Srinivasan [this message]
2012-01-12 20:37   ` [PATCH 03/15] Staging: hv: storvsc: Cleanup storvsc_queuecommand() K. Y. Srinivasan
2012-01-12 20:37   ` [PATCH 04/15] Staging: hv: storvsc: Introduce defines for srb status codes K. Y. Srinivasan
2012-01-12 20:37   ` [PATCH 05/15] Staging:hv: storvsc: Cleanup storvsc_host_reset_handler() K. Y. Srinivasan
2012-01-12 20:37   ` [PATCH 06/15] Staging: hv: storvsc: Move and cleanup storvsc_remove() K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 07/15] Staging: hv: storvsc: Add a comment to explain life-cycle management K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 08/15] Staging: hv: storvsc: Get rid of the on_io_completion in hv_storvsc_request K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 09/15] Staging: hv: storvsc: Rename the context field " K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 10/15] Staging: hv: storvsc: Miscellaneous cleanup of storvsc driver K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 11/15] Staging: hv: storvsc: Cleanup the code for generating protocol version K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 12/15] Staging: hv: storvsc: Cleanup some protocol related constants K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 13/15] Staging: hv: storvsc: Get rid of some unused defines K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 14/15] Staging: hv: storvsc: Consolidate the request structure K. Y. Srinivasan
2012-01-12 20:38   ` [PATCH 15/15] Staging: hv: storvsc: Consolidate all the wire protocol definitions K. Y. Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326400688-13544-2-git-send-email-kys@microsoft.com \
    --to=kys@microsoft.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ohering@suse.com \
    --cc=virtualization@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox