From patchwork Mon Oct 17 17:12:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 3619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1558410wrs; Mon, 17 Oct 2022 10:18:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6R5IoYFdTsZ8K4oUW+9+c3rfHuUL42pEAd2JYRTp5fj6SJmDzJiuODsju9OIYIzrP9sDD+ X-Received: by 2002:a63:1c43:0:b0:45e:1e2b:291d with SMTP id c3-20020a631c43000000b0045e1e2b291dmr11311868pgm.204.1666027086564; Mon, 17 Oct 2022 10:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666027086; cv=none; d=google.com; s=arc-20160816; b=amYDALhjFojGyx73DyGDgttSccPfsgwDwubGsEEa7rwWVoK0xpV0tZJwePNBFpsZXx qERoJP4a+xLhvNgxX7I6/0nqu7/Pwpvzyrh/O+c0s+tQ5758RREIwFdOPQMn6XkCfft9 /GZQmHHRocmmcKgd/lK/Aut/yyiGK3tB6YBM7HFlA2BZqobbVzwyOcdtLVOI9AIKcDhG z8rVMIXNL9bWJBh3aZHYNvWncaxh1th5G+uc7o6gOFdiZCGTo04evoxX1iQAbW1B9qSs 8fQseWlJuuGCJuUkrsKRF1Jl081mKoDnity940V1kFbykCHftEYZT8BugoJ1dPE+YShi YN2g== 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=EiBzRhdFNtZC8ggQWILwxH0mWpEU34USSvGckG708/o=; b=JuFJeAE3+n13QmlZxsIbb5L3DRWdlSVu/wDfBQAjl1IcNXUG2k/9MTm0bMmmB+anSG jjZjdSFpMFaRxGXfdK75Cei/Bt2GgJEz2e1tUsebnLJjghGSVFHY9LJc6XU56N130RGU gsiKQ/0hZtwEEJBr6GVRH2aWH50xABfyf8MAj5b4CTRA15s2natqCp1dbIe3BDwT19pB CavJ/j6gbsiyuhDWpOKHSeaAK4+vwtUvZlo5u74x3p1txFii2d4KBB2sJ/bV91RlUhf6 KvhxEyVz6mKwXet47b4OMJQ7zFxTXZH4am73UprZ+GExu2PoqcCm44w8rUC0yCroMQDF fJjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JHgz3CtC; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id in17-20020a17090b439100b00205de9ed2ffsi10563201pjb.43.2022.10.17.10.17.50; Mon, 17 Oct 2022 10:18:06 -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=@intel.com header.s=Intel header.b=JHgz3CtC; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbiJQRMv (ORCPT + 99 others); Mon, 17 Oct 2022 13:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiJQRMd (ORCPT ); Mon, 17 Oct 2022 13:12:33 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17CD06A4B6; Mon, 17 Oct 2022 10:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666026753; x=1697562753; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XlIOXCJHhj4h3agf1DUjrph2j3laCRQuoVVmOELxnfg=; b=JHgz3CtCH9taDVxIKmavTPcdAFJeC3Q/E2/5HCGVztpLOkbf2uDp6GWY 39AJv41JpgtOD+LzheQ+XgIlr7E4h3F+o6zbPUP1sZudWiVV0O9yz2D/6 3uIpjomK12NKIBqe7fnAV9I9qnRMMzCWqKUs3Ap6EulCBLpiTaTbI4B6Y t5Wz4Msl6PP3RdiQ0XoXoEsxQr/SdykGvQvi7SFnOPIDh0OUJiUm2XvG9 fjj6eXrHDegV69R/ZhXO0XFAMrx11Gd43AZX9phChml5sYcnYFPt4xPOr wL5P/m0shp3lDspzq542Q1xaKK3sNHwkVZD18RRxOORIT9QA0Z9eaZOYn g==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="285584014" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="285584014" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 10:12:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="697131922" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="697131922" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 17 Oct 2022 10:12:30 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BD17C666; Mon, 17 Oct 2022 20:12:51 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown Subject: [PATCH v1 6/6] spi: pxa2xx: Switch from PM ifdeffery to pm_ptr() Date: Mon, 17 Oct 2022 20:12:43 +0300 Message-Id: <20221017171243.57078-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221017171243.57078-1-andriy.shevchenko@linux.intel.com> References: <20221017171243.57078-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE 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?1746956018453377883?= X-GMAIL-MSGID: =?utf-8?q?1746956018453377883?= Cleaning up the driver to use pm_ptr() macro instead of ifdeffery that makes it simpler and allows the compiler to remove those functions if built without CONFIG_PM and CONFIG_PM_SLEEP support. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 76046612466d..60cab241200b 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1680,7 +1680,6 @@ static int pxa2xx_spi_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int pxa2xx_spi_suspend(struct device *dev) { struct driver_data *drv_data = dev_get_drvdata(dev); @@ -1715,9 +1714,7 @@ static int pxa2xx_spi_resume(struct device *dev) /* Start the queue running */ return spi_controller_resume(drv_data->controller); } -#endif -#ifdef CONFIG_PM static int pxa2xx_spi_runtime_suspend(struct device *dev) { struct driver_data *drv_data = dev_get_drvdata(dev); @@ -1732,12 +1729,10 @@ static int pxa2xx_spi_runtime_resume(struct device *dev) return clk_prepare_enable(drv_data->ssp->clk); } -#endif static const struct dev_pm_ops pxa2xx_spi_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pxa2xx_spi_suspend, pxa2xx_spi_resume) - SET_RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, - pxa2xx_spi_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(pxa2xx_spi_suspend, pxa2xx_spi_resume) + RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, pxa2xx_spi_runtime_resume, NULL) }; #ifdef CONFIG_ACPI @@ -1762,7 +1757,7 @@ MODULE_DEVICE_TABLE(of, pxa2xx_spi_of_match); static struct platform_driver driver = { .driver = { .name = "pxa2xx-spi", - .pm = &pxa2xx_spi_pm_ops, + .pm = pm_ptr(&pxa2xx_spi_pm_ops), .acpi_match_table = ACPI_PTR(pxa2xx_spi_acpi_match), .of_match_table = of_match_ptr(pxa2xx_spi_of_match), },