lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 24 Apr 2020 13:04:15 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Calvin Johnson <calvin.johnson@....nxp.com>
Cc:     linux.cj@...il.com, Jeremy Linton <jeremy.linton@....com>,
        Andrew Lunn <andrew@...n.ch>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Russell King - ARM Linux admin <linux@...linux.org.uk>,
        Cristi Sovaiala <cristian.sovaiala@....com>,
        Florin Laurentiu Chiculita <florinlaurentiu.chiculita@....com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Madalin Bucur <madalin.bucur@....nxp.com>,
        Laurentiu Tudor <laurentiu.tudor@....com>,
        linux-acpi@...r.kernel.org,
        Diana Madalina Craciun <diana.craciun@....com>,
        linux-arm-kernel@...ts.infradead.org,
        Pankaj Bansal <pankaj.bansal@....com>,
        linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        Varun Sethi <V.Sethi@....com>, Marcin Wojtas <mw@...ihalf.com>,
        Makarand Pawagi <makarand.pawagi@....com>,
        "Rajesh V . Bikkina" <rajesh.bikkina@....com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [net-next PATCH v1 1/2] device property: Introduce
 fwnode_phy_find_device()

On Fri, Apr 24, 2020 at 08:46:16AM +0530, Calvin Johnson wrote:
> Define fwnode_phy_find_device() to iterate an mdiobus and find the
> phy device of the provided phy fwnode.
> 
> Signed-off-by: Calvin Johnson <calvin.johnson@....nxp.com>
> ---
> 
>  drivers/base/property.c  | 41 ++++++++++++++++++++++++++++++++++++++++
>  include/linux/property.h |  5 +++++
>  2 files changed, 46 insertions(+)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 5f35c0ccf5e0..7c0c14c800b7 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -870,6 +870,47 @@ int device_get_phy_mode(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(device_get_phy_mode);
>  
> +/**
> + * fwnode_phy_find_device - Give a phy fwnode to find the corresponding
> + * phy_device on the mdiobus.
> + * @phy_fwnode: Pointer to the phy's fwnode.
> + *
> + * If successful, returns a pointer to the phy_device with the embedded
> + * struct device refcount incremented by one, or NULL on failure.
> + */
> +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode)
> +{
> +	struct device *d;
> +	struct mdio_device *mdiodev;
> +
> +	if (!phy_fwnode)
> +		return NULL;
> +
> +	d = bus_find_device_by_fwnode(&mdio_bus_type, phy_fwnode);
> +	if (d) {
> +		mdiodev = to_mdio_device(d);
> +		if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY)
> +			return to_phy_device(d);
> +		put_device(d);
> +	}
> +
> +	return NULL;
> +}
> +EXPORT_SYMBOL(fwnode_phy_find_device);
> +
> +/**
> + * device_phy_find_device - For the given device, get the phy_device
> + * @dev: Pointer to the given device
> + *
> + * If successful, returns a pointer to the phy_device with the embedded
> + * struct device refcount incremented by one, or NULL on failure.
> + */
> +struct phy_device *device_phy_find_device(struct device *dev)
> +{
> +	return fwnode_phy_find_device(dev_fwnode(dev));
> +}
> +EXPORT_SYMBOL_GPL(device_phy_find_device);

Let's not put any more subsystem specific functions into property.c.

thanks,

-- 
heikki

Powered by blists - more mailing lists