diff mbox series

macintosh: fix via-pmu and via-cuda build errors

Message ID 20220407023700.7216-1-rdunlap@infradead.org (mailing list archive)
State Changes Requested
Headers show
Series macintosh: fix via-pmu and via-cuda build errors | expand

Commit Message

Randy Dunlap April 7, 2022, 2:37 a.m. UTC
When CONFIG_INPUT=m, the input_*() family of functions is not
available to builtin drivers.

When CONFIG_RTC_CLASS is not set, rtc_tm_to_time64() is not defined.

Fix multiple build errors by making these Kconfig symbols required by
ADB_CUDA (RTC_CLASS) and ADB_PMU (RTC_CLASS and INPUT).

m68k-linux-ld: drivers/macintosh/via-pmu.o: in function `pmu_set_rtc_time':
drivers/macintosh/via-pmu.c:1758: undefined reference to `rtc_tm_to_time64'
m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `input_report_key':
include/linux/input.h:425: undefined reference to `input_event'
m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `input_report_switch':
include/linux/input.h:445: undefined reference to `input_event'
m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `via_pmu_event_init':
drivers/macintosh/via-pmu-event.c:38: undefined reference to `input_allocate_device'
m68k-linux-ld: drivers/macintosh/via-pmu-event.c:53: undefined reference to `input_register_device'
m68k-linux-ld: drivers/macintosh/via-pmu-event.c:55: undefined reference to `input_free_device'
m68k-linux-ld: drivers/macintosh/via-cuda.o: in function `cuda_set_rtc_time':
drivers/macintosh/via-cuda.c:797: undefined reference to `rtc_tm_to_time64'

Fixes: 0792a2c8e0bb ("macintosh: Use common code to access RTC")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Finn Thain <fthain@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
This is a big hammer type of patch. We could possibly do (a) some
conditional code blocks for RTC_CLASS and (b) only build via-pmu-event
if CONFIG_INPUT=y if needed.

 drivers/macintosh/Kconfig |    3 +++
 1 file changed, 3 insertions(+)

Comments

Randy Dunlap April 7, 2022, 3:16 a.m. UTC | #1
On 4/6/22 19:37, Randy Dunlap wrote:
> When CONFIG_INPUT=m, the input_*() family of functions is not
> available to builtin drivers.
> 
> When CONFIG_RTC_CLASS is not set, rtc_tm_to_time64() is not defined.
> 
> Fix multiple build errors by making these Kconfig symbols required by
> ADB_CUDA (RTC_CLASS) and ADB_PMU (RTC_CLASS and INPUT).

Ah yes, Finn has already fixed the INPUT problems here.

Maybe that patch hasn't been merged anywhere yet?

The RTC_CLASS problem is still present AFAICT.

