Commit 1e1bb2a4 authored by Stephen M. Cameron's avatar Stephen M. Cameron Committed by james toy

Use shost_priv instead of accessing host->hostdata[0] directly.

Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Mike Miller <mikem@beardog.cce.hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3fdc0c94
......@@ -177,6 +177,12 @@ static struct scsi_host_template hpsa_driver_template = {
.sdev_attrs = hpsa_sdev_attrs,
};
static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
{
unsigned long *priv = shost_priv(sdev->host);
return (struct ctlr_info *) *priv;
}
/* Enqueuing and dequeuing functions for cmdlists. */
static inline void addQ(struct hlist_head *list, struct CommandList *c)
{
......@@ -227,7 +233,7 @@ static ssize_t raid_level_show(struct device *dev,
unsigned long flags;
sdev = to_scsi_device(dev);
h = (struct ctlr_info *) sdev->host->hostdata[0];
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->lock, flags);
hdev = sdev->hostdata;
if (!hdev) {
......@@ -260,7 +266,7 @@ static ssize_t lunid_show(struct device *dev,
unsigned char lunid[8];
sdev = to_scsi_device(dev);
h = (struct ctlr_info *) sdev->host->hostdata[0];
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->lock, flags);
hdev = sdev->hostdata;
if (!hdev) {
......@@ -284,7 +290,7 @@ static ssize_t unique_id_show(struct device *dev,
unsigned char sn[16];
sdev = to_scsi_device(dev);
h = (struct ctlr_info *) sdev->host->hostdata[0];
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->lock, flags);
hdev = sdev->hostdata;
if (!hdev) {
......@@ -677,7 +683,7 @@ static int hpsa_slave_alloc(struct scsi_device *sdev)
unsigned long flags;
struct ctlr_info *h;
h = (struct ctlr_info *) sdev->host->hostdata[0];
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->devlock, flags);
sd = lookup_hpsa_scsi_dev(h, sdev_channel(sdev),
sdev_id(sdev), sdev->lun);
......@@ -1615,7 +1621,7 @@ static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd,
unsigned long flags;
/* Get the ptr to our adapter structure out of cmd->host. */
h = (struct ctlr_info *) cmd->device->host->hostdata[0];
h = sdev_to_hba(cmd->device);
dev = cmd->device->hostdata;
if (!dev) {
cmd->result = DID_NO_CONNECT << 16;
......@@ -1795,7 +1801,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
struct hpsa_scsi_dev_t *dev;
/* find the controller to which the command to be aborted was sent */
h = (struct ctlr_info *) scsicmd->device->host->hostdata[0];
h = sdev_to_hba(scsicmd->device);
if (h == NULL) /* paranoia */
return FAILED;
dev_warn(&h->pdev->dev, "resetting drive\n");
......@@ -2325,7 +2331,7 @@ static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg)
struct ctlr_info *h;
void __user *argp = (void __user *)arg;
h = (struct ctlr_info *) dev->host->hostdata[0];
h = sdev_to_hba(dev);
switch (cmd) {
case CCISS_DEREGDISK:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment