aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2013-08-29 13:33:16 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-08-30 02:57:07 -0400
commit67f43f38eeb34da43b624a29d57b703f4c4844b4 (patch)
treef38156d87f7bce9e1b32cb8214de0d24447e2dd6
parent0944fe3f4a323f436180d39402cae7f9c46ead17 (diff)
s390/pci/hotplug: convert to be builtin only
Convert s390' pci hotplug to be builtin only, with no module option. Suggested-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/pci.h24
-rw-r--r--arch/s390/pci/pci.c34
-rw-r--r--drivers/pci/hotplug/Kconfig2
-rw-r--r--drivers/pci/hotplug/s390_pci_hpc.c61
4 files changed, 20 insertions, 101 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index d0872769d44e..64081f85ffdb 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -116,11 +116,6 @@ struct zpci_dev {
116 struct dentry *debugfs_perf; 116 struct dentry *debugfs_perf;
117}; 117};
118 118
119struct pci_hp_callback_ops {
120 int (*create_slot) (struct zpci_dev *zdev);
121 void (*remove_slot) (struct zpci_dev *zdev);
122};
123
124static inline bool zdev_enabled(struct zpci_dev *zdev) 119static inline bool zdev_enabled(struct zpci_dev *zdev)
125{ 120{
126 return (zdev->fh & (1UL << 31)) ? true : false; 121 return (zdev->fh & (1UL << 31)) ? true : false;
@@ -154,6 +149,17 @@ static inline void zpci_event_error(void *e) {}
154static inline void zpci_event_availability(void *e) {} 149static inline void zpci_event_availability(void *e) {}
155#endif /* CONFIG_PCI */ 150#endif /* CONFIG_PCI */
156 151
152#ifdef CONFIG_HOTPLUG_PCI_S390
153int zpci_init_slot(struct zpci_dev *);
154void zpci_exit_slot(struct zpci_dev *);
155#else /* CONFIG_HOTPLUG_PCI_S390 */
156static inline int zpci_init_slot(struct zpci_dev *zdev)
157{
158 return 0;
159}
160static inline void zpci_exit_slot(struct zpci_dev *zdev) {}
161#endif /* CONFIG_HOTPLUG_PCI_S390 */
162
157/* Helpers */ 163/* Helpers */
158struct zpci_dev *get_zdev(struct pci_dev *); 164struct zpci_dev *get_zdev(struct pci_dev *);
159struct zpci_dev *get_zdev_by_fid(u32); 165struct zpci_dev *get_zdev_by_fid(u32);
@@ -167,14 +173,6 @@ void zpci_sysfs_remove_device(struct device *);
167int zpci_dma_init(void); 173int zpci_dma_init(void);
168void zpci_dma_exit(void); 174void zpci_dma_exit(void);
169 175
170/* Hotplug */
171extern struct mutex zpci_list_lock;
172extern struct list_head zpci_list;
173extern unsigned int s390_pci_probe;
174
175void zpci_register_hp_ops(struct pci_hp_callback_ops *);
176void zpci_deregister_hp_ops(void);
177
178/* FMB */ 176/* FMB */
179int zpci_fmb_enable_device(struct zpci_dev *); 177int zpci_fmb_enable_device(struct zpci_dev *);
180int zpci_fmb_disable_device(struct zpci_dev *); 178int zpci_fmb_disable_device(struct zpci_dev *);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index d65dc4f50e2a..56f8a1c4d9bf 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -45,11 +45,8 @@
45#define ZPCI_NR_DEVICES CONFIG_PCI_NR_FUNCTIONS 45#define ZPCI_NR_DEVICES CONFIG_PCI_NR_FUNCTIONS
46 46
47/* list of all detected zpci devices */ 47/* list of all detected zpci devices */
48LIST_HEAD(zpci_list); 48static LIST_HEAD(zpci_list);
49EXPORT_SYMBOL_GPL(zpci_list); 49static DEFINE_MUTEX(zpci_list_lock);
50DEFINE_MUTEX(zpci_list_lock);
51EXPORT_SYMBOL_GPL(zpci_list_lock);
52
53 50
54static void zpci_enable_irq(struct irq_data *data); 51static void zpci_enable_irq(struct irq_data *data);
55static void zpci_disable_irq(struct irq_data *data); 52static void zpci_disable_irq(struct irq_data *data);
@@ -60,8 +57,6 @@ static struct irq_chip zpci_irq_chip = {
60 .irq_mask = zpci_disable_irq, 57 .irq_mask = zpci_disable_irq,
61}; 58};
62 59
63static struct pci_hp_callback_ops *hotplug_ops;
64
65static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES); 60static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES);
66static DEFINE_SPINLOCK(zpci_domain_lock); 61static DEFINE_SPINLOCK(zpci_domain_lock);
67 62
@@ -828,10 +823,10 @@ int zpci_create_device(struct zpci_dev *zdev)
828 823
829 mutex_lock(&zpci_list_lock); 824 mutex_lock(&zpci_list_lock);
830 list_add_tail(&zdev->entry, &zpci_list); 825 list_add_tail(&zdev->entry, &zpci_list);
831 if (hotplug_ops)
832 hotplug_ops->create_slot(zdev);
833 mutex_unlock(&zpci_list_lock); 826 mutex_unlock(&zpci_list_lock);
834 827
828 zpci_init_slot(zdev);
829
835 return 0; 830 return 0;
836 831
837out_disable: 832out_disable:
@@ -884,24 +879,7 @@ static void zpci_mem_exit(void)
884 kmem_cache_destroy(zdev_fmb_cache); 879 kmem_cache_destroy(zdev_fmb_cache);
885} 880}
886 881
887void zpci_register_hp_ops(struct pci_hp_callback_ops *ops) 882static unsigned int s390_pci_probe;
888{
889 mutex_lock(&zpci_list_lock);
890 hotplug_ops = ops;
891 mutex_unlock(&zpci_list_lock);
892}
893EXPORT_SYMBOL_GPL(zpci_register_hp_ops);
894
895void zpci_deregister_hp_ops(void)
896{
897 mutex_lock(&zpci_list_lock);
898 hotplug_ops = NULL;
899 mutex_unlock(&zpci_list_lock);
900}
901EXPORT_SYMBOL_GPL(zpci_deregister_hp_ops);
902
903unsigned int s390_pci_probe;
904EXPORT_SYMBOL_GPL(s390_pci_probe);
905 883
906char * __init pcibios_setup(char *str) 884char * __init pcibios_setup(char *str)
907{ 885{
@@ -960,4 +938,4 @@ out_mem:
960out: 938out:
961 return rc; 939 return rc;
962} 940}
963subsys_initcall(pci_base_init); 941subsys_initcall_sync(pci_base_init);
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index d85009de713d..0a648af89531 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -146,7 +146,7 @@ config HOTPLUG_PCI_SGI
146 When in doubt, say N. 146 When in doubt, say N.
147 147
148config HOTPLUG_PCI_S390 148config HOTPLUG_PCI_S390
149 tristate "System z PCI Hotplug Support" 149 bool "System z PCI Hotplug Support"
150 depends on S390 && 64BIT 150 depends on S390 && 64BIT
151 help 151 help
152 Say Y here if you want to use the System z PCI Hotplug 152 Say Y here if you want to use the System z PCI Hotplug
diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c
index ea3fa90d020a..0d9c12fbcb3a 100644
--- a/drivers/pci/hotplug/s390_pci_hpc.c
+++ b/drivers/pci/hotplug/s390_pci_hpc.c
@@ -148,7 +148,7 @@ static struct hotplug_slot_ops s390_hotplug_slot_ops = {
148 .get_adapter_status = get_adapter_status, 148 .get_adapter_status = get_adapter_status,
149}; 149};
150 150
151static int init_pci_slot(struct zpci_dev *zdev) 151int zpci_init_slot(struct zpci_dev *zdev)
152{ 152{
153 struct hotplug_slot *hotplug_slot; 153 struct hotplug_slot *hotplug_slot;
154 struct hotplug_slot_info *info; 154 struct hotplug_slot_info *info;
@@ -202,7 +202,7 @@ error:
202 return -ENOMEM; 202 return -ENOMEM;
203} 203}
204 204
205static void exit_pci_slot(struct zpci_dev *zdev) 205void zpci_exit_slot(struct zpci_dev *zdev)
206{ 206{
207 struct list_head *tmp, *n; 207 struct list_head *tmp, *n;
208 struct slot *slot; 208 struct slot *slot;
@@ -215,60 +215,3 @@ static void exit_pci_slot(struct zpci_dev *zdev)
215 pci_hp_deregister(slot->hotplug_slot); 215 pci_hp_deregister(slot->hotplug_slot);
216 } 216 }
217} 217}
218
219static struct pci_hp_callback_ops hp_ops = {
220 .create_slot = init_pci_slot,
221 .remove_slot = exit_pci_slot,
222};
223
224static void __init init_pci_slots(void)
225{
226 struct zpci_dev *zdev;
227
228 /*
229 * Create a structure for each slot, and register that slot
230 * with the pci_hotplug subsystem.
231 */
232 mutex_lock(&zpci_list_lock);
233 list_for_each_entry(zdev, &zpci_list, entry) {
234 init_pci_slot(zdev);
235 }
236 mutex_unlock(&zpci_list_lock);
237}
238
239static void __exit exit_pci_slots(void)
240{
241 struct list_head *tmp, *n;
242 struct slot *slot;
243
244 /*
245 * Unregister all of our slots with the pci_hotplug subsystem.
246 * Memory will be freed in release_slot() callback after slot's
247 * lifespan is finished.
248 */
249 list_for_each_safe(tmp, n, &s390_hotplug_slot_list) {
250 slot = list_entry(tmp, struct slot, slot_list);
251 list_del(&slot->slot_list);
252 pci_hp_deregister(slot->hotplug_slot);
253 }
254}
255
256static int __init pci_hotplug_s390_init(void)
257{
258 if (!s390_pci_probe)
259 return -EOPNOTSUPP;
260
261 zpci_register_hp_ops(&hp_ops);
262 init_pci_slots();
263
264 return 0;
265}
266
267static void __exit pci_hotplug_s390_exit(void)
268{
269 exit_pci_slots();
270 zpci_deregister_hp_ops();
271}
272
273module_init(pci_hotplug_s390_init);
274module_exit(pci_hotplug_s390_exit);