[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180420215926.GA28568@lunn.ch>
Date: Fri, 20 Apr 2018 23:59:26 +0200
From: Andrew Lunn <andrew@...n.ch>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org, f.fainelli@...il.com,
vivien.didelot@...oirfairelinux.com
Subject: Re: [PATCH net-next] net: phy: mdio-boardinfo: Allow recursive
mdiobus_register()
On Fri, Apr 20, 2018 at 10:34:30AM -0400, David Miller wrote:
> From: Andrew Lunn <andrew@...n.ch>
> Date: Thu, 19 Apr 2018 02:00:47 +0200
>
> > mdiobus_register will search for any mdiobus board info registered for
> > the bus being registered. If found, it will probe devices on the bus.
> > That device, if for example it is an ethernet switch, may then try to
> > register an mdio bus. Thus we need to allow recursive calls to
> > mdiobus_register.
> >
> > Holding the mdio_board_lock will cause a deadlock during this
> > recursion. Release the lock and use list_for_each_entry_safe.
> >
> > Signed-off-by: Andrew Lunn <andrew@...n.ch>
>
> Applied.
>
> While looking over this code I see that we currently never unregister
> mdio boardinfo objects.
>
> If we have drivers that can be unloaded, as it seems the one you plan
> to add that needs this change should be, the situation could get more
> tricky here.
Hi David
That is in fact normal, if you look at the i2c and spi versions of
this. This is/was generally used for ARM platforms, from before the
times of DT. There was a board file setting up platform devices for
the different bits of the hardware. The hardware never goes away, so
there is no need to remove the description of the hardware, what
devices are on which bus, etc. The drivers for that hardware can
however be removed.
The platform i'm working on is however x86. So i don't have a board
file as such, just a driver which gets loaded because of matches with
ACPI DMI strings. It populates this mdio boardinfo, as well as i2c
boardinfo, causing other drivers to be loaded. And i don't implement a
remove function, so the driver can never be unloaded. I'm happy with
that.
Andrew
Powered by blists - more mailing lists