Skip to content

Commit 1f33cde

Browse files
robherringwilldeacon
authored andcommitted
drivers/perf: xgene: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() and acpi_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 32269e0 commit 1f33cde

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

drivers/perf/xgene_pmu.c

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
#include <linux/mfd/syscon.h>
1717
#include <linux/module.h>
1818
#include <linux/of_address.h>
19-
#include <linux/of_fdt.h>
20-
#include <linux/of_irq.h>
21-
#include <linux/of_platform.h>
2219
#include <linux/perf_event.h>
2320
#include <linux/platform_device.h>
21+
#include <linux/property.h>
2422
#include <linux/regmap.h>
2523
#include <linux/slab.h>
2624

@@ -1731,6 +1729,12 @@ static const struct xgene_pmu_data xgene_pmu_v2_data = {
17311729
.id = PCP_PMU_V2,
17321730
};
17331731

1732+
#ifdef CONFIG_ACPI
1733+
static const struct xgene_pmu_data xgene_pmu_v3_data = {
1734+
.id = PCP_PMU_V3,
1735+
};
1736+
#endif
1737+
17341738
static const struct xgene_pmu_ops xgene_pmu_ops = {
17351739
.mask_int = xgene_pmu_mask_int,
17361740
.unmask_int = xgene_pmu_unmask_int,
@@ -1773,9 +1777,9 @@ static const struct of_device_id xgene_pmu_of_match[] = {
17731777
MODULE_DEVICE_TABLE(of, xgene_pmu_of_match);
17741778
#ifdef CONFIG_ACPI
17751779
static const struct acpi_device_id xgene_pmu_acpi_match[] = {
1776-
{"APMC0D5B", PCP_PMU_V1},
1777-
{"APMC0D5C", PCP_PMU_V2},
1778-
{"APMC0D83", PCP_PMU_V3},
1780+
{"APMC0D5B", (kernel_ulong_t)&xgene_pmu_data},
1781+
{"APMC0D5C", (kernel_ulong_t)&xgene_pmu_v2_data},
1782+
{"APMC0D83", (kernel_ulong_t)&xgene_pmu_v3_data},
17791783
{},
17801784
};
17811785
MODULE_DEVICE_TABLE(acpi, xgene_pmu_acpi_match);
@@ -1831,7 +1835,6 @@ static int xgene_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
18311835
static int xgene_pmu_probe(struct platform_device *pdev)
18321836
{
18331837
const struct xgene_pmu_data *dev_data;
1834-
const struct of_device_id *of_id;
18351838
struct xgene_pmu *xgene_pmu;
18361839
int irq, rc;
18371840
int version;
@@ -1850,24 +1853,10 @@ static int xgene_pmu_probe(struct platform_device *pdev)
18501853
xgene_pmu->dev = &pdev->dev;
18511854
platform_set_drvdata(pdev, xgene_pmu);
18521855

1853-
version = -EINVAL;
1854-
of_id = of_match_device(xgene_pmu_of_match, &pdev->dev);
1855-
if (of_id) {
1856-
dev_data = (const struct xgene_pmu_data *) of_id->data;
1857-
version = dev_data->id;
1858-
}
1859-
1860-
#ifdef CONFIG_ACPI
1861-
if (ACPI_COMPANION(&pdev->dev)) {
1862-
const struct acpi_device_id *acpi_id;
1863-
1864-
acpi_id = acpi_match_device(xgene_pmu_acpi_match, &pdev->dev);
1865-
if (acpi_id)
1866-
version = (int) acpi_id->driver_data;
1867-
}
1868-
#endif
1869-
if (version < 0)
1856+
dev_data = device_get_match_data(&pdev->dev);
1857+
if (!dev_data)
18701858
return -ENODEV;
1859+
version = dev_data->id;
18711860

18721861
if (version == PCP_PMU_V3)
18731862
xgene_pmu->ops = &xgene_pmu_v3_ops;

0 commit comments

Comments
 (0)