Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp761857ybt; Wed, 24 Jun 2020 10:32:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPbZ0LmviK9jE7z4bbDo5C2+JWoNvdvinmYwFFaLax8Sc50XdAxjRd7mqkCpF3bFjKVRGn X-Received: by 2002:a05:6402:1803:: with SMTP id g3mr7548256edy.377.1593019941411; Wed, 24 Jun 2020 10:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593019941; cv=none; d=google.com; s=arc-20160816; b=zbhNCa3GYXvw/Eur8k3wXh8bhEl4hx/uEf+oDFVJdLlRWwlhuHFoJm69w5f4JlrpfY Y2lxfikcISQO6gkvdjbwdvSEmLR/rYiss+f9iEy+iUut0U8J/IycQX8bmcLtOXyvYc7F 7Xdh0uXQKVrHRzoaqvEXH7Caort+5FJj6PyGLCakyt02nk/7KDLYxsu5RlD/ZQ1QUigv fLfcNx91AxSe2Fr9AZ6lIC7mtExMdg4ZBYPiNUkWSf05uMM0frQRQTXosMOcxrDdiI8z Q7KhTtzv5w28PwEheE3UOkk9O5XgRYjbG3BTlVg5psmCgCn4NMv8oNnWGSqFnm2pujY1 9r6g== 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=UL6+9R7vje0BZ0kQ5AFUpy2CeEkUyuEVadPnyq+JkCk=; b=KjdQZ8CGxrReooLmNUC4kzQGhGs8c3kdl/+aGMMvX1sYlcdPA2YhvcpPMpKjL27AUY YllmCrCLYCpsPTYTF8xU5gU2USEGPR6brNC1bMkcN6URj10n6wnD4o+U2aLX5djO+aa3 wTAwOqP+glJD4HP2a/ZnFOSv3l5BXC/y2YTGPPqKWBDXCktHSN+Yr0yNCiVKz6g0cQpa x9+5rAUpxivSOd0AvDTU2RUW9HI5O9zio7IPOojLeWJx7glqYZD6GSNHQ+Xyv+nIrNe0 2fRpLJnTrZyURNZstYI7lAYu9IoGu/bxHBgGgPeuJIRDC/3pFCqXc9bFRTjaFdsoanP2 uM/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UnLb42tQ; 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 c3si12777720edw.365.2020.06.24.10.31.57; Wed, 24 Jun 2020 10:32:21 -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=UnLb42tQ; 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 S2405576AbgFXRac (ORCPT + 99 others); Wed, 24 Jun 2020 13:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405412AbgFXRa1 (ORCPT ); Wed, 24 Jun 2020 13:30:27 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E42C061573; Wed, 24 Jun 2020 10:30:27 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id p3so1738028pgh.3; Wed, 24 Jun 2020 10:30:27 -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=UL6+9R7vje0BZ0kQ5AFUpy2CeEkUyuEVadPnyq+JkCk=; b=UnLb42tQPS9hg3JnXZozz25v4pvQoNS34zoJ56oVVYBz5nVC87FFf+Oi1z1AtOuUMZ cMfElNuuN4O4g0UTxzLVbpaW1GykIvKhAGguR6BaKiSRK0Rf83kO/QQywLDrboW0br8M oyFzrZ8nwauun68VrBVUyuLt2qj9bLUI1ivbYVxjXuVSoWYRIeqlFdiGKNfLWjX5kAXL qjofIkJIUOwwyb9MSiGOTA9wAgXJszozSZWzK0og6tWSRvfWFJi766qdcAMlTbaYq4Ef q7hZ/fxUWSXKGH0sAcKeL4jGARM9UDwBw8IHQLu6GxnrJVJv97WZPQnwhwdzjv09Rv+s lMww== 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=UL6+9R7vje0BZ0kQ5AFUpy2CeEkUyuEVadPnyq+JkCk=; b=jR2QEzhPmA+q34as1lxvEuwPqTxlMtMSrm2UI5HNA/TbVI32Pav31pApk7rEMswDN9 TKRUnP7VgBR71v7eInXadEtykPuKq67NQoIAftZzFXKbV3MIAzpo5Xj5TxCbZi0dbEtF u4LeKr7V0evpvpZ4+8dZe9h1GsRkJ0kG4X1bHYs3BMFhZncyeGytNpEjDyBOzipSUMw7 Ocr+cFS2w1nG0EwCqKeBDkR3amXboN4qicpyofK0U7UUKAeKksfaHT8zGNThx5EhH015 RX7juJI1egCMS09vtr0H4ukkhy0WzMlqn7DWqn7o3xaAjBaGYPFqmqhklZPAx2rqDisx 02Lg== X-Gm-Message-State: AOAM531hrIxedcqfkXDA1ED7Oz5eVToOiTzzWX+YWzsSopvwHlQJXo4W DucpZ6JDFkICbYCOvMemMhA= X-Received: by 2002:a65:6799:: with SMTP id e25mr17316445pgr.364.1593019826946; Wed, 24 Jun 2020 10:30:26 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id z11sm21187215pfk.141.2020.06.24.10.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 10:30:26 -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 v1 2/4] ide: triflex: use generic power management Date: Wed, 24 Jun 2020 22:58:55 +0530 Message-Id: <20200624172857.60915-3-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200624172857.60915-1-vaibhavgupta40@gmail.com> References: <20200624172857.60915-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 While upgrading ide_pci_suspend() and ide_pci_resume(), all other source files, using same callbacks, were also updated except drivers/ide/triflex.c. This is because the driver does not want to power off the device during suspend. A quirk was required for the same. This patch provides the fix. Another driver, drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c, makes use of a quirk for similar goal. Hence a similar quirk has been applied for triflex. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/ide/triflex.c | 45 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/drivers/ide/triflex.c b/drivers/ide/triflex.c index 1886bbfb9e5d..f707f11c296d 100644 --- a/drivers/ide/triflex.c +++ b/drivers/ide/triflex.c @@ -100,48 +100,25 @@ static const struct pci_device_id triflex_pci_tbl[] = { }; MODULE_DEVICE_TABLE(pci, triflex_pci_tbl); -#ifdef CONFIG_PM -static int triflex_ide_pci_suspend(struct pci_dev *dev, pm_message_t state) -{ - /* - * We must not disable or powerdown the device. - * APM bios refuses to suspend if IDE is not accessible. - */ - pci_save_state(dev); - return 0; -} - -static int triflex_ide_pci_resume(struct pci_dev *dev) +/* + * We must not disable or powerdown the device. + * APM bios refuses to suspend if IDE is not accessible. + */ +static void triflex_pci_pm_cap_fixup(struct pci_dev *pdev) { - 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; + dev_info(&pdev->dev, "Disable triflex to be turned off by PCI CORE\n"); + pdev->pm_cap = 0; } -#else -#define triflex_ide_pci_suspend NULL -#define triflex_ide_pci_resume NULL -#endif +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_COMPAQ, + PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE, + triflex_pci_pm_cap_fixup); static struct pci_driver triflex_pci_driver = { .name = "TRIFLEX_IDE", .id_table = triflex_pci_tbl, .probe = triflex_init_one, .remove = ide_pci_remove, - .suspend = triflex_ide_pci_suspend, - .resume = triflex_ide_pci_resume, + .driver.pm = &ide_pci_pm_ops, }; static int __init triflex_ide_init(void) -- 2.27.0