<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/counter.h, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-03-10T09:00:49+00:00</updated>
<entry>
<title>counter: Introduce the compare component</title>
<updated>2025-03-10T09:00:49+00:00</updated>
<author>
<name>William Breathitt Gray</name>
<email>wbg@kernel.org</email>
</author>
<published>2025-03-06T07:05:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b5198201932635e19068cc2e83a99adf38f32c43'/>
<id>urn:sha1:b5198201932635e19068cc2e83a99adf38f32c43</id>
<content type='text'>
Compare registers are used in devices to compare a counter channel
against a particular count value (e.g. to check if a threshold has been
reached). A macro COUNTER_COMP_COMPARE() is introduced to facilitate the
creation of compare components as Count extensions.

Link: https://lore.kernel.org/r/20250306-introduce-compare-component-v1-1-93993b3dca9c@kernel.org
Signed-off-by: William Breathitt Gray &lt;wbg@kernel.org&gt;
</content>
</entry>
<entry>
<title>counter: Don't use "proxy" headers</title>
<updated>2024-04-23T00:03:37+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2024-04-22T14:48:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=89d5d9e9500826cbd3b15ea7b6e8d9fae966f073'/>
<id>urn:sha1:89d5d9e9500826cbd3b15ea7b6e8d9fae966f073</id>
<content type='text'>
Update header inclusions to follow IWYU (Include What You Use)
principle.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20240422144850.2031076-1-andriy.shevchenko@linux.intel.com
Signed-off-by: William Breathitt Gray &lt;wbg@kernel.org&gt;
</content>
</entry>
<entry>
<title>counter: Introduce the COUNTER_COMP_FREQUENCY() macro</title>
<updated>2024-04-02T17:10:34+00:00</updated>
<author>
<name>Fabrice Gasnier</name>
<email>fabrice.gasnier@foss.st.com</email>
</author>
<published>2024-03-06T15:36:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2f48aba356a004d854bc6d77fbc032b2fc666911'/>
<id>urn:sha1:2f48aba356a004d854bc6d77fbc032b2fc666911</id>
<content type='text'>
Now that there are two users for the "frequency" extension, introduce a
new COUNTER_COMP_FREQUENCY() macro.
This extension is intended to be a read-only signal attribute.

Suggested-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
Signed-off-by: Fabrice Gasnier &lt;fabrice.gasnier@foss.st.com&gt;
Link: https://lore.kernel.org/r/20240306153631.4051115-1-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
</content>
</entry>
<entry>
<title>counter: linux/counter.h: fix Excess kernel-doc description warning</title>
<updated>2024-04-02T17:10:33+00:00</updated>
<author>
<name>Randy Dunlap</name>
<email>rdunlap@infradead.org</email>
</author>
<published>2023-12-23T05:05:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=416bdb89605d960405178b9bf04df512d1ace1a3'/>
<id>urn:sha1:416bdb89605d960405178b9bf04df512d1ace1a3</id>
<content type='text'>
Remove the @priv: line to prevent the kernel-doc warning:

include/linux/counter.h:400: warning: Excess struct member 'priv' description in 'counter_device'

Signed-off-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Fixes: f2ee4759fb70 ("counter: remove old and now unused registration API")
Link: https://lore.kernel.org/r/20231223050511.13849-1-rdunlap@infradead.org
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
</content>
</entry>
<entry>
<title>counter: Declare counter_priv() to be const</title>
<updated>2023-08-16T13:41:29+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2023-07-18T16:20:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=83bc0982bf25edfcb261bebee51abc76ce8a975b'/>
<id>urn:sha1:83bc0982bf25edfcb261bebee51abc76ce8a975b</id>
<content type='text'>
According to the gcc manual functions "whose return value is not
affected by changes to the observable state of the program and that have
no observable effects on such state other than to return a value may
lend themselves to optimizations such as common subexpression
elimination. Declaring such functions with the 'const' attribute allows
GCC to avoid emitting some calls in repeated invocations of the function
with the same argument values."

counter_priv() is such a function and so can be marked with the const
function attribute.

The effect for an arm allyesconfig build according to bloat-o-meter (on
top of v6.5-rc2) is:

	add/remove: 0/1 grow/shrink: 2/14 up/down: 524/-1064 (-540)
	Function                                     old     new   delta
	rz_mtu3_count_enable_write                   632    1152    +520
	stm32_count_enable_write                     372     376      +4
	ti_eqep_action_read                          456     452      -4
	stm32_lptim_cnt_action_write                 400     392      -8
	stm32_lptim_cnt_action_read                  300     288     -12
	rz_mtu3_count_write                          296     284     -12
	rz_mtu3_count_read                           304     292     -12
	rz_mtu3_count_function_read                  212     200     -12
	rz_mtu3_count_direction_read                 268     256     -12
	rz_mtu3_action_read                          628     616     -12
	rz_mtu3_count_function_write                 328     312     -16
	ecap_cnt_suspend                             364     340     -24
	ecap_cnt_resume                              300     276     -24
	rz_mtu3_count_ceiling_write                  596     560     -36
	rz_mtu3_count_enable_read                    332     288     -44
	rz_mtu3_count_ceiling_read                   384     340     -44
	rz_mtu3_initialize_counter                   792       -    -792
	Total: Before=60715, After=60175, chg -0.89%

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20230718162015.3940148-1-u.kleine-koenig@pengutronix.de/
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
</content>
</entry>
<entry>
<title>counter: Reduce DEFINE_COUNTER_ARRAY_POLARITY() to defining counter_array</title>
<updated>2022-10-17T13:51:29+00:00</updated>
<author>
<name>William Breathitt Gray</name>
<email>william.gray@linaro.org</email>
</author>
<published>2022-10-02T12:04:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=472a1482325b3a285e0bcf82c0b0edc689b7e8cd'/>
<id>urn:sha1:472a1482325b3a285e0bcf82c0b0edc689b7e8cd</id>
<content type='text'>
A spare warning was reported for drivers/counter/ti-ecap-capture.c::

    sparse warnings: (new ones prefixed by &gt;&gt;)
    &gt;&gt; drivers/counter/ti-ecap-capture.c:380:8: sparse: sparse: symbol 'ecap_cnt_pol_array' was not declared. Should it be static?

    vim +/ecap_cnt_pol_array +380 drivers/counter/ti-ecap-capture.c

       379
     &gt; 380	static DEFINE_COUNTER_ARRAY_POLARITY(ecap_cnt_pol_array, ecap_cnt_pol_avail, ECAP_NB_CEVT);
       381

