Skip to content

Commit 13c35c8

Browse files
committed
Merge branches 'acpi-numa', 'acpi-sysfs', 'acpi-pmic', 'acpi-soc' and 'acpi-ged'
* acpi-numa: ACPI / NUMA: ia64: Parse all entries of SRAT memory affinity table * acpi-sysfs: ACPI: sysfs: Make ACPI GPE mask kernel parameter cover all GPEs * acpi-pmic: ACPI / PMIC: Convert to use builtin_platform_driver() macro ACPI / PMIC: constify platform_device_id * acpi-soc: ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources ACPI / LPSS: Add device link for CHT SD card dependency on I2C * acpi-ged: ACPI: GED: unregister interrupts during shutdown
6 parents 2a2bafc + fd3e454 + 0f27cff + 0d154fd + e168159 + 099caa9 commit 13c35c8

File tree

11 files changed

+201
-57
lines changed

11 files changed

+201
-57
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114
This facility can be used to prevent such uncontrolled
115115
GPE floodings.
116116
Format: <int>
117-
Support masking of GPEs numbered from 0x00 to 0x7f.
118117

119118
acpi_no_auto_serialize [HW,ACPI]
120119
Disable auto-serialization of AML methods

arch/ia64/kernel/acpi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,11 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
504504
if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
505505
return -1;
506506

507+
if (num_node_memblks >= NR_NODE_MEMBLKS) {
508+
pr_err("NUMA: too many memblk ranges\n");
509+
return -EINVAL;
510+
}
511+
507512
/* record this node in proximity bitmap */
508513
pxm_bit_set(pxm);
509514

drivers/acpi/acpi_lpss.c

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,142 @@ static int register_device_clock(struct acpi_device *adev,
427427
return 0;
428428
}
429429

