13
13
#include <linux/io.h>
14
14
#include <linux/kernel.h>
15
15
#include <linux/module.h>
16
- #include <linux/of .h>
16
+ #include <linux/mod_devicetable .h>
17
17
#include <linux/platform_device.h>
18
+ #include <linux/property.h>
18
19
19
20
/* register map */
20
21
#define ADI_REG_RSTN 0x0080
@@ -368,12 +369,12 @@ static irqreturn_t axi_fan_control_irq_handler(int irq, void *data)
368
369
}
369
370
370
371
static int axi_fan_control_init (struct axi_fan_control_data * ctl ,
371
- const struct device_node * np )
372
+ const struct device * dev )
372
373
{
373
374
int ret ;
374
375
375
376
/* get fan pulses per revolution */
376
- ret = of_property_read_u32 ( np , "pulses-per-revolution" , & ctl -> ppr );
377
+ ret = device_property_read_u32 ( dev , "pulses-per-revolution" , & ctl -> ppr );
377
378
if (ret )
378
379
return ret ;
379
380
@@ -443,25 +444,16 @@ static struct attribute *axi_fan_control_attrs[] = {
443
444
};
444
445
ATTRIBUTE_GROUPS (axi_fan_control );
445
446
446
- static const u32 version_1_0_0 = ADI_AXI_PCORE_VER (1 , 0 , 'a' );
447
-
448
- static const struct of_device_id axi_fan_control_of_match [] = {
449
- { .compatible = "adi,axi-fan-control-1.00.a" ,
450
- .data = (void * )& version_1_0_0 },
451
- {},
452
- };
453
- MODULE_DEVICE_TABLE (of , axi_fan_control_of_match );
454
-
455
447
static int axi_fan_control_probe (struct platform_device * pdev )
456
448
{
457
449
struct axi_fan_control_data * ctl ;
458
450
struct clk * clk ;
459
- const struct of_device_id * id ;
451
+ const unsigned int * id ;
460
452
const char * name = "axi_fan_control" ;
461
453
u32 version ;
462
454
int ret ;
463
455
464
- id = of_match_node ( axi_fan_control_of_match , pdev -> dev . of_node );
456
+ id = device_get_match_data ( & pdev -> dev );
465
457
if (!id )
466
458
return - EINVAL ;
467
459
@@ -485,18 +477,18 @@ static int axi_fan_control_probe(struct platform_device *pdev)
485
477
486
478
version = axi_ioread (ADI_AXI_REG_VERSION , ctl );
487
479
if (ADI_AXI_PCORE_VER_MAJOR (version ) !=
488
- ADI_AXI_PCORE_VER_MAJOR ((* ( u32 * ) id -> data ))) {
480
+ ADI_AXI_PCORE_VER_MAJOR ((* id ))) {
489
481
dev_err (& pdev -> dev , "Major version mismatch. Expected %d.%.2d.%c, Reported %d.%.2d.%c\n" ,
490
- ADI_AXI_PCORE_VER_MAJOR (( * ( u32 * ) id -> data ) ),
491
- ADI_AXI_PCORE_VER_MINOR (( * ( u32 * ) id -> data ) ),
492
- ADI_AXI_PCORE_VER_PATCH (( * ( u32 * ) id -> data ) ),
482
+ ADI_AXI_PCORE_VER_MAJOR (* id ),
483
+ ADI_AXI_PCORE_VER_MINOR (* id ),
484
+ ADI_AXI_PCORE_VER_PATCH (* id ),
493
485
ADI_AXI_PCORE_VER_MAJOR (version ),
494
486
ADI_AXI_PCORE_VER_MINOR (version ),
495
487
ADI_AXI_PCORE_VER_PATCH (version ));
496
488
return - ENODEV ;
497
489
}
498
490
499
- ret = axi_fan_control_init (ctl , pdev -> dev . of_node );
491
+ ret = axi_fan_control_init (ctl , & pdev -> dev );
500
492
if (ret ) {
501
493
dev_err (& pdev -> dev , "Failed to initialize device\n" );
502
494
return ret ;
@@ -527,6 +519,15 @@ static int axi_fan_control_probe(struct platform_device *pdev)
527
519
return 0 ;
528
520
}
529
521
522
+ static const u32 version_1_0_0 = ADI_AXI_PCORE_VER (1 , 0 , 'a' );
523
+
524
+ static const struct of_device_id axi_fan_control_of_match [] = {
525
+ { .compatible = "adi,axi-fan-control-1.00.a" ,
526
+ .data = (void * )& version_1_0_0 },
527
+ {},
528
+ };
529
+ MODULE_DEVICE_TABLE (of , axi_fan_control_of_match );
530
+
530
531
static struct platform_driver axi_fan_control_driver = {
531
532
.driver = {
532
533
.name = "axi_fan_control_driver" ,
0 commit comments