Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2128857ybt; Fri, 3 Jul 2020 01:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygRYWCLHX8xbpsSC/3VjeSm8v0f2c8B1oI9Tn1BFWkm1i6CcSz6Q0icSi/2Ep7gEsvbd+S X-Received: by 2002:a17:906:6b95:: with SMTP id l21mr31991144ejr.32.1593764390005; Fri, 03 Jul 2020 01:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593764389; cv=none; d=google.com; s=arc-20160816; b=jMctWlhYONxzTLARZ4P5pKiGuO0LYN0VHmnZnROR4wjlkfqXxM8ORAuOufS3K/Oyvl 0BA+vzBcK4Yil8S2kyWS2NKonAFHDZhdQc1dZivakOEKn+vYA10wBDYu7z0rmrSDumlu 9nsxAkId8uRph3BmqnuJHRuXZBdnlt+ZKgNF/byFxeagPRrqAdUXG/b2ep/sccnEwp6h pho9OaRBfuuPJhkMS29yZJeceb1bB6t9GNF70i4EItXVxe1G+aC1C7ZeVVJq/qDpT405 xnb2MxPEntgf5S8vJxlykxoSxYouOFp1lS8MxYxKGVCqiZZ1RB+udtBzV5Mc5Dq1JHBV E79w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x4o+ZvPMksH/mCK/c/HDn/RkcQN7O7pX0UDd4MLfNlo=; b=kYE9+jLxiGggSe5CuFmdB2EGDT/nsUEV5Yu6HAfNefpW2RvyN+QCX5oQlefMU1yKkh Lvvt9YQAZVIHoy0n5nfjGVGSNOM6QjxFSvf1SsRLtTYouutSXVzXfHhap03DrOd/YdQg AkLuVPJpXGggxVLqJsufjhrZU1TBHDn0t4bhCHs+a5MM+lw2trkqEZZO1TOMuvocuLSu LKFmawSfCufKEcJoxoqAt0zK8sEGpG1gWYHG6D2Sos8kfl2fmIn9KO3DBbtlLQV6O4lc sHD8O83I7ytXJBNfiXmUtuSyP8FtqOPiWrWqqhec8kLj9DJex2K6FKmB0HlLg8HlmITA L/Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AtQYdBra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si7618049edm.183.2020.07.03.01.19.26; Fri, 03 Jul 2020 01:19:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AtQYdBra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbgGCIQp (ORCPT + 99 others); Fri, 3 Jul 2020 04:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbgGCIQo (ORCPT ); Fri, 3 Jul 2020 04:16:44 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7970AC08C5C1; Fri, 3 Jul 2020 01:16:44 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id 72so1801600ple.0; Fri, 03 Jul 2020 01:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x4o+ZvPMksH/mCK/c/HDn/RkcQN7O7pX0UDd4MLfNlo=; b=AtQYdBra+JVvn7sj0HuVvPfyV1r50bN0iVzn7jdSs2k+//yzu6cTSzWBMz8S1hW31d bOKth8SXUtKb7zsPAxXQ+ON/CROJ0PfiTI2wxUkgefQcR3dI9E1lowVXGbGhNS3SHBb8 p2Il4tpZmjvqUQU2Vpn3mI1k3QecOwv6y9Q0dX9IJCO4dClSRVNqfsPzA6T0CrqJJGN8 9PPnc9lnfT77XLRLLEp39G2LnAt/V417LsYwto6Dr3NYKay0aSL/2yX9cBTifRBVDfqr Bb5fIJy39QsBGnAR+r2lLk6PXv9+/kv8mKlUvbTn6TmgfgFTscUHOeXFcRADOBiTk4ey dXIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x4o+ZvPMksH/mCK/c/HDn/RkcQN7O7pX0UDd4MLfNlo=; b=j2JAIe8SSG+c4KLD7vhc6CtK4CxIX6YJN2i1COhu/eGGvOtMN+Jvgx0YODszQJnNC6 V/PCvZXxXUm3ph1E5ZrIihyg2JcX4agXnMSgeSasaEGI5Oq+vawxvcAVJ5oJm3dKek0F Y9Af5wSdJqneJKx46jpZqPLn3jOgxiwzMn4t06pnfzGcfB8wEwhVkH1IzleZ99Ggudwi 5gtEEm1yVgo9Fy4gx8TpEigFifyqzWGkn3cNXJnpm3UsAO70NtBg5PVUpqtVNOd8OcQ5 4Hqt7OH+OF77M4kZ18BkpCLx3eBoMy2ywb8+1pj1khs2mSx4adeizsHtN/WivppFuKCF SJJQ== X-Gm-Message-State: AOAM531g9HvLHbEldPiCLdIydBIum8HZasDfjwXuxrhO3XcJ2n0B0Uxm O/X+vQ4rQk/dT/N4EbRVng0= X-Received: by 2002:a17:90a:20ad:: with SMTP id f42mr25987368pjg.96.1593764203990; Fri, 03 Jul 2020 01:16:43 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id y198sm8437085pfg.116.2020.07.03.01.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 01:16:43 -0700 (PDT) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , bjorn@helgaas.com, Vaibhav Gupta , "David S. Miller" Cc: Vaibhav Gupta , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org, linux-ide@vger.kernel.org Subject: [PATCH v2 4/4] ide: delkin_cb: use generic power management Date: Fri, 3 Jul 2020 13:44:28 +0530 Message-Id: <20200703081428.1011527-5-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703081428.1011527-1-vaibhavgupta40@gmail.com> References: <20200703081428.1011527-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the support of generic PM callbacks, drivers no longer need to use legacy .suspend() and .resume() in which they had to maintain PCI states changes and device's power state themselves. All required operations are done by PCI core. After converting it into generic model, suspend() became an empty function. Hence, it is defined as NULL. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/ide/delkin_cb.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/ide/delkin_cb.c b/drivers/ide/delkin_cb.c index 300daabaa575..a8a1af6aa1c1 100644 --- a/drivers/ide/delkin_cb.c +++ b/drivers/ide/delkin_cb.c @@ -123,28 +123,13 @@ delkin_cb_remove (struct pci_dev *dev) pci_disable_device(dev); } -#ifdef CONFIG_PM -static int delkin_cb_suspend(struct pci_dev *dev, pm_message_t state) -{ - pci_save_state(dev); - pci_disable_device(dev); - pci_set_power_state(dev, pci_choose_state(dev, state)); - - return 0; -} +#define delkin_cb_suspend NULL -static int delkin_cb_resume(struct pci_dev *dev) +static int __maybe_unused delkin_cb_resume(struct device *dev_d) { + struct pci_dev *dev = to_pci_dev(dev_d); struct ide_host *host = pci_get_drvdata(dev); - int rc; - pci_set_power_state(dev, PCI_D0); - - rc = pci_enable_device(dev); - if (rc) - return rc; - - pci_restore_state(dev); pci_set_master(dev); if (host->init_chipset) @@ -152,10 +137,6 @@ static int delkin_cb_resume(struct pci_dev *dev) return 0; } -#else -#define delkin_cb_suspend NULL -#define delkin_cb_resume NULL -#endif static struct pci_device_id delkin_cb_pci_tbl[] = { { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, @@ -164,13 +145,14 @@ static struct pci_device_id delkin_cb_pci_tbl[] = { }; MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl); +static SIMPLE_DEV_PM_OPS(delkin_cb_pm_ops, delkin_cb_suspend, delkin_cb_resume); + static struct pci_driver delkin_cb_pci_driver = { .name = "Delkin-ASKA-Workbit Cardbus IDE", .id_table = delkin_cb_pci_tbl, .probe = delkin_cb_probe, .remove = delkin_cb_remove, - .suspend = delkin_cb_suspend, - .resume = delkin_cb_resume, + .driver.pm = &delkin_cb_pm_ops, }; module_pci_driver(delkin_cb_pci_driver); -- 2.27.0