Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp637215ybv; Wed, 5 Feb 2020 11:44:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwMq2VWW6lAIgUixQiMAOOkikJUrfxH6CWSXDT4t+y8qrgRvWD0g1FvmHzU4Jw0/6CWSFr7 X-Received: by 2002:a9d:7487:: with SMTP id t7mr27733549otk.267.1580931884340; Wed, 05 Feb 2020 11:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580931884; cv=none; d=google.com; s=arc-20160816; b=rveax1nyStamJShoBhLSLs2H3PFiVNaGMwyPv+XwHf8vwLngC65Fg9NHhMUTTZwERO swNg4oNsGuBVnLiZHkNJ9vXMeNZh6H2bQSIW98DMZ1GZaZrRCj4FUffTs6qewebHFqo3 kUq/Td2nPM2hJCuAJjbrTFqkbklVbjayKANzXoxtXV9cJME3MuE2wdt6PSqF6wXw0Gh5 8GNixaCgxPHIQShDuLP8qnp+VABK/BuvDkiWfqBQFR77TQLU+Qyxwc5NX+HsDD6k3VFg oYxrpKYFdxW/XF4qrLZlr8wEhWz2DZkhRPYjkHF+RXhTyQUJYzdc8wv/c+2wY6N/XCH4 vFuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4tNmqVZiW++bCIMW549FZaWf//Au+3Hw7l0TwF264r8=; b=Gvq9azg1IqNys4+oxSMNfC5pBQn1aoNlN8uhQ8VKSluFUUvidf/fRluYhcU7KiJ/KQ F2RSAzkvOR5QC+P0vlPpD6pjFW69Ns4Unj1sw1zzl63ES/DrGg8VBq4CvdjxKVoQs76T T3pk2WG/F/MilTwPVDaiByOZI2PLPCYkFAbJEZ7m6YXHsHWlUZ7kPCcJ4KlOAbmkPTu/ tK36Hq5SSEE9a/6VSvyOt1q9oxwSB6HY4yTSfdE08RJ1X4JJOqt7sHYPziFpCSxdHnYk dQxnICt44hozfjPoRRJT3Ilt7qG0HlSSw8JVRfevG+oKw3aQd8CoYo22d+pO0/II2g74 ZAXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CQ3Lze5z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si608106oij.136.2020.02.05.11.44.31; Wed, 05 Feb 2020 11:44:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CQ3Lze5z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbgBETm0 (ORCPT + 99 others); Wed, 5 Feb 2020 14:42:26 -0500 Received: from mail-io1-f66.google.com ([209.85.166.66]:41888 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727079AbgBETm0 (ORCPT ); Wed, 5 Feb 2020 14:42:26 -0500 Received: by mail-io1-f66.google.com with SMTP id m25so3507573ioo.8 for ; Wed, 05 Feb 2020 11:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4tNmqVZiW++bCIMW549FZaWf//Au+3Hw7l0TwF264r8=; b=CQ3Lze5zaZTjmvhE3x3CrSo88h0oGNp0S8pHmB73CSZCa/zbWjTOuqj1DSyv7+LQ1Z TXumJ0aRVETgtfIfkuddmzWNsxznqiJLag5g2FuxwR1yIIdW5AgvkJZngkqL/tGsl1yE G7DM9Gz15hCx85y4b9zRJKC38nLawLWoIaWHA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4tNmqVZiW++bCIMW549FZaWf//Au+3Hw7l0TwF264r8=; b=nZZiKBlyyTYNJHEHSCWAH11piTtigpsV+DC1fGKOdW6wrI3d2qh4rHUA1J0o/fEnk+ A72jfuFV91d26KyvyhYmpWRL5OhKidGvX5GA0vzlJz6xXZrYOInln0Yyt4yQJMKtNp3f EYMPPWtQEGR5/5atleH/z7/PAMHJwehIdXSCSk0hqgD2a2kAMho8K3CHH2tYGxWkVQts efD/e22lKuXRlyPCdnb9YitCodS3r4TsvrFQiAdmjc9c+4mjOFF+6OPnnf7+ea6OnwVu 4PZ3Ggii5AhbMznkTpLS1ecv/KzGimJysU2GPwaw1EySpQ4ElmKLsvrKP6yCLgKXQpxr crPQ== X-Gm-Message-State: APjAAAVQGQe2buADFuh9a562Z1ekF7dILMz4em6uufPJMNB1g+pUqYO/ YNL7KsvjaVP8wHI8SSTqFziJIoOysqTDWD8kHdQkhw== X-Received: by 2002:a6b:dc03:: with SMTP id s3mr29708124ioc.50.1580931745506; Wed, 05 Feb 2020 11:42:25 -0800 (PST) MIME-Version: 1.0 References: <20200205190028.183069-1-pmalani@chromium.org> <20200205190028.183069-11-pmalani@chromium.org> In-Reply-To: <20200205190028.183069-11-pmalani@chromium.org> From: Gwendal Grignou Date: Wed, 5 Feb 2020 11:42:14 -0800 Message-ID: Subject: Re: [PATCH v2 10/17] iio: cros_ec: Use cros_ec_cmd() To: Prashant Malani Cc: linux-kernel , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , Lee Jones , Fabien Lahoudere , "open list:IIO SUBSYSTEM AND DRIVERS" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 5, 2020 at 11:13 AM Prashant Malani wrote: > > Replace cros_ec_cmd_xfer_status() with cros_ec_cmd() > which does the message buffer setup and cleanup. > > For one other usage, replace the cros_ec_cmd_xfer_status() call with a > call to cros_ec_cmd_xfer(), in preparation for the removal of the former > function. > > Signed-off-by: Prashant Malani Reviewed-by: Gwendal Grignou > --- > > Changes in v2: > - Updated to use new function name and parameter list. > - Used C99 element setting to initialize param struct. > - For second usage, replaced cros_ec_cmd_xfer_status() with > cros_ec_cmd_xfer() which is functionally similar. > > .../cros_ec_sensors/cros_ec_sensors_core.c | 25 +++++++------------ > 1 file changed, 9 insertions(+), 16 deletions(-) > > diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c > index d3a3626c7cd834..94e22e7d927631 100644 > --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c > +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c > @@ -30,24 +30,15 @@ static int cros_ec_get_host_cmd_version_mask(struct cros_ec_device *ec_dev, > u16 cmd_offset, u16 cmd, u32 *mask) > { > int ret; > - struct { > - struct cros_ec_command msg; > - union { > - struct ec_params_get_cmd_versions params; > - struct ec_response_get_cmd_versions resp; > - }; > - } __packed buf = { > - .msg = { > - .command = EC_CMD_GET_CMD_VERSIONS + cmd_offset, > - .insize = sizeof(struct ec_response_get_cmd_versions), > - .outsize = sizeof(struct ec_params_get_cmd_versions) > - }, > - .params = {.cmd = cmd} > + struct ec_params_get_cmd_versions params = { > + .cmd = cmd, > }; > + struct ec_response_get_cmd_versions resp = {0}; > > - ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg); > + ret = cros_ec_cmd(ec_dev, 0, EC_CMD_GET_CMD_VERSIONS + cmd_offset, > + ¶ms, sizeof(params), &resp, sizeof(resp), NULL); > if (ret >= 0) > - *mask = buf.resp.version_mask; > + *mask = resp.version_mask; > return ret; > } > > @@ -171,9 +162,11 @@ int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *state, > > memcpy(state->msg->data, &state->param, sizeof(state->param)); > > - ret = cros_ec_cmd_xfer_status(state->ec, state->msg); > + ret = cros_ec_cmd_xfer(state->ec, state->msg); > if (ret < 0) > return ret; > + else if (state->msg->result != EC_RES_SUCCESS) > + return -EPROTO; > > if (ret && > state->resp != (struct ec_response_motion_sense *)state->msg->data) > -- > 2.25.0.341.g760bfbb309-goog >