Skip to content

Commit 723ec4d

Browse files
committed
Merge branch 'pci/cleanup' into next
* pci/cleanup: PCI: Remove "extern" from function declarations PCI: Warn about failures instead of "must_check" functions PCI: Remove __must_check from definitions PCI: Remove unused variables PCI: Move cpci_hotplug_init() proto to header file PCI: Make local functions/structs static PCI: Fix missing prototype for pcie_port_acpi_setup() Conflicts: drivers/pci/hotplug/acpiphp.h include/linux/pci.h
2 parents a3b6bbd + f39d5b7 commit 723ec4d

28 files changed

Lines changed: 310 additions & 321 deletions

‎drivers/pci/bus.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ void pci_bus_add_devices(const struct pci_bus *bus)
202202
if (dev->is_added)
203203
continue;
204204
retval = pci_bus_add_device(dev);
205+
if (retval)
206+
dev_err(&dev->dev, "Error adding device (%d)\n",
207+
retval);
205208
}
206209

207210
list_for_each_entry(dev, &bus->devices, bus_list) {

‎drivers/pci/hotplug/acpiphp.h‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,21 @@ struct acpiphp_attention_info
170170
/* function prototypes */
171171

172172
/* acpiphp_core.c */
173-
extern int acpiphp_register_attention(struct acpiphp_attention_info*info);
174-
extern int acpiphp_unregister_attention(struct acpiphp_attention_info *info);
175-
extern int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot);
176-
extern void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
173+
int acpiphp_register_attention(struct acpiphp_attention_info*info);
174+
int acpiphp_unregister_attention(struct acpiphp_attention_info *info);
175+
int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot);
176+
void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
177177

178178
/* acpiphp_glue.c */
179179
typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
180180

181-
extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
182-
extern int acpiphp_disable_slot (struct acpiphp_slot *slot);
183-
extern int acpiphp_eject_slot (struct acpiphp_slot *slot);
184-
extern u8 acpiphp_get_power_status (struct acpiphp_slot *slot);
185-
extern u8 acpiphp_get_attention_status (struct acpiphp_slot *slot);
186-
extern u8 acpiphp_get_latch_status (struct acpiphp_slot *slot);
187-
extern u8 acpiphp_get_adapter_status (struct acpiphp_slot *slot);
181+
int acpiphp_enable_slot(struct acpiphp_slot *slot);
182+
int acpiphp_disable_slot(struct acpiphp_slot *slot);
183+
int acpiphp_eject_slot(struct acpiphp_slot *slot);
184+
u8 acpiphp_get_power_status(struct acpiphp_slot *slot);
185+
u8 acpiphp_get_attention_status(struct acpiphp_slot *slot);
186+
u8 acpiphp_get_latch_status(struct acpiphp_slot *slot);
187+
u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot);
188188

189189
/* variables */
190190
extern bool acpiphp_debug;

‎drivers/pci/hotplug/cpci_hotplug.h‎

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,36 @@ static inline const char *slot_name(struct slot *slot)
7575
return hotplug_slot_name(slot->hotplug_slot);
7676
}
7777

78-
extern int cpci_hp_register_controller(struct cpci_hp_controller *controller);
79-
extern int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
80-
extern int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
81-
extern int cpci_hp_unregister_bus(struct pci_bus *bus);
82-
extern int cpci_hp_start(void);
83-
extern int cpci_hp_stop(void);
78+
int cpci_hp_register_controller(struct cpci_hp_controller *controller);
79+
int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
80+
int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
81+
int cpci_hp_unregister_bus(struct pci_bus *bus);
82+
int cpci_hp_start(void);
83+
int cpci_hp_stop(void);
8484

