From f3d2f1655b543e2e8aaeaac0e1f6250c09fe1692 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Fri, 8 Jan 2016 12:05:39 -0600 Subject: [PATCH] PCI: Use to_pci_dev() instead of open-coding it Use to_pci_dev() instead of open-coding it. Signed-off-by: Geliang Tang Signed-off-by: Bjorn Helgaas --- drivers/pci/hotplug/shpchp_sysfs.c | 2 +- drivers/pci/pci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c index 1b4d73d8c728..7efb56a28c9f 100644 --- a/drivers/pci/hotplug/shpchp_sysfs.c +++ b/drivers/pci/hotplug/shpchp_sysfs.c @@ -43,7 +43,7 @@ static ssize_t show_ctrl(struct device *dev, struct device_attribute *attr, char struct resource *res; struct pci_bus *bus; - pdev = container_of(dev, struct pci_dev, dev); + pdev = to_pci_dev(dev); bus = pdev->subordinate; out += sprintf(buf, "Free resources: memory\n"); diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index db2e22707678..49e3715477d1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1417,7 +1417,7 @@ struct pci_devres { static void pcim_release(struct device *gendev, void *res) { - struct pci_dev *dev = container_of(gendev, struct pci_dev, dev); + struct pci_dev *dev = to_pci_dev(gendev); struct pci_devres *this = res; int i; -- 2.20.1