Message ID | 20230515141610.v2.1.I0d1657be3fea5870f797e975a7aa490291e17993@changeid (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Hans Verkuil |
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1pyRWo-003E1I-9v; Mon, 15 May 2023 06:17:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238384AbjEOGRr (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 15 May 2023 02:17:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233813AbjEOGRq (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 15 May 2023 02:17:46 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89F01172D for <linux-media@vger.kernel.org>; Sun, 14 May 2023 23:17:44 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-53033a0b473so5874442a12.0 for <linux-media@vger.kernel.org>; Sun, 14 May 2023 23:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684131464; x=1686723464; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DY/Tvek46OkRim5dYg2uuI8WkPZBk0b6iwqvYb0rtSM=; b=SHQD3SCR9W+xMBa5+chJhxwA/WtZwLNXlmU69gJd0tzp7gXBkk5GmihQlO83gvhqu2 ILCPJqysWYqlwQC/4a1tMhGE4nX7QMwQoDG1A2s7ZGxk/BPKLuxDWcvMbbPgRwWyiBta 82f2sGFYCBKjfzsdc8HdtI1PSDcX/gCsQURSk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684131464; x=1686723464; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DY/Tvek46OkRim5dYg2uuI8WkPZBk0b6iwqvYb0rtSM=; b=P3wz3d9RKRnYQhsq5VQcVxHs5BqEgYQPDL24cDOphn4dG664G5r/wpvhDiLb0DYYkW hmT5srsJp0woRMec3mTrMyp5M5wQfRx9bj5z97rJAFCJ5QGvPhmsKtgfdwrFVHb5BhjN 24iguEeMJwNSovTPIaYCA9We/oy7AlZdqtBDwvZpcxTw2xIOIzfJ7oTbjnhSs1Qyg8LZ +QF6K9ECI5HfTpSWi+2bJS7iWtLS1q39DMElnUmSrChvUkeYecaFa/w60RQuj6YhUHB4 Rv5bceOxowx5k5kBGJgktH250LQpLnedXfrbrjmpk/SPtBVhVZTN2wtIAdurodZlElsn 8HdQ== X-Gm-Message-State: AC+VfDxsigmTPDLCj1wpdPjtSgJhiHG5HsFsnX9QeqvWn+ClEenfFzPc iAtaJDYjSWxsjfZZ0Lg8E/p6mA== X-Google-Smtp-Source: ACHHUZ52DW6enl/aNrixK9TkcAw1Q3rEqPtBBG3wTF5oS74t9pGxSj4R90JS+A4/OvgNSW7wfSaeSg== X-Received: by 2002:a05:6a20:144a:b0:105:dafa:feb3 with SMTP id a10-20020a056a20144a00b00105dafafeb3mr4095639pzi.61.1684131464030; Sun, 14 May 2023 23:17:44 -0700 (PDT) Received: from fshao-glinux.tpe.corp.google.com ([2401:fa00:1:10:cdf5:d894:a1d:dc15]) by smtp.gmail.com with ESMTPSA id 12-20020a63124c000000b00502ecb91940sm10680495pgs.55.2023.05.14.23.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 May 2023 23:17:43 -0700 (PDT) From: Fei Shao <fshao@chromium.org> To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Chen-Yu Tsai <wenst@chromium.org> Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>, Fei Shao <fshao@chromium.org>, Andrew-CT Chen <andrew-ct.chen@mediatek.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Matthias Brugger <matthias.bgg@gmail.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Tiffany Lin <tiffany.lin@mediatek.com>, Yunfei Dong <yunfei.dong@mediatek.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2] media: mediatek: vcodec: mtk_vcodec_dec_hw: Use devm_pm_runtime_enable() Date: Mon, 15 May 2023 14:16:10 +0800 Message-ID: <20230515141610.v2.1.I0d1657be3fea5870f797e975a7aa490291e17993@changeid> X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIMWL_WL_HIGH=0.001,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
[v2] media: mediatek: vcodec: mtk_vcodec_dec_hw: Use devm_pm_runtime_enable()
|
|
Commit Message
Fei Shao
May 15, 2023, 6:16 a.m. UTC
Convert pm_runtime_enable() to the managed version, and clean up error
handling and unnecessary .remove() callback accordingly.
Signed-off-by: Fei Shao <fshao@chromium.org>
---
Changes in v2:
Use devm_pm_runtime_enable() per suggestion from the previous thread:
https://lore.kernel.org/lkml/20230510164330.z2ygkl7vws6fci75@pengutronix.de/T/#m25be91afe3e9554600e859a8a59128ca234fc63d
.../mediatek/vcodec/mtk_vcodec_dec_hw.c | 26 ++++++-------------
1 file changed, 8 insertions(+), 18 deletions(-)
Comments
On 15/05/2023 08:16, Fei Shao wrote: > Convert pm_runtime_enable() to the managed version, and clean up error > handling and unnecessary .remove() callback accordingly. This patch no longer applies. Can you make a v3? Regards, Hans > > Signed-off-by: Fei Shao <fshao@chromium.org> > > --- > > Changes in v2: > Use devm_pm_runtime_enable() per suggestion from the previous thread: > https://lore.kernel.org/lkml/20230510164330.z2ygkl7vws6fci75@pengutronix.de/T/#m25be91afe3e9554600e859a8a59128ca234fc63d > > .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 26 ++++++------------- > 1 file changed, 8 insertions(+), 18 deletions(-) > > diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c > index b753bf54ebd9..e1cb2f8dca33 100644 > --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c > +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c > @@ -148,20 +148,21 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) > ret = mtk_vcodec_init_dec_clk(pdev, &subdev_dev->pm); > if (ret) > return ret; > - pm_runtime_enable(&pdev->dev); > + > + ret = devm_pm_runtime_enable(&pdev->dev); > + if (ret) > + return ret; > > of_id = of_match_device(mtk_vdec_hw_match, dev); > if (!of_id) { > dev_err(dev, "Can't get vdec subdev id.\n"); > - ret = -EINVAL; > - goto err; > + return -EINVAL; > } > > hw_idx = (enum mtk_vdec_hw_id)(uintptr_t)of_id->data; > if (hw_idx >= MTK_VDEC_HW_MAX) { > dev_err(dev, "Hardware index %d not correct.\n", hw_idx); > - ret = -EINVAL; > - goto err; > + return -EINVAL; > } > > main_dev->subdev_dev[hw_idx] = subdev_dev; > @@ -173,36 +174,25 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) > if (IS_SUPPORT_VDEC_HW_IRQ(hw_idx)) { > ret = mtk_vdec_hw_init_irq(subdev_dev); > if (ret) > - goto err; > + return ret; > } > > subdev_dev->reg_base[VDEC_HW_MISC] = > devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC])) { > ret = PTR_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC]); > - goto err; > + return ret; > } > > if (!main_dev->subdev_prob_done) > main_dev->subdev_prob_done = mtk_vdec_hw_prob_done; > > platform_set_drvdata(pdev, subdev_dev); > - return 0; > -err: > - pm_runtime_disable(subdev_dev->pm.dev); > - return ret; > -} > - > -static int mtk_vdec_hw_remove(struct platform_device *pdev) > -{ > - pm_runtime_disable(&pdev->dev); > - > return 0; > } > > static struct platform_driver mtk_vdec_driver = { > .probe = mtk_vdec_hw_probe, > - .remove = mtk_vdec_hw_remove, > .driver = { > .name = "mtk-vdec-comp", > .of_match_table = mtk_vdec_hw_match,
On 15/05/2023 08:16, Fei Shao wrote: > Convert pm_runtime_enable() to the managed version, and clean up error > handling and unnecessary .remove() callback accordingly. > > Signed-off-by: Fei Shao<fshao@chromium.org> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
On 23/05/2023 13:42, Hans Verkuil wrote: > On 15/05/2023 08:16, Fei Shao wrote: >> Convert pm_runtime_enable() to the managed version, and clean up error >> handling and unnecessary .remove() callback accordingly. > > This patch no longer applies. Can you make a v3? Sorry, you can ignore this. I now realize that this was a v2 of https://patchwork.linuxtv.org/project/linux-media/patch/20230510233117.1.I7047714f92ef7569bd21f118ae6aee20b3175a92@changeid/ I had that v1 applied, so obviously this v2 would fail to apply. After dropping that v1 patch it now applies cleanly. Regards, Hans > > Regards, > > Hans > >> >> Signed-off-by: Fei Shao <fshao@chromium.org> >> >> --- >> >> Changes in v2: >> Use devm_pm_runtime_enable() per suggestion from the previous thread: >> https://lore.kernel.org/lkml/20230510164330.z2ygkl7vws6fci75@pengutronix.de/T/#m25be91afe3e9554600e859a8a59128ca234fc63d >> >> .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 26 ++++++------------- >> 1 file changed, 8 insertions(+), 18 deletions(-) >> >> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c >> index b753bf54ebd9..e1cb2f8dca33 100644 >> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c >> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c >> @@ -148,20 +148,21 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) >> ret = mtk_vcodec_init_dec_clk(pdev, &subdev_dev->pm); >> if (ret) >> return ret; >> - pm_runtime_enable(&pdev->dev); >> + >> + ret = devm_pm_runtime_enable(&pdev->dev); >> + if (ret) >> + return ret; >> >> of_id = of_match_device(mtk_vdec_hw_match, dev); >> if (!of_id) { >> dev_err(dev, "Can't get vdec subdev id.\n"); >> - ret = -EINVAL; >> - goto err; >> + return -EINVAL; >> } >> >> hw_idx = (enum mtk_vdec_hw_id)(uintptr_t)of_id->data; >> if (hw_idx >= MTK_VDEC_HW_MAX) { >> dev_err(dev, "Hardware index %d not correct.\n", hw_idx); >> - ret = -EINVAL; >> - goto err; >> + return -EINVAL; >> } >> >> main_dev->subdev_dev[hw_idx] = subdev_dev; >> @@ -173,36 +174,25 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) >> if (IS_SUPPORT_VDEC_HW_IRQ(hw_idx)) { >> ret = mtk_vdec_hw_init_irq(subdev_dev); >> if (ret) >> - goto err; >> + return ret; >> } >> >> subdev_dev->reg_base[VDEC_HW_MISC] = >> devm_platform_ioremap_resource(pdev, 0); >> if (IS_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC])) { >> ret = PTR_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC]); >> - goto err; >> + return ret; >> } >> >> if (!main_dev->subdev_prob_done) >> main_dev->subdev_prob_done = mtk_vdec_hw_prob_done; >> >> platform_set_drvdata(pdev, subdev_dev); >> - return 0; >> -err: >> - pm_runtime_disable(subdev_dev->pm.dev); >> - return ret; >> -} >> - >> -static int mtk_vdec_hw_remove(struct platform_device *pdev) >> -{ >> - pm_runtime_disable(&pdev->dev); >> - >> return 0; >> } >> >> static struct platform_driver mtk_vdec_driver = { >> .probe = mtk_vdec_hw_probe, >> - .remove = mtk_vdec_hw_remove, >> .driver = { >> .name = "mtk-vdec-comp", >> .of_match_table = mtk_vdec_hw_match, >
Il 15/05/23 08:16, Fei Shao ha scritto: > Convert pm_runtime_enable() to the managed version, and clean up error > handling and unnecessary .remove() callback accordingly. > > Signed-off-by: Fei Shao <fshao@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> ...but I was probably too late :-)
On Tue, May 23, 2023 at 8:28 PM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: > > On 23/05/2023 13:42, Hans Verkuil wrote: > > On 15/05/2023 08:16, Fei Shao wrote: > >> Convert pm_runtime_enable() to the managed version, and clean up error > >> handling and unnecessary .remove() callback accordingly. > > > > This patch no longer applies. Can you make a v3? > > Sorry, you can ignore this. I now realize that this was a v2 of > > https://patchwork.linuxtv.org/project/linux-media/patch/20230510233117.1.I7047714f92ef7569bd21f118ae6aee20b3175a92@changeid/ > > I had that v1 applied, so obviously this v2 would fail to apply. After dropping > that v1 patch it now applies cleanly. Ack, many thanks. BTW, besides the review tags (appreciation to all), would you mind adding this tag also as I missed it in the beginning? Suggested-by: Chen-Yu Tsai <wenst@chromium.org> Regards, Fei > > Regards, > > Hans > > > > > Regards, > > > > Hans > > > >> > >> Signed-off-by: Fei Shao <fshao@chromium.org> > >> > >> --- > >> > >> Changes in v2: > >> Use devm_pm_runtime_enable() per suggestion from the previous thread: > >> https://lore.kernel.org/lkml/20230510164330.z2ygkl7vws6fci75@pengutronix.de/T/#m25be91afe3e9554600e859a8a59128ca234fc63d > >> > >> .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 26 ++++++------------- > >> 1 file changed, 8 insertions(+), 18 deletions(-) > >> > >> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c > >> index b753bf54ebd9..e1cb2f8dca33 100644 > >> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c > >> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c > >> @@ -148,20 +148,21 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) > >> ret = mtk_vcodec_init_dec_clk(pdev, &subdev_dev->pm); > >> if (ret) > >> return ret; > >> - pm_runtime_enable(&pdev->dev); > >> + > >> + ret = devm_pm_runtime_enable(&pdev->dev); > >> + if (ret) > >> + return ret; > >> > >> of_id = of_match_device(mtk_vdec_hw_match, dev); > >> if (!of_id) { > >> dev_err(dev, "Can't get vdec subdev id.\n"); > >> - ret = -EINVAL; > >> - goto err; > >> + return -EINVAL; > >> } > >> > >> hw_idx = (enum mtk_vdec_hw_id)(uintptr_t)of_id->data; > >> if (hw_idx >= MTK_VDEC_HW_MAX) { > >> dev_err(dev, "Hardware index %d not correct.\n", hw_idx); > >> - ret = -EINVAL; > >> - goto err; > >> + return -EINVAL; > >> } > >> > >> main_dev->subdev_dev[hw_idx] = subdev_dev; > >> @@ -173,36 +174,25 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) > >> if (IS_SUPPORT_VDEC_HW_IRQ(hw_idx)) { > >> ret = mtk_vdec_hw_init_irq(subdev_dev); > >> if (ret) > >> - goto err; > >> + return ret; > >> } > >> > >> subdev_dev->reg_base[VDEC_HW_MISC] = > >> devm_platform_ioremap_resource(pdev, 0); > >> if (IS_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC])) { > >> ret = PTR_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC]); > >> - goto err; > >> + return ret; > >> } > >> > >> if (!main_dev->subdev_prob_done) > >> main_dev->subdev_prob_done = mtk_vdec_hw_prob_done; > >> > >> platform_set_drvdata(pdev, subdev_dev); > >> - return 0; > >> -err: > >> - pm_runtime_disable(subdev_dev->pm.dev); > >> - return ret; > >> -} > >> - > >> -static int mtk_vdec_hw_remove(struct platform_device *pdev) > >> -{ > >> - pm_runtime_disable(&pdev->dev); > >> - > >> return 0; > >> } > >> > >> static struct platform_driver mtk_vdec_driver = { > >> .probe = mtk_vdec_hw_probe, > >> - .remove = mtk_vdec_hw_remove, > >> .driver = { > >> .name = "mtk-vdec-comp", > >> .of_match_table = mtk_vdec_hw_match, > > >
On 23/05/2023 17:18, Fei Shao wrote: > On Tue, May 23, 2023 at 8:28 PM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: >> >> On 23/05/2023 13:42, Hans Verkuil wrote: >>> On 15/05/2023 08:16, Fei Shao wrote: >>>> Convert pm_runtime_enable() to the managed version, and clean up error >>>> handling and unnecessary .remove() callback accordingly. >>> >>> This patch no longer applies. Can you make a v3? >> >> Sorry, you can ignore this. I now realize that this was a v2 of >> >> https://patchwork.linuxtv.org/project/linux-media/patch/20230510233117.1.I7047714f92ef7569bd21f118ae6aee20b3175a92@changeid/ >> >> I had that v1 applied, so obviously this v2 would fail to apply. After dropping >> that v1 patch it now applies cleanly. > > Ack, many thanks. > BTW, besides the review tags (appreciation to all), would you mind > adding this tag also as I missed it in the beginning? > > Suggested-by: Chen-Yu Tsai <wenst@chromium.org> Done! Regards, Hans > > Regards, > Fei > > > > > >> >> Regards, >> >> Hans >> >>> >>> Regards, >>> >>> Hans >>> >>>> >>>> Signed-off-by: Fei Shao <fshao@chromium.org> >>>> >>>> --- >>>> >>>> Changes in v2: >>>> Use devm_pm_runtime_enable() per suggestion from the previous thread: >>>> https://lore.kernel.org/lkml/20230510164330.z2ygkl7vws6fci75@pengutronix.de/T/#m25be91afe3e9554600e859a8a59128ca234fc63d >>>> >>>> .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 26 ++++++------------- >>>> 1 file changed, 8 insertions(+), 18 deletions(-) >>>> >>>> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c >>>> index b753bf54ebd9..e1cb2f8dca33 100644 >>>> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c >>>> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c >>>> @@ -148,20 +148,21 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) >>>> ret = mtk_vcodec_init_dec_clk(pdev, &subdev_dev->pm); >>>> if (ret) >>>> return ret; >>>> - pm_runtime_enable(&pdev->dev); >>>> + >>>> + ret = devm_pm_runtime_enable(&pdev->dev); >>>> + if (ret) >>>> + return ret; >>>> >>>> of_id = of_match_device(mtk_vdec_hw_match, dev); >>>> if (!of_id) { >>>> dev_err(dev, "Can't get vdec subdev id.\n"); >>>> - ret = -EINVAL; >>>> - goto err; >>>> + return -EINVAL; >>>> } >>>> >>>> hw_idx = (enum mtk_vdec_hw_id)(uintptr_t)of_id->data; >>>> if (hw_idx >= MTK_VDEC_HW_MAX) { >>>> dev_err(dev, "Hardware index %d not correct.\n", hw_idx); >>>> - ret = -EINVAL; >>>> - goto err; >>>> + return -EINVAL; >>>> } >>>> >>>> main_dev->subdev_dev[hw_idx] = subdev_dev; >>>> @@ -173,36 +174,25 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) >>>> if (IS_SUPPORT_VDEC_HW_IRQ(hw_idx)) { >>>> ret = mtk_vdec_hw_init_irq(subdev_dev); >>>> if (ret) >>>> - goto err; >>>> + return ret; >>>> } >>>> >>>> subdev_dev->reg_base[VDEC_HW_MISC] = >>>> devm_platform_ioremap_resource(pdev, 0); >>>> if (IS_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC])) { >>>> ret = PTR_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC]); >>>> - goto err; >>>> + return ret; >>>> } >>>> >>>> if (!main_dev->subdev_prob_done) >>>> main_dev->subdev_prob_done = mtk_vdec_hw_prob_done; >>>> >>>> platform_set_drvdata(pdev, subdev_dev); >>>> - return 0; >>>> -err: >>>> - pm_runtime_disable(subdev_dev->pm.dev); >>>> - return ret; >>>> -} >>>> - >>>> -static int mtk_vdec_hw_remove(struct platform_device *pdev) >>>> -{ >>>> - pm_runtime_disable(&pdev->dev); >>>> - >>>> return 0; >>>> } >>>> >>>> static struct platform_driver mtk_vdec_driver = { >>>> .probe = mtk_vdec_hw_probe, >>>> - .remove = mtk_vdec_hw_remove, >>>> .driver = { >>>> .name = "mtk-vdec-comp", >>>> .of_match_table = mtk_vdec_hw_match, >>> >>
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c index b753bf54ebd9..e1cb2f8dca33 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c @@ -148,20 +148,21 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) ret = mtk_vcodec_init_dec_clk(pdev, &subdev_dev->pm); if (ret) return ret; - pm_runtime_enable(&pdev->dev); + + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; of_id = of_match_device(mtk_vdec_hw_match, dev); if (!of_id) { dev_err(dev, "Can't get vdec subdev id.\n"); - ret = -EINVAL; - goto err; + return -EINVAL; } hw_idx = (enum mtk_vdec_hw_id)(uintptr_t)of_id->data; if (hw_idx >= MTK_VDEC_HW_MAX) { dev_err(dev, "Hardware index %d not correct.\n", hw_idx); - ret = -EINVAL; - goto err; + return -EINVAL; } main_dev->subdev_dev[hw_idx] = subdev_dev; @@ -173,36 +174,25 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) if (IS_SUPPORT_VDEC_HW_IRQ(hw_idx)) { ret = mtk_vdec_hw_init_irq(subdev_dev); if (ret) - goto err; + return ret; } subdev_dev->reg_base[VDEC_HW_MISC] = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC])) { ret = PTR_ERR((__force void *)subdev_dev->reg_base[VDEC_HW_MISC]); - goto err; + return ret; } if (!main_dev->subdev_prob_done) main_dev->subdev_prob_done = mtk_vdec_hw_prob_done; platform_set_drvdata(pdev, subdev_dev); - return 0; -err: - pm_runtime_disable(subdev_dev->pm.dev); - return ret; -} - -static int mtk_vdec_hw_remove(struct platform_device *pdev) -{ - pm_runtime_disable(&pdev->dev); - return 0; } static struct platform_driver mtk_vdec_driver = { .probe = mtk_vdec_hw_probe, - .remove = mtk_vdec_hw_remove, .driver = { .name = "mtk-vdec-comp", .of_match_table = mtk_vdec_hw_match,