Re: [PATCH v3 1/3] HID: hid-sensor-hub: Synchronize callback removal with raw events
From: Andy Shevchenko
Date: Thu Oct 22 2026 - 10:15:39 EST
On Wed, Oct 21, 2026 at 06:21:45PM -0700, Srinivas Pandruvada wrote:
> On Sun, 2026-10-18 at 19:34 -0700, Christopher Hoover wrote:
> > sensor_hub_raw_event() holds pdata->lock while it looks a callback up
> > in dyn_callback_list and calls its capture_sample() and send_event().
> > sensor_hub_remove_callback() takes only dyn_callback_lock, so it can
> > unlink a callback and return while another CPU is between the lookup
> > and the call. The sensor drivers remove their callback in .remove()
>
> Two spaces before "The".
Which is not that bad [1], right? It's consistent in the text.
> > and keep the struct hid_sensor_hub_callbacks in memory that devres
> > frees right after, so a report racing an unbind can call through
> > freed function pointers.
> >
> > Take pdata->lock in sensor_hub_remove_callback() too, outside
> > dyn_callback_lock as in sensor_hub_raw_event(), so the removal waits
> > for a report in flight. pdata->lock is otherwise only taken in
> > sensor_hub_raw_event(), and callbacks are removed from process
> > context.
[1]:
"Using two spaces after a period is not strictly "wrong," but it is considered
outdated and contrary to modern typographic standards."
...
Yeah, it's a slippery slope of yet another holy war, but I think this
kind of a style is a last we should care about (main point is to be
consistent in a chosen style).
--
With Best Regards,
Andy Shevchenko