Re: [PATCH v4 04/24] PCI/sysfs: Use BAR length in pci_llseek_resource() when attr->size is zero
| Newsgroups | org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
> Both legacy and resource attributes set .f_mapping = iomem_get_mapping,
> so the default generic_file_llseek() would consult iomem_inode for the
> file size, which knows nothing about the attribute. That is why this
> custom llseek callback exists.
>
> Currently, the legacy and resource attributes have .size set at creation
> time, as such, using the attr->size is sufficient. However, the upcoming
> static resource attributes will have .size == 0 set, since they are const,
> and the .bin_size callback will be used to provide the real size to kernfs
> instead.
>
> Thus, update pci_llseek_resource() to derive the file size from the
> BAR using pci_resource_len() instead of reading the attr->size directly.
>
> The custom pci_llseek_resource() helper has been added in commit
> 24de09c16f97 ("PCI: Implement custom llseek for sysfs resource
> entries").
>
> Signed-off-by: Krzysztof Wilczyński <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4