Pull sem2mutex-ioc4 into release branch
This commit is contained in:
commit
6a8a8e14be
1 changed files with 18 additions and 23 deletions
|
@ -31,7 +31,7 @@
|
||||||
#include <linux/ioc4.h>
|
#include <linux/ioc4.h>
|
||||||
#include <linux/mmtimer.h>
|
#include <linux/mmtimer.h>
|
||||||
#include <linux/rtc.h>
|
#include <linux/rtc.h>
|
||||||
#include <linux/rwsem.h>
|
#include <linux/mutex.h>
|
||||||
#include <asm/sn/addrs.h>
|
#include <asm/sn/addrs.h>
|
||||||
#include <asm/sn/clksupport.h>
|
#include <asm/sn/clksupport.h>
|
||||||
#include <asm/sn/shub_mmr.h>
|
#include <asm/sn/shub_mmr.h>
|
||||||
|
@ -54,11 +54,10 @@
|
||||||
* Submodule management *
|
* Submodule management *
|
||||||
************************/
|
************************/
|
||||||
|
|
||||||
static LIST_HEAD(ioc4_devices);
|
static DEFINE_MUTEX(ioc4_mutex);
|
||||||
static DECLARE_RWSEM(ioc4_devices_rwsem);
|
|
||||||
|
|
||||||
|
static LIST_HEAD(ioc4_devices);
|
||||||
static LIST_HEAD(ioc4_submodules);
|
static LIST_HEAD(ioc4_submodules);
|
||||||
static DECLARE_RWSEM(ioc4_submodules_rwsem);
|
|
||||||
|
|
||||||
/* Register an IOC4 submodule */
|
/* Register an IOC4 submodule */
|
||||||
int
|
int
|
||||||
|
@ -66,15 +65,13 @@ ioc4_register_submodule(struct ioc4_submodule *is)
|
||||||
{
|
{
|
||||||
struct ioc4_driver_data *idd;
|
struct ioc4_driver_data *idd;
|
||||||
|
|
||||||
down_write(&ioc4_submodules_rwsem);
|
mutex_lock(&ioc4_mutex);
|
||||||
list_add(&is->is_list, &ioc4_submodules);
|
list_add(&is->is_list, &ioc4_submodules);
|
||||||
up_write(&ioc4_submodules_rwsem);
|
|
||||||
|
|
||||||
/* Initialize submodule for each IOC4 */
|
/* Initialize submodule for each IOC4 */
|
||||||
if (!is->is_probe)
|
if (!is->is_probe)
|
||||||
return 0;
|
goto out;
|
||||||
|
|
||||||
down_read(&ioc4_devices_rwsem);
|
|
||||||
list_for_each_entry(idd, &ioc4_devices, idd_list) {
|
list_for_each_entry(idd, &ioc4_devices, idd_list) {
|
||||||
if (is->is_probe(idd)) {
|
if (is->is_probe(idd)) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
|
@ -84,8 +81,8 @@ ioc4_register_submodule(struct ioc4_submodule *is)
|
||||||
pci_name(idd->idd_pdev));
|
pci_name(idd->idd_pdev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up_read(&ioc4_devices_rwsem);
|
out:
|
||||||
|
mutex_unlock(&ioc4_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,15 +92,13 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
|
||||||
{
|
{
|
||||||
struct ioc4_driver_data *idd;
|
struct ioc4_driver_data *idd;
|
||||||
|
|
||||||
down_write(&ioc4_submodules_rwsem);
|
mutex_lock(&ioc4_mutex);
|
||||||
list_del(&is->is_list);
|
list_del(&is->is_list);
|
||||||
up_write(&ioc4_submodules_rwsem);
|
|
||||||
|
|
||||||
/* Remove submodule for each IOC4 */
|
/* Remove submodule for each IOC4 */
|
||||||
if (!is->is_remove)
|
if (!is->is_remove)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
down_read(&ioc4_devices_rwsem);
|
|
||||||
list_for_each_entry(idd, &ioc4_devices, idd_list) {
|
list_for_each_entry(idd, &ioc4_devices, idd_list) {
|
||||||
if (is->is_remove(idd)) {
|
if (is->is_remove(idd)) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
|
@ -113,7 +108,8 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
|
||||||
pci_name(idd->idd_pdev));
|
pci_name(idd->idd_pdev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up_read(&ioc4_devices_rwsem);
|
out:
|
||||||
|
mutex_unlock(&ioc4_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
|
@ -312,12 +308,11 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
|
||||||
/* Track PCI-device specific data */
|
/* Track PCI-device specific data */
|
||||||
idd->idd_serial_data = NULL;
|
idd->idd_serial_data = NULL;
|
||||||
pci_set_drvdata(idd->idd_pdev, idd);
|
pci_set_drvdata(idd->idd_pdev, idd);
|
||||||
down_write(&ioc4_devices_rwsem);
|
|
||||||
|
mutex_lock(&ioc4_mutex);
|
||||||
list_add(&idd->idd_list, &ioc4_devices);
|
list_add(&idd->idd_list, &ioc4_devices);
|
||||||
up_write(&ioc4_devices_rwsem);
|
|
||||||
|
|
||||||
/* Add this IOC4 to all submodules */
|
/* Add this IOC4 to all submodules */
|
||||||
down_read(&ioc4_submodules_rwsem);
|
|
||||||
list_for_each_entry(is, &ioc4_submodules, is_list) {
|
list_for_each_entry(is, &ioc4_submodules, is_list) {
|
||||||
if (is->is_probe && is->is_probe(idd)) {
|
if (is->is_probe && is->is_probe(idd)) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
|
@ -327,7 +322,7 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
|
||||||
pci_name(idd->idd_pdev));
|
pci_name(idd->idd_pdev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up_read(&ioc4_submodules_rwsem);
|
mutex_unlock(&ioc4_mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -351,7 +346,7 @@ ioc4_remove(struct pci_dev *pdev)
|
||||||
idd = pci_get_drvdata(pdev);
|
idd = pci_get_drvdata(pdev);
|
||||||
|
|
||||||
/* Remove this IOC4 from all submodules */
|
/* Remove this IOC4 from all submodules */
|
||||||
down_read(&ioc4_submodules_rwsem);
|
mutex_lock(&ioc4_mutex);
|
||||||
list_for_each_entry(is, &ioc4_submodules, is_list) {
|
list_for_each_entry(is, &ioc4_submodules, is_list) {
|
||||||
if (is->is_remove && is->is_remove(idd)) {
|
if (is->is_remove && is->is_remove(idd)) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
|
@ -361,7 +356,7 @@ ioc4_remove(struct pci_dev *pdev)
|
||||||
pci_name(idd->idd_pdev));
|
pci_name(idd->idd_pdev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up_read(&ioc4_submodules_rwsem);
|
mutex_unlock(&ioc4_mutex);
|
||||||
|
|
||||||
/* Release resources */
|
/* Release resources */
|
||||||
iounmap(idd->idd_misc_regs);
|
iounmap(idd->idd_misc_regs);
|
||||||
|
@ -377,9 +372,9 @@ ioc4_remove(struct pci_dev *pdev)
|
||||||
pci_disable_device(pdev);
|
pci_disable_device(pdev);
|
||||||
|
|
||||||
/* Remove and free driver data */
|
/* Remove and free driver data */
|
||||||
down_write(&ioc4_devices_rwsem);
|
mutex_lock(&ioc4_mutex);
|
||||||
list_del(&idd->idd_list);
|
list_del(&idd->idd_list);
|
||||||
up_write(&ioc4_devices_rwsem);
|
mutex_unlock(&ioc4_mutex);
|
||||||
kfree(idd);
|
kfree(idd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue