diff options
author | Loic Poulain <loic.poulain@linaro.org> | 2021-06-04 09:17:14 +0200 |
---|---|---|
committer | Loic Poulain <loic.poulain@linaro.org> | 2021-06-04 12:05:21 +0200 |
commit | fd7e6d78ebad9930d22e5b5f430cae9ad5fc89fe (patch) | |
tree | 126b58647fcde6e7188b5e932d10a43cb601e9eb | |
parent | 7f3f5cdfe208d598fac631bfdde8c13bdd063258 (diff) |
[FIXUP] net: wwan: core: wwan_dev_get_by_parent support for netdev
wwan_dev_get_by_parent is used to find a wwan device based on a
'parent' pointer, which is usually the device representing the
wwan hardware, like a USB device, a MHI controller, etc... Ensuring
that devices that share the same 'wwan hardware' will be linked to
the same wwan device instance.
However with the support of WWAN link creation (via rtnetlink), a
'virtual' netdev is by default direct child of the wwan device and
so netdev parent must be considered as the wwan device to return.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
-rw-r--r-- | drivers/net/wwan/wwan_core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 32b2096c50369..5829c00a7586d 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -84,7 +84,8 @@ static const struct device_type wwan_dev_type = { static int wwan_dev_parent_match(struct device *dev, const void *parent) { - return (dev->type == &wwan_dev_type && dev->parent == parent); + return (dev->type == &wwan_dev_type && + (dev->parent == parent || dev == parent)); } static struct wwan_device *wwan_dev_get_by_parent(struct device *parent) |