Skip to contentSkip to conversation

Remove the IIO counter ABI

PATCH Superseded William Breathitt Gray 3 participants 5 messages Jan 24, 2021 – Jan 27, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Remove the IIO counter ABI

The IIO counter driver has been superseded by the Counter subsystem as discussed in [1]. This patchset removes the IIO counter ABI code and documentation.

[1] https://lore.kernel.org/lkml/[email protected]/

William Breathitt Gray (2):
counter: 104-quad-8: Remove IIO counter ABI
iio: Remove the IIO counter ABI documentation

 Documentation/ABI/testing/sysfs-bus-iio       |  40 --
 .../testing/sysfs-bus-iio-counter-104-quad-8  | 133 ----
 MAINTAINERS                                   |   1 -
 drivers/counter/104-quad-8.c                  | 652 ++----------------
 drivers/counter/Kconfig                       |   2 +-
 5 files changed, 65 insertions(+), 763 deletions(-)
 delete mode 100644 Documentation/ABI/testing/sysfs-bus-iio-counter-104-quad-8
Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/2 counter: 104-quad-8: Remove IIO counter ABI

The IIO counter driver has been superseded by the Counter subsystem as discussed in [1]. This patch removes the IIO counter ABI from the 104-QUAD-8 driver.

[1] https://lore.kernel.org/lkml/[email protected]/

---
 .../testing/sysfs-bus-iio-counter-104-quad-8  | 133 ----
 MAINTAINERS                                   |   1 -
 drivers/counter/104-quad-8.c                  | 652 ++----------------
 drivers/counter/Kconfig                       |   2 +-
 4 files changed, 65 insertions(+), 723 deletions(-)
 delete mode 100644 Documentation/ABI/testing/sysfs-bus-iio-counter-104-quad-8
Documentation/ABI/testing/sysfs-bus-iio-counter-104-quad-8 deleted +0 -133
deleted file mode 100644
index bac3d0d48b7b..000000000000
@@ -1,133 +0,0 @@
-What:		/sys/bus/iio/devices/iio:deviceX/in_count_count_mode_available
-What:		/sys/bus/iio/devices/iio:deviceX/in_count_noise_error_available
-What:		/sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available
-What:		/sys/bus/iio/devices/iio:deviceX/in_index_index_polarity_available
-What:		/sys/bus/iio/devices/iio:deviceX/in_index_synchronous_mode_available
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Discrete set of available values for the respective counter
-		configuration are listed in this file.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_countY_count_mode
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Count mode for channel Y. Four count modes are available:
-		normal, range limit, non-recycle, and modulo-n. The preset value
-		for channel Y is used by the count mode where required.
-
-		Normal:
-			Counting is continuous in either direction.
-
-		Range Limit:
-			An upper or lower limit is set, mimicking limit switches
-			in the mechanical counterpart. The upper limit is set to
-			the preset value, while the lower limit is set to 0. The
-			counter freezes at count = preset when counting up, and
-			at count = 0 when counting down. At either of these
-			limits, the counting is resumed only when the count
-			direction is reversed.
-
-		Non-recycle:
-			Counter is disabled whenever a 24-bit count overflow or
-			underflow takes place. The counter is re-enabled when a
-			new count value is loaded to the counter via a preset
-			operation or write to raw.
-
-		Modulo-N:
-			A count boundary is set between 0 and the preset value.
-			The counter is reset to 0 at count = preset when
-			counting up, while the counter is set to the preset
-			value at count = 0 when counting down; the counter does
-			not freeze at the bundary points, but counts
-			continuously throughout.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_countY_noise_error
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Read-only attribute that indicates whether excessive noise is
-		present at the channel Y count inputs in quadrature clock mode;
-		irrelevant in non-quadrature clock mode.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_countY_preset
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		If the counter device supports preset registers, the preset
-		count for channel Y is provided by this attribute.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_countY_quadrature_mode
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Configure channel Y counter for non-quadrature or quadrature
-		clock mode. Selecting non-quadrature clock mode will disable
-		synchronous load mode. In quadrature clock mode, the channel Y
-		scale attribute selects the encoder phase division (scale of 1
-		selects full-cycle, scale of 0.5 selects half-cycle, scale of
-		0.25 selects quarter-cycle) processed by the channel Y counter.
-
-		Non-quadrature:
-			The filter and decoder circuit are bypassed. Encoder A
-			input serves as the count input and B as the UP/DOWN
-			direction control input, with B = 1 selecting UP Count
-			mode and B = 0 selecting Down Count mode.
-
-		Quadrature:
-			Encoder A and B inputs are digitally filtered and
-			decoded for UP/DN clock.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_countY_set_to_preset_on_index
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Whether to set channel Y counter with channel Y preset value
-		when channel Y index input is active, or continuously count.
-		Valid attribute values are boolean.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_indexY_index_polarity
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Active level of channel Y index input; irrelevant in
-		non-synchronous load mode.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_indexY_synchronous_mode
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Configure channel Y counter for non-synchronous or synchronous
-		load mode. Synchronous load mode cannot be selected in
-		non-quadrature clock mode.
-
-		Non-synchronous:
-			A logic low level is the active level at this index
-			input. The index function (as enabled via
-			set_to_preset_on_index) is performed directly on the
-			active level of the index input.
-
-		Synchronous:
-			Intended for interfacing with encoder Index output in
-			quadrature clock mode. The active level is configured
-			via index_polarity. The index function (as enabled via
-			set_to_preset_on_index) is performed synchronously with
-			the quadrature clock on the active level of the index
-			input.
MAINTAINERS +0 -1
index 546aa66428c9..f2d94e1f4032 100644
@@ -298,7 +298,6 @@ M:	Syed Nayyar Waris <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/ABI/testing/sysfs-bus-counter-104-quad-8
-F:	Documentation/ABI/testing/sysfs-bus-iio-counter-104-quad-8
 F:	drivers/counter/104-quad-8.c
 
 ACCES PCI-IDIO-16 GPIO DRIVER
