From patchwork Tue Jun 25 11:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 13710900 Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5280614601C for ; Tue, 25 Jun 2024 11:22:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719314542; cv=none; b=hlixXRHfeI4+ueyifcQaxw38ifVYcTXjp4Y/q//4AKC2db9HQYON6DcFmctXnUzSD02wfrkzfKg3Wt6kDKrFE4xrqhV+qwRSAWpyPsEE+wPAa4O8VKDcmrQCBkRBFWoGuIDjtAUNeS4R6e5kI/VnpWhMRb7dPMFRe1DlfpP9cEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719314542; c=relaxed/simple; bh=0RXuDcYfqhvMNTXPYSeO+4Emq/8IOrPEjOsZ4Evm1DI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=NG2jXFabG8Nqi0u0SxHgp5PKzAWJD7VdYNmdGKFnTjzQABOo1gPNYIVCLT7HXuLc3ZbXy/tLZgYDG6wQ1yH4FYoTZrrvBmalEAR4yPJNSFKsP4lHajXlsMV2bDwnAOTJGRUdDe0wKB5U0TOE2baIFvKXJym/2R1tUJR2COPfePI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VLm3AX8T; arc=none smtp.client-ip=209.85.160.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VLm3AX8T" Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-254939503baso736043fac.0 for ; Tue, 25 Jun 2024 04:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719314540; x=1719919340; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QRAo6q1YcsHj+WSAL550qdAcHPXUyPYuUXj8gpOP9b0=; b=VLm3AX8TX4pkuebcIoZbSmY38JK3xWH9q3OrSqjShRschr08uHVk9SRaiABGu/tKcF 0Xlo2p3ItTpTPqHZq2TVUb8Cvn6+L6Ncr+C/MrDRrDYZ13lSjP2IEiH9ppd9fkUcSYb4 u0boIXAQYzaybLhCZYvKuzp1hvmFvFxO0qs4xpSpHtyjMxxtI094zuELYCk2iqh7ilMF FmUC+L72yOD5pXVMJwwGI6TRapQltcq7IyUaOz0iW60EHRiODIk2LV5eS98gi4ZC4+mH 9+0vzhAY4JaYTuF89Tc7hsGoEORW0iTFFaP3T0/yNw7PpK2HHsdH66LfWm41ahzroawh oJrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719314540; x=1719919340; 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=QRAo6q1YcsHj+WSAL550qdAcHPXUyPYuUXj8gpOP9b0=; b=JmyyTcljQklu9MioBwh8CKHhnuuCtqG/qSXcp0ZaP3tZTbK2jf8S3OpR2eUpBSjolU CVAW/0A9flaR/OA/43n7GC1jJ+x0pjhPoJE3OQXpgWoaaAvVJzSSagFUe3H9jvCQE5FV 1PhYXoVfVgVjMlTFlEnF4D1T8WxD4k94ChGiGJMDWCJPQqkQYOWyHUKC+InQdXR8sI0T xymAi43KL0reY/vOAEorZhSUE29VkDjz4rCRbt0u9TSeac1nb2wuF/nCOlf1JMtyKfZY pYmGp/0YDCVAFcrhNAvYA7biKWv1i4ReDNe7tFTSXh143e8MRnLIBFdLlIQFFErpkVuZ 9WHg== X-Gm-Message-State: AOJu0YzIjB5q9N+EkFCpqNjiN9f2GLEtw3PcbgQh957lzvmHMlILozoI +qsPCq0ro9gliNp8afaa7FwRayWVkaaVBzASuDP0zBIvLZGp0c4y7KSbsg== X-Google-Smtp-Source: AGHT+IH6NUfU0uRBM7/jdqenE/J2fzwrtBdow5i+c9vuRo0VZJfK/sgWvB4nT0tzdD7zxKyfFQ5RXA== X-Received: by 2002:a05:6870:b623:b0:259:f03c:4e90 with SMTP id 586e51a60fabf-25cf3fba001mr9077705fac.4.1719314540383; Tue, 25 Jun 2024 04:22:20 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b61:2ef4:1eef:ef84:36c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7069eb83d7fsm594022b3a.99.2024.06.25.04.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 04:22:19 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 1/2] spi: spi-imx: Switch to RUNTIME_PM_OPS/SYSTEM_SLEEP_PM_OPS() Date: Tue, 25 Jun 2024 08:22:05 -0300 Message-Id: <20240625112206.247804-1-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Fabio Estevam Replace SET_RUNTIME_PM_OPS()/SET SYSTEM_SLEEP_PM_OPS() with their modern RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() alternatives. The combined usage of pm_ptr() and RUNTIME_PM_OPS/SYSTEM_SLEEP_PM_OPS() allows the compiler to evaluate if the runtime suspend/resume() functions are used at build time or are simply dead code. This allows removing the __maybe_unused notation from the runtime suspend/resume() functions. Signed-off-by: Fabio Estevam --- Changes since v1: - Pass pm_ptr(). drivers/spi/spi-imx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 6f1cd3453c97..4b325220a7ab 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1898,7 +1898,7 @@ static void spi_imx_remove(struct platform_device *pdev) spi_imx_sdma_exit(spi_imx); } -static int __maybe_unused spi_imx_runtime_resume(struct device *dev) +static int spi_imx_runtime_resume(struct device *dev) { struct spi_controller *controller = dev_get_drvdata(dev); struct spi_imx_data *spi_imx; @@ -1919,7 +1919,7 @@ static int __maybe_unused spi_imx_runtime_resume(struct device *dev) return 0; } -static int __maybe_unused spi_imx_runtime_suspend(struct device *dev) +static int spi_imx_runtime_suspend(struct device *dev) { struct spi_controller *controller = dev_get_drvdata(dev); struct spi_imx_data *spi_imx; @@ -1932,29 +1932,28 @@ static int __maybe_unused spi_imx_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused spi_imx_suspend(struct device *dev) +static int spi_imx_suspend(struct device *dev) { pinctrl_pm_select_sleep_state(dev); return 0; } -static int __maybe_unused spi_imx_resume(struct device *dev) +static int spi_imx_resume(struct device *dev) { pinctrl_pm_select_default_state(dev); return 0; } static const struct dev_pm_ops imx_spi_pm = { - SET_RUNTIME_PM_OPS(spi_imx_runtime_suspend, - spi_imx_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(spi_imx_suspend, spi_imx_resume) + RUNTIME_PM_OPS(spi_imx_runtime_suspend, spi_imx_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(spi_imx_suspend, spi_imx_resume) }; static struct platform_driver spi_imx_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = spi_imx_dt_ids, - .pm = &imx_spi_pm, + .pm = pm_ptr(&imx_spi_pm), }, .probe = spi_imx_probe, .remove_new = spi_imx_remove, From patchwork Tue Jun 25 11:22:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 13710901 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B001E14601C for ; Tue, 25 Jun 2024 11:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719314545; cv=none; b=K8zb88OewQDGYAZmAkDtIPMh0rzgNxnmIpr1GBvFf3zMdGPpAwcJIxgDssLZXr3nN84R8fBIhWEdxTw/hIU6Y7lTlt3LLfruQqXicSa079ccPLvMjQ1EhPogaUGK+I71JbAh8EPUDwfuYC0dy8W+ZCPxOpqepfsiYBc579yksG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719314545; c=relaxed/simple; bh=sd+ovIrJtBShExsgUeg4gmDvvQ25ES/6M6Zjz1QNE9U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D/FlR3m8MpaYR6XuNm+e3OeEMUxJn2aFvmDlxguT2NbzG15NoJR5KreXAk2gI+fAb5vfgMOsdoagujXSvZ3motlDCjfYHq1H9xaOU2t9nIwZclF7PYgzP5wqEoKpVLG76BwPn+fHGhHGdekdLXd130tQwRdSo1MJftTVYmnvaBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Q7TzSs9m; arc=none smtp.client-ip=209.85.167.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q7TzSs9m" Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3d22323a3ccso273523b6e.1 for ; Tue, 25 Jun 2024 04:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719314543; x=1719919343; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nMFbhr5lggSiJ83uKqWDi7qbPmeUybuCyAAkERmbGb0=; b=Q7TzSs9mE71i5xEKnmV32MoKQktnqgjVHhYF7JRh0J1vNj4VwuPgzE1las/4EpWzpx LSKHq0KdAoUbYW5XYfr4QAGUNYXEbN/ygwRR9AgJGNraMaT3TSEuOw7ok/c878rDhOC8 40oSfJAY2wPsRmuFQDtHXRV+LOKbTF/nGsRzCVim4WUhpK1aWgN39REUlCBVPuAQZQUL Bi3tuLezkF6BE4SG9d2JCntmS1I0ZU863WPEG8KE0lF8bepHxTsLrTaeD7foMqybaqpJ px0Vbkz1laGxzkgAX0RMqcQwAZYamvAt1L9RDgNKaXxZJhJKtZigdvlCe4dH+vUB9Vzb KJCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719314543; x=1719919343; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nMFbhr5lggSiJ83uKqWDi7qbPmeUybuCyAAkERmbGb0=; b=OdxVERWP+QlSldHqLv6seuyS1khhlAhwyLegVn1073JvO9VUqiGwJW4bqYm6IKL1Ks E7xTnhQvyJhjG4tSroc7lTa/ZQbOwpD+1IpEcTnmiFhIqTMzIFlmrkBjz9S/UmeCLhA6 8Z69hygdu69iVZ9dousIWl1KzKDiU6I94yDzBd+f61dlZ96sYekwQBUS6qlNo06PFoi4 WadGv42h24yTlyWHLeOHgkAuJ3e3RgQinAT2g+diRWrC6dNaSue80LnRTbO2M4eZJgYh Do525+KrQIJnqVrITh0PEsjd48HtxweEgt65A9XNtlYG5mY/N9lKVhMdP1D5a17bZRUY TlOQ== X-Gm-Message-State: AOJu0YyU/Hr2OAGJ9qFGEHDf7xA++LAEEMdj+sBcoK3k+uE8z09CC26n N6ZaQH4bPhEnF+uBjcqUqvQ9qehCx2U3hqjoYaCHZ2nwUxP8HIMWan9PRA== X-Google-Smtp-Source: AGHT+IHKJc67fOAnT5o36VnLV/1E9DUpoRoJPTuLFdEavWDygnKx6edMQN4Wm5NIkgWGcOtldGjbPA== X-Received: by 2002:a05:6870:d6a5:b0:24f:e599:9168 with SMTP id 586e51a60fabf-25cf3c0544dmr8564523fac.1.1719314542700; Tue, 25 Jun 2024 04:22:22 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b61:2ef4:1eef:ef84:36c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7069eb83d7fsm594022b3a.99.2024.06.25.04.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 04:22:22 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 2/2] spi: spi-fsl-lpspi: Switch to SYSTEM_SLEEP_PM_OPS() Date: Tue, 25 Jun 2024 08:22:06 -0300 Message-Id: <20240625112206.247804-2-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625112206.247804-1-festevam@gmail.com> References: <20240625112206.247804-1-festevam@gmail.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Fabio Estevam Replace SET_SYSTEM_SLEEP_PM_OPS with its modern SYSTEM_SLEEP_PM_OPS() alternative. The combined usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS() allows the compiler to evaluate if the runtime suspend/resume() functions are used at build time or are simply dead code. This allows removing the __maybe_unused notation from the runtime suspend/resume() functions. Signed-off-by: Fabio Estevam --- Changes since v1: - Pass pm_ptr(). drivers/spi/spi-fsl-lpspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index aa5ed254be46..32baa14dfd83 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -960,13 +960,13 @@ static void fsl_lpspi_remove(struct platform_device *pdev) pm_runtime_disable(fsl_lpspi->dev); } -static int __maybe_unused fsl_lpspi_suspend(struct device *dev) +static int fsl_lpspi_suspend(struct device *dev) { pinctrl_pm_select_sleep_state(dev); return pm_runtime_force_suspend(dev); } -static int __maybe_unused fsl_lpspi_resume(struct device *dev) +static int fsl_lpspi_resume(struct device *dev) { int ret; @@ -984,14 +984,14 @@ static int __maybe_unused fsl_lpspi_resume(struct device *dev) static const struct dev_pm_ops fsl_lpspi_pm_ops = { SET_RUNTIME_PM_OPS(fsl_lpspi_runtime_suspend, fsl_lpspi_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(fsl_lpspi_suspend, fsl_lpspi_resume) + SYSTEM_SLEEP_PM_OPS(fsl_lpspi_suspend, fsl_lpspi_resume) }; static struct platform_driver fsl_lpspi_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = fsl_lpspi_dt_ids, - .pm = &fsl_lpspi_pm_ops, + .pm = pm_ptr(&fsl_lpspi_pm_ops), }, .probe = fsl_lpspi_probe, .remove_new = fsl_lpspi_remove,