public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] i2c: Handle HAS_IOPORT dependencies
@ 2024-04-05 10:10 Niklas Schnelle
  2024-04-05 10:10 ` [PATCH v2 1/1] i2c: add " Niklas Schnelle
  2024-04-06 19:49 ` [PATCH v2 0/1] i2c: Handle " Andi Shyti
  0 siblings, 2 replies; 6+ messages in thread
From: Niklas Schnelle @ 2024-04-05 10:10 UTC (permalink / raw)
  To: Andi Shyti, Wolfram Sang
  Cc: linux-i2c, Arnd Bergmann, Heiko Carstens, linux-kernel,
	Niklas Schnelle

Hi,

This is a follow up in my ongoing effort of making inb()/outb() and
similar I/O port accessors compile-time optional. Previously I sent this
as a treewide series titled "treewide: Remove I/O port accessors for
HAS_IOPORT=n" with the latest being its 5th version[0]. With a significant
subset of patches merged I've changed over to per-subsystem series. These
series are stand alone and should be merged via the relevant tree such
that with all subsystems complete we can follow this up with the final
patch that will make the I/O port accessors compile-time optional.

The current state of the full series with changes to the remaining subsystems
and the aforementioned final patch can be found for your convenience on my
git.kernel.org tree in the has_ioport branch[1]. As for compile-time vs runtime
see Linus' reply to my first attempt[2].

Thanks,
Niklas

[0] https://lore.kernel.org/all/20230522105049.1467313-1-schnelle@linux.ibm.com/
[1] https://git.kernel.org/pub/scm/linux/kernel/git/niks/linux.git/log/?h=has_ioport
[2] https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/

Changes since v1:
- Removed HAS_IOPORT dependency for I2C_PARPORT as it could be used with MMIO
  based parallel port driver

Niklas Schnelle (1):
  i2c: add HAS_IOPORT dependencies

 drivers/i2c/busses/Kconfig | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/1] i2c: add HAS_IOPORT dependencies
  2024-04-05 10:10 [PATCH v2 0/1] i2c: Handle HAS_IOPORT dependencies Niklas Schnelle
@ 2024-04-05 10:10 ` Niklas Schnelle
  2024-04-05 10:32   ` Wolfram Sang
  2024-04-08  8:50   ` Geert Uytterhoeven
  2024-04-06 19:49 ` [PATCH v2 0/1] i2c: Handle " Andi Shyti
  1 sibling, 2 replies; 6+ messages in thread
From: Niklas Schnelle @ 2024-04-05 10:10 UTC (permalink / raw)
  To: Andi Shyti, Wolfram Sang
  Cc: linux-i2c, Arnd Bergmann, Heiko Carstens, linux-kernel,
	Niklas Schnelle

In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
compile time. We thus need to add HAS_IOPORT as dependency for those
drivers using them.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Note: This patch does not depend any not-yet-mainline HAS_IOPORT changes
and may be merged via subsystem specific trees at your earliest
convenience.

v1 - v2:
- Removed HAS_IOPORT dependency for I2C_PARPORT

 drivers/i2c/busses/Kconfig | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 97989c914260..5f4dc31ed142 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -18,7 +18,7 @@ config I2C_CCGX_UCSI
 
 config I2C_ALI1535
 	tristate "ALI 1535"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the SMB
 	  Host controller on Acer Labs Inc. (ALI) M1535 South Bridges.  The SMB
@@ -30,7 +30,7 @@ config I2C_ALI1535
 
 config I2C_ALI1563
 	tristate "ALI 1563"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the SMB
 	  Host controller on Acer Labs Inc. (ALI) M1563 South Bridges.  The SMB
@@ -42,7 +42,7 @@ config I2C_ALI1563
 
 config I2C_ALI15X3
 	tristate "ALI 15x3"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  Acer Labs Inc. (ALI) M1514 and M1543 motherboard I2C interfaces.
@@ -52,7 +52,7 @@ config I2C_ALI15X3
 
 config I2C_AMD756
 	tristate "AMD 756/766/768/8111 and nVidia nForce"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the AMD
 	  756/766/768 mainboard I2C interfaces.  The driver also includes
@@ -77,7 +77,7 @@ config I2C_AMD756_S4882
 
 config I2C_AMD8111
 	tristate "AMD 8111"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  second (SMBus 2.0) AMD 8111 mainboard I2C interface.
@@ -107,7 +107,7 @@ config I2C_HIX5HD2
 
 config I2C_I801
 	tristate "Intel 82801 (ICH/PCH)"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select P2SB if X86
 	select CHECK_SIGNATURE if X86 && DMI
 	select I2C_SMBUS
@@ -165,7 +165,7 @@ config I2C_I801
 
 config I2C_ISCH
 	tristate "Intel SCH SMBus 1.0"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select LPC_SCH
 	help
 	  Say Y here if you want to use SMBus controller on the Intel SCH
@@ -186,7 +186,7 @@ config I2C_ISMT
 
 config I2C_PIIX4
 	tristate "Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC)"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  PIIX4 family of mainboard I2C interfaces.  Specifically, the following
@@ -232,7 +232,7 @@ config I2C_CHT_WC
 
 config I2C_NFORCE2
 	tristate "Nvidia nForce2, nForce3 and nForce4"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the Nvidia
 	  nForce2, nForce3 and nForce4 families of mainboard I2C interfaces.
@@ -265,7 +265,7 @@ config I2C_NVIDIA_GPU
 
 config I2C_SIS5595
 	tristate "SiS 5595"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  SiS5595 SMBus (a subset of I2C) interface.
@@ -275,7 +275,7 @@ config I2C_SIS5595
 
 config I2C_SIS630
 	tristate "SiS 630/730/964"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  SiS630, SiS730 and SiS964 SMBus (a subset of I2C) interface.
@@ -285,7 +285,7 @@ config I2C_SIS630
 
 config I2C_SIS96X
 	tristate "SiS 96x"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the SiS
 	  96x SMBus (a subset of I2C) interfaces.  Specifically, the following
@@ -303,7 +303,7 @@ config I2C_SIS96X
 
 config I2C_VIA
 	tristate "VIA VT82C586B"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the VIA
@@ -314,7 +314,7 @@ config I2C_VIA
 
 config I2C_VIAPRO
 	tristate "VIA VT82C596/82C686/82xx and CX700/VX8xx/VX900"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the VIA
 	  VT82C596 and later SMBus interface.  Specifically, the following
@@ -885,6 +885,7 @@ config I2C_NPCM
 
 config I2C_OCORES
 	tristate "OpenCores I2C Controller"
+	depends on HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  OpenCores I2C controller. For details see
@@ -1397,6 +1398,7 @@ config I2C_ICY
 config I2C_MLXCPLD
 	tristate "Mellanox I2C driver"
 	depends on X86_64 || (ARM64 && ACPI) || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	  This exposes the Mellanox platform I2C busses to the linux I2C layer
 	  for X86 and ARM64/ACPI based systems.
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] i2c: add HAS_IOPORT dependencies
  2024-04-05 10:10 ` [PATCH v2 1/1] i2c: add " Niklas Schnelle
@ 2024-04-05 10:32   ` Wolfram Sang
  2024-04-08  8:50   ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2024-04-05 10:32 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Andi Shyti, linux-i2c, Arnd Bergmann, Heiko Carstens,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Fri, Apr 05, 2024 at 12:10:09PM +0200, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
> compile time. We thus need to add HAS_IOPORT as dependency for those
> drivers using them.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/1] i2c: Handle HAS_IOPORT dependencies
  2024-04-05 10:10 [PATCH v2 0/1] i2c: Handle HAS_IOPORT dependencies Niklas Schnelle
  2024-04-05 10:10 ` [PATCH v2 1/1] i2c: add " Niklas Schnelle
@ 2024-04-06 19:49 ` Andi Shyti
  1 sibling, 0 replies; 6+ messages in thread
From: Andi Shyti @ 2024-04-06 19:49 UTC (permalink / raw)
  To: Wolfram Sang, Niklas Schnelle
  Cc: linux-i2c, Arnd Bergmann, Heiko Carstens, linux-kernel

Hi

On Fri, 05 Apr 2024 12:10:08 +0200, Niklas Schnelle wrote:
> This is a follow up in my ongoing effort of making inb()/outb() and
> similar I/O port accessors compile-time optional. Previously I sent this
> as a treewide series titled "treewide: Remove I/O port accessors for
> HAS_IOPORT=n" with the latest being its 5th version[0]. With a significant
> subset of patches merged I've changed over to per-subsystem series. These
> series are stand alone and should be merged via the relevant tree such
> that with all subsystems complete we can follow this up with the final
> patch that will make the I/O port accessors compile-time optional.
> 
> [...]

Applied to i2c/i2c-host on

git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Thank you,
Andi

