99#include <linux/platform_device.h>
1010#include <linux/mfd/core.h>
1111#include <linux/mfd/kempld.h>
12+ #include <linux/mod_devicetable.h>
1213#include <linux/module.h>
14+ #include <linux/property.h>
1315#include <linux/dmi.h>
1416#include <linux/io.h>
1517#include <linux/delay.h>
16- #include <linux/acpi.h>
1718
1819#define MAX_ID_LEN 4
1920static char force_device_id [MAX_ID_LEN + 1 ] = "" ;
@@ -425,26 +426,6 @@ static int kempld_detect_device(struct kempld_device_data *pld)
425426 return ret ;
426427}
427428
428- #ifdef CONFIG_ACPI
429- static int kempld_get_acpi_data (struct platform_device * pdev )
430- {
431- struct device * dev = & pdev -> dev ;
432- const struct kempld_platform_data * pdata ;
433- int ret ;
434-
435- pdata = acpi_device_get_match_data (dev );
436- ret = platform_device_add_data (pdev , pdata ,
437- sizeof (struct kempld_platform_data ));
438-
439- return ret ;
440- }
441- #else
442- static int kempld_get_acpi_data (struct platform_device * pdev )
443- {
444- return - ENODEV ;
445- }
446- #endif /* CONFIG_ACPI */
447-
448429static int kempld_probe (struct platform_device * pdev )
449430{
450431 const struct kempld_platform_data * pdata ;
@@ -458,10 +439,16 @@ static int kempld_probe(struct platform_device *pdev)
458439 * No kempld_pdev device has been registered in kempld_init,
459440 * so we seem to be probing an ACPI platform device.
460441 */
461- ret = kempld_get_acpi_data (pdev );
442+ pdata = device_get_match_data (dev );
443+ if (!pdata )
444+ return - ENODEV ;
445+
446+ ret = platform_device_add_data (pdev , pdata , sizeof (* pdata ));
462447 if (ret )
463448 return ret ;
464- } else if (kempld_pdev != pdev ) {
449+ } else if (kempld_pdev == pdev ) {
450+ pdata = dev_get_platdata (dev );
451+ } else {
465452 /*
466453 * The platform device we are probing is not the one we
467454 * registered in kempld_init using the DMI table, so this one
@@ -472,7 +459,6 @@ static int kempld_probe(struct platform_device *pdev)
472459 dev_notice (dev , "platform device exists - not using ACPI\n" );
473460 return - ENODEV ;
474461 }
475- pdata = dev_get_platdata (dev );
476462
477463 pld = devm_kzalloc (dev , sizeof (* pld ), GFP_KERNEL );
478464 if (!pld )
@@ -509,19 +495,17 @@ static void kempld_remove(struct platform_device *pdev)
509495 pdata -> release_hardware_mutex (pld );
510496}
511497
512- #ifdef CONFIG_ACPI
513498static const struct acpi_device_id kempld_acpi_table [] = {
514499 { "KEM0000" , (kernel_ulong_t )& kempld_platform_data_generic },
515500 { "KEM0001" , (kernel_ulong_t )& kempld_platform_data_generic },
516501 {}
517502};
518503MODULE_DEVICE_TABLE (acpi , kempld_acpi_table );
519- #endif
520504
521505static struct platform_driver kempld_driver = {
522506 .driver = {
523507 .name = "kempld" ,
524- .acpi_match_table = ACPI_PTR ( kempld_acpi_table ) ,
508+ .acpi_match_table = kempld_acpi_table ,
525509 },
526510 .probe = kempld_probe ,
527511 .remove_new = kempld_remove ,
0 commit comments