8585
/*
8686
* Internal function prototypes, these functions should not be used by
8787
* board/chassis drivers.
8888
*/
89-
extern u8 cpci_get_attention_status(struct slot *slot);
90-
extern u8 cpci_get_latch_status(struct slot *slot);
91-
extern u8 cpci_get_adapter_status(struct slot *slot);
92-
extern u16 cpci_get_hs_csr(struct slot * slot);
93-
extern int cpci_set_attention_status(struct slot *slot, int status);
94-
extern int cpci_check_and_clear_ins(struct slot * slot);
95-
extern int cpci_check_ext(struct slot * slot);
96-
extern int cpci_clear_ext(struct slot * slot);
97-
extern int cpci_led_on(struct slot * slot);
98-
extern int cpci_led_off(struct slot * slot);
99-
extern int cpci_configure_slot(struct slot *slot);
100-
extern int cpci_unconfigure_slot(struct slot *slot);
89+
u8 cpci_get_attention_status(struct slot *slot);
90+
u8 cpci_get_latch_status(struct slot *slot);
91+
u8 cpci_get_adapter_status(struct slot *slot);
92+
u16 cpci_get_hs_csr(struct slot * slot);
93+
int cpci_set_attention_status(struct slot *slot, int status);
94+
int cpci_check_and_clear_ins(struct slot * slot);
95+
int cpci_check_ext(struct slot * slot);
96+
int cpci_clear_ext(struct slot * slot);
97+
int cpci_led_on(struct slot * slot);
98+
int cpci_led_off(struct slot * slot);
99+
int cpci_configure_slot(struct slot *slot);
100+
int cpci_unconfigure_slot(struct slot *slot);
101+
102+
#ifdef CONFIG_HOTPLUG_PCI_CPCI
103+
int cpci_hotplug_init(int debug);
104+
void cpci_hotplug_exit(void);
105+
#else
106+
static inline int cpci_hotplug_init(int debug) { return 0; }
107+
static inline void cpci_hotplug_exit(void) { }
108+
#endif
101109

102110
#endif /* _CPCI_HOTPLUG_H */

‎drivers/pci/hotplug/cpqphp.h‎

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -404,50 +404,44 @@ struct resource_lists {
404404

405405

406406
/* debugfs functions for the hotplug controller info */
407-
extern void cpqhp_initialize_debugfs(void);
408-
extern void cpqhp_shutdown_debugfs(void);
409-
extern void cpqhp_create_debugfs_files(struct controller *ctrl);
410-
extern void cpqhp_remove_debugfs_files(struct controller *ctrl);
407+
void cpqhp_initialize_debugfs(void);
408+
void cpqhp_shutdown_debugfs(void);
409+
void cpqhp_create_debugfs_files(struct controller *ctrl);
410+
void cpqhp_remove_debugfs_files(struct controller *ctrl);
411411

412412
/* controller functions */
413-
extern void cpqhp_pushbutton_thread(unsigned long event_pointer);
414-
extern irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data);
415-
extern int cpqhp_find_available_resources(struct controller *ctrl,
416-
void __iomem *rom_start);
417-
extern int cpqhp_event_start_thread(void);
418-
extern void cpqhp_event_stop_thread(void);
419-
extern struct pci_func *cpqhp_slot_create(unsigned char busnumber);
420-
extern struct pci_func *cpqhp_slot_find(unsigned char bus, unsigned char device,
421-
unsigned char index);
422-
extern int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func);
423-
extern int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func);
424-
extern int cpqhp_hardware_test(struct controller *ctrl, int test_num);
413+
void cpqhp_pushbutton_thread(unsigned long event_pointer);
414+
irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data);
415+
int cpqhp_find_available_resources(struct controller *ctrl,
416+
void __iomem *rom_start);
417+
int cpqhp_event_start_thread(void);
418+
void cpqhp_event_stop_thread(void);
419+
struct pci_func *cpqhp_slot_create(unsigned char busnumber);
420+
struct pci_func *cpqhp_slot_find(unsigned char bus, unsigned char device,
421+
unsigned char index);
422+
int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func);
423+
int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func);
424+
int cpqhp_hardware_test(struct controller *ctrl, int test_num);
425425

426426
/* resource functions */
427-
extern int cpqhp_resource_sort_and_combine (struct pci_resource **head);
427+
int cpqhp_resource_sort_and_combine (struct pci_resource **head);
428428

