PM: Add sysfs attr for rechecking dev hash from PM trace
If the device which fails to resume is part of a loadable kernel module it won't be checked at startup against the magic number stored in the RTC. Add a read-only sysfs attribute /sys/power/pm_trace_dev_match which contains a list of newline separated devices (usually just the one) which currently match the last magic number. This allows the device which is failing to resume to be found after the modules are loaded again. Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
2ac21c6bc4
commit
d33ac60bea
@@ -207,6 +207,37 @@ static int show_dev_hash(unsigned int value)
|
||||
|
||||
static unsigned int hash_value_early_read;
|
||||
|
||||
int show_trace_dev_match(char *buf, size_t size)
|
||||
{
|
||||
unsigned int value = hash_value_early_read / (USERHASH * FILEHASH);
|
||||
int ret = 0;
|
||||
struct list_head *entry;
|
||||
|
||||
/*
|
||||
* It's possible that multiple devices will match the hash and we can't
|
||||
* tell which is the culprit, so it's best to output them all.
|
||||
*/
|
||||
device_pm_lock();
|
||||
entry = dpm_list.prev;
|
||||
while (size && entry != &dpm_list) {
|
||||
struct device *dev = to_device(entry);
|
||||
unsigned int hash = hash_string(DEVSEED, dev_name(dev),
|
||||
DEVHASH);
|
||||
if (hash == value) {
|
||||
int len = snprintf(buf, size, "%s\n",
|
||||
dev_driver_string(dev));
|
||||
if (len > size)
|
||||
len = size;
|
||||
buf += len;
|
||||
ret += len;
|
||||
size -= len;
|
||||
}
|
||||
entry = entry->prev;
|
||||
}
|
||||
device_pm_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int early_resume_init(void)
|
||||
{
|
||||
hash_value_early_read = read_magic_time();
|
||||
|
Reference in New Issue
Block a user