drivers/counter/104-quad-8.c +64 -588

880 lines not on this page · raw message

drivers/counter/Kconfig +1 -1
index 2de53ab0dd25..63ffbebcf455 100644
@@ -14,7 +14,7 @@ if COUNTER
 
 config 104_QUAD_8
 	tristate "ACCES 104-QUAD-8 driver"
-	depends on PC104 && X86 && IIO
+	depends on PC104 && X86
 	select ISA_BUS_API
 	help
 	  Say yes here to build support for the ACCES 104-QUAD-8 quadrature
Signature · 1 line
2.30.0
#3 lore raw

PATCH 2/2 iio: Remove the IIO counter ABI documentation

In reply to William Breathitt Gray

The IIO counter driver has been superseded by the Counter subsystem as discussed in [1]. This patch removes the IIO counter ABI documentation.

[1] https://lore.kernel.org/lkml/[email protected]/

Cc Fabrice Gasnier <[email protected]>
Cc Benjamin Gaignard <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 40 -------------------------
 1 file changed, 40 deletions(-)
Documentation/ABI/testing/sysfs-bus-iio +0 -40
index d957f5da5c04..c207484a86d0 100644
@@ -1704,46 +1704,6 @@ Description:
 		Raw (unscaled no offset etc.) electric conductivity reading that
 		can be processed to siemens per meter.
 
-What:		/sys/bus/iio/devices/iio:deviceX/in_countY_raw
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Raw counter device counts from channel Y. For quadrature
-		counters, multiplication by an available [Y]_scale results in
-		the counts of a single quadrature signal phase from channel Y.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_indexY_raw
-KernelVersion:	4.10
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Raw counter device index value from channel Y. This attribute
-		provides an absolute positional reference (e.g. a pulse once per
-		revolution) which may be used to home positional systems as
-		required.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_count_count_direction_available
-KernelVersion:	4.12
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		A list of possible counting directions which are:
-
-		- "up"	: counter device is increasing.
-		- "down": counter device is decreasing.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_countY_count_direction
-KernelVersion:	4.12
-Contact:	[email protected]
-Description:
-		This interface is deprecated; please use the Counter subsystem.
-
-		Raw counter device counters direction for channel Y.
-
 What:		/sys/bus/iio/devices/iio:deviceX/in_voltageY_label
 What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_label
 KernelVersion:	5.8
Signature · 1 line
2.30.0
maintainer
#4 lore raw
In reply to William Breathitt Gray
Quoted 5 lines · On Sun, 24 Jan 2021 16:42:22 +0900 William Breathitt Gray…

The IIO counter driver has been superseded by the Counter subsystem as discussed in [1]. This patchset removes the IIO counter ABI code and documentation.

[1] https://lore.kernel.org/lkml/[email protected]/

I'm happy to see this go in general, but would like it to sit on the list for a little while just in case anyone has a different opinion.

The ABI has been marked as deprecated for a while, but who knows if users noticed that. Fingers crossed no one notices us removing it.

It think it would also be good to note we still have one user of this ABI in iio/triggers/stm32-timer-trigger.c
Hence we may want to introduce specific docs for that one case or try to figure out a clean way to get rid of it...

Jonathan

Quoted 13 lines

