Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2127428ybt; Fri, 3 Jul 2020 01:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP7Gty99GZksAC1nkAqD9ioHhcBM46DBEoXm5Dew3xbGHroLLKlSxBTJninwLM9GGOYgsr X-Received: by 2002:a17:906:7212:: with SMTP id m18mr30968829ejk.29.1593764238714; Fri, 03 Jul 2020 01:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593764238; cv=none; d=google.com; s=arc-20160816; b=LTji+REnuqRsOfBmSnZnrCaRFZq1c3kL9wPwgdRrn1oXVYjoT+DvC+u1976xEN3Km6 PoY2Zss74GwE+85gzaGAkUVMuZBlf6z31czctmxwrDAgq0ndY/MEaZJOtvM5GElcoG9J mEuBcI7LEPVuZPbrYEFctHiO0QPk2MP99QE3Doo4cDKDbYBZdP8IfSrs2MwF1+DdHlV4 dyHOveCgvoJKfM0aOZm0+Cen2XocR40quxrkgP3CV4hormK4M+E3qGpalblhjnDn7Zq5 rrknmN0PNv+l07SbLBHUTOnPRkPuU35lsHVONKNSz/6wMzFPDax0fYTGpubkzRhJmEEJ balA== 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=hwN0F35HmIOsVk83Ru+LekhIDnqVhFDuAY3kTnBlsJKm/TEIKHnUpK8+dnvW/sc0sl 80r9E9nfpl5+/gaYqVbyN7ntIVXW7wCiuyyFRmx/VyMQH3kiI37qR1+Qh6060CprM62y wnr0ZFVLAxtxJw6XuB4hprlOYiGO+fOtBxOZvfI/6KOksmjlx5K4LVMioF/ASDdjGm3j 0CtJnBhBcHta9e+ELsZi9FAUBLJJex/IyLRmML1sMDekFgKH4g/vxgJaWEWgwHfVIXnA mMxG90aiA+XFbXlF7s1hrqETU+5//7XLRZkNQvGuzHAW5KzI3hs5VGcvEy1gno9+2Eb6 puFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vOZfyO1W; 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 do11si9786841ejc.450.2020.07.03.01.16.55; Fri, 03 Jul 2020 01:17:18 -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=vOZfyO1W; 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 S1726442AbgGCIQ3 (ORCPT + 99 others); Fri, 3 Jul 2020 04:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbgGCIQ0 (ORCPT ); Fri, 3 Jul 2020 04:16:26 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E04A1C08C5C1; Fri, 3 Jul 2020 01:16:26 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id cv18so7008186pjb.1; Fri, 03 Jul 2020 01:16:26 -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=vOZfyO1WAiqg1QRdEXq/qgxvjuqJQJ8oI+Utf7kPwIa5AM7PJSKzNIYSMJoDIHwMoZ 3uhc7vHe40p6dR9jWlhIihLnO+DYHoitu0wUyIRF3RdQpiusqkNPquq0R1kUJPdvjt0d +ny24UoUbQ9nwdTTVOG0nydNfKkc+Qc28np4jtbXR3y0ys4w9W/cV4ZNElhzvvm3NBvM 8YBdd3CXWT1Ku19EzSwZ+a/yfKkDbfUa5IvC4FvapLKjvs4CxBhNkYCmD+gOy3jh/gbP venVCiqqsRgim1m7sDshGUAMhpbiGIvyh7cWk2tvpHeIp9gKAZekuf3ccZQmPYsHto2e LY/g== 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=akDOlEpnr681n4gVd9a2Pt8wJCGNhLq5cTANggn4lQlzetpBSYv6MImYG+so2YDl8x lwJ8dK+x5ssQYbacnJL1VyFWlCgBuYxwRXlIGUXCAxporu9xLyhz7PAbrFwuBtKrZ7J0 hxvY3UTJUE933JOCGecXgIBQGv5hY0kxL0MokDo6xH6EuiH4nUzu0aZWTsyqWE+/m1fZ i0vGmIagoyrMuc5GcCHwNI7Gs5UQAFZ395iROS/GHkbm6u8qdgzXf5UrxPokGmAW+JZb k0lN2uv2l4RxFnV49//nbRCExF0OvJ7dmByg+OLvxreMt/0BowsSixZuE7XF3t3WSREs mgfA== X-Gm-Message-State: AOAM531QepnQHcAUfc0rklZhlD28TgAEh1zHMMFKTPnlXi2Q1D7/0Q4N KlzRl5XLBGjzKRx572cP2sA= X-Received: by 2002:a17:90b:194f:: with SMTP id nk15mr22777711pjb.189.1593764186406; Fri, 03 Jul 2020 01:16:26 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id y198sm8437085pfg.116.2020.07.03.01.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 01:16: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 v2 2/4] ide: triflex: use generic power management Date: Fri, 3 Jul 2020 13:44:26 +0530 Message-Id: <20200703081428.1011527-3-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200703081428.1011527-1-vaibhavgupta40@gmail.com> References: <20200703081428.1011527-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