From patchwork Sun Apr 21 13:47:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13637357 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 8A590C4345F for ; Sun, 21 Apr 2024 13:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N6r1j8t/Ga37N3hBKhnqQY0su6G0PHlfMExGoPyLk3U=; b=dzcpg5Wy+gsXgW cSxYTmIIjoCeVc4+cwEmNYHP4PPp7A1FOeKlO8iulLIrmwbJXRU8cN/rHd5BMg1wmLZGMI+7XRRJo r2sDQvG8L2ZWT1XYq5XJKdfE0K0IZTfYjA3CWauK6dfL9VuHifBxa2qON1m9KIOjw5ZGkfG1uj+YI uA+36ejI06qwa0MsxtFY9mxXaYOQ/kgWBsjwDvzgx8rEmiIu0RfnP7XKR5Tcd1Krcs5pZ8PS29vpz 0ABV0XHJMnbUdJXV/hJZsIAVsRNhwShbcgg+zFB+fvFJFMjTtVZelVqCH13k5iHgdWx6ckVlTvxI0 BKmEpRHWLlGnaoriqUVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryXYi-0000000AaqF-1to6; Sun, 21 Apr 2024 13:48:44 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryXYd-0000000Aamh-0fQc for linux-arm-kernel@lists.infradead.org; Sun, 21 Apr 2024 13:48:40 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6ecf406551aso3065025b3a.2 for ; Sun, 21 Apr 2024 06:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713707318; x=1714312118; darn=lists.infradead.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=ciAsjHwxYvDFWKrK0+bRI8F1DZJnqhJJG3f0Ywfv28Q=; b=eEWlXtTLem68y2ZJ6x6rFHvm4g0QS8/MKIJtIphh5FWwWHVd8ZIvFma2kl6rdhSQze 5F4O9sLPLz5b15F+YsQTlNriY+lRNmHuTkivmVyhrqa9w+ey6eUJX+2qdXQqUWWXxy/+ 9vcMT5zerBJGRcyJFP2HHE3/d3siJM+83Jt6SOpSBoSf/vQv9/XzvNH3Q/cP0X58Q2kc 4ObWATwBPG/rbQUqcWpKfSbL3pjuOPuUFhwOGN45AD33qJbnL8Ders3HcuenL2c2Rl27 Go66ubmyxSR+hx2etIqPznAu2zxIBcTjOSIH6wDTxB1UTWOSTIYnpxQHhzhSYecfXzw6 PcPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713707318; x=1714312118; 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=ciAsjHwxYvDFWKrK0+bRI8F1DZJnqhJJG3f0Ywfv28Q=; b=YmeBOMQFzcCee0EbYK+7wyD8V3YCsvM+b0k3qi9iyA/eGteusSfdNcUjgCZbOvdNEb v5slcSgtwLdBbIsF1gxMsOPI+2S4yt+1rdguILa2x5c85VLitNcGyOS3i1Pjr6FQEuEU ByWQ/AmubFGyDd2rwoHaw0SZYufZXdYAfT3u2Oon0eoGyQ48tsyN6aXr3bRg+DSjzIzN zHiiNbAK8xl7+E+YKM2Ck/TRIOBG7hK73ala5FJhGWT6uKOihUW8AqB2nTO4/QajIYjV 9RPQDgqmZiSgtnbjWHOW2+mWGaPjyQlZnmXU2Iy2UtMRi44thtE9/x6gk3OSDOPrJIe9 w9mw== X-Forwarded-Encrypted: i=1; AJvYcCXVPDTyGdIIAfRQ/UlAeVEuQTIwKxVyZZIlbIfXyU/3WLbfOIUvV+mydsEJ6e4fH09QnrXpzc/vi9XfBV4lOmqs9aMCpdFnKCLpju8mBU6GF8QC6jk= X-Gm-Message-State: AOJu0Yy/dCYvraCSgpIiwERGihZf8Lm94QCroQiJpafjF66XY6cOwrUx hXQN5JQMJuF/MAIJdRj9if1/1/cePXThYC5zmlrHRPDpZ5o4ECsR X-Google-Smtp-Source: AGHT+IHfvthUjm2iFzaL1LUjJwU52v8bgHPixb0cyYfYA4lJ9nZLxMwMuG3dGxRPm+KDk4l3Veo7wQ== X-Received: by 2002:a05:6a00:1390:b0:6ec:f9d3:d0c6 with SMTP id t16-20020a056a00139000b006ecf9d3d0c6mr10380392pfg.16.1713707317822; Sun, 21 Apr 2024 06:48:37 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id o13-20020a056a001b4d00b006e6c733bde9sm6175043pfv.155.2024.04.21.06.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:48:37 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] usb: ehci-exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Sun, 21 Apr 2024 19:17:31 +0530 Message-ID: <20240421134752.2652-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240421134752.2652-1-linux.amoon@gmail.com> References: <20240421134752.2652-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240421_064839_558408_B4173A5C X-CRM114-Status: GOOD ( 18.67 ) 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 Use DEFINE_SIMPLE_DEV_PM_OPS macro to progressively switch from a code model where PM callbacks are all protected behind CONFIG_PM guards, to a code model where the PM callbacks are always seen by the compiler, but discarded if not used. Reviewed-by: Alan Stern Signed-off-by: Anand Moon --- v4: rephrase commit message add reviewed by RB Alan Stern v3: fix using new DEFINE_SIMPLE_DEV_PM_OPS PM macro hence change the $subject and the commit message v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. --- drivers/usb/host/ehci-exynos.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index e2303757bc0f..f40bc2a7a124 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -237,7 +237,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) usb_put_hcd(hcd); } -#ifdef CONFIG_PM static int exynos_ehci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -280,15 +279,9 @@ static int exynos_ehci_resume(struct device *dev) ehci_resume(hcd, false); return 0; } -#else -#define exynos_ehci_suspend NULL -#define exynos_ehci_resume NULL -#endif -static const struct dev_pm_ops exynos_ehci_pm_ops = { - .suspend = exynos_ehci_suspend, - .resume = exynos_ehci_resume, -}; +static DEFINE_SIMPLE_DEV_PM_OPS(exynos_ehci_pm_ops, + exynos_ehci_suspend, exynos_ehci_resume); #ifdef CONFIG_OF static const struct of_device_id exynos_ehci_match[] = { @@ -304,7 +297,7 @@ static struct platform_driver exynos_ehci_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "exynos-ehci", - .pm = &exynos_ehci_pm_ops, + .pm = pm_ptr(&exynos_ehci_pm_ops), .of_match_table = of_match_ptr(exynos_ehci_match), } };