From patchwork Fri Jul 4 15:07:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 4481721 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B24339F26C for ; Fri, 4 Jul 2014 15:09:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE8BE2026F for ; Fri, 4 Jul 2014 15:09:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1021320260 for ; Fri, 4 Jul 2014 15:09:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753485AbaGDPIs (ORCPT ); Fri, 4 Jul 2014 11:08:48 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:43725 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751554AbaGDPIp (ORCPT ); Fri, 4 Jul 2014 11:08:45 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s64F8Hfd032689; Fri, 4 Jul 2014 10:08:17 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s64F8H55020214; Fri, 4 Jul 2014 10:08:17 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 4 Jul 2014 10:08:16 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s64F8AvE014296; Fri, 4 Jul 2014 10:08:14 -0500 From: Kishon Vijay Abraham I To: , , , , , , , CC: , Subject: [RFC PATCH 1/2] phy: core: Fix of_phy_provider_lookup to return PHY provider for sub node Date: Fri, 4 Jul 2014 20:37:53 +0530 Message-ID: <1404486474-28312-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404486474-28312-1-git-send-email-kishon@ti.com> References: <1404486474-28312-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixed of_phy_provider_lookup to return 'phy_provider' if _of_phy_get passes the node pointer of the sub-node of phy provider node. This is needed when phy provider implements multiple PHYs and each PHY is modelled as the sub-node of PHY provider device node. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index c64a2f3..a4a1f783 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -86,10 +86,18 @@ static struct phy *phy_lookup(struct device *device, const char *port) static struct phy_provider *of_phy_provider_lookup(struct device_node *node) { struct phy_provider *phy_provider; + struct device_node *child; list_for_each_entry(phy_provider, &phy_provider_list, list) { - if (phy_provider->dev->of_node == node) + if (phy_provider->dev->of_node != node) { + for_each_child_of_node(phy_provider->dev->of_node, + child) { + if (child == node) + return phy_provider; + } + } else { return phy_provider; + } } return ERR_PTR(-EPROBE_DEFER);