Messages in this thread | | | From | Gwendal Grignou <> | Date | Thu, 17 Nov 2022 22:41:06 -0800 | Subject | Re: [PATCH v3 1/1] platform/chrome: Poke kb_wake_angle attribute visibility when needed |
| |
On Thu, Nov 17, 2022 at 6:01 PM Tzung-Bi Shih <tzungbi@kernel.org> wrote: > > On Wed, Nov 16, 2022 at 10:23:38AM -0800, Gwendal Grignou wrote: > > [+chrome-platform@lists.linux.dev] > > 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@chromium.org> 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.
Gwendal. > > > > > diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h > > > > index 02599687770c5..c6dca260bbd5d 100644 > > > > --- a/include/linux/platform_data/cros_ec_proto.h > > > > +++ b/include/linux/platform_data/cros_ec_proto.h > > > > @@ -191,6 +191,7 @@ struct cros_ec_platform { > > > > /** > > > > * struct cros_ec_dev - ChromeOS EC device entry point. > > > > * @class_dev: Device structure used in sysfs. > > > > + * @groups: sysfs attributes groups for this EC. > > The field name has extra "s".
| |