From patchwork Tue Jul 22 10:56:44 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: 34053 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B0D4120540 for ; Tue, 22 Jul 2014 10:59:56 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f73sf28080078yha.7 for ; Tue, 22 Jul 2014 03:59:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=gpFdb9ueqHuNpIM2KqnORoLsIZitesUfh4fBStEY2+c=; b=CvkRY4K909+0oE98sockgx1U+oZowKqOm1W37leu7nGLfEkRSkODD4wyaBkfYq9av0 WoomZ/FNmGEOynrn6Y0blsEZgM6KfdWtiOcwAnGy0BTjYpCkdWUSHg11vIflIzNDtV08 hV/72rQgyUR5PCMTOtD4rYMrSLXAcJRmCcKrvuFY5cPy+r66yndxSsot7Er1rxmA28ad rUO3VwF4yONaV3yhgYycDREKcmLbFLr/caL4YdK2OisHzJs9LrUsLhitmVKySnZLqKip 1VO1FGNcz+L5xUTeN5m6OJWttfEMC6aKmBTbA86brIQH/tMdXW1kfryDSCse9T0+6ipA MLZg== X-Gm-Message-State: ALoCoQnxHVqZ4shxBPteY5zajLibd6VjH3ZK7bF5Ka47GQF43mxvlSHskwWdazXpKEkPKAKHEOO8 X-Received: by 10.236.128.112 with SMTP id e76mr13458045yhi.38.1406026796017; Tue, 22 Jul 2014 03:59:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.17 with SMTP id z17ls2327784qge.74.gmail; Tue, 22 Jul 2014 03:59:55 -0700 (PDT) X-Received: by 10.52.25.228 with SMTP id f4mr17544236vdg.62.1406026795908; Tue, 22 Jul 2014 03:59:55 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id mt8si37262vec.72.2014.07.22.03.59.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jul 2014 03:59:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so14511534vcb.32 for ; Tue, 22 Jul 2014 03:59:55 -0700 (PDT) X-Received: by 10.52.248.146 with SMTP id ym18mr32879065vdc.8.1406026795833; Tue, 22 Jul 2014 03:59:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp185788vcb; Tue, 22 Jul 2014 03:59:55 -0700 (PDT) X-Received: by 10.66.102.39 with SMTP id fl7mr32432609pab.28.1406026794735; Tue, 22 Jul 2014 03:59:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si5823pdf.402.2014.07.22.03.59.54; Tue, 22 Jul 2014 03:59:54 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755285AbaGVK7w (ORCPT + 12 others); Tue, 22 Jul 2014 06:59:52 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:56791 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754853AbaGVK5n (ORCPT ); Tue, 22 Jul 2014 06:57:43 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6MAvg6G005812; Tue, 22 Jul 2014 05:57:42 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6MAvgNZ018832; Tue, 22 Jul 2014 05:57:42 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Tue, 22 Jul 2014 05:57:42 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6MAv7r0027221; Tue, 22 Jul 2014 05:57:41 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 21/28] phy: core: Fix of_phy_provider_lookup to return PHY provider for sub node Date: Tue, 22 Jul 2014 16:26:44 +0530 Message-ID: <1406026611-30493-22-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406026611-30493-1-git-send-email-kishon@ti.com> References: <1406026611-30493-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Acked-by: Lee Jones --- drivers/phy/phy-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 75c9739..527e744 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -87,10 +87,15 @@ 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) return phy_provider; + + for_each_child_of_node(phy_provider->dev->of_node, child) + if (child == node) + return phy_provider; } return ERR_PTR(-EPROBE_DEFER);