Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp4337292ybt; Mon, 6 Jul 2020 02:01:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX9LbXjoH+zChn8dx3/UyHWUzSTCcZfMicpgYT67b9JmtWefksKPtfZZoa7MD6+WV+nwPQ X-Received: by 2002:a05:6402:1d35:: with SMTP id dh21mr49809262edb.186.1594026061861; Mon, 06 Jul 2020 02:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594026061; cv=none; d=google.com; s=arc-20160816; b=EPQgtG3MovACSy0Rfd4UxU3OWoXqj91yeSDpfnmO7R4Es75+oq+/bcUcTlSp9vODu4 WZ7xpb8tAcaCGsywvc2K0cP8qcsLvP0lLAuwGwqPg/+CSwxlNCqMWGj97SCASgISwZig bDMq1FrSwz+4Tvp8j9H+sEZC0IEGF7du9AirlIgNl39fDwo88Nqix1HrZKEU/4Aens5d G3zleXVJXFypnzrbJWoNWmenOl9E6zrYhxc4IcsUNCTVaDQWXd+zloeJ8ykFezBNVXuy Y2lO+XFucYCnbnDT2G/0k3nVWTidGPV/nbZIeZHOsCa7iG4Q+IOw2dYhG05iZZ1z9Z+6 pl1Q== 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=YDgHKvvmhsfWS8A9BYdRbUuXFuoTQjGp+5UpoFiAnjA=; b=QqwmFRpz88M9xXZ8Oo/a1/gxf5IZzv5woIK+DnZMiGEetiwp1VmKvEoPPJ872wc3is jCUJhCgWtRTHioZ7+OmPakhetTG/vhBAuvXt5PuuWuqqf+FqqRjKLCC/MF233t4NxSDr tuSnAmG058qYhaDI/FZCfBQU3drpGua4vmChciW77VAM4Ul0/AR07wqizluEiWNp3mHW NTM6UMUoimvk8PUB5ZZ2wg4j+bRLw1P5cLtbeqUjo6O3QLk7r1ke0D1+VKvw9+k+hoHZ sSeGkBrN2EdDcF/chcnGJzJTAOs0jyKhkxavT327qEJWbKX2/I4YmCzIAShZqLpu6O16 hrdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rFzIXEjT; 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 dj5si12710000edb.367.2020.07.06.02.00.39; Mon, 06 Jul 2020 02:01:01 -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=rFzIXEjT; 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 S1728759AbgGFI7b (ORCPT + 99 others); Mon, 6 Jul 2020 04:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728321AbgGFI7a (ORCPT ); Mon, 6 Jul 2020 04:59:30 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84991C061794; Mon, 6 Jul 2020 01:59:30 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id cv18so8443361pjb.1; Mon, 06 Jul 2020 01:59:30 -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=YDgHKvvmhsfWS8A9BYdRbUuXFuoTQjGp+5UpoFiAnjA=; b=rFzIXEjTzJ+YSq0LUkTDOF5yEVqOHm2fLik0s365SypOU57MghxUaHEt7P4+lWmhLo ukyWeXdlW2BcCn2gkiloxjmvEj/dLziRtbApGUr7uenm99O72BXKwyMa7L1XrIQxWbXw Z0C4EA+upuqWYOS1A+/8PmbZsEIMhqVTL7uSH91xNv+mvJYeLzX4GyMkXMm6YN5ZZ/gj vfRiSiXeiAb5C8d7cfxlycz7IF6KmjDoirZFssC0ko48Wusk+vLJw3Wro0qI9lPtjid1 Z0ofdKV9+XXwF6zigiqCDWB5eGHzmdlOMdQuobbNq67EN7OiiPUqUGnPt/AcpYX9wThn gDIA== 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=YDgHKvvmhsfWS8A9BYdRbUuXFuoTQjGp+5UpoFiAnjA=; b=hQtX0tEB8+TaQObP9jDS/EJvpNPF1d6UrxQq+qEFNbGkX+RsuVhxzZsYMpb5SUwR6V bdMRrqTiUYqbQ9BMHf2nLFu/1n+b8wyUpI7ppw7h+rfhv8P9iSGuiuS0Im91CKlA7P0u c6xaYo4T8PwLM5O3ZZWMN5rtsloJLX4o37TWFzKQ/hoXP/ix6dbo4G4OheiRARkr7ITH VTGr0OhPn6Fh74Do2ZW3p8Bh1K55Lmjl08hnwwo/m8WzuBHr5ie4hWR8O73PXOpPrDvl 9woGnuQFIFw8sZK69d1TVVanZuSi9644xrL1+ME2kAFsPtK2sAH18s91DxiBDEAr8i9V SSaw== X-Gm-Message-State: AOAM531CqbGY10z7ZdsWVLSiEgHj8KBkLPQKmTcQGh9Q97KRI+TMh1DJ kMR/iGmzgjdQZGvJrOP+3FmR9jJf/tW0ZQ== X-Received: by 2002:a17:90a:eb01:: with SMTP id j1mr51503192pjz.29.1594025970046; Mon, 06 Jul 2020 01:59:30 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.67]) by smtp.gmail.com with ESMTPSA id a19sm10068149pfn.136.2020.07.06.01.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 01:59:29 -0700 (PDT) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , bjorn@helgaas.com, Vaibhav Gupta , "David S. Miller" , Jakub Kicinski Cc: Vaibhav Gupta , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org Subject: [PATCH v1 2/3] sun/niu: use generic power management Date: Mon, 6 Jul 2020 14:27:45 +0530 Message-Id: <20200706085746.221992-3-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200706085746.221992-1-vaibhavgupta40@gmail.com> References: <20200706085746.221992-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 legacy PM, drivers themselves were responsible for managing the device's power states and takes care of register states. After upgrading to the generic structure, PCI core will take care of required tasks and drivers should do only device-specific operations. The driver was calling pci_save/restore_state() which is no more needed. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/net/ethernet/sun/niu.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 9a5004f674c7..68541c823245 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -9873,9 +9873,9 @@ static void niu_pci_remove_one(struct pci_dev *pdev) } } -static int niu_suspend(struct pci_dev *pdev, pm_message_t state) +static int niu_suspend(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(dev_d); struct niu *np = netdev_priv(dev); unsigned long flags; @@ -9897,14 +9897,12 @@ static int niu_suspend(struct pci_dev *pdev, pm_message_t state) niu_stop_hw(np); spin_unlock_irqrestore(&np->lock, flags); - pci_save_state(pdev); - return 0; } -static int niu_resume(struct pci_dev *pdev) +static int niu_resume(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(dev_d); struct niu *np = netdev_priv(dev); unsigned long flags; int err; @@ -9912,8 +9910,6 @@ static int niu_resume(struct pci_dev *pdev) if (!netif_running(dev)) return 0; - pci_restore_state(pdev); - netif_device_attach(dev); spin_lock_irqsave(&np->lock, flags); @@ -9930,13 +9926,14 @@ static int niu_resume(struct pci_dev *pdev) return err; } +static SIMPLE_DEV_PM_OPS(niu_pm_ops, niu_suspend, niu_resume); + static struct pci_driver niu_pci_driver = { .name = DRV_MODULE_NAME, .id_table = niu_pci_tbl, .probe = niu_pci_init_one, .remove = niu_pci_remove_one, - .suspend = niu_suspend, - .resume = niu_resume, + .driver.pm = &niu_pm_ops, }; #ifdef CONFIG_SPARC64 -- 2.27.0