From patchwork Mon May 15 06:16:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 93894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6720057vqo; Mon, 15 May 2023 00:02:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7duvehx6nrhphKwMkw8DEwczIhwhDDEVY/86wBUmIXWR19JdAg2CFpkLZaEQvmW3T+IJ2u X-Received: by 2002:a17:903:191:b0:1ac:750e:33f4 with SMTP id z17-20020a170903019100b001ac750e33f4mr33082134plg.32.1684134159225; Mon, 15 May 2023 00:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684134159; cv=none; d=google.com; s=arc-20160816; b=BLNgdZBK91/fV+/3rDccuAX0pnRF7PcWBRZjBFV0+5fy94rbmvZWBMSfFuZsfd+djz 1+A562IgoHXRExKy1MFthMzA4ExmTxxJaI15s6DCDmuD4Zv81JYCcvsfCZhxw9kjy3vb 2PZh2gA9sWz4n3AVwufBbBaws/rZy6ldxyBZcpB+pfElbRgSC4mCMBzMYqa7xqiUNwvZ pyjncOcwCXZTVi2uD2OPC9gM2qTewiXvPB1mVzfeNogGEXUYH3nNAYrKF3U33Jl61UMF g2PK/On9uoN36qpJXN1ng1KLUEbWCNtWcUvlz3fF49Pz1voflvfUm/xO84owkbB8kuc+ S36g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=DY/Tvek46OkRim5dYg2uuI8WkPZBk0b6iwqvYb0rtSM=; b=ByqyW7beqZ4VByiD1U39KmdG+xvmgrABmZP1aZ5vva/Ogzr69DdxhaFKZtNligPFuL 4u/ClY0iOpEFOVGM4ERCyeZr7A2hxCjwtiR8VGHzeGNrXtiJHgRFR4nZbdr8QptDiItR V1tOl3Ej3t2r+sOYcQ8gxlZVFbqUuo2YCPEl9R8ejO4lygrRFLcfhyxXH0Ej9vn2AA+6 GeenW7tO4qinNsOTUxIv9wgBkWtNWDd2sNSqiY9izXwrzmszzspXZTMXDn/2nZvYdDbq zEQaciXpOJ8SLk2+fcvxgho/v9jstDTgJPjBMIE5+vvRQvCQFHU2kvamiMeb9BLYoOGg R4yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SHQD3SCR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a17090301d100b0019c14335fc0si16321862plh.70.2023.05.15.00.02.26; Mon, 15 May 2023 00:02:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SHQD3SCR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238437AbjEOGRr (ORCPT + 99 others); Mon, 15 May 2023 02:17:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbjEOGRp (ORCPT ); Mon, 15 May 2023 02:17:45 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 883E31722 for ; Sun, 14 May 2023 23:17:44 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5208be24dcbso8801542a12.1 for ; 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=dncAwKY4+kcSbt93qvyQiCAtPmWy3nKKyUuM4VRHwT8wvoRCtBpAwIoqNDTVe8Vjwk e0d4esL8KZPf2Au/Ee5cmDUQ6yefhrU9Vy3z5pbwgQk7m+Ukr9aTPrzCjhOE+8xxW6Ye jJT4t9PF1vWZgk/t1effEH7SwNZLlp8bsb1vVPdMWyg3yUn4vush84RorkkbnGZEpPt6 OfAXlvzYnUwSjNXGaAkb0Bej4ZioOhUHgCBcnGOPWHWbxY29suSjNsLHhjzy0nxN+TG/ DbtfHrHZnWyQBEdCrreibTsdYk0Atq86abvV6fF47v84tlVVMM1pxlNd8w/GwQCNJzxH sR7w== X-Gm-Message-State: AC+VfDwr5/SXeo4Hq7pfMaLeUx8GeSFeys3CsrJEYLF+ai1Vth9BRjKA FAE7aI+2k2xVRk4qVSA2e8FUiQ== 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 To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Chen-Yu Tsai Cc: Hans Verkuil , Fei Shao , Andrew-CT Chen , AngeloGioacchino Del Regno , Matthias Brugger , Mauro Carvalho Chehab , Tiffany Lin , Yunfei Dong , 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 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=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765942660170346174?= X-GMAIL-MSGID: =?utf-8?q?1765942660170346174?= Convert pm_runtime_enable() to the managed version, and clean up error handling and unnecessary .remove() callback accordingly. Signed-off-by: Fei Shao Reviewed-by: Alexandre Mergnat Reviewed-by: AngeloGioacchino Del Regno --- 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,