• Linus Walleij's avatar
    net: ethernet: ixp4xx: Standard module init · c83db9ef
    Linus Walleij authored
    The IXP4xx driver was initializing the MDIO bus before even
    probing, in the callbacks supposed to be used for setting up
    the module itself, and with the side effect of trying to
    register the MDIO bus as soon as this module was loaded or
    compiled into the kernel whether the device was discovered
    or not.
    
    This does not work with multiplatform environments.
    
    To get rid of this: set up the MDIO bus from the probe()
    callback and remove it in the remove() callback. Rename
    the probe() and remove() calls to reflect the most common
    conventions.
    
    Since there is a bit of checking for the ethernet feature
    to be present in the MDIO registering function, making the
    whole module not even be registered if we can't find an
    MDIO bus, we need something similar: register the MDIO
    bus when the corresponding ethernet is probed, and
    return -EPROBE_DEFER on the other interfaces until this
    happens. If no MDIO bus is present on any of the
    registered interfaces we will eventually bail out.
    
    None of the platforms I've seen has e.g. MDIO on EthB
    and only uses EthC, there is always a Ethernet hardware
    on the NPE (B, C) that has the MDIO bus, we just might
    have to wait for it.
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    c83db9ef
ixp4xx_eth.c 38.4 KB