Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c78bc61 authored by Ryan Desfosses's avatar Ryan Desfosses Committed by Bjorn Helgaas
Browse files

PCI: Whitespace cleanup



Fix various whitespace errors.

No functional change.

[bhelgaas: fix other similar problems]
Signed-off-by: default avatarRyan Desfosses <ryan@desfo.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent b7fe9434
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -614,8 +614,8 @@ static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys)
	return sys->private_data;
}

static struct mvebu_pcie_port *
mvebu_pcie_find_port(struct mvebu_pcie *pcie, struct pci_bus *bus,
static struct mvebu_pcie_port *mvebu_pcie_find_port(struct mvebu_pcie *pcie,
						    struct pci_bus *bus,
						    int devfn)
{
	int i;
@@ -834,7 +834,8 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
 * found, maps it.
 */
static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
		      struct device_node *np, struct mvebu_pcie_port *port)
					      struct device_node *np,
					      struct mvebu_pcie_port *port)
{
	struct resource regs;
	int ret = 0;
+45 −51
Original line number Diff line number Diff line
@@ -59,8 +59,6 @@ static bool debug;
#define DRIVER_DESC	"PCI Hot Plug PCI Core"


//////////////////////////////////////////////////////////////////

static LIST_HEAD(pci_hotplug_slot_list);
static DEFINE_MUTEX(pci_hp_mutex);

@@ -92,10 +90,9 @@ static ssize_t power_read_file(struct pci_slot *slot, char *buf)

	retval = get_power_status(slot->hotplug, &value);
	if (retval)
		goto exit;
	retval = sprintf (buf, "%d\n", value);
exit:
		return retval;

	return sprintf(buf, "%d\n", value);
}

static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
@@ -150,11 +147,9 @@ static ssize_t attention_read_file(struct pci_slot *slot, char *buf)

	retval = get_attention_status(slot->hotplug, &value);
	if (retval)
		goto exit;
	retval = sprintf(buf, "%d\n", value);

exit:
		return retval;

	return sprintf(buf, "%d\n", value);
}

static ssize_t attention_write_file(struct pci_slot *slot, const char *buf,
@@ -196,11 +191,9 @@ static ssize_t latch_read_file(struct pci_slot *slot, char *buf)

	retval = get_latch_status(slot->hotplug, &value);
	if (retval)
		goto exit;
	retval = sprintf (buf, "%d\n", value);

exit:
		return retval;

	return sprintf(buf, "%d\n", value);
}

static struct pci_slot_attribute hotplug_slot_attr_latch = {
@@ -215,11 +208,9 @@ static ssize_t presence_read_file(struct pci_slot *slot, char *buf)

	retval = get_adapter_status(slot->hotplug, &value);
	if (retval)
		goto exit;
	retval = sprintf (buf, "%d\n", value);

exit:
		return retval;

	return sprintf(buf, "%d\n", value);
}

