Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'sysfs_defferred_iomem_get_mapping-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core driver-core-next

sysfs: Allow deferred execution of iomem_get_mapping()

Tag for toerh trees/branches to pull from in order to have a stable base
to build off of for the "Allow deferred execution of
iomem_get_mapping()" set of sysfs changes

Link: https://lore.kernel.org/r/20210729233235.1508920-1-kw@linux.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

* tag 'sysfs_defferred_iomem_get_mapping-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
sysfs: Rename struct bin_attribute member to f_mapping
sysfs: Invoke iomem_get_mapping() from the sysfs open callback

+6 -6
+3 -3
drivers/pci/pci-sysfs.c
··· 965 965 b->legacy_io->read = pci_read_legacy_io; 966 966 b->legacy_io->write = pci_write_legacy_io; 967 967 b->legacy_io->mmap = pci_mmap_legacy_io; 968 - b->legacy_io->mapping = iomem_get_mapping(); 968 + b->legacy_io->f_mapping = iomem_get_mapping; 969 969 pci_adjust_legacy_attr(b, pci_mmap_io); 970 970 error = device_create_bin_file(&b->dev, b->legacy_io); 971 971 if (error) ··· 978 978 b->legacy_mem->size = 1024*1024; 979 979 b->legacy_mem->attr.mode = 0600; 980 980 b->legacy_mem->mmap = pci_mmap_legacy_mem; 981 - b->legacy_io->mapping = iomem_get_mapping(); 981 + b->legacy_io->f_mapping = iomem_get_mapping; 982 982 pci_adjust_legacy_attr(b, pci_mmap_mem); 983 983 error = device_create_bin_file(&b->dev, b->legacy_mem); 984 984 if (error) ··· 1195 1195 } 1196 1196 } 1197 1197 if (res_attr->mmap) 1198 - res_attr->mapping = iomem_get_mapping(); 1198 + res_attr->f_mapping = iomem_get_mapping; 1199 1199 res_attr->attr.name = res_attr_name; 1200 1200 res_attr->attr.mode = 0600; 1201 1201 res_attr->size = pci_resource_len(pdev, num);
+2 -2
fs/sysfs/file.c
··· 174 174 { 175 175 struct bin_attribute *battr = of->kn->priv; 176 176 177 - if (battr->mapping) 178 - of->file->f_mapping = battr->mapping; 177 + if (battr->f_mapping) 178 + of->file->f_mapping = battr->f_mapping(); 179 179 180 180 return 0; 181 181 }
+1 -1
include/linux/sysfs.h
··· 176 176 struct attribute attr; 177 177 size_t size; 178 178 void *private; 179 - struct address_space *mapping; 179 + struct address_space *(*f_mapping)(void); 180 180 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, 181 181 char *, loff_t, size_t); 182 182 ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,