Commit 515028fe authored by Bartosz Folta's avatar Bartosz Folta Committed by David S. Miller

net: macb: Updated resource allocation function calls to new version of API.

Changed function calls of resource allocation to new API. Changed way
of setting DMA mask. Removed unnecessary sanity check.
This patch is sent in regard to recently applied patch
Commit 83a77e9e
net: macb: Added PCI wrapper for Platform Driver.
Signed-off-by: default avatarBartosz Folta <bfolta@cadence.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a2962b08
/** /**
* macb_pci.c - Cadence GEM PCI wrapper. * Cadence GEM PCI wrapper.
* *
* Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com
* *
...@@ -45,32 +45,27 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -45,32 +45,27 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct macb_platform_data plat_data; struct macb_platform_data plat_data;
struct resource res[2]; struct resource res[2];
/* sanity check */
if (!id)
return -EINVAL;
/* enable pci device */ /* enable pci device */
err = pci_enable_device(pdev); err = pcim_enable_device(pdev);
if (err < 0) { if (err < 0) {
dev_err(&pdev->dev, "Enabling PCI device has failed: 0x%04X", dev_err(&pdev->dev, "Enabling PCI device has failed: %d", err);
err); return err;
return -EACCES;
} }
pci_set_master(pdev); pci_set_master(pdev);
/* set up resources */ /* set up resources */
memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res)); memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
res[0].start = pdev->resource[0].start; res[0].start = pci_resource_start(pdev, 0);
res[0].end = pdev->resource[0].end; res[0].end = pci_resource_end(pdev, 0);
res[0].name = PCI_DRIVER_NAME; res[0].name = PCI_DRIVER_NAME;
res[0].flags = IORESOURCE_MEM; res[0].flags = IORESOURCE_MEM;
res[1].start = pdev->irq; res[1].start = pci_irq_vector(pdev, 0);
res[1].name = PCI_DRIVER_NAME; res[1].name = PCI_DRIVER_NAME;
res[1].flags = IORESOURCE_IRQ; res[1].flags = IORESOURCE_IRQ;
dev_info(&pdev->dev, "EMAC physical base addr = 0x%p\n", dev_info(&pdev->dev, "EMAC physical base addr: %pa\n",
(void *)(uintptr_t)pci_resource_start(pdev, 0)); &res[0].start);
/* set up macb platform data */ /* set up macb platform data */
memset(&plat_data, 0, sizeof(plat_data)); memset(&plat_data, 0, sizeof(plat_data));
...@@ -100,7 +95,7 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -100,7 +95,7 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
plat_info.num_res = ARRAY_SIZE(res); plat_info.num_res = ARRAY_SIZE(res);
plat_info.data = &plat_data; plat_info.data = &plat_data;
plat_info.size_data = sizeof(plat_data); plat_info.size_data = sizeof(plat_data);
plat_info.dma_mask = DMA_BIT_MASK(32); plat_info.dma_mask = pdev->dma_mask;
/* register platform device */ /* register platform device */
plat_dev = platform_device_register_full(&plat_info); plat_dev = platform_device_register_full(&plat_info);
...@@ -120,7 +115,6 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -120,7 +115,6 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
clk_unregister(plat_data.pclk); clk_unregister(plat_data.pclk);
err_pclk_register: err_pclk_register:
pci_disable_device(pdev);
return err; return err;
} }
...@@ -130,7 +124,6 @@ static void macb_remove(struct pci_dev *pdev) ...@@ -130,7 +124,6 @@ static void macb_remove(struct pci_dev *pdev)
struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev);
platform_device_unregister(plat_dev); platform_device_unregister(plat_dev);
pci_disable_device(pdev);
clk_unregister(plat_data->pclk); clk_unregister(plat_data->pclk);
clk_unregister(plat_data->hclk); clk_unregister(plat_data->hclk);
} }
......
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