Commit 8b28a3f3 authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/misc'

- Remove unnecessary #includes (Gustavo Pimentel)

- Fix intel_mid_pci.c build error when !CONFIG_ACPI (Randy Dunlap)

- Use scnprintf(), not snprintf(), in sysfs "show" functions (Krzysztof
  Wilczyński)

- Simplify pci-pf-stub by using module_pci_driver() (Liu Shixin)

- Print IRQ used by Link Bandwidth Notification (Dongdong Liu)

- Update sysfs mmap-related #ifdef comments (Clint Sbisa)

- Simplify pci_dev_reset_slot_function() (Lukas Wunner)

- Use "NULL" instead of "0" to fix sparse warnings (Gustavo Pimentel)

- Simplify bool comparisons (Krzysztof Wilczyński)

- Drop double zeroing for P2PDMA sg_init_table() (Julia Lawall)

* pci/misc:
  PCI: v3-semi: Remove unneeded break
  PCI/P2PDMA: Drop double zeroing for sg_init_table()
  PCI: Simplify bool comparisons
  PCI: endpoint: Use "NULL" instead of "0" as a NULL pointer
  PCI: Simplify pci_dev_reset_slot_function()
  PCI: Update mmap-related #ifdef comments
  PCI/LINK: Print IRQ number used by port
  PCI/IOV: Simplify pci-pf-stub with module_pci_driver()
  PCI: Use scnprintf(), not snprintf(), in sysfs "show" functions
  x86/PCI: Fix intel_mid_pci.c build error when ACPI is not enabled
  PCI: Remove unnecessary header includes
parents 0d2493ab 58e0cd3e
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
#include <asm/io_apic.h> #include <asm/io_apic.h>
#include <asm/intel-mid.h> #include <asm/intel-mid.h>
#include <asm/acpi.h>
#define PCIE_CAP_OFFSET 0x100 #define PCIE_CAP_OFFSET 0x100
......
...@@ -658,7 +658,6 @@ static int v3_get_dma_range_config(struct v3_pci *v3, ...@@ -658,7 +658,6 @@ static int v3_get_dma_range_config(struct v3_pci *v3,
default: default:
dev_err(v3->dev, "illegal dma memory chunk size\n"); dev_err(v3->dev, "illegal dma memory chunk size\n");
return -EINVAL; return -EINVAL;
break;
} }
val |= V3_PCI_MAP_M_REG_EN | V3_PCI_MAP_M_ENABLE; val |= V3_PCI_MAP_M_REG_EN | V3_PCI_MAP_M_ENABLE;
*pci_map = val; *pci_map = val;
......
...@@ -53,7 +53,7 @@ static ssize_t size_show(struct device *dev, struct device_attribute *attr, ...@@ -53,7 +53,7 @@ static ssize_t size_show(struct device *dev, struct device_attribute *attr,
if (pdev->p2pdma->pool) if (pdev->p2pdma->pool)
size = gen_pool_size(pdev->p2pdma->pool); size = gen_pool_size(pdev->p2pdma->pool);
return snprintf(buf, PAGE_SIZE, "%zd\n", size); return scnprintf(buf, PAGE_SIZE, "%zd\n", size);
} }
static DEVICE_ATTR_RO(size); static DEVICE_ATTR_RO(size);
...@@ -66,7 +66,7 @@ static ssize_t available_show(struct device *dev, struct device_attribute *attr, ...@@ -66,7 +66,7 @@ static ssize_t available_show(struct device *dev, struct device_attribute *attr,
if (pdev->p2pdma->pool) if (pdev->p2pdma->pool)
avail = gen_pool_avail(pdev->p2pdma->pool); avail = gen_pool_avail(pdev->p2pdma->pool);
return snprintf(buf, PAGE_SIZE, "%zd\n", avail); return scnprintf(buf, PAGE_SIZE, "%zd\n", avail);
} }
static DEVICE_ATTR_RO(available); static DEVICE_ATTR_RO(available);
...@@ -75,7 +75,7 @@ static ssize_t published_show(struct device *dev, struct device_attribute *attr, ...@@ -75,7 +75,7 @@ static ssize_t published_show(struct device *dev, struct device_attribute *attr,
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", return scnprintf(buf, PAGE_SIZE, "%d\n",
pdev->p2pdma->p2pmem_published); pdev->p2pdma->p2pmem_published);
} }
static DEVICE_ATTR_RO(published); static DEVICE_ATTR_RO(published);
...@@ -761,7 +761,7 @@ struct scatterlist *pci_p2pmem_alloc_sgl(struct pci_dev *pdev, ...@@ -761,7 +761,7 @@ struct scatterlist *pci_p2pmem_alloc_sgl(struct pci_dev *pdev,
struct scatterlist *sg; struct scatterlist *sg;
void *addr; void *addr;
sg = kzalloc(sizeof(*sg), GFP_KERNEL); sg = kmalloc(sizeof(*sg), GFP_KERNEL);
if (!sg) if (!sg)
return NULL; return NULL;
......
...@@ -37,18 +37,6 @@ static struct pci_driver pf_stub_driver = { ...@@ -37,18 +37,6 @@ static struct pci_driver pf_stub_driver = {
.probe = pci_pf_stub_probe, .probe = pci_pf_stub_probe,
.sriov_configure = pci_sriov_configure_simple, .sriov_configure = pci_sriov_configure_simple,
}; };
module_pci_driver(pf_stub_driver);
static int __init pci_pf_stub_init(void)
{
return pci_register_driver(&pf_stub_driver);
}
static void __exit pci_pf_stub_exit(void)
{
pci_unregister_driver(&pf_stub_driver);
}
module_init(pci_pf_stub_init);
module_exit(pci_pf_stub_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -574,7 +574,7 @@ static ssize_t driver_override_show(struct device *dev, ...@@ -574,7 +574,7 @@ static ssize_t driver_override_show(struct device *dev,
ssize_t len; ssize_t len;
device_lock(dev); device_lock(dev);
len = snprintf(buf, PAGE_SIZE, "%s\n", pdev->driver_override); len = scnprintf(buf, PAGE_SIZE, "%s\n", pdev->driver_override);
device_unlock(dev); device_unlock(dev);
return len; return len;
} }
...@@ -1197,10 +1197,10 @@ static int pci_create_resource_files(struct pci_dev *pdev) ...@@ -1197,10 +1197,10 @@ static int pci_create_resource_files(struct pci_dev *pdev)
} }
return 0; return 0;
} }
#else /* !HAVE_PCI_MMAP */ #else /* !(defined(HAVE_PCI_MMAP) || defined(ARCH_GENERIC_PCI_MMAP_RESOURCE)) */
int __weak pci_create_resource_files(struct pci_dev *dev) { return 0; } int __weak pci_create_resource_files(struct pci_dev *dev) { return 0; }
void __weak pci_remove_resource_files(struct pci_dev *dev) { return; } void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
#endif /* HAVE_PCI_MMAP */ #endif
/** /**
* pci_write_rom - used to enable access to the PCI ROM display * pci_write_rom - used to enable access to the PCI ROM display
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/msi.h> #include <linux/msi.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_pci.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -30,8 +29,6 @@ ...@@ -30,8 +29,6 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/pci_hotplug.h> #include <linux/pci_hotplug.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/pci-ats.h>
#include <asm/setup.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <linux/aer.h> #include <linux/aer.h>
#include "pci.h" #include "pci.h"
...@@ -4935,16 +4932,10 @@ static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe) ...@@ -4935,16 +4932,10 @@ static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe)
static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe)
{ {
struct pci_dev *pdev; if (dev->multifunction || dev->subordinate || !dev->slot ||
if (dev->subordinate || !dev->slot ||
dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET)
return -ENOTTY; return -ENOTTY;
list_for_each_entry(pdev, &dev->bus->devices, bus_list)
if (pdev != dev && pdev->slot == dev->slot)
return -ENOTTY;
return pci_reset_hotplug_slot(dev->slot->hotplug, probe); return pci_reset_hotplug_slot(dev->slot->hotplug, probe);
} }
...@@ -6020,7 +6011,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, ...@@ -6020,7 +6011,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
if (flags & PCI_VGA_STATE_CHANGE_DECODES) { if (flags & PCI_VGA_STATE_CHANGE_DECODES) {
pci_read_config_word(dev, PCI_COMMAND, &cmd); pci_read_config_word(dev, PCI_COMMAND, &cmd);
if (decode == true) if (decode)
cmd |= command_bits; cmd |= command_bits;
else else
cmd &= ~command_bits; cmd &= ~command_bits;
...@@ -6036,7 +6027,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, ...@@ -6036,7 +6027,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
if (bridge) { if (bridge) {
pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
&cmd); &cmd);
if (decode == true) if (decode)
cmd |= PCI_BRIDGE_CTL_VGA; cmd |= PCI_BRIDGE_CTL_VGA;
else else
cmd &= ~PCI_BRIDGE_CTL_VGA; cmd &= ~PCI_BRIDGE_CTL_VGA;
...@@ -6365,7 +6356,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf) ...@@ -6365,7 +6356,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf)
spin_lock(&resource_alignment_lock); spin_lock(&resource_alignment_lock);
if (resource_alignment_param) if (resource_alignment_param)
count = snprintf(buf, PAGE_SIZE, "%s", resource_alignment_param); count = scnprintf(buf, PAGE_SIZE, "%s", resource_alignment_param);
spin_unlock(&resource_alignment_lock); spin_unlock(&resource_alignment_lock);
/* /*
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* and warns when links become degraded in operation. * and warns when links become degraded in operation.
*/ */
#define dev_fmt(fmt) "bw_notification: " fmt
#include "../pci.h" #include "../pci.h"
#include "portdrv.h" #include "portdrv.h"
...@@ -97,6 +99,7 @@ static int pcie_bandwidth_notification_probe(struct pcie_device *srv) ...@@ -97,6 +99,7 @@ static int pcie_bandwidth_notification_probe(struct pcie_device *srv)
return ret; return ret;
pcie_enable_link_bandwidth_notification(srv->port); pcie_enable_link_bandwidth_notification(srv->port);
pci_info(srv->port, "enabled with IRQ %d\n", srv->irq);
return 0; return 0;
} }
......
...@@ -19,7 +19,7 @@ void pci_ep_cfs_remove_epf_group(struct config_group *group); ...@@ -19,7 +19,7 @@ void pci_ep_cfs_remove_epf_group(struct config_group *group);
#else #else
static inline struct config_group *pci_ep_cfs_add_epc_group(const char *name) static inline struct config_group *pci_ep_cfs_add_epc_group(const char *name)
{ {
return 0; return NULL;
} }
static inline void pci_ep_cfs_remove_epc_group(struct config_group *group) static inline void pci_ep_cfs_remove_epc_group(struct config_group *group)
...@@ -28,7 +28,7 @@ static inline void pci_ep_cfs_remove_epc_group(struct config_group *group) ...@@ -28,7 +28,7 @@ static inline void pci_ep_cfs_remove_epc_group(struct config_group *group)
static inline struct config_group *pci_ep_cfs_add_epf_group(const char *name) static inline struct config_group *pci_ep_cfs_add_epf_group(const char *name)
{ {
return 0; return NULL;
} }
static inline void pci_ep_cfs_remove_epf_group(struct config_group *group) static inline void pci_ep_cfs_remove_epf_group(struct config_group *group)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment