Skip to contentSkip to conversation

iio: addac: stx104: Migrate to the regmap API

PATCH Superseded William Breathitt Gray 2 participants 3 messages Mar 19, 2023 – Mar 20, 2023

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: addac: stx104: Migrate to the regmap API

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.

---
 drivers/iio/addac/Kconfig  |   2 +
 drivers/iio/addac/stx104.c | 422 ++++++++++++++++++++-----------------
 2 files changed, 231 insertions(+), 193 deletions(-)
drivers/iio/addac/Kconfig +2 -0
index 2843fcb70e24..877f9124803c 100644
@@ -35,7 +35,9 @@ config STX104
 	tristate "Apex Embedded Systems STX104 driver"
 	depends on PC104 && X86
 	select ISA_BUS_API
+	select REGMAP_MMIO
 	select GPIOLIB
+	select GPIO_REGMAP
 	help
 	  Say yes here to build support for the Apex Embedded Systems STX104
 	  integrated analog PC/104 card.
drivers/iio/addac/stx104.c +229 -193

563 lines not on this page · raw message

base-commit: 46e33707fe95a21aa9896bded0be97285b779509

Signature · 1 line
2.39.2
#1 lore raw
Quoted 3 lines · William Breathitt Gray

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.

...

Quoted 2 lines

-/**
- * struct stx104_iio - IIO device private data structure

I believe this...

Quoted 5 lines

- * @chan_out_states: channels' output states
- * @reg: I/O address offset for the device registers
- */

-struct stx104_iio {

...and this can be left here. With that the diff won't be too disrupted.

(You are using only pointers to the generic data types in the struct
definition, that's why its location can be almost anywhere before the first its real user.)

Quoted 2 lines
drivers/iio/addac/stx104.c +0 -2
-	unsigned int chan_out_states[STX104_NUM_OUT_CHAN];
-	struct stx104_reg __iomem *reg;

...

Quoted 4 lines
drivers/iio/addac/stx104.c +3 -0
+struct stx104_iio {
+	struct regmap *aio_data_map;
+	struct regmap *aio_ctl_map;
 };
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 12 lines · Andy Shevchenko
Quoted 3 lines · William Breathitt Gray

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.

...

Quoted 2 lines

-/**
- * struct stx104_iio - IIO device private data structure

I believe this...

Quoted 7 lines
Quoted 5 lines

- * @chan_out_states: channels' output states
- * @reg: I/O address offset for the device registers
- */

-struct stx104_iio {

...and this can be left here. With that the diff won't be too disrupted.

You're right Andy, I'll adjust this in v2 so the diff becomes clearer (along with some bitfield API adjustments).

William Breathitt Gray