430+
struct lpss_device_links {
431+
const char *supplier_hid;
432+
const char *supplier_uid;
433+
const char *consumer_hid;
434+
const char *consumer_uid;
435+
u32 flags;
436+
};
437+
438+
/*
439+
* The _DEP method is used to identify dependencies but instead of creating
440+
* device links for every handle in _DEP, only links in the following list are
441+
* created. That is necessary because, in the general case, _DEP can refer to
442+
* devices that might not have drivers, or that are on different buses, or where
443+
* the supplier is not enumerated until after the consumer is probed.
444+
*/
445+
static const struct lpss_device_links lpss_device_links[] = {
446+
{"808622C1", "7", "80860F14", "3", DL_FLAG_PM_RUNTIME},
447+
};
448+
449+
static bool hid_uid_match(const char *hid1, const char *uid1,
450+
const char *hid2, const char *uid2)
451+
{
452+
return !strcmp(hid1, hid2) && uid1 && uid2 && !strcmp(uid1, uid2);
453+
}
454+
455+
static bool acpi_lpss_is_supplier(struct acpi_device *adev,
456+
const struct lpss_device_links *link)
457+
{
458+
return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
459+
link->supplier_hid, link->supplier_uid);
460+
}
461+
462+
static bool acpi_lpss_is_consumer(struct acpi_device *adev,
463+
const struct lpss_device_links *link)
464+
{
465+
return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
466+
link->consumer_hid, link->consumer_uid);
467+
}
468+
469+
struct hid_uid {
470+
const char *hid;
471+
const char *uid;
472+
};
473+
474+
static int match_hid_uid(struct device *dev, void *data)
475+
{
476+
struct acpi_device *adev = ACPI_COMPANION(dev);
477+
struct hid_uid *id = data;
478+
479+
if (!adev)
480+
return 0;
481+
482+
return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
483+
id->hid, id->uid);
484+
}
485+
486+
static struct device *acpi_lpss_find_device(const char *hid, const char *uid)
487+
{
488+
struct hid_uid data = {
489+
.hid = hid,
490+
.uid = uid,
491+
};
492+
493+
return bus_find_device(&platform_bus_type, NULL, &data, match_hid_uid);
494+
}
495+
496+
static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle)
497+
{
498+
struct acpi_handle_list dep_devices;
499+
acpi_status status;
500+
int i;
501+
502+
if (!acpi_has_method(adev->handle, "_DEP"))
503+
return false;
504+
505+
status = acpi_evaluate_reference(adev->handle, "_DEP", NULL,
506+
&dep_devices);
507+
if (ACPI_FAILURE(status)) {
508+
dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n");
509+
return false;
510+
}
511+
512+
for (i = 0; i < dep_devices.count; i++) {
513+
if (dep_devices.handles[i] == handle)
514+
return true;
515+
}
516+
517+
return false;
518+
}
519+
520+
static void acpi_lpss_link_consumer(struct device *dev1,
521+
const struct lpss_device_links *link)
522+
{
523+
struct device *dev2;
524+
525+
dev2 = acpi_lpss_find_device(link->consumer_hid, link->consumer_uid);
526+
if (!dev2)
527+
return;
528+
529+
if (acpi_lpss_dep(ACPI_COMPANION(dev2), ACPI_HANDLE(dev1)))
530+
device_link_add(dev2, dev1, link->flags);
531+
532+
put_device(dev2);
533+
}
534+
535+
static void acpi_lpss_link_supplier(struct device *dev1,
536+
const struct lpss_device_links *link)
537+
{
538+
struct device *dev2;
539+
540+
dev2 = acpi_lpss_find_device(link->supplier_hid, link->supplier_uid);
541+
if (!dev2)
542+
return;
543+
544+
if (acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2)))
545+
device_link_add(dev1, dev2, link->flags);
546+
547+
put_device(dev2);
548+
}
549+
550+
static void acpi_lpss_create_device_links(struct acpi_device *adev,
551+
struct platform_device *pdev)
552+
{
553+
int i;
554+
555+
for (i = 0; i < ARRAY_SIZE(lpss_device_links); i++) {
556+
const struct lpss_device_links *link = &lpss_device_links[i];
557+
558+
if (acpi_lpss_is_supplier(adev, link))
559+
acpi_lpss_link_consumer(&pdev->dev, link);
560+
561+
if (acpi_lpss_is_consumer(adev, link))
562+
acpi_lpss_link_supplier(&pdev->dev, link);
563+
}
564+
}
565+
430566
static int acpi_lpss_create_device(struct acpi_device *adev,
431567
const struct acpi_device_id *id)
432568
{
@@ -465,6 +601,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
465601
acpi_dev_free_resource_list(&resource_list);
466602

467603
if (!pdata->mmio_base) {
604+
/* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
605+
adev->pnp.type.platform_id = 0;
468606
/* Skip the device, but continue the namespace scan. */
469607
ret = 0;
470608
goto err_out;
@@ -500,6 +638,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
500638
adev->driver_data = pdata;
501639
pdev = acpi_create_platform_device(adev, dev_desc->properties);
502640
if (!IS_ERR_OR_NULL(pdev)) {
641+
acpi_lpss_create_device_links(adev, pdev);
503642
return 1;
504643
}
505644

drivers/acpi/evged.c

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949

5050
#define MODULE_NAME "acpi-ged"
5151

52+
struct acpi_ged_device {
53+
struct device *dev;
54+
struct list_head event_list;
55+
};
56+
5257
struct acpi_ged_event {
5358
struct list_head node;
5459
struct device *dev;
@@ -76,7 +81,8 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
7681
unsigned int irq;
7782
unsigned int gsi;
7883
unsigned int irqflags = IRQF_ONESHOT;
79-
struct device *dev = context;
84+
struct acpi_ged_device *geddev = context;
85+
struct device *dev = geddev->dev;
8086
acpi_handle handle = ACPI_HANDLE(dev);
8187
acpi_handle evt_handle;
8288
struct resource r;
@@ -102,8 +108,6 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
102108
return AE_ERROR;
103109
}
104110

105-
dev_info(dev, "GED listening GSI %u @ IRQ %u\n", gsi, irq);
106-
107111
event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL);
108112
if (!event)
109113
return AE_ERROR;
@@ -116,36 +120,67 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
116120
if (r.flags & IORESOURCE_IRQ_SHAREABLE)
117121
irqflags |= IRQF_SHARED;
118122

119-
if (devm_request_threaded_irq(dev, irq, NULL, acpi_ged_irq_handler,
120-
irqflags, "ACPI:Ged", event)) {
123+
if (request_threaded_irq(irq, NULL, acpi_ged_irq_handler,
124+
irqflags, "ACPI:Ged", event)) {
121125
dev_err(dev, "failed to setup event handler for irq %u\n", irq);
122126
return AE_ERROR;
123127
}
124128

129+
dev_dbg(dev, "GED listening GSI %u @ IRQ %u\n", gsi, irq);
130+
list_add_tail(&event->node, &geddev->event_list);
125131
return AE_OK;
126132
}
127133

128134
static int ged_probe(struct platform_device *pdev)
129135
{
136+
struct acpi_ged_device *geddev;
130137
acpi_status acpi_ret;
131138

139+
geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL);
140+
if (!geddev)
141+
return -ENOMEM;
142+
143+
geddev->dev = &pdev->dev;
144+
INIT_LIST_HEAD(&geddev->event_list);
132145
acpi_ret = acpi_walk_resources(ACPI_HANDLE(&pdev->dev), "_CRS",
133-
acpi_ged_request_interrupt, &pdev->dev);
146+
acpi_ged_request_interrupt, geddev);
134147
if (ACPI_FAILURE(acpi_ret)) {
135148
dev_err(&pdev->dev, "unable to parse the _CRS record\n");
136149
return -EINVAL;
137150
}
151+
platform_set_drvdata(pdev, geddev);
138152

139153
return 0;
140154
}
141155

156+
static void ged_shutdown(struct platform_device *pdev)
157+
{
158+
struct acpi_ged_device *geddev = platform_get_drvdata(pdev);
159+
struct acpi_ged_event *event, *next;
160+
161+
list_for_each_entry_safe(event, next, &geddev->event_list, node) {
162+
free_irq(event->irq, event);
163+
list_del(&event->node);
164+
dev_dbg(geddev->dev, "GED releasing GSI %u @ IRQ %u\n",
165+
event->gsi, event->irq);
166+
}
167+
}
168+
169+
static int ged_remove(struct platform_device *pdev)
170+
{
171+
ged_shutdown(pdev);
172+
return 0;
173+
}
174+
142175
static const struct acpi_device_id ged_acpi_ids[] = {
143176
{"ACPI0013"},
144177
{},
145178
};
146179

