diff mbox series

net: lan743x: LAN743X selects FIXED_PHY to resolve a link error

Message ID 20230219150321.2683358-1-trix@redhat.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: lan743x: LAN743X selects FIXED_PHY to resolve a link error | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Tom Rix Feb. 19, 2023, 3:03 p.m. UTC
A rand config causes this link error
drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ethernet/microchip/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Simon Horman Feb. 19, 2023, 6:16 p.m. UTC | #1
On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
> A rand config causes this link error
> drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
> drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
> 
> lan743x_netdev_open is controlled by LAN743X
> fixed_phy_register is controlled by FIXED_PHY
> 
> So LAN743X should also select FIXED_PHY
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Hi Tom,

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
But I do not see a build failure, and I believe that is because
when FIXED_PHY is not set then a stub version of fixed_phy_register(),
defined as static inline in include/linux/phy_fixed.h, is used.

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

> ---
>  drivers/net/ethernet/microchip/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/microchip/Kconfig b/drivers/net/ethernet/microchip/Kconfig
> index 24c994baad13..43ba71e82260 100644
> --- a/drivers/net/ethernet/microchip/Kconfig
> +++ b/drivers/net/ethernet/microchip/Kconfig
> @@ -47,6 +47,7 @@ config LAN743X
>  	depends on PCI
>  	depends on PTP_1588_CLOCK_OPTIONAL
>  	select PHYLIB
> +	select FIXED_PHY
>  	select CRC16
>  	select CRC32
>  	help
> -- 
> 2.27.0
>
Andrew Lunn Feb. 20, 2023, 1:19 a.m. UTC | #2
On Sun, Feb 19, 2023 at 07:16:07PM +0100, Simon Horman wrote:
> On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
> > A rand config causes this link error
> > drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
> > drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
> > 
> > lan743x_netdev_open is controlled by LAN743X
> > fixed_phy_register is controlled by FIXED_PHY
> > 
> > So LAN743X should also select FIXED_PHY
> > 
> > Signed-off-by: Tom Rix <trix@redhat.com>
> 
> Hi Tom,
> 
> I am a little confused by this.
> 
> I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
> But I do not see a build failure, and I believe that is because
> when FIXED_PHY is not set then a stub version of fixed_phy_register(),
> defined as static inline in include/linux/phy_fixed.h, is used.
> 
> Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY
is a module? What might be needed is

depends on FIXED_PHY || FIXED_PHY=n

	Andrew
Simon Horman Feb. 20, 2023, 6:46 a.m. UTC | #3
On Mon, Feb 20, 2023 at 02:19:34AM +0100, Andrew Lunn wrote:
> On Sun, Feb 19, 2023 at 07:16:07PM +0100, Simon Horman wrote:
> > On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
> > > A rand config causes this link error
> > > drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
> > > drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
> > > 
> > > lan743x_netdev_open is controlled by LAN743X
> > > fixed_phy_register is controlled by FIXED_PHY
> > > 
> > > So LAN743X should also select FIXED_PHY
> > > 
> > > Signed-off-by: Tom Rix <trix@redhat.com>
> > 
> > Hi Tom,
> > 
> > I am a little confused by this.
> > 
> > I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
> > But I do not see a build failure, and I believe that is because
> > when FIXED_PHY is not set then a stub version of fixed_phy_register(),
> > defined as static inline in include/linux/phy_fixed.h, is used.
> > 
> > Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42
> 
> I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY
> is a module? What might be needed is
> 
> depends on FIXED_PHY || FIXED_PHY=n

Thanks Andrew,

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom
describes. And his patch does appear to resolve the problem.

Unfortunately your proposed solution seems to run foul of a complex
dependency situation.

$ make
...
drivers/net/ethernet/microchip/Kconfig:45:error: recursive dependency detected!
drivers/net/ethernet/microchip/Kconfig:45:	symbol LAN743X depends on FIXED_PHY
drivers/net/phy/Kconfig:48:	symbol FIXED_PHY depends on PHYLIB
drivers/net/phy/Kconfig:16:	symbol PHYLIB is selected by LAN743X
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
Andrew Lunn Feb. 21, 2023, 2:29 a.m. UTC | #4
On Mon, Feb 20, 2023 at 07:46:13AM +0100, Simon Horman wrote:
> On Mon, Feb 20, 2023 at 02:19:34AM +0100, Andrew Lunn wrote:
> > On Sun, Feb 19, 2023 at 07:16:07PM +0100, Simon Horman wrote:
> > > On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
> > > > A rand config causes this link error
> > > > drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
> > > > drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
> > > > 
> > > > lan743x_netdev_open is controlled by LAN743X
> > > > fixed_phy_register is controlled by FIXED_PHY
> > > > 
> > > > So LAN743X should also select FIXED_PHY
> > > > 
> > > > Signed-off-by: Tom Rix <trix@redhat.com>
> > > 
> > > Hi Tom,
> > > 
> > > I am a little confused by this.
> > > 
> > > I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
> > > But I do not see a build failure, and I believe that is because
> > > when FIXED_PHY is not set then a stub version of fixed_phy_register(),
> > > defined as static inline in include/linux/phy_fixed.h, is used.
> > > 
> > > Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42
> > 
> > I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY
> > is a module? What might be needed is
> > 
> > depends on FIXED_PHY || FIXED_PHY=n
> 
> Thanks Andrew,
> 
> LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom
> describes. And his patch does appear to resolve the problem.

O.K. So the commit message needs updating to describe the actual
problem.

> Unfortunately your proposed solution seems to run foul of a complex
> dependency situation.

I was never any good at Kconfig. Arnd is the expert at solving
problems like this.

You want either everything built in, or FIXED_PHY built in and LAN743X
modular, or both modular.

     Andrew
Simon Horman Feb. 21, 2023, 4:20 p.m. UTC | #5
+Arnd

On Tue, Feb 21, 2023 at 03:29:39AM +0100, Andrew Lunn wrote:
> On Mon, Feb 20, 2023 at 07:46:13AM +0100, Simon Horman wrote:
> > On Mon, Feb 20, 2023 at 02:19:34AM +0100, Andrew Lunn wrote:
> > > On Sun, Feb 19, 2023 at 07:16:07PM +0100, Simon Horman wrote:
> > > > On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
> > > > > A rand config causes this link error
> > > > > drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
> > > > > drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
> > > > > 
> > > > > lan743x_netdev_open is controlled by LAN743X
> > > > > fixed_phy_register is controlled by FIXED_PHY
> > > > > 
> > > > > So LAN743X should also select FIXED_PHY
> > > > > 
> > > > > Signed-off-by: Tom Rix <trix@redhat.com>
> > > > 
> > > > Hi Tom,
> > > > 
> > > > I am a little confused by this.
> > > > 
> > > > I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
> > > > But I do not see a build failure, and I believe that is because
> > > > when FIXED_PHY is not set then a stub version of fixed_phy_register(),
> > > > defined as static inline in include/linux/phy_fixed.h, is used.
> > > > 
> > > > Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42
> > > 
> > > I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY
> > > is a module? What might be needed is
> > > 
> > > depends on FIXED_PHY || FIXED_PHY=n
> > 
> > Thanks Andrew,
> > 
> > LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom
> > describes. And his patch does appear to resolve the problem.
> 
> O.K. So the commit message needs updating to describe the actual
> problem.

Yes, that would be a good improvement.

Perhaps a fixes tag too?

> > Unfortunately your proposed solution seems to run foul of a complex
> > dependency situation.
> 
> I was never any good at Kconfig. Arnd is the expert at solving
> problems like this.
> 
> You want either everything built in, or FIXED_PHY built in and LAN743X
> modular, or both modular.

I _think_ the patch, which uses select FIXED_PHY for LAN743X,
achieves that.

