Skip to contentSkip to conversation

misc: Kconfig: tc9564: fix a circular dependency

PATCH In review Alex Elder 2 participants 5 messages Oct 2 Char and misc drivers

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 misc: Kconfig: tc9564: fix a circular dependency

The TC9564_PCI config option selects PCI_DYNAMIC_OF_NODES. But that depends on OF_IRQ, and TC9564_PCI does not satisfy that dependency.

Simply adding "depends on OF_IRQ" results in a recursive Kconfig dependency.

A little experimentation shows that the recursion can be avoided when "depends on OF_IRQ" is added by *depending on* rather than *selecting* PCI_QUIRKS.

Fixes 1304b0c47ef81 ("misc: tc9564: introduce base PCI driver")
---
 drivers/misc/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/Kconfig +2 -1
index 9c5b1e9d672e8..87ea92af81dca 100644
@@ -571,9 +571,10 @@ config MCHP_LAN966X_PCI
 config TC9564_PCI
 	tristate "Toshiba TC9564 PCI function support"
 	depends on OF
+	depends on OF_IRQ
 	depends on PCI
+	depends on PCI_QUIRKS
 	select PCI_DYNAMIC_OF_NODES
-	select PCI_QUIRKS
 	default m
 	help
 	  This enables support for two PCI functions implemented by the

base-commit: 04434a1d0f311d76b1f15fa987918b471a0b8c6a

Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 9 lines · Alex Elder

The TC9564_PCI config option selects PCI_DYNAMIC_OF_NODES. But that depends on OF_IRQ, and TC9564_PCI does not satisfy that dependency.

Simply adding "depends on OF_IRQ" results in a recursive Kconfig dependency.

A little experimentation shows that the recursion can be avoided when "depends on OF_IRQ" is added by *depending on* rather than *selecting* PCI_QUIRKS.

Hi Alex,

This change looks technically correct, but I find the description misleading as you are not actually fixing a circular dependency but instead a missing one.

Quoted 5 lines
drivers/misc/Kconfig +0 -0
index 9c5b1e9d672e8..87ea92af81dca 100644

drivers/misc/Kconfig config MCHP_LAN966X_PCI · line 578

Quoted 9 lines
drivers/misc/Kconfig +2 -1
@@ -571,9 +571,10 @@ config MCHP_LAN966X_PCI
 config TC9564_PCI
 	tristate "Toshiba TC9564 PCI function support"
 	depends on OF
+	depends on OF_IRQ
 	depends on PCI
+	depends on PCI_QUIRKS
 	select PCI_DYNAMIC_OF_NODES
-	select PCI_QUIRKS
 	default m

I would go further here and simplify this to

config TC9564_PCI
tristate "Toshiba TC9564 PCI function support"

        depends on PCI && PCI_DYNAMIC_OF_NODES && PCI_QUIRKS

(in either one or three lines)

CONFIG_PCI_DYNAMIC_OF_NODES is a user-visible option, so you should not select it from a driver.

Arnd

author
#2 lore raw
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Alex Elder

The TC9564_PCI config option selects PCI_DYNAMIC_OF_NODES. But that depends on OF_IRQ, and TC9564_PCI does not satisfy that dependency.

Simply adding "depends on OF_IRQ" results in a recursive Kconfig dependency.

A little experimentation shows that the recursion can be avoided when "depends on OF_IRQ" is added by *depending on* rather than *selecting* PCI_QUIRKS.

Quoted 5 lines

Hi Alex,

This change looks technically correct, but I find the description misleading as you are not actually fixing a circular dependency but instead a missing one.

That's true. It's adding a missing dependency in a way that avoids the circular dependency. I will update this and send version 2 shortly.

Quoted 17 lines
Quoted 5 lines
drivers/misc/Kconfig +0 -0
index 9c5b1e9d672e8..87ea92af81dca 100644

drivers/misc/Kconfig config MCHP_LAN966X_PCI · line 578

Quoted 9 lines
drivers/misc/Kconfig +2 -1
@@ -571,9 +571,10 @@ config MCHP_LAN966X_PCI
  config TC9564_PCI
  	tristate "Toshiba TC9564 PCI function support"
  	depends on OF
+	depends on OF_IRQ
  	depends on PCI
+	depends on PCI_QUIRKS
  	select PCI_DYNAMIC_OF_NODES
-	select PCI_QUIRKS
  	default m

I would go further here and simplify this to

Quoted 5 lines

config TC9564_PCI
tristate "Toshiba TC9564 PCI function support"

         depends on PCI && PCI_DYNAMIC_OF_NODES && PCI_QUIRKS

(in either one or three lines)

If I do one, I'll combine OF and OF_IRQ similarly into one.

Quoted 2 lines

CONFIG_PCI_DYNAMIC_OF_NODES is a user-visible option, so you should not select it from a driver.

OK, I didn't realize this. Another thing to look for.

Thank you Arnd.

-Alex

Quoted 1 line

Arnd

maintainer
#3 lore raw
Quoted 9 lines · Alex Elder
Quoted 6 lines · Arnd Bergmann

On Fri, Oct 2, 2026, at 03:33, Alex Elder wrote:
config TC9564_PCI
tristate "Toshiba TC9564 PCI function support"

         depends on PCI && PCI_DYNAMIC_OF_NODES && PCI_QUIRKS

(in either one or three lines)

If I do one, I'll combine OF and OF_IRQ similarly into one.

If you have a dependency on PCI_DYNAMIC_OF_NODES, you don't need the extra dependency on OF_IRQ or OF.

I guess you don't need the dependency on PCI either, unless we ever want to make PCI a tristate option have that in a loadable module.

Arnd

author
#4 lore raw
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Alex Elder
Quoted 6 lines · Arnd Bergmann

On Fri, Oct 2, 2026, at 03:33, Alex Elder wrote:
config TC9564_PCI
tristate "Toshiba TC9564 PCI function support"

          depends on PCI && PCI_DYNAMIC_OF_NODES && PCI_QUIRKS

(in either one or three lines)

If I do one, I'll combine OF and OF_IRQ similarly into one.

Quoted 8 lines

If you have a dependency on PCI_DYNAMIC_OF_NODES, you don't need the extra dependency on OF_IRQ or OF.

I guess you don't need the dependency on PCI either, unless we ever want to make PCI a tristate option have that in a loadable module.

Arnd

I'm partly influenced by something comparable to "include what you use", where my instinct here would be to explicitly indicate dependencies even if other depended-on config options satisfy them. But I'll do what you're suggesting.

I will omit the dependency on PCI. This is the same situation as the OF dependency, where OF_IRQ is only available if OF is enabled.

I'm adding "Suggested-by" you in the commit, because the final (much simpler) form derives directly from what you've said here.

Thank you.

-Alex