• Brian Norris's avatar
    platform/chrome: cros_ec_lpc: Force synchronous probe · ca821c1f
    Brian Norris authored
    This reverts commit bd88b965 ("platform/chrome: cros_ec_lpc: Mark
    PROBE_PREFER_ASYNCHRONOUS"), and then some.
    
    It has been reported that there are issues with 'cros-ec-keyb' devices
    that are children of this. As noted in the initial patch for its ACPI
    support (commit ba0f3214 ("Input: cros_ec_keyb - handle x86
    detachable/convertible Chromebooks")), it's possible to probe an ACPI
    child device before its parent is probed -- hence the need for
    EPROBE_DEFER. Unfortunately, poking your parent's dev_get_drvdata()
    isn't safe with asynchronous probe, as there's no locking, and the
    ordering is all wrong anyway (drvdata is set before the device is
    *really* ready).
    
    Because this parent/child relationship has known issues, let's go the
    other direction and force synchronous probe, until we resolve the
    issues.
    
    Possible solutions involve adding device links, so we ensure the child
    doesn't probe before the parent is done; or perhaps some other larger
    refactoring (auxiliary bus?). But that might take a little more effort
    and review, as there are many other potential sub-devices of
    cros_ec_lpc that could need patching.
    
    Note that we don't have the same problem for non-ACPI cros-ec hosts,
    like cros-ec-spi (commit 015e4b05 ("platform/chrome: cros_ec_spi:
    Set PROBE_PREFER_ASYNCHRONOUS")), because its sub-devices aren't created
    until cros_ec_register(), or they don't exist at all (e.g., FPMCU uses).
    
    Fixes: bd88b965 ("platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS")
    Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
    Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    Reviewed-by: default avatarGuenter Roeck <groeck@chromium.org>
    Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
    Link: https://lore.kernel.org/r/20221111231302.3458191-1-briannorris@chromium.org
    ca821c1f
cros_ec_lpc.c 15.7 KB