Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andy Shevchenko and committed by
Lee Jones
392654ad 858cea6b

+11 -27
+11 -27
drivers/mfd/kempld-core.c
··· 9 9 #include <linux/platform_device.h> 10 10 #include <linux/mfd/core.h> 11 11 #include <linux/mfd/kempld.h> 12 + #include <linux/mod_devicetable.h> 12 13 #include <linux/module.h> 14 + #include <linux/property.h> 13 15 #include <linux/dmi.h> 14 16 #include <linux/io.h> 15 17 #include <linux/delay.h> 16 - #include <linux/acpi.h> 17 18 18 19 #define MAX_ID_LEN 4 19 20 static char force_device_id[MAX_ID_LEN + 1] = ""; ··· 426 425 return ret; 427 426 } 428 427 429 - #ifdef CONFIG_ACPI 430 - static int kempld_get_acpi_data(struct platform_device *pdev) 431 - { 432 - struct device *dev = &pdev->dev; 433 - const struct kempld_platform_data *pdata; 434 - int ret; 435 - 436 - pdata = acpi_device_get_match_data(dev); 437 - ret = platform_device_add_data(pdev, pdata, 438 - sizeof(struct kempld_platform_data)); 439 - 440 - return ret; 441 - } 442 - #else 443 - static int kempld_get_acpi_data(struct platform_device *pdev) 444 - { 445 - return -ENODEV; 446 - } 447 - #endif /* CONFIG_ACPI */ 448 - 449 428 static int kempld_probe(struct platform_device *pdev) 450 429 { 451 430 const struct kempld_platform_data *pdata; ··· 439 458 * No kempld_pdev device has been registered in kempld_init, 440 459 * so we seem to be probing an ACPI platform device. 441 460 */ 442 - ret = kempld_get_acpi_data(pdev); 461 + pdata = device_get_match_data(dev); 462 + if (!pdata) 463 + return -ENODEV; 464 + 465 + ret = platform_device_add_data(pdev, pdata, sizeof(*pdata)); 443 466 if (ret) 444 467 return ret; 445 - } else if (kempld_pdev != pdev) { 468 + } else if (kempld_pdev == pdev) { 469 + pdata = dev_get_platdata(dev); 470 + } else { 446 471 /* 447 472 * The platform device we are probing is not the one we 448 473 * registered in kempld_init using the DMI table, so this one ··· 459 472 dev_notice(dev, "platform device exists - not using ACPI\n"); 460 473 return -ENODEV; 461 474 } 462 - pdata = dev_get_platdata(dev); 463 475 464 476 pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL); 465 477 if (!pld) ··· 495 509 pdata->release_hardware_mutex(pld); 496 510 } 497 511 498 - #ifdef CONFIG_ACPI 499 512 static const struct acpi_device_id kempld_acpi_table[] = { 500 513 { "KEM0000", (kernel_ulong_t)&kempld_platform_data_generic }, 501 514 { "KEM0001", (kernel_ulong_t)&kempld_platform_data_generic }, 502 515 {} 503 516 }; 504 517 MODULE_DEVICE_TABLE(acpi, kempld_acpi_table); 505 - #endif 506 518 507 519 static struct platform_driver kempld_driver = { 508 520 .driver = { 509 521 .name = "kempld", 510 - .acpi_match_table = ACPI_PTR(kempld_acpi_table), 522 + .acpi_match_table = kempld_acpi_table, 511 523 }, 512 524 .probe = kempld_probe, 513 525 .remove_new = kempld_remove,