Skip to contentSkip to conversation

rtc: Kconfig: select REGMAP for RTC_DRV_DS1307

PATCH In review Benjamin Gray 3 participants 6 messages Jul 5, 2023 – Jul 6, 2023 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: Kconfig: select REGMAP for RTC_DRV_DS1307

The drivers/rtc/rtc-ds1307.c driver has a direct dependency on struct regmap_config, which is guarded behind CONFIG_REGMAP.

Commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP") exposed this by disabling the default pick unless KUNIT_ALL_TESTS is set, causing the ppc64be allnoconfig build to fail.

---
 drivers/rtc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/rtc/Kconfig +1 -0
index ffca9a8bb878..7455ebd189fe 100644
@@ -246,6 +246,7 @@ config RTC_DRV_AS3722
 
 config RTC_DRV_DS1307
 	tristate "Dallas/Maxim DS1307/37/38/39/40/41, ST M41T00, EPSON RX-8025, ISL12057"
+	select REGMAP
 	select REGMAP_I2C
 	select WATCHDOG_CORE if WATCHDOG
 	help
Signature · 1 line
2.41.0
#1 lore raw

Le 05/07/2023 à 02:30, Benjamin Gray a écrit :

Quoted 17 lines

The drivers/rtc/rtc-ds1307.c driver has a direct dependency on struct regmap_config, which is guarded behind CONFIG_REGMAP.

Commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP") exposed this by disabling the default pick unless KUNIT_ALL_TESTS is set, causing the ppc64be allnoconfig build to fail.

---
  drivers/rtc/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/rtc/Kconfig +0 -0
index ffca9a8bb878..7455ebd189fe 100644

drivers/rtc/Kconfig config RTC_DRV_AS3722 · line 249

Quoted 4 lines
drivers/rtc/Kconfig +1 -0
@@ -246,6 +246,7 @@ config RTC_DRV_AS3722
 
  config RTC_DRV_DS1307
  	tristate "Dallas/Maxim DS1307/37/38/39/40/41, ST M41T00, EPSON RX-8025, ISL12057"
+	select REGMAP

As far as I can see, REGMAP defaults to Y when REGMAP_I2C is selected. Can you explain more in details why you have to select it explicitely ? If there is something wrong with the logic, then the logic should be fixed instead of just adding a selection of REGMAP for that particular RTC_DRV_DS1307. Because others like RTC_DRV_ABB5ZES3 or RTC_DRV_ABEOZ9 might have the exact same problem.

Quoted 3 lines
drivers/rtc/Kconfig +0 -0
  	select REGMAP_I2C
  	select WATCHDOG_CORE if WATCHDOG
  	help
#2 lore raw
Quoted 30 lines · Christophe Leroy

Le 05/07/2023 à 02:30, Benjamin Gray a écrit :

Quoted 19 lines

The drivers/rtc/rtc-ds1307.c driver has a direct dependency on struct regmap_config, which is guarded behind CONFIG_REGMAP.

Commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP")
exposed this by disabling the default pick unless KUNIT_ALL_TESTS is
set, causing the ppc64be allnoconfig build to fail.

---
  drivers/rtc/Kconfig | 1 +

  1 file changed, 1 insertion(+)
drivers/rtc/Kconfig +0 -0
index ffca9a8bb878..7455ebd189fe 100644
@@ -246,6 +246,7 @@ config RTC_DRV_AS3722
Quoted 5 lines


  config RTC_DRV_DS1307
        tristate "Dallas/Maxim DS1307/37/38/39/40/41, ST M41T00, EPSON RX-8025, ISL12057"
+       select REGMAP

As far as I can see, REGMAP defaults to Y when REGMAP_I2C is selected.

Quoted 8 lines

Can you explain more in details why you have to select it explicitely ?
If there is something wrong with the logic, then the logic should be fixed instead of just adding a selection of REGMAP for that particular
RTC_DRV_DS1307. Because others like RTC_DRV_ABB5ZES3 or RTC_DRV_ABEOZ9
might have the exact same problem.

Right, yeah, I don't want to assert this patch is the correct solution, sending it was more to offer a fix and allow discussion if it should be resolved some other way (so thanks for replying, I appreciate it).

In terms of why I made this patch, the way I see it, if a config option requires another config option be set, then "selects" is the natural way of phrasing this dependency. "default" on the REGMAP side seems weird. If it's a default, does that mean it can be overridden? But RTC_DRV_DS1307 *requires* REGMAP; it's not just a "would be nice". The build breaks without it.

