Received: by 10.223.176.5 with SMTP id f5csp1073134wra; Fri, 2 Feb 2018 10:42:16 -0800 (PST) X-Google-Smtp-Source: AH8x227l2z13JLlDgNYBKxp6xhPAFiKHxCzccL0rDcI7GkwP/tjuwmdUC6RTCG+D55adUYQsmuQv X-Received: by 2002:a17:902:b189:: with SMTP id s9-v6mr5367843plr.243.1517596936511; Fri, 02 Feb 2018 10:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517596936; cv=none; d=google.com; s=arc-20160816; b=QlEvsolOJ5+qoBIptpZ8svu54V3Wj7w92+2/nWKhVvPJ5KODAuEA/MhvU5Xiu5U+8D I0szRC0KeP2KOpfjkwERdybm9qYgSvBb/WYIVQXX8yzdCq/35fyrF5tXp70OBynkFHn2 5Fahd53yUUgsnAtb3cH+E3VgbthABemulx9xhG2n+/ImT1EOPImUuZjQ8EyMsjO9uySR 7i4dD7fxQe9pSSGmYafA0esGNUsN9WQOf7is9uk4M7V73LOl0gzbOeztQYfJ2WjehUe/ oP2rtvCNEZKlJyXdQStSjYYQFBgVScCaibSVl9+YeH9fYoTk6+Y96Ad7MZmH+/isf8yq Ykjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=uxl+z+PnvFle67ahO3Rw38MOYQg98g4Uh5MHjzbgJ6g=; b=b5I24I8CucZBYnO+2NxXuXBL1V5s6q4GPPtYQtSwTPCfeqBYZadhQQDDn9MHkEGnOh cUX3bI9wn8FSW+nQa3qiFHXicpfh74oMD5vsisft04LvFoo5kAmzoPQX+SF7IHNI9fcF zrl+O5gpZz2/EMhihVDWte9vq9ddrIr1+sXa6m7EWpWB7Wu9cKnKwF8vxFsvu1Osrh9Y PcKhQEQQ9EgX0XGcO0ddlcfTFxJ8FM8QoPavXvBbl+5gdJ46ck81HGHk/+tazgRl8ceH vWiPZKLe/X7puiMD1V+KO6cfMuiL70RlpotcUxAKBIUtjxGBQ3/F62dNlZRdNb5KUbed g63Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p84si2011268pfj.67.2018.02.02.10.42.01; Fri, 02 Feb 2018 10:42:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755124AbeBBSkR (ORCPT + 99 others); Fri, 2 Feb 2018 13:40:17 -0500 Received: from mga14.intel.com ([192.55.52.115]:10384 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755002AbeBBSj7 (ORCPT ); Fri, 2 Feb 2018 13:39:59 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 10:39:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,450,1511856000"; d="scan'208";a="27608623" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2018 10:39:57 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6DE1B90; Fri, 2 Feb 2018 20:39:56 +0200 (EET) From: Andy Shevchenko To: Sudip Mukherjee , linux-kernel@vger.kernel.org, Nikola Ciprich Cc: Andy Shevchenko , Andy Shevchenko Subject: [PATCH v1 2/8] parport: PCI core handles power state for us Date: Fri, 2 Feb 2018 20:39:49 +0200 Message-Id: <20180202183955.85453-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180202183955.85453-1-andriy.shevchenko@linux.intel.com> References: <20180202183955.85453-1-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko There is no need to repeat the work that is already done in the PCI driver core. The patch removes excerpts from suspend and resume callbacks. Note that there is no more calls performed to enable or disable a PCI device during suspend-resume cycle. Nowadays they seems to be superflous. Someone can read more in [1]. While here, convert calls to new driver API. [1] https://www.kernel.org/doc/ols/2009/ols2009-pages-319-330.pdf Signed-off-by: Andy Shevchenko --- drivers/parport/parport_serial.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c index eda733c8f6e0..9689503641dc 100644 --- a/drivers/parport/parport_serial.c +++ b/drivers/parport/parport_serial.c @@ -661,57 +661,41 @@ static void parport_serial_pci_remove(struct pci_dev *dev) return; } -#ifdef CONFIG_PM -static int parport_serial_pci_suspend(struct pci_dev *dev, pm_message_t state) +static int __maybe_unused parport_serial_pci_suspend(struct device *dev) { - struct parport_serial_private *priv = pci_get_drvdata(dev); + struct pci_dev *pdev = to_pci_dev(dev); + struct parport_serial_private *priv = pci_get_drvdata(pdev); if (priv->serial) pciserial_suspend_ports(priv->serial); /* FIXME: What about parport? */ - - pci_save_state(dev); - pci_set_power_state(dev, pci_choose_state(dev, state)); return 0; } -static int parport_serial_pci_resume(struct pci_dev *dev) +static int __maybe_unused parport_serial_pci_resume(struct device *dev) { - struct parport_serial_private *priv = pci_get_drvdata(dev); - int err; - - pci_set_power_state(dev, PCI_D0); - pci_restore_state(dev); - - /* - * The device may have been disabled. Re-enable it. - */ - err = pci_enable_device(dev); - if (err) { - printk(KERN_ERR "parport_serial: %s: error enabling " - "device for resume (%d)\n", pci_name(dev), err); - return err; - } + struct pci_dev *pdev = to_pci_dev(dev); + struct parport_serial_private *priv = pci_get_drvdata(pdev); if (priv->serial) pciserial_resume_ports(priv->serial); /* FIXME: What about parport? */ - return 0; } -#endif + +static SIMPLE_DEV_PM_OPS(parport_serial_pm_ops, + parport_serial_pci_suspend, parport_serial_pci_resume); static struct pci_driver parport_serial_pci_driver = { .name = "parport_serial", .id_table = parport_serial_pci_tbl, .probe = parport_serial_pci_probe, .remove = parport_serial_pci_remove, -#ifdef CONFIG_PM - .suspend = parport_serial_pci_suspend, - .resume = parport_serial_pci_resume, -#endif + .driver = { + .pm = &parport_serial_pm_ops, + }, }; -- 2.15.1