Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3042138ybt; Mon, 29 Jun 2020 13:43:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdVaKPQigt+TLh1fTicZ2KIpatt8PRIWKwu/CTDvOO+kfhF+8n/fzXkKYwDK7rAxYLooOA X-Received: by 2002:a17:906:f49:: with SMTP id h9mr16306639ejj.155.1593463388692; Mon, 29 Jun 2020 13:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593463388; cv=none; d=google.com; s=arc-20160816; b=mpl3YDDOKDTMezpKKFizVEQREX+aE1VDTI4LWopWFjrO67npb7DSlmivThqJC60tNP kt68Ig4Wz+HSC0uyTO9qHA2OAEyYT4mUru/6Uqi3KJ+sYq4YtPkVnahweYZEW2TfSTcb +LukPaSRsSSetHwicdco63jm/DQwkWpY93tTw6gyZ7DKhAjua4G2x91O7LPBvGVjc/Yw i1xyoS2DXYd5AqMeF1W6jfBFgnzOVWKYVH0HoNch2RfuddYnICwAwWVtMDPhBTxhS6rx WwxjFDaAzZC4RGaIBJX0ImKOcptxpaCnn3fqu2NOI3CjGpLj7esU+/a/DZTOdQO+u6OA Xz/Q== 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=0fKzFmJ6swEgieVUVWwiawhKzRLACyYFxC8XDxv8xYs=; b=qHquQB89Bss4rYgAmyHjTXW8LFhxOkWXxn/WiiYYGO4XPwA2jeryTTplGhLzdiTRCJ VNtkyVjnBx62J9lVELBN8vCcgTAZ5eriSGklo+XvgpRCw7u+91JnU61zAlSTC0HeLPAc mG8OBQ/S5xgfsW2l2UKkfiL6M+yY/cOVoPtIpJuWu9Qvpxa46n9EQZloxmvmB9/l18ed PN9TwbBe1arWb+RdVZE58BTMcsQoTe4s1z64bGzEhR1XiWy0sJUoPnZN8wrZERMJpHFv fhBdj8GrC5bDtoKiiwI9xnd16r6RySshyIHfb2yw7M0G+wBa2Js4V4KibR/RRTO4ZCpQ Zx/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u88w+iCH; 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 w13si385665ejj.564.2020.06.29.13.42.45; Mon, 29 Jun 2020 13:43:08 -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=u88w+iCH; 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 S1733130AbgF2Ulj (ORCPT + 99 others); Mon, 29 Jun 2020 16:41:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731668AbgF2TOG (ORCPT ); Mon, 29 Jun 2020 15:14:06 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA99C00874A; Mon, 29 Jun 2020 01:30:17 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id o1so248041plk.1; Mon, 29 Jun 2020 01:30:17 -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=0fKzFmJ6swEgieVUVWwiawhKzRLACyYFxC8XDxv8xYs=; b=u88w+iCHX068TQdQGlFddt3hLNx2yCGO6LVQWWywBYNrJPxfB6jM2kQ0XCokKCXWI7 S1cvKjjK9AGtLBQS1eeRpxrkvPJ0Btbze1eRbWhdVRjxMpbENC512swG6tlAU26t//UN 9G9uVHnZLZZnXJfFJfhmQyPbcg8w7GRijrB0W97/4wfSZVzov43X5BvVnBmnf6TJTOLM UpdbzAp3t1s48We2fXEVPg7YoZteQfCvHF74x2W9vRAIgSOsm1G2psse5kshx5sLUhbi xJ6SP0gdGhfnUx8mR9034EIf/ZSIARVpiu8yhDeJVrG+y42v4RxA42o8A5pKyYHKXQCw o3VA== 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=0fKzFmJ6swEgieVUVWwiawhKzRLACyYFxC8XDxv8xYs=; b=fyFIiwPSLZyv2i2isYh3zVsrWx12X/1ayKyIu58db9eehh+5cammbPWd6KzJRafV48 V4hHmzyG9zQaOw76AFpDh3dSSB8uNgh6SHayA50aRYzpp/Ck0EZ2kR92OIYGDIyJ28aZ zsOyuThPMyI+856WB2d1U5GnldTClSFZtlJ6knDdMnNbCFPrgL4qauR/wl+xNWT4Kw4a BGwGD6OMrM22PE+giUH6fastr3foZm3V/T6606lOqwnkrSlSgBebDrJyPK2UMebp52hf Ij/ohwJx/3OOOUZcGpagSNQm+volobZkWcSA6A6kO7ahrtHGrElYwgGYbmHLCb+3VaSP OIZQ== X-Gm-Message-State: AOAM530Cko1QYEYXtP55GBN3oL1Gm4VYr1WE2amzCfW6LIlIMsrsjCvu AfWOZXR5RrnGHChC+7mAxo4= X-Received: by 2002:a17:902:8c89:: with SMTP id t9mr13070339plo.14.1593419416870; Mon, 29 Jun 2020 01:30:16 -0700 (PDT) Received: from varodek.localdomain ([106.210.40.90]) by smtp.gmail.com with ESMTPSA id 202sm9133790pfw.84.2020.06.29.01.30.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 01:30:16 -0700 (PDT) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , bjorn@helgaas.com, Vaibhav Gupta , Manish Chopra , GR-Linux-NIC-Dev@marvell.com, Greg Kroah-Hartman Cc: Vaibhav Gupta , netdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org Subject: [PATCH v1 4/4] vt6655/device_main.c: use generic power management Date: Mon, 29 Jun 2020 13:58:19 +0530 Message-Id: <20200629082819.216405-5-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200629082819.216405-1-vaibhavgupta40@gmail.com> References: <20200629082819.216405-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 Drivers should not use legacy power management as they have to manage power states and related operations, for the device, themselves. This driver was handling them with the help of PCI helper functions like pci_save/restore_state(), pci_enable/disable_device(), etc. With generic PM, all essentials will be handled by the PCI core. Driver needs to do only device-specific operations. The driver was also using pci_enable_wake(...,..., 0) to disable wake. Use device_wakeup_disable() instead. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/staging/vt6655/device_main.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 41cbec4134b0..76de1fd568eb 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1766,48 +1766,37 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) /*------------------------------------------------------------------*/ -#ifdef CONFIG_PM -static int vt6655_suspend(struct pci_dev *pcid, pm_message_t state) +static int __maybe_unused vt6655_suspend(struct device *dev_d) { - struct vnt_private *priv = pci_get_drvdata(pcid); + struct vnt_private *priv = dev_get_drvdata(dev_d); unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - pci_save_state(pcid); - MACbShutdown(priv); - pci_disable_device(pcid); - spin_unlock_irqrestore(&priv->lock, flags); - pci_set_power_state(pcid, pci_choose_state(pcid, state)); - return 0; } -static int vt6655_resume(struct pci_dev *pcid) +static int __maybe_unused vt6655_resume(struct device *dev_d) { - pci_set_power_state(pcid, PCI_D0); - pci_enable_wake(pcid, PCI_D0, 0); - pci_restore_state(pcid); + device_wakeup_disable(dev_d); return 0; } -#endif MODULE_DEVICE_TABLE(pci, vt6655_pci_id_table); +static SIMPLE_DEV_PM_OPS(vt6655_pm_ops, vt6655_suspend, vt6655_resume); + static struct pci_driver device_driver = { .name = DEVICE_NAME, .id_table = vt6655_pci_id_table, .probe = vt6655_probe, .remove = vt6655_remove, -#ifdef CONFIG_PM - .suspend = vt6655_suspend, - .resume = vt6655_resume, -#endif + .driver.pm = &vt6655_pm_ops, }; module_pci_driver(device_driver); -- 2.27.0