-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psys: Do not skip registering ipu_psys_bus for kernels >= 6.10 #327
Conversation
The new auxbus code-paths where not registering the ipu_psys_bus used for psys->dev.bus = &ipu_psys_bus, this was causing udev to not be able to properly enumerate the device. For example running: udevadm test -a add /dev/ipu-psys0 would fail with the following error: "Failed to clone sd_device object: No such file or directory" This udev issue in turn was causing issues with udev rules to set permissions on /dev/ipu-psys0 not working Fix this by: 1. Rename ipu6_psys_bus to ipu_psys_bus, there is no need for separate names for this struct with different kernels and having the same name allows code sharing. 2. Switching back from using module_auxiliary_driver() to using module_init() / module_exit() codes for registering the drivers. 3. Move the now always used ipu_psys_init() and ipu_psys_exit() out of any ifdefs blocks, so that these functions now always (un)register the chrdev region and the ipu_psys_bus. 4. Remove the now duplicate chrdev region handling from the auxbus ipu6_psys_probe() and ipu6_psys_remove() functions (now handled by ipu_psys_init() and ipu_psys_exit()). Signed-off-by: Hans de Goede
Use cdev_device_add() for /dev/ipu-psys0 so that its kobj parents gets set properly by calling cdev_set_parent(). "cdev_set_parent() sets a parent kobject which will be referenced appropriately so the parent is not freed before the cdev. This should be called before cdev_add." Signed-off-by: Hans de Goede <[email protected]>
Hi Hans @jwrdegoede , I'm looking into this PR and rebased internally. Will update it later. |
Note you can reproduce the issue (with a new enough kernel using the in kernel isys) by doing:
and then look for |
Here is the udev rule to change the owner on Chrome: |
Hi Hans @jwrdegoede , I resolved a conflict and rebased your PR to my fork here which have synced with intel/ipu6-drivers/master, could you help to update to this PR? Thank you. |
Hi Bingbu @bingbucao , seems the PSYS driver called @jwrdegoede Hans, is there any other issues could we met if we don't call |
ATM the device's bus member is set to the ipu6-bus, setting a device's bus-member to a non registered bus is not supported and will result in undefined behavior. I'm surprised things work as well as they do without this patch. You could try setting the device's bus member to NULL, I think that will just result in the device being attached to the virtual bus. |
ACK. We will land this PR. |
The new auxbus code-paths were not registering the ipu_psys_bus used for
psys->dev.bus = &ipu_psys_bus, this was causing udev to not be able to
properly enumerate the device. For example running:
would fail with the following error:
This udev issue in turn was causing issues with udev rules to set
permissions on /dev/ipu-psys0 not working
Fix this by:
Rename ipu6_psys_bus to ipu_psys_bus, there is no need for separate
names for this struct with different kernels and having the same name
allows code sharing.
Switching back from using module_auxiliary_driver() to using
module_init() / module_exit() codes for registering the drivers.
Move the now always used ipu_psys_init() and ipu_psys_exit()
out of any ifdefs blocks, so that these functions now always
(un)register the chrdev region and the ipu_psys_bus.
Remove the now duplicate chrdev region handling from the auxbus
ipu6_psys_probe() and ipu6_psys_remove() functions (now handled
by ipu_psys_init() and ipu_psys_exit()).