Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2671606ybt; Mon, 22 Jun 2020 04:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/QdP7HeDbTagSz4XbvpP1rfA6siuamqdCV8ZN8GsDTFTE8gE+gI6WrmNuJv750iotDhzD X-Received: by 2002:a17:907:7294:: with SMTP id dt20mr14982268ejc.355.1592824790469; Mon, 22 Jun 2020 04:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592824790; cv=none; d=google.com; s=arc-20160816; b=Z2bfYfu5er2kHSKDvlcD9ufHuygY9fFOQ7KFtpWUmtLZcualTPx6DGdiosJHOJu4Vk UfikCYYLjMaYejPpyfL5xRHjHW+gVYuotGAAfSZt7R8MGcKmdIHabYnZ7nIBE7n9xc44 6p8ut2BYvYBUEBSTkJPS5mDyI1202L7Ri236dd6S7gAbMhBTjwRPrFqpllVmL5VbiQ2Y GjaH/kJ6UUgHdaGGPFowNrQ0cV3gglofA5zi74kteYte7wVxZctAaBv8XtByflavepaw vi1ncppA8Vkg/YEqj6vpz+L86l0jUG+7CenHQsnI5cO/Qt/Ii7+0Q5MWbHpmva/VlgeO K08Q== 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=boZlC9cES8mgQCV+vpw6dNMvA6C5kwGu41XuL0MFGgA=; b=X30kMxcVYvPoTGXquppnRZ7+iK3yjNM9JwRyClUYycEmpEvmBdUAVfeWiOt4jQMDwt ejapnxsOoDTEZGgUVOSzIVmwCaZGSTLDfBzOjC57Yei7U0o01FKKA+kMsuAmJEJxOi1l KT5Sz5QSaPQzq/Xmfx+cFw4tnjKJgwcZkDFp5V1lou70OgzO1I3/+Dbm4OcM2jW3kXOa 47ACyfJu7pdiemsLubGMWdgPrKSyeniMWrGfQ/xRYrTd0dSFNZO6ApL360/Ihhjcy5Ef /TPyLrKlk/MMGapp020s1EzgKRKun5vwcmAHk6MHDXk6u+DLYebwoIKdzsmH/8YOqi4D zlpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PRvKW7jp; 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 u21si3159629edl.561.2020.06.22.04.19.28; Mon, 22 Jun 2020 04:19:50 -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=PRvKW7jp; 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 S1728395AbgFVLRC (ORCPT + 99 others); Mon, 22 Jun 2020 07:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728287AbgFVLPU (ORCPT ); Mon, 22 Jun 2020 07:15:20 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD849C061794; Mon, 22 Jun 2020 04:15:19 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id a127so8253490pfa.12; Mon, 22 Jun 2020 04:15:19 -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=boZlC9cES8mgQCV+vpw6dNMvA6C5kwGu41XuL0MFGgA=; b=PRvKW7jpjFDQZB+xI+fv7l1+6uyRhIvN+jwRydmIvNXCfTHEFJUgIg7UFP/RCCvpC3 iheuYvX9zRE9A4DGoFqwHyuGxl2yHCIOGDIFemHkWrJpTF83FSgJnht6I8Q1s6yCyLeu L5+v8WzaxYUv2CRjdFQnOlxYYwUwOUY+QiCeLTg+tMJey/+Os8vE9E6pvteqbOuCLdNn B/vy/3/GUoGB3p7VTZLaHBiie2hkKxp7LLkBuSelFeM2Lj85kPrNzL8tVQEwh6msaSRW gDI0ald+clzrjHgJUFKfp9+BjXv8KmJ8TT9k4mfSQzqgZqwPdFWjA3mvwEMqYQjp6zNS n2hQ== 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=boZlC9cES8mgQCV+vpw6dNMvA6C5kwGu41XuL0MFGgA=; b=oIWVP3lNHjTYNnfdk2FD71bN4K5XDty+zKfbKripfPMD7F8c/YqOOwQjvN/KdEeQ6o 7T5bRwHdlyE8NbQ/dlL6v8eU/pukcpiFnjg+SdnA1+RutozYHDPHFu6l3YJ1Il7C/Q/P QFjMo91lTUgRTSGe54+dx3BbnHN4tAW4WBVkedU+tgj0k0EAIraa25CItu+cm06JQF1H mKhArY74XtMuXOUOnZ2ZLGpKE4+TnA0M2ZF4WzvPqQrWjavdIJx1HXhbaocT6mwPuD+E lypaiAV+52M9yZ15VyhlghLwT7ByyeMsS2LDJ67AJ5uLsPjPMRNpjTCTvbJjxw3wHsOh yjOw== X-Gm-Message-State: AOAM533Ag0cH5MueP3z0Ml2+K1uZZtJSCC1r3ZV6V2j8Lty9tMllSFN3 LwE2bKhh0+yHUSnIDCAqtJE= X-Received: by 2002:a63:c004:: with SMTP id h4mr12497488pgg.385.1592824519235; Mon, 22 Jun 2020 04:15:19 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id n189sm13950150pfn.108.2020.06.22.04.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 04:15:18 -0700 (PDT) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , bjorn@helgaas.com, Vaibhav Gupta , "David S. Miller" , Jakub Kicinski , Don Fry , Tom Lendacky Cc: Vaibhav Gupta , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: [PATCH v2 1/3] pcnet32: Convert to generic power management Date: Mon, 22 Jun 2020 16:43:58 +0530 Message-Id: <20200622111400.55956-2-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200622111400.55956-1-vaibhavgupta40@gmail.com> References: <20200622111400.55956-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 Remove legacy PM callbacks and use generic operations. With legacy code, drivers were responsible for handling PCI PM operations like pci_save_state(). In generic code, all these are handled by PCI core. The generic suspend() and resume() are called at the same point the legacy ones were called. Thus, it does not affect the normal functioning of the driver. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/net/ethernet/amd/pcnet32.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index 07e8211eea51..d32f54d760e7 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c @@ -2913,30 +2913,27 @@ static void pcnet32_watchdog(struct timer_list *t) mod_timer(&lp->watchdog_timer, round_jiffies(PCNET32_WATCHDOG_TIMEOUT)); } -static int pcnet32_pm_suspend(struct pci_dev *pdev, pm_message_t state) +static int pcnet32_pm_suspend(struct device *device_d) { - struct net_device *dev = pci_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(device_d); if (netif_running(dev)) { netif_device_detach(dev); pcnet32_close(dev); } - pci_save_state(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); + return 0; } -static int pcnet32_pm_resume(struct pci_dev *pdev) +static int pcnet32_pm_resume(struct device *device_d) { - struct net_device *dev = pci_get_drvdata(pdev); - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); + struct net_device *dev = dev_get_drvdata(device_d); if (netif_running(dev)) { pcnet32_open(dev); netif_device_attach(dev); } + return 0; } @@ -2957,13 +2954,16 @@ static void pcnet32_remove_one(struct pci_dev *pdev) } } +static SIMPLE_DEV_PM_OPS(pcnet32_pm_ops, pcnet32_pm_suspend, pcnet32_pm_resume); + static struct pci_driver pcnet32_driver = { .name = DRV_NAME, .probe = pcnet32_probe_pci, .remove = pcnet32_remove_one, .id_table = pcnet32_pci_tbl, - .suspend = pcnet32_pm_suspend, - .resume = pcnet32_pm_resume, + .driver = { + .pm = &pcnet32_pm_ops, + }, }; /* An additional parameter that may be passed in... */ -- 2.27.0