From patchwork Wed Jul 5 20:45:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 116444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2143748vqx; Wed, 5 Jul 2023 14:21:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlFYQk5Oi+BkupEwT41SZTcKD1sbMzZQ6aRA1Ig6QDBZyNoUByzHRMnMwNTupIn2sWLkj0vp X-Received: by 2002:a17:902:ea0b:b0:1b8:b3f0:3d57 with SMTP id s11-20020a170902ea0b00b001b8b3f03d57mr145399plg.31.1688592071730; Wed, 05 Jul 2023 14:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688592071; cv=none; d=google.com; s=arc-20160816; b=ixYnhWWK7Ty0+YzwkMvAeDmM4vAmS2eDKhbvZ28QPGnBbTxsAtYcyqa5Gwdp0RC7eZ Jdmx/LJiXfT0+yzaMV+jfM3UzOttwZG7Kxcee5Gx/dpdTQuExP6IauB68EK9V+y57rUu KJOEASqdnaUg9edug6R8Zh1Lr0h0tipAKcKQPvsocfPb5WH2tLtCIWt+29t3JxSAIY2E XforNenMTiQ3Eev+GYaTeKOa8S0QufsiZY1/pM2s8pMxp6sQEnKBPb8i1lt9epZW0GdC QewPy3xkN5i4m/jb0LHNyiWiTyNg05epSEOXXFwvtOCc5+DJpbNeK1vcHJh87tOlNoMX 9Q8A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2FqxkEUgHooyK/GnIfHp1oWV5bVVwLweeiXpSLzSgxw=; fh=897C1gaMdBl9+vyYAbrS6FANrdYQmUFULa6mAiX+JZo=; b=XArG+0skM991EM1doJFg5kqzgdJW97qErJMHjT331lfYI2S3qwUDzX2Ipjuzf71AxO z33ctn9e3plIR+dtlIBoWKcSiQtukkxB/xxbxhhsdh7oF4dwgC6tU2HYNaXBcionoEsT TSkjErfl1uBH3GSdW1/GzmmyUUfcPGhh1T5WRp6BMGz9l+CqdtgUIGRsknYiugTSTkK8 faGUN1AwxpOOvzG/St9Tid3pfo2e9Qa7IGYcxC93d5Mpbao3c4cGi6uF7mz0eBLEYkwr SLLKwGYVf2vr6bkYVlwsuiQmcMd+G7sJNBvyRdLiw50DuLqhE7675vJWxutQfrBkKDWx joyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=ihTgTKx0; 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=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a170902da8f00b001b8a39d1738si5602171plx.500.2023.07.05.14.20.56; Wed, 05 Jul 2023 14:21:11 -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=@crapouillou.net header.s=mail header.b=ihTgTKx0; 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=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230094AbjGEUt1 (ORCPT + 99 others); Wed, 5 Jul 2023 16:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234137AbjGEUtW (ORCPT ); Wed, 5 Jul 2023 16:49:22 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44C1419BF; Wed, 5 Jul 2023 13:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2FqxkEUgHooyK/GnIfHp1oWV5bVVwLweeiXpSLzSgxw=; b=ihTgTKx0qCQlRZ4inB3q3GOpm5KWfI+FMEGNs1Qg/6mI7cex0Mwz/iZSl0fgIGgr+hyEpq byzHLearu/tCppPoUF/EqydoR013IcXDi8KU/OYPh/QWAip8IPwlhTBCbBBdT9gJ2bqzNg cPHyc3Ukl5MAyuxHNtG78I4/uRJk07A= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Conghui Chen , Viresh Kumar , virtualization@lists.linux-foundation.org Subject: [PATCH 22/23] i2c: virtio: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:45:20 +0200 Message-Id: <20230705204521.90050-4-paul@crapouillou.net> In-Reply-To: <20230705204521.90050-1-paul@crapouillou.net> References: <20230705204314.89800-1-paul@crapouillou.net> <20230705204521.90050-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1770617120509202629?= X-GMAIL-MSGID: =?utf-8?q?1770617120509202629?= Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Jonathan Cameron Acked-by: Viresh Kumar --- Cc: Conghui Chen Cc: Viresh Kumar Cc: virtualization@lists.linux-foundation.org --- drivers/i2c/busses/i2c-virtio.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c index 4b9536f50800..c60ae531ba57 100644 --- a/drivers/i2c/busses/i2c-virtio.c +++ b/drivers/i2c/busses/i2c-virtio.c @@ -243,7 +243,6 @@ static struct virtio_device_id id_table[] = { }; MODULE_DEVICE_TABLE(virtio, id_table); -#ifdef CONFIG_PM_SLEEP static int virtio_i2c_freeze(struct virtio_device *vdev) { virtio_i2c_del_vqs(vdev); @@ -254,7 +253,6 @@ static int virtio_i2c_restore(struct virtio_device *vdev) { return virtio_i2c_setup_vqs(vdev->priv); } -#endif static const unsigned int features[] = { VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, @@ -269,10 +267,8 @@ static struct virtio_driver virtio_i2c_driver = { .driver = { .name = "i2c_virtio", }, -#ifdef CONFIG_PM_SLEEP - .freeze = virtio_i2c_freeze, - .restore = virtio_i2c_restore, -#endif + .freeze = pm_sleep_ptr(virtio_i2c_freeze), + .restore = pm_sleep_ptr(virtio_i2c_restore), }; module_virtio_driver(virtio_i2c_driver);