Patches applied
===============
[1/1] i2c: add HAS_IOPORT dependencies
      commit: 53f44c1005ba64215ab6c3c5bbbcaef0870ae7d6


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] i2c: add HAS_IOPORT dependencies
  2024-04-05 10:10 ` [PATCH v2 1/1] i2c: add " Niklas Schnelle
  2024-04-05 10:32   ` Wolfram Sang
@ 2024-04-08  8:50   ` Geert Uytterhoeven
  2024-04-08  9:30     ` Arnd Bergmann
  1 sibling, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2024-04-08  8:50 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Andi Shyti, Wolfram Sang, linux-i2c, Arnd Bergmann,
	Heiko Carstens, linux-kernel

Hi Niklas,

On Fri, Apr 5, 2024 at 12:10 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
> In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
> compile time. We thus need to add HAS_IOPORT as dependency for those
> drivers using them.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> Note: This patch does not depend any not-yet-mainline HAS_IOPORT changes
> and may be merged via subsystem specific trees at your earliest
> convenience.
>
> v1 - v2:
> - Removed HAS_IOPORT dependency for I2C_PARPORT

Thanks for your patch, which is now commit 53f44c1005ba6421 ("i2c: add
HAS_IOPORT dependencies") in i2c-host/i2c/i2c-host (next-20240408).

> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -885,6 +885,7 @@ config I2C_NPCM
>
>  config I2C_OCORES
>         tristate "OpenCores I2C Controller"
> +       depends on HAS_IOPORT

This restricts the driver to platforms that select HAS_IOPORT, while
the driver supports both MMIO and IOPORT.

At least for
arch/xtensa/configs/audio_kc705_defconfig:CONFIG_I2C_OCORES=y
the HAS_IOPORT dependency does not seem to be met.

I think the IOPORT part in i2c-ocores.c should be protected by
"#ifdef HAS_IOPORT" first, so the driver can still be built on platforms
that do not support IOPORT.

>         help
>           If you say yes to this option, support will be included for the
>           OpenCores I2C controller. For details see

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] i2c: add HAS_IOPORT dependencies
  2024-04-08  8:50   ` Geert Uytterhoeven
@ 2024-04-08  9:30     ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2024-04-08  9:30 UTC (permalink / raw)
  To: Geert Uytterhoeven, Niklas Schnelle
  Cc: Andi Shyti, Wolfram Sang, linux-i2c, Heiko Carstens, linux-kernel

On Mon, Apr 8, 2024, at 10:50, Geert Uytterhoeven wrote:
> Hi Niklas,
>
> On Fri, Apr 5, 2024 at 12:10 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
>> In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
>> compile time. We thus need to add HAS_IOPORT as dependency for those
>> drivers using them.
>>
>> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
>> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
>> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
>> ---
>> Note: This patch does not depend any not-yet-mainline HAS_IOPORT changes
>> and may be merged via subsystem specific trees at your earliest
>> convenience.
>>
>> v1 - v2:
>> - Removed HAS_IOPORT dependency for I2C_PARPORT
>
> Thanks for your patch, which is now commit 53f44c1005ba6421 ("i2c: add
> HAS_IOPORT dependencies") in i2c-host/i2c/i2c-host (next-20240408).
>
>> --- a/drivers/i2c/busses/Kconfig
>> +++ b/drivers/i2c/busses/Kconfig
>> @@ -885,6 +885,7 @@ config I2C_NPCM
>>
>>  config I2C_OCORES
>>         tristate "OpenCores I2C Controller"
>> +       depends on HAS_IOPORT
>
> This restricts the driver to platforms that select HAS_IOPORT, while
> the driver supports both MMIO and IOPORT.
>
> At least for
> arch/xtensa/configs/audio_kc705_defconfig:CONFIG_I2C_OCORES=y
> the HAS_IOPORT dependency does not seem to be met.
>
> I think the IOPORT part in i2c-ocores.c should be protected by
> "#ifdef HAS_IOPORT" first, so the driver can still be built on platforms
> that do not support IOPORT.

Good catch! I sent a fixup for this driver now.

    Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-08  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 10:10 [PATCH v2 0/1] i2c: Handle HAS_IOPORT dependencies Niklas Schnelle
2024-04-05 10:10 ` [PATCH v2 1/1] i2c: add " Niklas Schnelle
2024-04-05 10:32   ` Wolfram Sang
2024-04-08  8:50   ` Geert Uytterhoeven
2024-04-08  9:30     ` Arnd Bergmann
2024-04-06 19:49 ` [PATCH v2 0/1] i2c: Handle " Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox