From patchwork Thu Mar 10 06:38:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12775972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 199A5C433F5 for ; Thu, 10 Mar 2022 06:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kanrL9mHSKjow0KxLL4khWSUB4PleQGH6VMuywTk7+k=; b=4jUeCJ2eE1YaOU aElEFrRMrf54FmLUNd8dsBnq2lclGFhO42hImBnoAqUq80nXuViXUFaBV3aKpsENPIn7gCedTcObO A41aBrmFnoOVr97Vo/KKiIwj31EGXUiiPXTBnUPHRRW1jnSBA1O1stpGqeVqci2ZROwxW3LQSSMqh nI7paTUc6xoFO8+FX/FwphHAW6DocZ09if9HbGHNuV39bdTgNrJ1izGJ8V7A0LJW4ULBfbEjHFCO4 SKvG4L2P4LxCHjiueXyeQ0wxWFaam3f6PY4YBlzqeh/HcfAONS/PfZHLBxZBFE7tB6d4UdWI8F1jS yxddxHVzvYCECZYubhdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSCU9-00BcrA-8P; Thu, 10 Mar 2022 06:41:17 +0000 Received: from mail-he1eur04on0624.outbound.protection.outlook.com ([2a01:111:f400:fe0d::624] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSCU3-00Bcp4-VQ for linux-arm-kernel@lists.infradead.org; Thu, 10 Mar 2022 06:41:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XclMlPPVKT+dFXpsvA2/Kqea1g5RJJem/7Xljz/qlkN+XnjIfXQDMbmG5WeSGrS3iEWfNeMxt2KhyvFcIneQ0G+/MEgJ4j6pTe1hLtymlN5Ym0moDr1NqB2zp5wuf8Mcf/cdNgfwUi4+4OfG+huJqj2u1GhGDsI8VRrx7aoCB+pp+cAsUch8VTgAEmyTUYh7NPGMJhZyLKZEnnBtyoZoqj0Nu2m1AEKbaOSfy/5bWORkPJ5jiqdWf554VeKHMYe+V9HUPbVGjDyIoqn0CAlzOgBHWF14xI+lehWaocSqhqgiQJvVLyYOhy4nC88ecjWQi1BflNZoWeu4t2rydWngOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cEKR7q+Irl2plfgWI7IAGt9uGr3G5B3IZzpRWiKcakU=; b=F92wyOvDSecAqzk+b5ac+nQh66Bg3WoAK/w7MHgUHxYFRKlNszauYL/4T7/ilvPZd18G74MLwxSSUd1rQ/f7OCWnZbQHmhjaMx++43wO/mkRMEEq/eZlaQYT4mOAJfxv/6R3jXf2nKo7SFASXeDRf/gSSxQSEBhvPtTaz7Prb8hDJcy0BtG0WCN27BZVDdSMfN+LoXGX103CFmjlGCxVVujnLY3LAde6TkipCQAsaAyHkxOVYB+JUp77cq9dL//R5SczS0C6bC+zwZ8fLCQtWpqT7Z9NRwOhMoA0OCwTpX+KnMLg+nFQdlnLzgoBYVynGI/GZ5FQVxJMJTNyEJWyqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cEKR7q+Irl2plfgWI7IAGt9uGr3G5B3IZzpRWiKcakU=; b=P2MQXawxk6no3lmlXIMLoxE7DrJ/z10E/UQt4VpLOleiMBY+nHtlfbN33tnpwl9pJGHLk/raW3O05wXYLJh1OGlbk1sr7HtYKvM604uzzNE27b5pOLLix5xbZqnFcnY1UBpcvTd5SUMb6xDMqb8HKuYBcl5VvthgnLeJqm6U2Nc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM8PR04MB7235.eurprd04.prod.outlook.com (2603:10a6:20b:1d1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 06:41:08 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::c39:69cf:c4ea:967]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::c39:69cf:c4ea:967%5]) with mapi id 15.20.5038.027; Thu, 10 Mar 2022 06:41:08 +0000 From: Ming Qian To: mchehab@kernel.org, shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de Cc: hverkuil-cisco@xs4all.nl, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, aisheng.dong@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] media: amphion: fix an issue that using pm_runtime_get_sync incorrectly Date: Thu, 10 Mar 2022 14:38:56 +0800 Message-Id: <20220310063856.9627-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.33.0 X-ClientProxiedBy: SG2PR04CA0215.apcprd04.prod.outlook.com (2603:1096:4:187::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e8cd16c-1cbf-48af-5b01-08da0260f540 X-MS-TrafficTypeDiagnostic: AM8PR04MB7235:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4Y/KriuGpg73cg9DTu/oicK9rRTM5n1OVOqtM095o2mPvX91JrdyHw1jbiG5jgE4ZFaG00DKO8xcnwHhgjQc+Rz/zeTTgH9boDU+rlnXBYFpBGrOPwOCtg0iG05O+dUEJzZAg4NtqJHUzlTgd9/QgmcsA/oqLzdwltxFb42upsamjaU9ydxFCdOBt+LMUW0BogwdoLv4J2X/csdMXC2E3MMlmqreFeY+RdlRi3r7BIl0aTRiTZs/eks4dcatOEERhIEOdJlqA95BMJa9qN0e36PxqXcygwshlvfNjbR9pNc/LT/p1TsVfm0gyjScqHW7oK0R9zFcGBUI90TYFRaRR0etZzIEptYqRbJommLdaKdevaD3LuaYfyT0LtgKaJjySN/PM5lkdtNxiQ5geEuJuWvJpIOx4x4eX98uFVOcJmzFSZjAeH1pPHeIdIPE5n56f9IhHh9AHrFt7eJ9Ftixd/u5Ro0jfAVvtNcc3EZ5YYIr5H+c86NszWoLyp5M3A+QPssYpx/WU4qs/5Yi843NXNupcQ3LfIfejFvJzol/TIfjHIhg9WzhfyJu6C/1shFUsFR3S2UdMXrl8wvLnct1psAmwsyCTNdMbMBQtZNXJ9S5rss9yx64PObdWZ8X27G1+pf3HMIKe8z/Bkk0SOupZGMBsWRSKDcFWDye0/V3Jk8nyq7s7T69eXCEbLXKiCnuII5c/4+Ts8aq52+kI+iGeg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(86362001)(66946007)(6506007)(52116002)(83380400001)(316002)(38100700002)(66476007)(38350700002)(66556008)(8676002)(4326008)(6512007)(6666004)(2906002)(1076003)(36756003)(2616005)(44832011)(7416002)(26005)(6486002)(5660300002)(186003)(508600001)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4NSr15Gufh4+b9z2Kppl6pmFqWBuQKv/BurbHKyBZ79mTcVS44l/HVXsv7bLx0mk3oHhDRJ/fLkG+F8gaLklagTelGsBOy/AZQPklilAb5KEAOUGrfT70FAioBoRDMxC7arSev55Te3mBRffV4pzKUQ5wbSWXv0nFJOITFEousD9SRM3eF8qgh2Qke9s80jyvZjw5Eg+9DNzksGDIBuMqIuljbKvY8a1mYAZpQ1dKohY/BdrTp/tfoZBUo/4K9lYOLmfRkgdtqRCs9PdmEDw8EUPNysJFX6mtDF268Lm0ZbWh+7GJgszAf0nWu9NcDfbGZ6n6fBtLToIWWR0ey0VYnDTf7Mqb3w5q/0QkQEXx4m57dDUIQcDB05W0BVy23ZD1V6CdD5iUVLJOgyuH+QpQ6ugxefpPYJOwPOKNCNv3PJtL/+AXDmJA44T18a/FzCpfRCqgVXAJip8e7J2CQs5OcwErFimiCPvHIHn04eZveHZV5DJWVMPIfKf4eRkpRMqPQIW/OTwTzfhayuoKvDAcVi5V5ihC1qeaq6YOx7kD/xnl/kcSSmzoYgxbN1oPCn2uXYNgM7zsnp59Jwfa0tprHVdioyL8uSNxCjNOoogWYkuOKGhOjEyUJq1VcuC2fI0FAu80/MB+QSxwLU4xP8c+W2jXrWbsLwTK1G0lV2LhK1OYPv7lw8PpeapmYhvS5JRmNX3aQSWECxQCLwafOMLm3l4nP/GaTMMz/1T7mKha+yMHm40fgP5ZcZ2w3oAAdbfFh8bQa4kju1iLHlahZnOJUVIFpBrQZFduRoYzoVWyLeNekdPrNpsKBj3AKFJLQqVzaDEPyTHOiyDSBqn8sBzjE1RUDn2Gh1aCU9J+eSdF16MijD/EpCHVqx8tsYw8lk7H7M+YU6+Gy/giEshyfTpntQ+ED43MOuyp8LmviMRRVzZKsqX0OIZBqcALkyDbtGpYoZro5CFOuC9R1mvboAQJ9vqTSISAteVPX0ACbUNme6MbXwLKpkrAi7o9Y04dDX0scOCX2Qozn538JRNNx1xttYZHQNQewkfi9E2XDCv8ZqgWyE7hMViPbjmNrrgCKT7RQK6g7dmzK6wo+bffC7Br8jj18t7T8x8iUhljU7/AMP1CXwo7Dzc4M0uXnwqlDxuczfGWw9KZiFwnBpxIuvFbxno6DiOVzrGoFzbyU4e5zlLIaNVGr6bPt0NT477+DDuce+hCnwt8Jo9hzbHk3oYomYkkert9yLZkliM5w4nNUkhfohxwL+YrKwS8uxmHbK58nWptEyFWWz+1Y7u0GljuqfbAguyDg8mfFi1ShA4ml7/f7/xiLG0Tka3RTN6XY1qBMzKYyOQUTvOocXjRJLi1eE/CRSHadG21bEICmtcRb12t1SUGErm/Fc8QcfngC87aLo6B1enA0lH9HYiRhyIWmLrhT5iX/LPzchir8njFSWOkmJlXNpnVEtkV1TWsrQ3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e8cd16c-1cbf-48af-5b01-08da0260f540 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 06:41:08.4066 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Zf38kXT7N7IK2oKG6nlqBErYNgkD7JH/9Eqgz/N1BPFfu22KIb4gJL98I4XBD2TLqH9pWqRsfgdmsM/VWQajXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7235 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_224112_122348_77327AF1 X-CRM114-Status: GOOD ( 12.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org pm_runtime_get_sync() also returns 1 on success. The documentation for pm_runtime_get_sync() suggests using pm_runtime_resume_and_get() instead Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vpu_core.c | 8 ++++---- drivers/media/platform/amphion/vpu_dbg.c | 2 +- drivers/media/platform/amphion/vpu_drv.c | 6 ------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 016554387f3f..968b578700e3 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -359,7 +359,7 @@ struct vpu_core *vpu_request_core(struct vpu_dev *vpu, enum vpu_core_type type) goto exit; mutex_lock(&core->lock); - pm_runtime_get_sync(core->dev); + pm_runtime_resume_and_get(core->dev); if (core->state == VPU_CORE_DEINIT) { ret = vpu_core_boot(core, true); @@ -650,7 +650,7 @@ static int vpu_core_probe(struct platform_device *pdev) vpu_iface_set_log_buf(core, &core->log); pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret) { pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); @@ -682,7 +682,7 @@ static int vpu_core_remove(struct platform_device *pdev) int ret; vpu_core_remove_dbgfs_file(core); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); WARN_ON(ret < 0); vpu_core_shutdown(core); @@ -746,7 +746,7 @@ static int __maybe_unused vpu_core_resume(struct device *dev) int ret = 0; mutex_lock(&core->lock); - pm_runtime_get_sync(dev); + pm_runtime_resume_and_get(dev); vpu_core_get_vpu(core); if (core->state != VPU_CORE_SNAPSHOT) goto exit; diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index 3c12320e1708..376196bea178 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -344,7 +344,7 @@ static ssize_t vpu_dbg_core_write(struct file *file, struct seq_file *s = file->private_data; struct vpu_core *core = s->private; - pm_runtime_get_sync(core->dev); + pm_runtime_resume_and_get(core->dev); mutex_lock(&core->lock); if (core->state != VPU_CORE_DEINIT && !core->instance_mask) { dev_info(core->dev, "reset\n"); diff --git a/drivers/media/platform/amphion/vpu_drv.c b/drivers/media/platform/amphion/vpu_drv.c index 834ec39640e5..f19f823d4b8c 100644 --- a/drivers/media/platform/amphion/vpu_drv.c +++ b/drivers/media/platform/amphion/vpu_drv.c @@ -118,11 +118,6 @@ static int vpu_probe(struct platform_device *pdev) return -ENODEV; pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); - if (ret) - goto err_runtime_disable; - - pm_runtime_put_sync(dev); ret = v4l2_device_register(dev, &vpu->v4l2_dev); if (ret) @@ -149,7 +144,6 @@ static int vpu_probe(struct platform_device *pdev) vpu_remove_func(&vpu->decoder); v4l2_device_unregister(&vpu->v4l2_dev); err_vpu_deinit: -err_runtime_disable: pm_runtime_set_suspended(dev); pm_runtime_disable(dev);