forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/qcom/qdsp6/q6adm.c
....@@ -2,25 +2,24 @@
22 // Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
33 // Copyright (c) 2018, Linaro Limited
44
5
-#include <linux/slab.h>
6
-#include <linux/wait.h>
7
-#include <linux/kernel.h>
85 #include <linux/device.h>
9
-#include <linux/module.h>
10
-#include <linux/sched.h>
116 #include <linux/jiffies.h>
7
+#include <linux/kernel.h>
8
+#include <linux/kref.h>
9
+#include <linux/module.h>
1210 #include <linux/of.h>
1311 #include <linux/of_platform.h>
14
-#include <linux/kref.h>
15
-#include <linux/wait.h>
16
-#include <linux/soc/qcom/apr.h>
1712 #include <linux/platform_device.h>
13
+#include <linux/sched.h>
14
+#include <linux/slab.h>
15
+#include <linux/soc/qcom/apr.h>
16
+#include <linux/wait.h>
1817 #include <sound/asound.h>
1918 #include "q6adm.h"
2019 #include "q6afe.h"
2120 #include "q6core.h"
22
-#include "q6dsp-errno.h"
2321 #include "q6dsp-common.h"
22
+#include "q6dsp-errno.h"
2423
2524 #define ADM_CMD_DEVICE_OPEN_V5 0x00010326
2625 #define ADM_CMDRSP_DEVICE_OPEN_V5 0x00010329
....@@ -218,7 +217,7 @@
218217 idx = find_first_zero_bit(&adm->copp_bitmap[port_idx],
219218 MAX_COPPS_PER_PORT);
220219
221
- if (idx > MAX_COPPS_PER_PORT)
220
+ if (idx >= MAX_COPPS_PER_PORT)
222221 return ERR_PTR(-EBUSY);
223222
224223 c = kzalloc(sizeof(*c), GFP_ATOMIC);
....@@ -404,7 +403,7 @@
404403
405404 spin_lock_irqsave(&adm->copps_list_lock, flags);
406405 copp = q6adm_alloc_copp(adm, port_id);
407
- if (IS_ERR_OR_NULL(copp)) {
406
+ if (IS_ERR(copp)) {
408407 spin_unlock_irqrestore(&adm->copps_list_lock, flags);
409408 return ERR_CAST(copp);
410409 }
....@@ -419,7 +418,6 @@
419418 copp->channels = channel_mode;
420419 copp->bit_width = bit_width;
421420 copp->app_type = app_type;
422
-
423421
424422 ret = q6adm_device_open(adm, copp, port_id, path, topology,
425423 channel_mode, bit_width, rate);
....@@ -589,12 +587,12 @@
589587 struct device *dev = &adev->dev;
590588 struct q6adm *adm;
591589
592
- adm = devm_kzalloc(&adev->dev, sizeof(*adm), GFP_KERNEL);
590
+ adm = devm_kzalloc(dev, sizeof(*adm), GFP_KERNEL);
593591 if (!adm)
594592 return -ENOMEM;
595593
596594 adm->apr = adev;
597
- dev_set_drvdata(&adev->dev, adm);
595
+ dev_set_drvdata(dev, adm);
598596 adm->dev = dev;
599597 q6core_get_svc_api_info(adev->svc_id, &adm->ainfo);
600598 mutex_init(&adm->lock);
....@@ -613,11 +611,13 @@
613611 return 0;
614612 }
615613
614
+#ifdef CONFIG_OF
616615 static const struct of_device_id q6adm_device_id[] = {
617616 { .compatible = "qcom,q6adm" },
618617 {},
619618 };
620619 MODULE_DEVICE_TABLE(of, q6adm_device_id);
620
+#endif
621621
622622 static struct apr_driver qcom_q6adm_driver = {
623623 .probe = q6adm_probe,