The first argument to the DEFINE_COUNTER_ARRAY_POLARITY() macro is a
token serving as the symbol name in the definition of a new
struct counter_array structure. However, this macro actually expands to
two statements::

    #define DEFINE_COUNTER_ARRAY_POLARITY(_name, _enums, _length) \
            DEFINE_COUNTER_AVAILABLE(_name##_available, _enums); \
            struct counter_array _name = { \
                    .type = COUNTER_COMP_SIGNAL_POLARITY, \
                    .avail = &amp;(_name##_available), \
                    .length = (_length), \
            }

Because of this, the "static" on line 380 only applies to the first
statement. This patch splits out the DEFINE_COUNTER_AVAILABLE() line
and leaves DEFINE_COUNTER_ARRAY_POLARITY() as a simple structure
definition to avoid issues like this.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Link: https://lore.kernel.org/all/202210020619.NQbyomII-lkp@intel.com/
Cc: Julien Panis &lt;jpanis@baylibre.com&gt;
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
</content>
</entry>
<entry>
<title>counter: Introduce the COUNTER_COMP_ARRAY component type</title>
<updated>2022-09-30T12:32:35+00:00</updated>
<author>
<name>William Breathitt Gray</name>
<email>william.gray@linaro.org</email>
</author>
<published>2022-09-27T22:53:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d2011be1e22f7769c7c71d6d7f777ffcc544808d'/>
<id>urn:sha1:d2011be1e22f7769c7c71d6d7f777ffcc544808d</id>
<content type='text'>
The COUNTER_COMP_ARRAY Counter component type is introduced to enable
support for Counter array components. With Counter array components,
exposure for buffers on counter devices can be defined via new Counter
array component macros. This should simplify code for driver authors who
would otherwise need to define individual Counter components for each
array element.

Eight Counter array component macros are introduced::

        DEFINE_COUNTER_ARRAY_U64(_name, _length)
        DEFINE_COUNTER_ARRAY_CAPTURE(_name, _length)
        DEFINE_COUNTER_ARRAY_POLARITY(_name, _enums, _length)
        COUNTER_COMP_DEVICE_ARRAY_U64(_name, _read, _write, _array)
        COUNTER_COMP_COUNT_ARRAY_U64(_name, _read, _write, _array)
        COUNTER_COMP_SIGNAL_ARRAY_U64(_name, _read, _write, _array)
        COUNTER_COMP_ARRAY_CAPTURE(_read, _write, _array)
        COUNTER_COMP_ARRAY_POLARITY(_read, _write, _array)

Eight Counter array callbacks are introduced as well::

        int (*signal_array_u32_read)(struct counter_device *counter,
                                     struct counter_signal *signal,
                                     size_t idx, u32 *val);
        int (*signal_array_u32_write)(struct counter_device *counter,
                                      struct counter_signal *signal,
                                      size_t idx, u32 val);
        int (*device_array_u64_read)(struct counter_device *counter,
                                     size_t idx, u64 *val);
        int (*count_array_u64_read)(struct counter_device *counter,
                                    struct counter_count *count,
                                    size_t idx, u64 *val);
        int (*signal_array_u64_read)(struct counter_device *counter,
                                     struct counter_signal *signal,
                                     size_t idx, u64 *val);
        int (*device_array_u64_write)(struct counter_device *counter,
                                      size_t idx, u64 val);
        int (*count_array_u64_write)(struct counter_device *counter,
                                     struct counter_count *count,
                                     size_t idx, u64 val);
        int (*signal_array_u64_write)(struct counter_device *counter,
                                      struct counter_signal *signal,
                                      size_t idx, u64 val);

Driver authors can handle reads/writes for an array component by
receiving an element index via the `idx` parameter and processing the
respective value via the `val` parameter.

For example, suppose a driver wants to expose a Count's read-only
capture buffer of four elements using a callback
`foobar_capture_read()`::

        DEFINE_COUNTER_ARRAY_CAPTURE(foobar_capture_array, 4);
        COUNTER_COMP_ARRAY_CAPTURE(foobar_capture_read, NULL,
                                   foobar_capture_array)

Respective sysfs attributes for each array element would appear for the
respective Count:

* /sys/bus/counter/devices/counterX/countY/capture0
* /sys/bus/counter/devices/counterX/countY/capture1
* /sys/bus/counter/devices/counterX/countY/capture2
* /sys/bus/counter/devices/counterX/countY/capture3

If a user tries to read _capture2_ for example, `idx` will be `2` when
passed to the `foobar_capture_read()` callback, and thus the driver
knows which array element to handle.

Counter arrays for polarity elements can be defined in a similar
manner as u64 elements::

        const enum counter_signal_polarity foobar_polarity_states[] = {
                COUNTER_SIGNAL_POLARITY_POSITIVE,
                COUNTER_SIGNAL_POLARITY_NEGATIVE,
        };
        DEFINE_COUNTER_ARRAY_POLARITY(foobar_polarity_array,
                                      foobar_polarity_states, 4);
        COUNTER_COMP_ARRAY_POLARITY(foobar_polarity_read,
                                    foobar_polarity_write,
                                    foobar_polarity_array)

Tested-by: Julien Panis &lt;jpanis@baylibre.com&gt;
Link: https://lore.kernel.org/r/5310c22520aeae65b1b74952419f49ac4c8e1ec1.1664204990.git.william.gray@linaro.org/
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
Link: https://lore.kernel.org/r/a51fd608704bdfc5a0efa503fc5481df34241e0a.1664318353.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>counter: Introduce the Count capture component</title>
<updated>2022-09-30T12:32:35+00:00</updated>
<author>
<name>William Breathitt Gray</name>
<email>william.gray@linaro.org</email>
</author>
<published>2022-09-27T22:53:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=45d2918520b2d8e640e4fb3fbf664dfb823dc520'/>
<id>urn:sha1:45d2918520b2d8e640e4fb3fbf664dfb823dc520</id>
<content type='text'>
Some devices provide a latch function to save historic Count values.
This patch standardizes exposure of such functionality as Count capture
components. A COUNTER_COMP_CAPTURE macro is provided for driver authors
to define a capture component. A new event COUNTER_EVENT_CAPTURE is
introduced to represent Count value capture events.

Cc: Julien Panis &lt;jpanis@baylibre.com&gt;
Link: https://lore.kernel.org/r/c239572ab4208d0d6728136e82a88ad464369a7a.1664204990.git.william.gray@linaro.org/
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
Link: https://lore.kernel.org/r/3cebaa0b807a225eb277d771504fe6dba7269ffd.1664318353.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>counter: Introduce the Signal polarity component</title>
<updated>2022-09-30T12:32:35+00:00</updated>
<author>
<name>William Breathitt Gray</name>
<email>william.gray@linaro.org</email>
</author>
<published>2022-09-27T22:53:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=650ae67bbf7ba5ac193f053969612fbb93247b64'/>
<id>urn:sha1:650ae67bbf7ba5ac193f053969612fbb93247b64</id>
<content type='text'>
The Signal polarity component represents the active level of a
respective Signal. There are two possible states: positive (rising edge)
and negative (falling edge); enum counter_signal_polarity represents
these states. A convenience macro COUNTER_COMP_POLARITY() is provided
for driver authors to declare a Signal polarity component.

Cc: Julien Panis &lt;jpanis@baylibre.com&gt;
Link: https://lore.kernel.org/r/8f47d6e1db71a11bb1e2666f8e2a6e9d256d4131.1664204990.git.william.gray@linaro.org/
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
Link: https://lore.kernel.org/r/b6e53438badcb6318997d13dd2fc052f97d808ac.1664318353.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>counter: Realign counter_comp comment block to 80 characters</title>
<updated>2022-09-22T11:28:31+00:00</updated>
<author>
<name>William Breathitt Gray</name>
<email>william.gray@linaro.org</email>
</author>
<published>2022-09-22T11:20:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cca1fd41ab2862465d75443822d751e4f9a112ee'/>
<id>urn:sha1:cca1fd41ab2862465d75443822d751e4f9a112ee</id>
<content type='text'>
The member documentation comment lines for struct counter_comp extend
past the 80-characters column boundary due to extra identation at the
start of each section. This patch realigns the comment block within the
80-characters boundary by removing these superfluous indents.

Reviewed-by: Yanteng Si &lt;siyanteng@loongson.cn&gt;
Link: https://lore.kernel.org/r/20220902120839.4260-1-william.gray@linaro.org/
Signed-off-by: William Breathitt Gray &lt;william.gray@linaro.org&gt;
Link: https://lore.kernel.org/r/8294b04153c33602e9c3dd21ac90c1e99bd0fdaf.1663844776.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