I CCed Arnd in case he has any input. Though I think I read
in an recent email from him that he is out most of this week.
Tom Rix Feb. 26, 2023, 3:15 p.m. UTC | #6
On 2/21/23 8:20 AM, Simon Horman wrote:
> +Arnd
>
> On Tue, Feb 21, 2023 at 03:29:39AM +0100, Andrew Lunn wrote:
>> On Mon, Feb 20, 2023 at 07:46:13AM +0100, Simon Horman wrote:
>>> On Mon, Feb 20, 2023 at 02:19:34AM +0100, Andrew Lunn wrote:
>>>> On Sun, Feb 19, 2023 at 07:16:07PM +0100, Simon Horman wrote:
>>>>> On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
>>>>>> A rand config causes this link error
>>>>>> drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
>>>>>> drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
>>>>>>
>>>>>> lan743x_netdev_open is controlled by LAN743X
>>>>>> fixed_phy_register is controlled by FIXED_PHY
>>>>>>
>>>>>> So LAN743X should also select FIXED_PHY
>>>>>>
>>>>>> Signed-off-by: Tom Rix <trix@redhat.com>
>>>>> Hi Tom,
>>>>>
>>>>> I am a little confused by this.
>>>>>
>>>>> I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
>>>>> But I do not see a build failure, and I believe that is because
>>>>> when FIXED_PHY is not set then a stub version of fixed_phy_register(),
>>>>> defined as static inline in include/linux/phy_fixed.h, is used.
>>>>>
>>>>> Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42
>>>> I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY
>>>> is a module? What might be needed is
>>>>
>>>> depends on FIXED_PHY || FIXED_PHY=n
>>> Thanks Andrew,
>>>
>>> LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom
>>> describes. And his patch does appear to resolve the problem.
>> O.K. So the commit message needs updating to describe the actual
>> problem.
> Yes, that would be a good improvement.
>
> Perhaps a fixes tag too?
>
>>> Unfortunately your proposed solution seems to run foul of a complex
>>> dependency situation.
>> I was never any good at Kconfig. Arnd is the expert at solving
>> problems like this.
>>
>> You want either everything built in, or FIXED_PHY built in and LAN743X
>> modular, or both modular.
> I _think_ the patch, which uses select FIXED_PHY for LAN743X,
> achieves that.
>
> I CCed Arnd in case he has any input. Though I think I read
> in an recent email from him that he is out most of this week.

I was out last week as well :)

I considered this a cleanup rather than a fix, I can add that fixes tag.

 From my point of view this is a linking problem, I don't mind 
changing,  what commit message should I use ?

Tom

>
Arnd Bergmann Feb. 27, 2023, 8:37 a.m. UTC | #7
On Sun, Feb 26, 2023, at 16:15, Tom Rix wrote:
> On 2/21/23 8:20 AM, Simon Horman wrote:
>> On Tue, Feb 21, 2023 at 03:29:39AM +0100, Andrew Lunn wrote:
>>> On Mon, Feb 20, 2023 at 07:46:13AM +0100, Simon Horman wrote:
>>>>
>>>> LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom
>>>> describes. And his patch does appear to resolve the problem.
>>> O.K. So the commit message needs updating to describe the actual
>>> problem.
>> Yes, that would be a good improvement.
>>
>> Perhaps a fixes tag too?
>>
>>>> Unfortunately your proposed solution seems to run foul of a complex
>>>> dependency situation.
>>> I was never any good at Kconfig. Arnd is the expert at solving
>>> problems like this.
>>>
>>> You want either everything built in, or FIXED_PHY built in and LAN743X
>>> modular, or both modular.
>> I _think_ the patch, which uses select FIXED_PHY for LAN743X,
>> achieves that.
>>
>> I CCed Arnd in case he has any input. Though I think I read
>> in an recent email from him that he is out most of this week.

FWIW, the original patch looks good to me,

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