147180
static struct platform_driver ged_driver = {
148181
.probe = ged_probe,
182+
.remove = ged_remove,
183+
.shutdown = ged_shutdown,
149184
.driver = {
150185
.name = MODULE_NAME,
151186
.acpi_match_table = ACPI_PTR(ged_acpi_ids),

drivers/acpi/numa.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ int __init acpi_numa_init(void)
460460
srat_proc, ARRAY_SIZE(srat_proc), 0);
461461

462462
cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
463-
acpi_parse_memory_affinity,
464-
NR_NODE_MEMBLKS);
463+
acpi_parse_memory_affinity, 0);
465464
}
466465

467466
/* SLIT: System Locality Information Table */

drivers/acpi/pmic/intel_pmic_bxtwc.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static int intel_bxtwc_pmic_opregion_probe(struct platform_device *pdev)
400400
&intel_bxtwc_pmic_opregion_data);
401401
}
402402

403-
static struct platform_device_id bxt_wc_opregion_id_table[] = {
403+
static const struct platform_device_id bxt_wc_opregion_id_table[] = {
404404
{ .name = "bxt_wcove_region" },
405405
{},
406406
};
@@ -412,9 +412,4 @@ static struct platform_driver intel_bxtwc_pmic_opregion_driver = {
412412
},
413413
.id_table = bxt_wc_opregion_id_table,
414414
};
415-
416-
static int __init intel_bxtwc_pmic_opregion_driver_init(void)
417-
{
418-
return platform_driver_register(&intel_bxtwc_pmic_opregion_driver);
419-
}
420-
device_initcall(intel_bxtwc_pmic_opregion_driver_init);
415+
builtin_platform_driver(intel_bxtwc_pmic_opregion_driver);

drivers/acpi/pmic/intel_pmic_chtdc_ti.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,4 @@ static struct platform_driver chtdc_ti_pmic_opregion_driver = {
131131
},
132132
.id_table = chtdc_ti_pmic_opregion_id_table,
133133
};
134-
module_platform_driver(chtdc_ti_pmic_opregion_driver);
135-
136-
MODULE_DESCRIPTION("Dollar Cove TI PMIC opregion driver");
137-
MODULE_LICENSE("GPL v2");
134+
builtin_platform_driver(chtdc_ti_pmic_opregion_driver);

drivers/acpi/pmic/intel_pmic_chtwc.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,10 @@ static int intel_cht_wc_pmic_opregion_probe(struct platform_device *pdev)
260260
&intel_cht_wc_pmic_opregion_data);
261261
}
262262

263-
static struct platform_device_id cht_wc_opregion_id_table[] = {
263+
static const struct platform_device_id cht_wc_opregion_id_table[] = {
264264
{ .name = "cht_wcove_region" },
265265
{},
266266
};
267-
MODULE_DEVICE_TABLE(platform, cht_wc_opregion_id_table);
268267

269268
static struct platform_driver intel_cht_wc_pmic_opregion_driver = {
270269
.probe = intel_cht_wc_pmic_opregion_probe,
@@ -273,8 +272,4 @@ static struct platform_driver intel_cht_wc_pmic_opregion_driver = {
273272
},
274273
.id_table = cht_wc_opregion_id_table,
275274
};
276-
module_platform_driver(intel_cht_wc_pmic_opregion_driver);
277-
278-
MODULE_DESCRIPTION("Intel CHT Whiskey Cove PMIC operation region driver");
279-
MODULE_AUTHOR("Hans de Goede <[email protected]>");
280-
MODULE_LICENSE("GPL");
275+
builtin_platform_driver(intel_cht_wc_pmic_opregion_driver);

drivers/acpi/pmic/intel_pmic_crc.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,4 @@ static struct platform_driver intel_crc_pmic_opregion_driver = {
201201
.name = "crystal_cove_pmic",
202202
},
203203
};
204-
205-
static int __init intel_crc_pmic_opregion_driver_init(void)
206-
{
207-
return platform_driver_register(&intel_crc_pmic_opregion_driver);
208-
}
209-
device_initcall(intel_crc_pmic_opregion_driver_init);
204+
builtin_platform_driver(intel_crc_pmic_opregion_driver);

drivers/acpi/pmic/intel_pmic_xpower.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,4 @@ static struct platform_driver intel_xpower_pmic_opregion_driver = {
278278
.name = "axp288_pmic_acpi",
279279
},
280280
};
281-
282-
static int __init intel_xpower_pmic_opregion_driver_init(void)
283-
{
284-
return platform_driver_register(&intel_xpower_pmic_opregion_driver);
285-
}
286-
device_initcall(intel_xpower_pmic_opregion_driver_init);
281+
builtin_platform_driver(intel_xpower_pmic_opregion_driver);

0 commit comments

Comments
 (0)