Re: [PATCH v4 3/3] i3c: add i3cdev module to expose i3c dev in /dev
From: Sam Agazaryan
Date: Fri Sep 18 2026 - 18:47:32 EST
> I made an assumption in my previous analysis. I assumed that the
> notification would be dispatched in its own thread. Digging more,
> bus_notify just invokes all the registered .notifier_call callbacks, so
> i3cdev_detach would be guaranteed to run before call_driver_probe.
Looking at this again, I think there is an issue in this area regarding
module deregistration.
If we deregister the module i3cdev_exit calls i3cdev_detach for all i3c
devices including the ones bound to different drivers, which is very bad.
i3c_for_each_dev(NULL, i3cdev_detach);
I can add a private LIST_HEAD (similar to i2c-dev) to track all devices
that are specifically using i3cdev and use that list to manage detaching
instead of dev->driver_data.
I think there was another issue with the bus notifier that Sashiko was
on the right track for.
The core lock being used wasn't the right one to protect against
attach and detach
races. I removed that lock and updated the locking inside the attach
and detach functions
to account for races that may arise from module loading and device discovery.
Thanks,
Sam