Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5237796ybb; Tue, 24 Mar 2020 13:29:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtnrU2Lf5RXNTGwdhL0/6O5haa1CVDDtXPJm5Ac20Ll8NJrO2SGj8JCIA1rONFrmVaQah0E X-Received: by 2002:aca:ef82:: with SMTP id n124mr41623oih.73.1585081752978; Tue, 24 Mar 2020 13:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585081752; cv=none; d=google.com; s=arc-20160816; b=hOyAoKLdhB1HZ9TcZOtN0Fh2RO5d6T7TcYXHdgrQFMNV+1uJr+Ze0pHNiEhrHi6g01 aWvwpuP6/5ACB1Mnx2rJrZuaH/1Rg7tSTQKspjN83fkZQAQ7WobS6UjjsGcf+vzLbxvw gHtU+OYcH9ebyEhBri+FE+lYlfofIIlEGOHqRIsfa+FUfsEB7IQnMcKwivtabr5COTbG ZBFD3wF6Mq8HLqH7IwUzDt+vB1FlAkgy8SV7Sbp2tZvI+SsqXGirpJn4pKED4V6UVpd+ N95QZxEIIP/M4KBB6za/jJH+ahrDqs3MliAsNvwGJZqKesZccY+AzJS903rI5wYJmUAg mDpg== 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=ZpnS/j1XfTEAxa697JfCqGh5bEfIShtd5fhuG2l93l8=; b=ZtMBKO8fwEc4Bs7a24Ei2Coye9Oo3eUwEu/ikY/hKiaPyDK+806GcFDUgaW+Ze0NmT Hf9jHNmqwMif/kB/XCMc0sSCtnn97VEusuqq+CShoMD5ec3xHkRHVusM5aFrcwa9m/1B eJAgZ6fmo60E6JsIrpNY9fEpg3nWx+XRMdMwTNVE6vPvRkeJAGMVyGztDFCiJz9e9q5q 0MA0GAq5/H6nkyeQZWhYcuy4+bXJPDUdRyjKUodUDCgpvZvOmo4D/5N3zz05Kgw5daDr j1BFS6vzKd3izHZlM4k1acbWaQdwY1ihYYXhD+fp8DcGEC9Nk61X7jKyykTnoVLT5Jyx +qQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ijO5I9xY; 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 y65si9327870oie.92.2020.03.24.13.29.00; Tue, 24 Mar 2020 13:29:12 -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=ijO5I9xY; 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 S1728060AbgCXU14 (ORCPT + 99 others); Tue, 24 Mar 2020 16:27:56 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45654 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727919AbgCXU1x (ORCPT ); Tue, 24 Mar 2020 16:27:53 -0400 Received: by mail-pl1-f196.google.com with SMTP id b9so7882174pls.12 for ; Tue, 24 Mar 2020 13:27:51 -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=ZpnS/j1XfTEAxa697JfCqGh5bEfIShtd5fhuG2l93l8=; b=ijO5I9xYJrPv9CaECBq+rp2MoCRZ6HJH87CVQD9pH86IYXdVtpQivHTYyHrnoLld/3 TKUEe9UuDwZ1fVvAIu4nZXlGJu2l/Z/tiJl00A6VBgPDugHEeqPvtzvGKsCBwxK4ATP+ RpHN9MYEcmMQDWAXLKJ3WrJDVJFOy932tV8GA= 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=ZpnS/j1XfTEAxa697JfCqGh5bEfIShtd5fhuG2l93l8=; b=lA/wBsVCSENsxfsS6ptC9zsBNQS4kDp4qF8Q2ehwXhXA4T7jwb9egVMW8TMv/XQdtw aI5xyahniiIHxF8TAVcjwphCzeV5UmVZmogGDx3wbXldSnXa9V+Y4uYD2Sx3BcJCgIW+ ZLexMk853oFSbLTGpkSLJKu9E68260ghcxJ9qUFdUoytV0Vkcdbu6BSPv865Hb8+6jY1 EEln/me0yYcqmUqfXaQhC535VNx3EK3tQjpduXU5CrLjb4UAO8xmrlSVEEl4mi7WOJJI r3Q0oLRM/5OiBccCwe1hmZliEjbcYIWVGFw66FqaZRhtmGy0wBfVAq859L2BDDHpKX/5 NiHA== X-Gm-Message-State: ANhLgQ1R0sg7fMWsgI1NcxCkxS2ODd53AOZGdRvTgkVADoShCnMtH4O0 nW8lxsoSFgwTRpVtGDNQZ6okUA== X-Received: by 2002:a17:90a:a102:: with SMTP id s2mr7671363pjp.44.1585081671127; Tue, 24 Mar 2020 13:27:51 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4cc0:7eee:97c9:3c1a]) by smtp.gmail.com with ESMTPSA id j19sm16613872pfe.102.2020.03.24.13.27.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2020 13:27:50 -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 v6 04/11] iio: cros_ec: Move function description to .c file Date: Tue, 24 Mar 2020 13:27:29 -0700 Message-Id: <20200324202736.243314-5-gwendal@chromium.org> X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog In-Reply-To: <20200324202736.243314-1-gwendal@chromium.org> References: <20200324202736.243314-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 prevent comment rot, move function description to cros_ec_sensors_core.c. Acked-by: Jonathan Cameron Acked-by: Enric Balletbo i Serra Signed-off-by: Gwendal Grignou --- Changes in v6: - No changes. Changes in v5: Added ack. No changes in v4. Changes in v3: fix spelling. New in v2. .../cros_ec_sensors/cros_ec_sensors_core.c | 69 ++++++++++++++++ .../linux/iio/common/cros_ec_sensors_core.h | 80 ------------------- 2 files changed, 69 insertions(+), 80 deletions(-) diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index d3a3626c7cd83..f3c000448b90e 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -82,6 +82,14 @@ static void get_default_min_max_freq(enum motionsensor_type type, } } +/** + * cros_ec_sensors_core_init() - basic initialization of the core structure + * @pdev: platform device created for the sensors + * @indio_dev: iio device structure of the device + * @physical_device: true if the device refers to a physical device + * + * Return: 0 on success, -errno on failure. + */ int cros_ec_sensors_core_init(struct platform_device *pdev, struct iio_dev *indio_dev, bool physical_device) @@ -159,6 +167,16 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(cros_ec_sensors_core_init); +/** + * cros_ec_motion_send_host_cmd() - send motion sense host command + * @state: pointer to state information for device + * @opt_length: optional length to reduce the response size, useful on the data + * path. Otherwise, the maximal allowed response size is used + * + * When called, the sub-command is assumed to be set in param->cmd. + * + * Return: 0 on success, -errno on failure. + */ int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *state, u16 opt_length) { @@ -421,6 +439,14 @@ int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, } EXPORT_SYMBOL_GPL(cros_ec_sensors_read_lpc); +/** + * cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol + * @indio_dev: pointer to IIO device + * @scan_mask: bitmap of the sensor indices to scan + * @data: location to store data + * + * Return: 0 on success, -errno on failure. + */ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask, s16 *data) { @@ -445,6 +471,18 @@ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, } EXPORT_SYMBOL_GPL(cros_ec_sensors_read_cmd); +/** + * cros_ec_sensors_capture() - the trigger handler function + * @irq: the interrupt number. + * @p: a pointer to the poll function. + * + * On a trigger event occurring, if the pollfunc is attached then this + * handler is called as a threaded interrupt (and hence may sleep). It + * is responsible for grabbing data from the device and pushing it into + * the associated buffer. + * + * Return: IRQ_HANDLED + */ irqreturn_t cros_ec_sensors_capture(int irq, void *p) { struct iio_poll_func *pf = p; @@ -480,6 +518,16 @@ irqreturn_t cros_ec_sensors_capture(int irq, void *p) } EXPORT_SYMBOL_GPL(cros_ec_sensors_capture); +/** + * cros_ec_sensors_core_read() - function to request a value from the sensor + * @st: pointer to state information for device + * @chan: channel specification structure table + * @val: will contain one element making up the returned value + * @val2: will contain another element making up the returned value + * @mask: specifies which values to be requested + * + * Return: the type of value returned by the device + */ int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st, struct iio_chan_spec const *chan, int *val, int *val2, long mask) @@ -520,6 +568,17 @@ int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st, } EXPORT_SYMBOL_GPL(cros_ec_sensors_core_read); +/** + * cros_ec_sensors_core_read_avail() - get available values + * @indio_dev: pointer to state information for device + * @chan: channel specification structure table + * @vals: list of available values + * @type: type of data returned + * @length: number of data returned in the array + * @mask: specifies which values to be requested + * + * Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST + */ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, const int **vals, @@ -541,6 +600,16 @@ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, } EXPORT_SYMBOL_GPL(cros_ec_sensors_core_read_avail); +/** + * cros_ec_sensors_core_write() - function to write a value to the sensor + * @st: pointer to state information for device + * @chan: channel specification structure table + * @val: first part of value to write + * @val2: second part of value to write + * @mask: specifies which values to write + * + * Return: the type of value returned by the device + */ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, struct iio_chan_spec const *chan, int val, int val2, long mask) diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linux/iio/common/cros_ec_sensors_core.h index bb331e6356a9c..0af918978f975 100644 --- a/include/linux/iio/common/cros_ec_sensors_core.h +++ b/include/linux/iio/common/cros_ec_sensors_core.h @@ -79,95 +79,25 @@ struct cros_ec_sensors_core_state { int frequencies[3]; }; -/** - * cros_ec_sensors_read_lpc() - retrieve data from EC shared memory - * @indio_dev: pointer to IIO device - * @scan_mask: bitmap of the sensor indices to scan - * @data: location to store data - * - * This is the safe function for reading the EC data. It guarantees that the - * data sampled was not modified by the EC while being read. - * - * Return: 0 on success, -errno on failure. - */ int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, unsigned long scan_mask, s16 *data); -/** - * cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol - * @indio_dev: pointer to IIO device - * @scan_mask: bitmap of the sensor indices to scan - * @data: location to store data - * - * Return: 0 on success, -errno on failure. - */ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask, s16 *data); struct platform_device; -/** - * cros_ec_sensors_core_init() - basic initialization of the core structure - * @pdev: platform device created for the sensors - * @indio_dev: iio device structure of the device - * @physical_device: true if the device refers to a physical device - * - * Return: 0 on success, -errno on failure. - */ int cros_ec_sensors_core_init(struct platform_device *pdev, struct iio_dev *indio_dev, bool physical_device); -/** - * cros_ec_sensors_capture() - the trigger handler function - * @irq: the interrupt number. - * @p: a pointer to the poll function. - * - * On a trigger event occurring, if the pollfunc is attached then this - * handler is called as a threaded interrupt (and hence may sleep). It - * is responsible for grabbing data from the device and pushing it into - * the associated buffer. - * - * Return: IRQ_HANDLED - */ irqreturn_t cros_ec_sensors_capture(int irq, void *p); -/** - * cros_ec_motion_send_host_cmd() - send motion sense host command - * @st: pointer to state information for device - * @opt_length: optional length to reduce the response size, useful on the data - * path. Otherwise, the maximal allowed response size is used - * - * When called, the sub-command is assumed to be set in param->cmd. - * - * Return: 0 on success, -errno on failure. - */ int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st, u16 opt_length); -/** - * cros_ec_sensors_core_read() - function to request a value from the sensor - * @st: pointer to state information for device - * @chan: channel specification structure table - * @val: will contain one element making up the returned value - * @val2: will contain another element making up the returned value - * @mask: specifies which values to be requested - * - * Return: the type of value returned by the device - */ int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st, struct iio_chan_spec const *chan, int *val, int *val2, long mask); -/** - * cros_ec_sensors_core_read_avail() - get available values - * @indio_dev: pointer to state information for device - * @chan: channel specification structure table - * @vals: list of available values - * @type: type of data returned - * @length: number of data returned in the array - * @mask: specifies which values to be requested - * - * Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST - */ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, const int **vals, @@ -175,16 +105,6 @@ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, int *length, long mask); -/** - * cros_ec_sensors_core_write() - function to write a value to the sensor - * @st: pointer to state information for device - * @chan: channel specification structure table - * @val: first part of value to write - * @val2: second part of value to write - * @mask: specifies which values to write - * - * Return: the type of value returned by the device - */ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, struct iio_chan_spec const *chan, int val, int val2, long mask); -- 2.25.1.696.g5e7596f4ac-goog