Message ID | 1445442731-28819-8-git-send-email-Suravee.Suthikulpanit@amd.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Hi Suravee, Some minor comments below: On 2015/10/21 23:52, Suravee Suthikulpanit wrote: [...] > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index eea8b42..09264f8 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -6,12 +6,14 @@ > #include <linux/delay.h> > #include <linux/init.h> > #include <linux/pci.h> > -#include <linux/of_pci.h> > +#include <linux/of_device.h> Seems it's needed for GICv2m patch but not this one? > #include <linux/pci_hotplug.h> > #include <linux/slab.h> > #include <linux/module.h> > #include <linux/cpumask.h> > #include <linux/pci-aspm.h> > +#include <linux/acpi.h> I think acpi.h should be introduced by the next patch. > +#include <linux/property.h> And property.h is also not needed for this patch set. Thanks Hanjun -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Suravee, On Wed, Oct 21, 2015 at 08:52:10AM -0700, Suravee Suthikulpanit wrote: > This patch move of_pci_dma_configure() to a more generic > pci_dma_configure(), which can be extended by non-OF code (e.g. ACPI). > -void of_pci_dma_configure(struct pci_dev *pci_dev) > -{ > - struct device *dev = &pci_dev->dev; > - struct device *bridge = pci_get_host_bridge_device(pci_dev); > - > - if (!bridge->parent) > - return; > - > - of_dma_configure(dev, bridge->parent->of_node); > - pci_put_host_bridge_device(bridge); > -} > +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) > + return; Don't we leak a bridge reference here? This looks like it was a problem in the original code, not something you added. Ideally I guess I would add a new patch that only fixes the leak in the original code, followed by this patch that moves it from of_pci_dma_configure() to pci_dma_configure(). > + > + of_dma_configure(&dev->dev, bridge->parent->of_node); > + } > + > + pci_put_host_bridge_device(bridge); > +} -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Hanjun, On 10/24/15 02:44, Hanjun Guo wrote: > Hi Suravee, > > Some minor comments below: > > On 2015/10/21 23:52, Suravee Suthikulpanit wrote: > [...] >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c >> index eea8b42..09264f8 100644 >> --- a/drivers/pci/probe.c >> +++ b/drivers/pci/probe.c >> @@ -6,12 +6,14 @@ >> #include <linux/delay.h> >> #include <linux/init.h> >> #include <linux/pci.h> >> -#include <linux/of_pci.h> >> +#include <linux/of_device.h> > > Seems it's needed for GICv2m patch but not this one? This one is needed since we are making use of the new of_dma_configure instead of the of_pci_dma_configure. > >> #include <linux/pci_hotplug.h> >> #include <linux/slab.h> >> #include <linux/module.h> >> #include <linux/cpumask.h> >> #include <linux/pci-aspm.h> >> +#include <linux/acpi.h> > > I think acpi.h should be introduced by the next patch. You are right. I'll update this one. > >> +#include <linux/property.h> > > And property.h is also not needed for this patch set. You are right. I'll remove this Thanks, Suravee -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 5751dc5..b66ee4e 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -117,26 +117,6 @@ int of_get_pci_domain_nr(struct device_node *node) } EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); -/** - * of_pci_dma_configure - Setup DMA configuration - * @dev: ptr to pci_dev struct of the PCI device - * - * Function to update PCI devices's DMA configuration using the same - * info from the OF node of host bridge's parent (if any). - */ -void of_pci_dma_configure(struct pci_dev *pci_dev) -{ - struct device *dev = &pci_dev->dev; - struct device *bridge = pci_get_host_bridge_device(pci_dev); - - if (!bridge->parent) - return; - - of_dma_configure(dev, bridge->parent->of_node); - pci_put_host_bridge_device(bridge); -} -EXPORT_SYMBOL_GPL(of_pci_dma_configure); - #if defined(CONFIG_OF_ADDRESS) /** * of_pci_get_host_bridge_resources - Parse PCI host bridge resources from DT diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index eea8b42..09264f8 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -6,12 +6,14 @@ #include <linux/delay.h> #include <linux/init.h> #include <linux/pci.h> -#include <linux/of_pci.h> +#include <linux/of_device.h> #include <linux/pci_hotplug.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/cpumask.h> #include <linux/pci-aspm.h> +#include <linux/acpi.h> +#include <linux/property.h> #include <asm-generic/pci-bridge.h> #include "pci.h" @@ -1635,6 +1637,27 @@ static void pci_set_msi_domain(struct pci_dev *dev) dev_get_msi_domain(&dev->bus->dev)); } +/** + * pci_dma_configure - Setup DMA configuration + * @dev: ptr to pci_dev struct of the PCI device + * + * Function to update PCI devices's DMA configuration using the same + * info from the OF node of host bridge's parent (if any). + */ +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) + return; + + of_dma_configure(&dev->dev, bridge->parent->of_node); + } + + pci_put_host_bridge_device(bridge); +} + void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { int ret; @@ -1648,7 +1671,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_parms = &dev->dma_parms; dev->dev.coherent_dma_mask = 0xffffffffull; - of_pci_dma_configure(dev); + pci_dma_configure(dev); pci_set_dma_max_seg_size(dev, 65536); pci_set_dma_seg_boundary(dev, 0xffffffff); diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 29fd3fe..ce0e5ab 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -16,7 +16,6 @@ int of_pci_get_devfn(struct device_node *np); int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); int of_pci_parse_bus_range(struct device_node *node, struct resource *res); int of_get_pci_domain_nr(struct device_node *node); -void of_pci_dma_configure(struct pci_dev *pci_dev); #else static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) { @@ -51,8 +50,6 @@ of_get_pci_domain_nr(struct device_node *node) { return -1; } - -static inline void of_pci_dma_configure(struct pci_dev *pci_dev) { } #endif #if defined(CONFIG_OF_ADDRESS)