> m68k-linux-ld: drivers/macintosh/via-pmu.o: in function `pmu_set_rtc_time':
> drivers/macintosh/via-pmu.c:1758: undefined reference to `rtc_tm_to_time64'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `input_report_key':
> include/linux/input.h:425: undefined reference to `input_event'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `input_report_switch':
> include/linux/input.h:445: undefined reference to `input_event'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `via_pmu_event_init':
> drivers/macintosh/via-pmu-event.c:38: undefined reference to `input_allocate_device'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.c:53: undefined reference to `input_register_device'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.c:55: undefined reference to `input_free_device'
> m68k-linux-ld: drivers/macintosh/via-cuda.o: in function `cuda_set_rtc_time':
> drivers/macintosh/via-cuda.c:797: undefined reference to `rtc_tm_to_time64'
> 
> Fixes: 0792a2c8e0bb ("macintosh: Use common code to access RTC")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Finn Thain <fthain@linux-m68k.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> This is a big hammer type of patch. We could possibly do (a) some
> conditional code blocks for RTC_CLASS and (b) only build via-pmu-event
> if CONFIG_INPUT=y if needed.
> 
>  drivers/macintosh/Kconfig |    3 +++
>  1 file changed, 3 insertions(+)
> 
> --- a/drivers/macintosh/Kconfig
> +++ b/drivers/macintosh/Kconfig
> @@ -44,6 +44,7 @@ config ADB_IOP
>  config ADB_CUDA
>  	bool "Support for Cuda/Egret based Macs and PowerMacs"
>  	depends on (ADB || PPC_PMAC) && !PPC_PMAC64
> +	depends on RTC_CLASS
>  	help
>  	  This provides support for Cuda/Egret based Macintosh and
>  	  Power Macintosh systems. This includes most m68k based Macs,
> @@ -57,6 +58,8 @@ config ADB_CUDA
>  config ADB_PMU
>  	bool "Support for PMU based PowerMacs and PowerBooks"
>  	depends on PPC_PMAC || MAC
> +	depends on INPUT=y
> +	depends on RTC_CLASS
>  	help
>  	  On PowerBooks, iBooks, and recent iMacs and Power Macintoshes, the
>  	  PMU is an embedded microprocessor whose primary function is to
Christophe Leroy April 7, 2022, 7:14 a.m. UTC | #2
Le 07/04/2022 à 05:16, Randy Dunlap a écrit :
> 
> 
> On 4/6/22 19:37, Randy Dunlap wrote:
>> When CONFIG_INPUT=m, the input_*() family of functions is not
>> available to builtin drivers.
>>
>> When CONFIG_RTC_CLASS is not set, rtc_tm_to_time64() is not defined.
>>
>> Fix multiple build errors by making these Kconfig symbols required by
>> ADB_CUDA (RTC_CLASS) and ADB_PMU (RTC_CLASS and INPUT).
> 
> Ah yes, Finn has already fixed the INPUT problems here.

https://patchwork.ozlabs.org/project/linuxppc-dev/patch/d987663bbed18d7dbf106db6066a759040b4e57a.1647837028.git.fthain@linux-m68k.org/

> 
> Maybe that patch hasn't been merged anywhere yet?

The patch has comments, I guess we are waiting for a new version ?



> 
> The RTC_CLASS problem is still present AFAICT.
> 


