* Re: [net-next: PATCH 07/12] net: mdio: allow registering non-PHY devices in ACPI world
@ 2022-06-21 4:37 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-06-21 4:37 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 16193 bytes --]
::::::
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check first_new_problem: include/asm-generic/rwonce.h:44:26: warning: dereference of NULL '<unknown>' [CWE-476] [-Wanalyzer-null-dereference]"
::::::
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220620150225.1307946-8-mw@semihalf.com>
References: <20220620150225.1307946-8-mw@semihalf.com>
TO: Marcin Wojtas <mw@semihalf.com>
TO: linux-kernel(a)vger.kernel.org
TO: linux-acpi(a)vger.kernel.org
TO: netdev(a)vger.kernel.org
CC: rafael(a)kernel.org
CC: andriy.shevchenko(a)linux.intel.com
CC: lenb(a)kernel.org
CC: andrew(a)lunn.ch
CC: vivien.didelot(a)gmail.com
CC: f.fainelli(a)gmail.com
CC: olteanv(a)gmail.com
CC: davem(a)davemloft.net
CC: edumazet(a)google.com
CC: kuba(a)kernel.org
CC: pabeni(a)redhat.com
CC: linux(a)armlinux.org.uk
CC: hkallweit1(a)gmail.com
CC: gjb(a)semihalf.com
CC: mw(a)semihalf.com
CC: jaz(a)semihalf.com
CC: tn(a)semihalf.com
CC: Samer.El-Haj-Mahmoud(a)arm.com
CC: upstream(a)semihalf.com
Hi Marcin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on robh/for-next linus/master v5.19-rc2 next-20220617]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Marcin-Wojtas/ACPI-support-for-DSA/20220620-231646
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: i386-randconfig-c001 (https://download.01.org/0day-ci/archive/20220621/202206211240.eoGOEICS-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3971d5dc91ab6b9c21f20cc7c431aca0a8ea6740
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Marcin-Wojtas/ACPI-support-for-DSA/20220620-231646
git checkout 3971d5dc91ab6b9c21f20cc7c431aca0a8ea6740
# save the config file
ARCH=i386 KBUILD_USERCFLAGS='-fanalyzer -Wno-error'
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
gcc-analyzer warnings: (new ones prefixed by >>)
| 65 | int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
| | ^~~~~~~~~~~~~~~~~~~~~
| | |
| | (1) entry to 'acpi_mdiobus_register.part.0'
|
'acpi_mdiobus_register.part.0': event 2
|
| 80 | fwnode_for_each_child_node(fwnode, child) {
| | ^~~~~
| | |
| | (2) following 'true' branch (when 'child' is non-NULL)...
include/linux/property.h:105:64: note: in definition of macro 'fwnode_for_each_child_node'
| 105 | for (child = fwnode_get_next_child_node(fwnode, NULL); child; \
| | ^~~~~
|
'acpi_mdiobus_register.part.0': event 3
|
|include/acpi/acpi_bus.h:421:17:
| 421 | is_acpi_device_node(__to_acpi_device_node_fwnode) ? \
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (3) ...to here
include/linux/acpi.h:48:52: note: in expansion of macro 'to_acpi_device_node'
| 48 | acpi_device_handle(to_acpi_device_node(fwnode))
| | ^~~~~~~~~~~~~~~~~~~
drivers/net/mdio/acpi_mdio.c:81:46: note: in expansion of macro 'ACPI_HANDLE_FWNODE'
| 81 | ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr);
| | ^~~~~~~~~~~~~~~~~~
|
'acpi_mdiobus_register.part.0': events 4-6
|
| 82 | if (ret || addr >= PHY_MAX_ADDR)
| | ^
| | |
| | (4) following 'false' branch...
|......
| 85 | if (acpi_mdiobus_child_is_phy(child))
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (5) ...to here
| | (6) calling 'acpi_mdiobus_child_is_phy' from 'acpi_mdiobus_register.part.0'
|
+--> 'acpi_mdiobus_child_is_phy': event 7
|
| 32 | static bool acpi_mdiobus_child_is_phy(struct fwnode_handle *child)
| | ^~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (7) entry to 'acpi_mdiobus_child_is_phy'
|
'acpi_mdiobus_child_is_phy': event 8
|
|include/acpi/acpi_bus.h:423:66:
| 423 | struct acpi_device, fwnode) : \
drivers/net/mdio/acpi_mdio.c:34:36: note: in expansion of macro 'to_acpi_device_node'
| 34 | struct acpi_device *adev = to_acpi_device_node(child);
| | ^~~~~~~~~~~~~~~~~~~
|
'acpi_mdiobus_child_is_phy': events 9-15
|
| 37 | if (fwnode_get_phy_id(child, &phy_id) != -EINVAL)
| | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | ||
| | |(9) ...to here
| | (10) following 'false' branch...
|......
| 40 | if (fwnode_property_match_string(child, "compatible",
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | ||
| | |(11) ...to here
| | (12) following 'false' branch...
| 41 | "ethernet-phy-ieee802.3-c45") == 0)
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|......
| 44 | if (fwnode_property_match_string(child, "compatible",
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | ||
| | |(13) ...to here
| | (14) following 'false' branch...
| 45 | "ethernet-phy-ieee802.3-c22") == 0)
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|......
| 49 | if (list_empty(&adev->pnp.ids))
| | ~~~~~~~~~~~~~~
| | |
| | (15) ...to here
|
'acpi_mdiobus_child_is_phy': event 16
|
|include/asm-generic/rwonce.h:44:26:
| 44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (16) dereference of NULL '<unknown>'
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
| 50 | __READ_ONCE(x); \
| | ^~~~~~~~~~~
include/linux/list.h:292:16: note: in expansion of macro 'READ_ONCE'
| 292 | return READ_ONCE(head->next) == head;
| | ^~~~~~~~~
|
>> include/asm-generic/rwonce.h:44:26: warning: dereference of NULL '<unknown>' [CWE-476] [-Wanalyzer-null-dereference]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
include/linux/list.h:292:16: note: in expansion of macro 'READ_ONCE'
292 | return READ_ONCE(head->next) == head;
| ^~~~~~~~~
'acpi_mdiobus_register.part.0': event 1
|
|drivers/net/mdio/acpi_mdio.c:65:5:
| 65 | int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
| | ^~~~~~~~~~~~~~~~~~~~~
| | |
| | (1) entry to 'acpi_mdiobus_register.part.0'
|
'acpi_mdiobus_register.part.0': event 2
|
| 80 | fwnode_for_each_child_node(fwnode, child) {
| | ^~~~~
| | |
| | (2) following 'true' branch (when 'child' is non-NULL)...
include/linux/property.h:105:64: note: in definition of macro 'fwnode_for_each_child_node'
| 105 | for (child = fwnode_get_next_child_node(fwnode, NULL); child; \
| | ^~~~~
|
'acpi_mdiobus_register.part.0': event 3
|
|include/acpi/acpi_bus.h:421:17:
| 421 | is_acpi_device_node(__to_acpi_device_node_fwnode) ? \
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (3) ...to here
include/linux/acpi.h:48:52: note: in expansion of macro 'to_acpi_device_node'
| 48 | acpi_device_handle(to_acpi_device_node(fwnode))
| | ^~~~~~~~~~~~~~~~~~~
drivers/net/mdio/acpi_mdio.c:81:46: note: in expansion of macro 'ACPI_HANDLE_FWNODE'
| 81 | ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr);
| | ^~~~~~~~~~~~~~~~~~
|
'acpi_mdiobus_register.part.0': event 4
|
|include/acpi/acpi_bus.h:423:66:
| 423 | struct acpi_device, fwnode) : \
include/linux/acpi.h:48:52: note: in expansion of macro 'to_acpi_device_node'
| 48 | acpi_device_handle(to_acpi_device_node(fwnode))
| | ^~~~~~~~~~~~~~~~~~~
drivers/net/mdio/acpi_mdio.c:81:46: note: in expansion of macro 'ACPI_HANDLE_FWNODE'
| 81 | ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr);
| | ^~~~~~~~~~~~~~~~~~
|
'acpi_mdiobus_register.part.0': event 5
|
|include/linux/container_of.h:22:10:
| 22 | ((type *)(__mptr - offsetof(type, member))); })
| | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (5) ...to here
include/acpi/acpi_bus.h:422:25: note: in expansion of macro 'container_of'
| 422 | container_of(__to_acpi_device_node_fwnode, \
| | ^~~~~~~~~~~~
include/linux/acpi.h:48:52: note: in expansion of macro 'to_acpi_device_node'
| 48 | acpi_device_handle(to_acpi_device_node(fwnode))
| | ^~~~~~~~~~~~~~~~~~~
drivers/net/mdio/acpi_mdio.c:81:46: note: in expansion of macro 'ACPI_HANDLE_FWNODE'
| 81 | ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr);
| | ^~~~~~~~~~~~~~~~~~
|
'acpi_mdiobus_register.part.0': event 6
|
|include/linux/acpi.h:40:36:
| 40 | return adev ? adev->handle : NULL;
|
'acpi_mdiobus_register.part.0': events 7-10
|
|drivers/net/mdio/acpi_mdio.c:81:23:
| 81 | ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (7) ...to here
| 82 | if (ret || addr >= PHY_MAX_ADDR)
| | ~
| | |
| | (8) following 'false' branch...
|......
| 85 | if (acpi_mdiobus_child_is_phy(child))
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (9) ...to here
| | (10) calling 'acpi_mdiobus_child_is_phy' from 'acpi_mdiobus_register.part.0'
|
+--> 'acpi_mdiobus_child_is_phy': event 11
|
| 32 | static bool acpi_mdiobus_child_is_phy(struct fwnode_handle *child)
| | ^~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (11) entry to 'acpi_mdiobus_child_is_phy'
|
'acpi_mdiobus_child_is_phy': event 12
|
vim +44 include/asm-generic/rwonce.h
e506ea451254ab Will Deacon 2019-10-15 28
e506ea451254ab Will Deacon 2019-10-15 29 /*
e506ea451254ab Will Deacon 2019-10-15 30 * Yes, this permits 64-bit accesses on 32-bit architectures. These will
e506ea451254ab Will Deacon 2019-10-15 31 * actually be atomic in some cases (namely Armv7 + LPAE), but for others we
e506ea451254ab Will Deacon 2019-10-15 32 * rely on the access being split into 2x32-bit accesses for a 32-bit quantity
e506ea451254ab Will Deacon 2019-10-15 33 * (e.g. a virtual address) and a strong prevailing wind.
e506ea451254ab Will Deacon 2019-10-15 34 */
e506ea451254ab Will Deacon 2019-10-15 35 #define compiletime_assert_rwonce_type(t) \
e506ea451254ab Will Deacon 2019-10-15 36 compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
e506ea451254ab Will Deacon 2019-10-15 37 "Unsupported access size for {READ,WRITE}_ONCE().")
e506ea451254ab Will Deacon 2019-10-15 38
e506ea451254ab Will Deacon 2019-10-15 39 /*
e506ea451254ab Will Deacon 2019-10-15 40 * Use __READ_ONCE() instead of READ_ONCE() if you do not require any
3c9184109e78ea Will Deacon 2019-10-30 41 * atomicity. Note that this may result in tears!
e506ea451254ab Will Deacon 2019-10-15 42 */
b78b331a3f5c07 Will Deacon 2019-10-15 43 #ifndef __READ_ONCE
e506ea451254ab Will Deacon 2019-10-15 @44 #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
b78b331a3f5c07 Will Deacon 2019-10-15 45 #endif
e506ea451254ab Will Deacon 2019-10-15 46
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 2+ messages in thread* [net-next: PATCH 00/12] ACPI support for DSA
@ 2022-06-20 15:02 Marcin Wojtas
2022-06-20 15:02 ` [net-next: PATCH 07/12] net: mdio: allow registering non-PHY devices in ACPI world Marcin Wojtas
0 siblings, 1 reply; 2+ messages in thread
From: Marcin Wojtas @ 2022-06-20 15:02 UTC (permalink / raw)
To: linux-kernel, linux-acpi, netdev
Cc: rafael, andriy.shevchenko, lenb, andrew, vivien.didelot,
f.fainelli, olteanv, davem, edumazet, kuba, pabeni, linux,
hkallweit1, gjb, mw, jaz, tn, Samer.El-Haj-Mahmoud, upstream
Hi!
This patchset introduces the support for DSA in ACPI world. A couple of
words about the background and motivation behind those changes:
The DSA code is strictly dependent on the Device Tree and Open Firmware
(of_*) interface, both in the drivers and the common high-level net/dsa API.
The only alternative is to pass the information about the topology via
platform data - a legacy approach used by older systems that compiled the
board description into the kernel.
The above constraint is problematic for the embedded devices based e.g. on
x86_64 SoCs, which are described by ACPI tables - to use DSA, some tricks
and workarounds have to be applied. Addition of switch description to
DSDT/SSDT tables would help to solve many similar cases and use unmodified
kernel modules. It also enables this feature for ARM64 ACPI users.
The key enablements allowing for adding ACPI support for DSA in Linux were
NIC drivers, MDIO, PHY, and phylink modifications – the latter three merged
in 2021. I thought it would be worth to experiment with DSA, which seemed
to be a natural follow-up challenge.
It turned out that without much hassle it is possible to describe
DSA-compliant switches as child devices of the MDIO busses, which are
responsible for their enumeration based on the standard _ADR fields and
description in _DSD objects under 'device properties' UUID [1].
The vast majority of required changes were simple of_* to fwnode_*
transition, as the DT and ACPI topolgies are analogous, except for
'ports' and 'mdio' subnodes naming, as they don't conform ACPI
namespace constraints [2].
The patchset can be logically split to subsets of commits:
* Move a couple of missing routines to fwnode_ equivalents
* Rework net/dsa to use fwnode_*/device_* API
* Introduce fwnode_mdiobus_register_device() and allow MDIO device probing
in ACPI world.
* Add necessary ACPI-related modifications to net/dsa and add Documentation
entry.
* Shift example mv88e6xxx driver to fwnode_*/device_* and add ACPI hooks.
The changes details can be found in the commit messages.
Note that for now cascade topology remains unsupported in ACPI world
(based on "dsa" label and "link" property values). It seems to be feasible,
but would extend this patchset due to necessity of of_phandle_iterator
migration to fwnode_. Leave it as a possible future step.
Testing:
* EACH commit was tested against regression with device tree on EspressoBIN
and SolidRun CN913x CEx7 Evaluation board. It works as expected throughout
entire patchset.
* The latter board was used as example ACPI user of the feature - it's 1:1
to what's available when booting with DT. Please check [3] and [4] to
compare the DT/ACPI description.
For convenience, this patchset is also available on a public branch [5].
I am looking forward to any comments or remarks, your review will be
appreciated.
Best regards,
Marcin
[1] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
[2] https://uefi.org/specs/ACPI/6.4/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#acpi-namespace
[3] https://github.com/semihalf-wojtas-marcin/edk2-platforms/commit/6368ee09a232c1348e19729f21c05e9c5410cdb9
[4] https://github.com/tianocore/edk2-non-osi/blob/master/Silicon/Marvell/OcteonTx/DeviceTree/T91/cn9130-cex7.dts#L252
[5] https://github.com/semihalf-wojtas-marcin/Linux-Kernel/commits/dsa-acpi-v1
Marcin Wojtas (12):
net: phy: fixed_phy: switch to fwnode_ API
net: mdio: switch fixed-link PHYs API to fwnode_
net: dsa: switch to device_/fwnode_ APIs
net: mvpp2: initialize port fwnode pointer
net: core: switch to fwnode_find_net_device_by_node()
net: mdio: introduce fwnode_mdiobus_register_device()
net: mdio: allow registering non-PHY devices in ACPI world
ACPI: scan: prevent double enumeration of MDIO bus children
Documentation: ACPI: DSD: introduce DSA description
net: dsa: add ACPI support
net: dsa: mv88e6xxx: switch to device_/fwnode_ APIs
net: dsa: mv88e6xxx: add ACPI support
include/linux/etherdevice.h | 1 +
include/linux/fwnode_mdio.h | 22 ++
include/linux/of_net.h | 6 -
include/linux/phy_fixed.h | 4 +-
include/net/dsa.h | 1 +
drivers/acpi/scan.c | 15 +
drivers/net/dsa/mv88e6xxx/chip.c | 76 +++--
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 +
drivers/net/mdio/acpi_mdio.c | 40 ++-
drivers/net/mdio/fwnode_mdio.c | 129 +++++++
drivers/net/mdio/of_mdio.c | 105 +-----
drivers/net/phy/fixed_phy.c | 37 +-
drivers/net/phy/mdio_bus.c | 4 +
net/core/net-sysfs.c | 18 +-
net/dsa/dsa2.c | 104 ++++--
net/dsa/port.c | 54 ++-
net/dsa/slave.c | 6 +-
Documentation/firmware-guide/acpi/dsd/dsa.rst | 359 ++++++++++++++++++++
Documentation/firmware-guide/acpi/index.rst | 1 +
19 files changed, 748 insertions(+), 235 deletions(-)
create mode 100644 Documentation/firmware-guide/acpi/dsd/dsa.rst
--
2.29.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [net-next: PATCH 07/12] net: mdio: allow registering non-PHY devices in ACPI world
2022-06-20 15:02 [net-next: PATCH 00/12] ACPI support for DSA Marcin Wojtas
@ 2022-06-20 15:02 ` Marcin Wojtas
0 siblings, 0 replies; 2+ messages in thread
From: Marcin Wojtas @ 2022-06-20 15:02 UTC (permalink / raw)
To: linux-kernel, linux-acpi, netdev
Cc: rafael, andriy.shevchenko, lenb, andrew, vivien.didelot,
f.fainelli, olteanv, davem, edumazet, kuba, pabeni, linux,
hkallweit1, gjb, mw, jaz, tn, Samer.El-Haj-Mahmoud, upstream
This patch utilizes the newly added fwnode_mdiobus_register_device
function and enables registration of non-PHY MDIO devices.
For that purpose a helper routine is added, allowing to determine,
whether the device associated to ACPI node is a PHY.
In addition to that update, allow matching child devices' drivers
based on their ACPI ID.
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
drivers/net/mdio/acpi_mdio.c | 40 +++++++++++++++++++-
drivers/net/phy/mdio_bus.c | 4 ++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mdio/acpi_mdio.c b/drivers/net/mdio/acpi_mdio.c
index d77c987fda9c..b5d7404afc5e 100644
--- a/drivers/net/mdio/acpi_mdio.c
+++ b/drivers/net/mdio/acpi_mdio.c
@@ -17,6 +17,41 @@
MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
MODULE_LICENSE("GPL");
+/**
+ * acpi_mdiobus_child_is_phy - check if device associated with fwnode is a PHY.
+ * @fwnode: pointer to MDIO bus child fwnode and is expected to represent ACPI
+ * device object.
+ *
+ * The function returns true if the child node is for a PHY.
+ * It must comprise either:
+ * o Compatible string of "ethernet-phy-idX.X"
+ * o Compatible string of "ethernet-phy-ieee802.3-c45"
+ * o Compatible string of "ethernet-phy-ieee802.3-c22"
+ * o No _HID or _CID fields.
+ */
+static bool acpi_mdiobus_child_is_phy(struct fwnode_handle *child)
+{
+ struct acpi_device *adev = to_acpi_device_node(child);
+ u32 phy_id;
+
+ if (fwnode_get_phy_id(child, &phy_id) != -EINVAL)
+ return true;
+
+ if (fwnode_property_match_string(child, "compatible",
+ "ethernet-phy-ieee802.3-c45") == 0)
+ return true;
+
+ if (fwnode_property_match_string(child, "compatible",
+ "ethernet-phy-ieee802.3-c22") == 0)
+ return true;
+
+ /* Default to PHY if no _HID or _CID found in the fwnode. */
+ if (list_empty(&adev->pnp.ids))
+ return true;
+
+ return false;
+}
+
/**
* acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL.
* @mdio: pointer to mii_bus structure
@@ -47,7 +82,10 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
if (ret || addr >= PHY_MAX_ADDR)
continue;
- ret = fwnode_mdiobus_register_phy(mdio, child, addr);
+ if (acpi_mdiobus_child_is_phy(child))
+ ret = fwnode_mdiobus_register_phy(mdio, child, addr);
+ else
+ ret = fwnode_mdiobus_register_device(mdio, child, addr);
if (ret == -ENODEV)
dev_err(&mdio->dev,
"MDIO device at address %d is missing.\n",
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 8a2dbe849866..b3c2f966be4b 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/errno.h>
@@ -989,6 +990,9 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
if (of_driver_match_device(dev, drv))
return 1;
+ if (acpi_driver_match_device(dev, drv))
+ return 1;
+
if (mdio->bus_match)
return mdio->bus_match(dev, drv);
--
2.29.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-21 4:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-21 4:37 [net-next: PATCH 07/12] net: mdio: allow registering non-PHY devices in ACPI world kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-06-20 15:02 [net-next: PATCH 00/12] ACPI support for DSA Marcin Wojtas
2022-06-20 15:02 ` [net-next: PATCH 07/12] net: mdio: allow registering non-PHY devices in ACPI world Marcin Wojtas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.