mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
[SCSI] ses: add support for enclosure component hot removal
Right at the moment, hot removal of a device within an enclosure does nothing (because the intf_remove only copes with enclosure removal not with component removal). Fix this by adding a function to remove the component. Also needed to fix the prototype of enclosure_remove_device, since we know the device we've removed but not the internal component number Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
163f52b6cf
commit
43d8eb9cfd
3 changed files with 41 additions and 16 deletions
|
@ -332,19 +332,25 @@ EXPORT_SYMBOL_GPL(enclosure_add_device);
|
|||
* Returns zero on success or an error.
|
||||
*
|
||||
*/
|
||||
int enclosure_remove_device(struct enclosure_device *edev, int component)
|
||||
int enclosure_remove_device(struct enclosure_device *edev, struct device *dev)
|
||||
{
|
||||
struct enclosure_component *cdev;
|
||||
int i;
|
||||
|
||||
if (!edev || component >= edev->components)
|
||||
if (!edev || !dev)
|
||||
return -EINVAL;
|
||||
|
||||
cdev = &edev->component[component];
|
||||
|
||||
device_del(&cdev->cdev);
|
||||
put_device(cdev->dev);
|
||||
cdev->dev = NULL;
|
||||
return device_add(&cdev->cdev);
|
||||
for (i = 0; i < edev->components; i++) {
|
||||
cdev = &edev->component[i];
|
||||
if (cdev->dev == dev) {
|
||||
enclosure_remove_links(cdev);
|
||||
device_del(&cdev->cdev);
|
||||
put_device(dev);
|
||||
cdev->dev = NULL;
|
||||
return device_add(&cdev->cdev);
|
||||
}
|
||||
}
|
||||
return -ENODEV;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(enclosure_remove_device);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue