kernel_samsung_a53x/Documentation/driver-api
Marco Pagani 427235ab25 fpga: region: add owner module and take its refcount
[ Upstream commit b7c0e1ecee403a43abc89eb3e75672b01ff2ece9 ]

The current implementation of the fpga region assumes that the low-level
module registers a driver for the parent device and uses its owner pointer
to take the module's refcount. This approach is problematic since it can
lead to a null pointer dereference while attempting to get the region
during programming if the parent device does not have a driver.

To address this problem, add a module owner pointer to the fpga_region
struct and use it to take the module's refcount. Modify the functions for
registering a region to take an additional owner module parameter and
rename them to avoid conflicts. Use the old function names for helper
macros that automatically set the module that registers the region as the
owner. This ensures compatibility with existing low-level control modules
and reduces the chances of registering a region without setting the owner.

Also, update the documentation to keep it consistent with the new interface
for registering an fpga region.

Fixes: 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA")
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Xu Yilun <yilun.xu@intel.com>
Reviewed-by: Russ Weight <russ.weight@linux.dev>
Signed-off-by: Marco Pagani <marpagan@redhat.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20240419083601.77403-1-marpagan@redhat.com
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:04 +01:00
..
80211 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
acpi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
backlight Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dmaengine Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
driver-model Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
early-userspace Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
firmware Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fpga fpga: region: add owner module and take its refcount 2024-11-19 12:27:04 +01:00
gpio Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i3c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iio Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
media Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mei Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
memory-devices Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mtd Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nfc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nvdimm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
phy Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pldmfw Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rapidio Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
serial Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soundwire Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
thermal Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usb Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xilinx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
basics.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clk.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
component.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
connector.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
console.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dcdbas.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
devfreq.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
device-io.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
device_link.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dma-buf.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
edac.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
eisa.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
firewire.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
frame-buffer.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
generic-counter.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hsi.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i2c.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
index.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
infiniband.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
infrastructure.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
input.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
interconnect.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
io-mapping.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
io_ordering.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioctl.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipmb.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipmi.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isa.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isapnp.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
libata.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lightnvm-pblk.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mailbox.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
men-chameleon-bus.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
message-based.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc_devices.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
miscellaneous.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mtdnand.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ntb.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nvmem.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
parport-lowlevel.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pinctl.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pps.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pti_intel_mid.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ptp.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pwm.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
regulator.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rfkill.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
s390-drivers.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scsi.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
slimbus.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sm501.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
spi.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
switchtec.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sync_file.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
target.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uio-howto.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vfio-mediated-device.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vfio.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vme.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
w1.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xillybus.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zorro.rst Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00