net: phy: don't abuse devres in devm_mdiobus_register()
We currently have two managed helpers for mdiobus - devm_mdiobus_alloc() and devm_mdiobus_register(). The idea behind devres is that the release callback releases whatever resource the devm function allocates. In the mdiobus case however there's no devres associated with the device by devm_mdiobus_register(). Instead the release callback for devm_mdiobus_alloc(): _devm_mdiobus_free() unregisters the device if it is marked as managed. This all seems wrong. The managed structure shouldn't need to know or care about whether it's managed or not - and this is the case now for struct mii_bus. The devres wrapper should be opaque to the managed resource. This changeset makes devm_mdiobus_alloc() and devm_mdiobus_register() conform to common devres standards: devm_mdiobus_alloc() allocates a devres structure and registers a callback that will call mdiobus_free(). __devm_mdiobus_register() allocated another devres and registers a callback that will unregister the bus. Signed-off-by:Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
David S. Miller <davem@davemloft.net>
parent
6a9a5723
-
mentioned in commit 43c880b8
-
mentioned in commit 2eaa39d8
-
mentioned in commit 880ee7cf
-
mentioned in commit 5e95328a
-
mentioned in commit 46b74723
-
mentioned in commit aae1c6a1
-
mentioned in commit caabb5f6
-
mentioned in commit 8cda7577
-
mentioned in commit b5652bc5
-
mentioned in commit 8b626d45
-
mentioned in commit 2770b795
-
mentioned in commit 95e5402f
-
mentioned in commit 8ccebe77
-
mentioned in commit 475ce5dc
-
mentioned in commit e177d2e8
Please register or sign in to comment