I'm not sure if the #else path in include/linux/phy_fixed.h
is actually helpful, as it does not avoid a link failure but
just makes it less common. Maybe we should just drop that
from the header and require all users of fixed_phy to
'select' that symbol even when they are built-in?

       Arnd
Simon Horman Feb. 27, 2023, 12:05 p.m. UTC | #8
On Sun, Feb 26, 2023 at 07:15:01AM -0800, Tom Rix wrote:
> 
> On 2/21/23 8:20 AM, Simon Horman wrote:
> > +Arnd
> > 
> > On Tue, Feb 21, 2023 at 03:29:39AM +0100, Andrew Lunn wrote:
> > > On Mon, Feb 20, 2023 at 07:46:13AM +0100, Simon Horman wrote:
> > > > On Mon, Feb 20, 2023 at 02:19:34AM +0100, Andrew Lunn wrote:
> > > > > On Sun, Feb 19, 2023 at 07:16:07PM +0100, Simon Horman wrote:
> > > > > > On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
> > > > > > > A rand config causes this link error
> > > > > > > drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
> > > > > > > drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
> > > > > > > 
> > > > > > > lan743x_netdev_open is controlled by LAN743X
> > > > > > > fixed_phy_register is controlled by FIXED_PHY
> > > > > > > 
> > > > > > > So LAN743X should also select FIXED_PHY
> > > > > > > 
> > > > > > > Signed-off-by: Tom Rix <trix@redhat.com>
> > > > > > Hi Tom,
> > > > > > 
> > > > > > I am a little confused by this.
> > > > > > 
> > > > > > I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
> > > > > > But I do not see a build failure, and I believe that is because
> > > > > > when FIXED_PHY is not set then a stub version of fixed_phy_register(),
> > > > > > defined as static inline in include/linux/phy_fixed.h, is used.
> > > > > > 
> > > > > > Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42
> > > > > I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY
> > > > > is a module? What might be needed is
> > > > > 
> > > > > depends on FIXED_PHY || FIXED_PHY=n
> > > > Thanks Andrew,
> > > > 
> > > > LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom
> > > > describes. And his patch does appear to resolve the problem.
> > > O.K. So the commit message needs updating to describe the actual
> > > problem.
> > Yes, that would be a good improvement.
> > 
> > Perhaps a fixes tag too?
> > 
> > > > Unfortunately your proposed solution seems to run foul of a complex
> > > > dependency situation.
> > > I was never any good at Kconfig. Arnd is the expert at solving
> > > problems like this.
> > > 
> > > You want either everything built in, or FIXED_PHY built in and LAN743X
> > > modular, or both modular.
> > I _think_ the patch, which uses select FIXED_PHY for LAN743X,
> > achieves that.
> > 
> > I CCed Arnd in case he has any input. Though I think I read
> > in an recent email from him that he is out most of this week.
> 
> I was out last week as well :)

:)

> I considered this a cleanup rather than a fix, I can add that fixes tag.

FWIIW, I'm happy with a cleanup.
And in that chase there should be no fixes tag
(conversely, if it is a fix, then there should be a fixes tag).

As a cleanup, I suggest targeting this at net-next ([PATCH net-next]).
As net-next is currently closed you'll need to wait for it to
re-open. I expect that will happen next week, after v6.3-rc2 has been tagged.

> From my point of view this is a linking problem, I don't mind changing, 
> what commit message should I use ?

I think updating the patch description by adding something like
"This problem occurs when LAN743X=y and FIXED_PHY=m." would be sufficient.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/Kconfig b/drivers/net/ethernet/microchip/Kconfig
index 24c994baad13..43ba71e82260 100644
--- a/drivers/net/ethernet/microchip/Kconfig
+++ b/drivers/net/ethernet/microchip/Kconfig
@@ -47,6 +47,7 @@  config LAN743X
 	depends on PCI
 	depends on PTP_1588_CLOCK_OPTIONAL
 	select PHYLIB
+	select FIXED_PHY
 	select CRC16
 	select CRC32
 	help