Skip to content

Commit b626816

Browse files
t-8chgregkh
authored andcommitted
sysfs: treewide: constify attribute callback of bin_is_visible()
The is_bin_visible() callbacks should not modify the struct bin_attribute passed as argument. Enforce this by marking the argument as const. As there are not many callback implementers perform this change throughout the tree at once. Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Martin K. Petersen <[email protected]> Acked-by: Jason Gunthorpe <[email protected]> Acked-by: Ira Weiny <[email protected]> Acked-by: Krzysztof Wilczyński <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 00ab6e9 commit b626816

File tree

12 files changed

+27
-26
lines changed

12 files changed

+27
-26
lines changed

drivers/cxl/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static ssize_t CDAT_read(struct file *filp, struct kobject *kobj,
173173
static BIN_ATTR_ADMIN_RO(CDAT, 0);
174174

175175
static umode_t cxl_port_bin_attr_is_visible(struct kobject *kobj,
176-
struct bin_attribute *attr, int i)
176+
const struct bin_attribute *attr, int i)
177177
{
178178
struct device *dev = kobj_to_dev(kobj);
179179
struct cxl_port *port = to_cxl_port(dev);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3999,7 +3999,7 @@ static umode_t amdgpu_flash_attr_is_visible(struct kobject *kobj, struct attribu
39993999
}
40004000

40014001
static umode_t amdgpu_bin_flash_attr_is_visible(struct kobject *kobj,
4002-
struct bin_attribute *attr,
4002+
const struct bin_attribute *attr,
40034003
int idx)
40044004
{
40054005
struct device *dev = kobj_to_dev(kobj);

drivers/infiniband/hw/qib/qib_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static struct bin_attribute *port_ccmgta_attributes[] = {
283283
};
284284

285285
static umode_t qib_ccmgta_is_bin_visible(struct kobject *kobj,
286-
struct bin_attribute *attr, int n)
286+
const struct bin_attribute *attr, int n)
287287
{
288288
struct qib_pportdata *ppd = qib_get_pportdata_kobj(kobj);
289289

drivers/mtd/spi-nor/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj,
8787
}
8888

8989
static umode_t spi_nor_sysfs_is_bin_visible(struct kobject *kobj,
90-
struct bin_attribute *attr, int n)
90+
const struct bin_attribute *attr, int n)
9191
{
9292
struct spi_device *spi = to_spi_device(kobj_to_dev(kobj));
9393
struct spi_mem *spimem = spi_get_drvdata(spi);

drivers/nvmem/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ static umode_t nvmem_bin_attr_get_umode(struct nvmem_device *nvmem)
298298
}
299299

300300
static umode_t nvmem_bin_attr_is_visible(struct kobject *kobj,
301-
struct bin_attribute *attr, int i)
301+
const struct bin_attribute *attr,
302+
int i)
302303
{
303304
struct device *dev = kobj_to_dev(kobj);
304305
struct nvmem_device *nvmem = to_nvmem_device(dev);

drivers/pci/pci-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ static struct bin_attribute *pci_dev_rom_attrs[] = {
13261326
};
13271327

13281328
static umode_t pci_dev_rom_attr_is_visible(struct kobject *kobj,
1329-
struct bin_attribute *a, int n)
1329+
const struct bin_attribute *a, int n)
13301330
{
13311331
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
13321332

drivers/pci/vpd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ static struct bin_attribute *vpd_attrs[] = {
325325
};
326326

327327
static umode_t vpd_attr_is_visible(struct kobject *kobj,
328-
struct bin_attribute *a, int n)
328+
const struct bin_attribute *a, int n)
329329
{
330330
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
331331

drivers/platform/x86/amd/hsmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ static int hsmp_get_tbl_dram_base(u16 sock_ind)
620620
}
621621

622622
static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
623-
struct bin_attribute *battr, int id)
623+
const struct bin_attribute *battr, int id)
624624
{
625625
if (plat_dev.proto_ver == HSMP_PROTO_VER6)
626626
return battr->attr.mode;

drivers/platform/x86/intel/sdsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static struct bin_attribute *sdsi_bin_attrs[] = {
541541
};
542542

543543
static umode_t
544-
sdsi_battr_is_visible(struct kobject *kobj, struct bin_attribute *attr, int n)
544+
sdsi_battr_is_visible(struct kobject *kobj, const struct bin_attribute *attr, int n)
545545
{
546546
struct device *dev = kobj_to_dev(kobj);
547547
struct sdsi_priv *priv = dev_get_drvdata(dev);

drivers/scsi/scsi_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
12741274
}
12751275

12761276
static umode_t scsi_sdev_bin_attr_is_visible(struct kobject *kobj,
1277-
struct bin_attribute *attr, int i)
1277+
const struct bin_attribute *attr, int i)
12781278
{
12791279
struct device *dev = kobj_to_dev(kobj);
12801280
struct scsi_device *sdev = to_scsi_device(dev);

0 commit comments

Comments
 (0)