From nobody Tue Apr 28 03:55:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66E70C433EF for ; Mon, 6 Jun 2022 20:19:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233845AbiFFUTp (ORCPT ); Mon, 6 Jun 2022 16:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbiFFUT0 (ORCPT ); Mon, 6 Jun 2022 16:19:26 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04DA36006C for ; Mon, 6 Jun 2022 13:19:18 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id w3so12981378plp.13 for ; Mon, 06 Jun 2022 13:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZKgchf40btIWK1MuQdpSZKSX/1eMrpvBCXeKfQlCM0c=; b=WIF/p78dmBucCD0VYMMYwKH70nOq+zaDIaCJ9LAtoPv7eyKdRy1BUM3j0la302RRwq 6wyWClM9UTgpMIw6Mz8dmt2D8JkhWGjZ8G6JqvaDw+gE1uU3RgCZ8J4CGoNsgiAoA1Y9 Vfm59OXc8URyJKD85J5Y7oGWiuO+4rvvGKpSo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZKgchf40btIWK1MuQdpSZKSX/1eMrpvBCXeKfQlCM0c=; b=eLWdj3ZL1acg+fwceoUdevA1k6WPMO57mX7BWAkJLVwaz8UbFHCy6TKKWKsvWU7p6G 3dnjmb7C3OKbdUi1RFtRaDLrP80wTRY4BKKTLC56dgPu/upBAM0z8Up58urfbl+7LfSS JM1yOAR7mOxRd7fw7q+F7Cj5X5AxxlTFa5rS0FloOEWzkzE+g49RrYVdq0L12oXzqWxm 4E7zWGIAccWxGokBxP4iWZQ8lSd0zAViyXLhJvhrRMHdDGpQm82tdnaEQdAKcmoII/nz ClUEvtxJuSPJ61AKzT4XZQWubKIa8MBOg/6eh462/lPSWKLyPsrR6WHX97NjzZgcZoam tarw== X-Gm-Message-State: AOAM531FZUh5vLTHpNq3L2wznVQIH2DCRA1TZblcQSHP3tCtpHZ3Lb+G T5MI6mEMS9KbsB7aOzG86CcASLGqHPp7ImR/ X-Google-Smtp-Source: ABdhPJxkHiVN6DgKpmKwdRRTwjOWWrpuGHZS40T6pGHkSBA3jBQUl/2ZcAn9I2rENu2BRz+Bn+qKbQ== X-Received: by 2002:a17:902:f60e:b0:158:5c4d:d9b0 with SMTP id n14-20020a170902f60e00b001585c4dd9b0mr26200738plg.63.1654546758051; Mon, 06 Jun 2022 13:19:18 -0700 (PDT) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id l5-20020a170902d34500b0015ef27092aasm10883034plk.190.2022.06.06.13.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 13:19:17 -0700 (PDT) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: bleung@chromium.org, Prashant Malani , Stephen Boyd , chrome-platform@lists.linux.dev (open list:CHROME HARDWARE PLATFORM SUPPORT), Daisuke Nojiri , Enric Balletbo i Serra , Guenter Roeck , Lee Jones , Liam Girdwood , Mark Brown , Tzung-Bi Shih Subject: [PATCH 1/3] regulator: cros-ec: Use common cros_ec_command() Date: Mon, 6 Jun 2022 20:18:01 +0000 Message-Id: <20220606201825.763788-2-pmalani@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606201825.763788-1-pmalani@chromium.org> References: <20220606201825.763788-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Reduce code duplication by using the common cros_ec_command() function instead of the locally defined variant. Cc: Stephen Boyd Signed-off-by: Prashant Malani Acked-by: Mark Brown Reviewed-by: Guenter Roeck Reviewed-by: Stephen Boyd --- drivers/regulator/cros-ec-regulator.c | 54 ++++++--------------------- 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/drivers/regulator/cros-ec-regulator.c b/drivers/regulator/cros= -ec-regulator.c index c4754f3cf233..1c5fc74a4776 100644 --- a/drivers/regulator/cros-ec-regulator.c +++ b/drivers/regulator/cros-ec-regulator.c @@ -22,36 +22,6 @@ struct cros_ec_regulator_data { u16 num_voltages; }; =20 -static int cros_ec_cmd(struct cros_ec_device *ec, u32 version, u32 command, - void *outdata, u32 outsize, void *indata, u32 insize) -{ - struct cros_ec_command *msg; - int ret; - - msg =3D kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL); - if (!msg) - return -ENOMEM; - - msg->version =3D version; - msg->command =3D command; - msg->outsize =3D outsize; - msg->insize =3D insize; - - if (outdata && outsize > 0) - memcpy(msg->data, outdata, outsize); - - ret =3D cros_ec_cmd_xfer_status(ec, msg); - if (ret < 0) - goto cleanup; - - if (insize) - memcpy(indata, msg->data, insize); - -cleanup: - kfree(msg); - return ret; -} - static int cros_ec_regulator_enable(struct regulator_dev *dev) { struct cros_ec_regulator_data *data =3D rdev_get_drvdata(dev); @@ -60,8 +30,8 @@ static int cros_ec_regulator_enable(struct regulator_dev = *dev) .enable =3D 1, }; =20 - return cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, - sizeof(cmd), NULL, 0); + return cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, + sizeof(cmd), NULL, 0); } =20 static int cros_ec_regulator_disable(struct regulator_dev *dev) @@ -72,8 +42,8 @@ static int cros_ec_regulator_disable(struct regulator_dev= *dev) .enable =3D 0, }; =20 - return cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, - sizeof(cmd), NULL, 0); + return cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, + sizeof(cmd), NULL, 0); } =20 static int cros_ec_regulator_is_enabled(struct regulator_dev *dev) @@ -85,8 +55,8 @@ static int cros_ec_regulator_is_enabled(struct regulator_= dev *dev) struct ec_response_regulator_is_enabled resp; int ret; =20 - ret =3D cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_IS_ENABLED, &cmd, - sizeof(cmd), &resp, sizeof(resp)); + ret =3D cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_IS_ENABLED, &cm= d, + sizeof(cmd), &resp, sizeof(resp)); if (ret < 0) return ret; return resp.enabled; @@ -112,8 +82,8 @@ static int cros_ec_regulator_get_voltage(struct regulato= r_dev *dev) struct ec_response_regulator_get_voltage resp; int ret; =20 - ret =3D cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_GET_VOLTAGE, &cmd, - sizeof(cmd), &resp, sizeof(resp)); + ret =3D cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_GET_VOLTAGE, &c= md, + sizeof(cmd), &resp, sizeof(resp)); if (ret < 0) return ret; return resp.voltage_mv * 1000; @@ -138,8 +108,8 @@ static int cros_ec_regulator_set_voltage(struct regulat= or_dev *dev, int min_uV, if (min_mV > max_mV) return -EINVAL; =20 - return cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_SET_VOLTAGE, &cmd, - sizeof(cmd), NULL, 0); + return cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_SET_VOLTAGE, &cm= d, + sizeof(cmd), NULL, 0); } =20 static const struct regulator_ops cros_ec_regulator_voltage_ops =3D { @@ -160,8 +130,8 @@ static int cros_ec_regulator_init_info(struct device *d= ev, struct ec_response_regulator_get_info resp; int ret; =20 - ret =3D cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_GET_INFO, &cmd, - sizeof(cmd), &resp, sizeof(resp)); + ret =3D cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_GET_INFO, &cmd, + sizeof(cmd), &resp, sizeof(resp)); if (ret < 0) return ret; =20 --=20 2.36.1.255.ge46751e96f-goog From nobody Tue Apr 28 03:55:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B32BC433EF for ; Mon, 6 Jun 2022 20:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233423AbiFFUUe (ORCPT ); Mon, 6 Jun 2022 16:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233647AbiFFUT7 (ORCPT ); Mon, 6 Jun 2022 16:19:59 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C112AE01 for ; Mon, 6 Jun 2022 13:19:47 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id cx11so13741013pjb.1 for ; Mon, 06 Jun 2022 13:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GK+uLiKUQmDn4qQpEUrcKDkvRTeqeq7QinyjcpvL3S8=; b=jWg3lKTQmJemYku9cAwoolQkQaPqFwe6dueJOg0YJmYixP7gTPLFFAiTknd5uYFEep xZdBKrt2e7pstsQYIotWzXV20zw8PnL1bbfjxD6uOsRGumqhzhUKNYVjwA4qxFjmXvO1 mGpkY12f4LFA6GTmoCDx/1DV9be44ocsbykQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GK+uLiKUQmDn4qQpEUrcKDkvRTeqeq7QinyjcpvL3S8=; b=lTAOGTHpU2TZXV6MYwWS03C4zZO68+oMbbDDpnb35ikvCdfmu8YDY4A23rZfKkZ5Fx EkkEiaWM7is/tXLcinQDKG9+LlWvRIVvaEUJ8uFlg3gcaRwk46B2qiNM7+bnuccm1A6n Xtr7H37fhO8W3eRFbmfKPNxUlRP1r992HdnzDqMI7IrKKld7a51QxpOo26dybsCPIFZR Ll1670F8llCCxLgeBc0HjBnuR3k0K2rrmhn90eIblxSTub/m6nGmgGL9FBlwXQFaU8PS qmP+pwxRh0EV81aaPP4P/xILaQHVM8gCf7/Bp15gbB9PGFBqz0Lrx5RyD0kUQB6gWSby N0eg== X-Gm-Message-State: AOAM531dVOJAoAFF1rgJnZyIPgSjcQIHkvT82ZKaoMr+nKVGoOfrSYYz rIHSwC6kZ3Huia7xWRkrPJVBJUJ83DbbuPDH X-Google-Smtp-Source: ABdhPJwTcOlTgTx5mTnFiZz+7tuHpNFSr/yyvDmX+aVuOgxbmbNnO9aPmOmYET4NzpIDTzgyBvDbbA== X-Received: by 2002:a17:903:40d0:b0:167:5fe8:ce7f with SMTP id t16-20020a17090340d000b001675fe8ce7fmr14509770pld.85.1654546786111; Mon, 06 Jun 2022 13:19:46 -0700 (PDT) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id l5-20020a170902d34500b0015ef27092aasm10883034plk.190.2022.06.06.13.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 13:19:45 -0700 (PDT) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: bleung@chromium.org, Prashant Malani , Stephen Boyd , Brian Norris , chrome-platform@lists.linux.dev (open list:CHROME HARDWARE PLATFORM SUPPORT), Enric Balletbo i Serra , Guenter Roeck , Lee Jones , Liam Girdwood , Mark Brown , Tzung-Bi Shih Subject: [PATCH 2/3] platform/chrome: cros_ec_proto: Rename cros_ec_command function Date: Mon, 6 Jun 2022 20:18:03 +0000 Message-Id: <20220606201825.763788-3-pmalani@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606201825.763788-1-pmalani@chromium.org> References: <20220606201825.763788-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" cros_ec_command() is the name of a function as well as a struct, as such it can confuse indexing tools (like ctags). Avoid this by renaming it to cros_ec_cmd(). Update all the callsites to use the new name. This patch is a find-and-replace, so should not introduce any functional changes. Suggested-by: Stephen Boyd Signed-off-by: Prashant Malani Acked-by: Lee Jones Reviewed-by: Guenter Roeck Reviewed-by: Stephen Boyd --- drivers/mfd/cros_ec_dev.c | 4 +-- drivers/platform/chrome/cros_ec_proto.c | 22 ++++++------ drivers/platform/chrome/cros_ec_typec.c | 39 ++++++++++----------- drivers/platform/chrome/cros_usbpd_notify.c | 4 +-- drivers/regulator/cros-ec-regulator.c | 24 ++++++------- include/linux/platform_data/cros_ec_proto.h | 2 +- 6 files changed, 47 insertions(+), 48 deletions(-) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index 596731caf407..02d4271dfe06 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -250,8 +250,8 @@ static int ec_device_probe(struct platform_device *pdev) * The PCHG device cannot be detected by sending EC_FEATURE_GET_CMD, but * it can be detected by querying the number of peripheral chargers. */ - retval =3D cros_ec_command(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0, - &pchg_count, sizeof(pchg_count)); + retval =3D cros_ec_cmd(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0, + &pchg_count, sizeof(pchg_count)); if (retval >=3D 0 && pchg_count.port_count) { retval =3D mfd_add_hotplug_devices(ec->dev, cros_ec_pchg_cells, diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chr= ome/cros_ec_proto.c index 13ced9d2dd71..b6bea183ee28 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -860,8 +860,8 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int= feature) =20 if (features->flags[0] =3D=3D -1U && features->flags[1] =3D=3D -1U) { /* features bitmap not read yet */ - ret =3D cros_ec_command(ec->ec_dev, 0, EC_CMD_GET_FEATURES + ec->cmd_off= set, - NULL, 0, features, sizeof(*features)); + ret =3D cros_ec_cmd(ec->ec_dev, 0, EC_CMD_GET_FEATURES + ec->cmd_offset, + NULL, 0, features, sizeof(*features)); if (ret < 0) { dev_warn(ec->dev, "cannot get EC features: %d\n", ret); memset(features, 0, sizeof(*features)); @@ -942,7 +942,7 @@ int cros_ec_get_sensor_count(struct cros_ec_dev *ec) EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count); =20 /** - * cros_ec_command - Send a command to the EC. + * cros_ec_cmd - Send a command to the EC. * * @ec_dev: EC device * @version: EC command version @@ -954,13 +954,13 @@ EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count); * * Return: >=3D 0 on success, negative error number on failure. */ -int cros_ec_command(struct cros_ec_device *ec_dev, - unsigned int version, - int command, - void *outdata, - int outsize, - void *indata, - int insize) +int cros_ec_cmd(struct cros_ec_device *ec_dev, + unsigned int version, + int command, + void *outdata, + int outsize, + void *indata, + int insize) { struct cros_ec_command *msg; int ret; @@ -987,4 +987,4 @@ int cros_ec_command(struct cros_ec_device *ec_dev, kfree(msg); return ret; } -EXPORT_SYMBOL_GPL(cros_ec_command); +EXPORT_SYMBOL_GPL(cros_ec_cmd); diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chr= ome/cros_ec_typec.c index 7cb2e35c4ded..d6088ba447af 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -525,8 +525,8 @@ static int cros_typec_configure_mux(struct cros_typec_d= ata *typec, int port_num, enum typec_orientation orientation; int ret; =20 - ret =3D cros_ec_command(typec->ec, 0, EC_CMD_USB_PD_MUX_INFO, - &req, sizeof(req), &resp, sizeof(resp)); + ret =3D cros_ec_cmd(typec->ec, 0, EC_CMD_USB_PD_MUX_INFO, + &req, sizeof(req), &resp, sizeof(resp)); if (ret < 0) { dev_warn(typec->dev, "Failed to get mux info for port: %d, err =3D %d\n", port_num, ret); @@ -585,8 +585,8 @@ static int cros_typec_configure_mux(struct cros_typec_d= ata *typec, int port_num, /* Sending Acknowledgment to EC */ mux_ack.port =3D port_num; =20 - if (cros_ec_command(typec->ec, 0, EC_CMD_USB_PD_MUX_ACK, &mux_ack, - sizeof(mux_ack), NULL, 0) < 0) + if (cros_ec_cmd(typec->ec, 0, EC_CMD_USB_PD_MUX_ACK, &mux_ack, + sizeof(mux_ack), NULL, 0) < 0) dev_warn(typec->dev, "Failed to send Mux ACK to EC for port: %d\n", port_num); @@ -754,8 +754,8 @@ static int cros_typec_handle_sop_prime_disc(struct cros= _typec_data *typec, int p int ret =3D 0; =20 memset(disc, 0, EC_PROTO2_MAX_RESPONSE_SIZE); - ret =3D cros_ec_command(typec->ec, 0, EC_CMD_TYPEC_DISCOVERY, &req, sizeo= f(req), - disc, EC_PROTO2_MAX_RESPONSE_SIZE); + ret =3D cros_ec_cmd(typec->ec, 0, EC_CMD_TYPEC_DISCOVERY, &req, sizeof(re= q), + disc, EC_PROTO2_MAX_RESPONSE_SIZE); if (ret < 0) { dev_err(typec->dev, "Failed to get SOP' discovery data for port: %d\n", = port_num); goto sop_prime_disc_exit; @@ -837,8 +837,8 @@ static int cros_typec_handle_sop_disc(struct cros_typec= _data *typec, int port_nu typec_partner_set_pd_revision(port->partner, pd_revision); =20 memset(sop_disc, 0, EC_PROTO2_MAX_RESPONSE_SIZE); - ret =3D cros_ec_command(typec->ec, 0, EC_CMD_TYPEC_DISCOVERY, &req, sizeo= f(req), - sop_disc, EC_PROTO2_MAX_RESPONSE_SIZE); + ret =3D cros_ec_cmd(typec->ec, 0, EC_CMD_TYPEC_DISCOVERY, &req, sizeof(re= q), + sop_disc, EC_PROTO2_MAX_RESPONSE_SIZE); if (ret < 0) { dev_err(typec->dev, "Failed to get SOP discovery data for port: %d\n", p= ort_num); goto disc_exit; @@ -870,8 +870,8 @@ static int cros_typec_send_clear_event(struct cros_type= c_data *typec, int port_n .clear_events_mask =3D events_mask, }; =20 - return cros_ec_command(typec->ec, 0, EC_CMD_TYPEC_CONTROL, &req, - sizeof(req), NULL, 0); + return cros_ec_cmd(typec->ec, 0, EC_CMD_TYPEC_CONTROL, &req, + sizeof(req), NULL, 0); } =20 static void cros_typec_handle_status(struct cros_typec_data *typec, int po= rt_num) @@ -882,8 +882,8 @@ static void cros_typec_handle_status(struct cros_typec_= data *typec, int port_num }; int ret; =20 - ret =3D cros_ec_command(typec->ec, 0, EC_CMD_TYPEC_STATUS, &req, sizeof(r= eq), - &resp, sizeof(resp)); + ret =3D cros_ec_cmd(typec->ec, 0, EC_CMD_TYPEC_STATUS, &req, sizeof(req), + &resp, sizeof(resp)); if (ret < 0) { dev_warn(typec->dev, "EC_CMD_TYPEC_STATUS failed for port: %d\n", port_n= um); return; @@ -960,9 +960,9 @@ static int cros_typec_port_update(struct cros_typec_dat= a *typec, int port_num) req.mux =3D USB_PD_CTRL_MUX_NO_CHANGE; req.swap =3D USB_PD_CTRL_SWAP_NONE; =20 - ret =3D cros_ec_command(typec->ec, typec->pd_ctrl_ver, - EC_CMD_USB_PD_CONTROL, &req, sizeof(req), - &resp, sizeof(resp)); + ret =3D cros_ec_cmd(typec->ec, typec->pd_ctrl_ver, + EC_CMD_USB_PD_CONTROL, &req, sizeof(req), + &resp, sizeof(resp)); if (ret < 0) return ret; =20 @@ -997,9 +997,8 @@ static int cros_typec_get_cmd_version(struct cros_typec= _data *typec) =20 /* We're interested in the PD control command version. */ req_v1.cmd =3D EC_CMD_USB_PD_CONTROL; - ret =3D cros_ec_command(typec->ec, 1, EC_CMD_GET_CMD_VERSIONS, - &req_v1, sizeof(req_v1), &resp, - sizeof(resp)); + ret =3D cros_ec_cmd(typec->ec, 1, EC_CMD_GET_CMD_VERSIONS, + &req_v1, sizeof(req_v1), &resp, sizeof(resp)); if (ret < 0) return ret; =20 @@ -1090,8 +1089,8 @@ static int cros_typec_probe(struct platform_device *p= dev) typec->typec_cmd_supported =3D cros_ec_check_features(ec_dev, EC_FEATURE_= TYPEC_CMD); typec->needs_mux_ack =3D cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_= MUX_REQUIRE_AP_ACK); =20 - ret =3D cros_ec_command(typec->ec, 0, EC_CMD_USB_PD_PORTS, NULL, 0, - &resp, sizeof(resp)); + ret =3D cros_ec_cmd(typec->ec, 0, EC_CMD_USB_PD_PORTS, NULL, 0, + &resp, sizeof(resp)); if (ret < 0) return ret; =20 diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform= /chrome/cros_usbpd_notify.c index 91ce6be91aac..4b5a81c9dc6d 100644 --- a/drivers/platform/chrome/cros_usbpd_notify.c +++ b/drivers/platform/chrome/cros_usbpd_notify.c @@ -71,8 +71,8 @@ static void cros_usbpd_get_event_and_notify(struct device= *dev, } =20 /* Check for PD host events on EC. */ - ret =3D cros_ec_command(ec_dev, 0, EC_CMD_PD_HOST_EVENT_STATUS, - NULL, 0, &host_event_status, sizeof(host_event_status)); + ret =3D cros_ec_cmd(ec_dev, 0, EC_CMD_PD_HOST_EVENT_STATUS, + NULL, 0, &host_event_status, sizeof(host_event_status)); if (ret < 0) { dev_warn(dev, "Can't get host event status (err: %d)\n", ret); goto send_notify; diff --git a/drivers/regulator/cros-ec-regulator.c b/drivers/regulator/cros= -ec-regulator.c index 1c5fc74a4776..1591636f86c3 100644 --- a/drivers/regulator/cros-ec-regulator.c +++ b/drivers/regulator/cros-ec-regulator.c @@ -30,8 +30,8 @@ static int cros_ec_regulator_enable(struct regulator_dev = *dev) .enable =3D 1, }; =20 - return cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, - sizeof(cmd), NULL, 0); + return cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, + sizeof(cmd), NULL, 0); } =20 static int cros_ec_regulator_disable(struct regulator_dev *dev) @@ -42,8 +42,8 @@ static int cros_ec_regulator_disable(struct regulator_dev= *dev) .enable =3D 0, }; =20 - return cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, - sizeof(cmd), NULL, 0); + return cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_ENABLE, &cmd, + sizeof(cmd), NULL, 0); } =20 static int cros_ec_regulator_is_enabled(struct regulator_dev *dev) @@ -55,8 +55,8 @@ static int cros_ec_regulator_is_enabled(struct regulator_= dev *dev) struct ec_response_regulator_is_enabled resp; int ret; =20 - ret =3D cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_IS_ENABLED, &cm= d, - sizeof(cmd), &resp, sizeof(resp)); + ret =3D cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_IS_ENABLED, &cmd, + sizeof(cmd), &resp, sizeof(resp)); if (ret < 0) return ret; return resp.enabled; @@ -82,8 +82,8 @@ static int cros_ec_regulator_get_voltage(struct regulator= _dev *dev) struct ec_response_regulator_get_voltage resp; int ret; =20 - ret =3D cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_GET_VOLTAGE, &c= md, - sizeof(cmd), &resp, sizeof(resp)); + ret =3D cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_GET_VOLTAGE, &cmd, + sizeof(cmd), &resp, sizeof(resp)); if (ret < 0) return ret; return resp.voltage_mv * 1000; @@ -108,8 +108,8 @@ static int cros_ec_regulator_set_voltage(struct regulat= or_dev *dev, int min_uV, if (min_mV > max_mV) return -EINVAL; =20 - return cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_SET_VOLTAGE, &cm= d, - sizeof(cmd), NULL, 0); + return cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_SET_VOLTAGE, &cmd, + sizeof(cmd), NULL, 0); } =20 static const struct regulator_ops cros_ec_regulator_voltage_ops =3D { @@ -130,8 +130,8 @@ static int cros_ec_regulator_init_info(struct device *d= ev, struct ec_response_regulator_get_info resp; int ret; =20 - ret =3D cros_ec_command(data->ec_dev, 0, EC_CMD_REGULATOR_GET_INFO, &cmd, - sizeof(cmd), &resp, sizeof(resp)); + ret =3D cros_ec_cmd(data->ec_dev, 0, EC_CMD_REGULATOR_GET_INFO, &cmd, + sizeof(cmd), &resp, sizeof(resp)); if (ret < 0) return ret; =20 diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/pl= atform_data/cros_ec_proto.h index 138fd912c808..816da4eef3e5 100644 --- a/include/linux/platform_data/cros_ec_proto.h +++ b/include/linux/platform_data/cros_ec_proto.h @@ -231,7 +231,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int= feature); =20 int cros_ec_get_sensor_count(struct cros_ec_dev *ec); =20 -int cros_ec_command(struct cros_ec_device *ec_dev, unsigned int version, i= nt command, void *outdata, +int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int c= ommand, void *outdata, int outsize, void *indata, int insize); =20 /** --=20 2.36.1.255.ge46751e96f-goog From nobody Tue Apr 28 03:55:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F417C43334 for ; Mon, 6 Jun 2022 20:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233714AbiFFUUo (ORCPT ); Mon, 6 Jun 2022 16:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234234AbiFFUUX (ORCPT ); Mon, 6 Jun 2022 16:20:23 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A40DEDA0 for ; Mon, 6 Jun 2022 13:20:11 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id j6so13566991pfe.13 for ; Mon, 06 Jun 2022 13:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zICvYCx4eGxVrXk8LpGPKi4keG/OpLNxmOtIxsqErvI=; b=IagWj/SYc4/Y9FtFzDCdKS0529Z4XuGo/muGY5dQdCpyLFUW4vJ6bi0MvsqL2kl5Ag x6oaZvLNOMpEwbKp3Hr7hRhbVM2hoMI1eIwsPfTLGax/rgzs75IqMS0pNkoSyhk9NLZz pebdYMxt0VX9bf4CyTFGLvAjhw/vC87BDFvfc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zICvYCx4eGxVrXk8LpGPKi4keG/OpLNxmOtIxsqErvI=; b=vVcqedDD9Xk27/0BEylKFBYVczTfHvi8BzUZENAnMOjkN+7e8NajtWCsMzpKSSsAPW I4NFqDnmKBrF0jJK4mUuFnsrU8c8iGvu90dUtoJEOX/gXULlV25WPB4mwAbZxrKJ3uCE f4Oh/Eu6Irz0vmkw1FdD2AuxrHyfDSzpx1tMjls0tq9CNnIlr4sbISZcMOl16LnbMu82 oof1PUYQ7kp2yewCSuQjAfkL+hcVsjb++0W3GPfI2ZnIttY5h6AHvUWozd+JD+LLveTD J1b8l6VonDENENQukJhplxoi2x11aSdfDdnsvPzxWuVJOGGRm//giW2zIKY+jGQgVjdI sa3g== X-Gm-Message-State: AOAM5305JY0RgyR3LIWs/yE6v0BKhp/G2SDFn5uxEZwfDgPCQoDkwXvI kRc5fm9O/tWib3Ivm+JXewmqLrkMX3hDcdwR X-Google-Smtp-Source: ABdhPJzhSZmC7qAnR3r/4uCpN7yK371WiuxS6DFokrY0B9A6JlwUmhG3U3RSl+6CPJFBjoOq2WeGEQ== X-Received: by 2002:a63:2360:0:b0:3fb:ee61:82cf with SMTP id u32-20020a632360000000b003fbee6182cfmr22288194pgm.574.1654546810993; Mon, 06 Jun 2022 13:20:10 -0700 (PDT) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id l5-20020a170902d34500b0015ef27092aasm10883034plk.190.2022.06.06.13.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 13:20:10 -0700 (PDT) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: bleung@chromium.org, Prashant Malani , Stephen Boyd , Guenter Roeck , Enric Balletbo i Serra , Tzung-Bi Shih , Brian Norris , chrome-platform@lists.linux.dev (open list:CHROME HARDWARE PLATFORM SUPPORT) Subject: [PATCH 3/3] platform/chrome: cros_ec_proto: Update size arg types Date: Mon, 6 Jun 2022 20:18:05 +0000 Message-Id: <20220606201825.763788-4-pmalani@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606201825.763788-1-pmalani@chromium.org> References: <20220606201825.763788-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" cros_ec_cmd() takes 2 size arguments. Update them to be of the more appropriate type size_t. Suggested-by: Stephen Boyd Signed-off-by: Prashant Malani Reviewed-by: Guenter Roeck Reviewed-by: Stephen Boyd --- drivers/platform/chrome/cros_ec_proto.c | 4 ++-- include/linux/platform_data/cros_ec_proto.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chr= ome/cros_ec_proto.c index b6bea183ee28..cefabfe45551 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -958,9 +958,9 @@ int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, void *outdata, - int outsize, + size_t outsize, void *indata, - int insize) + size_t insize) { struct cros_ec_command *msg; int ret; diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/pl= atform_data/cros_ec_proto.h index 816da4eef3e5..85e29300f63d 100644 --- a/include/linux/platform_data/cros_ec_proto.h +++ b/include/linux/platform_data/cros_ec_proto.h @@ -232,7 +232,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int= feature); int cros_ec_get_sensor_count(struct cros_ec_dev *ec); =20 int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int c= ommand, void *outdata, - int outsize, void *indata, int insize); + size_t outsize, void *indata, size_t insize); =20 /** * cros_ec_get_time_ns() - Return time in ns. --=20 2.36.1.255.ge46751e96f-goog