[PATCH] scsi-misc-2.5 fold scsi_alloc_cmd into __scsi_get_command

Patrick Mansfield
2003-04-24T16:55:16Z

Patch against scsi-misc-2.5

scsi_alloc_cmd is real simple now, just fold it into __scsi_get_command.

diff -purN -X /home/patman/dontdiff rmhost_flock-2.5-cur/drivers/scsi/scsi.c rmsacmd-2.5-cur/drivers/scsi/scsi.c
--- rmhost_flock-2.5-cur/drivers/scsi/scsi.c Thu Apr 24 09:14:47 2003
+++ rmsacmd-2.5-cur/drivers/scsi/scsi.c Thu Apr 24 09:15:07 2003
@@ -254,23 +254,6 @@ static struct scsi_host_cmd_pool scsi_cm

static DECLARE_MUTEX(host_cmd_pool_mutex);

-static struct scsi_cmnd *scsi_alloc_cmd(struct scsi_device *sdev,
- int gfp_mask)
-{
- struct scsi_cmnd *cmd;
-
- /*
- * Use any spare command first.
- */
- cmd = sdev->spare_cmd;
- if (cmd != NULL)
- sdev->spare_cmd = NULL;
- else
- cmd = kmem_cache_alloc(sdev->host->cmd_pool->slab,
- gfp_mask | sdev->host->cmd_pool->gfp_mask);
- return cmd;
-}
-
/*
* Function: __scsi_get_command()
*
@@ -286,7 +269,17 @@ static struct scsi_cmnd *scsi_alloc_cmd(
*/
struct scsi_cmnd *__scsi_get_command(struct scsi_device *dev, int gfp_mask)
{
- struct scsi_cmnd *cmd = scsi_alloc_cmd(dev, gfp_mask);
+ struct scsi_cmnd *cmd;
+
+ /*
+ * Use any spare command first.
+ */
+ cmd = dev->spare_cmd;
+ if (cmd != NULL)
+ dev->spare_cmd = NULL;
+ else
+ cmd = kmem_cache_alloc(dev->host->cmd_pool->slab,
+ gfp_mask | dev->host->cmd_pool->gfp_mask);

if (likely(cmd != NULL)) {
memset(cmd, 0, sizeof(*cmd));