Commit 2d564279 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

Merge branch 'pci/misc'

- Reorganize kerneldoc parameter names to match order in function signature
  (Julia Lawall)

- Remove kerneldoc return value descriptions from hotplug registration
  interfaces that don't return anything (Ilpo Järvinen)

- Fix sysfs reset_method_store() memory leak (Todd Kjos)

- Simplify pci_create_slot() (Ilpo Järvinen)

- Fix incorrect printf format specifiers in pcitest (Luo Yifan)

* pci/misc:
  tools: PCI: Fix incorrect printf format specifiers
  PCI: Simplify pci_create_slot() logic
  PCI: Fix reset_method_store() memory leak
  PCI: hotplug: Remove "Returns" kerneldoc from void functions
  PCI: hotplug: Reorganize kerneldoc parameter names
parents e6b95ef1 d9db393f
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -388,8 +388,8 @@ static struct hotplug_slot *get_slot_from_name(const char *name)

/**
 * __pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem
 * @bus: bus this slot is on
 * @slot: pointer to the &struct hotplug_slot to register
 * @bus: bus this slot is on
 * @devnr: device number
 * @name: name registered with kobject core
 * @owner: caller module owner
@@ -498,8 +498,6 @@ EXPORT_SYMBOL_GPL(pci_hp_add);
 *
 * The @slot must have been registered with the pci hotplug subsystem
 * previously with a call to pci_hp_register().
 *
 * Returns 0 if successful, anything else for an error.
 */
void pci_hp_deregister(struct hotplug_slot *slot)
{
@@ -513,8 +511,6 @@ EXPORT_SYMBOL_GPL(pci_hp_deregister);
 * @slot: pointer to the &struct hotplug_slot to unpublish
 *
 * Remove a hotplug slot's sysfs interface.
 *
 * Returns 0 on success or a negative int on error.
 */
void pci_hp_del(struct hotplug_slot *slot)
{
@@ -545,8 +541,6 @@ EXPORT_SYMBOL_GPL(pci_hp_del);
 * the driver may no longer invoke hotplug_slot_name() to get the slot's
 * unique name.  The driver no longer needs to handle a ->reset_slot callback
 * from this point on.
 *
 * Returns 0 on success or a negative int on error.
 */
void pci_hp_destroy(struct hotplug_slot *slot)
{
+3 −2
Original line number Diff line number Diff line
@@ -5250,7 +5250,7 @@ static ssize_t reset_method_store(struct device *dev,
				  const char *buf, size_t count)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	char *options, *name;
	char *options, *tmp_options, *name;
	int m, n;
	u8 reset_methods[PCI_NUM_RESET_METHODS] = { 0 };

@@ -5270,7 +5270,8 @@ static ssize_t reset_method_store(struct device *dev,
		return -ENOMEM;

	n = 0;
	while ((name = strsep(&options, " ")) != NULL) {
	tmp_options = options;
	while ((name = strsep(&tmp_options, " ")) != NULL) {
		if (sysfs_streq(name, ""))
			continue;

+11 −9
Original line number Diff line number Diff line
@@ -245,12 +245,13 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
	slot = get_slot(parent, slot_nr);
	if (slot) {
		if (hotplug) {
			if ((err = slot->hotplug ? -EBUSY : 0)
			     || (err = rename_slot(slot, name))) {
				kobject_put(&slot->kobj);
				slot = NULL;
				goto err;
			if (slot->hotplug) {
				err = -EBUSY;
				goto put_slot;
			}
			err = rename_slot(slot, name);
			if (err)
				goto put_slot;
		}
		goto out;
	}
@@ -280,10 +281,8 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,

	err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
				   "%s", slot_name);
	if (err) {
		kobject_put(&slot->kobj);
		goto err;
	}
	if (err)
		goto put_slot;

	down_read(&pci_bus_sem);
	list_for_each_entry(dev, &parent->devices, bus_list)
@@ -298,6 +297,9 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
	kfree(slot_name);
	mutex_unlock(&pci_slot_mutex);
	return slot;

put_slot:
	kobject_put(&slot->kobj);
err:
	slot = ERR_PTR(err);
	goto out;
+5 −5
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ static int run_test(struct pci_test *test)

	if (test->msinum > 0 && test->msinum <= 32) {
		ret = ioctl(fd, PCITEST_MSI, test->msinum);
		fprintf(stdout, "MSI%d:\t\t", test->msinum);
		fprintf(stdout, "MSI%u:\t\t", test->msinum);
		if (ret < 0)
			fprintf(stdout, "TEST FAILED\n");
		else
@@ -104,7 +104,7 @@ static int run_test(struct pci_test *test)

	if (test->msixnum > 0 && test->msixnum <= 2048) {
		ret = ioctl(fd, PCITEST_MSIX, test->msixnum);
		fprintf(stdout, "MSI-X%d:\t\t", test->msixnum);
		fprintf(stdout, "MSI-X%u:\t\t", test->msixnum);
		if (ret < 0)
			fprintf(stdout, "TEST FAILED\n");
		else
@@ -116,7 +116,7 @@ static int run_test(struct pci_test *test)
		if (test->use_dma)
			param.flags = PCITEST_FLAGS_USE_DMA;
		ret = ioctl(fd, PCITEST_WRITE, &param);
		fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size);
		fprintf(stdout, "WRITE (%7lu bytes):\t\t", test->size);
		if (ret < 0)
			fprintf(stdout, "TEST FAILED\n");
		else
@@ -128,7 +128,7 @@ static int run_test(struct pci_test *test)
		if (test->use_dma)
			param.flags = PCITEST_FLAGS_USE_DMA;
		ret = ioctl(fd, PCITEST_READ, &param);
		fprintf(stdout, "READ (%7ld bytes):\t\t", test->size);
		fprintf(stdout, "READ (%7lu bytes):\t\t", test->size);
		if (ret < 0)
			fprintf(stdout, "TEST FAILED\n");
		else
@@ -140,7 +140,7 @@ static int run_test(struct pci_test *test)
		if (test->use_dma)
			param.flags = PCITEST_FLAGS_USE_DMA;
		ret = ioctl(fd, PCITEST_COPY, &param);
		fprintf(stdout, "COPY (%7ld bytes):\t\t", test->size);
		fprintf(stdout, "COPY (%7lu bytes):\t\t", test->size);
		if (ret < 0)
			fprintf(stdout, "TEST FAILED\n");
		else