Skip to content

Commit 07938d7

Browse files
andy-shevdavem330
authored andcommitted
ptp: ocp: Use DEFINE_RES_*() in place
There is no need to have an intermediate functions as DEFINE_RES_*() macros are represented by compound literals. Just use them in place. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Vadim Fedorenko <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9fb3dc1 commit 07938d7

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

drivers/ptp/ptp_ocp.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,20 +1716,6 @@ ptp_ocp_get_mem(struct ptp_ocp *bp, struct ocp_resource *r)
17161716
return __ptp_ocp_get_mem(bp, start, r->size);
17171717
}
17181718

1719-
static void
1720-
ptp_ocp_set_irq_resource(struct resource *res, int irq)
1721-
{
1722-
struct resource r = DEFINE_RES_IRQ(irq);
1723-
*res = r;
1724-
}
1725-
1726-
static void
1727-
ptp_ocp_set_mem_resource(struct resource *res, resource_size_t start, int size)
1728-
{
1729-
struct resource r = DEFINE_RES_MEM(start, size);
1730-
*res = r;
1731-
}
1732-
17331719
static int
17341720
ptp_ocp_register_spi(struct ptp_ocp *bp, struct ocp_resource *r)
17351721
{
@@ -1741,15 +1727,15 @@ ptp_ocp_register_spi(struct ptp_ocp *bp, struct ocp_resource *r)
17411727
int id;
17421728

17431729
start = pci_resource_start(pdev, 0) + r->offset;
1744-
ptp_ocp_set_mem_resource(&res[0], start, r->size);
1745-
ptp_ocp_set_irq_resource(&res[1], pci_irq_vector(pdev, r->irq_vec));
1730+
res[0] = DEFINE_RES_MEM(start, r->size);
1731+
res[1] = DEFINE_RES_IRQ(pci_irq_vector(pdev, r->irq_vec));
17461732

17471733
info = r->extra;
17481734
id = pci_dev_id(pdev) << 1;
17491735
id += info->pci_offset;
17501736

17511737
p = platform_device_register_resndata(&pdev->dev, info->name, id,
1752-
res, 2, info->data,
1738+
res, ARRAY_SIZE(res), info->data,
17531739
info->data_size);
17541740
if (IS_ERR(p))
17551741
return PTR_ERR(p);
@@ -1768,11 +1754,11 @@ ptp_ocp_i2c_bus(struct pci_dev *pdev, struct ocp_resource *r, int id)
17681754

17691755
info = r->extra;
17701756
start = pci_resource_start(pdev, 0) + r->offset;
1771-
ptp_ocp_set_mem_resource(&res[0], start, r->size);
1772-
ptp_ocp_set_irq_resource(&res[1], pci_irq_vector(pdev, r->irq_vec));
1757+
res[0] = DEFINE_RES_MEM(start, r->size);
1758+
res[1] = DEFINE_RES_IRQ(pci_irq_vector(pdev, r->irq_vec));
17731759

17741760
return platform_device_register_resndata(&pdev->dev, info->name,
1775-
id, res, 2,
1761+
id, res, ARRAY_SIZE(res),
17761762
info->data, info->data_size);
17771763
}
17781764

0 commit comments

Comments
 (0)