lkml.org 
[lkml]   [2022]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 4/8] pwm: dwc: add of/platform support
From
On 08/08/2022 15:36, Jarkko Nikula wrote:
> 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@sifive.com>
>> ---
>> 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.

Yeah, just realised that.

I'm not sure it is worth splitting the driver as most of the probe code
is pretty small so it might be worth just having one init function that
adds both the pcie and the of drivers.

--
Ben

\
 
 \ /
  Last update: 2022-08-08 16:39    [W:0.113 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site