counter: Simplify the count_read and count_write callbacks

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.

Cc: Patrick Havelange <patrick.havelange@essensium.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
William Breathitt Gray
2019-10-06 16:03:09 -04:00
committed by Jonathan Cameron
parent 16922ffee1
commit d49e6ee2d6
7 changed files with 51 additions and 212 deletions

View File

@@ -93,35 +93,28 @@ struct ti_eqep_cnt {
};
static int ti_eqep_count_read(struct counter_device *counter,
struct counter_count *count,
struct counter_count_read_value *val)
struct counter_count *count, unsigned long *val)
{
struct ti_eqep_cnt *priv = counter->priv;
u32 cnt;
regmap_read(priv->regmap32, QPOSCNT, &cnt);
counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &cnt);
*val = cnt;
return 0;
}
static int ti_eqep_count_write(struct counter_device *counter,
struct counter_count *count,
struct counter_count_write_value *val)
struct counter_count *count, unsigned long val)
{
struct ti_eqep_cnt *priv = counter->priv;
u32 cnt, max;
int err;
err = counter_count_write_value_get(&cnt, COUNTER_COUNT_POSITION, val);
if (err)
return err;
u32 max;
regmap_read(priv->regmap32, QPOSMAX, &max);
if (cnt > max)
if (val > max)
return -EINVAL;
return regmap_write(priv->regmap32, QPOSCNT, cnt);
return regmap_write(priv->regmap32, QPOSCNT, val);
}
static int ti_eqep_function_get(struct counter_device *counter,