Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp240386imm; Tue, 12 Jun 2018 22:51:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIEJd0fFNuinarJdZcIyFj2kAXQVZinXjX8wAWm2q3ZI83tX1ZxUi+8O5OJCSEuI5AYTEnE X-Received: by 2002:a62:a30e:: with SMTP id s14-v6mr3531597pfe.168.1528869105961; Tue, 12 Jun 2018 22:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528869105; cv=none; d=google.com; s=arc-20160816; b=LmBRVFQqo1jSSYZc8c3dYZ+LKgQniLjR1f+0B0WhG2Y8PrCxzacW6tWee5IcaP/3y1 UbzlwRmJ3SEwNypBAKYtjI/rh5Z0ugNwivg5dRcke5JlLy+NQvKjcx+TJB571/i2ip0G 3iJuM2vXmJMc9F30vRIOLcJA3O6pSIVHAgCrQMqIlFvdpOEGvted1dW6bP5Ut+SYtbAj auRZ7dyK8zr6FuKe6sSK5jeXuM+tLNSzaeCHt7yJ6I1i/f6XpTz6M9cBEaIrASEnZ6eI dBK97vW+I/1QCX6lozHbm5QbXTIvr0T5D2ldhvO5vd4PA3GSd+TaE+uxl69pxofGgjHm Zw/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Wk4DSd4nSmR+PKFO3R/tIy7A4CkJrqJ/lwxPJZ/zmbA=; b=Ncw2m4kjswo5+s1BxIDzsgmD+k5Y/KppxQHi/l9wecLSEZVKdVCESC68YybHl8aM+I TIVfvmRw2Vmv4M1mXZZovOK/FuFZv15uducCln0mJ2dTCdvU2keXNM+9nOqm7sOG0rGa SVZT2yZagcqmTo51nMjXCVg1Mgc0S62bQRpO3m4sXCdkkkj0pwoOc8vijQ2dV8cH1b3f LI5pQrDyY+JKS3Qzx3ACYLdx809j7icOrA68ViMAxqfd33oApG83yK73ZDyKsPt0Qrj6 ImykJRM4VC5qonCR12oXzOVjIUr93AdvHSraefpPORBRk0p6WDPTIjm/SQuutlvmOPDU GUJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e191-v6si1662377pgc.332.2018.06.12.22.51.31; Tue, 12 Jun 2018 22:51:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754478AbeFMFvF (ORCPT + 99 others); Wed, 13 Jun 2018 01:51:05 -0400 Received: from mga07.intel.com ([134.134.136.100]:23228 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754447AbeFMFvE (ORCPT ); Wed, 13 Jun 2018 01:51:04 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2018 22:51:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,217,1526367600"; d="scan'208";a="236714707" Received: from ubuntu-kabylake-client-platform.sh.intel.com ([10.239.154.51]) by fmsmga005.fm.intel.com with ESMTP; 12 Jun 2018 22:51:02 -0700 From: Even Xu To: srinivas.pandruvada@linux.intel.com, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Even Xu , stable@vger.kernel.org Subject: [PATCH] hid: intel_ish-hid: ipc: register more pm callbacks to support hibernation Date: Fri, 12 Feb 2016 04:11:34 +0800 Message-Id: <1455221494-2915-1-git-send-email-even.xu@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current ISH driver only registers suspend/resume PM callbacks which don't support hibernation (suspend to disk). Basically after hiberation, the ISH can't resume properly and user may not see sensor events (for example: screen rotation may not work). User will not see a crash or panic or anything except the following message in log: hid-sensor-hub 001F:8086:22D8.0001: timeout waiting for response from ISHTP device So this patch adds support for S4/hiberbation to ISH by using the SIMPLE_DEV_PM_OPS() MACRO instead of struct dev_pm_ops directly. The suspend and resume functions will now be used for both suspend to RAM and hibernation. If power management is disabled, SIMPLE_DEV_PM_OPS will do nothing, the suspend and resume related functions won't be used, so mark them as __maybe_unused to clarify that this is the intended behavior, and remove #ifdefs for power management. Cc: stable@vger.kernel.org Signed-off-by: Even Xu Acked-by: Srinivas Pandruvada --- drivers/hid/intel-ish-hid/ipc/pci-ish.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index 582e449..a2c53ea 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c @@ -205,8 +205,7 @@ static void ish_remove(struct pci_dev *pdev) kfree(ishtp_dev); } -#ifdef CONFIG_PM -static struct device *ish_resume_device; +static struct device __maybe_unused *ish_resume_device; /* 50ms to get resume response */ #define WAIT_FOR_RESUME_ACK_MS 50 @@ -220,7 +219,7 @@ static struct device *ish_resume_device; * in that case a simple resume message is enough, others we need * a reset sequence. */ -static void ish_resume_handler(struct work_struct *work) +static void __maybe_unused ish_resume_handler(struct work_struct *work) { struct pci_dev *pdev = to_pci_dev(ish_resume_device); struct ishtp_device *dev = pci_get_drvdata(pdev); @@ -262,7 +261,7 @@ static void ish_resume_handler(struct work_struct *work) * * Return: 0 to the pm core */ -static int ish_suspend(struct device *device) +static int __maybe_unused ish_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct ishtp_device *dev = pci_get_drvdata(pdev); @@ -288,7 +287,7 @@ static int ish_suspend(struct device *device) return 0; } -static DECLARE_WORK(resume_work, ish_resume_handler); +static __maybe_unused DECLARE_WORK(resume_work, ish_resume_handler); /** * ish_resume() - ISH resume callback * @device: device pointer @@ -297,7 +296,7 @@ static DECLARE_WORK(resume_work, ish_resume_handler); * * Return: 0 to the pm core */ -static int ish_resume(struct device *device) +static int __maybe_unused ish_resume(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct ishtp_device *dev = pci_get_drvdata(pdev); @@ -311,21 +310,14 @@ static int ish_resume(struct device *device) return 0; } -static const struct dev_pm_ops ish_pm_ops = { - .suspend = ish_suspend, - .resume = ish_resume, -}; -#define ISHTP_ISH_PM_OPS (&ish_pm_ops) -#else -#define ISHTP_ISH_PM_OPS NULL -#endif /* CONFIG_PM */ +static SIMPLE_DEV_PM_OPS(ish_pm_ops, ish_suspend, ish_resume); static struct pci_driver ish_driver = { .name = KBUILD_MODNAME, .id_table = ish_pci_tbl, .probe = ish_probe, .remove = ish_remove, - .driver.pm = ISHTP_ISH_PM_OPS, + .driver.pm = &ish_pm_ops, }; module_pci_driver(ish_driver); -- 2.7.4