Skip to content

Commit 15f4bb9

Browse files
committed
Merge branches 'acpi-glue', 'acpi-osl', 'acpi-processor' and 'acpi-cppc'
Merge general ACPI cleanups and processor support updates for 5.19-rc1: - Rearrange find_child_checks() to simplify code (Rafael Wysocki). - Use memremap() to map the UCSI mailbox that is always in main memory and drop acpi_release_memory() that has no more users (Heikki Krogerus, Dan Carpenter). - Make max_cstate/nocst/bm_check_disable processor module parameters visible in sysfs (Yajun Deng). - Fix typo in the CPPC driver (Julia Lawall). * acpi-glue: ACPI: glue: Rearrange find_child_checks() * acpi-osl: usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe ACPI: OSL: Remove the helper for deactivating memory region usb: typec: ucsi: acpi: Map the mailbox with memremap() * acpi-processor: ACPI: processor: idle: Expose max_cstate/nocst/bm_check_disable read-only in sysfs * acpi-cppc: ACPI: CPPC: fix typo in comment
5 parents 657b95d + b7fbf4c + a9face8 + 27263b3 + 9e12eb8 commit 15f4bb9

File tree

6 files changed

+21
-119
lines changed

6 files changed

+21
-119
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
315315
goto end;
316316
}
317317

318-
/* wait for completion and check for PCC errro bit */
318+
/* wait for completion and check for PCC error bit */
319319
ret = check_pcc_chan(pcc_ss_id, true);
320320

321321
if (pcc_ss_data->pcc_mrtt)

drivers/acpi/glue.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
7979

8080
static int find_child_checks(struct acpi_device *adev, bool check_children)
8181
{
82-
bool sta_present = true;
8382
unsigned long long sta;
8483
acpi_status status;
8584

85+
if (check_children && list_empty(&adev->children))
86+
return -ENODEV;
87+
8688
status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
8789
if (status == AE_NOT_FOUND)
88-
sta_present = false;
89-
else if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
90-
return -ENODEV;
90+
return FIND_CHILD_MIN_SCORE;
9191

92-
if (check_children && list_empty(&adev->children))
92+
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
9393
return -ENODEV;
9494

9595
/*
@@ -99,8 +99,10 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
9999
* matched going forward. [This means a second spec violation in a row,
100100
* so whatever we do here is best effort anyway.]
101101
*/
102-
return sta_present && !adev->pnp.type.platform_id ?
103-
FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE;
102+
if (adev->pnp.type.platform_id)
103+
return FIND_CHILD_MIN_SCORE;
104+
105+
return FIND_CHILD_MAX_SCORE;
104106
}
105107

106108
struct acpi_device *acpi_find_child_device(struct acpi_device *parent,

drivers/acpi/osl.c

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <linux/io-64-nonatomic-lo-hi.h>
3737

3838
#include "acpica/accommon.h"
39-
#include "acpica/acnamesp.h"
4039
#include "internal.h"
4140

4241
/* Definitions for ACPI_DEBUG_PRINT() */
@@ -1496,91 +1495,6 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
14961495
}
14971496
EXPORT_SYMBOL(acpi_check_region);
14981497

