Skip to content

Commit 392654a

Browse files
andy-shevlag-linaro
authored andcommitted
mfd: kempld: Replace ACPI code with agnostic one
There is no need to include and use entire ACPI stack in the driver. Replace respective pieces by agnostic code. No functional change indented. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240223195113.880121-2-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 858cea6 commit 392654a

1 file changed

Lines changed: 11 additions & 27 deletions

File tree

drivers/mfd/kempld-core.c

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
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
1920
static 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-
448429
static 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
513498
static 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
};
518503
MODULE_DEVICE_TABLE(acpi, kempld_acpi_table);
519-
#endif
520504

521505
static 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

Comments
 (0)