static struct pci_slot_attribute hotplug_slot_attr_presence = {
@@ -261,6 +252,7 @@ static struct pci_slot_attribute hotplug_slot_attr_test = {
static bool has_power_file(struct pci_slot *pci_slot)
{
	struct hotplug_slot *slot = pci_slot->hotplug;

	if ((!slot) || (!slot->ops))
		return false;
	if ((slot->ops->enable_slot) ||
@@ -273,6 +265,7 @@ static bool has_power_file(struct pci_slot *pci_slot)
static bool has_attention_file(struct pci_slot *pci_slot)
{
	struct hotplug_slot *slot = pci_slot->hotplug;

	if ((!slot) || (!slot->ops))
		return false;
	if ((slot->ops->set_attention_status) ||
@@ -284,6 +277,7 @@ static bool has_attention_file(struct pci_slot *pci_slot)
static bool has_latch_file(struct pci_slot *pci_slot)
{
	struct hotplug_slot *slot = pci_slot->hotplug;

	if ((!slot) || (!slot->ops))
		return false;
	if (slot->ops->get_latch_status)
@@ -294,6 +288,7 @@ static bool has_latch_file(struct pci_slot *pci_slot)
static bool has_adapter_file(struct pci_slot *pci_slot)
{
	struct hotplug_slot *slot = pci_slot->hotplug;

	if ((!slot) || (!slot->ops))
		return false;
	if (slot->ops->get_adapter_status)
@@ -304,6 +299,7 @@ static bool has_adapter_file(struct pci_slot *pci_slot)
static bool has_test_file(struct pci_slot *pci_slot)
{
	struct hotplug_slot *slot = pci_slot->hotplug;

	if ((!slot) || (!slot->ops))
		return false;
	if (slot->ops->hardware_test)
@@ -538,12 +534,10 @@ static int __init pci_hotplug_init (void)
	result = cpci_hotplug_init(debug);
	if (result) {
		err("cpci_hotplug_init with error %d\n", result);
		goto err_cpci;
		return result;
	}

	info(DRIVER_DESC " version: " DRIVER_VERSION "\n");

err_cpci:
	return result;
}

+24 −27
Original line number Diff line number Diff line
@@ -99,8 +99,8 @@ static void pci_free_dynids(struct pci_driver *drv)
 *
 * Allow PCI IDs to be added to an existing driver via sysfs.
 */
static ssize_t
store_new_id(struct device_driver *driver, const char *buf, size_t count)
static ssize_t store_new_id(struct device_driver *driver, const char *buf,
			    size_t count)
{
	struct pci_driver *pdrv = to_pci_driver(driver);
	const struct pci_device_id *ids = pdrv->id_table;
@@ -167,8 +167,8 @@ static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
 *
 * Removes a dynamic pci device ID to this driver.
 */
static ssize_t
store_remove_id(struct device_driver *driver, const char *buf, size_t count)
static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
			       size_t count)
{
	struct pci_dynid *dynid, *n;
	struct pci_driver *pdrv = to_pci_driver(driver);
@@ -374,8 +374,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
 * returns 0 on success, else error.
 * side-effect: pci_dev->driver is set to drv when drv claims pci_dev.
 */
static int
__pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
{
	const struct pci_device_id *id;
	int error = 0;
@@ -1269,8 +1268,7 @@ EXPORT_SYMBOL(__pci_register_driver);
 * driverless.
 */

void
pci_unregister_driver(struct pci_driver *drv)
void pci_unregister_driver(struct pci_driver *drv)
{
	driver_unregister(&drv->driver);
	pci_free_dynids(drv);
@@ -1288,8 +1286,7 @@ static struct pci_driver pci_compat_driver = {
 * Returns the appropriate pci_driver structure or %NULL if there is no
 * registered driver for the device.
 */
struct pci_driver *
pci_dev_driver(const struct pci_dev *dev)
struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
{
	if (dev->driver)
		return dev->driver;
+26 −39
Original line number Diff line number Diff line
@@ -40,8 +40,7 @@ enum smbios_attr_enum {
	SMBIOS_ATTR_INSTANCE_SHOW,
};

static size_t
find_smbios_instance_string(struct pci_dev *pdev, char *buf,
static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
					  enum smbios_attr_enum attribute)
{
	const struct dmi_device *dmi;
@@ -74,9 +73,8 @@ find_smbios_instance_string(struct pci_dev *pdev, char *buf,
	return 0;
}

static umode_t
smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
			     int n)
static umode_t smbios_instance_string_exist(struct kobject *kobj,
					    struct attribute *attr, int n)
{
	struct device *dev;
	struct pci_dev *pdev;
@@ -88,8 +86,8 @@ smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
					   S_IRUGO : 0;
}

static ssize_t
smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t smbioslabel_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	struct pci_dev *pdev;
	pdev = to_pci_dev(dev);
@@ -98,8 +96,7 @@ smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
					   SMBIOS_ATTR_LABEL_SHOW);
}

static ssize_t
smbiosinstance_show(struct device *dev,
static ssize_t smbiosinstance_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	struct pci_dev *pdev;
@@ -130,26 +127,22 @@ static struct attribute_group smbios_attr_group = {
	.is_visible = smbios_instance_string_exist,
};

static int
pci_create_smbiosname_file(struct pci_dev *pdev)
static int pci_create_smbiosname_file(struct pci_dev *pdev)
{
	return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group);
}

static void
pci_remove_smbiosname_file(struct pci_dev *pdev)
static void pci_remove_smbiosname_file(struct pci_dev *pdev)
{
	sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
}
#else
static inline int
pci_create_smbiosname_file(struct pci_dev *pdev)
static inline int pci_create_smbiosname_file(struct pci_dev *pdev)
{
	return -1;
}

static inline void
pci_remove_smbiosname_file(struct pci_dev *pdev)
static inline void pci_remove_smbiosname_file(struct pci_dev *pdev)
{
}
#endif
@@ -175,8 +168,8 @@ static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
	buf[len] = '\n';
}

static int
dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
static int dsm_get_label(struct device *dev, char *buf,
			 enum acpi_attr_enum attr)
{
	acpi_handle handle;
	union acpi_object *obj, *tmp;
@@ -212,8 +205,7 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
	return len;
}

static bool
device_has_dsm(struct device *dev)
static bool device_has_dsm(struct device *dev)
{
	acpi_handle handle;

@@ -225,8 +217,8 @@ device_has_dsm(struct device *dev)
				1 << DEVICE_LABEL_DSM);
}

static umode_t
acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
static umode_t acpi_index_string_exist(struct kobject *kobj,
				       struct attribute *attr, int n)
{
	struct device *dev;

@@ -238,14 +230,14 @@ acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
	return 0;
}

static ssize_t
acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t acpilabel_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{
	return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW);
}

static ssize_t
acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t acpiindex_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{
	return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW);
}
@@ -271,33 +263,28 @@ static struct attribute_group acpi_attr_group = {
	.is_visible = acpi_index_string_exist,
};

static int
pci_create_acpi_index_label_files(struct pci_dev *pdev)
static int pci_create_acpi_index_label_files(struct pci_dev *pdev)
{
	return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group);
}

static int
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
static int pci_remove_acpi_index_label_files(struct pci_dev *pdev)
{
	sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group);
	return 0;
}
#else
static inline int
pci_create_acpi_index_label_files(struct pci_dev *pdev)
static inline int pci_create_acpi_index_label_files(struct pci_dev *pdev)
{
	return -1;
}

static inline int
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
static inline int pci_remove_acpi_index_label_files(struct pci_dev *pdev)
{
	return -1;
}

static inline bool
device_has_dsm(struct device *dev)
static inline bool device_has_dsm(struct device *dev)
{
	return false;
}
+131 −158
Original line number Diff line number Diff line
@@ -77,10 +77,8 @@ static ssize_t broken_parity_status_store(struct device *dev,
}
static DEVICE_ATTR_RW(broken_parity_status);

static ssize_t pci_dev_show_local_cpu(struct device *dev,
		int type,
		struct device_attribute *attr,
		char *buf)
static ssize_t pci_dev_show_local_cpu(struct device *dev, int type,
				      struct device_attribute *attr, char *buf)
{
	const struct cpumask *mask;
	int len;
@@ -117,8 +115,7 @@ static DEVICE_ATTR_RO(local_cpulist);
/*
 * PCI Bus Class Devices
 */
static ssize_t pci_bus_show_cpuaffinity(struct device *dev,
					int type,
static ssize_t pci_bus_show_cpuaffinity(struct device *dev, int type,
					struct device_attribute *attr,
					char *buf)
{
@@ -149,8 +146,8 @@ static ssize_t cpulistaffinity_show(struct device *dev,
static DEVICE_ATTR_RO(cpulistaffinity);

/* show resources */
static ssize_t
resource_show(struct device * dev, struct device_attribute *attr, char * buf)
static ssize_t resource_show(struct device *dev, struct device_attribute *attr,
			     char *buf)
{
	struct pci_dev *pci_dev = to_pci_dev(dev);
	char *str = buf;
@@ -175,7 +172,8 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
}
static DEVICE_ATTR_RO(resource);

static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
			     char *buf)
{
	struct pci_dev *pci_dev = to_pci_dev(dev);

@@ -187,9 +185,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(modalias);

static ssize_t enabled_store(struct device *dev,
			     struct device_attribute *attr, const char *buf,
			     size_t count)
static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
			     const char *buf, size_t count)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	unsigned long val;
@@ -213,8 +210,8 @@ static ssize_t enabled_store(struct device *dev,
	return result < 0 ? result : count;
}

static ssize_t enabled_show(struct device *dev,
			    struct device_attribute *attr, char *buf)
static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
			    char *buf)
{
	struct pci_dev *pdev;

@@ -224,16 +221,16 @@ static ssize_t enabled_show(struct device *dev,
static DEVICE_ATTR_RW(enabled);

#ifdef CONFIG_NUMA
static ssize_t
numa_node_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr,
			      char *buf)
{
	return sprintf(buf, "%d\n", dev->numa_node);
}
static DEVICE_ATTR_RO(numa_node);
#endif

static ssize_t
dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t dma_mask_bits_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{
	struct pci_dev *pdev = to_pci_dev(dev);

@@ -241,16 +238,16 @@ dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf)
}
static DEVICE_ATTR_RO(dma_mask_bits);

static ssize_t
consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr,
static ssize_t consistent_dma_mask_bits_show(struct device *dev,
					     struct device_attribute *attr,
					     char *buf)
{
	return sprintf(buf, "%d\n", fls64(dev->coherent_dma_mask));
}
static DEVICE_ATTR_RO(consistent_dma_mask_bits);

static ssize_t
msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr,
			    char *buf)
{
	struct pci_dev *pdev = to_pci_dev(dev);

@@ -261,8 +258,7 @@ msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf)
		       !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI));
}

static ssize_t
msi_bus_store(struct device *dev, struct device_attribute *attr,
static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
			     const char *buf, size_t count)
{
	struct pci_dev *pdev = to_pci_dev(dev);
@@ -331,9 +327,9 @@ const struct attribute_group *pci_bus_groups[] = {
	NULL,
};

static ssize_t
dev_rescan_store(struct device *dev, struct device_attribute *attr,
		 const char *buf, size_t count)
static ssize_t dev_rescan_store(struct device *dev,
				struct device_attribute *attr, const char *buf,
				size_t count)
{
	unsigned long val;
	struct pci_dev *pdev = to_pci_dev(dev);
@@ -352,8 +348,7 @@ static struct device_attribute dev_rescan_attr = __ATTR(rescan,
							(S_IWUSR|S_IWGRP),
							NULL, dev_rescan_store);

static ssize_t
remove_store(struct device *dev, struct device_attribute *attr,
static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
			    const char *buf, size_t count)
{
	unsigned long val;
@@ -369,8 +364,8 @@ static struct device_attribute dev_remove_attr = __ATTR(remove,
							(S_IWUSR|S_IWGRP),
							NULL, remove_store);

static ssize_t
dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
static ssize_t dev_bus_rescan_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{
	unsigned long val;
@@ -607,8 +602,8 @@ const struct attribute_group *pcibus_groups[] = {
	NULL,
};

static ssize_t
boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr,
			     char *buf)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	struct pci_dev *vga_dev = vga_default_device();
@@ -622,22 +617,21 @@ boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
}
static struct device_attribute vga_attr = __ATTR_RO(boot_vga);

static ssize_t
pci_read_config(struct file *filp, struct kobject *kobj,
		struct bin_attribute *bin_attr,
		char *buf, loff_t off, size_t count)
static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
			       struct bin_attribute *bin_attr, char *buf,
			       loff_t off, size_t count)
{
	struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj));
	struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device,
						      kobj));
	unsigned int size = 64;
	loff_t init_off = off;
	u8 *data = (u8 *) buf;

