Skip to content

Commit 08d4c17

Browse files
robherringKAGA-KOKO
authored andcommitted
irqchip/ls-scfg-msi: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data in a single step without the unnecessary intermediate match pointer. With this, adjust the includes to explicitly include the correct headers. That also serves as preparation to remove implicit includes within the DT headers. of_platform.h currently includes platform_device.h among others. Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Vladimir Oltean <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5e7afb2 commit 08d4c17

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/irqchip/irq-ls-scfg-msi.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
#include <linux/irqdomain.h>
1818
#include <linux/of_irq.h>
1919
#include <linux/of_pci.h>
20-
#include <linux/of_platform.h>
20+
#include <linux/platform_device.h>
21+
#include <linux/property.h>
2122
#include <linux/spinlock.h>
2223

2324
#define MSI_IRQS_PER_MSIR 32
@@ -334,20 +335,17 @@ MODULE_DEVICE_TABLE(of, ls_scfg_msi_id);
334335

335336
static int ls_scfg_msi_probe(struct platform_device *pdev)
336337
{
337-
const struct of_device_id *match;
338338
struct ls_scfg_msi *msi_data;
339339
struct resource *res;
340340
int i, ret;
341341

342-
match = of_match_device(ls_scfg_msi_id, &pdev->dev);
343-
if (!match)
344-
return -ENODEV;
345-
346342
msi_data = devm_kzalloc(&pdev->dev, sizeof(*msi_data), GFP_KERNEL);
347343
if (!msi_data)
348344
return -ENOMEM;
349345

350-
msi_data->cfg = (struct ls_scfg_msi_cfg *) match->data;
346+
msi_data->cfg = (struct ls_scfg_msi_cfg *)device_get_match_data(&pdev->dev);
347+
if (!msi_data->cfg)
348+
return -ENODEV;
351349

352350
msi_data->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
353351
if (IS_ERR(msi_data->regs)) {

0 commit comments

Comments
 (0)