Re: [PATCH v4 3/3] i3c: add i3cdev module to expose i3c dev in /dev
From: Sam Agazaryan
Date: Fri Sep 11 2026 - 19:57:50 EST
> this is problem, Maybe we can use ioctrl to set default cmd, hdr/ sdr(default).
That makes sense.
We can keep read()/write() defaulting to I3C_SDR out of the box, and add an
ioctl (e.g. I3C_IOC_SET_MODE) to allow configuring the default mode and
command byte for that file descriptor if a user wants to use read()/write()
with HDR. How does that sound?
>How about this driver built-in and other devices build as modules, modules
>load maybe later than this driver?
This scenario is handled automatically by our bus notifier
(i3cdev_notifier_call):
When i3cdev is built-in, it attaches to unbound target devices at boot. If a
device driver module is loaded later (e.g. via modprobe), the driver core
emits BUS_NOTIFY_BIND_DRIVER right before binding the new driver.
Our notifier listens for BUS_NOTIFY_BIND_DRIVER and immediately calls
i3cdev_detach(), which unregisters the device clears i3cdev->i3c.
That way, i3cdev automatically steps aside whenever a dedicated driver
loads. And if that module is ever unloaded later, BUS_NOTIFY_UNBOUND_DRIVER
triggers i3cdev_attach() to re-expose the /dev node.
Thanks,
Sam