429429
/* pci functions */
430-
extern int cpqhp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num);
431-
extern int cpqhp_get_bus_dev(struct controller *ctrl, u8 *bus_num, u8 *dev_num,
432-
u8 slot);
433-
extern int cpqhp_save_config(struct controller *ctrl, int busnumber,
434-
int is_hot_plug);
435-
extern int cpqhp_save_base_addr_length(struct controller *ctrl,
436-
struct pci_func *func);
437-
extern int cpqhp_save_used_resources(struct controller *ctrl,
438-
struct pci_func *func);
439-
extern int cpqhp_configure_board(struct controller *ctrl,
440-
struct pci_func *func);
441-
extern int cpqhp_save_slot_config(struct controller *ctrl,
442-
struct pci_func *new_slot);
443-
extern int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func);
444-
extern void cpqhp_destroy_board_resources(struct pci_func *func);
445-
extern int cpqhp_return_board_resources (struct pci_func *func,
446-
struct resource_lists *resources);
447-
extern void cpqhp_destroy_resource_list(struct resource_lists *resources);
448-
extern int cpqhp_configure_device(struct controller *ctrl,
449-
struct pci_func *func);
450-
extern int cpqhp_unconfigure_device(struct pci_func *func);
430+
int cpqhp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num);
431+
int cpqhp_get_bus_dev(struct controller *ctrl, u8 *bus_num, u8 *dev_num,
432+
u8 slot);
433+
int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug);
434+
int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func);
435+
int cpqhp_save_used_resources(struct controller *ctrl, struct pci_func *func);
436+
int cpqhp_configure_board(struct controller *ctrl, struct pci_func *func);
437+
int cpqhp_save_slot_config(struct controller *ctrl, struct pci_func *new_slot);
438+
int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func);
439+
void cpqhp_destroy_board_resources(struct pci_func *func);
440+
int cpqhp_return_board_resources(struct pci_func *func,
441+
struct resource_lists *resources);
442+
void cpqhp_destroy_resource_list(struct resource_lists *resources);
443+
int cpqhp_configure_device(struct controller *ctrl, struct pci_func *func);
444+
int cpqhp_unconfigure_device(struct pci_func *func);
451445

452446
/* Global variables */
453447
extern int cpqhp_debug;

‎drivers/pci/hotplug/cpqphp_nvram.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,26 @@
3030

3131
#ifndef CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM
3232

33-
static inline void compaq_nvram_init (void __iomem *rom_start)
33+
static inline void compaq_nvram_init(void __iomem *rom_start)
3434
{
3535
return;
3636
}
3737

38-
static inline int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl)
38+
static inline int compaq_nvram_load(void __iomem *rom_start, struct controller *ctrl)
3939
{
4040
return 0;
4141
}
4242

43-
static inline int compaq_nvram_store (void __iomem *rom_start)
43+
static inline int compaq_nvram_store(void __iomem *rom_start)
4444
{
4545
return 0;
4646
}
4747

4848
#else
4949

50-
extern void compaq_nvram_init (void __iomem *rom_start);
51-
extern int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl);
52-
extern int compaq_nvram_store (void __iomem *rom_start);
50+
void compaq_nvram_init(void __iomem *rom_start);
51+
int compaq_nvram_load(void __iomem *rom_start, struct controller *ctrl);
52+
int compaq_nvram_store(void __iomem *rom_start);
5353

5454
#endif
5555

‎drivers/pci/hotplug/ibmphp.h‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,17 @@ extern struct list_head ibmphp_slot_head;
275275
* FUNCTION PROTOTYPES *
276276
***********************************************************/
277277

278-
extern void ibmphp_free_ebda_hpc_queue (void);
279-
extern int ibmphp_access_ebda (void);
280-
extern struct slot *ibmphp_get_slot_from_physical_num (u8);
281-
extern int ibmphp_get_total_hp_slots (void);
282-
extern void ibmphp_free_ibm_slot (struct slot *);
283-
extern void ibmphp_free_bus_info_queue (void);
284-
extern void ibmphp_free_ebda_pci_rsrc_queue (void);
285-
extern struct bus_info *ibmphp_find_same_bus_num (u32);
286-
extern int ibmphp_get_bus_index (u8);
287-
extern u16 ibmphp_get_total_controllers (void);
288-
extern int ibmphp_register_pci (void);
278+
void ibmphp_free_ebda_hpc_queue(void);
279+
int ibmphp_access_ebda(void);
280+
struct slot *ibmphp_get_slot_from_physical_num(u8);
281+
int ibmphp_get_total_hp_slots(void);
282+
void ibmphp_free_ibm_slot(struct slot *);
283+
void ibmphp_free_bus_info_queue(void);
284+
void ibmphp_free_ebda_pci_rsrc_queue(void);
285+
struct bus_info *ibmphp_find_same_bus_num(u32);
286+
int ibmphp_get_bus_index(u8);
287+
u16 ibmphp_get_total_controllers(void);
288+
int ibmphp_register_pci(void);
289289

