Re: [PATCH] net: usb: lan78xx: add weak dependency with micrel phy module

From: Florian Fainelli
Date: Thu Jul 25 2024 - 00:43:07 EST




On 7/24/2024 9:25 PM, Lucas De Marchi wrote:
On Thu, Jul 25, 2024 at 12:57:05AM GMT, Andrew Lunn wrote:
For the commented case, I have included only one phy because it is the hardware
that I have, but other phy devices (modules) are possible and they can be some.

So this the whole whacker a mole problem. It works for you but fails
for 99% of users. How is this helping us?

no, this is the first instance that was found/added.

if you declare a softdep what happens is that the dep is loaded first
(needed or not) and your module is loaded after that

if you declare a weakdep, you are just instructing the tools that the
module may or may not be needed.  Any module today that does a
request_module("foo") could be a candidate to migrate from
MODULE_SOFTDEP("pre: foo") to the new weakdep, as long as it handles
properly the module being loaded ondemand as opposed to using
request_module() to just synchronize the module being loaded.


Maybe a better solution is to first build an initramfs with
everything, plus the kitchen sink. Boot it, and then look at what has
been loaded in order to get the rootfs mounted. Then update the
initramfs with just what is needed? That should be pretty generic,
with throw out networking ig NFS root is not used, just load JFFS2 and
a NAND driver if it was used for the rootfs, etc.

that works for development systems or if you are fine tuning it for each
system you have. It doesn't work for a generic distro with the kitchen
sink of modules and still trying to minimize the initrd without end user
intervention. So it works for 99% of users.

OK, but 'config USB_LAN78XX' does have a number of 'select' meaning those are hard functional dependencies, and so those should be more than a hint that these modules are necessary. Why should we encode that information twice: once in Kconfig and another time within the module .c file itself? Cannot we have better tooling to help build an initramfs which does include everything that has been selected?
--
Florian