Commit 7a173f0f authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] scsi_remove_device simplifications

 - change return value to void, returning errors from unregister
   doesn't make lots of sense
 - rename scsi_device_unregister to scsi_remove_device to kill
   a superflous level of layering
parent 3a2b9514
...@@ -992,8 +992,9 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id) ...@@ -992,8 +992,9 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
sbp2scsi_complete_all_commands(scsi_id, DID_NO_CONNECT); sbp2scsi_complete_all_commands(scsi_id, DID_NO_CONNECT);
/* Remove it from the scsi layer now */ /* Remove it from the scsi layer now */
if (sdev && scsi_remove_device(sdev)) if (sdev) {
SBP2_ERR("scsi_remove_device failed"); scsi_remove_device(sdev);
}
sbp2util_remove_command_orb_pool(scsi_id); sbp2util_remove_command_orb_pool(scsi_id);
......
...@@ -109,7 +109,6 @@ extern void scsi_rescan_device(struct device *); ...@@ -109,7 +109,6 @@ extern void scsi_rescan_device(struct device *);
/* scsi_sysfs.c */ /* scsi_sysfs.c */
extern int scsi_device_register(struct scsi_device *); extern int scsi_device_register(struct scsi_device *);
extern void scsi_device_unregister(struct scsi_device *);
extern void scsi_sysfs_init_host(struct Scsi_Host *); extern void scsi_sysfs_init_host(struct Scsi_Host *);
extern int scsi_sysfs_add_host(struct Scsi_Host *, struct device *); extern int scsi_sysfs_add_host(struct Scsi_Host *, struct device *);
extern void scsi_sysfs_remove_host(struct Scsi_Host *); extern void scsi_sysfs_remove_host(struct Scsi_Host *);
......
...@@ -208,7 +208,8 @@ static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun) ...@@ -208,7 +208,8 @@ static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
if (sdev->access_count) if (sdev->access_count)
goto out; goto out;
error = scsi_remove_device(sdev); scsi_remove_device(sdev);
error = 0;
out: out:
scsi_host_put(shost); scsi_host_put(shost);
return error; return error;
......
...@@ -1074,12 +1074,6 @@ struct scsi_device *scsi_add_device(struct Scsi_Host *shost, ...@@ -1074,12 +1074,6 @@ struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
return sdev; return sdev;
} }
int scsi_remove_device(struct scsi_device *sdev)
{
scsi_device_unregister(sdev);
return 0;
}
void scsi_rescan_device(struct device *dev) void scsi_rescan_device(struct device *dev)
{ {
struct scsi_driver *drv = to_scsi_driver(dev->driver); struct scsi_driver *drv = to_scsi_driver(dev->driver);
......
...@@ -305,7 +305,7 @@ int scsi_device_register(struct scsi_device *sdev) ...@@ -305,7 +305,7 @@ int scsi_device_register(struct scsi_device *sdev)
error = attr_add(&sdev->sdev_gendev, error = attr_add(&sdev->sdev_gendev,
sdev->host->hostt->sdev_attrs[i]); sdev->host->hostt->sdev_attrs[i]);
if (error) if (error)
scsi_device_unregister(sdev); scsi_remove_device(sdev);
} }
} }
...@@ -315,7 +315,7 @@ int scsi_device_register(struct scsi_device *sdev) ...@@ -315,7 +315,7 @@ int scsi_device_register(struct scsi_device *sdev)
error = device_create_file(&sdev->sdev_gendev, error = device_create_file(&sdev->sdev_gendev,
scsi_sysfs_sdev_attrs[i]); scsi_sysfs_sdev_attrs[i]);
if (error) if (error)
scsi_device_unregister(sdev); scsi_remove_device(sdev);
} }
} }
...@@ -323,10 +323,10 @@ int scsi_device_register(struct scsi_device *sdev) ...@@ -323,10 +323,10 @@ int scsi_device_register(struct scsi_device *sdev)
} }
/** /**
* scsi_device_unregister - unregister a device from the scsi bus * scsi_remove_device - unregister a device from the scsi bus
* @sdev: scsi_device to unregister * @sdev: scsi_device to unregister
**/ **/
void scsi_device_unregister(struct scsi_device *sdev) void scsi_remove_device(struct scsi_device *sdev)
{ {
class_device_unregister(&sdev->sdev_classdev); class_device_unregister(&sdev->sdev_classdev);
device_unregister(&sdev->sdev_gendev); device_unregister(&sdev->sdev_gendev);
......
...@@ -92,7 +92,7 @@ struct scsi_device { ...@@ -92,7 +92,7 @@ struct scsi_device {
extern struct scsi_device *scsi_add_device(struct Scsi_Host *, extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
uint, uint, uint); uint, uint, uint);
extern int scsi_remove_device(struct scsi_device *); extern void scsi_remove_device(struct scsi_device *);
extern void scsi_set_device_offline(struct scsi_device *); extern void scsi_set_device_offline(struct scsi_device *);
extern int scsi_device_get(struct scsi_device *); extern int scsi_device_get(struct scsi_device *);
......
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