Skip to content

Commit 10ff5bb

Browse files
committed
Merge branch 'pci/misc'
- 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'
2 parents 4d3bf4e + b388fac commit 10ff5bb

File tree

8 files changed

+39
-42
lines changed

8 files changed

+39
-42
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4673,7 +4673,7 @@
46734673
'1' – force enabled
46744674
'x' – unchanged
46754675
For example,
4676-
pci=config_acs=10x
4676+
pci=config_acs=10x@pci:0:0
46774677
would configure all devices that support
46784678
ACS to enable P2P Request Redirect, disable
46794679
Translation Blocking, and leave Source

drivers/pci/hotplug/acpiphp_ibm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status);
8484
static void ibm_handle_events(acpi_handle handle, u32 event, void *context);
8585
static int ibm_get_table_from_acpi(char **bufp);
8686
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,
8888
char *buffer, loff_t pos, size_t size);
8989
static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
9090
u32 lvl, void *context, void **rv);
@@ -98,7 +98,7 @@ static struct bin_attribute ibm_apci_table_attr __ro_after_init = {
9898
.name = "apci_table",
9999
.mode = S_IRUGO,
100100
},
101-
.read = ibm_read_apci_table,
101+
.read_new = ibm_read_apci_table,
102102
.write = NULL,
103103
};
104104
static struct acpiphp_attention_info ibm_attention_info =
@@ -353,7 +353,7 @@ static int ibm_get_table_from_acpi(char **bufp)
353353
* our solution is to only allow reading the table in all at once.
354354
*/
355355
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,
357357
char *buffer, loff_t pos, size_t size)
358358
{
359359
int bytes_read = -EINVAL;

drivers/pci/p2pdma.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int p2pmem_alloc_mmap(struct file *filp, struct kobject *kobj,
161161
return ret;
162162
}
163163

164-
static struct bin_attribute p2pmem_alloc_attr = {
164+
static const struct bin_attribute p2pmem_alloc_attr = {
165165
.attr = { .name = "allocate", .mode = 0660 },
166166
.mmap = p2pmem_alloc_mmap,
167167
/*
@@ -180,14 +180,14 @@ static struct attribute *p2pmem_attrs[] = {
180180
NULL,
181181
};
182182

183-
static struct bin_attribute *p2pmem_bin_attrs[] = {
183+
static const struct bin_attribute *const p2pmem_bin_attrs[] = {
184184
&p2pmem_alloc_attr,
185185
NULL,
186186
};
187187

188188
static const struct attribute_group p2pmem_group = {
189189
.attrs = p2pmem_attrs,
190-
.bin_attrs = p2pmem_bin_attrs,
190+
.bin_attrs_new = p2pmem_bin_attrs,
191191
.name = "p2pmem",
192192
};
193193

drivers/pci/pci-sysfs.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr,
695695
static DEVICE_ATTR_RO(boot_vga);
696696

697697
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,
699699
loff_t off, size_t count)
700700
{
701701
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,
770770
}
771771

772772
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,
774774
loff_t off, size_t count)
775775
{
776776
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,
838838

839839
return count;
840840
}
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);
842842

843-
static struct bin_attribute *pci_dev_config_attrs[] = {
843+
static const struct bin_attribute *const pci_dev_config_attrs[] = {
844844
&bin_attr_config,
845845
NULL,
846846
};
@@ -857,7 +857,7 @@ static size_t pci_dev_config_attr_bin_size(struct kobject *kobj,
857857
}
858858

859859
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,
861861
.bin_size = pci_dev_config_attr_bin_size,
862862
};
863863

@@ -888,8 +888,8 @@ pci_llseek_resource(struct file *filep,
888888
* callback routine (pci_legacy_read).
889889
*/
890890
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)
893893
{
894894
struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj));
895895

@@ -913,8 +913,8 @@ static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj,
913913
* callback routine (pci_legacy_write).
914914
*/
915915
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)
918918
{
919919
struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj));
920920

@@ -1004,8 +1004,8 @@ void pci_create_legacy_files(struct pci_bus *b)
10041004
b->legacy_io->attr.name = "legacy_io";
10051005
b->legacy_io->size = 0xffff;
10061006
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;
10091009
/* See pci_create_attr() for motivation */
10101010
b->legacy_io->llseek = pci_llseek_resource;
10111011
b->legacy_io->mmap = pci_mmap_legacy_io;
@@ -1100,7 +1100,7 @@ static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
11001100
}
11011101

11021102
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,
11041104
loff_t off, size_t count, bool write)
11051105
{
11061106
#ifdef CONFIG_HAS_IOPORT
@@ -1143,14 +1143,14 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
11431143
}
11441144

11451145
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,
11471147
loff_t off, size_t count)
11481148
{
11491149
return pci_resource_io(filp, kobj, attr, buf, off, count, false);
11501150
}
11511151

11521152
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,
11541154
loff_t off, size_t count)
11551155
{
11561156
int ret;
@@ -1211,8 +1211,8 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
12111211
} else {
12121212
sprintf(res_attr_name, "resource%d", num);
12131213
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;
12161216
if (arch_can_pci_mmap_io())
12171217
res_attr->mmap = pci_mmap_resource_uc;
12181218
} else {
@@ -1293,7 +1293,7 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
12931293
* writing anything except 0 enables it
12941294
*/
12951295
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,
12971297
loff_t off, size_t count)
12981298
{
12991299
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,
13191319
* device corresponding to @kobj.
13201320
*/
13211321
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,
13231323
loff_t off, size_t count)
13241324
{
13251325
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,
13451345

13461346
return count;
13471347
}
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);
13491349

1350-
static struct bin_attribute *pci_dev_rom_attrs[] = {
1350+
static const struct bin_attribute *const pci_dev_rom_attrs[] = {
13511351
&bin_attr_rom,
13521352
NULL,
13531353
};
@@ -1373,7 +1373,7 @@ static size_t pci_dev_rom_attr_bin_size(struct kobject *kobj,
13731373
}
13741374

13751375
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,
13771377
.is_bin_visible = pci_dev_rom_attr_is_visible,
13781378
.bin_size = pci_dev_rom_attr_bin_size,
13791379
};

drivers/pci/pci.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <linux/string.h>
2424
#include <linux/log2.h>
2525
#include <linux/logic_pio.h>
26-
#include <linux/pm_wakeup.h>
2726
#include <linux/device.h>
2827
#include <linux/pm_runtime.h>
2928
#include <linux/pci_hotplug.h>

drivers/pci/vpd.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ void pci_vpd_init(struct pci_dev *dev)
271271
}
272272

273273
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)
276276
{
277277
struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj));
278278
struct pci_dev *vpd_dev = dev;
@@ -295,8 +295,8 @@ static ssize_t vpd_read(struct file *filp, struct kobject *kobj,
295295
}
296296

297297
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)
300300
{
301301
struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj));
302302
struct pci_dev *vpd_dev = dev;
@@ -317,9 +317,9 @@ static ssize_t vpd_write(struct file *filp, struct kobject *kobj,
317317

318318
return ret;
319319
}
320-
static BIN_ATTR(vpd, 0600, vpd_read, vpd_write, 0);
320+
static const BIN_ATTR(vpd, 0600, vpd_read, vpd_write, 0);
321321

322-
static struct bin_attribute *vpd_attrs[] = {
322+
static const struct bin_attribute *const vpd_attrs[] = {
323323
&bin_attr_vpd,
324324
NULL,
325325
};
@@ -336,7 +336,7 @@ static umode_t vpd_attr_is_visible(struct kobject *kobj,
336336
}
337337

338338
const struct attribute_group pci_dev_vpd_attr_group = {
339-
.bin_attrs = vpd_attrs,
339+
.bin_attrs_new = vpd_attrs,
340340
.is_bin_visible = vpd_attr_is_visible,
341341
};
342342

drivers/vfio/pci/vfio_pci_config.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,11 +1389,12 @@ static int vfio_ext_cap_len(struct vfio_pci_core_device *vdev, u16 ecap, u16 epo
13891389

13901390
switch (ecap) {
13911391
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);
13931394
if (ret)
13941395
return pcibios_err_to_errno(ret);
13951396

1396-
return dword >> PCI_VSEC_HDR_LEN_SHIFT;
1397+
return PCI_VNDR_HEADER_LEN(dword);
13971398
case PCI_EXT_CAP_ID_VC:
13981399
case PCI_EXT_CAP_ID_VC9:
13991400
case PCI_EXT_CAP_ID_MFVC:

include/uapi/linux/pci_regs.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@
533533
#define PCI_EXP_DEVSTA_TRPND 0x0020 /* Transactions Pending */
534534
#define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V1 12 /* v1 endpoints without link end here */
535535
#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) */
537537
#define PCI_EXP_LNKCAP_SLS_2_5GB 0x00000001 /* LNKCAP2 SLS Vector bit 0 */
538538
#define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */
539539
#define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */
@@ -1004,9 +1004,6 @@
10041004
#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
10051005
#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */
10061006

1007-
#define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */
1008-
#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */
1009-
10101007
/* SATA capability */
10111008
#define PCI_SATA_REGS 4 /* SATA REGs specifier */
10121009
#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */

0 commit comments

Comments
 (0)