hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/mxs/mxs-saif.c
....@@ -1,19 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright 2011 Freescale Semiconductor, Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with this program; if not, write to the Free Software Foundation, Inc.,
16
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
174 */
185
196 #include <linux/module.h>
....@@ -26,6 +13,7 @@
2613 #include <linux/clk.h>
2714 #include <linux/clk-provider.h>
2815 #include <linux/delay.h>
16
+#include <linux/io.h>
2917 #include <linux/time.h>
3018 #include <sound/core.h>
3119 #include <sound/pcm.h>
....@@ -467,7 +455,10 @@
467455 * basic clock which should be fast enough for the internal
468456 * logic.
469457 */
470
- clk_enable(saif->clk);
458
+ ret = clk_enable(saif->clk);
459
+ if (ret)
460
+ return ret;
461
+
471462 ret = clk_set_rate(saif->clk, 24000000);
472463 clk_disable(saif->clk);
473464 if (ret)
....@@ -744,13 +735,9 @@
744735 static int mxs_saif_probe(struct platform_device *pdev)
745736 {
746737 struct device_node *np = pdev->dev.of_node;
747
- struct resource *iores;
748738 struct mxs_saif *saif;
749
- int irq, ret = 0;
739
+ int irq, ret;
750740 struct device_node *master;
751
-
752
- if (!np)
753
- return -EINVAL;
754741
755742 saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL);
756743 if (!saif)
....@@ -777,6 +764,7 @@
777764 saif->master_id = saif->id;
778765 } else {
779766 ret = of_alias_get_id(master, "saif");
767
+ of_node_put(master);
780768 if (ret < 0)
781769 return ret;
782770 else
....@@ -798,19 +786,13 @@
798786 return ret;
799787 }
800788
801
- iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
802
-
803
- saif->base = devm_ioremap_resource(&pdev->dev, iores);
789
+ saif->base = devm_platform_ioremap_resource(pdev, 0);
804790 if (IS_ERR(saif->base))
805791 return PTR_ERR(saif->base);
806792
807793 irq = platform_get_irq(pdev, 0);
808
- if (irq < 0) {
809
- ret = irq;
810
- dev_err(&pdev->dev, "failed to get irq resource: %d\n",
811
- ret);
812
- return ret;
813
- }
794
+ if (irq < 0)
795
+ return irq;
814796
815797 saif->dev = &pdev->dev;
816798 ret = devm_request_irq(&pdev->dev, irq, mxs_saif_irq, 0,