From patchwork Wed Sep 18 07:52:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 11149749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDE1614E5 for ; Wed, 18 Sep 2019 07:53:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B24E421928 for ; Wed, 18 Sep 2019 07:53:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aapYiITK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728175AbfIRHxU (ORCPT ); Wed, 18 Sep 2019 03:53:20 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38488 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbfIRHxT (ORCPT ); Wed, 18 Sep 2019 03:53:19 -0400 Received: by mail-pg1-f195.google.com with SMTP id x10so3527330pgi.5; Wed, 18 Sep 2019 00:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xjl+nKMauFdQMucZCGYFJNYkEcd8nmtmKLzonD2DvBw=; b=aapYiITKELPyW4PHB8mGw+Qj50qIrsMGCgbf6vimpLFQn0kfedpldxpF+mnmGruaRd 0D8dSrIxudPaQYKYtAJrGcKiT8MvXUOpimKbMaeDoAoX0MlxNUIblfM+rFIUdA6Fa+q0 fthHylYRRRyzedpTzlaznmGMzytzDacZRuJ/ge1XH/9Y1p4sdx40bnlddoJYjB64oksE a8XW5eydVr6oBq2MGac+QDMkHOFsmbDn+Te32g8A+A2ELQedhj4qMBs4oKMkLNMEpd6A RdoZHCGo7QdWuRXFOQApsNZa6kL3Mi5LyXDjTJeM7rmc077HB3Z/t+V2mQBDbDe3Dl70 3Zbg== 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=Xjl+nKMauFdQMucZCGYFJNYkEcd8nmtmKLzonD2DvBw=; b=Uoyl2hwqSu3OeMF0ZgN3ex+oaVqqiIXrCUY0c3rDXoHQVTeF7KHs0NhWRqduAgcJx8 ByJc9Qp7qr3biecZtmyQ237RcBABzOny61py0EWIEJiyZoFTB5vMuU3Fz0tC0M8/uq/d 8g/Uwz38FX6la8MNfA6Xi1s0eZlwWq29Opomqrdvkf6zv/kqAKVUg0f2Ol1OSDP7iu+d Qg4Mfp1xNMUno1hE3+GIFdCerLtAv9hkwvoZZimZonPPLRGuaI+bFm4rePu8F5vVqeC4 lz8R7XSVYVvosbLCiiw2SkRJxoplWlM6dKZNA3hF6W/jYfZkPWjjERXiUUxBeMtoJ5R4 sfyQ== X-Gm-Message-State: APjAAAX0xtOiDWddO6rPy7QfoS+x4zmX7GgSGQ3OjtYZwqnDggojs7eV cJ0vHFGiyP3sJJiQwjXIC3Q= X-Google-Smtp-Source: APXvYqy5KsztavGnDkcRDa8efg7SqNcEzpfdR8ZQEEx9n/F421fNVbt98mZe0yTO939Qqb5PhBhnRw== X-Received: by 2002:a17:90a:2ecb:: with SMTP id h11mr2331197pjs.108.1568793198781; Wed, 18 Sep 2019 00:53:18 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c147:d9df:f819:e399:825f:f2dc]) by smtp.gmail.com with ESMTPSA id h8sm5580715pfo.64.2019.09.18.00.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 00:53:17 -0700 (PDT) From: William Breathitt Gray To: jic23@jic23.retrosnub.co.uk Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v2 1/7] counter: Simplify the count_read and count_write callbacks Date: Wed, 18 Sep 2019 16:52:42 +0900 Message-Id: X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The count_read and count_write callbacks are simplified to pass val as unsigned long rather than as an opaque data structure. The opaque counter_count_read_value and counter_count_write_value structures, counter_count_value_type enum, and relevant counter_count_read_value_set and counter_count_write_value_get functions, are removed as they are no longer used. Signed-off-by: William Breathitt Gray --- drivers/counter/counter.c | 66 +++++---------------------------------- include/linux/counter.h | 43 +++---------------------- 2 files changed, 12 insertions(+), 97 deletions(-) diff --git a/drivers/counter/counter.c b/drivers/counter/counter.c index 106bc7180cd8..1d08f1437b1b 100644 --- a/drivers/counter/counter.c +++ b/drivers/counter/counter.c @@ -246,60 +246,6 @@ void counter_signal_read_value_set(struct counter_signal_read_value *const val, } EXPORT_SYMBOL_GPL(counter_signal_read_value_set); -/** - * counter_count_read_value_set - set counter_count_read_value data - * @val: counter_count_read_value structure to set - * @type: property Count data represents - * @data: Count data - * - * This function sets an opaque counter_count_read_value structure with the - * provided Count data. - */ -void counter_count_read_value_set(struct counter_count_read_value *const val, - const enum counter_count_value_type type, - void *const data) -{ - switch (type) { - case COUNTER_COUNT_POSITION: - val->len = sprintf(val->buf, "%lu\n", *(unsigned long *)data); - break; - default: - val->len = 0; - } -} -EXPORT_SYMBOL_GPL(counter_count_read_value_set); - -/** - * counter_count_write_value_get - get counter_count_write_value data - * @data: Count data - * @type: property Count data represents - * @val: counter_count_write_value structure containing data - * - * This function extracts Count data from the provided opaque - * counter_count_write_value structure and stores it at the address provided by - * @data. - * - * RETURNS: - * 0 on success, negative error number on failure. - */ -int counter_count_write_value_get(void *const data, - const enum counter_count_value_type type, - const struct counter_count_write_value *const val) -{ - int err; - - switch (type) { - case COUNTER_COUNT_POSITION: - err = kstrtoul(val->buf, 0, data); - if (err) - return err; - break; - } - - return 0; -} -EXPORT_SYMBOL_GPL(counter_count_write_value_get); - struct counter_attr_parm { struct counter_device_attr_group *group; const char *prefix; @@ -788,13 +734,13 @@ static ssize_t counter_count_show(struct device *dev, const struct counter_count_unit *const component = devattr->component; struct counter_count *const count = component->count; int err; - struct counter_count_read_value val = { .buf = buf }; + unsigned long val; err = counter->ops->count_read(counter, count, &val); if (err) return err; - return val.len; + return sprintf(buf, "%lu\n", val); } static ssize_t counter_count_store(struct device *dev, @@ -806,9 +752,13 @@ static ssize_t counter_count_store(struct device *dev, const struct counter_count_unit *const component = devattr->component; struct counter_count *const count = component->count; int err; - struct counter_count_write_value val = { .buf = buf }; + unsigned long val; + + err = kstrtoul(buf, 0, &val); + if (err) + return err; - err = counter->ops->count_write(counter, count, &val); + err = counter->ops->count_write(counter, count, val); if (err) return err; diff --git a/include/linux/counter.h b/include/linux/counter.h index a061cdcdef7c..7e40796598a6 100644 --- a/include/linux/counter.h +++ b/include/linux/counter.h @@ -300,24 +300,6 @@ struct counter_signal_read_value { size_t len; }; -/** - * struct counter_count_read_value - Opaque Count read value - * @buf: string representation of Count read value - * @len: length of string in @buf - */ -struct counter_count_read_value { - char *buf; - size_t len; -}; - -/** - * struct counter_count_write_value - Opaque Count write value - * @buf: string representation of Count write value - */ -struct counter_count_write_value { - const char *buf; -}; - /** * struct counter_ops - Callbacks from driver * @signal_read: optional read callback for Signal attribute. The read @@ -328,15 +310,10 @@ struct counter_count_write_value { * signal_read callback. * @count_read: optional read callback for Count attribute. The read * value of the respective Count should be passed back via - * the val parameter. val points to an opaque type which - * should be set only by calling the - * counter_count_read_value_set function from within the - * count_read callback. + * the val parameter. * @count_write: optional write callback for Count attribute. The write * value for the respective Count is passed in via the val - * parameter. val points to an opaque type which should be - * accessed only by calling the - * counter_count_write_value_get function. + * parameter. * @function_get: function to get the current count function mode. Returns * 0 on success and negative error code on error. The index * of the respective Count's returned function mode should @@ -357,11 +334,9 @@ struct counter_ops { struct counter_signal *signal, struct counter_signal_read_value *val); int (*count_read)(struct counter_device *counter, - struct counter_count *count, - struct counter_count_read_value *val); + struct counter_count *count, unsigned long *val); int (*count_write)(struct counter_device *counter, - struct counter_count *count, - struct counter_count_write_value *val); + struct counter_count *count, unsigned long val); int (*function_get)(struct counter_device *counter, struct counter_count *count, size_t *function); int (*function_set)(struct counter_device *counter, @@ -486,19 +461,9 @@ enum counter_signal_value_type { COUNTER_SIGNAL_LEVEL = 0 }; -enum counter_count_value_type { - COUNTER_COUNT_POSITION = 0, -}; - void counter_signal_read_value_set(struct counter_signal_read_value *const val, const enum counter_signal_value_type type, void *const data); -void counter_count_read_value_set(struct counter_count_read_value *const val, - const enum counter_count_value_type type, - void *const data); -int counter_count_write_value_get(void *const data, - const enum counter_count_value_type type, - const struct counter_count_write_value *const val); int counter_register(struct counter_device *const counter); void counter_unregister(struct counter_device *const counter); From patchwork Wed Sep 18 07:52:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 11149753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC21F912 for ; Wed, 18 Sep 2019 07:53:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F0E821907 for ; Wed, 18 Sep 2019 07:53:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CnEdhhsR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726884AbfIRHxY (ORCPT ); Wed, 18 Sep 2019 03:53:24 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:40195 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbfIRHxY (ORCPT ); Wed, 18 Sep 2019 03:53:24 -0400 Received: by mail-pg1-f193.google.com with SMTP id w10so3521803pgj.7; Wed, 18 Sep 2019 00:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y1oWvoEblal6EMi7QOA2PERi1JLfxSYAnMiBp+6pVPo=; b=CnEdhhsRkpafJvgJT4mL3c+IcDmTmsQB0iDRkZeA/NAmKxpkZza0NRe67uVCmcfyRZ GWdbH1S0liYCjA94q29e/woGC2zdHfnKWDjDONnLWwTCwBAKkNcI4cD6jwkUQc4yxKz1 Qt6d4xNERDcmfK5Po3W6mKGQIykecevxBvyMiJeRAmTOapSV2mHPTlSe3hWRRo1lKIqn CXhZ0kb4jBW6B3LCuK82M7IfscaIKJZ4Ju+H0fdwY/jKrrpdth6quh4c2V5yXEnF+ABg rlnswzlq9NKl3EIjGhwcfsmaPP9KfDEWViGEY4i2+4rEEf1qDZad0gfIfY2Pnc8sANA3 6Uzw== 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=y1oWvoEblal6EMi7QOA2PERi1JLfxSYAnMiBp+6pVPo=; b=m+n9rDdrvN1OalzD2c8KUFPxDeyxEvMhduErzYvcBo3TS/yL7+2/9BeDCczK10V+tC Hykla/S2ax6cjHDJSxREqFk3iBiTrx/PrTKEYMAqtkZcA+7//IQP48nl2ku/YOc3fvyu Ql8Xi65voxVvGr8Coy8ZRLkosj98+eS/EQacm2es3rbi7KN7cyP2u4HK97CfSend8Skl DZRfOq7rjRb6IKsdTst9d8vL4pLtpGuU4iUU69AcQkiF8kMEE/ryu2cbsWRhSBcRbEL1 ua7DTDRPnL4qvxH/IGuP8LF8zTVYD5pZrA1HU0UQ7qpbQxinr15wyUQB4j8EgSHFofmR AYyw== X-Gm-Message-State: APjAAAVSChKf5e4uefRvL4h7SCvy6Ca3Y2OS98usYkPHItShMu5an6rq HoPjVYJmW5/5p4b4+bcdCus= X-Google-Smtp-Source: APXvYqz1GM0wIGoCacIl0DFSJZeVxpLMqSHlnKe5HnoF5L2gn6G5UNxU1R9svnqYxwXg8JzOg1r+XQ== X-Received: by 2002:a17:90a:fe04:: with SMTP id ck4mr2425601pjb.74.1568793203428; Wed, 18 Sep 2019 00:53:23 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c147:d9df:f819:e399:825f:f2dc]) by smtp.gmail.com with ESMTPSA id h8sm5580715pfo.64.2019.09.18.00.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 00:53:22 -0700 (PDT) From: William Breathitt Gray To: jic23@jic23.retrosnub.co.uk Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v2 2/7] counter: Simplify the signal_read callback Date: Wed, 18 Sep 2019 16:52:43 +0900 Message-Id: <422cb5fa006ec10f1c6d1130a282f2a5d2cdd9df.1568792697.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The signal_read callback is simplified to pass val as a counter_signal_val enum rather than as an opaque data structure. The opaque counter_signal_read_value structure and relevant counter_signal_read_value_set function are removed as they are no longer used. In addition, the counter_signal_level enum is replaced by the similar counter_signal_value enum. Signed-off-by: William Breathitt Gray --- drivers/counter/counter.c | 35 +++++++---------------------------- include/linux/counter.h | 31 +++++-------------------------- 2 files changed, 12 insertions(+), 54 deletions(-) diff --git a/drivers/counter/counter.c b/drivers/counter/counter.c index 1d08f1437b1b..6a683d086008 100644 --- a/drivers/counter/counter.c +++ b/drivers/counter/counter.c @@ -220,32 +220,6 @@ ssize_t counter_device_enum_available_read(struct counter_device *counter, } EXPORT_SYMBOL_GPL(counter_device_enum_available_read); -static const char *const counter_signal_level_str[] = { - [COUNTER_SIGNAL_LEVEL_LOW] = "low", - [COUNTER_SIGNAL_LEVEL_HIGH] = "high" -}; - -/** - * counter_signal_read_value_set - set counter_signal_read_value data - * @val: counter_signal_read_value structure to set - * @type: property Signal data represents - * @data: Signal data - * - * This function sets an opaque counter_signal_read_value structure with the - * provided Signal data. - */ -void counter_signal_read_value_set(struct counter_signal_read_value *const val, - const enum counter_signal_value_type type, - void *const data) -{ - if (type == COUNTER_SIGNAL_LEVEL) - val->len = sprintf(val->buf, "%s\n", - counter_signal_level_str[*(enum counter_signal_level *)data]); - else - val->len = 0; -} -EXPORT_SYMBOL_GPL(counter_signal_read_value_set); - struct counter_attr_parm { struct counter_device_attr_group *group; const char *prefix; @@ -315,6 +289,11 @@ struct counter_signal_unit { struct counter_signal *signal; }; +static const char *const counter_signal_value_str[] = { + [COUNTER_SIGNAL_LOW] = "low", + [COUNTER_SIGNAL_HIGH] = "high" +}; + static ssize_t counter_signal_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -323,13 +302,13 @@ static ssize_t counter_signal_show(struct device *dev, const struct counter_signal_unit *const component = devattr->component; struct counter_signal *const signal = component->signal; int err; - struct counter_signal_read_value val = { .buf = buf }; + enum counter_signal_value val; err = counter->ops->signal_read(counter, signal, &val); if (err) return err; - return val.len; + return sprintf(buf, "%s\n", counter_signal_value_str[val]); } struct counter_name_unit { diff --git a/include/linux/counter.h b/include/linux/counter.h index 7e40796598a6..32fb4d8cc3fd 100644 --- a/include/linux/counter.h +++ b/include/linux/counter.h @@ -290,24 +290,16 @@ struct counter_device_state { const struct attribute_group **groups; }; -/** - * struct counter_signal_read_value - Opaque Signal read value - * @buf: string representation of Signal read value - * @len: length of string in @buf - */ -struct counter_signal_read_value { - char *buf; - size_t len; +enum counter_signal_value { + COUNTER_SIGNAL_LOW = 0, + COUNTER_SIGNAL_HIGH }; /** * struct counter_ops - Callbacks from driver * @signal_read: optional read callback for Signal attribute. The read * value of the respective Signal should be passed back via - * the val parameter. val points to an opaque type which - * should be set only by calling the - * counter_signal_read_value_set function from within the - * signal_read callback. + * the val parameter. * @count_read: optional read callback for Count attribute. The read * value of the respective Count should be passed back via * the val parameter. @@ -332,7 +324,7 @@ struct counter_signal_read_value { struct counter_ops { int (*signal_read)(struct counter_device *counter, struct counter_signal *signal, - struct counter_signal_read_value *val); + enum counter_signal_value *val); int (*count_read)(struct counter_device *counter, struct counter_count *count, unsigned long *val); int (*count_write)(struct counter_device *counter, @@ -452,19 +444,6 @@ struct counter_device { void *priv; }; -enum counter_signal_level { - COUNTER_SIGNAL_LEVEL_LOW = 0, - COUNTER_SIGNAL_LEVEL_HIGH -}; - -enum counter_signal_value_type { - COUNTER_SIGNAL_LEVEL = 0 -}; - -void counter_signal_read_value_set(struct counter_signal_read_value *const val, - const enum counter_signal_value_type type, - void *const data); - int counter_register(struct counter_device *const counter); void counter_unregister(struct counter_device *const counter); int devm_counter_register(struct device *dev, From patchwork Wed Sep 18 07:52:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 11149755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99D38912 for ; Wed, 18 Sep 2019 07:53:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7525421907 for ; Wed, 18 Sep 2019 07:53:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AkDFryyh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728423AbfIRHx2 (ORCPT ); Wed, 18 Sep 2019 03:53:28 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35075 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbfIRHx2 (ORCPT ); Wed, 18 Sep 2019 03:53:28 -0400 Received: by mail-pg1-f195.google.com with SMTP id a24so3538024pgj.2; Wed, 18 Sep 2019 00:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X0YlaBg0eWRFmg01LcYcEakBboU2udItKz/WvLmsstE=; b=AkDFryyhXfRKyYsBUK/KXoVhWOS+frVLcJhgIH2cxTS3whUyNT8x2qvtaNcSFWmZvy 5gsAQmmAO/3Gxs67mdVJcyC02/Jvf+6VXiHN1VH1qkQPZiu5eREbG0BkyO6aH3fnqqHS Id0cQ2DVr5dAEeR/Opp7cYg5Hk3IJT+duEw8CaFbEvueqmUysPnSgyXqEBzwtDxdFUKk sOhzOeSdHbNP7Xofpfxt+xqLByjC70EJpD0/NNRYwXvoJaRvuu1GZNfd19BNVYwMoCLK ZjFBOEMIA1l0YlAKCVd4B84k/44VcCjkkAsjE4giIMyTrTw0Ar5hauGdOXV4YG3vfhMH ilzw== 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=X0YlaBg0eWRFmg01LcYcEakBboU2udItKz/WvLmsstE=; b=WuThpUp2IPx9om3cU2o/9sT9EH2tVQlS4N2/AygV04YY3iNRhbiR4zs6yZ2OQ87Sx3 IaaU6/O3XqA9OjXDXOiXiALoWjFkHToIayTwu/Pw6uQ430Sw/iLhtuArGhFwqlJ4NKdU V6tSxI95Tm8s1vE+DaZF1fZ2Em2rorRVF78Grys8JwuqDeAa8ujTLsnAklwNGV28UjN6 SEaj8xhpj2rnIPFtazyOdZFuj0DYpRYOKaB5NQl6f3hjL2Nvx1Gwy8rxyUZw8LSGVRi+ x34URm3sTpzPKneuvRdsJ4amVB9+YOrzh4ydtTI7sbS25lgWNQvKIAxUBlcls0+FznBP nhyw== X-Gm-Message-State: APjAAAWITcf9tI2O0gt6Mr+TGnJTQmUkhHD9vbfXOE4qJO00sNmqngZ4 YuqZZvFZMmuKPaBTyvtVuY0= X-Google-Smtp-Source: APXvYqzaZ48uQhaDCpAmPYWnFCbRwXOhnRpAWgBqtZsQrr7+jFYScd1DVyElD2iND+AbYLOOfNJGWQ== X-Received: by 2002:a62:ab04:: with SMTP id p4mr2716826pff.227.1568793207344; Wed, 18 Sep 2019 00:53:27 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c147:d9df:f819:e399:825f:f2dc]) by smtp.gmail.com with ESMTPSA id h8sm5580715pfo.64.2019.09.18.00.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 00:53:26 -0700 (PDT) From: William Breathitt Gray To: jic23@jic23.retrosnub.co.uk Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v2 3/7] docs: driver-api: generic-counter: Update Count and Signal data types Date: Wed, 18 Sep 2019 16:52:44 +0900 Message-Id: X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Count data is now always represented as an unsigned integer, while Signal data is either SIGNAL_LOW or SIGNAL_HIGH. Signed-off-by: William Breathitt Gray --- Documentation/driver-api/generic-counter.rst | 22 +++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Documentation/driver-api/generic-counter.rst b/Documentation/driver-api/generic-counter.rst index 8382f01a53e3..161652fc1025 100644 --- a/Documentation/driver-api/generic-counter.rst +++ b/Documentation/driver-api/generic-counter.rst @@ -39,10 +39,7 @@ There are three core components to a counter: COUNT ----- A Count represents the count data for a set of Signals. The Generic -Counter interface provides the following available count data types: - -* COUNT_POSITION: - Unsigned integer value representing position. +Counter interface represents the count data as an unsigned integer. A Count has a count function mode which represents the update behavior for the count data. The Generic Counter interface provides the following @@ -93,19 +90,16 @@ SIGNAL A Signal represents a counter input data; this is the input data that is evaluated by the counter to determine the count data; e.g. a quadrature signal output line of a rotary encoder. Not all counter devices provide -user access to the Signal data. - -The Generic Counter interface provides the following available signal -data types for when the Signal data is available for user access: +user access to the Signal data, so exposure is optional for drivers. -* SIGNAL_LEVEL: - Signal line state level. The following states are possible: +When the Signal data is available for user access, the Generic Counter +interface provides the following available signal values: - - SIGNAL_LEVEL_LOW: - Signal line is in a low state. +* SIGNAL_LOW: + Signal line is in a low state. - - SIGNAL_LEVEL_HIGH: - Signal line is in a high state. +* SIGNAL_HIGH: + Signal line is in a high state. A Signal may be associated with one or more Counts. From patchwork Wed Sep 18 07:52:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 11149757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 457CB14E5 for ; Wed, 18 Sep 2019 07:53:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1AF2321920 for ; Wed, 18 Sep 2019 07:53:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IumcRAkx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728555AbfIRHxe (ORCPT ); Wed, 18 Sep 2019 03:53:34 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:33358 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfIRHxe (ORCPT ); Wed, 18 Sep 2019 03:53:34 -0400 Received: by mail-pg1-f195.google.com with SMTP id n190so3544935pgn.0; Wed, 18 Sep 2019 00:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LsvbpETHylsMeIUTajAZCGUDIJ8fG7jkQ6/Zagal4f4=; b=IumcRAkxy5pZylIcDk2kk11lt/Kamjn4u4KN9e1isPm+S+UCnm3JlxVbOiZ46oXK4n BB/x+oxrFpErhPzc1KQOp/7hsPIzjCj/wZ9g0IE9FwXQwCxkd9IsjMPwGghqdxSVLkI/ xOlbhDFJw5DSqaELCOyrE5u39asaHlXLvDVIzpsnCaHzCTJMVGIHvCMgqw1wL5t/fomj N//ewlufhfCWiM4m/DmfdTnc0pZWJxAl5iHcvmOSjJ4iFd2k8cHhHdJL0B6IwZdRDkkI 1uGPxbb3wOTm2bQHBAV494FE66uu9zVh1aSrZpUf3oPKPpSuUQmj6hELuVVdHwEBWPGq db8Q== 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=LsvbpETHylsMeIUTajAZCGUDIJ8fG7jkQ6/Zagal4f4=; b=MP4tSi3mfhJL3fwAH2B9QocOuvpt6iqiI6saJ40eTg3JDdFHMZn/SDZFJcV+LK+34d hnNO0CZvIznDH1pEf1V/20WCBQiC+uCqoBhA4EM2zQH/hlS5cm5CA9dDxjutxFaHH5rS RoQ9HP4zPfs+BOfL8A2tzBQNOeS26CG12yGDzFvp76mSEWKmRYEZ7A31Fap+y5cBf6JF bBurua2GUSblw6FtzN87kYn3K8XwbZbgEF/z4KEoD3+efvxy6bBGD65G7cUbJXSNUFjq HdAaXqOsCJDTVC3mC85JrpA30YRJYYHO56lorNNiHWbHqYnMjkP8NU/odZWlIpTQ+XoO 2EqA== X-Gm-Message-State: APjAAAXvitshNEFU672hlNF2HC2vWywt+L5ODByOHeuzFozeesZHtWh8 mx2/FgK6ayMaf4XQ0DdpYOk= X-Google-Smtp-Source: APXvYqz6bKFysyOYIsBhtp2Nnv9ivWYTyp7k2Sqz3xxBjGsrTUv0j48RIsG6BIg+26QoSnC9TG7lyQ== X-Received: by 2002:a17:90a:e57:: with SMTP id p23mr2314170pja.126.1568793212976; Wed, 18 Sep 2019 00:53:32 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c147:d9df:f819:e399:825f:f2dc]) by smtp.gmail.com with ESMTPSA id h8sm5580715pfo.64.2019.09.18.00.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 00:53:32 -0700 (PDT) From: William Breathitt Gray To: jic23@jic23.retrosnub.co.uk Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v2 4/7] counter: 104-quad-8: Update count_read/count_write/signal_read callbacks Date: Wed, 18 Sep 2019 16:52:45 +0900 Message-Id: <44531823f947fffb12ceac17861a391a025dd229.1568792697.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The count_read and count_write callbacks pass unsigned long now, while the signal_read callback passes an enum counter_signal_value. Signed-off-by: William Breathitt Gray --- drivers/counter/104-quad-8.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c index 00b113f4b958..17e67a84777d 100644 --- a/drivers/counter/104-quad-8.c +++ b/drivers/counter/104-quad-8.c @@ -562,11 +562,10 @@ static const struct iio_chan_spec quad8_channels[] = { }; static int quad8_signal_read(struct counter_device *counter, - struct counter_signal *signal, struct counter_signal_read_value *val) + struct counter_signal *signal, enum counter_signal_value *val) { const struct quad8_iio *const priv = counter->priv; unsigned int state; - enum counter_signal_level level; /* Only Index signal levels can be read */ if (signal->id < 16) @@ -575,22 +574,19 @@ static int quad8_signal_read(struct counter_device *counter, state = inb(priv->base + QUAD8_REG_INDEX_INPUT_LEVELS) & BIT(signal->id - 16); - level = (state) ? COUNTER_SIGNAL_LEVEL_HIGH : COUNTER_SIGNAL_LEVEL_LOW; - - counter_signal_read_value_set(val, COUNTER_SIGNAL_LEVEL, &level); + *val = (state) ? COUNTER_SIGNAL_HIGH : COUNTER_SIGNAL_LOW; return 0; } static int quad8_count_read(struct counter_device *counter, - struct counter_count *count, struct counter_count_read_value *val) + struct counter_count *count, unsigned long *val) { const struct quad8_iio *const priv = counter->priv; const int base_offset = priv->base + 2 * count->id; unsigned int flags; unsigned int borrow; unsigned int carry; - unsigned long position; int i; flags = inb(base_offset + 1); @@ -598,36 +594,27 @@ static int quad8_count_read(struct counter_device *counter, carry = !!(flags & QUAD8_FLAG_CT); /* Borrow XOR Carry effectively doubles count range */ - position = (unsigned long)(borrow ^ carry) << 24; + *val = (unsigned long)(borrow ^ carry) << 24; /* Reset Byte Pointer; transfer Counter to Output Latch */ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, base_offset + 1); for (i = 0; i < 3; i++) - position |= (unsigned long)inb(base_offset) << (8 * i); - - counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &position); + *val |= (unsigned long)inb(base_offset) << (8 * i); return 0; } static int quad8_count_write(struct counter_device *counter, - struct counter_count *count, struct counter_count_write_value *val) + struct counter_count *count, unsigned long val) { const struct quad8_iio *const priv = counter->priv; const int base_offset = priv->base + 2 * count->id; - int err; - unsigned long position; int i; - err = counter_count_write_value_get(&position, COUNTER_COUNT_POSITION, - val); - if (err) - return err; - /* Only 24-bit values are supported */ - if (position > 0xFFFFFF) + if (val > 0xFFFFFF) return -EINVAL; /* Reset Byte Pointer */ @@ -635,7 +622,7 @@ static int quad8_count_write(struct counter_device *counter, /* Counter can only be set via Preset Register */ for (i = 0; i < 3; i++) - outb(position >> (8 * i), base_offset); + outb(val >> (8 * i), base_offset); /* Transfer Preset Register to Counter */ outb(QUAD8_CTR_RLD | QUAD8_RLD_PRESET_CNTR, base_offset + 1); @@ -644,9 +631,9 @@ static int quad8_count_write(struct counter_device *counter, outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); /* Set Preset Register back to original value */ - position = priv->preset[count->id]; + val = priv->preset[count->id]; for (i = 0; i < 3; i++) - outb(position >> (8 * i), base_offset); + outb(val >> (8 * i), base_offset); /* Reset Borrow, Carry, Compare, and Sign flags */ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, base_offset + 1); From patchwork Wed Sep 18 07:52:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 11149759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C8B514E5 for ; Wed, 18 Sep 2019 07:53:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AE0221924 for ; Wed, 18 Sep 2019 07:53:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Um9D2iCr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728915AbfIRHxi (ORCPT ); Wed, 18 Sep 2019 03:53:38 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38733 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfIRHxi (ORCPT ); Wed, 18 Sep 2019 03:53:38 -0400 Received: by mail-pf1-f194.google.com with SMTP id h195so3829572pfe.5; Wed, 18 Sep 2019 00:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jztD0q/pSM8JUi6mwAcEWzxcgZfTnzpK2xWBV2x6KlU=; b=Um9D2iCr8IeMcdqzFKJCNkI4+H9iquS7B6UFk6cgl4jXkAirxwIuJ95qkKTrUhPsfT gTJcQMEthS4bzi0GfhSAd52gBR5BnadIzveTBTJe5gXEKvFl/zkrZBG1JQAG3wwASiDa INEDf4012fWYH/QZwcG3VHMmcNQaX2TVdkk3ncLyDT9fs5uPELiztes5FG8XMNlvN0fi YM0fnrpbCFQ0TSpfLVRR3SyTJKZH5qDBhLa0bfCyr2euLMqndD+EYffJSPfQ3LI5rTg4 VbrNEubms5qPtsWb331YMEQTqHr4o0GWM0hcAlBaJwAVOpVN8q53IHXZBOA7Z1F9Hfxs DeqQ== 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=jztD0q/pSM8JUi6mwAcEWzxcgZfTnzpK2xWBV2x6KlU=; b=ZtCzrhVHnFd2IKs7QWEhx/R7k5ImqY47+rM6Wu6GqCtpr1ZwF3y/scYX/eXsHrSZqk dUDBtcQLdF+SMhTMRcKo88Jk2b1nUc0t+qxyeNGS5kR32d2lrvBFYO0jOaa0iB7ghfXc +SLHLAz0RPn6cbfkNjPItToMmLbAf+F+c7kAXnMnDZCRztwSniia3pisKwQYqj45Hvzu e+GD4a00fsPL9xSTg9ue5Oo8OzJO4hQ79OAR2R+z2AfMax42ZxuYVK3ta0YNKB6bN2IY RNkI/AYCdN3Fk88mb808zxG7vk//yBIa5JyR1vZGTUC5iDlRZ6A8O3NpdhHcyOM1akyP i6+Q== X-Gm-Message-State: APjAAAWzcpCmjxs8xueY054i5Q4BWCxRKfUpYRZpY5wXQ6ZTbKvGEwZ9 29N4HrJ8r5AAqJZoK6bZ3ks= X-Google-Smtp-Source: APXvYqxxqPoVDdtGr5+T574vmF9JYrxp2FWnYti4I+/c5S8B3oWrqRqPteeAZ6AyHkDVfV3S2ouo0A== X-Received: by 2002:a63:2004:: with SMTP id g4mr2593156pgg.97.1568793217016; Wed, 18 Sep 2019 00:53:37 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c147:d9df:f819:e399:825f:f2dc]) by smtp.gmail.com with ESMTPSA id h8sm5580715pfo.64.2019.09.18.00.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 00:53:36 -0700 (PDT) From: William Breathitt Gray To: jic23@jic23.retrosnub.co.uk Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v2 5/7] counter: ftm-quaddec: Update count_read and count_write callbacks Date: Wed, 18 Sep 2019 16:52:46 +0900 Message-Id: <6925fdda26c57ce29d373f8cb01a572cd7b92c0f.1568792697.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The count_read and count_write callbacks pass unsigned long now. Cc: Patrick Havelange Signed-off-by: William Breathitt Gray --- drivers/counter/ftm-quaddec.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c index 4046aa9f9234..c2b3fdfd8b77 100644 --- a/drivers/counter/ftm-quaddec.c +++ b/drivers/counter/ftm-quaddec.c @@ -178,31 +178,25 @@ static const enum counter_count_function ftm_quaddec_count_functions[] = { static int ftm_quaddec_count_read(struct counter_device *counter, struct counter_count *count, - struct counter_count_read_value *val) + unsigned long *val) { struct ftm_quaddec *const ftm = counter->priv; uint32_t cntval; ftm_read(ftm, FTM_CNT, &cntval); - counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &cntval); + *val = cntval; return 0; } static int ftm_quaddec_count_write(struct counter_device *counter, struct counter_count *count, - struct counter_count_write_value *val) + const unsigned long val) { struct ftm_quaddec *const ftm = counter->priv; - u32 cnt; - int err; - err = counter_count_write_value_get(&cnt, COUNTER_COUNT_POSITION, val); - if (err) - return err; - - if (cnt != 0) { + if (val != 0) { dev_warn(&ftm->pdev->dev, "Can only accept '0' as new counter value\n"); return -EINVAL; } From patchwork Wed Sep 18 07:52:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 11149761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69A74912 for ; Wed, 18 Sep 2019 07:53:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47C3C21907 for ; Wed, 18 Sep 2019 07:53:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LPLquoAA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbfIRHxn (ORCPT ); Wed, 18 Sep 2019 03:53:43 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39026 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfIRHxn (ORCPT ); Wed, 18 Sep 2019 03:53:43 -0400 Received: by mail-pl1-f195.google.com with SMTP id x6so1249382plv.6; Wed, 18 Sep 2019 00:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PJG4R+fWj0sM0gBzRDWpk4Qq46V/CmHI+1H6OVyYxow=; b=LPLquoAAfdRTAHtbCvmLo89FOddl3kLcmoKcvwkZ0Aw07CYrKMn+rFIQ2SMea735AQ AhnhBuxblGpnPuo+csACqsv4/PROmfKoa5EOp8kW373rASStMsZzdD+2vvLXcKZJcyxi 2ImXKEAbpcXEmkfMjE0o+4eZnp8Xd6U5kObCj+vhHZLUxNrHqO3Fb2vGNuc4KjPolu9a eNwCsdLN6k8bFLCyXjsqYRR6Fs0KdBq96+GkBgYg897380aPwILuaA9ey3/ifpesPQLU w68JEyzljbnOCXit4ZJLKveLJOqxOvOZIgwQR0ydrTc51rSAGBZehoceinBxXYmxAzwE T+Fw== 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=PJG4R+fWj0sM0gBzRDWpk4Qq46V/CmHI+1H6OVyYxow=; b=ZduD4i692kStDB8WozUCW/CZgMpkrEhojxXQgPgXpS4yCtO3n+KYX1HD7OC/B3Os8M s04ZHxF475Z2wqgMqwrG+mhNu1b/Y9FU39cSshN12CBCPNsiKPbsrcuhVj12E7b3IZEr tfUtJZ/csAxvUaelLOnWlgd7Hp+AUO0bV0o52DlQFCcJD9t2bPMBP9Z78i3C0455fHWe E/dFNQsLhXkLtU632NwQYLXswzEC52wrNzSIy/dS5IjlHh95ZeWcV9iXtS1KlmCSuCX/ rDe4nsJ14mVzVcJE3hlm0Xw5bB5wMc1ivBovJV3UGHG7O5tzsLIrYcxXtXblMoL9QRTV iWoQ== X-Gm-Message-State: APjAAAV9DFRA3VBxInBe9FHq5RpQPgyGhUY7MYq1wC6V/MRghX5mNMV9 prMaNPbZqlhpjs2YJsm2d2I= X-Google-Smtp-Source: APXvYqwvA2Z/8K4t3M3bEg5QWzJdOEqfLT2DZsU8W/BmRASwQDwnmEUZ8gxHBxKvOMXGNHlizN8Mqg== X-Received: by 2002:a17:902:8d87:: with SMTP id v7mr2716294plo.229.1568793222048; Wed, 18 Sep 2019 00:53:42 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c147:d9df:f819:e399:825f:f2dc]) by smtp.gmail.com with ESMTPSA id h8sm5580715pfo.64.2019.09.18.00.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 00:53:41 -0700 (PDT) From: William Breathitt Gray To: jic23@jic23.retrosnub.co.uk Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v2 6/7] counter: stm32-lptimer-cnt: Update count_read callback Date: Wed, 18 Sep 2019 16:52:47 +0900 Message-Id: X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The count_read callback passes unsigned long now. Cc: Fabrice Gasnier Signed-off-by: William Breathitt Gray --- drivers/counter/stm32-lptimer-cnt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c index bbc930a5962c..73bb773f5e6d 100644 --- a/drivers/counter/stm32-lptimer-cnt.c +++ b/drivers/counter/stm32-lptimer-cnt.c @@ -377,8 +377,7 @@ static enum counter_synapse_action stm32_lptim_cnt_synapse_actions[] = { }; static int stm32_lptim_cnt_read(struct counter_device *counter, - struct counter_count *count, - struct counter_count_read_value *val) + struct counter_count *count, unsigned long *val) { struct stm32_lptim_cnt *const priv = counter->priv; u32 cnt; @@ -388,7 +387,7 @@ static int stm32_lptim_cnt_read(struct counter_device *counter, if (ret) return ret; - counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &cnt); + *val = cnt; return 0; } From patchwork Wed Sep 18 07:52:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 11149765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE63E14E5 for ; Wed, 18 Sep 2019 07:53:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CCCE21907 for ; Wed, 18 Sep 2019 07:53:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gBsEGCLI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729164AbfIRHxr (ORCPT ); Wed, 18 Sep 2019 03:53:47 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43061 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfIRHxq (ORCPT ); Wed, 18 Sep 2019 03:53:46 -0400 Received: by mail-pf1-f194.google.com with SMTP id a2so3815256pfo.10; Wed, 18 Sep 2019 00:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wv4la6Y6FsJg+2v49trmGgdAwNGUcPB7OMZV54Bj2EQ=; b=gBsEGCLIoG9yZOLSPABp5DkqpxUM9VPF+gft6+M58mitntGiBP2B8ZmrdxOFtVQXbn Ri3QHHyEmNUfyQSyX52qq4D7m9tZmGEhy7E12ATGIl8xUL2fdr6MQC7B7UgLocy3qRN2 zKvq2O6kUZNUZUjYg9ZTnJLo1cAZ3DagU2gA6jbq1mM9d7b8TS+CBxCYv73a21JsSweL YgDq8thCF1g0TVAs5oSjbcIWdTfUOK6BABgoT/pslldal2AWK0yke8OqcUmbkyBbntit /xJdKQ99zJ/XgOU8AdprPj5kAjHHpD7e2Vrr4WeHEetM6hB5L+So+ClfGNokdxjz5+Vw UwIQ== 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=wv4la6Y6FsJg+2v49trmGgdAwNGUcPB7OMZV54Bj2EQ=; b=KIiza3Ym0/Iek06nYuTC0Q+Bf8u1iGmn36aGRe9W/I1gIFUEfGsbleqvuPZIWT00W8 br3rJrR/2H39KU5IhPVo1sEoS98RJTcYpjA9f3EeDxdoY/ek4TKpCxnLhjJsYyDgs9mq 5UyMw1Z1JmGOsDBuuR6fTmhHEfUGP82+FFbQdSPJn+qMFX61MTp+H4BNXc2gytT9HWEQ 1Y0sX4b1szCVT7f6AAfDkTzFbdF7HZDF0g22BzyCJecpkgXSzjoiwdIDU4sLVryoCmXx Um8Vc8hzUKg4zSwCI+dEH0xaHnhaohNcEAfu+DjaKEj+HDeeVgcQTJokCj/uSyGiMEdn CEXQ== X-Gm-Message-State: APjAAAWawIb3dwoRrSj8hB0RHg4M+Rzf5isi7d/OB00dbZSdpyxZH8uN TrkX7mwGsR40gJC5g820QCQ= X-Google-Smtp-Source: APXvYqyk7VLAQdjAwuVNeoLOS2lLrS99HPfR5mFLVgsHVxJ42p5JUMRjPPcgX6gO5Y/xqCH3Tv6Kyg== X-Received: by 2002:a17:90a:b108:: with SMTP id z8mr2370791pjq.64.1568793226157; Wed, 18 Sep 2019 00:53:46 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c147:d9df:f819:e399:825f:f2dc]) by smtp.gmail.com with ESMTPSA id h8sm5580715pfo.64.2019.09.18.00.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 00:53:45 -0700 (PDT) From: William Breathitt Gray To: jic23@jic23.retrosnub.co.uk Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v2 7/7] counter: stm32-timer-cnt: Update count_read and count_write callbacks Date: Wed, 18 Sep 2019 16:52:48 +0900 Message-Id: <327fe01b7ce4feb0fc3d854393691664a6a36b40.1568792697.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The count_read and count_write callbacks pass unsigned long now. Cc: Fabrice Gasnier Signed-off-by: William Breathitt Gray --- drivers/counter/stm32-timer-cnt.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c index 644ba18a72ad..839083543323 100644 --- a/drivers/counter/stm32-timer-cnt.c +++ b/drivers/counter/stm32-timer-cnt.c @@ -48,34 +48,27 @@ static enum counter_count_function stm32_count_functions[] = { }; static int stm32_count_read(struct counter_device *counter, - struct counter_count *count, - struct counter_count_read_value *val) + struct counter_count *count, unsigned long *val) { struct stm32_timer_cnt *const priv = counter->priv; u32 cnt; regmap_read(priv->regmap, TIM_CNT, &cnt); - counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &cnt); + *val = cnt; return 0; } static int stm32_count_write(struct counter_device *counter, struct counter_count *count, - struct counter_count_write_value *val) + const unsigned long val) { struct stm32_timer_cnt *const priv = counter->priv; - u32 cnt; - int err; - - err = counter_count_write_value_get(&cnt, COUNTER_COUNT_POSITION, val); - if (err) - return err; - if (cnt > priv->ceiling) + if (val > priv->ceiling) return -EINVAL; - return regmap_write(priv->regmap, TIM_CNT, cnt); + return regmap_write(priv->regmap, TIM_CNT, val); } static int stm32_count_function_get(struct counter_device *counter,