kernel: bump 6.1 to 6.1.80
[openwrt/staging/stintel.git] / target / linux / d1 / patches-6.1 / 0069-ASoC-sun4i-spdif-Simplify-code-around-optional-reset.patch
1 From 0efd742482dbe4b17a441eab5c57231d65f9a852 Mon Sep 17 00:00:00 2001
2 From: Samuel Holland <samuel@sholland.org>
3 Date: Sat, 13 Nov 2021 11:14:30 -0600
4 Subject: [PATCH 069/117] ASoC: sun4i-spdif: Simplify code around optional
5 resets
6
7 The driver does not need to care about which variants have a reset;
8 the devicetree binding already enforces that the necessary resources are
9 provided. Simplify the logic by always calling the optional getter,
10 which will return NULL if no reset reference is found.
11
12 Also clean up the error handling, which should not print a misleading
13 error in the EPROBE_DEFER case.
14
15 Signed-off-by: Samuel Holland <samuel@sholland.org>
16 ---
17 sound/soc/sunxi/sun4i-spdif.c | 22 ++++++----------------
18 1 file changed, 6 insertions(+), 16 deletions(-)
19
20 --- a/sound/soc/sunxi/sun4i-spdif.c
21 +++ b/sound/soc/sunxi/sun4i-spdif.c
22 @@ -170,12 +170,10 @@
23 * struct sun4i_spdif_quirks - Differences between SoC variants.
24 *
25 * @reg_dac_txdata: TX FIFO offset for DMA config.
26 - * @has_reset: SoC needs reset deasserted.
27 * @val_fctl_ftx: TX FIFO flush bitmask.
28 */
29 struct sun4i_spdif_quirks {
30 unsigned int reg_dac_txdata;
31 - bool has_reset;
32 unsigned int val_fctl_ftx;
33 };
34
35 @@ -546,19 +544,16 @@ static const struct sun4i_spdif_quirks s
36 static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = {
37 .reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
38 .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
39 - .has_reset = true,
40 };
41
42 static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = {
43 .reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
44 .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
45 - .has_reset = true,
46 };
47
48 static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = {
49 .reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
50 .val_fctl_ftx = SUN50I_H6_SPDIF_FCTL_FTX,
51 - .has_reset = true,
52 };
53
54 static const struct of_device_id sun4i_spdif_of_match[] = {
55 @@ -672,17 +667,12 @@ static int sun4i_spdif_probe(struct plat
56
57 platform_set_drvdata(pdev, host);
58
59 - if (quirks->has_reset) {
60 - host->rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
61 - NULL);
62 - if (PTR_ERR(host->rst) == -EPROBE_DEFER) {
63 - ret = -EPROBE_DEFER;
64 - dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
65 - return ret;
66 - }
67 - if (!IS_ERR(host->rst))
68 - reset_control_deassert(host->rst);
69 - }
70 + host->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
71 + if (IS_ERR(host->rst))
72 + return dev_err_probe(&pdev->dev, PTR_ERR(host->rst),
73 + "Failed to get reset\n");
74 +
75 + reset_control_deassert(host->rst);
76
77 ret = devm_snd_soc_register_component(&pdev->dev,
78 &sun4i_spdif_component, &sun4i_spdif_dai, 1);