Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp825671ybv; Thu, 20 Feb 2020 07:59:43 -0800 (PST) X-Google-Smtp-Source: APXvYqy62Z9YX6QFCrNrYKXldqxKWxi3elYYLL04ozzJKORnVy45nU87Xkb+pnfhmlIiZ+vJ9VvM X-Received: by 2002:a54:4117:: with SMTP id l23mr2489944oic.140.1582214383174; Thu, 20 Feb 2020 07:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582214383; cv=none; d=google.com; s=arc-20160816; b=Mh0FA7ZL79f3YThYaxjiCy///o5XRcz9AF3NmlEzdpd8++CtVR0Y/lqGigPIJPqBvf KbJTAe0LzMB+ONPWltWh0KMzb3RDxw8gGhjCWf4zNyO5gX1M6ROf/Re8gC9Jzx9WL2Bv 4D1gy26sz4iozAhBgLuOKAFZ6orKH6Zz4xH9iXRmg21V9aK69Gcp8eiz/rOd21JLFu1e Z9W+P9k2JnQwjmI5I2vf5y+7H+sjVk+AXSCnOa/6dspMH7OD0ookeXKmIHDpH7Oy5/tf aH15lR2+xP0n7x4ptN33gAn1HNYAb5qpGrwpR38xLq9Q5nEKFId9CgzI6pmNHkmd2u0W +HBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pYMIdGQxhP1lbg80tiBGcSVUlHYHKVk5sZPVHxD5uSo=; b=d24dhmVW6tp2hYt2EevB2jdS6IWa5CnPozPiwv0JhhmEVl/pbEq1hVFDYAQ7FlflUK NU1QUANS30ahDxOdW96qfp4e9eVaxtvHjBJ/uhklO+W8I534/8Kp0jS+vulWW1tjyJNQ fFqAs2uaGl6LCVuk4snr/JhvmNZfavFv14bg+F4QOrbBCw8ccI03xRCHJm4vJ7aUm6/I Wh0Q2dK46jTgphsymej4TZPMeK23AJEQt3uvo5n5jKkjk/epB4t7k/bR0/WYasw910+1 3Qv+19c1E9/eatFzqW6apCSSoyQKs5w7kAHNYFnZ1ZXbCN92ApNeXqlVkc2UALdtfaLa 7tOw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m16si1994613otj.7.2020.02.20.07.59.30; Thu, 20 Feb 2020 07:59:43 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728666AbgBTP7W (ORCPT + 99 others); Thu, 20 Feb 2020 10:59:22 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:47604 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728305AbgBTP7V (ORCPT ); Thu, 20 Feb 2020 10:59:21 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 17FE62951A1 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Cc: Collabora Kernel ML , groeck@chromium.org, bleung@chromium.org, dtor@chromium.org, gwendal@chromium.org, pmalani@chromium.org, Jonathan Cameron , Ting Shen , Neil Armstrong , Dmitry Torokhov , Fei Shao , linux-input@vger.kernel.org Subject: [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper Date: Thu, 20 Feb 2020 16:58:53 +0100 Message-Id: <20200220155859.906647-3-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200220155859.906647-1-enric.balletbo@collabora.com> References: <20200220155859.906647-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch makes use of cros_ec_cmd_xfer_status() instead of cros_ec_cmd_xfer(). In this case there is no advantage of doing this apart from that 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/input/keyboard/cros_ec_keyb.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 2b71c5a51f90..fc1793ca2f17 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -347,18 +347,14 @@ static int cros_ec_keyb_info(struct cros_ec_device *ec_dev, params->info_type = info_type; params->event_type = event_type; - ret = cros_ec_cmd_xfer(ec_dev, msg); - if (ret < 0) { - dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n", - (int)info_type, (int)event_type, ret); - } else if (msg->result == EC_RES_INVALID_VERSION) { + ret = cros_ec_cmd_xfer_status(ec_dev, msg); + if (ret == -ENOTSUPP) { /* With older ECs we just return 0 for everything */ memset(result, 0, result_size); ret = 0; - } else if (msg->result != EC_RES_SUCCESS) { - dev_warn(ec_dev->dev, "Error getting info %d/%d: %d\n", - (int)info_type, (int)event_type, msg->result); - ret = -EPROTO; + } else if (ret < 0) { + dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n", + (int)info_type, (int)event_type, ret); } else if (ret != result_size) { dev_warn(ec_dev->dev, "Wrong size %d/%d: %d != %zu\n", (int)info_type, (int)event_type, -- 2.25.0