From: "K. Y. Srinivasan" <kys@microsoft.com>
To: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>
Subject: [PATCH 09/20] Staging: hv: storvsc: Get rid of storvsc_dev_add() by inlining the code
Date: Tue, 13 Sep 2011 10:59:45 -0700 [thread overview]
Message-ID: <1315936796-20662-9-git-send-email-kys@microsoft.com> (raw)
In-Reply-To: <1315936796-20662-1-git-send-email-kys@microsoft.com>
Get rid of storvsc_dev_add() by inlining the code.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
drivers/staging/hv/storvsc_drv.c | 58 +++++++++----------------------------
1 files changed, 14 insertions(+), 44 deletions(-)
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index b996293..2210c8c 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -651,41 +651,6 @@ static int storvsc_connect_to_vsp(struct hv_device *device, u32 ring_size)
return ret;
}
-static int storvsc_dev_add(struct hv_device *device,
- void *additional_info)
-{
- struct storvsc_device *stor_device;
- struct storvsc_device_info *device_info;
- int ret = 0;
-
- device_info = (struct storvsc_device_info *)additional_info;
- stor_device = alloc_stor_device(device);
- if (!stor_device)
- return -ENOMEM;
-
- /* Save the channel properties to our storvsc channel */
-
- /*
- * If we support more than 1 scsi channel, we need to set the
- * port number here to the scsi channel but how do we get the
- * scsi channel prior to the bus scan.
- *
- * The host does not support this.
- */
-
- stor_device->port_number = device_info->port_number;
- /* Send it back up */
- ret = storvsc_connect_to_vsp(device, device_info->ring_buffer_size);
- if (ret) {
- kfree(stor_device);
- return ret;
- }
- device_info->path_id = stor_device->path_id;
- device_info->target_id = stor_device->target_id;
-
- return ret;
-}
-
static int storvsc_dev_remove(struct hv_device *device)
{
struct storvsc_device *stor_device;
@@ -1389,10 +1354,10 @@ static int storvsc_probe(struct hv_device *device,
int ret;
struct Scsi_Host *host;
struct hv_host_device *host_dev;
- struct storvsc_device_info device_info;
bool dev_is_ide = ((dev_id->driver_data == IDE_GUID) ? true : false);
int path = 0;
int target = 0;
+ struct storvsc_device *stor_device;
host = scsi_host_alloc(&scsi_driver,
sizeof(struct hv_host_device));
@@ -1417,22 +1382,27 @@ static int storvsc_probe(struct hv_device *device,
return -ENOMEM;
}
- device_info.port_number = host->host_no;
- device_info.ring_buffer_size = storvsc_ringbuffer_size;
- /* Call to the vsc driver to add the device */
- ret = storvsc_dev_add(device, (void *)&device_info);
+ stor_device = alloc_stor_device(device);
+ if (!stor_device) {
+ kmem_cache_destroy(host_dev->request_pool);
+ scsi_host_put(host);
+ return -ENOMEM;
+ }
- if (ret != 0) {
+ stor_device->port_number = host->host_no;
+ ret = storvsc_connect_to_vsp(device, storvsc_ringbuffer_size);
+ if (ret) {
kmem_cache_destroy(host_dev->request_pool);
scsi_host_put(host);
- return -ENODEV;
+ kfree(stor_device);
+ return ret;
}
if (dev_is_ide)
storvsc_get_ide_info(device, &target, &path);
- host_dev->path = device_info.path_id;
- host_dev->target = device_info.target_id;
+ host_dev->path = stor_device->path_id;
+ host_dev->target = stor_device->target_id;
/* max # of devices per target */
host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
--
1.7.4.1
next prev parent reply other threads:[~2011-09-13 17:39 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-13 17:59 [PATCH 0000/0020] Staging: hv: Driver cleanup K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 01/20] Staging: hv: vmbus: Introduce a utility function to match hv_vmbus_device_id K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 02/20] Staging: hv: vmbus: Change the signature of struct hv_driver probe function K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 03/20] Staging: hv: storvsc: Use the driver_data to identify ide K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 04/20] Staging: hv: vmbus: Introduce functions for setting and getting driver data K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 05/20] Staging: hv: util: Perform some service specific init/deinit in probe/remove K. Y. Srinivasan
2011-09-16 18:01 ` Greg KH
2011-09-13 17:59 ` [PATCH 06/20] Staging: hv: util: Properly handle util services in the util driver K. Y. Srinivasan
2011-09-15 20:08 ` Dan Carpenter
2011-09-15 20:24 ` KY Srinivasan
2011-09-16 18:03 ` Greg KH
2011-09-17 13:26 ` KY Srinivasan
2011-09-13 17:59 ` [PATCH 07/20] Staging: hv: vmbus: Get rid of hv_cb_utils[] and other unneeded code K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 08/20] Staging: hv: vmbus: Cleanup vmbus_remove() K. Y. Srinivasan
2011-09-13 17:59 ` K. Y. Srinivasan [this message]
2011-09-13 18:39 ` [PATCH 09/20] Staging: hv: storvsc: Get rid of storvsc_dev_add() by inlining the code Christoph Hellwig
2011-09-13 18:52 ` KY Srinivasan
2011-09-13 17:59 ` [PATCH 10/20] Staging: hv: storvsc: Get rid of alloc_stor_device() " K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 11/20] Staging: hv: storvsc: Get rid of some unnecessary state and definitions K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 12/20] Staging: hv: storvsc: Eliminate the usage of ext field in struct hv_device K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 13/20] Staging: hv: netvsc: Get rid of the usage of the " K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 14/20] Staging: hv: mousevsc: " K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 15/20] Staging: hv: vmbus: Get rid " K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 16/20] Staging: hv: vmbus: Do not allocate struct hv_device_info on the stack K. Y. Srinivasan
2011-09-13 18:41 ` Christoph Hellwig
2011-09-13 17:59 ` [PATCH 17/20] Staging: hv: vmbus: Get rid of the module dependency K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 18/20] Staging: hv: netvsc: Rename netDevice as net_device K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 19/20] Staging: hv: netvsc: Rename rndisDevice to rndis_device K. Y. Srinivasan
2011-09-13 17:59 ` [PATCH 20/20] Staging: hv: netvsc: Rename deviceInfo as device_info K. Y. Srinivasan
2011-09-13 18:10 ` Joe Perches
2011-09-13 18:15 ` KY Srinivasan
2011-09-16 18:07 ` [PATCH 0000/0020] Staging: hv: Driver cleanup Greg KH
2011-09-17 13:26 ` KY 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=1315936796-20662-9-git-send-email-kys@microsoft.com \
--to=kys@microsoft.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@suse.de \
--cc=haiyangz@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--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