Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp39511ybb; Fri, 27 Mar 2020 15:36:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtC29/tKCMcgZH+gQe78//U5seZ1HFXwuwluyvc4CG5u/W+jbXCv8FLJ/rhiYN4bUszQV4r X-Received: by 2002:a9d:6e02:: with SMTP id e2mr760213otr.317.1585348610406; Fri, 27 Mar 2020 15:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585348610; cv=none; d=google.com; s=arc-20160816; b=gGYuesIPJ2skRgE9kzDuR1XUpqM5VS7xfBuMgWWSk5Ml0vfruM5aQzcclYMpf6ZMsy cCkawiDYZLz1UVDKOYKnGkL9yy7R6CJVz1Rxk7nKSHO2cL11iz0sJ3y8xKnvOHDjaVVg TZEYgLtDnpmr1YzArXg9ug1vHHvVotkmjxG7aIuSFywq6rZWIPG8VhcBp0lsULscg6f7 Ahpdzw73AVwdB0Af5JhJHlMP8rLKRuUId+9r3HNsMSO4gymVHhD5R7jEU76O3viq80gp R614PxRWakvok77mWguF2dB4FuZ3j7vJMaEsFDkJYQBxbo3IMmh0Rn2zvTfpr931gIOR AbUg== 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=4W7il/SUE8zUP0mcJ/uA7eBv3zkE6qgGXJ8Gi2G1bGc=; b=vu3Wbs2KhCYlEB7dnwqczEqQQxZoq7Jr8ScamH2ZyNlabkKEcTbu7DfacWH85f0nsZ qE5DEr9u6FD7BkiV7Q7dyk6fdH7nu8g+mp8nLa7hQ29aNkuyE8AYpEFVRh2P1+zHycQI ywDWZWl0bxBdXJ5SppZek3kMFiwS9bVse4Q4+SH0r95q+XVS9IppCpKZ+TzpjeGEjaom gybjGBV2TZKE3m/H2j4trnDnW+eo2H+ynO8n03oiH/O0b1qTGPkeLJPuONj3E8vtxIPg uBmnJpuz+xqlp2uZxG8PsmSSSkv40O0YF0gg7BdmxNqrB3FUNg6flO/iZE8ZWTMpqjV7 yDRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fFJMe+uv; 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 e11si2392576ooq.30.2020.03.27.15.36.37; Fri, 27 Mar 2020 15:36:50 -0700 (PDT) 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=fFJMe+uv; 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 S1727754AbgC0Wev (ORCPT + 99 others); Fri, 27 Mar 2020 18:34:51 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37383 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727655AbgC0Weu (ORCPT ); Fri, 27 Mar 2020 18:34:50 -0400 Received: by mail-pf1-f196.google.com with SMTP id h72so5187307pfe.4 for ; Fri, 27 Mar 2020 15:34:48 -0700 (PDT) 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=4W7il/SUE8zUP0mcJ/uA7eBv3zkE6qgGXJ8Gi2G1bGc=; b=fFJMe+uv7dx/GIdNbdWPiOEuHJbIMI2boKej//D6yPWsBog+iuRnO1i8EK8XtHwwQl tewoenQ+8uI/9F/fXK9tN2P9tMmV4WRFzFKGAJhcrT1WN695Hl1f91Q98A+E+H5QZ5Mf vs1iyY1rxXshI2BuE7UqTH1kWbEtPaqdLS1yw= 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=4W7il/SUE8zUP0mcJ/uA7eBv3zkE6qgGXJ8Gi2G1bGc=; b=Oc0dIGIgru5ZxUQJrCa/qkO9fS71t3wo1n+4v/2uLKpn8qxu+iOG1QcgLXd1MRZNie uOcrQy7tTmqAPGR6Am8QJtwCKdktgKtKWdc7us+lk9lSJEIxwxbNlFG8mXXc+gT01d8C EE+gL4sb+DMrhEyZrnikPY8TAQOP5lsSwNbpyixH6QZfAc21cD7r9ziJv4Lyzd7ym4TB WSr5q6T6ZyrpKe6pEGyhCZLId+Yd0hW2fHyv26xUFo6H+o1gYtLKkMGrwyQp7NTdt1Z1 FCUInQ59VCD1TYwCfV4UaABejIB2BpngjofNZGer7qDk9LwB0T6mjxJZ7f1cbfdWvaEt yr+w== X-Gm-Message-State: ANhLgQ1zx9EofGHsc/mceV03J0jp4es8dh/FqQcKzHmiUbErVryANxol ZLGT0f0bPaGJC8PTAUU2xyXZ7w== X-Received: by 2002:a63:5004:: with SMTP id e4mr1496115pgb.19.1585348487774; Fri, 27 Mar 2020 15:34:47 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4cc0:7eee:97c9:3c1a]) by smtp.gmail.com with ESMTPSA id a2sm4441959pjq.20.2020.03.27.15.34.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Mar 2020 15:34:47 -0700 (PDT) From: Gwendal Grignou To: bleung@chromium.org, enric.balletbo@collabora.com, Jonathan.Cameron@huawei.com Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Gwendal Grignou Subject: [PATCH v7 01/12] platform: chrome: sensorhub: Add the number of sensors in sensorhub Date: Fri, 27 Mar 2020 15:34:32 -0700 Message-Id: <20200327223443.6006-2-gwendal@chromium.org> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog In-Reply-To: <20200327223443.6006-1-gwendal@chromium.org> References: <20200327223443.6006-1-gwendal@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 To better manage resources, store the number of sensors reported by the EC. Signed-off-by: Gwendal Grignou --- New in v7 drivers/platform/chrome/cros_ec_sensorhub.c | 4 +++- include/linux/platform_data/cros_ec_sensorhub.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub.c b/drivers/platform/chrome/cros_ec_sensorhub.c index 79fefd3bb0fa6..134ee5e460472 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub.c +++ b/drivers/platform/chrome/cros_ec_sensorhub.c @@ -65,6 +65,7 @@ static int cros_ec_sensorhub_register(struct device *dev, return sensor_num; } + sensorhub->sensor_num = sensor_num; if (sensor_num == 0) { dev_err(dev, "Zero sensors reported.\n"); return -EINVAL; @@ -172,7 +173,8 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev) * If the device has sensors but does not claim to * be a sensor hub, we are in legacy mode. */ - for (i = 0; i < 2; i++) { + data->sensor_num = 2; + for (i = 0; i < data->sensor_num; i++) { ret = cros_ec_sensorhub_allocate_sensor(dev, "cros-ec-accel-legacy", i); if (ret) diff --git a/include/linux/platform_data/cros_ec_sensorhub.h b/include/linux/platform_data/cros_ec_sensorhub.h index bef7ffc7fce10..7e46a47fd642b 100644 --- a/include/linux/platform_data/cros_ec_sensorhub.h +++ b/include/linux/platform_data/cros_ec_sensorhub.h @@ -22,9 +22,11 @@ struct cros_ec_sensor_platform { * struct cros_ec_sensorhub - Sensor Hub device data. * * @ec: Embedded Controller where the hub is located. + * @sensor_num: Number of MEMS sensors present in the EC. */ struct cros_ec_sensorhub { struct cros_ec_dev *ec; + int sensor_num; }; #endif /* __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H */ -- 2.26.0.rc2.310.g2932bb562d-goog