Commit c6c59bf2 authored by Geliang Tang's avatar Geliang Tang Committed by Herbert Xu

crypto: ccp - use to_pci_dev and to_platform_device

Use to_pci_dev() and to_platform_device() instead of open-coding.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a239c36e
...@@ -44,7 +44,7 @@ static int ccp_get_msix_irqs(struct ccp_device *ccp) ...@@ -44,7 +44,7 @@ static int ccp_get_msix_irqs(struct ccp_device *ccp)
{ {
struct ccp_pci *ccp_pci = ccp->dev_specific; struct ccp_pci *ccp_pci = ccp->dev_specific;
struct device *dev = ccp->dev; struct device *dev = ccp->dev;
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); struct pci_dev *pdev = to_pci_dev(dev);
struct msix_entry msix_entry[MSIX_VECTORS]; struct msix_entry msix_entry[MSIX_VECTORS];
unsigned int name_len = sizeof(ccp_pci->msix[0].name) - 1; unsigned int name_len = sizeof(ccp_pci->msix[0].name) - 1;
int v, ret; int v, ret;
...@@ -86,7 +86,7 @@ static int ccp_get_msix_irqs(struct ccp_device *ccp) ...@@ -86,7 +86,7 @@ static int ccp_get_msix_irqs(struct ccp_device *ccp)
static int ccp_get_msi_irq(struct ccp_device *ccp) static int ccp_get_msi_irq(struct ccp_device *ccp)
{ {
struct device *dev = ccp->dev; struct device *dev = ccp->dev;
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); struct pci_dev *pdev = to_pci_dev(dev);
int ret; int ret;
ret = pci_enable_msi(pdev); ret = pci_enable_msi(pdev);
...@@ -133,7 +133,7 @@ static void ccp_free_irqs(struct ccp_device *ccp) ...@@ -133,7 +133,7 @@ static void ccp_free_irqs(struct ccp_device *ccp)
{ {
struct ccp_pci *ccp_pci = ccp->dev_specific; struct ccp_pci *ccp_pci = ccp->dev_specific;
struct device *dev = ccp->dev; struct device *dev = ccp->dev;
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); struct pci_dev *pdev = to_pci_dev(dev);
if (ccp_pci->msix_count) { if (ccp_pci->msix_count) {
while (ccp_pci->msix_count--) while (ccp_pci->msix_count--)
...@@ -149,7 +149,7 @@ static void ccp_free_irqs(struct ccp_device *ccp) ...@@ -149,7 +149,7 @@ static void ccp_free_irqs(struct ccp_device *ccp)
static int ccp_find_mmio_area(struct ccp_device *ccp) static int ccp_find_mmio_area(struct ccp_device *ccp)
{ {
struct device *dev = ccp->dev; struct device *dev = ccp->dev;
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); struct pci_dev *pdev = to_pci_dev(dev);
resource_size_t io_len; resource_size_t io_len;
unsigned long io_flags; unsigned long io_flags;
......
...@@ -35,8 +35,7 @@ struct ccp_platform { ...@@ -35,8 +35,7 @@ struct ccp_platform {
static int ccp_get_irq(struct ccp_device *ccp) static int ccp_get_irq(struct ccp_device *ccp)
{ {
struct device *dev = ccp->dev; struct device *dev = ccp->dev;
struct platform_device *pdev = container_of(dev, struct platform_device *pdev = to_platform_device(dev);
struct platform_device, dev);
int ret; int ret;
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
...@@ -78,8 +77,7 @@ static void ccp_free_irqs(struct ccp_device *ccp) ...@@ -78,8 +77,7 @@ static void ccp_free_irqs(struct ccp_device *ccp)
static struct resource *ccp_find_mmio_area(struct ccp_device *ccp) static struct resource *ccp_find_mmio_area(struct ccp_device *ccp)
{ {
struct device *dev = ccp->dev; struct device *dev = ccp->dev;
struct platform_device *pdev = container_of(dev, struct platform_device *pdev = to_platform_device(dev);
struct platform_device, dev);
struct resource *ior; struct resource *ior;
ior = platform_get_resource(pdev, IORESOURCE_MEM, 0); ior = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
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