From patchwork Tue Jul 16 18:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Rapha=C3=ABl_Gallais-Pou?= X-Patchwork-Id: 13734729 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 C6F6EC3DA49 for ; Tue, 16 Jul 2024 18:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ePgpYFkBe3qAoTduEyFM1RrNaLGJSVdjeXc5RO7/VUQ=; b=N/veYNQqnef61J8usztOsJ+u6y njRNa2+YJP32SRN+zzZwo2P8UJ0ZMDfXilB13rw75H9zi40w4hf+uzq7rZwpKgsAvCOKnOodApdHI 3zZdpP8I4gg2WzOly8S4OIUOpUCqLMSL/G9ufRVUzZWQkh/kWn0gde9mdv+y46wK99l+NGOv4lOWW o2uITEskmqzJwxoLclv7qqu4pbaVcOBfZEFKOEhhxGbwwn9X3Ee1Zfk+HwYyOZscqg4FARzmlD6of C/mabgtLqEjGSSNe7fi8RsnfqbAoi/+GGgU4GUEg/PbhLm98r/e+Y7P40lMVkA4nqWkd1z+HWJVTL fk761cuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTmTn-0000000BD1N-3NJ4; Tue, 16 Jul 2024 18:00:47 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTmTT-0000000BCws-2lYM for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 18:00:29 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4267300145eso46340685e9.3 for ; Tue, 16 Jul 2024 11:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721152826; x=1721757626; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ePgpYFkBe3qAoTduEyFM1RrNaLGJSVdjeXc5RO7/VUQ=; b=VJfZ7h3g42+LP3gAKNXhk4FE/IeilTPGquK7A6mdevQ5yAwdbQ+lPXwzoX2ZTLcleV lDIHD+a6SL1xmHnz5nYX7sULmZj02ebWEVV+OVhAvP+VSHwV15UvUkT8XviLbCr99mc0 YwSAIBdZB0KKK/kf+ZVdEwFTqHJ33pNRmG7vyv99kvPjUdJZWm2ZMsQ77pd7QCuM0gYD gr+XWzrsNdqL29yrdlJVaEB5OKPPyYpr0B1pevTnmvYNYkeODDwGgkx3GKkJwDgTVydg LBMjMMOQRNzQwomb9lrOzyomRyR6beQStjpPPaeEJ1CSoL/HFGbTF9xmJr3TQjbO+yO8 FDhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721152826; x=1721757626; 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=ePgpYFkBe3qAoTduEyFM1RrNaLGJSVdjeXc5RO7/VUQ=; b=s+0Cr1J6JUw4A/urcIFemEHfdcV2tKX9JqwNe59UfmfxKTucoFSfze/7lOkUr224uy fipZt9cBcS0FYviuk891zsviVILv66NKeUkPz4/eXIWNLSAjLKP9M8K+CQhmKRUbqZ5j oAdg/VUEkbjKmU6trazn9asmOrnBImAcgq2/e1MsHdSwf26/U1RPIJrfPq8X70PEeKGD qo4y1AVDe4cOz1Q/NF8de88gKsSbr+BqIs+Df/R/fGKaXzMdkKVz4T1ak5dd1BxtjfJC DH256PoItvuk2bsgTMkRyz+2JSdIc/DCM3gQ+eCcRiDCIwwV7DIDsUd0avUG9/fqtpoM CgaA== X-Gm-Message-State: AOJu0YxZoShnsFX271p/7Imy9OIj4P/CbS6eWNVjD0NNITyIjY4FQw7C OAGnOmOa1e7rNcUOotWP9I7NhqwiPKz8yFsH381L81WnqoruqxjU X-Google-Smtp-Source: AGHT+IFEbnR254xpr2eCNt05Z8i8hkwq+V1zJCxhVNl41Xk9b4hDR6NjRNJb345aFhEo2aZlS7vM6A== X-Received: by 2002:a05:600c:19d1:b0:426:5b44:2be7 with SMTP id 5b1f17b1804b1-427ba66a5e9mr23251815e9.10.1721152825523; Tue, 16 Jul 2024 11:00:25 -0700 (PDT) Received: from localhost ([2001:861:3385:e20:6384:4cf:52c5:3194]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f27983esm170194845e9.27.2024.07.16.11.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 11:00:25 -0700 (PDT) From: Raphael Gallais-Pou To: Patrice Chotard , Greg Kroah-Hartman , Jiri Slaby Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH] serial: st-asc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Tue, 16 Jul 2024 20:00:10 +0200 Message-ID: <20240716180010.126987-1-rgallaispou@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_110027_721855_CEDC8EE7 X-CRM114-Status: GOOD ( 14.31 ) 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 Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based kernel configuration guards. Signed-off-by: Raphael Gallais-Pou --- drivers/tty/serial/st-asc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index f91753a40a69..8aea59f8ca13 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -808,7 +808,6 @@ static void asc_serial_remove(struct platform_device *pdev) uart_remove_one_port(&asc_uart_driver, port); } -#ifdef CONFIG_PM_SLEEP static int asc_serial_suspend(struct device *dev) { struct uart_port *port = dev_get_drvdata(dev); @@ -823,8 +822,6 @@ static int asc_serial_resume(struct device *dev) return uart_resume_port(&asc_uart_driver, port); } -#endif /* CONFIG_PM_SLEEP */ - /*----------------------------------------------------------------------*/ #ifdef CONFIG_SERIAL_ST_ASC_CONSOLE @@ -932,16 +929,15 @@ static struct uart_driver asc_uart_driver = { .cons = ASC_SERIAL_CONSOLE, }; -static const struct dev_pm_ops asc_serial_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(asc_serial_suspend, asc_serial_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(asc_serial_pm_ops, asc_serial_suspend, + asc_serial_resume); static struct platform_driver asc_serial_driver = { .probe = asc_serial_probe, .remove_new = asc_serial_remove, .driver = { .name = DRIVER_NAME, - .pm = &asc_serial_pm_ops, + .pm = pm_sleep_ptr(&asc_serial_pm_ops), .of_match_table = of_match_ptr(asc_match), }, };