Skip to content

Commit c358eb4

Browse files
konradybciostorulf
authored andcommitted
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: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20231227-topic-rpmpd_cleanup-v1-1-860ab141b076@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 2b391c4 commit c358eb4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/pmdomain/qcom/rpmpd.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#define domain_to_rpmpd(domain) container_of(domain, struct rpmpd, pd)
1818

19+
static struct qcom_smd_rpm *rpmpd_smd_rpm;
20+
1921
/* Resource types:
2022
* RPMPD_X is X encoded as a little-endian, lower-case, ASCII string */
2123
#define RPMPD_SMPA 0x61706d73
@@ -54,7 +56,6 @@ struct rpmpd {
5456
bool enabled;
5557
const int res_type;
5658
const int res_id;
57-
struct qcom_smd_rpm *rpm;
5859
unsigned int max_state;
5960
__le32 key;
6061
bool state_synced;
@@ -879,7 +880,7 @@ static int rpmpd_send_enable(struct rpmpd *pd, bool enable)
879880
.value = cpu_to_le32(enable),
880881
};
881882

882-
return qcom_rpm_smd_write(pd->rpm, QCOM_SMD_RPM_ACTIVE_STATE,
883+
return qcom_rpm_smd_write(rpmpd_smd_rpm, QCOM_SMD_RPM_ACTIVE_STATE,
883884
pd->res_type, pd->res_id, &req, sizeof(req));
884885
}
885886

@@ -891,7 +892,7 @@ static int rpmpd_send_corner(struct rpmpd *pd, int state, unsigned int corner)
891892
.value = cpu_to_le32(corner),
892893
};
893894

894-
return qcom_rpm_smd_write(pd->rpm, state, pd->res_type, pd->res_id,
895+
return qcom_rpm_smd_write(rpmpd_smd_rpm, state, pd->res_type, pd->res_id,
895896
&req, sizeof(req));
896897
};
897898

@@ -1004,12 +1005,11 @@ static int rpmpd_probe(struct platform_device *pdev)
10041005
int i;
10051006
size_t num;
10061007
struct genpd_onecell_data *data;
1007-
struct qcom_smd_rpm *rpm;
10081008
struct rpmpd **rpmpds;
10091009
const struct rpmpd_desc *desc;
10101010

1011-
rpm = dev_get_drvdata(pdev->dev.parent);
1012-
if (!rpm) {
1011+
rpmpd_smd_rpm = dev_get_drvdata(pdev->dev.parent);
1012+
if (!rpmpd_smd_rpm) {
10131013
dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n");
10141014
return -ENODEV;
10151015
}
@@ -1039,7 +1039,6 @@ static int rpmpd_probe(struct platform_device *pdev)
10391039
continue;
10401040
}
10411041

1042-
rpmpds[i]->rpm = rpm;
10431042
rpmpds[i]->max_state = desc->max_state;
10441043
rpmpds[i]->pd.power_off = rpmpd_power_off;
10451044
rpmpds[i]->pd.power_on = rpmpd_power_on;

0 commit comments

Comments
 (0)