mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
sysfs: treewide: constify attribute callback of bin_attribute::mmap()
The mmap() 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 <linux@weissschuh.net> Acked-by: Andrew Donnellan <ajd@linux.ibm.com> # ocxl Acked-by: Krzysztof Wilczyński <kw@linux.com> Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-6-71110628844c@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b626816fdd
commit
94a20fb9af
@ -64,7 +64,7 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num,
|
||||
* Return: %0 on success, negative error code otherwise
|
||||
*/
|
||||
static int pci_mmap_resource(struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma, int sparse)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
@ -93,14 +93,14 @@ static int pci_mmap_resource(struct kobject *kobj,
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_sparse(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 1);
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_dense(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 0);
|
||||
|
@ -125,7 +125,7 @@ static const struct vm_operations_struct global_mmio_vmops = {
|
||||
};
|
||||
|
||||
static int global_mmio_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
const struct bin_attribute *bin_attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct ocxl_afu *afu = to_afu(kobj_to_dev(kobj));
|
||||
|
@ -90,7 +90,7 @@ static ssize_t published_show(struct device *dev, struct device_attribute *attr,
|
||||
static DEVICE_ATTR_RO(published);
|
||||
|
||||
static int p2pmem_alloc_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
const struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
size_t len = vma->vm_end - vma->vm_start;
|
||||
|
@ -910,7 +910,7 @@ static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj,
|
||||
* memory space.
|
||||
*/
|
||||
static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj));
|
||||
@ -930,7 +930,7 @@ static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
|
||||
* memory space. Returns -ENOSYS if the operation isn't supported
|
||||
*/
|
||||
static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj));
|
||||
@ -1034,7 +1034,7 @@ void pci_remove_legacy_files(struct pci_bus *b)
|
||||
*
|
||||
* Use the regular PCI mapping routines to map a PCI resource into userspace.
|
||||
*/
|
||||
static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||
static int pci_mmap_resource(struct kobject *kobj, const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma, int write_combine)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
@ -1059,14 +1059,14 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 0);
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 1);
|
||||
|
@ -103,7 +103,7 @@ intel_pmt_read(struct file *filp, struct kobject *kobj,
|
||||
|
||||
static int
|
||||
intel_pmt_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
const struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
{
|
||||
struct intel_pmt_entry *entry = container_of(attr,
|
||||
struct intel_pmt_entry,
|
||||
|
@ -135,7 +135,7 @@ static void hv_uio_rescind(struct vmbus_channel *channel)
|
||||
* The ring buffer is allocated as contiguous memory by vmbus_open
|
||||
*/
|
||||
static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct vmbus_channel *channel
|
||||
|
@ -309,7 +309,7 @@ struct bin_attribute {
|
||||
char *, loff_t, size_t);
|
||||
loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *,
|
||||
loff_t, int);
|
||||
int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
|
||||
int (*mmap)(struct file *, struct kobject *, const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user