* [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
@ 2015-11-19 0:49 ` Suravee Suthikulpanit
0 siblings, 0 replies; 10+ messages in thread
From: Suravee Suthikulpanit @ 2015-11-19 0:49 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
@ 2015-11-19 0:49 ` Suravee Suthikulpanit
0 siblings, 0 replies; 10+ messages in thread
From: Suravee Suthikulpanit @ 2015-11-19 0:49 UTC (permalink / raw)
To: rjw, bhelgaas, robin.murphy
Cc: arnd, linux-pci, linux-acpi, linux-kernel, linux-arm-kernel,
Suravee Suthikulpanit, Rafael J. Wysocki, Suravee Suthikulpanit
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
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
2015-11-19 0:49 ` Suravee Suthikulpanit
(?)
@ 2015-11-19 0:54 ` Suravee Suthikulanit
-1 siblings, 0 replies; 10+ messages in thread
From: Suravee Suthikulanit @ 2015-11-19 0:54 UTC (permalink / raw)
To: rjw, bhelgaas, robin.murphy
Cc: arnd, linux-pci, linux-acpi, linux-kernel, linux-arm-kernel,
Rafael J. Wysocki
Arg... sorry for the typo in the subject. It should say:
[PATCH] PCI: Fix OF logic in pci_dma_configure()
Suravee
On 11/18/2015 6:49 PM, Suravee Suthikulpanit wrote:
> 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);
>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
@ 2015-11-19 0:54 ` Suravee Suthikulanit
0 siblings, 0 replies; 10+ messages in thread
From: Suravee Suthikulanit @ 2015-11-19 0:54 UTC (permalink / raw)
To: linux-arm-kernel
Arg... sorry for the typo in the subject. It should say:
[PATCH] PCI: Fix OF logic in pci_dma_configure()
Suravee
On 11/18/2015 6:49 PM, Suravee Suthikulpanit wrote:
> 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);
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
@ 2015-11-19 0:54 ` Suravee Suthikulanit
0 siblings, 0 replies; 10+ messages in thread
From: Suravee Suthikulanit @ 2015-11-19 0:54 UTC (permalink / raw)
To: rjw, bhelgaas, robin.murphy
Cc: arnd, linux-pci, linux-acpi, linux-kernel, linux-arm-kernel,
Rafael J. Wysocki
Arg... sorry for the typo in the subject. It should say:
[PATCH] PCI: Fix OF logic in pci_dma_configure()
Suravee
On 11/18/2015 6:49 PM, Suravee Suthikulpanit wrote:
> 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);
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
2015-11-19 0:54 ` Suravee Suthikulanit
@ 2015-11-19 1:56 ` Rafael J. Wysocki
-1 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2015-11-19 1:56 UTC (permalink / raw)
To: Suravee Suthikulanit
Cc: bhelgaas, robin.murphy, arnd, linux-pci, linux-acpi, linux-kernel,
linux-arm-kernel, Rafael J. Wysocki
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
2015-11-19 0:49 ` Suravee Suthikulpanit
@ 2015-11-19 8:23 ` Arnd Bergmann
-1 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2015-11-19 8:23 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Suravee Suthikulpanit, rjw, bhelgaas, robin.murphy, linux-pci,
Rafael J. Wysocki, linux-kernel, linux-acpi,
Suravee Suthikulpanit
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
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH] PCI: Fix logic OF logic in pci_dma_configure()
@ 2015-11-19 8:23 ` Arnd Bergmann
0 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2015-11-19 8:23 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread