PCI: Whitespace cleanup

Fix various whitespace errors.

No functional change.

[bhelgaas: fix other similar problems]
Signed-off-by: Ryan Desfosses <ryan@desfo.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
Ryan Desfosses 2014-04-18 20:13:49 -04:00 committed by Bjorn Helgaas
parent b7fe943421
commit 3c78bc61f5
45 changed files with 513 additions and 584 deletions

View file

@ -614,8 +614,8 @@ static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys)
return sys->private_data; return sys->private_data;
} }
static struct mvebu_pcie_port * static struct mvebu_pcie_port *mvebu_pcie_find_port(struct mvebu_pcie *pcie,
mvebu_pcie_find_port(struct mvebu_pcie *pcie, struct pci_bus *bus, struct pci_bus *bus,
int devfn) int devfn)
{ {
int i; int i;
@ -834,7 +834,8 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
* found, maps it. * found, maps it.
*/ */
static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev, 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; struct resource regs;
int ret = 0; int ret = 0;

View file

@ -59,8 +59,6 @@ static bool debug;
#define DRIVER_DESC "PCI Hot Plug PCI Core" #define DRIVER_DESC "PCI Hot Plug PCI Core"
//////////////////////////////////////////////////////////////////
static LIST_HEAD(pci_hotplug_slot_list); static LIST_HEAD(pci_hotplug_slot_list);
static DEFINE_MUTEX(pci_hp_mutex); 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); retval = get_power_status(slot->hotplug, &value);
if (retval) if (retval)
goto exit;
retval = sprintf (buf, "%d\n", value);
exit:
return retval; return retval;
return sprintf(buf, "%d\n", value);
} }
static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf, 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); retval = get_attention_status(slot->hotplug, &value);
if (retval) if (retval)
goto exit;
retval = sprintf(buf, "%d\n", value);
exit:
return retval; return retval;
return sprintf(buf, "%d\n", value);
} }
static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, 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); retval = get_latch_status(slot->hotplug, &value);
if (retval) if (retval)
goto exit;
retval = sprintf (buf, "%d\n", value);
exit:
return retval; return retval;
return sprintf(buf, "%d\n", value);
} }
static struct pci_slot_attribute hotplug_slot_attr_latch = { 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); retval = get_adapter_status(slot->hotplug, &value);
if (retval) if (retval)
goto exit;
retval = sprintf (buf, "%d\n", value);
exit:
return retval; return retval;
return sprintf(buf, "%d\n", value);
} }
static struct pci_slot_attribute hotplug_slot_attr_presence = { 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) static bool has_power_file(struct pci_slot *pci_slot)
{ {
struct hotplug_slot *slot = pci_slot->hotplug; struct hotplug_slot *slot = pci_slot->hotplug;
if ((!slot) || (!slot->ops)) if ((!slot) || (!slot->ops))
return false; return false;
if ((slot->ops->enable_slot) || 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) static bool has_attention_file(struct pci_slot *pci_slot)
{ {
struct hotplug_slot *slot = pci_slot->hotplug; struct hotplug_slot *slot = pci_slot->hotplug;
if ((!slot) || (!slot->ops)) if ((!slot) || (!slot->ops))
return false; return false;
if ((slot->ops->set_attention_status) || 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) static bool has_latch_file(struct pci_slot *pci_slot)
{ {
struct hotplug_slot *slot = pci_slot->hotplug; struct hotplug_slot *slot = pci_slot->hotplug;
if ((!slot) || (!slot->ops)) if ((!slot) || (!slot->ops))
return false; return false;
if (slot->ops->get_latch_status) 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) static bool has_adapter_file(struct pci_slot *pci_slot)
{ {
struct hotplug_slot *slot = pci_slot->hotplug; struct hotplug_slot *slot = pci_slot->hotplug;
if ((!slot) || (!slot->ops)) if ((!slot) || (!slot->ops))
return false; return false;
if (slot->ops->get_adapter_status) 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) static bool has_test_file(struct pci_slot *pci_slot)
{ {
struct hotplug_slot *slot = pci_slot->hotplug; struct hotplug_slot *slot = pci_slot->hotplug;
if ((!slot) || (!slot->ops)) if ((!slot) || (!slot->ops))
return false; return false;
if (slot->ops->hardware_test) if (slot->ops->hardware_test)
@ -538,12 +534,10 @@ static int __init pci_hotplug_init (void)
result = cpci_hotplug_init(debug); result = cpci_hotplug_init(debug);
if (result) { if (result) {
err("cpci_hotplug_init with error %d\n", result); err("cpci_hotplug_init with error %d\n", result);
goto err_cpci; return result;
} }
info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
err_cpci:
return result; return result;
} }

View file

@ -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. * Allow PCI IDs to be added to an existing driver via sysfs.
*/ */
static ssize_t static ssize_t store_new_id(struct device_driver *driver, const char *buf,
store_new_id(struct device_driver *driver, const char *buf, size_t count) size_t count)
{ {
struct pci_driver *pdrv = to_pci_driver(driver); struct pci_driver *pdrv = to_pci_driver(driver);
const struct pci_device_id *ids = pdrv->id_table; 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. * Removes a dynamic pci device ID to this driver.
*/ */
static ssize_t static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
store_remove_id(struct device_driver *driver, const char *buf, size_t count) size_t count)
{ {
struct pci_dynid *dynid, *n; struct pci_dynid *dynid, *n;
struct pci_driver *pdrv = to_pci_driver(driver); 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. * returns 0 on success, else error.
* side-effect: pci_dev->driver is set to drv when drv claims pci_dev. * side-effect: pci_dev->driver is set to drv when drv claims pci_dev.
*/ */
static int static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
__pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
{ {
const struct pci_device_id *id; const struct pci_device_id *id;
int error = 0; int error = 0;
@ -1269,8 +1268,7 @@ EXPORT_SYMBOL(__pci_register_driver);
* driverless. * driverless.
*/ */
void void pci_unregister_driver(struct pci_driver *drv)
pci_unregister_driver(struct pci_driver *drv)
{ {
driver_unregister(&drv->driver); driver_unregister(&drv->driver);
pci_free_dynids(drv); 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 * Returns the appropriate pci_driver structure or %NULL if there is no
* registered driver for the device. * registered driver for the device.
*/ */
struct pci_driver * struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
pci_dev_driver(const struct pci_dev *dev)
{ {
if (dev->driver) if (dev->driver)
return dev->driver; return dev->driver;

View file

@ -40,8 +40,7 @@ enum smbios_attr_enum {
SMBIOS_ATTR_INSTANCE_SHOW, SMBIOS_ATTR_INSTANCE_SHOW,
}; };
static size_t static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
find_smbios_instance_string(struct pci_dev *pdev, char *buf,
enum smbios_attr_enum attribute) enum smbios_attr_enum attribute)
{ {
const struct dmi_device *dmi; const struct dmi_device *dmi;
@ -74,9 +73,8 @@ find_smbios_instance_string(struct pci_dev *pdev, char *buf,
return 0; return 0;
} }
static umode_t static umode_t smbios_instance_string_exist(struct kobject *kobj,
smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr, struct attribute *attr, int n)
int n)
{ {
struct device *dev; struct device *dev;
struct pci_dev *pdev; struct pci_dev *pdev;
@ -88,8 +86,8 @@ smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
S_IRUGO : 0; S_IRUGO : 0;
} }
static ssize_t static ssize_t smbioslabel_show(struct device *dev,
smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
pdev = to_pci_dev(dev); pdev = to_pci_dev(dev);
@ -98,8 +96,7 @@ smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
SMBIOS_ATTR_LABEL_SHOW); SMBIOS_ATTR_LABEL_SHOW);
} }
static ssize_t static ssize_t smbiosinstance_show(struct device *dev,
smbiosinstance_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
@ -130,26 +127,22 @@ static struct attribute_group smbios_attr_group = {
.is_visible = smbios_instance_string_exist, .is_visible = smbios_instance_string_exist,
}; };
static int static int pci_create_smbiosname_file(struct pci_dev *pdev)
pci_create_smbiosname_file(struct pci_dev *pdev)
{ {
return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group); return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group);
} }
static void static void pci_remove_smbiosname_file(struct pci_dev *pdev)
pci_remove_smbiosname_file(struct pci_dev *pdev)
{ {
sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
} }
#else #else
static inline int static inline int pci_create_smbiosname_file(struct pci_dev *pdev)
pci_create_smbiosname_file(struct pci_dev *pdev)
{ {
return -1; return -1;
} }
static inline void static inline void pci_remove_smbiosname_file(struct pci_dev *pdev)
pci_remove_smbiosname_file(struct pci_dev *pdev)
{ {
} }
#endif #endif
@ -175,8 +168,8 @@ static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
buf[len] = '\n'; buf[len] = '\n';
} }
static int static int dsm_get_label(struct device *dev, char *buf,
dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) enum acpi_attr_enum attr)
{ {
acpi_handle handle; acpi_handle handle;
union acpi_object *obj, *tmp; union acpi_object *obj, *tmp;
@ -212,8 +205,7 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
return len; return len;
} }
static bool static bool device_has_dsm(struct device *dev)
device_has_dsm(struct device *dev)
{ {
acpi_handle handle; acpi_handle handle;
@ -225,8 +217,8 @@ device_has_dsm(struct device *dev)
1 << DEVICE_LABEL_DSM); 1 << DEVICE_LABEL_DSM);
} }
static umode_t static umode_t acpi_index_string_exist(struct kobject *kobj,
acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n) struct attribute *attr, int n)
{ {
struct device *dev; struct device *dev;
@ -238,14 +230,14 @@ acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
return 0; return 0;
} }
static ssize_t static ssize_t acpilabel_show(struct device *dev,
acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW); return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW);
} }
static ssize_t static ssize_t acpiindex_show(struct device *dev,
acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW); 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, .is_visible = acpi_index_string_exist,
}; };
static int static int pci_create_acpi_index_label_files(struct pci_dev *pdev)
pci_create_acpi_index_label_files(struct pci_dev *pdev)
{ {
return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group); return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group);
} }
static int static int pci_remove_acpi_index_label_files(struct pci_dev *pdev)
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
{ {
sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group);
return 0; return 0;
} }
#else #else
static inline int static inline int pci_create_acpi_index_label_files(struct pci_dev *pdev)
pci_create_acpi_index_label_files(struct pci_dev *pdev)
{ {
return -1; return -1;
} }
static inline int static inline int pci_remove_acpi_index_label_files(struct pci_dev *pdev)
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
{ {
return -1; return -1;
} }
static inline bool static inline bool device_has_dsm(struct device *dev)
device_has_dsm(struct device *dev)
{ {
return false; return false;
} }

