]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: qcom: Constify APR callback response data
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Sun, 30 Nov 2025 09:40:23 +0000 (10:40 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 19 Dec 2025 21:29:28 +0000 (21:29 +0000)
APR bus driver calls each APR client callback with pointer to the APR
response packet.  The callbacks are not suppose to modify that response
packet, so make it a pointer to const to document that expectation
explicitly.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20251130-asoc-apr-const-v1-1-d0833f3ed423@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/linux/soc/qcom/apr.h
sound/soc/qcom/qdsp6/q6adm.c
sound/soc/qcom/qdsp6/q6afe.c
sound/soc/qcom/qdsp6/q6asm.c
sound/soc/qcom/qdsp6/q6core.c

index a532d1e4b1f4d9588927b1c6a01c7fada72bfd4b..35f44cd868cba5a0ec7513e798d1c97b2772cce3 100644 (file)
@@ -155,7 +155,7 @@ struct apr_driver {
        int     (*probe)(struct apr_device *sl);
        void    (*remove)(struct apr_device *sl);
        int     (*callback)(struct apr_device *a,
-                           struct apr_resp_pkt *d);
+                           const struct apr_resp_pkt *d);
        int     (*gpr_callback)(struct gpr_resp_pkt *d, void *data, int op);
        struct device_driver            driver;
        const struct apr_device_id      *id_table;
index 0b8d06ec8b2691d1e3d00e8082b71d07bfd1b42e..608ca0e41539f414a0098db07e774644a30ba742 100644 (file)
@@ -186,11 +186,11 @@ static void q6adm_free_copp(struct kref *ref)
        kfree(c);
 }
 
-static int q6adm_callback(struct apr_device *adev, struct apr_resp_pkt *data)
+static int q6adm_callback(struct apr_device *adev, const struct apr_resp_pkt *data)
 {
        struct aprv2_ibasic_rsp_result_t *result = data->payload;
        int port_idx, copp_idx;
-       struct apr_hdr *hdr = &data->hdr;
+       const struct apr_hdr *hdr = &data->hdr;
        struct q6copp *copp;
        struct q6adm *adm = dev_get_drvdata(&adev->dev);
 
index 0b01fc9e13a7278ff11567bc4e7f14ae65c60d91..a9f8b7d68a96bc1fea9abba951c7cf446cd9439d 100644 (file)
@@ -958,11 +958,11 @@ static struct q6afe_port *q6afe_find_port(struct q6afe *afe, int token)
        return ret;
 }
 
-static int q6afe_callback(struct apr_device *adev, struct apr_resp_pkt *data)
+static int q6afe_callback(struct apr_device *adev, const struct apr_resp_pkt *data)
 {
        struct q6afe *afe = dev_get_drvdata(&adev->dev);
        struct aprv2_ibasic_rsp_result_t *res;
-       struct apr_hdr *hdr = &data->hdr;
+       const struct apr_hdr *hdr = &data->hdr;
        struct q6afe_port *port;
 
        if (!data->payload_size)
index e7295b7b246105733a3728d7e0f21e68fa6a730b..df183b7a4019c1526c451773874a5800210f2f1b 100644 (file)
@@ -599,12 +599,12 @@ int q6asm_get_hw_pointer(struct audio_client *ac, unsigned int dir)
 EXPORT_SYMBOL_GPL(q6asm_get_hw_pointer);
 
 static int32_t q6asm_stream_callback(struct apr_device *adev,
-                                    struct apr_resp_pkt *data,
+                                    const struct apr_resp_pkt *data,
                                     int session_id)
 {
        struct q6asm *q6asm = dev_get_drvdata(&adev->dev);
        struct aprv2_ibasic_rsp_result_t *result;
-       struct apr_hdr *hdr = &data->hdr;
+       const struct apr_hdr *hdr = &data->hdr;
        struct audio_port_data *port;
        struct audio_client *ac;
        uint32_t client_event = 0;
@@ -744,13 +744,13 @@ done:
 }
 
 static int q6asm_srvc_callback(struct apr_device *adev,
-                              struct apr_resp_pkt *data)
+                              const struct apr_resp_pkt *data)
 {
        struct q6asm *q6asm = dev_get_drvdata(&adev->dev);
        struct aprv2_ibasic_rsp_result_t *result;
        struct audio_port_data *port;
        struct audio_client *ac = NULL;
-       struct apr_hdr *hdr = &data->hdr;
+       const struct apr_hdr *hdr = &data->hdr;
        struct q6asm *a;
        uint32_t sid = 0;
        uint32_t dir = 0;
index 49cfb32cd20917cea2fe51c4c513fcfadc2a972d..51398199bff3d9fe6a6583c8bf9b13527bc10747 100644 (file)
@@ -67,11 +67,11 @@ struct q6core {
 
 static struct q6core *g_core;
 
-static int q6core_callback(struct apr_device *adev, struct apr_resp_pkt *data)
+static int q6core_callback(struct apr_device *adev, const struct apr_resp_pkt *data)
 {
        struct q6core *core = dev_get_drvdata(&adev->dev);
        struct aprv2_ibasic_rsp_result_t *result;
-       struct apr_hdr *hdr = &data->hdr;
+       const struct apr_hdr *hdr = &data->hdr;
 
        result = data->payload;
        switch (hdr->opcode) {