Skip to content

Commit c893d13

Browse files
YijingWangbjorn-helgaas
authored andcommitted
PCI: Make pci_bus_add_device() void
pci_bus_add_device() always returns 0, so there's no point in returning anything at all. Make it a void function and remove the tests of the return value from the callers. [bhelgaas: changelog, remove unused "err" from i82875p_setup_overfl_dev()] Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent d97ffe2 commit c893d13

6 files changed

Lines changed: 7 additions & 21 deletions

File tree

‎drivers/edac/i82875p_edac.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ static int i82875p_setup_overfl_dev(struct pci_dev *pdev,
275275
{
276276
struct pci_dev *dev;
277277
void __iomem *window;
278-
int err;
279278

280279
*ovrfl_pdev = NULL;
281280
*ovrfl_window = NULL;
@@ -293,12 +292,7 @@ static int i82875p_setup_overfl_dev(struct pci_dev *pdev,
293292
if (dev == NULL)
294293
return 1;
295294

296-
err = pci_bus_add_device(dev);
297-
if (err) {
298-
i82875p_printk(KERN_ERR,
299-
"%s(): pci_bus_add_device() Failed\n",
300-
__func__);
301-
}
295+
pci_bus_add_device(dev);
302296
pci_bus_assign_resources(dev->bus);
303297
}
304298

‎drivers/pci/bus.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
235235
*
236236
* This adds add sysfs entries and start device drivers
237237
*/
238-
int pci_bus_add_device(struct pci_dev *dev)
238+
void pci_bus_add_device(struct pci_dev *dev)
239239
{
240240
int retval;
241241

@@ -252,8 +252,6 @@ int pci_bus_add_device(struct pci_dev *dev)
252252
WARN_ON(retval < 0);
253253

254254
dev->is_added = 1;
255-
256-
return 0;
257255
}
258256

259257
/**
@@ -266,16 +264,12 @@ void pci_bus_add_devices(const struct pci_bus *bus)
266264
{
267265
struct pci_dev *dev;
268266
struct pci_bus *child;
269-
int retval;
270267

271268
list_for_each_entry(dev, &bus->devices, bus_list) {
272269
/* Skip already-added devices */
273270
if (dev->is_added)
274271
continue;
275-
retval = pci_bus_add_device(dev);
276-
if (retval)
277-
dev_err(&dev->dev, "Error adding device (%d)\n",
278-
retval);
272+
pci_bus_add_device(dev);
279273
}
280274

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

‎drivers/pci/iov.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
106106
pci_device_add(virtfn, virtfn->bus);
107107
mutex_unlock(&iov->dev->sriov->lock);
108108

109-
rc = pci_bus_add_device(virtfn);
109+
pci_bus_add_device(virtfn);
110110
sprintf(buf, "virtfn%u", id);
111111
rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
112112
if (rc)

‎drivers/platform/x86/asus-wmi.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,7 @@ static void asus_rfkill_hotplug(struct asus_wmi *asus)
642642
dev = pci_scan_single_device(bus, 0);
643643
if (dev) {
644644
pci_bus_assign_resources(bus);
645-
if (pci_bus_add_device(dev))
646-
pr_err("Unable to hotplug wifi\n");
645+
pci_bus_add_device(dev);
647646
}
648647
} else {
649648
dev = pci_get_slot(bus, 0);

‎drivers/platform/x86/eeepc-laptop.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
633633
dev = pci_scan_single_device(bus, 0);
634634
if (dev) {
635635
pci_bus_assign_resources(bus);
636-
if (pci_bus_add_device(dev))
637-
pr_err("Unable to hotplug wifi\n");
636+
pci_bus_add_device(dev);
638637
}
639638
} else {
640639
dev = pci_get_slot(bus, 0);

‎include/linux/pci.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
764764
struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
765765
void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
766766
unsigned int pci_scan_child_bus(struct pci_bus *bus);
767-
int __must_check pci_bus_add_device(struct pci_dev *dev);
767+
void pci_bus_add_device(struct pci_dev *dev);
768768
void pci_read_bridge_bases(struct pci_bus *child);
769769
struct resource *pci_find_parent_resource(const struct pci_dev *dev,
770770
struct resource *res);

0 commit comments

Comments
 (0)