Commit 445f8249 authored by Geliang Tang's avatar Geliang Tang Committed by Greg Kroah-Hartman

vme: vme_ca91cx42.c: use to_pci_dev()

Use to_pci_dev() instead of open-coding it.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Acked-by: default avatarMartyn Welch <martyn@welchs.me.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c37ff3fb
...@@ -202,7 +202,7 @@ static int ca91cx42_irq_init(struct vme_bridge *ca91cx42_bridge) ...@@ -202,7 +202,7 @@ static int ca91cx42_irq_init(struct vme_bridge *ca91cx42_bridge)
bridge = ca91cx42_bridge->driver_priv; bridge = ca91cx42_bridge->driver_priv;
/* Need pdev */ /* Need pdev */
pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev); pdev = to_pci_dev(ca91cx42_bridge->parent);
INIT_LIST_HEAD(&ca91cx42_bridge->vme_error_handlers); INIT_LIST_HEAD(&ca91cx42_bridge->vme_error_handlers);
...@@ -293,8 +293,7 @@ static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level, ...@@ -293,8 +293,7 @@ static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level,
iowrite32(tmp, bridge->base + LINT_EN); iowrite32(tmp, bridge->base + LINT_EN);
if ((state == 0) && (sync != 0)) { if ((state == 0) && (sync != 0)) {
pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, pdev = to_pci_dev(ca91cx42_bridge->parent);
dev);
synchronize_irq(pdev->irq); synchronize_irq(pdev->irq);
} }
...@@ -518,7 +517,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image, ...@@ -518,7 +517,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n"); dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
return -EINVAL; return -EINVAL;
} }
pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev); pdev = to_pci_dev(ca91cx42_bridge->parent);
existing_size = (unsigned long long)(image->bus_resource.end - existing_size = (unsigned long long)(image->bus_resource.end -
image->bus_resource.start); image->bus_resource.start);
...@@ -1519,7 +1518,7 @@ static void *ca91cx42_alloc_consistent(struct device *parent, size_t size, ...@@ -1519,7 +1518,7 @@ static void *ca91cx42_alloc_consistent(struct device *parent, size_t size,
struct pci_dev *pdev; struct pci_dev *pdev;
/* Find pci_dev container of dev */ /* Find pci_dev container of dev */
pdev = container_of(parent, struct pci_dev, dev); pdev = to_pci_dev(parent);
return pci_alloc_consistent(pdev, size, dma); return pci_alloc_consistent(pdev, size, dma);
} }
...@@ -1530,7 +1529,7 @@ static void ca91cx42_free_consistent(struct device *parent, size_t size, ...@@ -1530,7 +1529,7 @@ static void ca91cx42_free_consistent(struct device *parent, size_t size,
struct pci_dev *pdev; struct pci_dev *pdev;
/* Find pci_dev container of dev */ /* Find pci_dev container of dev */
pdev = container_of(parent, struct pci_dev, dev); pdev = to_pci_dev(parent);
pci_free_consistent(pdev, size, vaddr, dma); pci_free_consistent(pdev, size, vaddr, dma);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment