Skip to content

Commit ebeaa36

Browse files
EvenxfJiri Kosina
authored andcommitted
HID: intel_ish-hid: ipc: register more pm callbacks to support hibernation
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: [email protected] Signed-off-by: Even Xu <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 4bff980 commit ebeaa36

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

drivers/hid/intel-ish-hid/ipc/pci-ish.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,7 @@ static void ish_remove(struct pci_dev *pdev)
205205
kfree(ishtp_dev);
206206
}
207207

208-
#ifdef CONFIG_PM
209-
static struct device *ish_resume_device;
208+
static struct device __maybe_unused *ish_resume_device;
210209

211210
/* 50ms to get resume response */
212211
#define WAIT_FOR_RESUME_ACK_MS 50
@@ -220,7 +219,7 @@ static struct device *ish_resume_device;
220219
* in that case a simple resume message is enough, others we need
221220
* a reset sequence.
222221
*/
223-
static void ish_resume_handler(struct work_struct *work)
222+
static void __maybe_unused ish_resume_handler(struct work_struct *work)
224223
{
225224
struct pci_dev *pdev = to_pci_dev(ish_resume_device);
226225
struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -262,7 +261,7 @@ static void ish_resume_handler(struct work_struct *work)
262261
*
263262
* Return: 0 to the pm core
264263
*/
265-
static int ish_suspend(struct device *device)
264+
static int __maybe_unused ish_suspend(struct device *device)
266265
{
267266
struct pci_dev *pdev = to_pci_dev(device);
268267
struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -288,7 +287,7 @@ static int ish_suspend(struct device *device)
288287
return 0;
289288
}
290289

291-
static DECLARE_WORK(resume_work, ish_resume_handler);
290+
static __maybe_unused DECLARE_WORK(resume_work, ish_resume_handler);
292291
/**
293292
* ish_resume() - ISH resume callback
294293
* @device: device pointer
@@ -297,7 +296,7 @@ static DECLARE_WORK(resume_work, ish_resume_handler);
297296
*
298297
* Return: 0 to the pm core
299298
*/
300-
static int ish_resume(struct device *device)
299+
static int __maybe_unused ish_resume(struct device *device)
301300
{
302301
struct pci_dev *pdev = to_pci_dev(device);
303302
struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -311,21 +310,14 @@ static int ish_resume(struct device *device)
311310
return 0;
312311
}
313312

314-
static const struct dev_pm_ops ish_pm_ops = {
315-
.suspend = ish_suspend,
316-
.resume = ish_resume,
317-
};
318-
#define ISHTP_ISH_PM_OPS (&ish_pm_ops)
319-
#else
320-
#define ISHTP_ISH_PM_OPS NULL
321-
#endif /* CONFIG_PM */
313+
static SIMPLE_DEV_PM_OPS(ish_pm_ops, ish_suspend, ish_resume);
322314

323315
static struct pci_driver ish_driver = {
324316
.name = KBUILD_MODNAME,
325317
.id_table = ish_pci_tbl,
326318
.probe = ish_probe,
327319
.remove = ish_remove,
328-
.driver.pm = ISHTP_ISH_PM_OPS,
320+
.driver.pm = &ish_pm_ops,
329321
};
330322

331323
module_pci_driver(ish_driver);

0 commit comments

Comments
 (0)