- Constify struct bin_attribute for sysfs, VPD, P2PDMA, and the IBM ACPI hotplug driver (Thomas Weißschuh) - Update PCI_EXP_LNKCAP_SLS comment (Lukas Wunner) - Drop superfluous pm_wakeup.h include (Wolfram Sang) - Remove redundant PCI_VSEC_HDR and PCI_VSEC_HDR_LEN_SHIFT (Dongdong Zhang) - Correct documentation of the 'config_acs=' kernel parameter (Akihiko Odaki) * pci/misc: Documentation: Fix pci=config_acs= example PCI: Remove redundant PCI_VSEC_HDR and PCI_VSEC_HDR_LEN_SHIFT PCI: Don't include 'pm_wakeup.h' directly PCI: Update code comment on PCI_EXP_LNKCAP_SLS for PCIe r3.0 PCI/ACPI: Constify 'struct bin_attribute' PCI/P2PDMA: Constify 'struct bin_attribute' PCI/VPD: Constify 'struct bin_attribute' PCI/sysfs: Constify 'struct bin_attribute'
Unified · Split
| @@ -4673,7 +4673,7 @@ · 4672 unmodified lines | ||
| 4673 | 4673 | '1' – force enabled |
| 4674 | 4674 | 'x' – unchanged |
| 4675 | 4675 | For example, |
| 4676 | − pci=config_acs=10x | |
| 4676 | + pci=config_acs=10x@pci:0:0 | |
| 4677 | 4677 | would configure all devices that support |
| 4678 | 4678 | ACS to enable P2P Request Redirect, disable |
| 4679 | 4679 | Translation Blocking, and leave Source |
| @@ -84,7 +84,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status); · 83 unmodified lines | ||
| 84 | 84 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context); |
| 85 | 85 | static int ibm_get_table_from_acpi(char **bufp); |
| 86 | 86 | static ssize_t ibm_read_apci_table(struct file *filp, struct kobject *kobj, |
| 87 | − struct bin_attribute *bin_attr, | |
| 87 | + const struct bin_attribute *bin_attr, | |
| 88 | 88 | char *buffer, loff_t pos, size_t size); |
| 89 | 89 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, |
| 90 | 90 | u32 lvl, void *context, void **rv); |
| @@ -98,7 +98,7 @@ static struct bin_attribute ibm_apci_table_attr __ro_after_init = { · 7 unmodified lines | ||
| 98 | 98 | .name = "apci_table", |
| 99 | 99 | .mode = S_IRUGO, |
| 100 | 100 | }, |
| 101 | − .read = ibm_read_apci_table, | |
| 101 | + .read_new = ibm_read_apci_table, | |
| 102 | 102 | .write = NULL, |
| 103 | 103 | }; |
| 104 | 104 | static struct acpiphp_attention_info ibm_attention_info = |
| @@ -353,7 +353,7 @@ read_table_done: · 248 unmodified lines | ||
| 353 | 353 | * our solution is to only allow reading the table in all at once. |
| 354 | 354 | */ |
| 355 | 355 | static ssize_t ibm_read_apci_table(struct file *filp, struct kobject *kobj, |
| 356 | − struct bin_attribute *bin_attr, | |
| 356 | + const struct bin_attribute *bin_attr, | |
| 357 | 357 | char *buffer, loff_t pos, size_t size) |
| 358 | 358 | { |
| 359 | 359 | int bytes_read = -EINVAL; |
| @@ -161,7 +161,7 @@ out: · 160 unmodified lines | ||
| 161 | 161 | return ret; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | −static struct bin_attribute p2pmem_alloc_attr = { | |
| 164 | +static const struct bin_attribute p2pmem_alloc_attr = { | |
| 165 | 165 | .attr = { .name = "allocate", .mode = 0660 }, |
| 166 | 166 | .mmap = p2pmem_alloc_mmap, |
| 167 | 167 | /* |
| @@ -180,14 +180,14 @@ static struct attribute *p2pmem_attrs[] = { · 12 unmodified lines | ||
| 180 | 180 | NULL, |
| 181 | 181 | }; |
| 182 | 182 | |
| 183 | −static struct bin_attribute *p2pmem_bin_attrs[] = { | |
| 183 | +static const struct bin_attribute *const p2pmem_bin_attrs[] = { | |
| 184 | 184 | &p2pmem_alloc_attr, |
| 185 | 185 | NULL, |
| 186 | 186 | }; |
| 187 | 187 | |
| 188 | 188 | static const struct attribute_group p2pmem_group = { |
| 189 | 189 | .attrs = p2pmem_attrs, |
| 190 | − .bin_attrs = p2pmem_bin_attrs, | |
| 190 | + .bin_attrs_new = p2pmem_bin_attrs, | |
| 191 | 191 | .name = "p2pmem", |
| 192 | 192 | }; |
| 193 | 193 | |
| @@ -695,7 +695,7 @@ static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr, · 694 unmodified lines | ||
| 695 | 695 | static DEVICE_ATTR_RO(boot_vga); |
| 696 | 696 | |
| 697 | 697 | static ssize_t pci_read_config(struct file *filp, struct kobject *kobj, |
| 698 | − struct bin_attribute *bin_attr, char *buf, | |
| 698 | + const struct bin_attribute *bin_attr, char *buf, | |
| 699 | 699 | loff_t off, size_t count) |
| 700 | 700 | { |
| 701 | 701 | struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj)); |
| @@ -770,7 +770,7 @@ static ssize_t pci_read_config(struct file *filp, struct kobject *kobj, · 68 unmodified lines | ||
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | static ssize_t pci_write_config(struct file *filp, struct kobject *kobj, |
| 773 | − struct bin_attribute *bin_attr, char *buf, | |
| 773 | + const struct bin_attribute *bin_attr, char *buf, | |
| 774 | 774 | loff_t off, size_t count) |
| 775 | 775 | { |
| 776 | 776 | struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj)); |
| @@ -838,9 +838,9 @@ static ssize_t pci_write_config(struct file *filp, struct kobject *kobj, · 61 unmodified lines | ||
| 838 | 838 | |
| 839 | 839 | return count; |
| 840 | 840 | } |
| 841 | −static BIN_ATTR(config, 0644, pci_read_config, pci_write_config, 0); | |
| 841 | +static const BIN_ATTR(config, 0644, pci_read_config, pci_write_config, 0); | |
| 842 | 842 | |
| 843 | −static struct bin_attribute *pci_dev_config_attrs[] = { | |
| 843 | +static const struct bin_attribute *const pci_dev_config_attrs[] = { | |
| 844 | 844 | &bin_attr_config, |
| 845 | 845 | NULL, |
| 846 | 846 | }; |
| @@ -857,7 +857,7 @@ static size_t pci_dev_config_attr_bin_size(struct kobject *kobj, · 10 unmodified lines | ||
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | static const struct attribute_group pci_dev_config_attr_group = { |
| 860 | − .bin_attrs = pci_dev_config_attrs, | |
| 860 | + .bin_attrs_new = pci_dev_config_attrs, | |
| 861 | 861 | .bin_size = pci_dev_config_attr_bin_size, |
| 862 | 862 | }; |
| 863 | 863 | |
| @@ -888,8 +888,8 @@ pci_llseek_resource(struct file *filep, · 24 unmodified lines | ||
| 888 | 888 | * callback routine (pci_legacy_read). |
| 889 | 889 | */ |
| 890 | 890 | static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj, |
| 891 | − struct bin_attribute *bin_attr, char *buf, | |
| 892 | − loff_t off, size_t count) | |
| 891 | + const struct bin_attribute *bin_attr, | |
| 892 | + char *buf, loff_t off, size_t count) | |
| 893 | 893 | { |
| 894 | 894 | struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj)); |
| 895 | 895 | |
| @@ -913,8 +913,8 @@ static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj, · 17 unmodified lines | ||
| 913 | 913 | * callback routine (pci_legacy_write). |
| 914 | 914 | */ |
| 915 | 915 | static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj, |
| 916 | − struct bin_attribute *bin_attr, char *buf, | |
| 917 | − loff_t off, size_t count) | |
| 916 | + const struct bin_attribute *bin_attr, | |
| 917 | + char *buf, loff_t off, size_t count) | |
| 918 | 918 | { |
| 919 | 919 | struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj)); |
| 920 | 920 | |
| @@ -1004,8 +1004,8 @@ void pci_create_legacy_files(struct pci_bus *b) · 83 unmodified lines | ||
| 1004 | 1004 | b->legacy_io->attr.name = "legacy_io"; |
| 1005 | 1005 | b->legacy_io->size = 0xffff; |
| 1006 | 1006 | b->legacy_io->attr.mode = 0600; |
| 1007 | − b->legacy_io->read = pci_read_legacy_io; | |
| 1008 | − b->legacy_io->write = pci_write_legacy_io; | |
| 1007 | + b->legacy_io->read_new = pci_read_legacy_io; | |
| 1008 | + b->legacy_io->write_new = pci_write_legacy_io; | |
| 1009 | 1009 | /* See pci_create_attr() for motivation */ |
| 1010 | 1010 | b->legacy_io->llseek = pci_llseek_resource; |
| 1011 | 1011 | b->legacy_io->mmap = pci_mmap_legacy_io; |
| @@ -1100,7 +1100,7 @@ static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, · 88 unmodified lines | ||
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, |
| 1103 | − struct bin_attribute *attr, char *buf, | |
| 1103 | + const struct bin_attribute *attr, char *buf, | |
| 1104 | 1104 | loff_t off, size_t count, bool write) |
| 1105 | 1105 | { |
| 1106 | 1106 | #ifdef CONFIG_HAS_IOPORT |
| @@ -1143,14 +1143,14 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, · 36 unmodified lines | ||
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj, |
| 1146 | − struct bin_attribute *attr, char *buf, | |
| 1146 | + const struct bin_attribute *attr, char *buf, | |
| 1147 | 1147 | loff_t off, size_t count) |
| 1148 | 1148 | { |
| 1149 | 1149 | return pci_resource_io(filp, kobj, attr, buf, off, count, false); |
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj, |
| 1153 | − struct bin_attribute *attr, char *buf, | |
| 1153 | + const struct bin_attribute *attr, char *buf, | |
| 1154 | 1154 | loff_t off, size_t count) |
| 1155 | 1155 | { |
| 1156 | 1156 | int ret; |
| @@ -1211,8 +1211,8 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine) · 54 unmodified lines | ||
| 1211 | 1211 | } else { |
| 1212 | 1212 | sprintf(res_attr_name, "resource%d", num); |
| 1213 | 1213 | if (pci_resource_flags(pdev, num) & IORESOURCE_IO) { |
| 1214 | − res_attr->read = pci_read_resource_io; | |
| 1215 | − res_attr->write = pci_write_resource_io; | |
| 1214 | + res_attr->read_new = pci_read_resource_io; | |
| 1215 | + res_attr->write_new = pci_write_resource_io; | |
| 1216 | 1216 | if (arch_can_pci_mmap_io()) |
| 1217 | 1217 | res_attr->mmap = pci_mmap_resource_uc; |
| 1218 | 1218 | } else { |
| @@ -1293,7 +1293,7 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; } · 74 unmodified lines | ||
| 1293 | 1293 | * writing anything except 0 enables it |
| 1294 | 1294 | */ |
| 1295 | 1295 | static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj, |
| 1296 | − struct bin_attribute *bin_attr, char *buf, | |
| 1296 | + const struct bin_attribute *bin_attr, char *buf, | |
| 1297 | 1297 | loff_t off, size_t count) |
| 1298 | 1298 | { |
| 1299 | 1299 | struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); |
| @@ -1319,7 +1319,7 @@ static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj, · 19 unmodified lines | ||
| 1319 | 1319 | * device corresponding to @kobj. |
| 1320 | 1320 | */ |
| 1321 | 1321 | static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj, |
| 1322 | − struct bin_attribute *bin_attr, char *buf, | |
| 1322 | + const struct bin_attribute *bin_attr, char *buf, | |
| 1323 | 1323 | loff_t off, size_t count) |
| 1324 | 1324 | { |
| 1325 | 1325 | struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); |
| @@ -1345,9 +1345,9 @@ static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj, · 19 unmodified lines | ||
| 1345 | 1345 | |
| 1346 | 1346 | return count; |
| 1347 | 1347 | } |
| 1348 | −static BIN_ATTR(rom, 0600, pci_read_rom, pci_write_rom, 0); | |
| 1348 | +static const BIN_ATTR(rom, 0600, pci_read_rom, pci_write_rom, 0); | |
| 1349 | 1349 | |
| 1350 | −static struct bin_attribute *pci_dev_rom_attrs[] = { | |
| 1350 | +static const struct bin_attribute *const pci_dev_rom_attrs[] = { | |
| 1351 | 1351 | &bin_attr_rom, |
| 1352 | 1352 | NULL, |
| 1353 | 1353 | }; |
| @@ -1373,7 +1373,7 @@ static size_t pci_dev_rom_attr_bin_size(struct kobject *kobj, · 19 unmodified lines | ||
| 1373 | 1373 | } |
| 1374 | 1374 | |
| 1375 | 1375 | static const struct attribute_group pci_dev_rom_attr_group = { |
| 1376 | − .bin_attrs = pci_dev_rom_attrs, | |
| 1376 | + .bin_attrs_new = pci_dev_rom_attrs, | |
| 1377 | 1377 | .is_bin_visible = pci_dev_rom_attr_is_visible, |
| 1378 | 1378 | .bin_size = pci_dev_rom_attr_bin_size, |
| 1379 | 1379 | }; |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/string.h> |
| 24 | 24 | #include <linux/log2.h> |
| 25 | 25 | #include <linux/logic_pio.h> |
| 26 | −#include <linux/pm_wakeup.h> | |
| 27 | 26 | #include <linux/device.h> |
| 28 | 27 | #include <linux/pm_runtime.h> |
| 29 | 28 | #include <linux/pci_hotplug.h> |
| @@ -271,8 +271,8 @@ void pci_vpd_init(struct pci_dev *dev) · 270 unmodified lines | ||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | static ssize_t vpd_read(struct file *filp, struct kobject *kobj, |
| 274 | − struct bin_attribute *bin_attr, char *buf, loff_t off, | |
| 275 | − size_t count) | |
| 274 | + const struct bin_attribute *bin_attr, char *buf, | |
| 275 | + loff_t off, size_t count) | |
| 276 | 276 | { |
| 277 | 277 | struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj)); |
| 278 | 278 | struct pci_dev *vpd_dev = dev; |
| @@ -295,8 +295,8 @@ static ssize_t vpd_read(struct file *filp, struct kobject *kobj, · 16 unmodified lines | ||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | static ssize_t vpd_write(struct file *filp, struct kobject *kobj, |
| 298 | − struct bin_attribute *bin_attr, char *buf, loff_t off, | |
| 299 | − size_t count) | |
| 298 | + const struct bin_attribute *bin_attr, char *buf, | |
| 299 | + loff_t off, size_t count) | |
| 300 | 300 | { |
| 301 | 301 | struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj)); |
| 302 | 302 | struct pci_dev *vpd_dev = dev; |
| @@ -317,9 +317,9 @@ static ssize_t vpd_write(struct file *filp, struct kobject *kobj, · 14 unmodified lines | ||
| 317 | 317 | |
| 318 | 318 | return ret; |
| 319 | 319 | } |
| 320 | −static BIN_ATTR(vpd, 0600, vpd_read, vpd_write, 0); | |
| 320 | +static const BIN_ATTR(vpd, 0600, vpd_read, vpd_write, 0); | |
| 321 | 321 | |
| 322 | −static struct bin_attribute *vpd_attrs[] = { | |
| 322 | +static const struct bin_attribute *const vpd_attrs[] = { | |
| 323 | 323 | &bin_attr_vpd, |
| 324 | 324 | NULL, |
| 325 | 325 | }; |
| @@ -336,7 +336,7 @@ static umode_t vpd_attr_is_visible(struct kobject *kobj, · 10 unmodified lines | ||
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | const struct attribute_group pci_dev_vpd_attr_group = { |
| 339 | − .bin_attrs = vpd_attrs, | |
| 339 | + .bin_attrs_new = vpd_attrs, | |
| 340 | 340 | .is_bin_visible = vpd_attr_is_visible, |
| 341 | 341 | }; |
| 342 | 342 | |
| @@ -1389,11 +1389,12 @@ static int vfio_ext_cap_len(struct vfio_pci_core_device *vdev, u16 ecap, u16 epo · 1388 unmodified lines | ||
| 1389 | 1389 | |
| 1390 | 1390 | switch (ecap) { |
| 1391 | 1391 | case PCI_EXT_CAP_ID_VNDR: |
| 1392 | − ret = pci_read_config_dword(pdev, epos + PCI_VSEC_HDR, &dword); | |
| 1392 | + ret = pci_read_config_dword(pdev, epos + PCI_VNDR_HEADER, | |
| 1393 | + &dword); | |
| 1393 | 1394 | if (ret) |
| 1394 | 1395 | return pcibios_err_to_errno(ret); |
| 1395 | 1396 | |
| 1396 | − return dword >> PCI_VSEC_HDR_LEN_SHIFT; | |
| 1397 | + return PCI_VNDR_HEADER_LEN(dword); | |
| 1397 | 1398 | case PCI_EXT_CAP_ID_VC: |
| 1398 | 1399 | case PCI_EXT_CAP_ID_VC9: |
| 1399 | 1400 | case PCI_EXT_CAP_ID_MFVC: |
| @@ -533,7 +533,7 @@ · 532 unmodified lines | ||
| 533 | 533 | #define PCI_EXP_DEVSTA_TRPND 0x0020 /* Transactions Pending */ |
| 534 | 534 | #define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V1 12 /* v1 endpoints without link end here */ |
| 535 | 535 | #define PCI_EXP_LNKCAP 0x0c /* Link Capabilities */ |
| 536 | −#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ | |
| 536 | +#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Max Link Speed (prior to PCIe r3.0: Supported Link Speeds) */ | |
| 537 | 537 | #define PCI_EXP_LNKCAP_SLS_2_5GB 0x00000001 /* LNKCAP2 SLS Vector bit 0 */ |
| 538 | 538 | #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */ |
| 539 | 539 | #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */ |
| @@ -1004,9 +1004,6 @@ · 464 unmodified lines | ||
| 1004 | 1004 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ |
| 1005 | 1005 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ |
| 1006 | 1006 | |
| 1007 | −#define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */ | |
| 1008 | −#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */ | |
| 1009 | − | |
| 1010 | 1007 | /* SATA capability */ |
| 1011 | 1008 | #define PCI_SATA_REGS 4 /* SATA REGs specifier */ |
| 1012 | 1009 | #define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */ |