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_i2c.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_i2c.c')
-rw-r--r-- | drivers/platform/chrome/cros_ec_i2c.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/platform/chrome/cros_ec_i2c.c b/drivers/platform/chrome/cros_ec_i2c.c index ee3c5130ec3f..def1144a077e 100644 --- a/drivers/platform/chrome/cros_ec_i2c.c +++ b/drivers/platform/chrome/cros_ec_i2c.c @@ -297,16 +297,11 @@ static int cros_ec_i2c_probe(struct i2c_client *client) return -ENOMEM; i2c_set_clientdata(client, ec_dev); - ec_dev->dev = dev; ec_dev->priv = client; ec_dev->irq = client->irq; ec_dev->cmd_xfer = cros_ec_cmd_xfer_i2c; ec_dev->pkt_xfer = cros_ec_pkt_xfer_i2c; ec_dev->phys_name = client->adapter->name; - ec_dev->din_size = sizeof(struct ec_host_response_i2c) + - sizeof(struct ec_response_get_protocol_info); - ec_dev->dout_size = sizeof(struct ec_host_request_i2c) + - sizeof(struct ec_params_rwsig_action); err = cros_ec_register(ec_dev); if (err) { |