Re: [PATCH] counter: 104-quad-8: Migrate to the regmap API
From: Andy Shevchenko
Date: Tue Apr 11 2023 - 10:38:07 EST
On Mon, Apr 10, 2023 at 10:12:52AM -0400, William Breathitt Gray wrote:
> The regmap API supports IO port accessors so we can take advantage of
> regmap abstractions rather than handling access to the device registers
> directly in the driver.
Looking at the statistics it's a bit unfortunate that LoCs are risen,
perhaps you can add more points why regmap is better than direct IO
accessors.
...
> + int state;
state...
> + state = regmap_test_bits(priv->map, QUAD8_INDEX_INPUT_LEVELS, BIT(signal->id - 16));
> + if (state < 0)
> + return state;
...
> + int ret;
ret...
> + ret = regmap_write(priv->map, QUAD8_CONTROL(count->id),
> + SELECT_RLD | RESET_BP | TRANSFER_CNTR_TO_OL);
> + if (ret)
> + goto exit_unlock;
...
> + int err;
err...
> + err = regmap_write(priv->map, QUAD8_CONTROL(id), SELECT_RLD | RESET_BP);
> + if (err)
> + return err;
...
Maybe a bit of consistency?
...
> + int err;
> + unsigned int status;
> unsigned long irq_status;
> unsigned long channel;
> unsigned int flg_pins;
> u8 event;
Perhaps longer lines first? Hence
int ret;
to be here.
--
With Best Regards,
Andy Shevchenko