Re: [PATCH v4 1/3] bus: mhi: host: clients: Add loopback driver with sysfs interface
Manivannan Sadhasivam <[email protected]> Tue, 23 Jun 2026 13:20:01 +0200
| Newsgroups | dev.linux.lists.mhi,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <uprjbvbojknioyczod63ik3foy57k5gonfe6po2nhm5nov4ctk@mjwtrl3luncl> |
On Tue, Jun 23, 2026 at 03:58:00PM +0530, Sumit Kumar wrote:
>
[...]
> > > +static void mhi_loopback_remove(struct mhi_device *mhi_dev)
> > > +{
> > > + struct mhi_loopback *loopback = dev_get_drvdata(&mhi_dev->dev);
> > > +
> > > + complete(&loopback->comp);
> > > +
> > > + mutex_lock(&loopback->lb_mutex);
> > > + mutex_unlock(&loopback->lb_mutex);
> > What does this locking protect?
> since start_store() is holding the mutex for its entire duration,
> this lock will block until any in-progress start_store() has fully
> completed before teardown, ensuring mhi_unprepare_from_transfer()
> does not race with an active test still accessing the channel.
>
How can you ensure that start_store doesn't race if you unlock the mutex before
mhi_unprepare_from_transfer()? Anyway, once you remove the sysfs files here as I
suggested, you do not need to worry about the race.
- Mani
--
மணிவண்ணன் சதாசிவம்