16
16
#include <linux/mfd/syscon.h>
17
17
#include <linux/module.h>
18
18
#include <linux/of_address.h>
19
- #include <linux/of_fdt.h>
20
- #include <linux/of_irq.h>
21
- #include <linux/of_platform.h>
22
19
#include <linux/perf_event.h>
23
20
#include <linux/platform_device.h>
21
+ #include <linux/property.h>
24
22
#include <linux/regmap.h>
25
23
#include <linux/slab.h>
26
24
@@ -1731,6 +1729,12 @@ static const struct xgene_pmu_data xgene_pmu_v2_data = {
1731
1729
.id = PCP_PMU_V2 ,
1732
1730
};
1733
1731
1732
+ #ifdef CONFIG_ACPI
1733
+ static const struct xgene_pmu_data xgene_pmu_v3_data = {
1734
+ .id = PCP_PMU_V3 ,
1735
+ };
1736
+ #endif
1737
+
1734
1738
static const struct xgene_pmu_ops xgene_pmu_ops = {
1735
1739
.mask_int = xgene_pmu_mask_int ,
1736
1740
.unmask_int = xgene_pmu_unmask_int ,
@@ -1773,9 +1777,9 @@ static const struct of_device_id xgene_pmu_of_match[] = {
1773
1777
MODULE_DEVICE_TABLE (of , xgene_pmu_of_match );
1774
1778
#ifdef CONFIG_ACPI
1775
1779
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 },
1779
1783
{},
1780
1784
};
1781
1785
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)
1831
1835
static int xgene_pmu_probe (struct platform_device * pdev )
1832
1836
{
1833
1837
const struct xgene_pmu_data * dev_data ;
1834
- const struct of_device_id * of_id ;
1835
1838
struct xgene_pmu * xgene_pmu ;
1836
1839
int irq , rc ;
1837
1840
int version ;
@@ -1850,24 +1853,10 @@ static int xgene_pmu_probe(struct platform_device *pdev)
1850
1853
xgene_pmu -> dev = & pdev -> dev ;
1851
1854
platform_set_drvdata (pdev , xgene_pmu );
1852
1855
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 )
1870
1858
return - ENODEV ;
1859
+ version = dev_data -> id ;
1871
1860
1872
1861
if (version == PCP_PMU_V3 )
1873
1862
xgene_pmu -> ops = & xgene_pmu_v3_ops ;
0 commit comments