Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1181180ybl; Fri, 24 Jan 2020 17:23:45 -0800 (PST) X-Google-Smtp-Source: APXvYqyZvedAliyhC/U08njNtpkHFIbbQnkbYt3UJFMuRHyORrRjOEnZkpPKP7tGE+sbENSuNkDu X-Received: by 2002:aca:d15:: with SMTP id 21mr1158825oin.127.1579915425207; Fri, 24 Jan 2020 17:23:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579915425; cv=none; d=google.com; s=arc-20160816; b=CL/J5ya5G/qn0z+U+IH0Jr4z/bSkAuLMF/b6iSOT0zPLyPsqe42nZAWfE7h2hgyums 66e+9Vo+nIs0pfMUjN6YD7lKag2g/fZ5w3BJWikT/0wu+q6FZav713K/s2cLVC4itp+L 0K2/3B70FGxFFqwqJLh+MnRtCyab8TRlqgCoePa0F5nq5/+wk592+HD+9s92q28yh67d M5utVr3neR9UTa7D95KKWHR/OlNgw6htQMOjdausld3s4td9L/LyHMc4iBTcxDUBmpYr Xei7xp4UsqR8sNgoGKDurid1Fi1JuxtG+ui4TAtpE/HNsDrADemnKxiYk7I0yx+AuGp9 8KdQ== 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 :dkim-signature; bh=/CBLP4zJTiApGSM+fXOeI1RBw2aN/kHUsOiaSD/bkm0=; b=Gt4w6OH8xZ+DbRkU71D264CW2Id5DdeNH8lyJ1OPNhZ75zpuISgA97+0ElnPB+i5/I W4qosqgb1SkXo//ZwowDWgM8RJ4JW852hPzTQOXFhH5aZiV66+O+AfJxaGYYukR3/7xO IAXwDf/xNjGDLEN/LdLYV/uxl+zcSYhoQR+S8whs+qO81GgdJ1zElJZb7X88dtjW0N4I Q5yCNaSJS4aZHwSO3SJqyIADLr6I8u0BInloIq3IehOD5LufN2gSHTFyx7qfC1SXaUw0 ow7wjFoK5xHz9S3sz0IznKLR9O8dilPMvTnfUvqwZ9VrcxKcgHUUv2i6lcWr38fYNLsw nfqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V7gNpm6V; 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 x24si3806218oto.255.2020.01.24.17.23.33; Fri, 24 Jan 2020 17:23:45 -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=V7gNpm6V; 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 S1729777AbgAYBWU (ORCPT + 99 others); Fri, 24 Jan 2020 20:22:20 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43039 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbgAYBWU (ORCPT ); Fri, 24 Jan 2020 20:22:20 -0500 Received: by mail-pl1-f196.google.com with SMTP id p23so1480181plq.10 for ; Fri, 24 Jan 2020 17:22:19 -0800 (PST) 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=/CBLP4zJTiApGSM+fXOeI1RBw2aN/kHUsOiaSD/bkm0=; b=V7gNpm6Vi8iEjBxI/eMT+Bcv63RhQZDAaVu5HSs9A0OWPY/oVLUjWNpCpSjnYMQrh7 GGa49vVpRENiccRsfXxAzhOH7mNPHuEz2vw9kvj1FFnlrKNJnPAqYtxd44gxpHIRJal+ mkWZTUTEgG2Pxa7Iu67e613O7XjH+j8njXUUM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/CBLP4zJTiApGSM+fXOeI1RBw2aN/kHUsOiaSD/bkm0=; b=dpbSXDJd/KRmXzi57ALkn7xH8XAbq5bXPA7H1gP+XGM3wcALLo3V//HgOp74MaTKjR ifIdY1cZcgrHbcmbETVKQ8o8S763X7IkWMHBjsvgReJAQzBRgEg7nM7Q2TlHHFXX0D2G UU+1u1hLK9zomqbsx4Xtlm9rmx76loVq7d7Jbck8+4GFcIxHG5yHp/UNwDQCnN4tDIKR wOWBLouKMi8etKKitLTrCPSy3JLA74D8aQ2VsFx4QQtUaHfbb3UhqF3ZEx7d02Ir2FZV enm5NNKYF/HZGHsbdmuvE5/iBb+eEny2sMK1epSTak9SQKqHs+T3S8qszXZJZaYHaZI7 pURg== X-Gm-Message-State: APjAAAURZ+4i8IOP4rUgfYV5p+HCQvHvyAUmW4/AHAYqhIDuESST0Dmx 6ISvX9FF0aSekwZOvlT0Dz16D6jXR7Q= X-Received: by 2002:a17:90b:3c9:: with SMTP id go9mr2323550pjb.7.1579915339467; Fri, 24 Jan 2020 17:22:19 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:172e:4646:c089:ce59]) by smtp.gmail.com with ESMTPSA id n4sm7443337pgg.88.2020.01.24.17.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2020 17:22:19 -0800 (PST) From: Prashant Malani To: enric.balletbo@collabora.com, bleung@chromium.org Cc: linux-kernel@vger.kernel.org, Prashant Malani Subject: [PATCH 4/4] platform/chrome: Make check_features() use wrapper Date: Fri, 24 Jan 2020 17:21:09 -0800 Message-Id: <20200125012105.59903-5-pmalani@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200125012105.59903-1-pmalani@chromium.org> References: <20200125012105.59903-1-pmalani@chromium.org> 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 Replace the use of cros_ec_cmd_xfer_status() with the new wrapper function. Signed-off-by: Prashant Malani --- drivers/platform/chrome/cros_ec_proto.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index 8ef3b7d27d260..d3540fe1b7556 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -804,31 +804,21 @@ EXPORT_SYMBOL(cros_ec_get_host_event); */ int cros_ec_check_features(struct cros_ec_dev *ec, int feature) { - struct cros_ec_command *msg; int ret; if (ec->features[0] == -1U && ec->features[1] == -1U) { /* features bitmap not read yet */ - msg = kzalloc(sizeof(*msg) + sizeof(ec->features), GFP_KERNEL); - if (!msg) - return -ENOMEM; - - msg->command = EC_CMD_GET_FEATURES + ec->cmd_offset; - msg->insize = sizeof(ec->features); - - ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg); + ret = cros_ec_send_cmd_msg(ec->ec_dev, 0, + ec->cmd_offset + EC_CMD_GET_FEATURES, + NULL, 0, ec->features, + sizeof(ec->features)); if (ret < 0) { - dev_warn(ec->dev, "cannot get EC features: %d/%d\n", - ret, msg->result); + dev_warn(ec->dev, "cannot get EC features: %d\n", ret); memset(ec->features, 0, sizeof(ec->features)); - } else { - memcpy(ec->features, msg->data, sizeof(ec->features)); } dev_dbg(ec->dev, "EC features %08x %08x\n", ec->features[0], ec->features[1]); - - kfree(msg); } return ec->features[feature / 32] & EC_FEATURE_MASK_0(feature); -- 2.25.0.341.g760bfbb309-goog