[PATCH v4 05/18] ASoC: mediatek: mt8192: Migrate to mtk_soundcard_common_probe

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Wed Apr 10 08:28:41 PDT 2024


Il 10/04/24 15:59, Alexandre Mergnat ha scritto:
> 
> 
> On 09/04/2024 13:32, AngeloGioacchino Del Regno wrote:
>> @@ -1211,52 +1196,85 @@ static int mt8192_mt6359_dev_probe(struct platform_device 
>> *pdev)
>>           if (dai_link->num_codecs && dai_link->codecs[0].dai_name &&
>>               strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0)
>>               dai_link->ops = &mt8192_rt1015_i2s_ops;
>> -
>> -        if (!dai_link->platforms->name)
>> -            dai_link->platforms->of_node = platform_node;
>> -    }
>> -
>> -    priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>> -    if (!priv) {
>> -        ret = -ENOMEM;
>> -        goto err_probe;
>> -    }
>> -    snd_soc_card_set_drvdata(card, priv);
>> -
>> -    ret = mt8192_afe_gpio_init(&pdev->dev);
>> -    if (ret) {
>> -        dev_err_probe(&pdev->dev, ret, "%s init gpio error\n", __func__);
> 
> I don't think __func__ is necessary.
> 
>> -        goto err_probe;
>>       }
>> -    ret = devm_snd_soc_register_card(&pdev->dev, card);
>> -    if (ret)
>> -        dev_err_probe(&pdev->dev, ret, "%s snd_soc_register_card fail\n", 
>> __func__);
> 
> I don't think __func__ is necessary.

I am removing the line, here :-P

> 
>> -
>> -err_probe:
>>       of_node_put(headset_codec);
>>   err_headset_codec:
>>       of_node_put(speaker_codec);
>>   err_speaker_codec:
>> -    of_node_put(platform_node);
>> -err_platform_node:
>> -    of_node_put(hdmi_codec);
>> +    if (hdmi_codec)
>> +        of_node_put(hdmi_codec);
>> +
>>       return ret;
>>   }
>> +static int mt8192_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data, 
>> bool legacy)
>> +{
>> +    struct mtk_platform_card_data *card_data = soc_card_data->card_data;
>> +    struct snd_soc_card *card = card_data->card;
>> +    int ret;
>> +
>> +    if (legacy) {
>> +        ret = mt8192_mt6359_legacy_probe(soc_card_data);
>> +        if (ret)
>> +            return ret;
>> +    } else {
>> +        struct snd_soc_dai_link *dai_link;
>> +        int i;
>> +
>> +        for_each_card_prelinks(card, i, dai_link)
>> +            if (dai_link->num_codecs && dai_link->codecs[0].dai_name &&
>> +                strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0)
>> +                dai_link->ops = &mt8192_rt1015_i2s_ops;
>> +    }
>> +
>> +    ret = mt8192_afe_gpio_init(card->dev);
>> +    if (ret)
>> +        return dev_err_probe(card->dev, ret, "%s init gpio error\n", __func__);
> 
> I don't think __func__ is necessary.
> 

That was on purpose.
I'm migrating things, but I am leaving the prints as they were.

Cheers,
Angelo

>> +
>> +    return 0;
>> +}
> 
> Beside that,
> Reviewed-by: Alexandre Mergnat <amergnat at baylibre.com>
> 






More information about the Linux-mediatek mailing list