	/* Several chips lock up trying to read undefined config space */
	if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0) {
	if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0)
		size = dev->cfg_size;
	} else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
	else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
		size = 128;
	}

	if (off > size)
		return 0;
@@ -700,12 +694,12 @@ pci_read_config(struct file *filp, struct kobject *kobj,
	return count;
}

static ssize_t
pci_write_config(struct file* filp, struct kobject *kobj,
		 struct bin_attribute *bin_attr,
		 char *buf, loff_t off, size_t count)
static ssize_t pci_write_config(struct file *filp, struct kobject *kobj,
				struct bin_attribute *bin_attr, char *buf,
				loff_t off, size_t count)
{
	struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj));
	struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device,
						      kobj));
	unsigned int size = count;
	loff_t init_off = off;
	u8 *data = (u8 *) buf;
@@ -762,10 +756,9 @@ pci_write_config(struct file* filp, struct kobject *kobj,
	return count;
}

static ssize_t
read_vpd_attr(struct file *filp, struct kobject *kobj,
	      struct bin_attribute *bin_attr,
	      char *buf, loff_t off, size_t count)
static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj,
			     struct bin_attribute *bin_attr, char *buf,
			     loff_t off, size_t count)
{
	struct pci_dev *dev =
		to_pci_dev(container_of(kobj, struct device, kobj));
@@ -778,10 +771,9 @@ read_vpd_attr(struct file *filp, struct kobject *kobj,
	return pci_read_vpd(dev, off, count, buf);
}

static ssize_t
write_vpd_attr(struct file *filp, struct kobject *kobj,
	       struct bin_attribute *bin_attr,
	       char *buf, loff_t off, size_t count)
static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj,
			      struct bin_attribute *bin_attr, char *buf,
			      loff_t off, size_t count)
{
	struct pci_dev *dev =
		to_pci_dev(container_of(kobj, struct device, kobj));
@@ -807,13 +799,11 @@ write_vpd_attr(struct file *filp, struct kobject *kobj,
 * Reads 1, 2, or 4 bytes from legacy I/O port space using an arch specific
 * callback routine (pci_legacy_read).
 */
static ssize_t
pci_read_legacy_io(struct file *filp, struct kobject *kobj,
		   struct bin_attribute *bin_attr,
		   char *buf, loff_t off, size_t count)
static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj,
				  struct bin_attribute *bin_attr, char *buf,
				  loff_t off, size_t count)
{
        struct pci_bus *bus = to_pci_bus(container_of(kobj,
                                                      struct device,
	struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
						      kobj));

	/* Only support 1, 2 or 4 byte accesses */
@@ -835,14 +825,13 @@ pci_read_legacy_io(struct file *filp, struct kobject *kobj,
 * Writes 1, 2, or 4 bytes from legacy I/O port space using an arch specific
 * callback routine (pci_legacy_write).
 */
static ssize_t
pci_write_legacy_io(struct file *filp, struct kobject *kobj,
		    struct bin_attribute *bin_attr,
		    char *buf, loff_t off, size_t count)
static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj,
				   struct bin_attribute *bin_attr, char *buf,
				   loff_t off, size_t count)
{
        struct pci_bus *bus = to_pci_bus(container_of(kobj,
						      struct device,
	struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
						      kobj));

	/* Only support 1, 2 or 4 byte accesses */
	if (count != 1 && count != 2 && count != 4)
		return -EINVAL;
@@ -861,13 +850,11 @@ pci_write_legacy_io(struct file *filp, struct kobject *kobj,
 * legacy memory space (first meg of bus space) into application virtual
 * memory space.
 */
static int
pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
			       struct bin_attribute *attr,
			       struct vm_area_struct *vma)
{
        struct pci_bus *bus = to_pci_bus(container_of(kobj,
                                                      struct device,
	struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
						      kobj));

	return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem);
@@ -884,13 +871,11 @@ pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
 * legacy IO space (first meg of bus space) into application virtual
 * memory space. Returns -ENOSYS if the operation isn't supported
 */
static int
pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
			      struct bin_attribute *attr,
			      struct vm_area_struct *vma)
{
        struct pci_bus *bus = to_pci_bus(container_of(kobj,
                                                      struct device,
	struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
						      kobj));

	return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io);
@@ -903,10 +888,9 @@ pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
 *
 * Stub implementation. Can be overridden by arch if necessary.
 */
void __weak
pci_adjust_legacy_attr(struct pci_bus *b, enum pci_mmap_state mmap_type)
void __weak pci_adjust_legacy_attr(struct pci_bus *b,
				   enum pci_mmap_state mmap_type)
{
	return;
}

/**
@@ -1005,8 +989,7 @@ int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma,
 *
 * Use the regular PCI mapping routines to map a PCI resource into userspace.
 */
static int
pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
			     struct vm_area_struct *vma, int write_combine)
{
	struct pci_dev *pdev = to_pci_dev(container_of(kobj,
@@ -1046,24 +1029,21 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
	return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
}

static int
pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
				struct bin_attribute *attr,
				struct vm_area_struct *vma)
{
	return pci_mmap_resource(kobj, attr, vma, 0);
}

static int
pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
				struct bin_attribute *attr,
				struct vm_area_struct *vma)
{
	return pci_mmap_resource(kobj, attr, vma, 1);
}

static ssize_t
pci_resource_io(struct file *filp, struct kobject *kobj,
static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
			       struct bin_attribute *attr, char *buf,
			       loff_t off, size_t count, bool write)
{
@@ -1110,16 +1090,14 @@ pci_resource_io(struct file *filp, struct kobject *kobj,
	return -EINVAL;
}

static ssize_t
pci_read_resource_io(struct file *filp, struct kobject *kobj,
static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
				    struct bin_attribute *attr, char *buf,
				    loff_t off, size_t count)
{
	return pci_resource_io(filp, kobj, attr, buf, off, count, false);
}

static ssize_t
pci_write_resource_io(struct file *filp, struct kobject *kobj,
static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj,
				     struct bin_attribute *attr, char *buf,
				     loff_t off, size_t count)
{
@@ -1133,8 +1111,7 @@ pci_write_resource_io(struct file *filp, struct kobject *kobj,
 * If we created resource files for @pdev, remove them from sysfs and
 * free their resources.
 */
static void
pci_remove_resource_files(struct pci_dev *pdev)
static void pci_remove_resource_files(struct pci_dev *pdev)
{
	int i;

@@ -1237,10 +1214,9 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
 *
 * writing anything except 0 enables it
 */
static ssize_t
pci_write_rom(struct file *filp, struct kobject *kobj,
	      struct bin_attribute *bin_attr,
	      char *buf, loff_t off, size_t count)
static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj,
			     struct bin_attribute *bin_attr, char *buf,
			     loff_t off, size_t count)
{
	struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));

@@ -1264,10 +1240,9 @@ pci_write_rom(struct file *filp, struct kobject *kobj,
 * Put @count bytes starting at @off into @buf from the ROM in the PCI
 * device corresponding to @kobj.
 */
static ssize_t
pci_read_rom(struct file *filp, struct kobject *kobj,
	     struct bin_attribute *bin_attr,
	     char *buf, loff_t off, size_t count)
static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj,
			    struct bin_attribute *bin_attr, char *buf,
			    loff_t off, size_t count)
{
	struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
	void __iomem *rom;
@@ -1313,9 +1288,8 @@ static struct bin_attribute pcie_config_attr = {
	.write = pci_write_config,
};

static ssize_t reset_store(struct device *dev,
			   struct device_attribute *attr, const char *buf,
			   size_t count)
static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
			   const char *buf, size_t count)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	unsigned long val;
@@ -1520,7 +1494,6 @@ static int __init pci_sysfs_init(void)

	return 0;
}

late_initcall(pci_sysfs_init);

static struct attribute *pci_dev_dev_attrs[] = {
Loading