Skip to content

Commit cdc3d2a

Browse files
Heikki Krogerusrafaeljw
authored andcommitted
usb: typec: ucsi: acpi: Map the mailbox with memremap()
The UCSI mailbox is always in main memory. Signed-off-by: Heikki Krogerus <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent af2d861 commit cdc3d2a

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

drivers/usb/typec/ucsi/ucsi_acpi.c

Lines changed: 4 additions & 15 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,18 +132,7 @@ 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));
135+
ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB);
147136
if (!ua->base)
148137
return -ENOMEM;
149138

0 commit comments

Comments
 (0)