diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2013-01-31 13:55:17 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-02-14 09:55:17 -0500 |
commit | 53923354d69e4748506bfee932b7c6b309a15c21 (patch) | |
tree | 3d6e2d0fac4f26f53cbff549ad31b0032006c99d /arch/s390/pci | |
parent | add09d61fee72d7a346051332b6d99f18989504c (diff) |
s390/pci: fix hotplug module init
Loading the pci hotplug module when no devices are present will fail
but unfortunately some hotplug callbacks stay registered to the pci
bus level. Fix this by not letting module loading fail when no pci
devices are present and provide proper {de}registration functions
for these callbacks.
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/pci')
-rw-r--r-- | arch/s390/pci/pci.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index aa74409db656..27b4c17855b9 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -51,8 +51,7 @@ EXPORT_SYMBOL_GPL(zpci_list); | |||
51 | DEFINE_MUTEX(zpci_list_lock); | 51 | DEFINE_MUTEX(zpci_list_lock); |
52 | EXPORT_SYMBOL_GPL(zpci_list_lock); | 52 | EXPORT_SYMBOL_GPL(zpci_list_lock); |
53 | 53 | ||
54 | struct pci_hp_callback_ops hotplug_ops; | 54 | static struct pci_hp_callback_ops *hotplug_ops; |
55 | EXPORT_SYMBOL_GPL(hotplug_ops); | ||
56 | 55 | ||
57 | static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES); | 56 | static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES); |
58 | static DEFINE_SPINLOCK(zpci_domain_lock); | 57 | static DEFINE_SPINLOCK(zpci_domain_lock); |
@@ -974,8 +973,8 @@ int zpci_create_device(struct zpci_dev *zdev) | |||
974 | 973 | ||
975 | mutex_lock(&zpci_list_lock); | 974 | mutex_lock(&zpci_list_lock); |
976 | list_add_tail(&zdev->entry, &zpci_list); | 975 | list_add_tail(&zdev->entry, &zpci_list); |
977 | if (hotplug_ops.create_slot) | 976 | if (hotplug_ops) |
978 | hotplug_ops.create_slot(zdev); | 977 | hotplug_ops->create_slot(zdev); |
979 | mutex_unlock(&zpci_list_lock); | 978 | mutex_unlock(&zpci_list_lock); |
980 | 979 | ||
981 | if (zdev->state == ZPCI_FN_STATE_STANDBY) | 980 | if (zdev->state == ZPCI_FN_STATE_STANDBY) |
@@ -989,8 +988,8 @@ int zpci_create_device(struct zpci_dev *zdev) | |||
989 | out_start: | 988 | out_start: |
990 | mutex_lock(&zpci_list_lock); | 989 | mutex_lock(&zpci_list_lock); |
991 | list_del(&zdev->entry); | 990 | list_del(&zdev->entry); |
992 | if (hotplug_ops.remove_slot) | 991 | if (hotplug_ops) |
993 | hotplug_ops.remove_slot(zdev); | 992 | hotplug_ops->remove_slot(zdev); |
994 | mutex_unlock(&zpci_list_lock); | 993 | mutex_unlock(&zpci_list_lock); |
995 | out_bus: | 994 | out_bus: |
996 | zpci_free_domain(zdev); | 995 | zpci_free_domain(zdev); |
@@ -1072,6 +1071,22 @@ static void zpci_mem_exit(void) | |||
1072 | kmem_cache_destroy(zdev_fmb_cache); | 1071 | kmem_cache_destroy(zdev_fmb_cache); |
1073 | } | 1072 | } |
1074 | 1073 | ||
1074 | void zpci_register_hp_ops(struct pci_hp_callback_ops *ops) | ||
1075 | { | ||
1076 | mutex_lock(&zpci_list_lock); | ||
1077 | hotplug_ops = ops; | ||
1078 | mutex_unlock(&zpci_list_lock); | ||
1079 | } | ||
1080 | EXPORT_SYMBOL_GPL(zpci_register_hp_ops); | ||
1081 | |||
1082 | void zpci_deregister_hp_ops(void) | ||
1083 | { | ||
1084 | mutex_lock(&zpci_list_lock); | ||
1085 | hotplug_ops = NULL; | ||
1086 | mutex_unlock(&zpci_list_lock); | ||
1087 | } | ||
1088 | EXPORT_SYMBOL_GPL(zpci_deregister_hp_ops); | ||
1089 | |||
1075 | unsigned int s390_pci_probe = 1; | 1090 | unsigned int s390_pci_probe = 1; |
1076 | EXPORT_SYMBOL_GPL(s390_pci_probe); | 1091 | EXPORT_SYMBOL_GPL(s390_pci_probe); |
1077 | 1092 | ||