Skip to content

Commit c6c59bf

Browse files
geliangtangherbertx
authored andcommitted
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: Geliang Tang <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent a239c36 commit c6c59bf

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

drivers/crypto/ccp/ccp-pci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static int ccp_get_msix_irqs(struct ccp_device *ccp)
4444
{
4545
struct ccp_pci *ccp_pci = ccp->dev_specific;
4646
struct device *dev = ccp->dev;
47-
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
47+
struct pci_dev *pdev = to_pci_dev(dev);
4848
struct msix_entry msix_entry[MSIX_VECTORS];
4949
unsigned int name_len = sizeof(ccp_pci->msix[0].name) - 1;
5050
int v, ret;
@@ -86,7 +86,7 @@ static int ccp_get_msix_irqs(struct ccp_device *ccp)
8686
static int ccp_get_msi_irq(struct ccp_device *ccp)
8787
{
8888
struct device *dev = ccp->dev;
89-
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
89+
struct pci_dev *pdev = to_pci_dev(dev);
9090
int ret;
9191

9292
ret = pci_enable_msi(pdev);
@@ -133,7 +133,7 @@ static void ccp_free_irqs(struct ccp_device *ccp)
133133
{
134134
struct ccp_pci *ccp_pci = ccp->dev_specific;
135135
struct device *dev = ccp->dev;
136-
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
136+
struct pci_dev *pdev = to_pci_dev(dev);
137137

138138
if (ccp_pci->msix_count) {
139139
while (ccp_pci->msix_count--)
@@ -149,7 +149,7 @@ static void ccp_free_irqs(struct ccp_device *ccp)
149149
static int ccp_find_mmio_area(struct ccp_device *ccp)
150150
{
151151
struct device *dev = ccp->dev;
152-
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
152+
struct pci_dev *pdev = to_pci_dev(dev);
153153
resource_size_t io_len;
154154
unsigned long io_flags;
155155

drivers/crypto/ccp/ccp-platform.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ struct ccp_platform {
3535
static int ccp_get_irq(struct ccp_device *ccp)
3636
{
3737
struct device *dev = ccp->dev;
38-
struct platform_device *pdev = container_of(dev,
39-
struct platform_device, dev);
38+
struct platform_device *pdev = to_platform_device(dev);
4039
int ret;
4140

4241
ret = platform_get_irq(pdev, 0);
@@ -78,8 +77,7 @@ static void ccp_free_irqs(struct ccp_device *ccp)
7877
static struct resource *ccp_find_mmio_area(struct ccp_device *ccp)
7978
{
8079
struct device *dev = ccp->dev;
81-
struct platform_device *pdev = container_of(dev,
82-
struct platform_device, dev);
80+
struct platform_device *pdev = to_platform_device(dev);
8381
struct resource *ior;
8482

8583
ior = platform_get_resource(pdev, IORESOURCE_MEM, 0);

0 commit comments

Comments
 (0)