View file

@ -77,10 +77,8 @@ static ssize_t broken_parity_status_store(struct device *dev,
} }
static DEVICE_ATTR_RW(broken_parity_status); static DEVICE_ATTR_RW(broken_parity_status);
static ssize_t pci_dev_show_local_cpu(struct device *dev, static ssize_t pci_dev_show_local_cpu(struct device *dev, int type,
int type, struct device_attribute *attr, char *buf)
struct device_attribute *attr,
char *buf)
{ {
const struct cpumask *mask; const struct cpumask *mask;
int len; int len;
@ -117,8 +115,7 @@ static DEVICE_ATTR_RO(local_cpulist);
/* /*
* PCI Bus Class Devices * PCI Bus Class Devices
*/ */
static ssize_t pci_bus_show_cpuaffinity(struct device *dev, static ssize_t pci_bus_show_cpuaffinity(struct device *dev, int type,
int type,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
@ -149,8 +146,8 @@ static ssize_t cpulistaffinity_show(struct device *dev,
static DEVICE_ATTR_RO(cpulistaffinity); static DEVICE_ATTR_RO(cpulistaffinity);
/* show resources */ /* show resources */
static ssize_t static ssize_t resource_show(struct device *dev, struct device_attribute *attr,
resource_show(struct device * dev, struct device_attribute *attr, char * buf) char *buf)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
char *str = buf; char *str = buf;
@ -175,7 +172,8 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
} }
static DEVICE_ATTR_RO(resource); 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); 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 DEVICE_ATTR_RO(modalias);
static ssize_t enabled_store(struct device *dev, static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
struct device_attribute *attr, const char *buf, const char *buf, size_t count)
size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
unsigned long val; unsigned long val;
@ -213,8 +210,8 @@ static ssize_t enabled_store(struct device *dev,
return result < 0 ? result : count; return result < 0 ? result : count;
} }
static ssize_t enabled_show(struct device *dev, static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
struct device_attribute *attr, char *buf) char *buf)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
@ -224,16 +221,16 @@ static ssize_t enabled_show(struct device *dev,
static DEVICE_ATTR_RW(enabled); static DEVICE_ATTR_RW(enabled);
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
static ssize_t static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr,
numa_node_show(struct device *dev, struct device_attribute *attr, char *buf) char *buf)
{ {
return sprintf(buf, "%d\n", dev->numa_node); return sprintf(buf, "%d\n", dev->numa_node);
} }
static DEVICE_ATTR_RO(numa_node); static DEVICE_ATTR_RO(numa_node);
#endif #endif
static ssize_t static ssize_t dma_mask_bits_show(struct device *dev,
dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct pci_dev *pdev = to_pci_dev(dev); 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 DEVICE_ATTR_RO(dma_mask_bits);
static ssize_t static ssize_t consistent_dma_mask_bits_show(struct device *dev,
consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%d\n", fls64(dev->coherent_dma_mask)); return sprintf(buf, "%d\n", fls64(dev->coherent_dma_mask));
} }
static DEVICE_ATTR_RO(consistent_dma_mask_bits); static DEVICE_ATTR_RO(consistent_dma_mask_bits);
static ssize_t static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr,
msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf) char *buf)
{ {
struct pci_dev *pdev = to_pci_dev(dev); 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)); !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI));
} }
static ssize_t static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
msi_bus_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
@ -331,9 +327,9 @@ const struct attribute_group *pci_bus_groups[] = {
NULL, NULL,
}; };
static ssize_t static ssize_t dev_rescan_store(struct device *dev,
dev_rescan_store(struct device *dev, struct device_attribute *attr, struct device_attribute *attr, const char *buf,
const char *buf, size_t count) size_t count)
{ {
unsigned long val; unsigned long val;
struct pci_dev *pdev = to_pci_dev(dev); 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), (S_IWUSR|S_IWGRP),
NULL, dev_rescan_store); NULL, dev_rescan_store);
static ssize_t static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
remove_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
@ -369,8 +364,8 @@ static struct device_attribute dev_remove_attr = __ATTR(remove,
(S_IWUSR|S_IWGRP), (S_IWUSR|S_IWGRP),
NULL, remove_store); NULL, remove_store);
static ssize_t static ssize_t dev_bus_rescan_store(struct device *dev,
dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
@ -607,8 +602,8 @@ const struct attribute_group *pcibus_groups[] = {
NULL, NULL,
}; };
static ssize_t static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr,
boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) char *buf)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct pci_dev *vga_dev = vga_default_device(); 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 struct device_attribute vga_attr = __ATTR_RO(boot_vga);
static ssize_t static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
pci_read_config(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
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; unsigned int size = 64;
loff_t init_off = off; loff_t init_off = off;
u8 *data = (u8 *) buf; u8 *data = (u8 *) buf;
/* Several chips lock up trying to read undefined config space */ /* 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; size = dev->cfg_size;
} else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
size = 128; size = 128;
}
if (off > size) if (off > size)
return 0; return 0;
@ -700,12 +694,12 @@ pci_read_config(struct file *filp, struct kobject *kobj,
return count; return count;
} }
static ssize_t static ssize_t pci_write_config(struct file *filp, struct kobject *kobj,
pci_write_config(struct file* filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
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; unsigned int size = count;
loff_t init_off = off; loff_t init_off = off;
u8 *data = (u8 *) buf; u8 *data = (u8 *) buf;
@ -762,10 +756,9 @@ pci_write_config(struct file* filp, struct kobject *kobj,
return count; return count;
} }
static ssize_t static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj,
read_vpd_attr(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *dev = struct pci_dev *dev =
to_pci_dev(container_of(kobj, struct device, kobj)); 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); return pci_read_vpd(dev, off, count, buf);
} }
static ssize_t static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj,
write_vpd_attr(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *dev = struct pci_dev *dev =
to_pci_dev(container_of(kobj, struct device, kobj)); 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 * Reads 1, 2, or 4 bytes from legacy I/O port space using an arch specific
* callback routine (pci_legacy_read). * callback routine (pci_legacy_read).
*/ */
static ssize_t static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj,
pci_read_legacy_io(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
char *buf, loff_t off, size_t count)
{ {
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
struct device,
kobj)); kobj));
/* Only support 1, 2 or 4 byte accesses */ /* 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 * Writes 1, 2, or 4 bytes from legacy I/O port space using an arch specific
* callback routine (pci_legacy_write). * callback routine (pci_legacy_write).
*/ */
static ssize_t static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj,
pci_write_legacy_io(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
char *buf, loff_t off, size_t count)
{ {
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
struct device,
kobj)); kobj));
/* Only support 1, 2 or 4 byte accesses */ /* Only support 1, 2 or 4 byte accesses */
if (count != 1 && count != 2 && count != 4) if (count != 1 && count != 2 && count != 4)
return -EINVAL; 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 * legacy memory space (first meg of bus space) into application virtual
* memory space. * memory space.
*/ */
static int static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, struct bin_attribute *attr,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
struct device,
kobj)); kobj));
return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem); 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 * legacy IO space (first meg of bus space) into application virtual
* memory space. Returns -ENOSYS if the operation isn't supported * memory space. Returns -ENOSYS if the operation isn't supported
*/ */
static int static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, struct bin_attribute *attr,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct pci_bus *bus = to_pci_bus(container_of(kobj, struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device,
struct device,
kobj)); kobj));
return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io); 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. * Stub implementation. Can be overridden by arch if necessary.
*/ */
void __weak void __weak pci_adjust_legacy_attr(struct pci_bus *b,
pci_adjust_legacy_attr(struct pci_bus *b, enum pci_mmap_state mmap_type) 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. * Use the regular PCI mapping routines to map a PCI resource into userspace.
*/ */
static int static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
struct vm_area_struct *vma, int write_combine) struct vm_area_struct *vma, int write_combine)
{ {
struct pci_dev *pdev = to_pci_dev(container_of(kobj, 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); return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
} }
static int static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, struct bin_attribute *attr,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
return pci_mmap_resource(kobj, attr, vma, 0); return pci_mmap_resource(kobj, attr, vma, 0);
} }
static int static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, struct bin_attribute *attr,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
return pci_mmap_resource(kobj, attr, vma, 1); return pci_mmap_resource(kobj, attr, vma, 1);
} }
static ssize_t static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
pci_resource_io(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf, struct bin_attribute *attr, char *buf,
loff_t off, size_t count, bool write) loff_t off, size_t count, bool write)
{ {
@ -1110,16 +1090,14 @@ pci_resource_io(struct file *filp, struct kobject *kobj,
return -EINVAL; return -EINVAL;
} }
static ssize_t static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
pci_read_resource_io(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf, struct bin_attribute *attr, char *buf,
loff_t off, size_t count) loff_t off, size_t count)
{ {
return pci_resource_io(filp, kobj, attr, buf, off, count, false); return pci_resource_io(filp, kobj, attr, buf, off, count, false);
} }
static ssize_t static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj,
pci_write_resource_io(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf, struct bin_attribute *attr, char *buf,
loff_t off, size_t count) 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 * If we created resource files for @pdev, remove them from sysfs and
* free their resources. * free their resources.
*/ */
static void static void pci_remove_resource_files(struct pci_dev *pdev)
pci_remove_resource_files(struct pci_dev *pdev)
{ {
int i; int i;
@ -1237,10 +1214,9 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
* *
* writing anything except 0 enables it * writing anything except 0 enables it
*/ */
static ssize_t static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj,
pci_write_rom(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); 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 * Put @count bytes starting at @off into @buf from the ROM in the PCI
* device corresponding to @kobj. * device corresponding to @kobj.
*/ */
static ssize_t static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj,
pci_read_rom(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf,
struct bin_attribute *bin_attr, loff_t off, size_t count)
char *buf, loff_t off, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
void __iomem *rom; void __iomem *rom;
@ -1313,9 +1288,8 @@ static struct bin_attribute pcie_config_attr = {
.write = pci_write_config, .write = pci_write_config,
}; };
static ssize_t reset_store(struct device *dev, static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
struct device_attribute *attr, const char *buf, const char *buf, size_t count)
size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
unsigned long val; unsigned long val;
@ -1520,7 +1494,6 @@ static int __init pci_sysfs_init(void)
return 0; return 0;
} }
late_initcall(pci_sysfs_init); late_initcall(pci_sysfs_init);
static struct attribute *pci_dev_dev_attrs[] = { static struct attribute *pci_dev_dev_attrs[] = {

View file

@ -405,8 +405,8 @@ EXPORT_SYMBOL_GPL(pci_find_ht_capability);
* For given resource region of given device, return the resource * For given resource region of given device, return the resource
* region of parent bus the given region is contained in. * region of parent bus the given region is contained in.
*/ */
struct resource * struct resource *pci_find_parent_resource(const struct pci_dev *dev,
pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) struct resource *res)
{ {
const struct pci_bus *bus = dev->bus; const struct pci_bus *bus = dev->bus;
struct resource *r; struct resource *r;
@ -473,8 +473,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask)
* Restore the BAR values for a given device, so as to make it * Restore the BAR values for a given device, so as to make it
* accessible by its driver. * accessible by its driver.
*/ */
static void static void pci_restore_bars(struct pci_dev *dev)
pci_restore_bars(struct pci_dev *dev)
{ {
int i; int i;
@ -888,12 +887,10 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
} }
return PCI_D0; return PCI_D0;
} }
EXPORT_SYMBOL(pci_choose_state); EXPORT_SYMBOL(pci_choose_state);
#define PCI_EXP_SAVE_REGS 7 #define PCI_EXP_SAVE_REGS 7
static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev, static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev,
u16 cap, bool extended) u16 cap, bool extended)
{ {
@ -1005,8 +1002,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
* pci_save_state - save the PCI configuration space of a device before suspending * pci_save_state - save the PCI configuration space of a device before suspending
* @dev: - PCI device that we're dealing with * @dev: - PCI device that we're dealing with
*/ */
int int pci_save_state(struct pci_dev *dev)
pci_save_state(struct pci_dev *dev)
{ {
int i; int i;
/* XXX: 100% dword access ok here? */ /* XXX: 100% dword access ok here? */
@ -1527,8 +1523,7 @@ void pci_disable_enabled_device(struct pci_dev *dev)
* Note we don't actually disable the device until all callers of * Note we don't actually disable the device until all callers of
* pci_enable_device() have called pci_disable_device(). * pci_enable_device() have called pci_disable_device().
*/ */
void void pci_disable_device(struct pci_dev *dev)
pci_disable_device(struct pci_dev *dev)
{ {
struct pci_devres *dr; struct pci_devres *dr;
@ -2434,8 +2429,7 @@ u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin)
return (((pin - 1) + slot) % 4) + 1; return (((pin - 1) + slot) % 4) + 1;
} }
int int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
{ {
u8 pin; u8 pin;
@ -2518,8 +2512,8 @@ EXPORT_SYMBOL(pci_release_region);
* Returns 0 on success, or %EBUSY on error. A warning * Returns 0 on success, or %EBUSY on error. A warning
* message is also printed on failure. * message is also printed on failure.
*/ */
static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name, static int __pci_request_region(struct pci_dev *pdev, int bar,
int exclusive) const char *res_name, int exclusive)
{ {
struct pci_devres *dr; struct pci_devres *dr;
@ -2530,8 +2524,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
if (!request_region(pci_resource_start(pdev, bar), if (!request_region(pci_resource_start(pdev, bar),
pci_resource_len(pdev, bar), res_name)) pci_resource_len(pdev, bar), res_name))
goto err_out; goto err_out;
} } else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
if (!__request_mem_region(pci_resource_start(pdev, bar), if (!__request_mem_region(pci_resource_start(pdev, bar),
pci_resource_len(pdev, bar), res_name, pci_resource_len(pdev, bar), res_name,
exclusive)) exclusive))
@ -2588,7 +2581,8 @@ EXPORT_SYMBOL(pci_request_region);
* explicitly not allowed to map the resource via /dev/mem or * explicitly not allowed to map the resource via /dev/mem or
* sysfs. * sysfs.
*/ */
int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name) int pci_request_region_exclusive(struct pci_dev *pdev, int bar,
const char *res_name)
{ {
return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE); return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
} }
@ -2645,8 +2639,8 @@ int pci_request_selected_regions(struct pci_dev *pdev, int bars,
} }
EXPORT_SYMBOL(pci_request_selected_regions); EXPORT_SYMBOL(pci_request_selected_regions);
int pci_request_selected_regions_exclusive(struct pci_dev *pdev, int pci_request_selected_regions_exclusive(struct pci_dev *pdev, int bars,
int bars, const char *res_name) const char *res_name)
{ {
return __pci_request_selected_regions(pdev, bars, res_name, return __pci_request_selected_regions(pdev, bars, res_name,
IORESOURCE_EXCLUSIVE); IORESOURCE_EXCLUSIVE);
@ -2836,8 +2830,7 @@ EXPORT_SYMBOL_GPL(pci_set_cacheline_size);
* *
* RETURNS: An appropriate -ERRNO error value on error, or zero for success. * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
*/ */
int int pci_set_mwi(struct pci_dev *dev)
pci_set_mwi(struct pci_dev *dev)
{ {
#ifdef PCI_DISABLE_MWI #ifdef PCI_DISABLE_MWI
return 0; return 0;
@ -2885,8 +2878,7 @@ EXPORT_SYMBOL(pci_try_set_mwi);
* *
* Disables PCI Memory-Write-Invalidate transaction on the device * Disables PCI Memory-Write-Invalidate transaction on the device
*/ */
void void pci_clear_mwi(struct pci_dev *dev)
pci_clear_mwi(struct pci_dev *dev)
{ {
#ifndef PCI_DISABLE_MWI #ifndef PCI_DISABLE_MWI
u16 cmd; u16 cmd;
@ -2907,18 +2899,16 @@ EXPORT_SYMBOL(pci_clear_mwi);
* *
* Enables/disables PCI INTx for device dev * Enables/disables PCI INTx for device dev
*/ */
void void pci_intx(struct pci_dev *pdev, int enable)
pci_intx(struct pci_dev *pdev, int enable)
{ {
u16 pci_command, new; u16 pci_command, new;
pci_read_config_word(pdev, PCI_COMMAND, &pci_command); pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
if (enable) { if (enable)
new = pci_command & ~PCI_COMMAND_INTX_DISABLE; new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
} else { else
new = pci_command | PCI_COMMAND_INTX_DISABLE; new = pci_command | PCI_COMMAND_INTX_DISABLE;
}
if (new != pci_command) { if (new != pci_command) {
struct pci_devres *dr; struct pci_devres *dr;
@ -4271,11 +4261,10 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
bus == dev->bus->number && bus == dev->bus->number &&
slot == PCI_SLOT(dev->devfn) && slot == PCI_SLOT(dev->devfn) &&
func == PCI_FUNC(dev->devfn)) { func == PCI_FUNC(dev->devfn)) {
if (align_order == -1) { if (align_order == -1)
align = PAGE_SIZE; align = PAGE_SIZE;
} else { else
align = 1 << align_order; align = 1 << align_order;
}
/* Found */ /* Found */
break; break;
} }
@ -4393,7 +4382,6 @@ static int __init pci_resource_alignment_sysfs_init(void)
return bus_create_file(&pci_bus_type, return bus_create_file(&pci_bus_type,
&bus_attr_resource_alignment); &bus_attr_resource_alignment);
} }
late_initcall(pci_resource_alignment_sysfs_init); late_initcall(pci_resource_alignment_sysfs_init);
static void pci_no_domains(void) static void pci_no_domains(void)

View file

@ -464,8 +464,7 @@ static int aer_inject(struct aer_error_inj *einj)
goto out_put; goto out_put;
} }
aer_irq(-1, edev); aer_irq(-1, edev);
} } else
else
ret = -EINVAL; ret = -EINVAL;
out_put: out_put:
kfree(err_alloc); kfree(err_alloc);

View file

@ -542,8 +542,7 @@ static void aer_recover_work_func(struct work_struct *work);
#define AER_RECOVER_RING_ORDER 4 #define AER_RECOVER_RING_ORDER 4
#define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER) #define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER)
struct aer_recover_entry struct aer_recover_entry {
{
u8 bus; u8 bus;
u8 devfn; u8 devfn;
u16 domain; u16 domain;

View file

@ -604,7 +604,6 @@ static enum pci_bus_speed agp_speed(int agp3, int agpstat)
return agp_speeds[index]; return agp_speeds[index];
} }
static void pci_set_bus_speed(struct pci_bus *bus) static void pci_set_bus_speed(struct pci_bus *bus)
{ {
struct pci_dev *bridge = bus->self; struct pci_dev *bridge = bus->self;
@ -636,11 +635,10 @@ static void pci_set_bus_speed(struct pci_bus *bus)
} else if (status & PCI_X_SSTATUS_266MHZ) { } else if (status & PCI_X_SSTATUS_266MHZ) {
max = PCI_SPEED_133MHz_PCIX_266; max = PCI_SPEED_133MHz_PCIX_266;
} else if (status & PCI_X_SSTATUS_133MHZ) { } else if (status & PCI_X_SSTATUS_133MHZ) {
if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) { if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2)
max = PCI_SPEED_133MHz_PCIX_ECC; max = PCI_SPEED_133MHz_PCIX_ECC;
} else { else
max = PCI_SPEED_133MHz_PCIX; max = PCI_SPEED_133MHz_PCIX;
}
} else { } else {
max = PCI_SPEED_66MHz_PCIX; max = PCI_SPEED_66MHz_PCIX;
} }
@ -664,7 +662,6 @@ static void pci_set_bus_speed(struct pci_bus *bus)
} }
} }
static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
struct pci_dev *bridge, int busnr) struct pci_dev *bridge, int busnr)
{ {
@ -729,7 +726,8 @@ add_dev:
return child; return child;
} }
struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
int busnr)
{ {
struct pci_bus *child; struct pci_bus *child;
@ -994,7 +992,6 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
pdev->is_hotplug_bridge = 1; pdev->is_hotplug_bridge = 1;
} }
/** /**
* pci_ext_cfg_is_aliased - is ext config space just an alias of std config? * pci_ext_cfg_is_aliased - is ext config space just an alias of std config?
* @dev: PCI device * @dev: PCI device
@ -2062,7 +2059,8 @@ void pci_unlock_rescan_remove(void)
} }
EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove); EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove);
static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b) static int __init pci_sort_bf_cmp(const struct device *d_a,
const struct device *d_b)
{ {
const struct pci_dev *a = to_pci_dev(d_a); const struct pci_dev *a = to_pci_dev(d_a);
const struct pci_dev *b = to_pci_dev(d_b); const struct pci_dev *b = to_pci_dev(d_b);

View file

@ -17,15 +17,14 @@
static int proc_initialized; /* = 0 */ static int proc_initialized; /* = 0 */
static loff_t static loff_t proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
{ {
struct pci_dev *dev = PDE_DATA(file_inode(file)); struct pci_dev *dev = PDE_DATA(file_inode(file));
return fixed_size_llseek(file, off, whence, dev->cfg_size); return fixed_size_llseek(file, off, whence, dev->cfg_size);
} }
static ssize_t static ssize_t proc_bus_pci_read(struct file *file, char __user *buf,
proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) size_t nbytes, loff_t *ppos)
{ {
struct pci_dev *dev = PDE_DATA(file_inode(file)); struct pci_dev *dev = PDE_DATA(file_inode(file));
unsigned int pos = *ppos; unsigned int pos = *ppos;
@ -108,8 +107,8 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp
return nbytes; return nbytes;
} }
static ssize_t static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf,
proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) size_t nbytes, loff_t *ppos)
{ {
struct inode *ino = file_inode(file); struct inode *ino = file_inode(file);
struct pci_dev *dev = PDE_DATA(ino); struct pci_dev *dev = PDE_DATA(ino);
@ -423,6 +422,7 @@ static int proc_bus_pci_dev_open(struct inode *inode, struct file *file)
{ {
return seq_open(file, &proc_bus_pci_devices_op); return seq_open(file, &proc_bus_pci_devices_op);
} }
static const struct file_operations proc_bus_pci_dev_operations = { static const struct file_operations proc_bus_pci_dev_operations = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = proc_bus_pci_dev_open, .open = proc_bus_pci_dev_open,
@ -443,6 +443,4 @@ static int __init pci_proc_init(void)
return 0; return 0;
} }
device_initcall(pci_proc_init); device_initcall(pci_proc_init);

View file

@ -967,6 +967,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA, 0x605, quirk_transparent_bridge)
static void quirk_mediagx_master(struct pci_dev *dev) static void quirk_mediagx_master(struct pci_dev *dev)
{ {
u8 reg; u8 reg;
pci_read_config_byte(dev, 0x41, &reg); pci_read_config_byte(dev, 0x41, &reg);
if (reg & 2) { if (reg & 2) {
reg &= ~2; reg &= ~2;
@ -1514,11 +1515,9 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)
/* The next five BARs all seem to be rubbish, so just clean /* The next five BARs all seem to be rubbish, so just clean
* them out */ * them out */
for (i=1; i < 6; i++) { for (i = 1; i < 6; i++)
memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); memset(&pdev->resource[i], 0, sizeof(pdev->resource[i]));
} }
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic);
#endif #endif
@ -2189,8 +2188,7 @@ static int msi_ht_cap_enabled(struct pci_dev *dev)
u8 flags; u8 flags;
if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
&flags) == 0) &flags) == 0) {
{
dev_info(&dev->dev, "Found %s HT MSI Mapping\n", dev_info(&dev->dev, "Found %s HT MSI Mapping\n",
flags & HT_MSI_FLAGS_ENABLE ? flags & HT_MSI_FLAGS_ENABLE ?
"enabled" : "disabled"); "enabled" : "disabled");

View file

@ -110,8 +110,7 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
* legacy PCI bridge and the bridge is directly connected to bus 0), return its * legacy PCI bridge and the bridge is directly connected to bus 0), return its
* parent * parent
*/ */
struct pci_dev * struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
{ {
struct pci_dev *tmp = NULL; struct pci_dev *tmp = NULL;
@ -188,8 +187,7 @@ EXPORT_SYMBOL(pci_find_bus);
* @from is not %NULL, searches continue from next device on the * @from is not %NULL, searches continue from next device on the
* global list. * global list.
*/ */
struct pci_bus * struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
pci_find_next_bus(const struct pci_bus *from)
{ {
struct list_head *n; struct list_head *n;
struct pci_bus *b = NULL; struct pci_bus *b = NULL;
@ -357,8 +355,8 @@ EXPORT_SYMBOL(pci_get_subsys);
* from next device on the global list. The reference count for @from is * from next device on the global list. The reference count for @from is
* always decremented if it is not %NULL. * always decremented if it is not %NULL.
*/ */
struct pci_dev * struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from) struct pci_dev *from)
{ {
return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
} }

View file

@ -68,7 +68,7 @@ static int add_to_list(struct list_head *head,
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
if (!tmp) { if (!tmp) {
pr_warning("add_to_list: kmalloc() failed!\n"); pr_warn("add_to_list: kmalloc() failed!\n");
return -ENOMEM; return -ENOMEM;
} }

View file

@ -22,8 +22,7 @@ void __weak pcibios_update_irq(struct pci_dev *dev, int irq)
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
} }
static void static void pdev_fixup_irq(struct pci_dev *dev,
pdev_fixup_irq(struct pci_dev *dev,
u8 (*swizzle)(struct pci_dev *, u8 *), u8 (*swizzle)(struct pci_dev *, u8 *),
int (*map_irq)(const struct pci_dev *, u8, u8)) int (*map_irq)(const struct pci_dev *, u8, u8))
{ {
@ -58,11 +57,11 @@ pdev_fixup_irq(struct pci_dev *dev,
pcibios_update_irq(dev, irq); pcibios_update_irq(dev, irq);
} }
void void pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *),
pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *),
int (*map_irq)(const struct pci_dev *, u8, u8)) int (*map_irq)(const struct pci_dev *, u8, u8))
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
for_each_pci_dev(dev) for_each_pci_dev(dev)
pdev_fixup_irq(dev, swizzle, map_irq); pdev_fixup_irq(dev, swizzle, map_irq);
} }