From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A04FFC54FCB for ; Fri, 24 Apr 2020 10:04:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 515B420767 for ; Fri, 24 Apr 2020 10:04:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QEYxstk1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 515B420767 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r2t40Io+CZm35JK2YH5USg9fKVgBldZcJfEtJT5yRVY=; b=QEYxstk1tqzoAE VmJqCmnqA4iWktFTxCGbVsB/VeYY0yy/RP4+7Pg1APcEsQzawLfX4YkPwww2d1Yfp9ch+mkhQa6rr qllQmCgkwWvZA0ABgudgI1JYnP/sEDYb8R5RiIVAEaa2lYwSUs2SoqMvmzOz3q/o1INuVPkd5PqMY sc8IruucQUcSVGKBfZXRW20brWrWdiE5UY+c5byNsw+ZLZVRyOXbFjTNMeAb05CQZ8A/BOA0PP2YX VmpStpXqbJxsiQFi5RnDkAQWHzhoTnEBmWD1kj8z4TKBZpaqGe3JsAGhmSeCyLGKPTU9KPM8caVJi I/K+eTMILzE9CQnuf/ag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRvC6-0005It-7q; Fri, 24 Apr 2020 10:04:26 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRvC3-0005Hw-CY for linux-arm-kernel@lists.infradead.org; Fri, 24 Apr 2020 10:04:24 +0000 IronPort-SDR: qh2hH1g9TCvfFIki7fQ7vObJc2ekSUBicdpDT5ZXhtbUozeTk2gu+8YBnhl1vpqjoTqlInB0vf 8zIU/N3mWRbQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 03:04:22 -0700 IronPort-SDR: 0rZ8bHp+me5uUBc2xp4wacOWeGz9KMvj9xxyBNfUJ9cPDNC6hHi/MaFgNt6E34vFpUvmg9UlRC +YWwO73fwrWQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,311,1583222400"; d="scan'208";a="366299723" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 24 Apr 2020 03:04:15 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 24 Apr 2020 13:04:15 +0300 Date: Fri, 24 Apr 2020 13:04:15 +0300 From: Heikki Krogerus To: Calvin Johnson Subject: Re: [net-next PATCH v1 1/2] device property: Introduce fwnode_phy_find_device() Message-ID: <20200424100415.GA1575367@kuha.fi.intel.com> References: <20200424031617.24033-1-calvin.johnson@oss.nxp.com> <20200424031617.24033-2-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200424031617.24033-2-calvin.johnson@oss.nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200424_030423_435177_C062FCB3 X-CRM114-Status: GOOD ( 17.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , "Rafael J. Wysocki" , Andy Shevchenko , Cristi Sovaiala , Ioana Ciornei , Florian Fainelli , "Rajesh V . Bikkina" , Pankaj Bansal , Russell King - ARM Linux admin , Diana Madalina Craciun , linux-acpi@vger.kernel.org, Andy Shevchenko , Florin Laurentiu Chiculita , Sakari Ailus , Madalin Bucur , Makarand Pawagi , Varun Sethi , Thomas Gleixner , Marcin Wojtas , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor , netdev@vger.kernel.org, Dmitry Torokhov , linux-kernel@vger.kernel.org, Jeremy Linton , linux.cj@gmail.com, Greg Kroah-Hartman Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > --- > > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel