Commit c358eb46 authored by Konrad Dybcio's avatar Konrad Dybcio Committed by Ulf Hansson

pmdomain: qcom: rpmpd: Keep one RPM handle for all RPMPDs

For no apparent reason (as there's just one RPM per SoC), all RPMPDs
currently store a copy of a pointer to smd_rpm. Introduce a single,
global one to save up on space in each definition.

bloat-o-meter reports:

Total: Before=92010, After=91062, chg -1.03%
Signed-off-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20231227-topic-rpmpd_cleanup-v1-1-860ab141b076@linaro.orgSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 2b391c4c
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#define domain_to_rpmpd(domain) container_of(domain, struct rpmpd, pd) #define domain_to_rpmpd(domain) container_of(domain, struct rpmpd, pd)
static struct qcom_smd_rpm *rpmpd_smd_rpm;
/* Resource types: /* Resource types:
* RPMPD_X is X encoded as a little-endian, lower-case, ASCII string */ * RPMPD_X is X encoded as a little-endian, lower-case, ASCII string */
#define RPMPD_SMPA 0x61706d73 #define RPMPD_SMPA 0x61706d73
...@@ -54,7 +56,6 @@ struct rpmpd { ...@@ -54,7 +56,6 @@ struct rpmpd {
bool enabled; bool enabled;
const int res_type; const int res_type;
const int res_id; const int res_id;
struct qcom_smd_rpm *rpm;
unsigned int max_state; unsigned int max_state;
__le32 key; __le32 key;
bool state_synced; bool state_synced;
...@@ -879,7 +880,7 @@ static int rpmpd_send_enable(struct rpmpd *pd, bool enable) ...@@ -879,7 +880,7 @@ static int rpmpd_send_enable(struct rpmpd *pd, bool enable)
.value = cpu_to_le32(enable), .value = cpu_to_le32(enable),
}; };
return qcom_rpm_smd_write(pd->rpm, QCOM_SMD_RPM_ACTIVE_STATE, return qcom_rpm_smd_write(rpmpd_smd_rpm, QCOM_SMD_RPM_ACTIVE_STATE,
pd->res_type, pd->res_id, &req, sizeof(req)); pd->res_type, pd->res_id, &req, sizeof(req));
} }
...@@ -891,7 +892,7 @@ static int rpmpd_send_corner(struct rpmpd *pd, int state, unsigned int corner) ...@@ -891,7 +892,7 @@ static int rpmpd_send_corner(struct rpmpd *pd, int state, unsigned int corner)
.value = cpu_to_le32(corner), .value = cpu_to_le32(corner),
}; };
return qcom_rpm_smd_write(pd->rpm, state, pd->res_type, pd->res_id, return qcom_rpm_smd_write(rpmpd_smd_rpm, state, pd->res_type, pd->res_id,
&req, sizeof(req)); &req, sizeof(req));
}; };
...@@ -1004,12 +1005,11 @@ static int rpmpd_probe(struct platform_device *pdev) ...@@ -1004,12 +1005,11 @@ static int rpmpd_probe(struct platform_device *pdev)
int i; int i;
size_t num; size_t num;
struct genpd_onecell_data *data; struct genpd_onecell_data *data;
struct qcom_smd_rpm *rpm;
struct rpmpd **rpmpds; struct rpmpd **rpmpds;
const struct rpmpd_desc *desc; const struct rpmpd_desc *desc;
rpm = dev_get_drvdata(pdev->dev.parent); rpmpd_smd_rpm = dev_get_drvdata(pdev->dev.parent);
if (!rpm) { if (!rpmpd_smd_rpm) {
dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n"); dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1039,7 +1039,6 @@ static int rpmpd_probe(struct platform_device *pdev) ...@@ -1039,7 +1039,6 @@ static int rpmpd_probe(struct platform_device *pdev)
continue; continue;
} }
rpmpds[i]->rpm = rpm;
rpmpds[i]->max_state = desc->max_state; rpmpds[i]->max_state = desc->max_state;
rpmpds[i]->pd.power_off = rpmpd_power_off; rpmpds[i]->pd.power_off = rpmpd_power_off;
rpmpds[i]->pd.power_on = rpmpd_power_on; rpmpds[i]->pd.power_on = rpmpd_power_on;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment