On Thu, Feb 26 2026, David Matlack wrote: > On 2026-02-26 03:52 PM, Alex Williamson wrote: >> On Thu, 29 Jan 2026 21:24:53 +0000 David Matlack <[email protected]> wrote: > >> > diff --git a/drivers/vfio/device_cdev.c b/drivers/vfio/device_cdev.c >> > index 8ceca24ac136..935f84a35875 100644 >> > --- a/drivers/vfio/device_cdev.c >> > +++ b/drivers/vfio/device_cdev.c >> > @@ -52,6 +46,19 @@ int vfio_device_fops_cdev_open(struct inode *inode, >> > struct file *filep) >> > vfio_device_put_registration(device); >> > return ret; >> > } >> > +EXPORT_SYMBOL_GPL(__vfio_device_fops_cdev_open); >> >> I really dislike that we're exporting the underscore variant, which >> implies it's an internal function that the caller should understand the >> constraints, without outlining any constraints. >> >> I'm not sure what a good alternative is. We can drop fops since this >> isn't called from file_operations. Maybe vfio_device_cdev_open_file(). > > Ack. Due to the bug you pointed out below, I think the changes in this > file will look fairly different in the next version. But no matter what > I'll avoid exporting a underscore variant without outlining the > constraints.
I haven't yet had a chance to read v3 so maybe you already solved this problem. But I dealt with some similar problems for the memfd patches [0] and the hugetlb patches [1]. What I did was to just use/add a internal header (mm/internal.h or mm/hugetlb_internal.h). This lets you share functions within your subsystem but avoid exporting everywhere else. I see that there already is drivers/vfio/vfio.h so perhaps you can use that to avoid exporting these functions outside the subsystem? [0] https://git.kernel.org/torvalds/c/ed6f45f81bf9 [1] https://lore.kernel.org/linux-mm/[email protected]/ [...] -- Regards, Pratyush Yadav

