Re:Re: [PATCH] bus: mhi: host: Only expose controller sysfs attributes on the controller device
From: Manivannan Sadhasivam
Date: Wed Dec 02 2026 - 07:22:21 EST
On 2026-12-02 09:48 +0800, Slark Xiao wrote:
>
> At 2026-12-02 01:34:01, "Manivannan Sadhasivam" <mani@xxxxxxxxxx> wrote:
> >On 2026-11-20 09:45 -0700, Jeff Hugo wrote:
> >> On 11/18/2026 12:05 AM, Slark Xiao wrote:
> >> >
> >> > At 2026-11-14 02:42:46, "Jeff Hugo" <jeff.hugo@xxxxxxxxxxxxxxxx> wrote:
> >> >> On 11/11/2026 4:56 AM, Slark Xiao wrote:
> >> >>> The serial_number, oem_pk_hash and soc_reset attributes are registered
> >> >>> through mhi_bus_type.dev_groups, so the driver core creates them for
> >> >>> every device on the MHI bus. MHI client devices (the per-channel
> >> >>> devices such as mhi0_DUN or mhi0_MBIM) are also MHI bus devices, so
> >> >>> each of them ends up with its own copies of these files even though
> >> >>> they all operate on the same mhi_controller:
> >> >>>
> >> >>> $ ls /sys/bus/mhi/devices/mhi0_DUN/
> >> >>> driver oem_pk_hash power serial_number soc_reset subsystem uevent
> >> >>>
> >> >>> This is wrong for several reasons:
> >> >>>
> >> >>> - The attributes describe the controller, not the channel. Their
> >> >>> callbacks all dereference mhi_dev->mhi_cntrl and read BHI registers
> >> >>> or issue a controller-wide SoC reset, so writing soc_reset through
> >> >>> mhi0_DUN resets the whole device while looking like a per-channel
> >> >>> operation.
> >> >>> - oem_pk_hash reports failures with dev_err(dev, ...), so a single
> >> >>> failing controller produces one log line per registered channel
> >> >>> device instead of one.
> >> >>> - Userspace has no way to tell which copy is authoritative.
> >> >>>
> >> >>> Move the attributes off the bus and attach them to the controller
> >> >>> device only. mhi_register_controller() now installs the group via
> >> >>> mhi_dev->dev.groups before device_add(), while the channel devices
> >> >>> created by mhi_create_devices() are left untouched. No functional
> >> >>> change for the controller device; the files stay at the paths listed
> >> >>> in Documentation/ABI/stable/sysfs-bus-mhi.
> >> >>>
> >> >>> Note that trigger_edl was already handled this way, through an explicit
> >> >>> sysfs_create_file() on the controller kobject, which is why it never
> >> >>> appeared on the channel devices.
> >> >> I agree with the rationale, but this does appear to change uAPI. Are you
> >> >> sure no one is using these on the channel devices?
> >> >>
> >> >> -Jeff
> >> > Hi Jeff,
> >> > For oem_pk_hash and serial_number, all interface returns same value.
> >> > I think there is no need to keep these interfaces under the channel
> >> > devices.
> >> >
> >> > For soc_reset, it write the register directly and it works for the entire
> >> > device rather than a single channel.
> >> >
> >> > So I think there is no problem to remove them.
> >>
> >> These are uAPI. The golden rule of the kernel is that we do not break
> >> userspace. It does not matter that their existence is a "bug", if there
> >> is userspace using them, then we must keep them.
> >>
> >
> >That's certainly true.
> It seems unrealistic to expect an MHI contributor to prove that there are
> no users utilizing it at the user level. I can't guarantee that there isn't someone
> using the interface under channel device. Instead, I believe the original
> submitter should clarify the intent behind this design. Unfortunately,
> the original submitter seems to be unreachable. His email is no longer
> valid.
>
He is no longer working with Qcom. But judging from the code, I would assume
that exposing these attributes from controller devices were an oversight.
> >
> >> I could agree with you assessment that having these items on the channel
> >> device is a mistake (and I do), but that does not change the rule.
> >>
> >> So far you have not provided any data to say that userspace is in fact
> >> not using these, and therefore removing them would have no impact.
> >>
> >> Without that analysis, I am sorry to say I am uncomfortable proceeding
> >> with this change. Mani is free to ignore my concerns and apply this
> >> patch at his own risk.
> >>
> >
> >No. I didn't suggest dropping the sysfs attributes from the channel devices
> >altogether. Since these channel attributes are ABIs, they need to be documented
> >in 'obsolete' directory in the ABI documentation first with a proposed removal
> >version and then the existing entries in 'stable' needs to be tweaked to be
> >controller specific. And then we can remove the channel specific attributes
> >only after the proposed kernel version.
> >
> >But now I'm really thinking if it is worth doing or not.
> >
> >- Mani
> >
> In fact, as a long-term contributor and user of MHI, I have never utilized the sysfs
> interface under the channel. Additionally, nearly half of the devices that support
> MHI are products from Foxconn. I haven't heard of any demand for such usage
> from factories, ODM manufacturers, PC vendors, or end users. While I cannot
> represent all products, this does reflect some genuine feedback regarding MHI
> products.
>
No matter what, stable ABIs are meant not to be broken. But there is a process
for marking them obsolete and removing them, which I quoted in my reply.
> I have to say that during use, seeing these extra enumerated ports really makes
> me feel uncomfortable( I am not quite sure if I might be a bit obsessive).
>
> If you still have a plan to fix this, please let me know.
>
Sorry, I don't have a plan to fix it now. I have more boiling issues to fix than
this ;)
- Mani