diff mbox series

[v5,30/44] rtc: add HAS_IOPORT dependencies

Message ID 20230522105049.1467313-31-schnelle@linux.ibm.com (mailing list archive)
State Handled Elsewhere
Headers show
Series treewide: Remove I/O port accessors for HAS_IOPORT=n | expand

Commit Message

Niklas Schnelle May 22, 2023, 10:50 a.m. UTC
In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. 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>
---
 drivers/rtc/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Maciej W. Rozycki May 22, 2023, 1:09 p.m. UTC | #1
On Mon, 22 May 2023, Niklas Schnelle wrote:

> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 753872408615..a38a919b3f15 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -956,6 +956,7 @@ comment "Platform RTC drivers"
>  config RTC_DRV_CMOS
>  	tristate "PC-style 'CMOS'"
>  	depends on X86 || ARM || PPC || MIPS || SPARC64
> +	depends on HAS_IOPORT || MACH_DECSTATION
>  	default y if X86
>  	select RTC_MC146818_LIB
>  	help

 For the DECstation part:

Acked-by: Maciej W. Rozycki <macro@orcam.me.uk>

  Maciej
Alexandre Belloni June 6, 2023, 9:35 p.m. UTC | #2
On Mon, 22 May 2023 12:50:35 +0200, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add HAS_IOPORT as dependency for
> those drivers using them.
> 
> 

Applied, thanks!

[30/44] rtc: add HAS_IOPORT dependencies
        commit: 8bb12adb214b2d7cdad84f89db2cbab4b2908b61

Best regards,
Geert Uytterhoeven July 4, 2023, 8:06 a.m. UTC | #3
Hi Niklas,

On Mon, May 22, 2023 at 12:51 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. 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>

Thanks for your patch, which is now commit 8bb12adb214b2d7c ("rtc:
add HAS_IOPORT dependencies") upstream.

> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
>
>  config RTC_DRV_BQ4802
>         tristate "TI BQ4802"
> -       depends on HAS_IOMEM
> +       depends on HAS_IOMEM && HAS_IOPORT
>         help
>           If you say Y here you will get support for the TI
>           BQ4802 RTC chip.

This driver can use either iomem or ioport.
By adding a dependency on HAS_IOPORT, it can no longer be used
on platforms that provide HAS_IOMEM only.

Probably the driver should be refactored to make it use only
the accessors that are available.

Gr{oetje,eeting}s,

                        Geert
Arnd Bergmann July 4, 2023, 11:25 a.m. UTC | #4
On Tue, Jul 4, 2023, at 10:06, Geert Uytterhoeven wrote:
> Hi Niklas,
>
> On Mon, May 22, 2023 at 12:51 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
>> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
>> not being declared. 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>
>
> Thanks for your patch, which is now commit 8bb12adb214b2d7c ("rtc:
> add HAS_IOPORT dependencies") upstream.
>
>> --- a/drivers/rtc/Kconfig
>> +++ b/drivers/rtc/Kconfig
>> @@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
>>
>>  config RTC_DRV_BQ4802
>>         tristate "TI BQ4802"
>> -       depends on HAS_IOMEM
>> +       depends on HAS_IOMEM && HAS_IOPORT
>>         help
>>           If you say Y here you will get support for the TI
>>           BQ4802 RTC chip.
>
> This driver can use either iomem or ioport.
> By adding a dependency on HAS_IOPORT, it can no longer be used
> on platforms that provide HAS_IOMEM only.

You are correct, we could allow building this driver even
without IOPORT and make it use ioport_map() or an #ifdef.

> Probably the driver should be refactored to make it use only
> the accessors that are available.

Since the driver itself has no DT support, it looks like the
only way it can be used is from the sparc64/ultra45 wrapper,
but that architecture always provides CONFIG_IOPORT, so I
don't think it makes any difference in the end. We can change
this again if another user comes up.

It might be good to know whether the machine uses a memory or
I/O resource in its device tree.

      Arnd
Geert Uytterhoeven July 4, 2023, 12:46 p.m. UTC | #5
Hi Arnd,

On Tue, Jul 4, 2023 at 1:25 PM Arnd Bergmann <arnd@arndb.de> wrote:
> On Tue, Jul 4, 2023, at 10:06, Geert Uytterhoeven wrote:
> > On Mon, May 22, 2023 at 12:51 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
> >> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> >> not being declared. 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>
> >
> > Thanks for your patch, which is now commit 8bb12adb214b2d7c ("rtc:
> > add HAS_IOPORT dependencies") upstream.
> >
> >> --- a/drivers/rtc/Kconfig
> >> +++ b/drivers/rtc/Kconfig
> >> @@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
> >>
> >>  config RTC_DRV_BQ4802
> >>         tristate "TI BQ4802"
> >> -       depends on HAS_IOMEM
> >> +       depends on HAS_IOMEM && HAS_IOPORT
> >>         help
> >>           If you say Y here you will get support for the TI
> >>           BQ4802 RTC chip.
> >
> > This driver can use either iomem or ioport.
> > By adding a dependency on HAS_IOPORT, it can no longer be used
> > on platforms that provide HAS_IOMEM only.
>
> You are correct, we could allow building this driver even
> without IOPORT and make it use ioport_map() or an #ifdef.
>
> > Probably the driver should be refactored to make it use only
> > the accessors that are available.
>
> Since the driver itself has no DT support, it looks like the
> only way it can be used is from the sparc64/ultra45 wrapper,
> but that architecture always provides CONFIG_IOPORT, so I
> don't think it makes any difference in the end. We can change
> this again if another user comes up.

Correct, I made the same reasoning after sending my previous email...

> It might be good to know whether the machine uses a memory or
> I/O resource in its device tree.

Indeed.

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 753872408615..a38a919b3f15 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -956,6 +956,7 @@  comment "Platform RTC drivers"
 config RTC_DRV_CMOS
 	tristate "PC-style 'CMOS'"
 	depends on X86 || ARM || PPC || MIPS || SPARC64
+	depends on HAS_IOPORT || MACH_DECSTATION
 	default y if X86
 	select RTC_MC146818_LIB
 	help
@@ -976,6 +977,7 @@  config RTC_DRV_CMOS
 config RTC_DRV_ALPHA
 	bool "Alpha PC-style CMOS"
 	depends on ALPHA
+	depends on HAS_IOPORT
 	select RTC_MC146818_LIB
 	default y
 	help
@@ -1193,7 +1195,7 @@  config RTC_DRV_MSM6242
 
 config RTC_DRV_BQ4802
 	tristate "TI BQ4802"
-	depends on HAS_IOMEM
+	depends on HAS_IOMEM && HAS_IOPORT
 	help
 	  If you say Y here you will get support for the TI
 	  BQ4802 RTC chip.