|
@@ -650,35 +650,14 @@ static bool clariion_match(struct scsi_device *sdev)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-static int clariion_bus_attach(struct scsi_device *sdev);
|
|
|
-static void clariion_bus_detach(struct scsi_device *sdev);
|
|
|
-
|
|
|
-static struct scsi_device_handler clariion_dh = {
|
|
|
- .name = CLARIION_NAME,
|
|
|
- .module = THIS_MODULE,
|
|
|
- .attach = clariion_bus_attach,
|
|
|
- .detach = clariion_bus_detach,
|
|
|
- .check_sense = clariion_check_sense,
|
|
|
- .activate = clariion_activate,
|
|
|
- .prep_fn = clariion_prep_fn,
|
|
|
- .set_params = clariion_set_params,
|
|
|
- .match = clariion_match,
|
|
|
-};
|
|
|
-
|
|
|
-static int clariion_bus_attach(struct scsi_device *sdev)
|
|
|
+static struct scsi_dh_data *clariion_bus_attach(struct scsi_device *sdev)
|
|
|
{
|
|
|
struct clariion_dh_data *h;
|
|
|
- unsigned long flags;
|
|
|
int err;
|
|
|
|
|
|
h = kzalloc(sizeof(*h) , GFP_KERNEL);
|
|
|
- if (!h) {
|
|
|
- sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
|
|
|
- CLARIION_NAME);
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
-
|
|
|
- h->dh_data.scsi_dh = &clariion_dh;
|
|
|
+ if (!h)
|
|
|
+ return ERR_PTR(-ENOMEM);
|
|
|
h->lun_state = CLARIION_LUN_UNINITIALIZED;
|
|
|
h->default_sp = CLARIION_UNBOUND_LU;
|
|
|
h->current_sp = CLARIION_UNBOUND_LU;
|
|
@@ -691,40 +670,37 @@ static int clariion_bus_attach(struct scsi_device *sdev)
|
|
|
if (err != SCSI_DH_OK)
|
|
|
goto failed;
|
|
|
|
|
|
- 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_INFO, sdev,
|
|
|
"%s: connected to SP %c Port %d (%s, default SP %c)\n",
|
|
|
CLARIION_NAME, h->current_sp + 'A',
|
|
|
h->port, lun_state[h->lun_state],
|
|
|
h->default_sp + 'A');
|
|
|
-
|
|
|
- return 0;
|
|
|
+ return &h->dh_data;
|
|
|
|
|
|
failed:
|
|
|
kfree(h);
|
|
|
- sdev_printk(KERN_ERR, sdev, "%s: not attached\n",
|
|
|
- CLARIION_NAME);
|
|
|
- return -EINVAL;
|
|
|
+ return ERR_PTR(-EINVAL);
|
|
|
}
|
|
|
|
|
|
static void clariion_bus_detach(struct scsi_device *sdev)
|
|
|
{
|
|
|
struct clariion_dh_data *h = get_clariion_data(sdev);
|
|
|
- unsigned long flags;
|
|
|
-
|
|
|
- spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
|
|
- sdev->scsi_dh_data = NULL;
|
|
|
- spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
|
|
-
|
|
|
- sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n",
|
|
|
- CLARIION_NAME);
|
|
|
|
|
|
kfree(h);
|
|
|
}
|
|
|
|
|
|
+static struct scsi_device_handler clariion_dh = {
|
|
|
+ .name = CLARIION_NAME,
|
|
|
+ .module = THIS_MODULE,
|
|
|
+ .attach = clariion_bus_attach,
|
|
|
+ .detach = clariion_bus_detach,
|
|
|
+ .check_sense = clariion_check_sense,
|
|
|
+ .activate = clariion_activate,
|
|
|
+ .prep_fn = clariion_prep_fn,
|
|
|
+ .set_params = clariion_set_params,
|
|
|
+ .match = clariion_match,
|
|
|
+};
|
|
|
+
|
|
|
static int __init clariion_init(void)
|
|
|
{
|
|
|
int r;
|