mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
staging: gasket: core: factor out generic device remove code from PCI
Separate code for generic parts of gasket device removal sequence from the PCI device removal code, in prep for non-PCI devices later. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9c34e95c6f
commit
1fb5e1c92e
1 changed files with 10 additions and 10 deletions
|
@ -1461,6 +1461,14 @@ static int __gasket_add_device(struct device *parent_dev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __gasket_remove_device(struct gasket_internal_desc *internal_desc,
|
||||||
|
struct gasket_dev *gasket_dev)
|
||||||
|
{
|
||||||
|
gasket_sysfs_remove_mapping(gasket_dev->dev_info.device);
|
||||||
|
device_destroy(internal_desc->class, gasket_dev->dev_info.devt);
|
||||||
|
gasket_free_dev(gasket_dev);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add PCI gasket device.
|
* Add PCI gasket device.
|
||||||
*
|
*
|
||||||
|
@ -1515,9 +1523,7 @@ int gasket_pci_add_device(struct pci_dev *pci_dev,
|
||||||
|
|
||||||
cleanup_pci:
|
cleanup_pci:
|
||||||
gasket_cleanup_pci(gasket_dev);
|
gasket_cleanup_pci(gasket_dev);
|
||||||
gasket_sysfs_remove_mapping(gasket_dev->dev_info.device);
|
__gasket_remove_device(internal_desc, gasket_dev);
|
||||||
device_destroy(internal_desc->class, gasket_dev->dev_info.devt);
|
|
||||||
gasket_free_dev(gasket_dev);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(gasket_pci_add_device);
|
EXPORT_SYMBOL(gasket_pci_add_device);
|
||||||
|
@ -1528,7 +1534,6 @@ void gasket_pci_remove_device(struct pci_dev *pci_dev)
|
||||||
int i;
|
int i;
|
||||||
struct gasket_internal_desc *internal_desc;
|
struct gasket_internal_desc *internal_desc;
|
||||||
struct gasket_dev *gasket_dev = NULL;
|
struct gasket_dev *gasket_dev = NULL;
|
||||||
const struct gasket_driver_desc *driver_desc;
|
|
||||||
/* Find the device desc. */
|
/* Find the device desc. */
|
||||||
mutex_lock(&g_mutex);
|
mutex_lock(&g_mutex);
|
||||||
internal_desc = lookup_internal_desc(pci_dev);
|
internal_desc = lookup_internal_desc(pci_dev);
|
||||||
|
@ -1538,8 +1543,6 @@ void gasket_pci_remove_device(struct pci_dev *pci_dev)
|
||||||
}
|
}
|
||||||
mutex_unlock(&g_mutex);
|
mutex_unlock(&g_mutex);
|
||||||
|
|
||||||
driver_desc = internal_desc->driver_desc;
|
|
||||||
|
|
||||||
/* Now find the specific device */
|
/* Now find the specific device */
|
||||||
mutex_lock(&internal_desc->mutex);
|
mutex_lock(&internal_desc->mutex);
|
||||||
for (i = 0; i < GASKET_DEV_MAX; i++) {
|
for (i = 0; i < GASKET_DEV_MAX; i++) {
|
||||||
|
@ -1558,10 +1561,7 @@ void gasket_pci_remove_device(struct pci_dev *pci_dev)
|
||||||
internal_desc->driver_desc->name);
|
internal_desc->driver_desc->name);
|
||||||
|
|
||||||
gasket_cleanup_pci(gasket_dev);
|
gasket_cleanup_pci(gasket_dev);
|
||||||
|
__gasket_remove_device(internal_desc, gasket_dev);
|
||||||
gasket_sysfs_remove_mapping(gasket_dev->dev_info.device);
|
|
||||||
device_destroy(internal_desc->class, gasket_dev->dev_info.devt);
|
|
||||||
gasket_free_dev(gasket_dev);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(gasket_pci_remove_device);
|
EXPORT_SYMBOL(gasket_pci_remove_device);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue