Commit b626816f authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Greg Kroah-Hartman
Browse files

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: default avatarThomas Weißschuh <linux@weissschuh.net>
Acked-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Acked-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Acked-by: default avatarIra Weiny <ira.weiny@intel.com>
Acked-by: default avatarKrzysztof Wilczyński <kw@linux.com>
Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-5-71110628844c@weissschuh.net


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 00ab6e97
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ static ssize_t CDAT_read(struct file *filp, struct kobject *kobj,
static BIN_ATTR_ADMIN_RO(CDAT, 0);

static umode_t cxl_port_bin_attr_is_visible(struct kobject *kobj,
					    struct bin_attribute *attr, int i)
					    const struct bin_attribute *attr, int i)
{
	struct device *dev = kobj_to_dev(kobj);
	struct cxl_port *port = to_cxl_port(dev);
+1 −1
Original line number Diff line number Diff line
@@ -3999,7 +3999,7 @@ static umode_t amdgpu_flash_attr_is_visible(struct kobject *kobj, struct attribu
}

static umode_t amdgpu_bin_flash_attr_is_visible(struct kobject *kobj,
						struct bin_attribute *attr,
						const struct bin_attribute *attr,
						int idx)
{
	struct device *dev = kobj_to_dev(kobj);
+1 −1
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ static struct bin_attribute *port_ccmgta_attributes[] = {
};

static umode_t qib_ccmgta_is_bin_visible(struct kobject *kobj,
				 struct bin_attribute *attr, int n)
				 const struct bin_attribute *attr, int n)
{
	struct qib_pportdata *ppd = qib_get_pportdata_kobj(kobj);

+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj,
}

static umode_t spi_nor_sysfs_is_bin_visible(struct kobject *kobj,
					    struct bin_attribute *attr, int n)
					    const struct bin_attribute *attr, int n)
{
	struct spi_device *spi = to_spi_device(kobj_to_dev(kobj));
	struct spi_mem *spimem = spi_get_drvdata(spi);
+2 −1
Original line number Diff line number Diff line
@@ -298,7 +298,8 @@ static umode_t nvmem_bin_attr_get_umode(struct nvmem_device *nvmem)
}

static umode_t nvmem_bin_attr_is_visible(struct kobject *kobj,
					 struct bin_attribute *attr, int i)
					 const struct bin_attribute *attr,
					 int i)
{
	struct device *dev = kobj_to_dev(kobj);
	struct nvmem_device *nvmem = to_nvmem_device(dev);
Loading