Skip to contentSkip to conversation

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

PATCH In review Randy Dunlap 3 participants 6 messages Apr 7, 2022 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macintosh: fix via-pmu and via-cuda build errors

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")
Cc Kees Cook <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Finn Thain <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>

---
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(+)
drivers/macintosh/Kconfig +3 -0
@@ -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
#1 lore raw
Quoted 7 lines · Randy Dunlap

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.

Quoted 52 lines

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")
Cc Kees Cook <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Finn Thain <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>

---
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(+)
drivers/macintosh/Kconfig +3 -0
@@ -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
Signature · 1 line
~Randy
#2 lore raw

Le 07/04/2022 à 05:16, Randy Dunlap a écrit :

Quoted 12 lines · Randy Dunlap
Quoted 7 lines

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/

Quoted 2 lines

Maybe that patch hasn't been merged anywhere yet?

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

Quoted 3 lines

The RTC_CLASS problem is still present AFAICT.

Christophe

#3 lore raw
Quoted 12 lines · Christophe Leroy

Le 07/04/2022 à 05:16, Randy Dunlap a écrit :

Quoted 11 lines · Randy Dunlap
Quoted 7 lines

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).

Quoted 9 lines
Quoted 1 line

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/

Quoted 2 lines

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.

#4 lore raw
In reply to Randy Dunlap

Le 07/04/2022 à 04:37, Randy Dunlap a écrit :

Quoted 44 lines

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")
Cc Kees Cook <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Finn Thain <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>

---
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(+)

drivers/macintosh/Kconfig config ADB_IOP · line 47

Quoted 4 lines
drivers/macintosh/Kconfig +1 -0
@@ -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' ?

drivers/macintosh/Kconfig config ADB_CUDA · line 61

Quoted 8 lines
drivers/macintosh/Kconfig +1 -0
  	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.

drivers/macintosh/Kconfig config ADB_CUDA · line 62

Quoted 1 line
drivers/macintosh/Kconfig +1 -0
+	depends on RTC_CLASS

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

drivers/macintosh/Kconfig config ADB_CUDA · line 65

Quoted 3 lines
drivers/macintosh/Kconfig +0 -0
  	help
  	  On PowerBooks, iBooks, and recent iMacs and Power Macintoshes, the
  	  PMU is an embedded microprocessor whose primary function is to

Christophe

#5 lore raw
In reply to Randy Dunlap
Quoted 4 lines · Randy Dunlap

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

...

Quoted 8 lines

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).