diff options
| author | Tzung-Bi Shih <tzungbi@kernel.org> | 2025-08-28 11:36:00 +0300 |
|---|---|---|
| committer | Tzung-Bi Shih <tzungbi@kernel.org> | 2025-09-14 06:34:41 +0300 |
| commit | 56cb557279d70397cefb497e0f06bdd6fd685f8e (patch) | |
| tree | a863b7f72ea4e475ae1363a96da57e4cad1a9687 /include/linux/platform_data | |
| parent | 7a79b0bfd8b3995a39d25bffcf57273635c0e542 (diff) | |
| download | linux-56cb557279d70397cefb497e0f06bdd6fd685f8e.tar.xz | |
platform/chrome: cros_ec: Add a flag to track registration state
Introduce a `registered` flag to the `struct cros_ec_device` to allow
callers to determine if the device has been fully registered and is
ready for use.
This is a preparatory step to prevent race conditions where other drivers
might try to access the device before it is fully registered or after
it has been unregistered.
Link: https://lore.kernel.org/r/20250828083601.856083-5-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Diffstat (limited to 'include/linux/platform_data')
| -rw-r--r-- | include/linux/platform_data/cros_ec_proto.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h index 4d96cffbb9e3..de14923720a5 100644 --- a/include/linux/platform_data/cros_ec_proto.h +++ b/include/linux/platform_data/cros_ec_proto.h @@ -128,6 +128,7 @@ struct cros_ec_command { * @dout_size: Size of dout buffer to allocate (zero to use static dout). * @wake_enabled: True if this device can wake the system from sleep. * @suspended: True if this device had been suspended. + * @registered: True if this device had been registered. * @cmd_xfer: Send command to EC and get response. * Returns the number of bytes received if the communication * succeeded, but that doesn't mean the EC was happy with the @@ -186,6 +187,7 @@ struct cros_ec_device { int dout_size; bool wake_enabled; bool suspended; + bool registered; int (*cmd_xfer)(struct cros_ec_device *ec, struct cros_ec_command *msg); int (*pkt_xfer)(struct cros_ec_device *ec, @@ -278,6 +280,8 @@ int cros_ec_cmd_readmem(struct cros_ec_device *ec_dev, u8 offset, u8 size, void int cros_ec_get_cmd_versions(struct cros_ec_device *ec_dev, u16 cmd); +bool cros_ec_device_registered(struct cros_ec_device *ec_dev); + /** * cros_ec_get_time_ns() - Return time in ns. * |
