Re: [PATCH 4/8] pwm: dwc: add of/platform support
From: Jarkko Nikula
Date: Mon Aug 08 2022 - 10:36:37 EST
Hi
On 8/5/22 19:50, Ben Dooks wrote:
The dwc pwm controller can be used in non-PCI systems, so allow
either platform or OF based probing.
Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxx>
---
v3:
- changed compatible name
---
drivers/pwm/Kconfig | 5 ++--
drivers/pwm/pwm-dwc.c | 53 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)
...
@@ -319,6 +320,58 @@ static struct pci_driver dwc_pwm_driver = {
module_pci_driver(dwc_pwm_driver);
...
+module_platform_driver(dwc_pwm_plat_driver);
+
These module_X_driver() macros cannot coexist in the same module and
ideally the same kernel built should support probing both PCI and OF
based systems in runtime, i.e. putting those macros under #ifdef is not
ideal.
Usually this is solved either by common code has the platform device
probing (with or without the OF support) and the PCI part is in another
module which adds the platform device(s) or both platform and PCI device
code are in own modules and call common code.