diff options
author | Tzung-Bi Shih <tzungbi@kernel.org> | 2025-08-28 11:35:58 +0300 |
---|---|---|
committer | Tzung-Bi Shih <tzungbi@kernel.org> | 2025-09-14 06:34:41 +0300 |
commit | e19ceeb1c0f63e3e15b197c5f34797134b51ba0e (patch) | |
tree | 3737c3fd556834d10f91e43f5fb38623884984d3 /drivers/platform/chrome/cros_ec_spi.c | |
parent | 918856986014142271a70a334d300994b9c41720 (diff) | |
download | linux-e19ceeb1c0f63e3e15b197c5f34797134b51ba0e.tar.xz |
platform/chrome: Centralize common cros_ec_device initialization
Move the common initialization from protocol device drivers into central
cros_ec_device_alloc().
This removes duplicated code from each driver's probe function.
The buffer sizes are now calculated once, using the maximum possible
overhead required by any of the transport protocols, ensuring the
allocated buffers are sufficient for all cases.
Link: https://lore.kernel.org/r/20250828083601.856083-3-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Diffstat (limited to 'drivers/platform/chrome/cros_ec_spi.c')
-rw-r--r-- | drivers/platform/chrome/cros_ec_spi.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c index c778300a4145..28fa82f8cb07 100644 --- a/drivers/platform/chrome/cros_ec_spi.c +++ b/drivers/platform/chrome/cros_ec_spi.c @@ -757,16 +757,11 @@ static int cros_ec_spi_probe(struct spi_device *spi) cros_ec_spi_dt_probe(ec_spi, dev); spi_set_drvdata(spi, ec_dev); - ec_dev->dev = dev; ec_dev->priv = ec_spi; ec_dev->irq = spi->irq; ec_dev->cmd_xfer = cros_ec_cmd_xfer_spi; ec_dev->pkt_xfer = cros_ec_pkt_xfer_spi; ec_dev->phys_name = dev_name(&ec_spi->spi->dev); - ec_dev->din_size = EC_MSG_PREAMBLE_COUNT + - sizeof(struct ec_host_response) + - sizeof(struct ec_response_get_protocol_info); - ec_dev->dout_size = sizeof(struct ec_host_request) + sizeof(struct ec_params_rwsig_action); ec_spi->last_transfer_ns = ktime_get_ns(); |