Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1154455ybh; Mon, 13 Jul 2020 10:41:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0Ba8k4HQbxIqp+Gb9FqKPzBtbgJh7irxnasNDNrdJAgbz1I8ZYDv9i9FaHwWKdoCDoUU/ X-Received: by 2002:a05:6402:b4b:: with SMTP id bx11mr509609edb.286.1594662064563; Mon, 13 Jul 2020 10:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594662064; cv=none; d=google.com; s=arc-20160816; b=ylxrkLoYUrtO5JTJr4JhWN/bHkfjF9fILYUVGp8tljdVpvv5uZ7wDkvjF+oF+WFLit oBLeF1mEImslZ8FOiC2dCmkiDrKGzE6uUkt1xX7kkqcivc5u1QM5S//m1Uy3S7sU5Or6 2Dirr9sm0gZq+pmR2jTsHFtsdPLdnNH4iBlX0h+y1YjRFirkmi9mYqzRqt/LyQoe+M6v lI4TVKVRDW3r0uSI5+5ZXKgttspz/hlgc+5EVQJTYt9YntHuXaIDNAIqVusk/MEPBDXo x8Yajy6it3HmBeT3JjUjepVIGa9bfbR/qu+ex0vNc9ISEEo6H20qoFLGFyJkAVlk63EN kbsg== 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=o79HY/YJ97Muwh9uDvJ9rHuVKiZwBdetcBhADyrjYKw=; b=wz4DtOvlNkoyAPLuOVJYduKgK0XKH8EFQgtvmpus0Z/4F7XVn1SM38p1qmN1QUS9GL xl4+/bhhq9md5ilepWGKZgT3lgc7bvWdWtpWl4NL8cg8LyX7hIb99kqzcSmjobeE6x+R y5xaOewCNdqUc2zebhYJsTIy+i3mwzoI16802BQhKJ9HUzVykqxMjOLn1YV4d6RfiBLP I7SzHFAaVy7Z5PUH/VWvYEwu3WdrTgohsfySb0mAz/R+bfqslYPympaW7s2GE1sgXVWs Z1I+afM48EolWp41CvsUVgTORd34lTIl9fqi6VeMJPJHpZa+5TvIsT7ghQXVn+70nCnN sGuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pWthblwx; 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 dk28si9020986edb.425.2020.07.13.10.40.41; Mon, 13 Jul 2020 10:41:04 -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=pWthblwx; 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 S1730425AbgGMRj6 (ORCPT + 99 others); Mon, 13 Jul 2020 13:39:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729703AbgGMRj6 (ORCPT ); Mon, 13 Jul 2020 13:39:58 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02858C061755; Mon, 13 Jul 2020 10:39:58 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id ls15so211698pjb.1; Mon, 13 Jul 2020 10:39:57 -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=o79HY/YJ97Muwh9uDvJ9rHuVKiZwBdetcBhADyrjYKw=; b=pWthblwx4XS1nTxr4C2EivA/n5vv+TetehgxG5VGGx9WqnFEWfMCBfc0TnNl8a6oTs L3u03MGf06on2PbEQEZWSOI0dG94IDHDfXJRjGW9GeBTbpgUdaGRHtvVGfonR50uo074 +x1A7PJp/jcmMqede3M99hONPcWyW0Wx9qATi6QChEEWYMqIuUhH1j8zgDgnu1kcE8oj Nwy3nqR6yzT7vxGUz4koXImCaaHxMyBU5aZo70/4Saz8IHhuVGMZjIdO2kJPklUc78Or EjOcY2VUetIeMyOywIeIKuyWWHsYHfK2Q7mH58ZxVIDSJGD61ZeRWT8LpUV6Hc0W5XOw U9Aw== 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=o79HY/YJ97Muwh9uDvJ9rHuVKiZwBdetcBhADyrjYKw=; b=DQHl7rtbmF8ENY0K/B1KNHNEbuGIj7jBMIrLG+niL1htVV7HXv0HzKViNewU8mhGyK uzi1shucv1rEplRwGZa3EjttfhKGl0AlZzh3TWxr4wueWRraYtP6xGkufRZuxZOoklem U9KvX5AKqU3OXt6iNM8MbIj+QvWRd78Fi0rtzqVji9W2RGZpqzLu/AtJQBsdiI6PGAtw xKm3Ue1BAuu4TkrvYllr6awcZlCwXMqIGxTUDqwdngWPqBDm3r9UBebmcyx27HNidx8t dWQlErTkbzwO2OvDUxecMuR/u5aodihSb11XmIeTXZoXZGcZnQwfzXBjXtDx+4bmqGJi fbXQ== X-Gm-Message-State: AOAM53286xbZCBqhX+YXWOk/x0/aWZK6Qf4bv46Pw8MbF2JESpwg/eQO 2OS50UrsakC9oW1ba7e6oH0= X-Received: by 2002:a17:902:7008:: with SMTP id y8mr605240plk.85.1594661997540; Mon, 13 Jul 2020 10:39:57 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.67]) by smtp.gmail.com with ESMTPSA id w9sm186540pja.39.2020.07.13.10.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 10:39:57 -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 v3 3/3] ide: delkin_cb: use generic power management Date: Mon, 13 Jul 2020 23:06:13 +0530 Message-Id: <20200713173613.2095-4-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713173613.2095-1-vaibhavgupta40@gmail.com> References: <20200713173613.2095-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 | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/drivers/ide/delkin_cb.c b/drivers/ide/delkin_cb.c index 300daabaa575..a711b64dbd1c 100644 --- a/drivers/ide/delkin_cb.c +++ b/drivers/ide/delkin_cb.c @@ -123,39 +123,18 @@ 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) host->init_chipset(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 +143,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