Christophe
Christophe Leroy April 7, 2022, 7:22 a.m. UTC | #3
Le 07/04/2022 à 04:37, Randy Dunlap a écrit :
> When CONFIG_INPUT=m, the input_*() family of functions is not
> available to builtin drivers.
> 
> When CONFIG_RTC_CLASS is not set, rtc_tm_to_time64() is not defined.
> 
> Fix multiple build errors by making these Kconfig symbols required by
> ADB_CUDA (RTC_CLASS) and ADB_PMU (RTC_CLASS and INPUT).
> 
> m68k-linux-ld: drivers/macintosh/via-pmu.o: in function `pmu_set_rtc_time':
> drivers/macintosh/via-pmu.c:1758: undefined reference to `rtc_tm_to_time64'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `input_report_key':
> include/linux/input.h:425: undefined reference to `input_event'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `input_report_switch':
> include/linux/input.h:445: undefined reference to `input_event'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.o: in function `via_pmu_event_init':
> drivers/macintosh/via-pmu-event.c:38: undefined reference to `input_allocate_device'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.c:53: undefined reference to `input_register_device'
> m68k-linux-ld: drivers/macintosh/via-pmu-event.c:55: undefined reference to `input_free_device'
> m68k-linux-ld: drivers/macintosh/via-cuda.o: in function `cuda_set_rtc_time':
> drivers/macintosh/via-cuda.c:797: undefined reference to `rtc_tm_to_time64'
> 
> Fixes: 0792a2c8e0bb ("macintosh: Use common code to access RTC")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Finn Thain <fthain@linux-m68k.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> This is a big hammer type of patch. We could possibly do (a) some
> conditional code blocks for RTC_CLASS and (b) only build via-pmu-event
> if CONFIG_INPUT=y if needed.
> 
>   drivers/macintosh/Kconfig |    3 +++
>   1 file changed, 3 insertions(+)
> 
> --- a/drivers/macintosh/Kconfig
> +++ b/drivers/macintosh/Kconfig
> @@ -44,6 +44,7 @@ config ADB_IOP
>   config ADB_CUDA
>   	bool "Support for Cuda/Egret based Macs and PowerMacs"
>   	depends on (ADB || PPC_PMAC) && !PPC_PMAC64
> +	depends on RTC_CLASS

Shouldn't it be the other way round, ie 'select RTC_CLASS' ?


>   	help
>   	  This provides support for Cuda/Egret based Macintosh and
>   	  Power Macintosh systems. This includes most m68k based Macs,
> @@ -57,6 +58,8 @@ config ADB_CUDA
>   config ADB_PMU
>   	bool "Support for PMU based PowerMacs and PowerBooks"
>   	depends on PPC_PMAC || MAC
> +	depends on INPUT=y

As far as I remember that's not enough, it leads to some warnings, see 
the threads around Finn's patch.

> +	depends on RTC_CLASS

Shouldn't it be the other way round, ie 'select RTC_CLASS' ?

>   	help
>   	  On PowerBooks, iBooks, and recent iMacs and Power Macintoshes, the
>   	  PMU is an embedded microprocessor whose primary function is to

Christophe
Finn Thain April 7, 2022, 7:31 a.m. UTC | #4
On Wed, 6 Apr 2022, Randy Dunlap wrote:

> When CONFIG_RTC_CLASS is not set, rtc_tm_to_time64() is not defined.
> 
> ...
> 
> m68k-linux-ld: drivers/macintosh/via-pmu.o: in function `pmu_set_rtc_time':
> drivers/macintosh/via-pmu.c:1758: undefined reference to `rtc_tm_to_time64'
> m68k-linux-ld: drivers/macintosh/via-cuda.o: in function `cuda_set_rtc_time':
> drivers/macintosh/via-cuda.c:797: undefined reference to `rtc_tm_to_time64'
> 
> ...
> This is a big hammer type of patch. We could possibly do (a) some
> conditional code blocks for RTC_CLASS 

rtc_tm_to_time64() call sites also appear in several other files without 
conditionals:

arch/powerpc/kernel/time.c
arch/powerpc/platforms/8xx/m8xx_setup.c
arch/powerpc/platforms/maple/time.c
arch/powerpc/platforms/powermac/time.c

Why not use mktime64() instead? That seems to be a common pattern for this 
kind of thing (without needing conditional code).
Finn Thain April 7, 2022, 7:41 a.m. UTC | #5
On Thu, 7 Apr 2022, Christophe Leroy wrote:

> Le 07/04/2022 à 05:16, Randy Dunlap a écrit :
> > 
> > 
> > On 4/6/22 19:37, Randy Dunlap wrote:
> >> When CONFIG_INPUT=m, the input_*() family of functions is not
> >> available to builtin drivers.
> >>
> >> When CONFIG_RTC_CLASS is not set, rtc_tm_to_time64() is not defined.
> >>
> >> Fix multiple build errors by making these Kconfig symbols required by
> >> ADB_CUDA (RTC_CLASS) and ADB_PMU (RTC_CLASS and INPUT).
> > 
> > Ah yes, Finn has already fixed the INPUT problems here.
> 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/d987663bbed18d7dbf106db6066a759040b4e57a.1647837028.git.fthain@linux-m68k.org/
> 
> > 
> > Maybe that patch hasn't been merged anywhere yet?
> 
> The patch has comments, I guess we are waiting for a new version ?
> 

I'll send a new version, though I expect it will attract comments too.
diff mbox series

Patch

--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -44,6 +44,7 @@  config ADB_IOP
 config ADB_CUDA
 	bool "Support for Cuda/Egret based Macs and PowerMacs"
 	depends on (ADB || PPC_PMAC) && !PPC_PMAC64
+	depends on RTC_CLASS
 	help
 	  This provides support for Cuda/Egret based Macintosh and
 	  Power Macintosh systems. This includes most m68k based Macs,
@@ -57,6 +58,8 @@  config ADB_CUDA
 config ADB_PMU
 	bool "Support for PMU based PowerMacs and PowerBooks"
 	depends on PPC_PMAC || MAC
+	depends on INPUT=y
+	depends on RTC_CLASS
 	help
 	  On PowerBooks, iBooks, and recent iMacs and Power Macintoshes, the
 	  PMU is an embedded microprocessor whose primary function is to