Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp601215ybz; Wed, 15 Apr 2020 14:56:08 -0700 (PDT) X-Google-Smtp-Source: APiQypIqjOsmSYYL/pa1nmkFdcEDBsU4lWp73oAA7+MM/X0+81AtUvqvfMkk8wy1kkcgjM56X20H X-Received: by 2002:a50:f306:: with SMTP id p6mr25405049edm.363.1586987768478; Wed, 15 Apr 2020 14:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586987768; cv=none; d=google.com; s=arc-20160816; b=GkdxckjVRXEvS3vAZ6k3yYiZXC6mfZKXAh1daeEPNrRih5DEL9vyv5e6yV/MW8HElz sxA+hSmAZ0muwO4DZ4VhyPreasQmHB+SrmQjdgnP69p7aWRuMf0ODHdIt0Nc3Pvh1n23 amgh+XWtXJ1bQPJLTas0jr1Oe27H2gsU3R5OL0aqmbk5MFErcCLXifnojTCgbV1jS/5K A25JsPJgmL9Q0bI8BPCkOBZTz53l/AeM1raIq+OU/snjUAQKPWd3lyr6BSq+gSBk2Esg Y7Wx0UNCS42xFjnJqTEzBkD2Bt122YjQHgKE0dwlOksHmzTsg3Yq4lmTjczWPJNcUggC Z1+g== 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 :message-id:date:subject:cc:to:from; bh=9SbbOYh0eeDY3lAEOMYgemXYxG8CUDwrzGIRddUeqpM=; b=1CDttDs6r7wmzlhwiMP7/MpnSrjfIf9mQOTetGG1ECIdM5b0ouuiRZeFzBVmbonq9W +Jb/296JfOutHeBIW0X64VMXlJRPSXAxlL80srM7YVCImG1hQNpmT7ycnId+nfTJB3Ad OrET3NvPiIAv3LKEEYh02OyxudWtEKL6/af1+G9L3QrhLMYkwOsBHGJ0gdiDw5LiWBiW M+acedjc6n4WHqVIAzdhFYAyL1uPH9fswwmifwikIdnkA+sbh9fI6Y5Mpv4t4u0swJv8 oyo+dlMRSWsAHmFWaGgC1gku+u9DIoFk7yOGK6QOg9mDu6ZmA1NnK+aMOZkUQWCUe9kh 1ySA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id y23si11366241ejc.425.2020.04.15.14.55.44; Wed, 15 Apr 2020 14:56:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2633659AbgDNVFO (ORCPT + 99 others); Tue, 14 Apr 2020 17:05:14 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48184 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731698AbgDNVEo (ORCPT ); Tue, 14 Apr 2020 17:04:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 423B22A1C3A 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, Chanwoo Choi , Dmitry Torokhov , Fei Shao , Sebastian Reichel , Ting Shen , linux-input@vger.kernel.org Subject: [RESEND PATCH] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper Date: Tue, 14 Apr 2020 23:04:34 +0200 Message-Id: <20200414210434.1534982-1-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.25.1 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 --- This patch was initially part of this series [1]. The other patches in the series have been applied and remains this, hence, I send this patch alone as a RESEND. [1] https://patchwork.kernel.org/cover/11394361/ 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.1