platform/chrome: cros_ec: Separate initialization from cros_ec_register()
authorTzung-Bi Shih <tzungbi@kernel.org>
Thu, 28 Aug 2025 08:35:59 +0000 (08:35 +0000)
committerTzung-Bi Shih <tzungbi@kernel.org>
Sun, 14 Sep 2025 03:34:41 +0000 (11:34 +0800)
commit7a79b0bfd8b3995a39d25bffcf57273635c0e542
tree40faf42e10b3c26d0230d5b5eea4616174fa3ef0
parente19ceeb1c0f63e3e15b197c5f34797134b51ba0e
platform/chrome: cros_ec: Separate initialization from cros_ec_register()

Move the initialization of the `struct cros_ec_device` from
cros_ec_register() into cros_ec_device_alloc().

This decouples device initialization from registration.  By doing so,
the per-device lock is now available immediately after allocation,
allowing it to be used safely even before the device is fully
registered.

Link: https://lore.kernel.org/r/20250828083601.856083-4-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec.c