2021-12-27 09:46:20

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH v2 05/23] counter: 104-quad-8: Convert to counter_priv() wrapper

This is a straight forward conversion to the new counter_priv() wrapper.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/counter/104-quad-8.c | 58 ++++++++++++++++++------------------
1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
index 1cbd60aaed69..6e5286cd1d4e 100644
--- a/drivers/counter/104-quad-8.c
+++ b/drivers/counter/104-quad-8.c
@@ -113,7 +113,7 @@ static int quad8_signal_read(struct counter_device *counter,
struct counter_signal *signal,
enum counter_signal_level *level)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);
unsigned int state;

/* Only Index signal levels can be read */
@@ -131,7 +131,7 @@ static int quad8_signal_read(struct counter_device *counter,
static int quad8_count_read(struct counter_device *counter,
struct counter_count *count, u64 *val)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const int base_offset = priv->base + 2 * count->id;
unsigned int flags;
unsigned int borrow;
@@ -163,7 +163,7 @@ static int quad8_count_read(struct counter_device *counter,
static int quad8_count_write(struct counter_device *counter,
struct counter_count *count, u64 val)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const int base_offset = priv->base + 2 * count->id;
unsigned long irqflags;
int i;
@@ -213,7 +213,7 @@ static int quad8_function_read(struct counter_device *counter,
struct counter_count *count,
enum counter_function *function)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const int id = count->id;
unsigned long irqflags;

@@ -243,7 +243,7 @@ static int quad8_function_write(struct counter_device *counter,
struct counter_count *count,
enum counter_function function)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const int id = count->id;
unsigned int *const quadrature_mode = priv->quadrature_mode + id;
unsigned int *const scale = priv->quadrature_scale + id;
@@ -305,7 +305,7 @@ static int quad8_direction_read(struct counter_device *counter,
struct counter_count *count,
enum counter_count_direction *direction)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);
unsigned int ud_flag;
const unsigned int flag_addr = priv->base + 2 * count->id + 1;

@@ -335,7 +335,7 @@ static int quad8_action_read(struct counter_device *counter,
struct counter_synapse *synapse,
enum counter_synapse_action *action)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
int err;
enum counter_function function;
const size_t signal_a_id = count->synapses[0].signal->id;
@@ -399,7 +399,7 @@ enum {

static int quad8_events_configure(struct counter_device *counter)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
unsigned long irq_enabled = 0;
unsigned long irqflags;
size_t channel;
@@ -442,7 +442,7 @@ static int quad8_events_configure(struct counter_device *counter)
static int quad8_watch_validate(struct counter_device *counter,
const struct counter_watch *watch)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);

if (watch->channel > QUAD8_NUM_COUNTERS - 1)
return -EINVAL;
@@ -497,7 +497,7 @@ static int quad8_index_polarity_get(struct counter_device *counter,
struct counter_signal *signal,
u32 *index_polarity)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id - 16;

*index_polarity = priv->index_polarity[channel_id];
@@ -509,7 +509,7 @@ static int quad8_index_polarity_set(struct counter_device *counter,
struct counter_signal *signal,
u32 index_polarity)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id - 16;
const int base_offset = priv->base + 2 * channel_id + 1;
unsigned long irqflags;
@@ -538,7 +538,7 @@ static int quad8_synchronous_mode_get(struct counter_device *counter,
struct counter_signal *signal,
u32 *synchronous_mode)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id - 16;

*synchronous_mode = priv->synchronous_mode[channel_id];
@@ -550,7 +550,7 @@ static int quad8_synchronous_mode_set(struct counter_device *counter,
struct counter_signal *signal,
u32 synchronous_mode)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id - 16;
const int base_offset = priv->base + 2 * channel_id + 1;
unsigned long irqflags;
@@ -589,7 +589,7 @@ static int quad8_count_mode_read(struct counter_device *counter,
struct counter_count *count,
enum counter_count_mode *cnt_mode)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);

/* Map 104-QUAD-8 count mode to Generic Counter count mode */
switch (priv->count_mode[count->id]) {
@@ -614,7 +614,7 @@ static int quad8_count_mode_write(struct counter_device *counter,
struct counter_count *count,
enum counter_count_mode cnt_mode)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
unsigned int count_mode;
unsigned int mode_cfg;
const int base_offset = priv->base + 2 * count->id + 1;
@@ -661,7 +661,7 @@ static int quad8_count_mode_write(struct counter_device *counter,
static int quad8_count_enable_read(struct counter_device *counter,
struct counter_count *count, u8 *enable)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);

*enable = priv->ab_enable[count->id];

@@ -671,7 +671,7 @@ static int quad8_count_enable_read(struct counter_device *counter,
static int quad8_count_enable_write(struct counter_device *counter,
struct counter_count *count, u8 enable)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const int base_offset = priv->base + 2 * count->id;
unsigned long irqflags;
unsigned int ior_cfg;
@@ -699,7 +699,7 @@ static const char *const quad8_noise_error_states[] = {
static int quad8_error_noise_get(struct counter_device *counter,
struct counter_count *count, u32 *noise_error)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);
const int base_offset = priv->base + 2 * count->id + 1;

*noise_error = !!(inb(base_offset) & QUAD8_FLAG_E);
@@ -710,7 +710,7 @@ static int quad8_error_noise_get(struct counter_device *counter,
static int quad8_count_preset_read(struct counter_device *counter,
struct counter_count *count, u64 *preset)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);

*preset = priv->preset[count->id];

@@ -736,7 +736,7 @@ static void quad8_preset_register_set(struct quad8 *const priv, const int id,
static int quad8_count_preset_write(struct counter_device *counter,
struct counter_count *count, u64 preset)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
unsigned long irqflags;

/* Only 24-bit values are supported */
@@ -755,7 +755,7 @@ static int quad8_count_preset_write(struct counter_device *counter,
static int quad8_count_ceiling_read(struct counter_device *counter,
struct counter_count *count, u64 *ceiling)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
unsigned long irqflags;

spin_lock_irqsave(&priv->lock, irqflags);
@@ -780,7 +780,7 @@ static int quad8_count_ceiling_read(struct counter_device *counter,
static int quad8_count_ceiling_write(struct counter_device *counter,
struct counter_count *count, u64 ceiling)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
unsigned long irqflags;

/* Only 24-bit values are supported */
@@ -807,7 +807,7 @@ static int quad8_count_preset_enable_read(struct counter_device *counter,
struct counter_count *count,
u8 *preset_enable)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);

*preset_enable = !priv->preset_enable[count->id];

@@ -818,7 +818,7 @@ static int quad8_count_preset_enable_write(struct counter_device *counter,
struct counter_count *count,
u8 preset_enable)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const int base_offset = priv->base + 2 * count->id + 1;
unsigned long irqflags;
unsigned int ior_cfg;
@@ -845,7 +845,7 @@ static int quad8_signal_cable_fault_read(struct counter_device *counter,
struct counter_signal *signal,
u8 *cable_fault)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id / 2;
unsigned long irqflags;
bool disabled;
@@ -875,7 +875,7 @@ static int quad8_signal_cable_fault_enable_read(struct counter_device *counter,
struct counter_signal *signal,
u8 *enable)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id / 2;

*enable = !!(priv->cable_fault_enable & BIT(channel_id));
@@ -887,7 +887,7 @@ static int quad8_signal_cable_fault_enable_write(struct counter_device *counter,
struct counter_signal *signal,
u8 enable)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id / 2;
unsigned long irqflags;
unsigned int cable_fault_enable;
@@ -913,7 +913,7 @@ static int quad8_signal_fck_prescaler_read(struct counter_device *counter,
struct counter_signal *signal,
u8 *prescaler)
{
- const struct quad8 *const priv = counter->priv;
+ const struct quad8 *const priv = counter_priv(counter);

*prescaler = priv->fck_prescaler[signal->id / 2];

@@ -924,7 +924,7 @@ static int quad8_signal_fck_prescaler_write(struct counter_device *counter,
struct counter_signal *signal,
u8 prescaler)
{
- struct quad8 *const priv = counter->priv;
+ struct quad8 *const priv = counter_priv(counter);
const size_t channel_id = signal->id / 2;
const int base_offset = priv->base + 2 * channel_id;
unsigned long irqflags;
--
2.33.0



2021-12-28 17:56:46

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v2 05/23] counter: 104-quad-8: Convert to counter_priv() wrapper

On Mon, 27 Dec 2021 10:45:08 +0100
Uwe Kleine-König <[email protected]> wrote:

> This is a straight forward conversion to the new counter_priv() wrapper.
>
> Signed-off-by: Uwe Kleine-König <[email protected]>
Looks sane and I'll assume you didn't miss any!

Acked-by: Jonathan Cameron <[email protected]>

> ---
> drivers/counter/104-quad-8.c | 58 ++++++++++++++++++------------------
> 1 file changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
> index 1cbd60aaed69..6e5286cd1d4e 100644
> --- a/drivers/counter/104-quad-8.c
> +++ b/drivers/counter/104-quad-8.c
> @@ -113,7 +113,7 @@ static int quad8_signal_read(struct counter_device *counter,
> struct counter_signal *signal,
> enum counter_signal_level *level)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> unsigned int state;
>
> /* Only Index signal levels can be read */
> @@ -131,7 +131,7 @@ static int quad8_signal_read(struct counter_device *counter,
> static int quad8_count_read(struct counter_device *counter,
> struct counter_count *count, u64 *val)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id;
> unsigned int flags;
> unsigned int borrow;
> @@ -163,7 +163,7 @@ static int quad8_count_read(struct counter_device *counter,
> static int quad8_count_write(struct counter_device *counter,
> struct counter_count *count, u64 val)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id;
> unsigned long irqflags;
> int i;
> @@ -213,7 +213,7 @@ static int quad8_function_read(struct counter_device *counter,
> struct counter_count *count,
> enum counter_function *function)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int id = count->id;
> unsigned long irqflags;
>
> @@ -243,7 +243,7 @@ static int quad8_function_write(struct counter_device *counter,
> struct counter_count *count,
> enum counter_function function)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int id = count->id;
> unsigned int *const quadrature_mode = priv->quadrature_mode + id;
> unsigned int *const scale = priv->quadrature_scale + id;
> @@ -305,7 +305,7 @@ static int quad8_direction_read(struct counter_device *counter,
> struct counter_count *count,
> enum counter_count_direction *direction)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> unsigned int ud_flag;
> const unsigned int flag_addr = priv->base + 2 * count->id + 1;
>
> @@ -335,7 +335,7 @@ static int quad8_action_read(struct counter_device *counter,
> struct counter_synapse *synapse,
> enum counter_synapse_action *action)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> int err;
> enum counter_function function;
> const size_t signal_a_id = count->synapses[0].signal->id;
> @@ -399,7 +399,7 @@ enum {
>
> static int quad8_events_configure(struct counter_device *counter)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irq_enabled = 0;
> unsigned long irqflags;
> size_t channel;
> @@ -442,7 +442,7 @@ static int quad8_events_configure(struct counter_device *counter)
> static int quad8_watch_validate(struct counter_device *counter,
> const struct counter_watch *watch)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
>
> if (watch->channel > QUAD8_NUM_COUNTERS - 1)
> return -EINVAL;
> @@ -497,7 +497,7 @@ static int quad8_index_polarity_get(struct counter_device *counter,
> struct counter_signal *signal,
> u32 *index_polarity)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
>
> *index_polarity = priv->index_polarity[channel_id];
> @@ -509,7 +509,7 @@ static int quad8_index_polarity_set(struct counter_device *counter,
> struct counter_signal *signal,
> u32 index_polarity)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
> const int base_offset = priv->base + 2 * channel_id + 1;
> unsigned long irqflags;
> @@ -538,7 +538,7 @@ static int quad8_synchronous_mode_get(struct counter_device *counter,
> struct counter_signal *signal,
> u32 *synchronous_mode)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
>
> *synchronous_mode = priv->synchronous_mode[channel_id];
> @@ -550,7 +550,7 @@ static int quad8_synchronous_mode_set(struct counter_device *counter,
> struct counter_signal *signal,
> u32 synchronous_mode)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
> const int base_offset = priv->base + 2 * channel_id + 1;
> unsigned long irqflags;
> @@ -589,7 +589,7 @@ static int quad8_count_mode_read(struct counter_device *counter,
> struct counter_count *count,
> enum counter_count_mode *cnt_mode)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> /* Map 104-QUAD-8 count mode to Generic Counter count mode */
> switch (priv->count_mode[count->id]) {
> @@ -614,7 +614,7 @@ static int quad8_count_mode_write(struct counter_device *counter,
> struct counter_count *count,
> enum counter_count_mode cnt_mode)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned int count_mode;
> unsigned int mode_cfg;
> const int base_offset = priv->base + 2 * count->id + 1;
> @@ -661,7 +661,7 @@ static int quad8_count_mode_write(struct counter_device *counter,
> static int quad8_count_enable_read(struct counter_device *counter,
> struct counter_count *count, u8 *enable)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *enable = priv->ab_enable[count->id];
>
> @@ -671,7 +671,7 @@ static int quad8_count_enable_read(struct counter_device *counter,
> static int quad8_count_enable_write(struct counter_device *counter,
> struct counter_count *count, u8 enable)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id;
> unsigned long irqflags;
> unsigned int ior_cfg;
> @@ -699,7 +699,7 @@ static const char *const quad8_noise_error_states[] = {
> static int quad8_error_noise_get(struct counter_device *counter,
> struct counter_count *count, u32 *noise_error)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id + 1;
>
> *noise_error = !!(inb(base_offset) & QUAD8_FLAG_E);
> @@ -710,7 +710,7 @@ static int quad8_error_noise_get(struct counter_device *counter,
> static int quad8_count_preset_read(struct counter_device *counter,
> struct counter_count *count, u64 *preset)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *preset = priv->preset[count->id];
>
> @@ -736,7 +736,7 @@ static void quad8_preset_register_set(struct quad8 *const priv, const int id,
> static int quad8_count_preset_write(struct counter_device *counter,
> struct counter_count *count, u64 preset)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irqflags;
>
> /* Only 24-bit values are supported */
> @@ -755,7 +755,7 @@ static int quad8_count_preset_write(struct counter_device *counter,
> static int quad8_count_ceiling_read(struct counter_device *counter,
> struct counter_count *count, u64 *ceiling)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irqflags;
>
> spin_lock_irqsave(&priv->lock, irqflags);
> @@ -780,7 +780,7 @@ static int quad8_count_ceiling_read(struct counter_device *counter,
> static int quad8_count_ceiling_write(struct counter_device *counter,
> struct counter_count *count, u64 ceiling)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irqflags;
>
> /* Only 24-bit values are supported */
> @@ -807,7 +807,7 @@ static int quad8_count_preset_enable_read(struct counter_device *counter,
> struct counter_count *count,
> u8 *preset_enable)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *preset_enable = !priv->preset_enable[count->id];
>
> @@ -818,7 +818,7 @@ static int quad8_count_preset_enable_write(struct counter_device *counter,
> struct counter_count *count,
> u8 preset_enable)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id + 1;
> unsigned long irqflags;
> unsigned int ior_cfg;
> @@ -845,7 +845,7 @@ static int quad8_signal_cable_fault_read(struct counter_device *counter,
> struct counter_signal *signal,
> u8 *cable_fault)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
> unsigned long irqflags;
> bool disabled;
> @@ -875,7 +875,7 @@ static int quad8_signal_cable_fault_enable_read(struct counter_device *counter,
> struct counter_signal *signal,
> u8 *enable)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
>
> *enable = !!(priv->cable_fault_enable & BIT(channel_id));
> @@ -887,7 +887,7 @@ static int quad8_signal_cable_fault_enable_write(struct counter_device *counter,
> struct counter_signal *signal,
> u8 enable)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
> unsigned long irqflags;
> unsigned int cable_fault_enable;
> @@ -913,7 +913,7 @@ static int quad8_signal_fck_prescaler_read(struct counter_device *counter,
> struct counter_signal *signal,
> u8 *prescaler)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *prescaler = priv->fck_prescaler[signal->id / 2];
>
> @@ -924,7 +924,7 @@ static int quad8_signal_fck_prescaler_write(struct counter_device *counter,
> struct counter_signal *signal,
> u8 prescaler)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
> const int base_offset = priv->base + 2 * channel_id;
> unsigned long irqflags;


2021-12-29 07:27:48

by William Breathitt Gray

[permalink] [raw]
Subject: Re: [PATCH v2 05/23] counter: 104-quad-8: Convert to counter_priv() wrapper

On Mon, Dec 27, 2021 at 10:45:08AM +0100, Uwe Kleine-König wrote:
> This is a straight forward conversion to the new counter_priv() wrapper.
>
> Signed-off-by: Uwe Kleine-König <[email protected]>

This patch results in a minor merge conflict with commit c95cc0d95702
("counter: 104-quad-8: Fix persistent enabled events bug") in linux-next
due to context changes in quad8_events_configure() and
quad8_watch_validate(). Fixing this after a rebase is trivial so I'll
give my Ack here.

Acked-by: William Breathitt Gray <[email protected]>

> ---
> drivers/counter/104-quad-8.c | 58 ++++++++++++++++++------------------
> 1 file changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
> index 1cbd60aaed69..6e5286cd1d4e 100644
> --- a/drivers/counter/104-quad-8.c
> +++ b/drivers/counter/104-quad-8.c
> @@ -113,7 +113,7 @@ static int quad8_signal_read(struct counter_device *counter,
> struct counter_signal *signal,
> enum counter_signal_level *level)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> unsigned int state;
>
> /* Only Index signal levels can be read */
> @@ -131,7 +131,7 @@ static int quad8_signal_read(struct counter_device *counter,
> static int quad8_count_read(struct counter_device *counter,
> struct counter_count *count, u64 *val)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id;
> unsigned int flags;
> unsigned int borrow;
> @@ -163,7 +163,7 @@ static int quad8_count_read(struct counter_device *counter,
> static int quad8_count_write(struct counter_device *counter,
> struct counter_count *count, u64 val)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id;
> unsigned long irqflags;
> int i;
> @@ -213,7 +213,7 @@ static int quad8_function_read(struct counter_device *counter,
> struct counter_count *count,
> enum counter_function *function)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int id = count->id;
> unsigned long irqflags;
>
> @@ -243,7 +243,7 @@ static int quad8_function_write(struct counter_device *counter,
> struct counter_count *count,
> enum counter_function function)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int id = count->id;
> unsigned int *const quadrature_mode = priv->quadrature_mode + id;
> unsigned int *const scale = priv->quadrature_scale + id;
> @@ -305,7 +305,7 @@ static int quad8_direction_read(struct counter_device *counter,
> struct counter_count *count,
> enum counter_count_direction *direction)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> unsigned int ud_flag;
> const unsigned int flag_addr = priv->base + 2 * count->id + 1;
>
> @@ -335,7 +335,7 @@ static int quad8_action_read(struct counter_device *counter,
> struct counter_synapse *synapse,
> enum counter_synapse_action *action)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> int err;
> enum counter_function function;
> const size_t signal_a_id = count->synapses[0].signal->id;
> @@ -399,7 +399,7 @@ enum {
>
> static int quad8_events_configure(struct counter_device *counter)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irq_enabled = 0;
> unsigned long irqflags;
> size_t channel;
> @@ -442,7 +442,7 @@ static int quad8_events_configure(struct counter_device *counter)
> static int quad8_watch_validate(struct counter_device *counter,
> const struct counter_watch *watch)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
>
> if (watch->channel > QUAD8_NUM_COUNTERS - 1)
> return -EINVAL;
> @@ -497,7 +497,7 @@ static int quad8_index_polarity_get(struct counter_device *counter,
> struct counter_signal *signal,
> u32 *index_polarity)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
>
> *index_polarity = priv->index_polarity[channel_id];
> @@ -509,7 +509,7 @@ static int quad8_index_polarity_set(struct counter_device *counter,
> struct counter_signal *signal,
> u32 index_polarity)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
> const int base_offset = priv->base + 2 * channel_id + 1;
> unsigned long irqflags;
> @@ -538,7 +538,7 @@ static int quad8_synchronous_mode_get(struct counter_device *counter,
> struct counter_signal *signal,
> u32 *synchronous_mode)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
>
> *synchronous_mode = priv->synchronous_mode[channel_id];
> @@ -550,7 +550,7 @@ static int quad8_synchronous_mode_set(struct counter_device *counter,
> struct counter_signal *signal,
> u32 synchronous_mode)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id - 16;
> const int base_offset = priv->base + 2 * channel_id + 1;
> unsigned long irqflags;
> @@ -589,7 +589,7 @@ static int quad8_count_mode_read(struct counter_device *counter,
> struct counter_count *count,
> enum counter_count_mode *cnt_mode)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> /* Map 104-QUAD-8 count mode to Generic Counter count mode */
> switch (priv->count_mode[count->id]) {
> @@ -614,7 +614,7 @@ static int quad8_count_mode_write(struct counter_device *counter,
> struct counter_count *count,
> enum counter_count_mode cnt_mode)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned int count_mode;
> unsigned int mode_cfg;
> const int base_offset = priv->base + 2 * count->id + 1;
> @@ -661,7 +661,7 @@ static int quad8_count_mode_write(struct counter_device *counter,
> static int quad8_count_enable_read(struct counter_device *counter,
> struct counter_count *count, u8 *enable)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *enable = priv->ab_enable[count->id];
>
> @@ -671,7 +671,7 @@ static int quad8_count_enable_read(struct counter_device *counter,
> static int quad8_count_enable_write(struct counter_device *counter,
> struct counter_count *count, u8 enable)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id;
> unsigned long irqflags;
> unsigned int ior_cfg;
> @@ -699,7 +699,7 @@ static const char *const quad8_noise_error_states[] = {
> static int quad8_error_noise_get(struct counter_device *counter,
> struct counter_count *count, u32 *noise_error)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id + 1;
>
> *noise_error = !!(inb(base_offset) & QUAD8_FLAG_E);
> @@ -710,7 +710,7 @@ static int quad8_error_noise_get(struct counter_device *counter,
> static int quad8_count_preset_read(struct counter_device *counter,
> struct counter_count *count, u64 *preset)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *preset = priv->preset[count->id];
>
> @@ -736,7 +736,7 @@ static void quad8_preset_register_set(struct quad8 *const priv, const int id,
> static int quad8_count_preset_write(struct counter_device *counter,
> struct counter_count *count, u64 preset)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irqflags;
>
> /* Only 24-bit values are supported */
> @@ -755,7 +755,7 @@ static int quad8_count_preset_write(struct counter_device *counter,
> static int quad8_count_ceiling_read(struct counter_device *counter,
> struct counter_count *count, u64 *ceiling)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irqflags;
>
> spin_lock_irqsave(&priv->lock, irqflags);
> @@ -780,7 +780,7 @@ static int quad8_count_ceiling_read(struct counter_device *counter,
> static int quad8_count_ceiling_write(struct counter_device *counter,
> struct counter_count *count, u64 ceiling)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> unsigned long irqflags;
>
> /* Only 24-bit values are supported */
> @@ -807,7 +807,7 @@ static int quad8_count_preset_enable_read(struct counter_device *counter,
> struct counter_count *count,
> u8 *preset_enable)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *preset_enable = !priv->preset_enable[count->id];
>
> @@ -818,7 +818,7 @@ static int quad8_count_preset_enable_write(struct counter_device *counter,
> struct counter_count *count,
> u8 preset_enable)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const int base_offset = priv->base + 2 * count->id + 1;
> unsigned long irqflags;
> unsigned int ior_cfg;
> @@ -845,7 +845,7 @@ static int quad8_signal_cable_fault_read(struct counter_device *counter,
> struct counter_signal *signal,
> u8 *cable_fault)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
> unsigned long irqflags;
> bool disabled;
> @@ -875,7 +875,7 @@ static int quad8_signal_cable_fault_enable_read(struct counter_device *counter,
> struct counter_signal *signal,
> u8 *enable)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
>
> *enable = !!(priv->cable_fault_enable & BIT(channel_id));
> @@ -887,7 +887,7 @@ static int quad8_signal_cable_fault_enable_write(struct counter_device *counter,
> struct counter_signal *signal,
> u8 enable)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
> unsigned long irqflags;
> unsigned int cable_fault_enable;
> @@ -913,7 +913,7 @@ static int quad8_signal_fck_prescaler_read(struct counter_device *counter,
> struct counter_signal *signal,
> u8 *prescaler)
> {
> - const struct quad8 *const priv = counter->priv;
> + const struct quad8 *const priv = counter_priv(counter);
>
> *prescaler = priv->fck_prescaler[signal->id / 2];
>
> @@ -924,7 +924,7 @@ static int quad8_signal_fck_prescaler_write(struct counter_device *counter,
> struct counter_signal *signal,
> u8 prescaler)
> {
> - struct quad8 *const priv = counter->priv;
> + struct quad8 *const priv = counter_priv(counter);
> const size_t channel_id = signal->id / 2;
> const int base_offset = priv->base + 2 * channel_id;
> unsigned long irqflags;
> --
> 2.33.0
>


Attachments:
(No filename) (11.80 kB)
signature.asc (833.00 B)
Download all attachments

2021-12-29 11:11:42

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH v2 05/23] counter: 104-quad-8: Convert to counter_priv() wrapper

On Tue, Dec 28, 2021 at 06:02:24PM +0000, Jonathan Cameron wrote:
> On Mon, 27 Dec 2021 10:45:08 +0100
> Uwe Kleine-K?nig <[email protected]> wrote:
>
> > This is a straight forward conversion to the new counter_priv() wrapper.
> >
> > Signed-off-by: Uwe Kleine-K?nig <[email protected]>
>
> Looks sane and I'll assume you didn't miss any!

I assume so, too. At least it still compiles after I dropped priv from
struct counter_device :-)

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (648.00 B)
signature.asc (488.00 B)
Download all attachments

2021-12-29 11:15:32

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH v2 05/23] counter: 104-quad-8: Convert to counter_priv() wrapper

Hello William,

On Wed, Dec 29, 2021 at 04:27:33PM +0900, William Breathitt Gray wrote:
> On Mon, Dec 27, 2021 at 10:45:08AM +0100, Uwe Kleine-K?nig wrote:
> > This is a straight forward conversion to the new counter_priv() wrapper.
> >
> > Signed-off-by: Uwe Kleine-K?nig <[email protected]>
>
> This patch results in a minor merge conflict with commit c95cc0d95702
> ("counter: 104-quad-8: Fix persistent enabled events bug") in linux-next
> due to context changes in quad8_events_configure() and
> quad8_watch_validate(). Fixing this after a rebase is trivial so I'll
> give my Ack here.

this raises the question how this patch set is to be merged. My
expectaion up to now was, that this goes via you, so the merge conflict
shouldn't be an issue? What is your expectation who will pick up this
series?

Would a PR helpful, or will the series be picked up from the mailing
list?

I'm about to prepare a v3 adding all the review tags and fixing the few
issues that were pointed out.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (1.15 kB)
signature.asc (488.00 B)
Download all attachments

2021-12-29 22:41:08

by William Breathitt Gray

[permalink] [raw]
Subject: Re: [PATCH v2 05/23] counter: 104-quad-8: Convert to counter_priv() wrapper

On Wed, Dec 29, 2021 at 12:15:22PM +0100, Uwe Kleine-König wrote:
> Hello William,
>
> On Wed, Dec 29, 2021 at 04:27:33PM +0900, William Breathitt Gray wrote:
> > On Mon, Dec 27, 2021 at 10:45:08AM +0100, Uwe Kleine-König wrote:
> > > This is a straight forward conversion to the new counter_priv() wrapper.
> > >
> > > Signed-off-by: Uwe Kleine-König <[email protected]>
> >
> > This patch results in a minor merge conflict with commit c95cc0d95702
> > ("counter: 104-quad-8: Fix persistent enabled events bug") in linux-next
> > due to context changes in quad8_events_configure() and
> > quad8_watch_validate(). Fixing this after a rebase is trivial so I'll
> > give my Ack here.
>
> this raises the question how this patch set is to be merged. My
> expectaion up to now was, that this goes via you, so the merge conflict
> shouldn't be an issue? What is your expectation who will pick up this
> series?
>
> Would a PR helpful, or will the series be picked up from the mailing
> list?
>
> I'm about to prepare a v3 adding all the review tags and fixing the few
> issues that were pointed out.
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | https://www.pengutronix.de/ |

If Greg or Jonathan don't pick this series up from the mailing list
here, I can merge it to my personal tree and then submit it in the next
cycle with any other Counter subsystem changes that come in along the
way.

William Breathitt Gray


Attachments:
(No filename) (1.51 kB)
signature.asc (833.00 B)
Download all attachments