|
@@ -827,36 +827,16 @@ static bool rdac_match(struct scsi_device *sdev)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
-static int rdac_bus_attach(struct scsi_device *sdev);
|
|
|
|
-static void rdac_bus_detach(struct scsi_device *sdev);
|
|
|
|
-
|
|
|
|
-static struct scsi_device_handler rdac_dh = {
|
|
|
|
- .name = RDAC_NAME,
|
|
|
|
- .module = THIS_MODULE,
|
|
|
|
- .prep_fn = rdac_prep_fn,
|
|
|
|
- .check_sense = rdac_check_sense,
|
|
|
|
- .attach = rdac_bus_attach,
|
|
|
|
- .detach = rdac_bus_detach,
|
|
|
|
- .activate = rdac_activate,
|
|
|
|
- .match = rdac_match,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static int rdac_bus_attach(struct scsi_device *sdev)
|
|
|
|
|
|
+static struct scsi_dh_data *rdac_bus_attach(struct scsi_device *sdev)
|
|
{
|
|
{
|
|
struct rdac_dh_data *h;
|
|
struct rdac_dh_data *h;
|
|
- unsigned long flags;
|
|
|
|
int err;
|
|
int err;
|
|
char array_name[ARRAY_LABEL_LEN];
|
|
char array_name[ARRAY_LABEL_LEN];
|
|
char array_id[UNIQUE_ID_LEN];
|
|
char array_id[UNIQUE_ID_LEN];
|
|
|
|
|
|
h = kzalloc(sizeof(*h) , GFP_KERNEL);
|
|
h = kzalloc(sizeof(*h) , GFP_KERNEL);
|
|
- if (!h) {
|
|
|
|
- sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
|
|
|
|
- RDAC_NAME);
|
|
|
|
- return -ENOMEM;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- h->dh_data.scsi_dh = &rdac_dh;
|
|
|
|
|
|
+ if (!h)
|
|
|
|
+ return ERR_PTR(-ENOMEM);
|
|
h->lun = UNINITIALIZED_LUN;
|
|
h->lun = UNINITIALIZED_LUN;
|
|
h->state = RDAC_STATE_ACTIVE;
|
|
h->state = RDAC_STATE_ACTIVE;
|
|
|
|
|
|
@@ -876,16 +856,12 @@ static int rdac_bus_attach(struct scsi_device *sdev)
|
|
if (err != SCSI_DH_OK)
|
|
if (err != SCSI_DH_OK)
|
|
goto clean_ctlr;
|
|
goto clean_ctlr;
|
|
|
|
|
|
- spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
|
|
|
- sdev->scsi_dh_data = &h->dh_data;
|
|
|
|
- spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
|
|
|
-
|
|
|
|
sdev_printk(KERN_NOTICE, sdev,
|
|
sdev_printk(KERN_NOTICE, sdev,
|
|
"%s: LUN %d (%s) (%s)\n",
|
|
"%s: LUN %d (%s) (%s)\n",
|
|
RDAC_NAME, h->lun, mode[(int)h->mode],
|
|
RDAC_NAME, h->lun, mode[(int)h->mode],
|
|
lun_state[(int)h->lun_state]);
|
|
lun_state[(int)h->lun_state]);
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
+ return &h->dh_data;
|
|
|
|
|
|
clean_ctlr:
|
|
clean_ctlr:
|
|
spin_lock(&list_lock);
|
|
spin_lock(&list_lock);
|
|
@@ -894,32 +870,33 @@ clean_ctlr:
|
|
|
|
|
|
failed:
|
|
failed:
|
|
kfree(h);
|
|
kfree(h);
|
|
- sdev_printk(KERN_ERR, sdev, "%s: not attached\n",
|
|
|
|
- RDAC_NAME);
|
|
|
|
- return -EINVAL;
|
|
|
|
|
|
+ return ERR_PTR(-EINVAL);
|
|
}
|
|
}
|
|
|
|
|
|
static void rdac_bus_detach( struct scsi_device *sdev )
|
|
static void rdac_bus_detach( struct scsi_device *sdev )
|
|
{
|
|
{
|
|
struct rdac_dh_data *h = get_rdac_data(sdev);
|
|
struct rdac_dh_data *h = get_rdac_data(sdev);
|
|
- unsigned long flags;
|
|
|
|
|
|
|
|
if (h->ctlr && h->ctlr->ms_queued)
|
|
if (h->ctlr && h->ctlr->ms_queued)
|
|
flush_workqueue(kmpath_rdacd);
|
|
flush_workqueue(kmpath_rdacd);
|
|
|
|
|
|
- spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
|
|
|
- sdev->scsi_dh_data = NULL;
|
|
|
|
- spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
|
|
|
-
|
|
|
|
spin_lock(&list_lock);
|
|
spin_lock(&list_lock);
|
|
if (h->ctlr)
|
|
if (h->ctlr)
|
|
kref_put(&h->ctlr->kref, release_controller);
|
|
kref_put(&h->ctlr->kref, release_controller);
|
|
spin_unlock(&list_lock);
|
|
spin_unlock(&list_lock);
|
|
kfree(h);
|
|
kfree(h);
|
|
- sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+static struct scsi_device_handler rdac_dh = {
|
|
|
|
+ .name = RDAC_NAME,
|
|
|
|
+ .module = THIS_MODULE,
|
|
|
|
+ .prep_fn = rdac_prep_fn,
|
|
|
|
+ .check_sense = rdac_check_sense,
|
|
|
|
+ .attach = rdac_bus_attach,
|
|
|
|
+ .detach = rdac_bus_detach,
|
|
|
|
+ .activate = rdac_activate,
|
|
|
|
+ .match = rdac_match,
|
|
|
|
+};
|
|
|
|
|
|
static int __init rdac_init(void)
|
|
static int __init rdac_init(void)
|
|
{
|
|
{
|