1499-
static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level,
1500-
void *_res, void **return_value)
1501-
{
1502-
struct acpi_mem_space_context **mem_ctx;
1503-
union acpi_operand_object *handler_obj;
1504-
union acpi_operand_object *region_obj2;
1505-
union acpi_operand_object *region_obj;
1506-
struct resource *res = _res;
1507-
acpi_status status;
1508-
1509-
region_obj = acpi_ns_get_attached_object(handle);
1510-
if (!region_obj)
1511-
return AE_OK;
1512-
1513-
handler_obj = region_obj->region.handler;
1514-
if (!handler_obj)
1515-
return AE_OK;
1516-
1517-
if (region_obj->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
1518-
return AE_OK;
1519-
1520-
if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE))
1521-
return AE_OK;
1522-
1523-
region_obj2 = acpi_ns_get_secondary_object(region_obj);
1524-
if (!region_obj2)
1525-
return AE_OK;
1526-
1527-
mem_ctx = (void *)&region_obj2->extra.region_context;
1528-
1529-
if (!(mem_ctx[0]->address >= res->start &&
1530-
mem_ctx[0]->address < res->end))
1531-
return AE_OK;
1532-
1533-
status = handler_obj->address_space.setup(region_obj,
1534-
ACPI_REGION_DEACTIVATE,
1535-
NULL, (void **)mem_ctx);
1536-
if (ACPI_SUCCESS(status))
1537-
region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
1538-
1539-
return status;
1540-
}
1541-
1542-
/**
1543-
* acpi_release_memory - Release any mappings done to a memory region
1544-
* @handle: Handle to namespace node
1545-
* @res: Memory resource
1546-
* @level: A level that terminates the search
1547-
*
1548-
* Walks through @handle and unmaps all SystemMemory Operation Regions that
1549-
* overlap with @res and that have already been activated (mapped).
1550-
*
1551-
* This is a helper that allows drivers to place special requirements on memory
1552-
* region that may overlap with operation regions, primarily allowing them to
1553-
* safely map the region as non-cached memory.
1554-
*
1555-
* The unmapped Operation Regions will be automatically remapped next time they
1556-
* are called, so the drivers do not need to do anything else.
1557-
*/
1558-
acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
1559-
u32 level)
1560-
{
1561-
acpi_status status;
1562-
1563-
if (!(res->flags & IORESOURCE_MEM))
1564-
return AE_TYPE;
1565-
1566-
status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
1567-
acpi_deactivate_mem_region, NULL,
1568-
res, NULL);
1569-
if (ACPI_FAILURE(status))
1570-
return status;
1571-
1572-
/*
1573-
* Wait for all of the mappings queued up for removal by
1574-
* acpi_deactivate_mem_region() to actually go away.
1575-
*/
1576-
synchronize_rcu();
1577-
rcu_barrier();
1578-
flush_scheduled_work();
1579-
1580-
return AE_OK;
1581-
}
1582-
EXPORT_SYMBOL_GPL(acpi_release_memory);
1583-
15841498
/*
15851499
* Let drivers know whether the resource checks are effective
15861500
*/

drivers/acpi/processor_idle.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
#define ACPI_IDLE_STATE_START (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX) ? 1 : 0)
3939

4040
static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
41-
module_param(max_cstate, uint, 0000);
42-
static unsigned int nocst __read_mostly;
43-
module_param(nocst, uint, 0000);
44-
static int bm_check_disable __read_mostly;
45-
module_param(bm_check_disable, uint, 0000);
41+
module_param(max_cstate, uint, 0400);
42+
static bool nocst __read_mostly;
43+
module_param(nocst, bool, 0400);
44+
static bool bm_check_disable __read_mostly;
45+
module_param(bm_check_disable, bool, 0400);
4646

4747
static unsigned int latency_factor __read_mostly = 2;
4848
module_param(latency_factor, uint, 0644);

drivers/usb/typec/ucsi/ucsi_acpi.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
struct ucsi_acpi {
2020
struct device *dev;
2121
struct ucsi *ucsi;
22-
void __iomem *base;
22+
void *base;
2323
struct completion complete;
2424
unsigned long flags;
2525
guid_t guid;
@@ -51,7 +51,7 @@ static int ucsi_acpi_read(struct ucsi *ucsi, unsigned int offset,
5151
if (ret)
5252
return ret;
5353

54-
memcpy(val, (const void __force *)(ua->base + offset), val_len);
54+
memcpy(val, ua->base + offset, val_len);
5555

5656
return 0;
5757
}
@@ -61,7 +61,7 @@ static int ucsi_acpi_async_write(struct ucsi *ucsi, unsigned int offset,
6161
{
6262
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
6363

64-
memcpy((void __force *)(ua->base + offset), val, val_len);
64+
memcpy(ua->base + offset, val, val_len);
6565

6666
return ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_WRITE);
6767
}
@@ -132,20 +132,9 @@ static int ucsi_acpi_probe(struct platform_device *pdev)
132132
return -ENODEV;
133133
}
134134

135-
/* This will make sure we can use ioremap() */
136-
status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1);
137-
if (ACPI_FAILURE(status))
138-
return -ENOMEM;
139-
140-
/*
141-
* NOTE: The memory region for the data structures is used also in an
142-
* operation region, which means ACPI has already reserved it. Therefore
143-
* it can not be requested here, and we can not use
144-
* devm_ioremap_resource().
145-
*/
146-
ua->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
147-
if (!ua->base)
148-
return -ENOMEM;
135+
ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB);
136+
if (IS_ERR(ua->base))
137+
return PTR_ERR(ua->base);
149138

150139
ret = guid_parse(UCSI_DSM_UUID, &ua->guid);
151140
if (ret)

include/linux/acpi.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,6 @@ int acpi_check_resource_conflict(const struct resource *res);
520520
int acpi_check_region(resource_size_t start, resource_size_t n,
521521
const char *name);
522522

523-
acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
524-
u32 level);
525-
526523
int acpi_resources_are_enforced(void);
527524

528525
#ifdef CONFIG_HIBERNATION

0 commit comments

Comments
 (0)