--- drivers/base/power/suspend.c | 2 +- drivers/base/power/sysfs.c | 30 ++++++++++++++++++++++++++++++ include/linux/device.h | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) --- gregkh-2.6.orig/drivers/base/power/suspend.c +++ gregkh-2.6/drivers/base/power/suspend.c @@ -78,7 +78,7 @@ int suspend_device(struct device * dev, suspend_report_result(dev->class->suspend, error); } - if (!error && dev->bus && dev->bus->suspend && !dev->power.power_state.event) { + if (!error && !dev->no_suspend && dev->bus && dev->bus->suspend && !dev->power.power_state.event) { dev_dbg(dev, "%s%s\n", suspend_verb(state.event), ((state.event == PM_EVENT_SUSPEND) --- gregkh-2.6.orig/drivers/base/power/sysfs.c +++ gregkh-2.6/drivers/base/power/sysfs.c @@ -141,12 +141,42 @@ wake_store(struct device * dev, struct d static DEVICE_ATTR(wakeup, 0644, wake_show, wake_store); +static ssize_t can_suspend_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%s\n", dev->no_suspend ? "no" : "yes"); +} + +static ssize_t can_suspend_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t n) +{ + if (!n) + return -EINVAL; + + switch (buf[0]) { + case 'y': + case 'Y': + case '1': + dev->no_suspend = 0; + break; + case 'n': + case 'N': + case '0': + dev->no_suspend = 1; + break; + } + + return n; +} +static DEVICE_ATTR(can_suspend, 0644, can_suspend_show, can_suspend_store); static struct attribute * power_attrs[] = { #ifdef CONFIG_PM_SYSFS_DEPRECATED &dev_attr_state.attr, #endif &dev_attr_wakeup.attr, + &dev_attr_can_suspend.attr, NULL, }; static struct attribute_group pm_attr_group = { --- gregkh-2.6.orig/include/linux/device.h +++ gregkh-2.6/include/linux/device.h @@ -402,6 +402,7 @@ struct device { char bus_id[BUS_ID_SIZE]; /* position on parent bus */ struct device_type *type; unsigned is_registered:1; + unsigned no_suspend:1; struct device_attribute uevent_attr; struct device_attribute *devt_attr;