290290
/* passed parameters */
291291
#define MEM 0
@@ -381,24 +381,24 @@ struct res_needed {
381381

382382
/* functions */
383383

384-
extern int ibmphp_rsrc_init (void);
385-
extern int ibmphp_add_resource (struct resource_node *);
386-
extern int ibmphp_remove_resource (struct resource_node *);
387-
extern int ibmphp_find_resource (struct bus_node *, u32, struct resource_node **, int);
388-
extern int ibmphp_check_resource (struct resource_node *, u8);
389-
extern int ibmphp_remove_bus (struct bus_node *, u8);
390-
extern void ibmphp_free_resources (void);
391-
extern int ibmphp_add_pfmem_from_mem (struct resource_node *);
392-
extern struct bus_node *ibmphp_find_res_bus (u8);
393-
extern void ibmphp_print_test (void); /* for debugging purposes */
384+
int ibmphp_rsrc_init(void);
385+
int ibmphp_add_resource(struct resource_node *);
386+
int ibmphp_remove_resource(struct resource_node *);
387+
int ibmphp_find_resource(struct bus_node *, u32, struct resource_node **, int);
388+
int ibmphp_check_resource(struct resource_node *, u8);
389+
int ibmphp_remove_bus(struct bus_node *, u8);
390+
void ibmphp_free_resources(void);
391+
int ibmphp_add_pfmem_from_mem(struct resource_node *);
392+
struct bus_node *ibmphp_find_res_bus(u8);
393+
void ibmphp_print_test(void); /* for debugging purposes */
394394

395-
extern void ibmphp_hpc_initvars (void);
396-
extern int ibmphp_hpc_readslot (struct slot *, u8, u8 *);
397-
extern int ibmphp_hpc_writeslot (struct slot *, u8);
398-
extern void ibmphp_lock_operations (void);
399-
extern void ibmphp_unlock_operations (void);
400-
extern int ibmphp_hpc_start_poll_thread (void);
401-
extern void ibmphp_hpc_stop_poll_thread (void);
395+
void ibmphp_hpc_initvars(void);
396+
int ibmphp_hpc_readslot(struct slot *, u8, u8 *);
397+
int ibmphp_hpc_writeslot(struct slot *, u8);
398+
void ibmphp_lock_operations(void);
399+
void ibmphp_unlock_operations(void);
400+
int ibmphp_hpc_start_poll_thread(void);
401+
void ibmphp_hpc_stop_poll_thread(void);
402402

403403
//----------------------------------------------------------------------------
404404

@@ -749,11 +749,11 @@ struct controller {
749749

750750
/* Functions */
751751

752-
extern int ibmphp_init_devno (struct slot **); /* This function is called from EBDA, so we need it not be static */
753-
extern int ibmphp_do_disable_slot (struct slot *slot_cur);
754-
extern int ibmphp_update_slot_info (struct slot *); /* This function is called from HPC, so we need it to not be be static */
755-
extern int ibmphp_configure_card (struct pci_func *, u8);
756-
extern int ibmphp_unconfigure_card (struct slot **, int);
752+
int ibmphp_init_devno(struct slot **); /* This function is called from EBDA, so we need it not be static */
753+
int ibmphp_do_disable_slot(struct slot *slot_cur);
754+
int ibmphp_update_slot_info(struct slot *); /* This function is called from HPC, so we need it to not be be static */
755+
int ibmphp_configure_card(struct pci_func *, u8);
756+
int ibmphp_unconfigure_card(struct slot **, int);
757757
extern struct hotplug_slot_ops ibmphp_hotplug_slot_ops;
758758

759759
#endif //__IBMPHP_H

‎drivers/pci/hotplug/pci_hotplug_core.c‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <linux/pci_hotplug.h>
4242
#include <asm/uaccess.h>
4343
#include "../pci.h"
44+
#include "cpci_hotplug.h"
4445

4546
#define MY_NAME "pci_hotplug"
4647

@@ -63,14 +64,6 @@ static bool debug;
6364
static LIST_HEAD(pci_hotplug_slot_list);
6465
static DEFINE_MUTEX(pci_hp_mutex);
6566

66-
#ifdef CONFIG_HOTPLUG_PCI_CPCI
67-
extern int cpci_hotplug_init(int debug);
68-
extern void cpci_hotplug_exit(void);
69-
#else
70-
static inline int cpci_hotplug_init(int debug) { return 0; }
71-
static inline void cpci_hotplug_exit(void) { }
72-
#endif
73-
7467
/* Weee, fun with macros... */
7568
#define GET_STATUS(name,type) \
7669
static int get_##name (struct hotplug_slot *slot, type *value) \
@@ -524,13 +517,11 @@ int pci_hp_deregister(struct hotplug_slot *hotplug)
524517
*
525518
* Returns 0 if successful, anything else for an error.
526519
*/
527-
int __must_check pci_hp_change_slot_info(struct hotplug_slot *hotplug,
528-
struct hotplug_slot_info *info)
520+
int pci_hp_change_slot_info(struct hotplug_slot *hotplug,
521+
struct hotplug_slot_info *info)
529522
{
530-
struct pci_slot *slot;
531523
if (!hotplug || !info)
532524
return -ENODEV;
533-
slot = hotplug->pci_slot;
534525

535526
memcpy(hotplug->info, info, sizeof(struct hotplug_slot_info));
536527

‎drivers/pci/hotplug/pciehp.h‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ struct controller {
127127
#define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_NCCS)
128128
#define PSN(ctrl) ((ctrl)->slot_cap >> 19)
129129

130-
extern int pciehp_sysfs_enable_slot(struct slot *slot);
131-
extern int pciehp_sysfs_disable_slot(struct slot *slot);
132-
extern u8 pciehp_handle_attention_button(struct slot *p_slot);
133-
extern u8 pciehp_handle_switch_change(struct slot *p_slot);
134-
extern u8 pciehp_handle_presence_change(struct slot *p_slot);
135-
extern u8 pciehp_handle_power_fault(struct slot *p_slot);
136-
extern int pciehp_configure_device(struct slot *p_slot);
137-
extern int pciehp_unconfigure_device(struct slot *p_slot);
138-
extern void pciehp_queue_pushbutton_work(struct work_struct *work);
130+
int pciehp_sysfs_enable_slot(struct slot *slot);
131+
int pciehp_sysfs_disable_slot(struct slot *slot);
132+
u8 pciehp_handle_attention_button(struct slot *p_slot);
133+
u8 pciehp_handle_switch_change(struct slot *p_slot);
134+
u8 pciehp_handle_presence_change(struct slot *p_slot);
135+
u8 pciehp_handle_power_fault(struct slot *p_slot);
136+
int pciehp_configure_device(struct slot *p_slot);
137+
int pciehp_unconfigure_device(struct slot *p_slot);
138+
void pciehp_queue_pushbutton_work(struct work_struct *work);
139139
struct controller *pcie_init(struct pcie_device *dev);
140140
int pcie_init_notification(struct controller *ctrl);
141141
int pciehp_enable_slot(struct slot *p_slot);
@@ -166,8 +166,8 @@ static inline const char *slot_name(struct slot *slot)
166166
#include <acpi/acpi_bus.h>
167167
#include <linux/pci-acpi.h>
168168

169-
extern void __init pciehp_acpi_slot_detection_init(void);
170-
extern int pciehp_acpi_slot_detection_check(struct pci_dev *dev);
169+
void __init pciehp_acpi_slot_detection_init(void);
170+
int pciehp_acpi_slot_detection_check(struct pci_dev *dev);
171171

172172
static inline void pciehp_firmware_init(void)
173173
{

‎drivers/pci/hotplug/rpadlpar.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#ifndef _RPADLPAR_IO_H_
1616
#define _RPADLPAR_IO_H_
1717

18-
extern int dlpar_sysfs_init(void);
19-
extern void dlpar_sysfs_exit(void);
18+
int dlpar_sysfs_init(void);
19+
void dlpar_sysfs_exit(void);
2020

21-
extern int dlpar_add_slot(char *drc_name);
22-
extern int dlpar_remove_slot(char *drc_name);
21+
int dlpar_add_slot(char *drc_name);
22+
int dlpar_remove_slot(char *drc_name);
2323

2424
#endif

0 commit comments

Comments
 (0)