diff options
author | Stefan Weinhuber <wein@de.ibm.com> | 2009-06-16 04:30:38 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-16 04:31:15 -0400 |
commit | 9f62fa1618987e9fadb2eef86d35ef168ddf5a1f (patch) | |
tree | 34f269f035be00fc0c96c61339e199e22972c2bd /drivers/s390 | |
parent | b241f7bcc603babd3de903fa855d418ee7c4751d (diff) |
[S390] pm: vmlogrdr power management callbacks
Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/vmlogrdr.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index d8a2289fcb69..e925808c2149 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * character device driver for reading z/VM system service records | 3 | * character device driver for reading z/VM system service records |
4 | * | 4 | * |
5 | * | 5 | * |
6 | * Copyright 2004 IBM Corporation | 6 | * Copyright IBM Corp. 2004, 2009 |
7 | * character device driver for reading z/VM system service records, | 7 | * character device driver for reading z/VM system service records, |
8 | * Version 1.0 | 8 | * Version 1.0 |
9 | * Author(s): Xenia Tkatschow <xenia@us.ibm.com> | 9 | * Author(s): Xenia Tkatschow <xenia@us.ibm.com> |
@@ -660,6 +660,29 @@ static struct attribute *vmlogrdr_attrs[] = { | |||
660 | NULL, | 660 | NULL, |
661 | }; | 661 | }; |
662 | 662 | ||
663 | static int vmlogrdr_pm_prepare(struct device *dev) | ||
664 | { | ||
665 | int rc; | ||
666 | struct vmlogrdr_priv_t *priv = dev->driver_data; | ||
667 | |||
668 | rc = 0; | ||
669 | if (priv) { | ||
670 | spin_lock_bh(&priv->priv_lock); | ||
671 | if (priv->dev_in_use) | ||
672 | rc = -EBUSY; | ||
673 | spin_unlock_bh(&priv->priv_lock); | ||
674 | } | ||
675 | if (rc) | ||
676 | pr_err("vmlogrdr: device %s is busy. Refuse to suspend.\n", | ||
677 | dev_name(dev)); | ||
678 | return rc; | ||
679 | } | ||
680 | |||
681 | |||
682 | static struct dev_pm_ops vmlogrdr_pm_ops = { | ||
683 | .prepare = vmlogrdr_pm_prepare, | ||
684 | }; | ||
685 | |||
663 | static struct attribute_group vmlogrdr_attr_group = { | 686 | static struct attribute_group vmlogrdr_attr_group = { |
664 | .attrs = vmlogrdr_attrs, | 687 | .attrs = vmlogrdr_attrs, |
665 | }; | 688 | }; |
@@ -668,6 +691,7 @@ static struct class *vmlogrdr_class; | |||
668 | static struct device_driver vmlogrdr_driver = { | 691 | static struct device_driver vmlogrdr_driver = { |
669 | .name = "vmlogrdr", | 692 | .name = "vmlogrdr", |
670 | .bus = &iucv_bus, | 693 | .bus = &iucv_bus, |
694 | .pm = &vmlogrdr_pm_ops, | ||
671 | }; | 695 | }; |
672 | 696 | ||
673 | 697 | ||
@@ -729,6 +753,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
729 | dev->bus = &iucv_bus; | 753 | dev->bus = &iucv_bus; |
730 | dev->parent = iucv_root; | 754 | dev->parent = iucv_root; |
731 | dev->driver = &vmlogrdr_driver; | 755 | dev->driver = &vmlogrdr_driver; |
756 | dev->driver_data = priv; | ||
732 | /* | 757 | /* |
733 | * The release function could be called after the | 758 | * The release function could be called after the |
734 | * module has been unloaded. It's _only_ task is to | 759 | * module has been unloaded. It's _only_ task is to |