Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1272723 > unrolled thread

[PATCH] PCI: Fix logic OF logic in pci_dma_configure()

Started bySuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
First post2015-11-19 02:00 +0100
Last post2015-11-19 09:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] PCI: Fix logic OF logic in pci_dma_configure() Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2015-11-19 02:00 +0100
    Re: [PATCH] PCI: Fix logic OF logic in pci_dma_configure() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-11-19 02:30 +0100
    Re: [PATCH] PCI: Fix logic OF logic in pci_dma_configure() Arnd Bergmann <arnd@arndb.de> - 2015-11-19 09:30 +0100

#1272723 — [PATCH] PCI: Fix logic OF logic in pci_dma_configure()

FromSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Date2015-11-19 02:00 +0100
Subject[PATCH] PCI: Fix logic OF logic in pci_dma_configure()
Message-ID<qwlJT-2a0-7@gated-at.bofh.it>
This patch fixes a bug introduced by previous commit,
which incorrectly checkes the of_node of the end-point device.
Instead, it should check the of_node of the host bridge.

Fixes: 50230713b639 ("PCI: OF: Move of_pci_dma_configure() to pci_dma_configure()")
Reported-by: Robin Murphy <robin.murphy@arm.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/pci/probe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e735c72..edb1984 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1685,8 +1685,8 @@ static void pci_dma_configure(struct pci_dev *dev)
 {
 	struct device *bridge = pci_get_host_bridge_device(dev);
 
-	if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) {
-		if (bridge->parent)
+	if (IS_ENABLED(CONFIG_OF) &&
+		bridge->parent && bridge->parent->of_node) {
 			of_dma_configure(&dev->dev, bridge->parent->of_node);
 	} else if (has_acpi_companion(bridge)) {
 		struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1272735

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2015-11-19 02:30 +0100
Message-ID<qwmcW-2AA-15@gated-at.bofh.it>
In reply to#1272723
On Wednesday, November 18, 2015 06:54:16 PM Suravee Suthikulanit wrote:
> Arg... sorry for the typo in the subject. It should say:
> 
> [PATCH] PCI: Fix OF logic in pci_dma_configure()

OK, applied.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1272927

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-19 09:30 +0100
Message-ID<qwsLn-6Qc-1@gated-at.bofh.it>
In reply to#1272723
On Wednesday 18 November 2015 16:49:52 Suravee Suthikulpanit wrote:
> -       if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) {
> -               if (bridge->parent)
> +       if (IS_ENABLED(CONFIG_OF) &&
> +               bridge->parent && bridge->parent->of_node) {
>                         of_dma_configure(&dev->dev, bridge->parent->of_node);
> 

Acked-by: Arnd Bergmann <arnd@arndb.de>

I was wondering for a bit whether we should warn about the case where there
is no of_node pointer, as that would mean we cannot do DMA on that PCI
device, but on second thought we have to do it exactly like you do, because
we would otherwise break machines that do not use DT.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web