Skip to content

Commit 80fcd1e

Browse files
sudeep-hollagroeck
authored andcommitted
hwmon: (xgene-hwmon) Simplify PCC shared memory region handling
The PCC driver now handles mapping and unmapping of shared memory areas as part of pcc_mbox_{request,free}_channel(). Without these before, this xgene hwmon driver did handling of those mappings like several other PCC mailbox client drivers. There were redundant operations, leading to unnecessary code. Maintaining the consistency across these driver was harder due to scattered handling of shmem. Just use the mapped shmem and remove all redundant operations from this driver. Cc: Jean Delvare <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: [email protected] Signed-off-by: Sudeep Holla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 5659108 commit 80fcd1e

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

drivers/hwmon/xgene-hwmon.c

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ struct xgene_hwmon_dev {
103103
struct device *hwmon_dev;
104104
bool temp_critical_alarm;
105105

106-
phys_addr_t comm_base_addr;
107-
void *pcc_comm_addr;
108106
unsigned int usecs_lat;
109107
};
110108

@@ -125,7 +123,8 @@ static u16 xgene_word_tst_and_clr(u16 *addr, u16 mask)
125123

126124
static int xgene_hwmon_pcc_rd(struct xgene_hwmon_dev *ctx, u32 *msg)
127125
{
128-
struct acpi_pcct_shared_memory *generic_comm_base = ctx->pcc_comm_addr;
126+
struct acpi_pcct_shared_memory __iomem *generic_comm_base =
127+
ctx->pcc_chan->shmem;
129128
u32 *ptr = (void *)(generic_comm_base + 1);
130129
int rc, i;
131130
u16 val;
@@ -523,7 +522,8 @@ static void xgene_hwmon_rx_cb(struct mbox_client *cl, void *msg)
523522
static void xgene_hwmon_pcc_rx_cb(struct mbox_client *cl, void *msg)
524523
{
525524
struct xgene_hwmon_dev *ctx = to_xgene_hwmon_dev(cl);
526-
struct acpi_pcct_shared_memory *generic_comm_base = ctx->pcc_comm_addr;
525+
struct acpi_pcct_shared_memory __iomem *generic_comm_base =
526+
ctx->pcc_chan->shmem;
527527
struct slimpro_resp_msg amsg;
528528

529529
/*
@@ -649,7 +649,6 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
649649
} else {
650650
struct pcc_mbox_chan *pcc_chan;
651651
const struct acpi_device_id *acpi_id;
652-
int version;
653652

654653
acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
655654
&pdev->dev);
@@ -658,8 +657,6 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
658657
goto out_mbox_free;
659658
}
660659

661-
version = (int)acpi_id->driver_data;
662-
663660
if (device_property_read_u32(&pdev->dev, "pcc-channel",
664661
&ctx->mbox_idx)) {
665662
dev_err(&pdev->dev, "no pcc-channel property\n");
@@ -685,34 +682,6 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
685682
goto out;
686683
}
687684

688-
/*
689-
* This is the shared communication region
690-
* for the OS and Platform to communicate over.
691-
*/
692-
ctx->comm_base_addr = pcc_chan->shmem_base_addr;
693-
if (ctx->comm_base_addr) {
694-
if (version == XGENE_HWMON_V2)
695-
ctx->pcc_comm_addr = (void __force *)devm_ioremap(&pdev->dev,
696-
ctx->comm_base_addr,
697-
pcc_chan->shmem_size);
698-
else
699-
ctx->pcc_comm_addr = devm_memremap(&pdev->dev,
700-
ctx->comm_base_addr,
701-
pcc_chan->shmem_size,
702-
MEMREMAP_WB);
703-
} else {
704-
dev_err(&pdev->dev, "Failed to get PCC comm region\n");
705-
rc = -ENODEV;
706-
goto out;
707-
}
708-
709-
if (IS_ERR_OR_NULL(ctx->pcc_comm_addr)) {
710-
dev_err(&pdev->dev,
711-
"Failed to ioremap PCC comm region\n");
712-
rc = -ENOMEM;
713-
goto out;
714-
}
715-
716685
/*
717686
* pcc_chan->latency is just a Nominal value. In reality
718687
* the remote processor could be much slower to reply.

0 commit comments

Comments
 (0)