Re: [PATCH v3 1/1] platform/chrome: Poke kb_wake_angle attribute visibility when needed

From: Tzung-Bi Shih
Date: Fri Nov 18 2022 - 01:48:43 EST


On Thu, Nov 17, 2022 at 10:41:06PM -0800, Gwendal Grignou wrote:
> On Thu, Nov 17, 2022 at 6:01 PM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
> >
> > On Wed, Nov 16, 2022 at 10:23:38AM -0800, Gwendal Grignou wrote:
> > > [+chrome-platform@xxxxxxxxxxxxxxx]
> >
> > Please also Cc to the mailing list if the patch gets chance to have
> > next version.
> >
> > > On Mon, Nov 14, 2022 at 8:10 PM Gwendal Grignou <gwendal@xxxxxxxxxxxx> wrote:
> > [...]
> > > > > Expose the attribute group to alter to close a potiential race between
> > > > > cros-ec-sensorhub and cros-ec-sysfs (that creates the attribute group
> > > > > on behalf of the class driver).
> >
> > I failed to realize the potential race. Could you explain it a bit?
> The decision to show or not an attribute is done at the attribute file
> creation time, once. If the module cros_ec_sysfs is loaded before
> cros_ec_sensorhub, the attribute kb_wake_angle will never be shown. If
> it is loaded after, and there are 2 accelerometers, the is_visible()
> function will return true and the attribute is shown.
>
> This patch ensures the attribute is_visible() is run again after the
> sensorhub driver is loaded.

I see. Thanks.