From patchwork Tue Feb 7 16:13:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 53979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2936991wrn; Tue, 7 Feb 2023 08:15:59 -0800 (PST) X-Google-Smtp-Source: AK7set+Zj9CrqaEeNwnNlrx3EhGVdg2UUR96mq5yXrtMxbT6bdHSLZlCpq9gSctC+GLER1IdBfos X-Received: by 2002:a05:6a20:c114:b0:be:9fff:48d9 with SMTP id bh20-20020a056a20c11400b000be9fff48d9mr2682258pzb.27.1675786559117; Tue, 07 Feb 2023 08:15:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675786559; cv=none; d=google.com; s=arc-20160816; b=zS0/tvXwAibEOaUS/aSUIV4rth31sEXmYhzX5V6PMnkq6N3LzaM34s1Yn0c/UcFj6U 6mA9h/0Ck+AiMzcDpKMU90KB96x8XeLEqlgF/mIh+SS4+e+N5Rut2V22cIPAXFan9H1I PMJQor3ryG/c6+YnCHSWGy+hUDnWNCALwbtq4ye0zIz9E34s8GtVcU56myG1cV0cC0++ 9TJd/HIOcQ5komaHDkt9juTFMycfVbYMI2DyVxKs0XJyvsS7AsM1VKGfiT2A5b2Zry2B 9uQIkGM9qFVgMPVIKRTTrE03C/TzVYgP96OFm2JwozBFmD6CrGEeSg3gD0/ZKVBkJR+C Gbng== 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=9MwxX2vkey55a0aik1xB9HvQZekwONZmfzEzmnFvGis=; b=DBM6PilNYKgBfabjJJbrCXPi9tBCI0fhK5EcbaVFBETWp0EA8eWBpQd2w1V+C9gOHH l6dkwU27/SBDx5DEzb+Iom7Xx9uXGVJjEe+m4culWDFgy6IBETJI6LDOg/PJPURfzlMw 5XcqOYui2LxY0s/12KaQ+BwAND3NN5GgXK9lkXWRqrV7+UiIFsohrJL34cTPAwxpwdLe jglSqEFyUdVwvhEzH/jAkdwvI7IKTD2e05PcFAxZgKxxqGKFfqEuWNn2CST0IfbPUPZ3 6wmhVLnA8SBvwrmmZODOyncelfJhrSMPVJ7MbwfjhJmj5j3bYtDS4BwpLRkTHJvbE1Hc dc7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nhhBAWfF; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u190-20020a6385c7000000b00478aa71aa99si8213424pgd.717.2023.02.07.08.15.45; Tue, 07 Feb 2023 08:15:59 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=nhhBAWfF; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231881AbjBGQNc (ORCPT + 99 others); Tue, 7 Feb 2023 11:13:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232791AbjBGQN2 (ORCPT ); Tue, 7 Feb 2023 11:13:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C274E055; Tue, 7 Feb 2023 08:13:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3FB8360EA6; Tue, 7 Feb 2023 16:13:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5C26C433EF; Tue, 7 Feb 2023 16:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675786399; bh=FLLBP0tTZMTEFNWTFRCOfoqXmh7TMFj9z2SwwwQ+5qo=; h=From:To:Cc:Subject:Date:From; b=nhhBAWfFDWtPwtP5V87mG2i7Se7blpUDpt0dX0s1B2Nz8J9dHcar/LTEE4M2F5/yM E28Y0A+5GYWCzYXlSv7zJv5A44VpQS74C7z3Lb6oWWf/VVnmPzVPw9z7b1kD8Cf6Ih 1mePSowwg3p65lzzLBB8pWQrSdIwquj5+0ELfVZ4g5rIp4DhdopEpfMedZTDwGQUcY kMHKKjMiatRL3vqMusbbsqcpxO55rY30nr07BbirYbZqnBSkPrmLyBhIjVQRzdsr5v bz6QlUCL+ZuccEB7nOAZVRzWmcbVl9vQATNgIXJ4w+M+f1KO6XKeb7Vtrm+TzjoUhq B0qttGVTChpdg== From: Arnd Bergmann To: Manivannan Sadhasivam , Mauro Carvalho Chehab , Sakari Ailus , Alexander Stein , Laurent Pinchart Cc: Arnd Bergmann , Dave Stevenson , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: i2c: imx290: fix conditional function defintions Date: Tue, 7 Feb 2023 17:13:12 +0100 Message-Id: <20230207161316.293923-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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?1757189567136844049?= X-GMAIL-MSGID: =?utf-8?q?1757189567136844049?= From: Arnd Bergmann The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning: drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev) ^ drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function] static int imx290_runtime_suspend(struct device *dev) ^ Convert this to the new RUNTIME_PM_OPS() helper that so this is not required. To improve this further, also use the pm_ptr() helper that lets the dev_pm_ops get dropped entirely when CONFIG_PM is disabled. A related mistake happened in the of_match_ptr() macro here, which like SET_RUNTIME_PM_OPS() requires the match table to be marked as __maybe_unused, though I could not reproduce building this without CONFIG_OF. Remove the of_match_ptr() here as there is no point in dropping the match table in configurations without CONFIG_OF. Fixes: 02852c01f654 ("media: i2c: imx290: Initialize runtime PM before subdev") Signed-off-by: Arnd Bergmann Reviewed-by: Laurent Pinchart Reviewed-by: Manivannan Sadhasivam --- drivers/media/i2c/imx290.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c index 49d6c8bdec41..48ae2e0adf9e 100644 --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -1098,7 +1098,7 @@ static int imx290_runtime_suspend(struct device *dev) } static const struct dev_pm_ops imx290_pm_ops = { - SET_RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL) + RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL) }; /* ---------------------------------------------------------------------------- @@ -1362,8 +1362,8 @@ static struct i2c_driver imx290_i2c_driver = { .remove = imx290_remove, .driver = { .name = "imx290", - .pm = &imx290_pm_ops, - .of_match_table = of_match_ptr(imx290_of_match), + .pm = pm_ptr(&imx290_pm_ops), + .of_match_table = imx290_of_match, }, };