mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 07:03:28 -04:00
platform/x86/amd/hsmp: Pass struct device explicitly to ACPI mailbox parsers
hsmp_read_acpi_crs() and hsmp_read_acpi_dsd() read the ACPI handle and emit error messages via sock->dev. Pass the struct device explicitly to both helpers instead of reading it back from sock->dev. This is a pure refactor with no functional change; it prepares for publishing sock->dev as the data-plane readiness gate only after the socket has been fully initialized, so the parsers must not depend on sock->dev already being set. Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com> Link: https://patch.msgid.link/20260629155634.1807598-4-muralidhara.mk@amd.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
committed by
Ilpo Järvinen
parent
0d7a266449
commit
b558cbed39
@@ -107,7 +107,7 @@ static acpi_status hsmp_resource(struct acpi_resource *res, void *data)
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
|
||||
static int hsmp_read_acpi_dsd(struct device *dev, struct hsmp_socket *sock)
|
||||
{
|
||||
struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *guid, *mailbox_package;
|
||||
@@ -116,10 +116,10 @@ static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
|
||||
int ret = 0;
|
||||
int j;
|
||||
|
||||
status = acpi_evaluate_object_typed(ACPI_HANDLE(sock->dev), "_DSD", NULL,
|
||||
status = acpi_evaluate_object_typed(ACPI_HANDLE(dev), "_DSD", NULL,
|
||||
&buf, ACPI_TYPE_PACKAGE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
dev_err(sock->dev, "Failed to read mailbox reg offsets from DSD table, err: %s\n",
|
||||
dev_err(dev, "Failed to read mailbox reg offsets from DSD table, err: %s\n",
|
||||
acpi_format_exception(status));
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
|
||||
guid = &dsd->package.elements[0];
|
||||
mailbox_package = &dsd->package.elements[1];
|
||||
if (!is_acpi_hsmp_uuid(guid) || mailbox_package->type != ACPI_TYPE_PACKAGE) {
|
||||
dev_err(sock->dev, "Invalid hsmp _DSD table data\n");
|
||||
dev_err(dev, "Invalid hsmp _DSD table data\n");
|
||||
ret = -EINVAL;
|
||||
goto free_buf;
|
||||
}
|
||||
@@ -192,14 +192,14 @@ static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hsmp_read_acpi_crs(struct hsmp_socket *sock)
|
||||
static int hsmp_read_acpi_crs(struct device *dev, struct hsmp_socket *sock)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
status = acpi_walk_resources(ACPI_HANDLE(sock->dev), METHOD_NAME__CRS,
|
||||
status = acpi_walk_resources(ACPI_HANDLE(dev), METHOD_NAME__CRS,
|
||||
hsmp_resource, sock);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
dev_err(sock->dev, "Failed to look up MP1 base address from CRS method, err: %s\n",
|
||||
dev_err(dev, "Failed to look up MP1 base address from CRS method, err: %s\n",
|
||||
acpi_format_exception(status));
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -207,10 +207,10 @@ static int hsmp_read_acpi_crs(struct hsmp_socket *sock)
|
||||
return -EINVAL;
|
||||
|
||||
/* The mapped region should be un-cached */
|
||||
sock->virt_base_addr = devm_ioremap_uc(sock->dev, sock->mbinfo.base_addr,
|
||||
sock->virt_base_addr = devm_ioremap_uc(dev, sock->mbinfo.base_addr,
|
||||
sock->mbinfo.size);
|
||||
if (!sock->virt_base_addr) {
|
||||
dev_err(sock->dev, "Failed to ioremap MP1 base address\n");
|
||||
dev_err(dev, "Failed to ioremap MP1 base address\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -232,12 +232,12 @@ static int hsmp_parse_acpi_table(struct device *dev, u16 sock_ind)
|
||||
dev_set_drvdata(dev, sock);
|
||||
|
||||
/* Read MP1 base address from CRS method */
|
||||
ret = hsmp_read_acpi_crs(sock);
|
||||
ret = hsmp_read_acpi_crs(dev, sock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Read mailbox offsets from DSD table */
|
||||
return hsmp_read_acpi_dsd(sock);
|
||||
return hsmp_read_acpi_dsd(dev, sock);
|
||||
}
|
||||
|
||||
static ssize_t hsmp_metric_tbl_acpi_read(struct file *filp, struct kobject *kobj,
|
||||
|
||||
Reference in New Issue
Block a user