But maybe KConfig works differently to my assumptions. Maybe the referenced patch that causes the build failure is actually incorrect (CC Geert). I spoke with Joel Stanley (CC) and he indicated you're not supposed to depend on REGMAP like KUnit does?

As for other drivers having the same problem, quite possibly, yes. But the PPC configs don't seem to build those drivers, so I'd prefer to leave it to anyone who does build them to report the error. I wasn't planning to audit all the drivers, I was just trying to fix the PPC configs I build and test.

#3 lore raw

Le 06/07/2023 à 08:14, Benjamin Gray a écrit :

Quoted 44 lines · Christophe Leroy
Quoted 23 lines

Le 05/07/2023 à 02:30, Benjamin Gray a écrit :

Quoted 20 lines

The drivers/rtc/rtc-ds1307.c driver has a direct dependency on struct regmap_config, which is guarded behind CONFIG_REGMAP.

Commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP")
exposed this by disabling the default pick unless KUNIT_ALL_TESTS is
set, causing the ppc64be allnoconfig build to fail.

---
   drivers/rtc/Kconfig | 1 +
   1 file changed, 1 insertion(+)
drivers/rtc/Kconfig +0 -0
index ffca9a8bb878..7455ebd189fe 100644
@@ -246,6 +246,7 @@ config RTC_DRV_AS3722
 
Quoted 15 lines
Quoted 4 lines
drivers/rtc/Kconfig +0 -0
   config RTC_DRV_DS1307
         tristate "Dallas/Maxim DS1307/37/38/39/40/41, ST M41T00,

EPSON RX-8025, ISL12057"
+       select REGMAP

As far as I can see, REGMAP defaults to Y when REGMAP_I2C is selected.
Can you explain more in details why you have to select it explicitely ?
If there is something wrong with the logic, then the logic should be fixed instead of just adding a selection of REGMAP for that particular
RTC_DRV_DS1307. Because others like RTC_DRV_ABB5ZES3 or RTC_DRV_ABEOZ9
might have the exact same problem.

Right, yeah, I don't want to assert this patch is the correct solution, sending it was more to offer a fix and allow discussion if it should be resolved some other way (so thanks for replying, I appreciate it).

Quoted 6 lines

In terms of why I made this patch, the way I see it, if a config option requires another config option be set, then "selects" is the natural way of phrasing this dependency. "default" on the REGMAP side seems weird. If it's a default, does that mean it can be overridden? But RTC_DRV_DS1307 *requires* REGMAP; it's not just a "would be nice". The build breaks without it.

I mean't "why doesn't it work as is", and/or "why didn't you fix what doesn't work".

Well, until commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP") it was not user-selectable so I couldn't be overridden. After commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP") it is overridable so we have an additional problem.

Does RTC_DRV_DS1307 require REGMAP or does RTC_DRV_DS1307 require REGMAP_I2C and then REGMAP_I2C requires REGMAP ?

I think that huge default like for REGMAP should be replaced by individual selection of REGMAP from each of those config items. For exemple REGMAP_I2C should select REGMAP then I guess it would also solve your issue wouldn't it ?

Quoted 11 lines

But maybe KConfig works differently to my assumptions. Maybe the referenced patch that causes the build failure is actually incorrect (CC Geert). I spoke with Joel Stanley (CC) and he indicated you're not supposed to depend on REGMAP like KUnit does?

As for other drivers having the same problem, quite possibly, yes. But the PPC configs don't seem to build those drivers, so I'd prefer to leave it to anyone who does build them to report the error. I wasn't planning to audit all the drivers, I was just trying to fix the PPC configs I build and test.

Well ok but that's probably the indication of a deeper problem which deserves a more generic fix.

#4 lore raw
In reply to Benjamin Gray

Hi Benjamin,

Quoted 49 lines · Benjamin Gray
Quoted 21 lines · Christophe Leroy
Quoted 20 lines · Benjamin Gray

The drivers/rtc/rtc-ds1307.c driver has a direct dependency on struct regmap_config, which is guarded behind CONFIG_REGMAP.

Commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP")
exposed this by disabling the default pick unless KUNIT_ALL_TESTS is
set, causing the ppc64be allnoconfig build to fail.

---
  drivers/rtc/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/rtc/Kconfig +0 -0
index ffca9a8bb878..7455ebd189fe 100644
@@ -246,6 +246,7 @@ config RTC_DRV_AS3722
 
Quoted 15 lines
Quoted 4 lines
drivers/rtc/Kconfig +0 -0
  config RTC_DRV_DS1307
        tristate "Dallas/Maxim DS1307/37/38/39/40/41, ST M41T00,

EPSON RX-8025, ISL12057"
+ select REGMAP

As far as I can see, REGMAP defaults to Y when REGMAP_I2C is selected.
Can you explain more in details why you have to select it explicitely ?
If there is something wrong with the logic, then the logic should be fixed instead of just adding a selection of REGMAP for that particular
RTC_DRV_DS1307. Because others like RTC_DRV_ABB5ZES3 or RTC_DRV_ABEOZ9
might have the exact same problem.

Right, yeah, I don't want to assert this patch is the correct solution, sending it was more to offer a fix and allow discussion if it should be resolved some other way (so thanks for replying, I appreciate it).

In terms of why I made this patch, the way I see it, if a config option requires another config option be set, then "selects" is the natural way of phrasing this dependency. "default" on the REGMAP side seems weird. If it's a default, does that mean it can be overridden? But RTC_DRV_DS1307 *requires* REGMAP; it's not just a "would be nice". The build breaks without it.

Quoted 4 lines

But maybe KConfig works differently to my assumptions. Maybe the referenced patch that causes the build failure is actually incorrect (CC Geert). I spoke with Joel Stanley (CC) and he indicated you're not supposed to depend on REGMAP like KUnit does?

Thanks for CCing me!

Looks like I made a really silly mistake here: my patch not only allows the user to enable REGMAP manually (for the test), but also to disable it manually, regardless if there are users or not :-(

I think the proper fix is to replace the "default y if ..." by "select REGMAP" for all users.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#5 lore raw
Quoted 55 lines · Geert Uytterhoeven
Quoted 49 lines · Benjamin Gray
Quoted 21 lines · Christophe Leroy
Quoted 20 lines · Benjamin Gray

The drivers/rtc/rtc-ds1307.c driver has a direct dependency on struct regmap_config, which is guarded behind CONFIG_REGMAP.

Commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP")
exposed this by disabling the default pick unless KUNIT_ALL_TESTS is
set, causing the ppc64be allnoconfig build to fail.

---
  drivers/rtc/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/rtc/Kconfig +0 -0
index ffca9a8bb878..7455ebd189fe 100644
@@ -246,6 +246,7 @@ config RTC_DRV_AS3722
 
Quoted 15 lines
Quoted 4 lines
drivers/rtc/Kconfig +0 -0
  config RTC_DRV_DS1307
        tristate "Dallas/Maxim DS1307/37/38/39/40/41, ST M41T00,

EPSON RX-8025, ISL12057"
+ select REGMAP

As far as I can see, REGMAP defaults to Y when REGMAP_I2C is selected.
Can you explain more in details why you have to select it explicitely ?
If there is something wrong with the logic, then the logic should be fixed instead of just adding a selection of REGMAP for that particular
RTC_DRV_DS1307. Because others like RTC_DRV_ABB5ZES3 or RTC_DRV_ABEOZ9
might have the exact same problem.

Right, yeah, I don't want to assert this patch is the correct solution, sending it was more to offer a fix and allow discussion if it should be resolved some other way (so thanks for replying, I appreciate it).

In terms of why I made this patch, the way I see it, if a config option requires another config option be set, then "selects" is the natural way of phrasing this dependency. "default" on the REGMAP side seems weird. If it's a default, does that mean it can be overridden? But RTC_DRV_DS1307 *requires* REGMAP; it's not just a "would be nice". The build breaks without it.

Quoted 4 lines

But maybe KConfig works differently to my assumptions. Maybe the referenced patch that causes the build failure is actually incorrect (CC Geert). I spoke with Joel Stanley (CC) and he indicated you're not supposed to depend on REGMAP like KUnit does?

Quoted 8 lines

Thanks for CCing me!

Looks like I made a really silly mistake here: my patch not only allows the user to enable REGMAP manually (for the test), but also to disable it manually, regardless if there are users or not :-(

I think the proper fix is to replace the "default y if ..." by "select REGMAP" for all users.

I have sent a patch to do so, followed by a few related fixes
https://lore.kernel.org/r/525c37a568b10623ffb2d108850afd7e37f9350e.1688643442.git.geert@linux-m68k.org

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds