Commit 1a84aaad authored by David Lechner's avatar David Lechner Committed by William Breathitt Gray

counter: ti-eqep: remove counter_priv() wrapper

The ti_eqep_count_from_counter() function is just a wrapper around
counter_priv(). counter_priv() can be used directly, so we don't need
the wrapper function. Remove it.
Signed-off-by: default avatarDavid Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240609-ti-eqep-cleanup-v1-2-9d67939c763a@baylibre.comSigned-off-by: default avatarWilliam Breathitt Gray <wbg@kernel.org>
parent bc4666be
...@@ -126,15 +126,10 @@ struct ti_eqep_cnt { ...@@ -126,15 +126,10 @@ struct ti_eqep_cnt {
struct regmap *regmap16; struct regmap *regmap16;
}; };
static struct ti_eqep_cnt *ti_eqep_count_from_counter(struct counter_device *counter)
{
return counter_priv(counter);
}
static int ti_eqep_count_read(struct counter_device *counter, static int ti_eqep_count_read(struct counter_device *counter,
struct counter_count *count, u64 *val) struct counter_count *count, u64 *val)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
u32 cnt; u32 cnt;
regmap_read(priv->regmap32, QPOSCNT, &cnt); regmap_read(priv->regmap32, QPOSCNT, &cnt);
...@@ -146,7 +141,7 @@ static int ti_eqep_count_read(struct counter_device *counter, ...@@ -146,7 +141,7 @@ static int ti_eqep_count_read(struct counter_device *counter,
static int ti_eqep_count_write(struct counter_device *counter, static int ti_eqep_count_write(struct counter_device *counter,
struct counter_count *count, u64 val) struct counter_count *count, u64 val)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
u32 max; u32 max;
regmap_read(priv->regmap32, QPOSMAX, &max); regmap_read(priv->regmap32, QPOSMAX, &max);
...@@ -160,7 +155,7 @@ static int ti_eqep_function_read(struct counter_device *counter, ...@@ -160,7 +155,7 @@ static int ti_eqep_function_read(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
enum counter_function *function) enum counter_function *function)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
u32 qdecctl; u32 qdecctl;
regmap_read(priv->regmap16, QDECCTL, &qdecctl); regmap_read(priv->regmap16, QDECCTL, &qdecctl);
...@@ -187,7 +182,7 @@ static int ti_eqep_function_write(struct counter_device *counter, ...@@ -187,7 +182,7 @@ static int ti_eqep_function_write(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
enum counter_function function) enum counter_function function)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
enum ti_eqep_count_func qsrc; enum ti_eqep_count_func qsrc;
switch (function) { switch (function) {
...@@ -217,7 +212,7 @@ static int ti_eqep_action_read(struct counter_device *counter, ...@@ -217,7 +212,7 @@ static int ti_eqep_action_read(struct counter_device *counter,
struct counter_synapse *synapse, struct counter_synapse *synapse,
enum counter_synapse_action *action) enum counter_synapse_action *action)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
enum counter_function function; enum counter_function function;
u32 qdecctl; u32 qdecctl;
int err; int err;
...@@ -326,7 +321,7 @@ static int ti_eqep_position_ceiling_read(struct counter_device *counter, ...@@ -326,7 +321,7 @@ static int ti_eqep_position_ceiling_read(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
u64 *ceiling) u64 *ceiling)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
u32 qposmax; u32 qposmax;
regmap_read(priv->regmap32, QPOSMAX, &qposmax); regmap_read(priv->regmap32, QPOSMAX, &qposmax);
...@@ -340,7 +335,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter, ...@@ -340,7 +335,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
u64 ceiling) u64 ceiling)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
if (ceiling != (u32)ceiling) if (ceiling != (u32)ceiling)
return -ERANGE; return -ERANGE;
...@@ -353,7 +348,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter, ...@@ -353,7 +348,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter,
static int ti_eqep_position_enable_read(struct counter_device *counter, static int ti_eqep_position_enable_read(struct counter_device *counter,
struct counter_count *count, u8 *enable) struct counter_count *count, u8 *enable)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
u32 qepctl; u32 qepctl;
regmap_read(priv->regmap16, QEPCTL, &qepctl); regmap_read(priv->regmap16, QEPCTL, &qepctl);
...@@ -366,7 +361,7 @@ static int ti_eqep_position_enable_read(struct counter_device *counter, ...@@ -366,7 +361,7 @@ static int ti_eqep_position_enable_read(struct counter_device *counter,
static int ti_eqep_position_enable_write(struct counter_device *counter, static int ti_eqep_position_enable_write(struct counter_device *counter,
struct counter_count *count, u8 enable) struct counter_count *count, u8 enable)
{ {
struct ti_eqep_cnt *priv = ti_eqep_count_from_counter(counter); struct ti_eqep_cnt *priv = counter_priv(counter);
regmap_write_bits(priv->regmap16, QEPCTL, QEPCTL_PHEN, enable ? -1 : 0); regmap_write_bits(priv->regmap16, QEPCTL, QEPCTL_PHEN, enable ? -1 : 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment