public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe
@ 2022-11-01 22:22 Brian Norris
  2022-11-01 22:22 ` [PATCH v2 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS Brian Norris
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Brian Norris @ 2022-11-01 22:22 UTC (permalink / raw)
  To: Benson Leung, Guenter Roeck; +Cc: chrome-platform, linux-kernel, Brian Norris

Disregarding the weird global state hiding in this cros_ec_lpc_mec_*()
stuff, it belongs in device probe. We shouldn't assume we can access
hardware resources when the device isn't attached to the driver.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---

Changes in v2:
 - drop cros_ec_lpc_mec_destroy() (removed in -next; was done wrong in
   my v1 anyway)

 drivers/platform/chrome/cros_ec_lpc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 6ef5e5d40ba4..48302183d62e 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -354,6 +354,9 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
+	cros_ec_lpc_mec_init(EC_HOST_CMD_REGION0,
+			     EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE);
+
 	/*
 	 * Read the mapped ID twice, the first one is assuming the
 	 * EC is a Microchip Embedded Controller (MEC) variant, if the
@@ -586,9 +589,6 @@ static int __init cros_ec_lpc_init(void)
 		return -ENODEV;
 	}
 
-	cros_ec_lpc_mec_init(EC_HOST_CMD_REGION0,
-			     EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE);
-
 	/* Register the driver */
 	ret = platform_driver_register(&cros_ec_lpc_driver);
 	if (ret) {
-- 
2.38.1.273.g43a17bfeac-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-02 12:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
2022-11-01 22:22 ` [PATCH v2 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-11-01 22:22 ` [PATCH v2 3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-11-01 22:22 ` [PATCH v2 4/5] platform/chrome: cros_ec_lightbar: " Brian Norris
2022-11-01 22:22 ` [PATCH v2 5/5] platform/chrome: cros_ec_spi: " Brian Norris
2022-11-02  4:30 ` [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe patchwork-bot+chrome-platform
2022-11-02 12:30 ` patchwork-bot+chrome-platform

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox