Skip to content

Commit c3fb466

Browse files
committed
Merge branches 'acpi-glue', 'acpi-pnp', 'acpi-processor' and 'acpi-soc'
Merge updates of the code associating ACPI device objects with devices and PNP code, processor driver, and Intel LPSS driver updates for 5.16-rc1: - Make the association of ACPI device objects with PCI devices more straightforward and simplify the code doing that for all devices in general (Rafael Wysocki). - Use acpi_device_adr() in acpi_find_child_device() instead of evaluating _ADR (Rafael Wysocki). - Drop duplicate device IDs from PNP device IDs list (Krzysztof Kozlowski). - Allow acpi_idle_play_dead() to use C3 on AMD processors (Richard Gong). - Use ACPI_COMPANION() to simplify code in the ACPI driver for Intel SoCs (Rafael Wysocki). * acpi-glue: ACPI: glue: Use acpi_device_adr() in acpi_find_child_device() ACPI: glue: Look for ACPI bus type only if ACPI companion is not known ACPI: glue: Drop cleanup callback from struct acpi_bus_type PCI: ACPI: Drop acpi_pci_bus * acpi-pnp: ACPI: PNP: remove duplicated BRI0A49 and BDP3336 entries * acpi-processor: ACPI: processor idle: Allow playing dead in C3 state * acpi-soc: ACPI: LPSS: Use ACPI_COMPANION() directly
5 parents b2ffa16 + 61a3c78 + 6c7058a + d6b88ce + 50861d4 commit c3fb466

File tree

7 files changed

+43
-54
lines changed

7 files changed

+43
-54
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,13 @@ static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata,
712712

713713
static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
714714
{
715-
struct acpi_device *adev;
715+
struct acpi_device *adev = ACPI_COMPANION(dev);
716716
struct lpss_private_data *pdata;
717717
unsigned long flags;
718718
int ret;
719719

720-
ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev);
721-
if (WARN_ON(ret))
722-
return ret;
720+
if (WARN_ON(!adev))
721+
return -ENODEV;
723722

724723
spin_lock_irqsave(&dev->power.lock, flags);
725724
if (pm_runtime_suspended(dev)) {
@@ -732,6 +731,7 @@ static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
732731
goto out;
733732
}
734733
*val = __lpss_reg_read(pdata, reg);
734+
ret = 0;
735735

736736
out:
737737
spin_unlock_irqrestore(&dev->power.lock, flags);
@@ -1266,7 +1266,8 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb,
12661266
if (!id || !id->driver_data)
12671267
return 0;
12681268

1269-
if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev))
1269+
adev = ACPI_COMPANION(&pdev->dev);
1270+
if (!adev)
12701271
return 0;
12711272

12721273
pdata = acpi_driver_data(adev);

drivers/acpi/acpi_pnp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ static const struct acpi_device_id acpi_pnp_device_ids[] = {
156156
{"BRI0A49"}, /* Boca Complete Ofc Communicator 14.4 Data-FAX */
157157
{"BRI1400"}, /* Boca Research 33,600 ACF Modem */
158158
{"BRI3400"}, /* Boca 33.6 Kbps Internal FD34FSVD */
159-
{"BRI0A49"}, /* Boca 33.6 Kbps Internal FD34FSVD */
160-
{"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */
161159
{"CPI4050"}, /* Computer Peripherals Inc. EuroViVa CommCenter-33.6 SP PnP */
162160
{"CTL3001"}, /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */
163161
{"CTL3011"}, /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */

drivers/acpi/glue.c

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <linux/rwsem.h>
1818
#include <linux/acpi.h>
1919
#include <linux/dma-mapping.h>
20+
#include <linux/pci.h>
21+
#include <linux/pci-acpi.h>
2022
#include <linux/platform_device.h>
2123

2224
#include "internal.h"
@@ -111,13 +113,10 @@ struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
111113
return NULL;
112114

113115
list_for_each_entry(adev, &parent->children, node) {
114-
unsigned long long addr;
115-
acpi_status status;
116+
acpi_bus_address addr = acpi_device_adr(adev);
116117
int score;
117118

118-
status = acpi_evaluate_integer(adev->handle, METHOD_NAME__ADR,
119-
NULL, &addr);
120-
if (ACPI_FAILURE(status) || addr != address)
119+
if (!adev->pnp.type.bus_address || addr != address)
121120
continue;
122121

123122
if (!ret) {
@@ -287,12 +286,13 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one);
287286

288287
void acpi_device_notify(struct device *dev)
289288
{
290-
struct acpi_bus_type *type = acpi_get_bus_type(dev);
291289
struct acpi_device *adev;
292290
int ret;
293291

294292
ret = acpi_bind_one(dev, NULL);
295293
if (ret) {
294+
struct acpi_bus_type *type = acpi_get_bus_type(dev);
295+
296296
if (!type)
297297
goto err;
298298

@@ -304,17 +304,26 @@ void acpi_device_notify(struct device *dev)
304304
ret = acpi_bind_one(dev, adev);
305305
if (ret)
306306
goto err;
307-
}
308-
adev = ACPI_COMPANION(dev);
309307

310-
if (dev_is_platform(dev))
311-
acpi_configure_pmsi_domain(dev);
308+
if (type->setup) {
309+
type->setup(dev);
310+
goto done;
311+
}
312+
} else {
313+
adev = ACPI_COMPANION(dev);
314+
315+
if (dev_is_pci(dev)) {
316+
pci_acpi_setup(dev, adev);
317+
goto done;
318+
} else if (dev_is_platform(dev)) {
319+
acpi_configure_pmsi_domain(dev);
320+
}
321+
}
312322

313-
if (type && type->setup)
314-
type->setup(dev);
315-
else if (adev->handler && adev->handler->bind)
323+
if (adev->handler && adev->handler->bind)
316324
adev->handler->bind(dev);
317325

326+
done:
318327
acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
319328
dev_name(dev));
320329

@@ -327,14 +336,12 @@ void acpi_device_notify(struct device *dev)
327336
void acpi_device_notify_remove(struct device *dev)
328337
{
329338
struct acpi_device *adev = ACPI_COMPANION(dev);
330-
struct acpi_bus_type *type;
331339

332340
if (!adev)
333341
return;
334342

335-
type = acpi_get_bus_type(dev);
336-
if (type && type->cleanup)
337-
type->cleanup(dev);
343+
if (dev_is_pci(dev))
344+
pci_acpi_cleanup(dev, adev);
338345
else if (adev->handler && adev->handler->unbind)
339346
adev->handler->unbind(dev);
340347

drivers/acpi/processor_idle.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
789789
state->enter = acpi_idle_enter;
790790

791791
state->flags = 0;
792-
if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) {
792+
if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
793+
cx->type == ACPI_STATE_C3) {
793794
state->enter_dead = acpi_idle_play_dead;
794795
drv->safe_state_index = count;
795796
}

drivers/pci/pci-acpi.c

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,13 +1356,9 @@ static void pci_acpi_set_external_facing(struct pci_dev *dev)
13561356
dev->external_facing = 1;
13571357
}
13581358

1359-
static void pci_acpi_setup(struct device *dev)
1359+
void pci_acpi_setup(struct device *dev, struct acpi_device *adev)
13601360
{
13611361
struct pci_dev *pci_dev = to_pci_dev(dev);
1362-
struct acpi_device *adev = ACPI_COMPANION(dev);
1363-
1364-
if (!adev)
1365-
return;
13661362

13671363
pci_acpi_optimize_delay(pci_dev, adev->handle);
13681364
pci_acpi_set_external_facing(pci_dev);
@@ -1386,14 +1382,10 @@ static void pci_acpi_setup(struct device *dev)
13861382
acpi_device_power_add_dependent(adev, dev);
13871383
}
13881384

1389-
static void pci_acpi_cleanup(struct device *dev)
1385+
void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev)
13901386
{
1391-
struct acpi_device *adev = ACPI_COMPANION(dev);
13921387
struct pci_dev *pci_dev = to_pci_dev(dev);
13931388

1394-
if (!adev)
1395-
return;
1396-
13971389
pci_acpi_remove_edr_notifier(pci_dev);
13981390
pci_acpi_remove_pm_notifier(adev);
13991391
if (adev->wakeup.flags.valid) {
@@ -1405,20 +1397,6 @@ static void pci_acpi_cleanup(struct device *dev)
14051397
}
14061398
}
14071399

1408-
static bool pci_acpi_bus_match(struct device *dev)
1409-
{
1410-
return dev_is_pci(dev);
1411-
}
1412-
1413-
static struct acpi_bus_type acpi_pci_bus = {
1414-
.name = "PCI",
1415-
.match = pci_acpi_bus_match,
1416-
.find_companion = acpi_pci_find_companion,
1417-
.setup = pci_acpi_setup,
1418-
.cleanup = pci_acpi_cleanup,
1419-
};
1420-
1421-
14221400
static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev);
14231401

14241402
/**
@@ -1460,8 +1438,6 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
14601438

14611439
static int __init acpi_pci_init(void)
14621440
{
1463-
int ret;
1464-
14651441
if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) {
14661442
pr_info("ACPI FADT declares the system doesn't support MSI, so disable it\n");
14671443
pci_no_msi();
@@ -1472,8 +1448,7 @@ static int __init acpi_pci_init(void)
14721448
pcie_no_aspm();
14731449
}
14741450

1475-
ret = register_acpi_bus_type(&acpi_pci_bus);
1476-
if (ret)
1451+
if (acpi_pci_disabled)
14771452
return 0;
14781453

14791454
pci_set_platform_pm(&acpi_pci_platform_pm);

include/acpi/acpi_bus.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,6 @@ struct acpi_bus_type {
570570
bool (*match)(struct device *dev);
571571
struct acpi_device * (*find_companion)(struct device *);
572572
void (*setup)(struct device *);
573-
void (*cleanup)(struct device *);
574573
};
575574
int register_acpi_bus_type(struct acpi_bus_type *);
576575
int unregister_acpi_bus_type(struct acpi_bus_type *);

include/linux/pci-acpi.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ extern struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
8484
void acpi_pci_add_bus(struct pci_bus *bus);
8585
void acpi_pci_remove_bus(struct pci_bus *bus);
8686

87+
#ifdef CONFIG_PCI
88+
void pci_acpi_setup(struct device *dev, struct acpi_device *adev);
89+
void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev);
90+
#else
91+
static inline void pci_acpi_setup(struct device *dev, struct acpi_device *adev) {}
92+
static inline void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev) {}
93+
#endif
94+
8795
#ifdef CONFIG_ACPI_PCI_SLOT
8896
void acpi_pci_slot_init(void);
8997
void acpi_pci_slot_enumerate(struct pci_bus *bus);

0 commit comments

Comments
 (0)