lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Nov 2023 08:30:59 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     "Miclaus, Antoniu" <Antoniu.Miclaus@...log.com>
Cc:     Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Jean Delvare <jdelvare@...e.com>,
        "linux-rtc@...r.kernel.org" <linux-rtc@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-hwmon@...r.kernel.org" <linux-hwmon@...r.kernel.org>
Subject: Re: [PATCH v4 2/2] rtc: max31335: add driver support

On 11/1/23 08:21, Miclaus, Antoniu wrote:
>> On Wed, Nov 01, 2023 at 11:48:14AM +0200, Antoniu Miclaus wrote:
>>> RTC driver for MAX31335 ±2ppm Automotive Real-Time Clock with
>>> Integrated MEMS Resonator.
>>>
>>> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
>>> ---
>>> changes in v4:
>>>   - add Kconfig entry for HWMON dependency.
>>>   MAINTAINERS                |   8 +
>>>   drivers/rtc/Kconfig        |  20 +
>>>   drivers/rtc/Makefile       |   1 +
>>>   drivers/rtc/rtc-max31335.c | 765
>> +++++++++++++++++++++++++++++++++++++
>>>   4 files changed, 794 insertions(+)
>>>   create mode 100644 drivers/rtc/rtc-max31335.c
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index dd5de540ec0b..bc484cb997ab 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -12823,6 +12823,14 @@ F:
>> 	Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
>>>   F:	Documentation/hwmon/max31827.rst
>>>   F:	drivers/hwmon/max31827.c
>>>
>>> +MAX31335 RTC DRIVER
>>> +M:	Antoniu Miclaus <antoniu.miclaus@...log.com>
>>> +L:	linux-rtc@...r.kernel.org
>>> +S:	Supported
>>> +W:	https://ez.analog.com/linux-software-drivers
>>> +F:	Documentation/devicetree/bindings/rtc/adi,max31335.yaml
>>> +F:	drivers/rtc/rtc-max31335.c
>>> +
>>>   MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER
>>>   L:	linux-hwmon@...r.kernel.org
>>>   S:	Orphan
>>> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
>>> index d7502433c78a..360da13fe61b 100644
>>> --- a/drivers/rtc/Kconfig
>>> +++ b/drivers/rtc/Kconfig
>>> @@ -373,6 +373,26 @@ config RTC_DRV_MAX8997
>>>   	  This driver can also be built as a module. If so, the module
>>>   	  will be called rtc-max8997.
>>>
>>> +config RTC_DRV_MAX31335
>>> +	tristate "Analog Devices MAX31335"
>>> +	depends on I2C
>>> +	select REGMAP_I2C
>>> +	help
>>> +	  If you say yes here you get support for the Analog Devices
>>> +	  MAX31335.
>>> +
>>> +	  This driver can also be built as a module. If so, the module
>>> +	  will be called rtc-max31335.
>>> +
>>> +config RTC_DRV_MAX31335_HWMON
>>> +	bool "HWMON support for Analog Devices MAX31335"
>>> +	depends on RTC_DRV_MAX31335 && HWMON
>>> +	depends on !(RTC_DRV_MAX31335=y && HWMON=m)
>>> +	default y
>>> +	help
>>> +	  Say Y here if you want to expose temperature sensor data on
>>> +	  rtc-max31335.
>>> +
>>
>> This isn't used in the driver. Did you test with HWMON=n ?
>>
> 
> I need to start thinking a bit more out of the box instead of
> taking other driver approaches as being the only way to go. 😊
> 

There are essentially two options: Either the above, or use
	depends on HWMON || HWMON=n
for RTC_DRV_MAX31335.

In both cases, the driver hwmon code has to be surrounded with #if[def].
Depending on your approach, that will be "#ifdef RTC_DRV_MAX31335_HWMON"
or "#if IS_REACHABLE(HWMON)".

You could also use "depends on HWMON" for RTC_DRV_MAX31335 to avoid the
#ifdef in the driver, but that is normally undesirable.

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