Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: qcom: Constify GPR packet being send over GPR interface

gpr_send_pkt() and pkt_router_send_svc_pkt() only send the GPR packet
they receive, without any need to actually modify it, so mark the
pointer to GPR packet as pointer to const for code safety and code
self-documentation. Several users of this interface can follow up and
also operate on pointer to const.

Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260317-rpmsg-send-const-v3-4-4d7fd27f037f@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Bjorn Andersson
66ec8362 b8077b4d

+14 -13
+4 -4
drivers/soc/qcom/apr.c
··· 123 123 } 124 124 EXPORT_SYMBOL_GPL(gpr_alloc_port); 125 125 126 - static int pkt_router_send_svc_pkt(struct pkt_router_svc *svc, struct gpr_pkt *pkt) 126 + static int pkt_router_send_svc_pkt(struct pkt_router_svc *svc, const struct gpr_pkt *pkt) 127 127 { 128 128 struct packet_router *pr = svc->pr; 129 - struct gpr_hdr *hdr; 129 + const struct gpr_hdr *hdr; 130 130 unsigned long flags; 131 131 int ret; 132 132 ··· 139 139 return ret ? ret : hdr->pkt_size; 140 140 } 141 141 142 - int gpr_send_pkt(struct apr_device *gdev, struct gpr_pkt *pkt) 142 + int gpr_send_pkt(struct apr_device *gdev, const struct gpr_pkt *pkt) 143 143 { 144 144 return pkt_router_send_svc_pkt(&gdev->svc, pkt); 145 145 } 146 146 EXPORT_SYMBOL_GPL(gpr_send_pkt); 147 147 148 - int gpr_send_port_pkt(gpr_port_t *port, struct gpr_pkt *pkt) 148 + int gpr_send_port_pkt(gpr_port_t *port, const struct gpr_pkt *pkt) 149 149 { 150 150 return pkt_router_send_svc_pkt(port, pkt); 151 151 }
+2 -2
include/linux/soc/qcom/apr.h
··· 191 191 gpr_port_t *gpr_alloc_port(gpr_device_t *gdev, struct device *dev, 192 192 gpr_port_cb cb, void *priv); 193 193 void gpr_free_port(gpr_port_t *port); 194 - int gpr_send_port_pkt(gpr_port_t *port, struct gpr_pkt *pkt); 195 - int gpr_send_pkt(gpr_device_t *gdev, struct gpr_pkt *pkt); 194 + int gpr_send_port_pkt(gpr_port_t *port, const struct gpr_pkt *pkt); 195 + int gpr_send_pkt(gpr_device_t *gdev, const struct gpr_pkt *pkt); 196 196 197 197 #endif /* __QCOM_APR_H_ */
+3 -3
sound/soc/qcom/qdsp6/audioreach.c
··· 579 579 int audioreach_send_cmd_sync(struct device *dev, gpr_device_t *gdev, 580 580 struct gpr_ibasic_rsp_result_t *result, struct mutex *cmd_lock, 581 581 gpr_port_t *port, wait_queue_head_t *cmd_wait, 582 - struct gpr_pkt *pkt, uint32_t rsp_opcode) 582 + const struct gpr_pkt *pkt, uint32_t rsp_opcode) 583 583 { 584 584 585 - struct gpr_hdr *hdr = &pkt->hdr; 585 + const struct gpr_hdr *hdr = &pkt->hdr; 586 586 int rc; 587 587 588 588 mutex_lock(cmd_lock); ··· 622 622 } 623 623 EXPORT_SYMBOL_GPL(audioreach_send_cmd_sync); 624 624 625 - int audioreach_graph_send_cmd_sync(struct q6apm_graph *graph, struct gpr_pkt *pkt, 625 + int audioreach_graph_send_cmd_sync(struct q6apm_graph *graph, const struct gpr_pkt *pkt, 626 626 uint32_t rsp_opcode) 627 627 { 628 628
+2 -2
sound/soc/qcom/qdsp6/audioreach.h
··· 844 844 bool is_contiguous); 845 845 int audioreach_send_cmd_sync(struct device *dev, gpr_device_t *gdev, struct gpr_ibasic_rsp_result_t *result, 846 846 struct mutex *cmd_lock, gpr_port_t *port, wait_queue_head_t *cmd_wait, 847 - struct gpr_pkt *pkt, uint32_t rsp_opcode); 848 - int audioreach_graph_send_cmd_sync(struct q6apm_graph *graph, struct gpr_pkt *pkt, 847 + const struct gpr_pkt *pkt, uint32_t rsp_opcode); 848 + int audioreach_graph_send_cmd_sync(struct q6apm_graph *graph, const struct gpr_pkt *pkt, 849 849 uint32_t rsp_opcode); 850 850 int audioreach_set_media_format(struct q6apm_graph *graph, 851 851 const struct audioreach_module *module,
+2 -1
sound/soc/qcom/qdsp6/q6apm.c
··· 29 29 30 30 static struct q6apm *g_apm; 31 31 32 - int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt, uint32_t rsp_opcode) 32 + int q6apm_send_cmd_sync(struct q6apm *apm, const struct gpr_pkt *pkt, 33 + uint32_t rsp_opcode) 33 34 { 34 35 gpr_device_t *gdev = apm->gdev; 35 36
+1 -1
sound/soc/qcom/qdsp6/q6apm.h
··· 138 138 int q6apm_unmap_memory_regions(struct q6apm_graph *graph, 139 139 unsigned int dir); 140 140 /* Helpers */ 141 - int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt, 141 + int q6apm_send_cmd_sync(struct q6apm *apm, const struct gpr_pkt *pkt, 142 142 uint32_t rsp_opcode); 143 143 144 144 /* Callback for graph specific */