lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 3 May 2023 13:23:17 +0000
From:   Trevor Wu (吳文良) <Trevor.Wu@...iatek.com>
To:     "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "angelogioacchino.delregno@...labora.com" 
        <angelogioacchino.delregno@...labora.com>
CC:     "sound-open-firmware@...a-project.org" 
        <sound-open-firmware@...a-project.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
        "ribalda@...omium.org" <ribalda@...omium.org>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "u.kleine-koenig@...gutronix.de" <u.kleine-koenig@...gutronix.de>,
        YC Hung (洪堯俊) <yc.hung@...iatek.com>,
        "kai.vehmanen@...ux.intel.com" <kai.vehmanen@...ux.intel.com>,
        Chunxu Li (李春旭) <Chunxu.Li@...iatek.com>,
        "kernel@...labora.com" <kernel@...labora.com>,
        "pierre-louis.bossart@...ux.intel.com" 
        <pierre-louis.bossart@...ux.intel.com>,
        Allen-KH Cheng (程冠勳) 
        <Allen-KH.Cheng@...iatek.com>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "tiwai@...e.com" <tiwai@...e.com>,
        "yung-chuan.liao@...ux.intel.com" <yung-chuan.liao@...ux.intel.com>,
        "ranjani.sridharan@...ux.intel.com" 
        <ranjani.sridharan@...ux.intel.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "matthias.bgg@...il.com" <matthias.bgg@...il.com>,
        "peter.ujfalusi@...ux.intel.com" <peter.ujfalusi@...ux.intel.com>,
        "perex@...ex.cz" <perex@...ex.cz>,
        "daniel.baluta@....com" <daniel.baluta@....com>,
        "nicolas.ferre@...rochip.com" <nicolas.ferre@...rochip.com>,
        TingHan Shen (沈廷翰) 
        <TingHan.Shen@...iatek.com>,
        "error27@...il.com" <error27@...il.com>
Subject: Re: [PATCH 3/5] ASoC: mediatek: mt8195-afe-pcm: Simplify runtime PM
 during probe

On Wed, 2023-05-03 at 13:34 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Use devm_pm_runtime_enable() and pm_runtime_resume_and_get() to
> to simplify the probe function.
> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@...labora.com>

Acked-by: Trevor Wu <trevor.wu@...iatek.com>
> ---
>  sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 22 ++++++++++++------
> ----
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> index 9e45efeada55..a54c16e0aa05 100644
> --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> @@ -3179,16 +3179,16 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
> 
>         mt8195_afe_parse_of(afe, pdev->dev.of_node);
> 
> -       pm_runtime_enable(dev);
> -       if (!pm_runtime_enabled(dev)) {
> -               ret = mt8195_afe_runtime_resume(dev);
> -               if (ret)
> -                       return ret;
> -       }
> -
>         /* enable clock for regcache get default value from hw */
>         afe_priv->pm_runtime_bypass_reg_ctl = true;
> -       pm_runtime_get_sync(dev);
> +
> +       ret = devm_pm_runtime_enable(dev);
> +       if (ret)
> +               return ret;
> +
> +       ret = pm_runtime_resume_and_get(dev);
> +       if (ret)
> +               return dev_err_probe(dev, ret, "Failed to resume
> device\n");
> 
>         afe->regmap = devm_regmap_init_mmio(&pdev->dev, afe-
> >base_addr,
>                                             &mt8195_afe_regmap_config
> );
> @@ -3238,7 +3238,10 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
> 
>         mt8195_afe_init_registers(afe);
> 
> -       pm_runtime_put_sync(dev);
> +       ret = pm_runtime_put_sync(dev);
> +       if (ret)
> +               return dev_err_probe(dev, ret, "Failed to suspend
> device\n");
> +
>         afe_priv->pm_runtime_bypass_reg_ctl = false;
> 
>         regcache_cache_only(afe->regmap, true);
> @@ -3248,7 +3251,6 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
> 
>  err_pm_put:
>         pm_runtime_put_sync(dev);
> -       pm_runtime_disable(dev);
> 
>         return ret;
>  }
> --
> 2.40.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