[PATCH v3 0/6] gpio: Implement and utilize register structures for ISA drivers

William Breathitt Gray posted 6 patches 3 years, 9 months ago
There is a newer version of this series
MAINTAINERS                     |   6 +
drivers/gpio/Kconfig            |  13 ++
drivers/gpio/Makefile           |   1 +
drivers/gpio/gpio-104-dio-48e.c | 248 ++++++++-------------------
drivers/gpio/gpio-104-idi-48.c  | 141 +++++++--------
drivers/gpio/gpio-104-idio-16.c |  58 +++++--
drivers/gpio/gpio-gpio-mm.c     | 202 +++++-----------------
drivers/gpio/gpio-i8255.c       | 292 ++++++++++++++++++++++++++++++++
drivers/gpio/gpio-i8255.h       |  47 +++++
drivers/gpio/gpio-ws16c48.c     | 119 +++++++++----
10 files changed, 657 insertions(+), 470 deletions(-)
create mode 100644 drivers/gpio/gpio-i8255.c
create mode 100644 drivers/gpio/gpio-i8255.h
[PATCH v3 0/6] gpio: Implement and utilize register structures for ISA drivers
Posted by William Breathitt Gray 3 years, 9 months ago
Changes in v3:
 - Updated contact information in MAINTAINERS
 - Added help text for GPIO_I8255 Kconfig option
 - Move include/linux/gpio/i8255.h to drivers/gpio/gpio-i8255.h
 - Include "gpio-i8255.h" instead of <linux/gpio/i8255.h>
 - Include linux/types.h instead of linux/compiler_types.h
 - Add underscores for *PORTC_LOWER* and *PORTC_UPPER* defines
 - Move (offset % 8) expression to a port_offset const above the io_port
   const in i8255_direction_mask(); this should help optimize assembly
   instructions on some architectures
 - Implement an opaque i8255_state struct to organize and access i8255
   device states; this replaces the control_state array passed to
   various i8255 library functions in previous patchsets
 - Implement and provide a i8255_state_init() function to initialize the
   i8255_state struct for a consumer
 - Use a spinlock within i8255 library functions to protect access to
   i8255 states and synchronize I/O operations; a spinlock is used so
   that these functions may be used within an interrupt context
 - Export the i8255 library symbols within a new I8255 namespace
 - Update the 104-dio-48e, 104-idi-48, gpio-mm drivers to use the new
   i8255_state struct and I8255 namespace

The PC104/ISA drivers were updated to use I/O memory accessor calls such
as ioread8()/iowrite8() in a previous patch series [0]. This
patchset is a continuation of the effort to improve the code readability
and reduce magic numbers by implementing and utilizing named register
data structures.

One of the benefits is that we can now observe more easily similarities
in devices that share similar interfaces; such as the i8255 interfaces
used by the 104-DIO-48E, 104-IDI-48, and GPIO-MM drivers -- as well as
the similar interface used by the 104-IDIO-16 and PCI-IDIO-16 drivers.

A new module supporting the Intel 8255 interface is introduced to
consolidate the common code found among the 104-DIO-48E, 104-IDI-48, and
GPIO-MM drivers.

[0] https://lore.kernel.org/all/cover.1652201921.git.william.gray@linaro.org/

William Breathitt Gray (6):
  gpio: ws16c48: Implement and utilize register structures
  gpio: 104-idio-16: Implement and utilize register structures
  gpio: i8255: Introduce the Intel 8255 interface library module
  gpio: 104-dio-48e: Implement and utilize register structures
  gpio: 104-idi-48: Implement and utilize register structures
  gpio: gpio-mm: Implement and utilize register structures

 MAINTAINERS                     |   6 +
 drivers/gpio/Kconfig            |  13 ++
 drivers/gpio/Makefile           |   1 +
 drivers/gpio/gpio-104-dio-48e.c | 248 ++++++++-------------------
 drivers/gpio/gpio-104-idi-48.c  | 141 +++++++--------
 drivers/gpio/gpio-104-idio-16.c |  58 +++++--
 drivers/gpio/gpio-gpio-mm.c     | 202 +++++-----------------
 drivers/gpio/gpio-i8255.c       | 292 ++++++++++++++++++++++++++++++++
 drivers/gpio/gpio-i8255.h       |  47 +++++
 drivers/gpio/gpio-ws16c48.c     | 119 +++++++++----
 10 files changed, 657 insertions(+), 470 deletions(-)
 create mode 100644 drivers/gpio/gpio-i8255.c
 create mode 100644 drivers/gpio/gpio-i8255.h


base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
2.36.1
Re: [PATCH v3 0/6] gpio: Implement and utilize register structures for ISA drivers
Posted by Linus Walleij 3 years, 9 months ago
On Mon, Jul 18, 2022 at 10:56 PM William Breathitt Gray
<william.gray@linaro.org> wrote:

> Changes in v3:

I'm happy with v3 from my POV, especially if also Andy's comments
are also addressed in the next iteration.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Re: [PATCH v3 0/6] gpio: Implement and utilize register structures for ISA drivers
Posted by Bartosz Golaszewski 3 years, 9 months ago
On Mon, Jul 18, 2022 at 10:56 PM William Breathitt Gray
<william.gray@linaro.org> wrote:
>
> Changes in v3:
>  - Updated contact information in MAINTAINERS
>  - Added help text for GPIO_I8255 Kconfig option
>  - Move include/linux/gpio/i8255.h to drivers/gpio/gpio-i8255.h
>  - Include "gpio-i8255.h" instead of <linux/gpio/i8255.h>
>  - Include linux/types.h instead of linux/compiler_types.h
>  - Add underscores for *PORTC_LOWER* and *PORTC_UPPER* defines
>  - Move (offset % 8) expression to a port_offset const above the io_port
>    const in i8255_direction_mask(); this should help optimize assembly
>    instructions on some architectures
>  - Implement an opaque i8255_state struct to organize and access i8255
>    device states; this replaces the control_state array passed to
>    various i8255 library functions in previous patchsets
>  - Implement and provide a i8255_state_init() function to initialize the
>    i8255_state struct for a consumer
>  - Use a spinlock within i8255 library functions to protect access to
>    i8255 states and synchronize I/O operations; a spinlock is used so
>    that these functions may be used within an interrupt context
>  - Export the i8255 library symbols within a new I8255 namespace
>  - Update the 104-dio-48e, 104-idi-48, gpio-mm drivers to use the new
>    i8255_state struct and I8255 namespace
>
> The PC104/ISA drivers were updated to use I/O memory accessor calls such
> as ioread8()/iowrite8() in a previous patch series [0]. This
> patchset is a continuation of the effort to improve the code readability
> and reduce magic numbers by implementing and utilizing named register
> data structures.
>
> One of the benefits is that we can now observe more easily similarities
> in devices that share similar interfaces; such as the i8255 interfaces
> used by the 104-DIO-48E, 104-IDI-48, and GPIO-MM drivers -- as well as
> the similar interface used by the 104-IDIO-16 and PCI-IDIO-16 drivers.
>
> A new module supporting the Intel 8255 interface is introduced to
> consolidate the common code found among the 104-DIO-48E, 104-IDI-48, and
> GPIO-MM drivers.
>
> [0] https://lore.kernel.org/all/cover.1652201921.git.william.gray@linaro.org/
>
> William Breathitt Gray (6):
>   gpio: ws16c48: Implement and utilize register structures
>   gpio: 104-idio-16: Implement and utilize register structures
>   gpio: i8255: Introduce the Intel 8255 interface library module
>   gpio: 104-dio-48e: Implement and utilize register structures
>   gpio: 104-idi-48: Implement and utilize register structures
>   gpio: gpio-mm: Implement and utilize register structures
>

Hey William!

Are you planning to submit a fourth version anytime soon? I am willing
to take it for the next merge window if it arrives soon - like
tomorrow at the latest.

Bart
Re: [PATCH v3 0/6] gpio: Implement and utilize register structures for ISA drivers
Posted by William Breathitt Gray 3 years, 9 months ago
On Tue, Jul 19, 2022 at 10:09:33AM +0200, Bartosz Golaszewski wrote:
> On Mon, Jul 18, 2022 at 10:56 PM William Breathitt Gray
> <william.gray@linaro.org> wrote:
> >
> > Changes in v3:
> >  - Updated contact information in MAINTAINERS
> >  - Added help text for GPIO_I8255 Kconfig option
> >  - Move include/linux/gpio/i8255.h to drivers/gpio/gpio-i8255.h
> >  - Include "gpio-i8255.h" instead of <linux/gpio/i8255.h>
> >  - Include linux/types.h instead of linux/compiler_types.h
> >  - Add underscores for *PORTC_LOWER* and *PORTC_UPPER* defines
> >  - Move (offset % 8) expression to a port_offset const above the io_port
> >    const in i8255_direction_mask(); this should help optimize assembly
> >    instructions on some architectures
> >  - Implement an opaque i8255_state struct to organize and access i8255
> >    device states; this replaces the control_state array passed to
> >    various i8255 library functions in previous patchsets
> >  - Implement and provide a i8255_state_init() function to initialize the
> >    i8255_state struct for a consumer
> >  - Use a spinlock within i8255 library functions to protect access to
> >    i8255 states and synchronize I/O operations; a spinlock is used so
> >    that these functions may be used within an interrupt context
> >  - Export the i8255 library symbols within a new I8255 namespace
> >  - Update the 104-dio-48e, 104-idi-48, gpio-mm drivers to use the new
> >    i8255_state struct and I8255 namespace
> >
> > The PC104/ISA drivers were updated to use I/O memory accessor calls such
> > as ioread8()/iowrite8() in a previous patch series [0]. This
> > patchset is a continuation of the effort to improve the code readability
> > and reduce magic numbers by implementing and utilizing named register
> > data structures.
> >
> > One of the benefits is that we can now observe more easily similarities
> > in devices that share similar interfaces; such as the i8255 interfaces
> > used by the 104-DIO-48E, 104-IDI-48, and GPIO-MM drivers -- as well as
> > the similar interface used by the 104-IDIO-16 and PCI-IDIO-16 drivers.
> >
> > A new module supporting the Intel 8255 interface is introduced to
> > consolidate the common code found among the 104-DIO-48E, 104-IDI-48, and
> > GPIO-MM drivers.
> >
> > [0] https://lore.kernel.org/all/cover.1652201921.git.william.gray@linaro.org/
> >
> > William Breathitt Gray (6):
> >   gpio: ws16c48: Implement and utilize register structures
> >   gpio: 104-idio-16: Implement and utilize register structures
> >   gpio: i8255: Introduce the Intel 8255 interface library module
> >   gpio: 104-dio-48e: Implement and utilize register structures
> >   gpio: 104-idi-48: Implement and utilize register structures
> >   gpio: gpio-mm: Implement and utilize register structures
> >
> 
> Hey William!
> 
> Are you planning to submit a fourth version anytime soon? I am willing
> to take it for the next merge window if it arrives soon - like
> tomorrow at the latest.
> 
> Bart

Hi Bart,

I'm incorporating Andy's comments for v4, and I expect it should be
ready later today for you to pick up.

Thanks,

William Breathitt Gray