William Breathitt Gray (2):
counter: 104-quad-8: Remove IIO counter ABI
iio: Remove the IIO counter ABI documentation

 Documentation/ABI/testing/sysfs-bus-iio       |  40 --
 .../testing/sysfs-bus-iio-counter-104-quad-8  | 133 ----
 MAINTAINERS                                   |   1 -
 drivers/counter/104-quad-8.c                  | 652 ++----------------
 drivers/counter/Kconfig                       |   2 +-
 5 files changed, 65 insertions(+), 763 deletions(-)
 delete mode 100644 Documentation/ABI/testing/sysfs-bus-iio-counter-104-quad-8
#2 lore raw

Re: [PATCH 1/2] counter: 104-quad-8: Remove IIO counter ABI

In reply to William Breathitt Gray
I love your patch! Yet something to improve:

Hi William,

I love your patch! Yet something to improve:

[auto build test ERROR on iio/togreg]
[also build test ERROR on linux/master linus/master v5.11-rc5 next-20210125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/William-Breathitt-Gray/Remove-the-IIO-counter-ABI/20210125-210945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: x86_64-randconfig-a003-20210126 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 925ae8c790c7e354f12ec14a6cac6aa49fc75b29)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/93b6ce4252570c170c0a65a5d2ba200a5cb07967
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review William-Breathitt-Gray/Remove-the-IIO-counter-ABI/20210125-210945 git checkout 93b6ce4252570c170c0a65a5d2ba200a5cb07967
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/counter/104-quad-8.c:1036:40: error: too few arguments to function call, expected 3, have 2
           priv = devm_kzalloc(dev, sizeof(*priv));
                  ~~~~~~~~~~~~                   ^
   include/linux/device.h:215:21: note: 'devm_kzalloc' declared here
   static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
                       ^

1 error generated.

vim +1036 drivers/counter/104-quad-8.c

1022
1023 static int quad8_probe(struct device *dev, unsigned int id)
1024 {
1025 struct quad8 *priv;
1026 int i, j;
1027 unsigned int base_offset;
1028 int err;
1029
1030 if (!devm_request_region(dev, base[id], QUAD8_EXTENT, dev_name(dev))) {
1031 dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n",
1032 base[id], base[id] + QUAD8_EXTENT);
1033 return -EBUSY;
1034 }
1035

> 1036		priv = devm_kzalloc(dev, sizeof(*priv));

1037 if (!priv)
1038 return -ENOMEM;
1039
1040 /* Initialize Counter device and driver data */
1041 priv->counter.name = dev_name(dev);
1042 priv->counter.parent = dev;
1043 priv->counter.ops = &quad8_ops;
1044 priv->counter.counts = quad8_counts;
1045 priv->counter.num_counts = ARRAY_SIZE(quad8_counts);
1046 priv->counter.signals = quad8_signals;
1047 priv->counter.num_signals = ARRAY_SIZE(quad8_signals);
1048 priv->counter.priv = priv;
1049 priv->base = base[id];
1050
1051 /* Initialize mutex */
1052 mutex_init(&priv->lock);
1053
1054 /* Reset all counters and disable interrupt function */
1055 outb(QUAD8_CHAN_OP_RESET_COUNTERS, base[id] + QUAD8_REG_CHAN_OP);
1056 /* Set initial configuration for all counters */
1057 for (i = 0; i < QUAD8_NUM_COUNTERS; i++) {
1058 base_offset = base[id] + 2 * i;
1059 /* Reset Byte Pointer */
1060 outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
1061 /* Reset filter clock factor */
1062 outb(0, base_offset);
1063 outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC,
1064 base_offset + 1);
1065 /* Reset Byte Pointer */
1066 outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
1067 /* Reset Preset Register */
1068 for (j = 0; j < 3; j++)
1069 outb(0x00, base_offset);
1070 /* Reset Borrow, Carry, Compare, and Sign flags */
1071 outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, base_offset + 1);
1072 /* Reset Error flag */
1073 outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1);
1074 /* Binary encoding; Normal count; non-quadrature mode */
1075 outb(QUAD8_CTR_CMR, base_offset + 1);
1076 /* Disable A and B inputs; preset on index; FLG1 as Carry */
1077 outb(QUAD8_CTR_IOR, base_offset + 1);
1078 /* Disable index function; negative index polarity */
1079 outb(QUAD8_CTR_IDR, base_offset + 1);
1080 }
1081 /* Disable Differential Encoder Cable Status for all channels */
1082 outb(0xFF, base[id] + QUAD8_DIFF_ENCODER_CABLE_STATUS);
1083 /* Enable all counters */
1084 outb(QUAD8_CHAN_OP_ENABLE_COUNTERS, base[id] + QUAD8_REG_CHAN_OP);
1085
1086 /* Register Counter device */
1087 return devm_counter_register(dev, &priv->counter);
1088 }
1089

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org