Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4037615ybv; Tue, 25 Feb 2020 11:56:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxH9PrQZoqf0yzetCmWSyzb8eJupyZlNQt8yaG+VL14JfpPAaHwzDIpOGWgub8dWio/sfIA X-Received: by 2002:a05:6808:249:: with SMTP id m9mr457687oie.5.1582660596793; Tue, 25 Feb 2020 11:56:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582660596; cv=none; d=google.com; s=arc-20160816; b=bCj4UTXYzRCVHQNYcpY1/UQ5iUtwnb6JZMPGnMwextOAbB/9pfJmIm7lJ5TvizCWz2 CNb6VCguv2E4/2KfMD1Nm+M7TZdd/iT+3tuhPIITma6AYpIKNKbsfYjWVTaswF/F5AdE XJd1C9+SOnlvC1oM0/v1yxnXTqhiqzWwlv4q+wl2G+Yl3HHdO8rBg0KUMjeJp7Ub+82b 0cHpeL0pk1T48tIx2v4PYUdNtEIVwurgfHC2H5ZOWxGARhBNBI9jzhftGo+mmIrHDh/U DNSi0PelDlSgjY3VIno7NsHKYk0ky8RVThtQ8JrLImu7F97qWwu6cQ+xQ0b7Q/8D0o08 XZqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SnsV7ukks/HdHQSNSo2jKDAJZMw+RXgFpVQ1NWbWeJ4=; b=Rl86aRKYDIUnRGd/ps11MaPASxiffOYm3Q0koJzqlLuOv2b93mjspbaD6DUqmKRrSL +J8LX+XWDAis3DIwKtMSenU7QA77sK6Mfm7NEUKUH2hohNjP3Oak4ZlzUFS88/UmuSNs MPfdzppuoWU+Bx+HjHXUvNdXG8F0DlhIIF/1M/2zm00aRGaiyq/JjOdyoQjXlFRA6yId K6enCr5pbHFvRwOPS/wAt6s873hhXqbw5yzdkt5fHtfG5XdFZ0Iy/Mfqy0VvT4LGPA7U laWMlcUdjgu8JhJm7RF9lxFDE0jmfr1o2DVXo5uLW/QnkhzOQhlD114G5XSs6NWvs7rj UKaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cvLez4k2; 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 v18si112973otq.209.2020.02.25.11.56.24; Tue, 25 Feb 2020 11:56:36 -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=cvLez4k2; 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 S1731178AbgBYTzY (ORCPT + 99 others); Tue, 25 Feb 2020 14:55:24 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:40205 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbgBYTzY (ORCPT ); Tue, 25 Feb 2020 14:55:24 -0500 Received: by mail-pj1-f67.google.com with SMTP id 12so170375pjb.5 for ; Tue, 25 Feb 2020 11:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SnsV7ukks/HdHQSNSo2jKDAJZMw+RXgFpVQ1NWbWeJ4=; b=cvLez4k2FMczRwg3HTgCnssgLc9hcjpdA7sScgfJYSyKQS7N0vsqyEphpfVUGVNumO Lz4Zk63sF9n0txyw++6a+NP7F6D9+1wPKN++pGBrFoYrgtu7n+xBdAWoy0yrbsp/1wH8 t36jE/s/FvXbCBtx+8eGLY8NLyK5vuww2AMH4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SnsV7ukks/HdHQSNSo2jKDAJZMw+RXgFpVQ1NWbWeJ4=; b=mR9q6A6RG/7Z/W7Joj7HOUhxTAp/QCiLP1A1cr4BvcCQcHfdsERjdi2/pvpnFrSRJ1 4ZxpR/O34jJT+SOPKJKI3GkJK/G8+ztBKgbGe6lmat1+HE88qKQSfzhTI+Sw53TVSVHC yoZKQjEL9eePh0ulh9tTHBXBh/V43rn2uk+ssl0AX89uV5P2Zs/gMbKL3d3gV5HAC1i6 +171MBxurnPKBJkultXFh6GzfFbfywGC9hhncEz5bFmdxrT0ukuMSlkPiZFv9Kjc0ARi vy5lmrJyhgyryD13xonRdM7+ROPqPCTUHcoKMkhlE/3gJgDo/Wba1TNgDRKm2ttrTbTx lI4w== X-Gm-Message-State: APjAAAUOf0aJeziu43GTUqfWX8yff+Qwe9HocUj092tceO/zujPqvaSn CoHli4MjwU7NJp3/GYgMkEuz8Q== X-Received: by 2002:a17:90a:33a1:: with SMTP id n30mr746208pjb.6.1582660522012; Tue, 25 Feb 2020 11:55:22 -0800 (PST) Received: from google.com ([2620:15c:202:201:476b:691:abc3:38db]) by smtp.gmail.com with ESMTPSA id s7sm4355059pjk.22.2020.02.25.11.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 11:55:21 -0800 (PST) Date: Tue, 25 Feb 2020 11:55:19 -0800 From: Prashant Malani To: Enric Balletbo i Serra Cc: linux-kernel@vger.kernel.org, Collabora Kernel ML , groeck@chromium.org, bleung@chromium.org, dtor@chromium.org, gwendal@chromium.org Subject: Re: [PATCH 4/8] platform/chrome: cros_ec_chardev: Use cros_ec_cmd_xfer_status helper Message-ID: <20200225195519.GC11971@google.com> References: <20200220155859.906647-1-enric.balletbo@collabora.com> <20200220155859.906647-5-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200220155859.906647-5-enric.balletbo@collabora.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Enric, On Thu, Feb 20, 2020 at 04:58:55PM +0100, Enric Balletbo i Serra wrote: > This patch makes use of cros_ec_cmd_xfer_status() instead of > cros_ec_cmd_xfer(). In this case the change is trivial and the only > reason to do it is because we want to make cros_ec_cmd_xfer() a private > function for the EC protocol and let people only use the > cros_ec_cmd_xfer_status() to return Linux standard error codes. > > Signed-off-by: Enric Balletbo i Serra > --- > > drivers/platform/chrome/cros_ec_chardev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c > index c65e70bc168d..b51ab24055f3 100644 > --- a/drivers/platform/chrome/cros_ec_chardev.c > +++ b/drivers/platform/chrome/cros_ec_chardev.c > @@ -301,7 +301,7 @@ static long cros_ec_chardev_ioctl_xcmd(struct cros_ec_dev *ec, void __user *arg) > } > > s_cmd->command += ec->cmd_offset; > - ret = cros_ec_cmd_xfer(ec->ec_dev, s_cmd); > + ret = cros_ec_cmd_xfer_status(ec->ec_dev, s_cmd); One issue I see here is that if we were to later convert cros_ec_cmd_xfer_status() to cros_ec_cmd(), we would lose the s_cmd->result value, since I was hoping to avoid returning msg->result via a pointer parameter. I don't know if userspace actually uses that, but I am assuming it does. So, should cros_ec_cmd() keep the *result pointer like so ?: int cros_ec_cmd(struct cros_ec_device *ec, u32 version, u32 command, void *outdata, u32 outsize, void *indata, u32 insize, u32 *result); This way, we can manually re-populate s_cmd->result with |*result|. Or, should we drop msg->result while returning s_cmd to userspace? I am guessing the answer is no, but thought I'd check with you first. Best regards, > /* Only copy data to userland if data was received. */ > if (ret < 0) > goto exit; > -- > 2.25.0 >