media: ipu7: register the psys bus before adding devices#89
Open
atisDu wants to merge 1 commit into
Open
Conversation
ipu7_psys_bus is defined and assigned to psys->dev.bus, but is never passed to bus_register(). device_register() on a device whose bus was never registered depends on the kernel's tolerance for that condition; newer kernels reject it outright with -EINVAL: bus_add_device: cannot add device 'ipu7-psys0' to unregistered bus 'intel-ipu7-psys' intel-ipu7-psys ipu7-psys0: psys device_register failed intel_ipu7_psys.psys intel_ipu7.psys.40: probe with driver intel_ipu7_psys.psys failed with error -22 which breaks PSys probe entirely and /dev/ipu7-psys0 is never created. Reproduced on CachyOS kernel 7.1.3 (IPU7, ThinkPad X9-14/Lunar Lake); the same tree still probed successfully on kernel 7.0.11. Register ipu7_psys_bus in module init before registering the auxiliary driver, and unregister both in reverse order on exit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ipu7_psys_bus(drivers/media/pci/intel/ipu7/psys/ipu-psys.c) is defined and assigned topsys->dev.businipu7_psys_probe(), but is never passed tobus_register(). Callingdevice_register()on a device whosebuswas never registered relies on kernel tolerance for that condition; newer kernels reject it outright:This makes PSys probe fail entirely, so
/dev/ipu7-psys0is never created and any hardware-ISP pipeline (e.g.icamerasrc) fails withnot-negotiated.Reproduced on a ThinkPad X9-14 (Lunar Lake, IPU7) running CachyOS. PSys probed and streamed correctly on kernel 7.0.11 but started failing after upgrading to kernel 7.1.3 — no other driver, firmware, or config changes involved, so this looks like a kernel-side tightening of
bus_add_device()behavior that exposed a pre-existing bug in this driver.Fix
Replace the
module_auxiliary_driver()convenience macro with explicitmodule_init/module_exitfunctions thatbus_register(&ipu7_psys_bus)before registering the auxiliary driver, and unregister both in reverse order on exit.Test plan
make LLVM=1 KERNELRELEASE=7.1.3-2-cachyos KERNEL_SRC=/lib/modules/7.1.3-2-cachyos/buildbuilds cleanlyintel_ipu7_psys—/dev/ipu7-psys0now appearsgst-launch-1.0 icamerasrc ! video/x-raw,format=NV12,width=1920,height=1080 ! fakesinknegotiates caps and streams without error (previously failed withnot-negotiated (-4))