From patchwork Sat Mar 25 05:31:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 9644407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8EA6601E9 for ; Sat, 25 Mar 2017 05:47:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A05F20700 for ; Sat, 25 Mar 2017 05:47:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DD0A26490; Sat, 25 Mar 2017 05:47:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5139F20700 for ; Sat, 25 Mar 2017 05:47:05 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=y0oql2OG3oSxT4S1zxx9DwpGrIApipieyxUDJ+jLmeI=; b=lLLZzyC11dB+XsDyfV8kKHxAQ0 hSJNG1UHYM51Yn9c9H8naASnnTPVxWz3xTcfsR/++omv3+PtwjQsbd4/oNL/QDxe/6Tce+ZJaw2P2 c9F7S4/zLpnZo8Ke/02X2Da6ZR8yI2Wb8g8/vDflvTa6Pjjp0thDE9jnPqF/PwDckyOLQXf3xteHA OEehbuVrf7atLf5KSJNekRbYh5Ycggy4iOwasUbQjOflEWyNbpY8Q9NGI6b37ZRCHFhbF+au7Ao2t xahmz4Y5YHhqqCEF62rHucNECNrD/JbtEVK6TT/S2EIcxx9U5DpsSQcMc4aDIyQAu2RBfd6paaPyA F4e4/J1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1creXV-0003k5-NN; Sat, 25 Mar 2017 05:47:01 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1creJH-0006Ad-GS for linux-arm-kernel@lists.infradead.org; Sat, 25 Mar 2017 05:32:23 +0000 Received: by mail-wm0-x233.google.com with SMTP id n11so5814397wma.0 for ; Fri, 24 Mar 2017 22:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XHHlFUc/1vVyXUuc3uwVv8qnEXxJeEK0VoljnTLxdVo=; b=SRCkRtlaf54KwYH2am2JSlsPEV844Sdz/1JDu6Mq4pz59H2X0gLS0Uir7SWT1brtcP PSeRzYroNQLxbe5OMlLukcDnjcp6vj4m8fhbjfwOaW2Z1hpj/OLFDW7zdLz7YQtt4b3X 9+RlKyNSWh2wpWL81pkm5tWPtgNGwahv2LaSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XHHlFUc/1vVyXUuc3uwVv8qnEXxJeEK0VoljnTLxdVo=; b=uWGzbTN7hPizboSwN5ZU5JaX2PqouCLPMAbEE51QTx6onFVMCKSKMiU+gr/O6UfzCn 1uZlshQk9BSkowAmuFtvHsCu7CMgB6RODHxGotkPsyFpryCoIuvWIAmfHS0xJCdO+Tyn vbPfAsTM2BnIRAN6W2ivyndSBTy/4Huh5P6LdYOSNggOBOUOFIyzYlsxR78smhSHZwaw uQSITzOj6FUVjT48rvO4+it+S5T8gPiaVGGWRe2zP/vpvarZfV6j7c7HVsuTzLiaHAqY lZtjulW2eIVCvisKl9FiQFCnP/Rd748YjCWfsZoQgk3I6CHiLlVD/CeMokWg/yu/2mre tm5w== X-Gm-Message-State: AFeK/H3kTgDmwfwJcmzMcXQU3N6NEQx2/+PHnFUSrbA/X8YYy0EgtCBiW4qrBdrTINjpb1sz X-Received: by 10.28.224.69 with SMTP id x66mr651291wmg.21.1490419917511; Fri, 24 Mar 2017 22:31:57 -0700 (PDT) Received: from anjanavk-OptiPlex-7010.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id x1sm5479205wrd.63.2017.03.24.22.31.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 22:31:56 -0700 (PDT) From: Oza Pawandeep To: Joerg Roedel , Robin Murphy Subject: [RFC PATCH 3/3] of: fix node traversing in of_dma_get_range Date: Sat, 25 Mar 2017 11:01:33 +0530 Message-Id: <1490419893-5073-3-git-send-email-oza.oza@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490419893-5073-1-git-send-email-oza.oza@broadcom.com> References: <1490419893-5073-1-git-send-email-oza.oza@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170324_223220_792840_DC8EC8C2 X-CRM114-Status: UNSURE ( 8.10 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, bcm-kernel-feedback-list@broadcom.com, Oza Pawandeep , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP it jumps to the parent node without examining the child node. also with that, it throws "no dma-ranges found for node" for pci dma-ranges. this patch fixes device node traversing for dma-ranges. Reviewed-by: Anup Patel Signed-off-by: Oza Pawandeep diff --git a/drivers/of/address.c b/drivers/of/address.c index 02b2903..3293d55 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -836,9 +836,6 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz while (1) { naddr = of_n_addr_cells(node); nsize = of_n_size_cells(node); - node = of_get_next_parent(node); - if (!node) - break; ranges = of_get_property(node, "dma-ranges", &len); @@ -852,6 +849,10 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz */ if (!ranges) break; + + node = of_get_next_parent(node); + if (!node) + break; } if (!ranges) {