diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/acpi/processor_core.c | 2 | ||||
| -rw-r--r-- | drivers/base/power/Makefile | 1 | ||||
| -rw-r--r-- | drivers/base/power/generic_ops.c | 233 | ||||
| -rw-r--r-- | drivers/gpu/drm/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/usb/core/devices.c | 69 | ||||
| -rw-r--r-- | drivers/virtio/virtio_pci.c | 1 |
6 files changed, 260 insertions, 47 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 9863c98c81ba..e9b7b402dbfb 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -123,6 +123,8 @@ static const struct file_operations acpi_processor_info_fops = { | |||
| 123 | #endif | 123 | #endif |
| 124 | 124 | ||
| 125 | DEFINE_PER_CPU(struct acpi_processor *, processors); | 125 | DEFINE_PER_CPU(struct acpi_processor *, processors); |
| 126 | EXPORT_PER_CPU_SYMBOL(processors); | ||
| 127 | |||
| 126 | struct acpi_processor_errata errata __read_mostly; | 128 | struct acpi_processor_errata errata __read_mostly; |
| 127 | 129 | ||
| 128 | /* -------------------------------------------------------------------------- | 130 | /* -------------------------------------------------------------------------- |
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile index 3ce3519e8f30..89de75325cea 100644 --- a/drivers/base/power/Makefile +++ b/drivers/base/power/Makefile | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | obj-$(CONFIG_PM) += sysfs.o | 1 | obj-$(CONFIG_PM) += sysfs.o |
| 2 | obj-$(CONFIG_PM_SLEEP) += main.o | 2 | obj-$(CONFIG_PM_SLEEP) += main.o |
| 3 | obj-$(CONFIG_PM_RUNTIME) += runtime.o | 3 | obj-$(CONFIG_PM_RUNTIME) += runtime.o |
| 4 | obj-$(CONFIG_PM_OPS) += generic_ops.o | ||
| 4 | obj-$(CONFIG_PM_TRACE_RTC) += trace.o | 5 | obj-$(CONFIG_PM_TRACE_RTC) += trace.o |
| 5 | 6 | ||
| 6 | ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG | 7 | ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG |
diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c new file mode 100644 index 000000000000..4b29d4981253 --- /dev/null +++ b/drivers/base/power/generic_ops.c | |||
| @@ -0,0 +1,233 @@ | |||
| 1 | /* | ||
| 2 | * drivers/base/power/generic_ops.c - Generic PM callbacks for subsystems | ||
| 3 | * | ||
| 4 | * Copyright (c) 2010 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | ||
| 5 | * | ||
| 6 | * This file is released under the GPLv2. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/pm.h> | ||
| 10 | #include <linux/pm_runtime.h> | ||
| 11 | |||
| 12 | #ifdef CONFIG_PM_RUNTIME | ||
| 13 | /** | ||
| 14 | * pm_generic_runtime_idle - Generic runtime idle callback for subsystems. | ||
| 15 | * @dev: Device to handle. | ||
| 16 | * | ||
| 17 | * If PM operations are defined for the @dev's driver and they include | ||
| 18 | * ->runtime_idle(), execute it and return its error code, if nonzero. | ||
| 19 | * Otherwise, execute pm_runtime_suspend() for the device and return 0. | ||
| 20 | */ | ||
| 21 | int pm_generic_runtime_idle(struct device *dev) | ||
| 22 | { | ||
| 23 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | ||
| 24 | |||
| 25 | if (pm && pm->runtime_idle) { | ||
| 26 | int ret = pm->runtime_idle(dev); | ||
| 27 | if (ret) | ||
| 28 | return ret; | ||
| 29 | } | ||
| 30 | |||
| 31 | pm_runtime_suspend(dev); | ||
| 32 | return 0; | ||
| 33 | } | ||
| 34 | EXPORT_SYMBOL_GPL(pm_generic_runtime_idle); | ||
| 35 | |||
| 36 | /** | ||
| 37 | * pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems. | ||
| 38 | * @dev: Device to suspend. | ||
| 39 | * | ||
| 40 | * If PM operations are defined for the @dev's driver and they include | ||
| 41 | * ->runtime_suspend(), execute it and return its error code. Otherwise, | ||
| 42 | * return -EINVAL. | ||
| 43 | */ | ||
| 44 | int pm_generic_runtime_suspend(struct device *dev) | ||
| 45 | { | ||
| 46 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | ||
| 47 | int ret; | ||
| 48 | |||
| 49 | ret = pm && pm->runtime_suspend ? pm->runtime_suspend(dev) : -EINVAL; | ||
| 50 | |||
| 51 | return ret; | ||
| 52 | } | ||
| 53 | EXPORT_SYMBOL_GPL(pm_generic_runtime_suspend); | ||
| 54 | |||
| 55 | /** | ||
| 56 | * pm_generic_runtime_resume - Generic runtime resume callback for subsystems. | ||
| 57 | * @dev: Device to resume. | ||
| 58 | * | ||
| 59 | * If PM operations are defined for the @dev's driver and they include | ||
| 60 | * ->runtime_resume(), execute it and return its error code. Otherwise, | ||
| 61 | * return -EINVAL. | ||
| 62 | */ | ||
| 63 | int pm_generic_runtime_resume(struct device *dev) | ||
| 64 | { | ||
| 65 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | ||
| 66 | int ret; | ||
| 67 | |||
| 68 | ret = pm && pm->runtime_resume ? pm->runtime_resume(dev) : -EINVAL; | ||
| 69 | |||
| 70 | return ret; | ||
| 71 | } | ||
| 72 | EXPORT_SYMBOL_GPL(pm_generic_runtime_resume); | ||
| 73 | #endif /* CONFIG_PM_RUNTIME */ | ||
| 74 | |||
| 75 | #ifdef CONFIG_PM_SLEEP | ||
| 76 | /** | ||
| 77 | * __pm_generic_call - Generic suspend/freeze/poweroff/thaw subsystem callback. | ||
| 78 | * @dev: Device to handle. | ||
| 79 | * @event: PM transition of the system under way. | ||
| 80 | * | ||
| 81 | * If the device has not been suspended at run time, execute the | ||
| 82 | * suspend/freeze/poweroff/thaw callback provided by its driver, if defined, and | ||
| 83 | * return its error code. Otherwise, return zero. | ||
| 84 | */ | ||
| 85 | static int __pm_generic_call(struct device *dev, int event) | ||
| 86 | { | ||
| 87 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | ||
| 88 | int (*callback)(struct device *); | ||
| 89 | |||
| 90 | if (!pm || pm_runtime_suspended(dev)) | ||
| 91 | return 0; | ||
| 92 | |||
| 93 | switch (event) { | ||
| 94 | case PM_EVENT_SUSPEND: | ||
| 95 | callback = pm->suspend; | ||
| 96 | break; | ||
| 97 | case PM_EVENT_FREEZE: | ||
| 98 | callback = pm->freeze; | ||
| 99 | break; | ||
| 100 | case PM_EVENT_HIBERNATE: | ||
| 101 | callback = pm->poweroff; | ||
| 102 | break; | ||
| 103 | case PM_EVENT_THAW: | ||
| 104 | callback = pm->thaw; | ||
| 105 | break; | ||
| 106 | default: | ||
| 107 | callback = NULL; | ||
| 108 | break; | ||
| 109 | } | ||
| 110 | |||
| 111 | return callback ? callback(dev) : 0; | ||
| 112 | } | ||
| 113 | |||
| 114 | /** | ||
| 115 | * pm_generic_suspend - Generic suspend callback for subsystems. | ||
| 116 | * @dev: Device to suspend. | ||
| 117 | */ | ||
| 118 | int pm_generic_suspend(struct device *dev) | ||
| 119 | { | ||
| 120 | return __pm_generic_call(dev, PM_EVENT_SUSPEND); | ||
| 121 | } | ||
| 122 | EXPORT_SYMBOL_GPL(pm_generic_suspend); | ||
| 123 | |||
| 124 | /** | ||
| 125 | * pm_generic_freeze - Generic freeze callback for subsystems. | ||
| 126 | * @dev: Device to freeze. | ||
| 127 | */ | ||
| 128 | int pm_generic_freeze(struct device *dev) | ||
| 129 | { | ||
| 130 | return __pm_generic_call(dev, PM_EVENT_FREEZE); | ||
| 131 | } | ||
| 132 | EXPORT_SYMBOL_GPL(pm_generic_freeze); | ||
| 133 | |||
| 134 | /** | ||
| 135 | * pm_generic_poweroff - Generic poweroff callback for subsystems. | ||
| 136 | * @dev: Device to handle. | ||
| 137 | */ | ||
| 138 | int pm_generic_poweroff(struct device *dev) | ||
| 139 | { | ||
| 140 | return __pm_generic_call(dev, PM_EVENT_HIBERNATE); | ||
| 141 | } | ||
| 142 | EXPORT_SYMBOL_GPL(pm_generic_poweroff); | ||
| 143 | |||
| 144 | /** | ||
| 145 | * pm_generic_thaw - Generic thaw callback for subsystems. | ||
| 146 | * @dev: Device to thaw. | ||
| 147 | */ | ||
| 148 | int pm_generic_thaw(struct device *dev) | ||
| 149 | { | ||
| 150 | return __pm_generic_call(dev, PM_EVENT_THAW); | ||
| 151 | } | ||
| 152 | EXPORT_SYMBOL_GPL(pm_generic_thaw); | ||
| 153 | |||
| 154 | /** | ||
| 155 | * __pm_generic_resume - Generic resume/restore callback for subsystems. | ||
| 156 | * @dev: Device to handle. | ||
| 157 | * @event: PM transition of the system under way. | ||
| 158 | * | ||
| 159 | * Execute the resume/resotre callback provided by the @dev's driver, if | ||
| 160 | * defined. If it returns 0, change the device's runtime PM status to 'active'. | ||
| 161 | * Return the callback's error code. | ||
| 162 | */ | ||
| 163 | static int __pm_generic_resume(struct device *dev, int event) | ||
| 164 | { | ||
| 165 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | ||
| 166 | int (*callback)(struct device *); | ||
| 167 | int ret; | ||
| 168 | |||
| 169 | if (!pm) | ||
| 170 | return 0; | ||
| 171 | |||
| 172 | switch (event) { | ||
| 173 | case PM_EVENT_RESUME: | ||
| 174 | callback = pm->resume; | ||
| 175 | break; | ||
| 176 | case PM_EVENT_RESTORE: | ||
| 177 | callback = pm->restore; | ||
| 178 | break; | ||
| 179 | default: | ||
| 180 | callback = NULL; | ||
| 181 | break; | ||
| 182 | } | ||
| 183 | |||
| 184 | if (!callback) | ||
| 185 | return 0; | ||
| 186 | |||
| 187 | ret = callback(dev); | ||
| 188 | if (!ret) { | ||
| 189 | pm_runtime_disable(dev); | ||
| 190 | pm_runtime_set_active(dev); | ||
| 191 | pm_runtime_enable(dev); | ||
| 192 | } | ||
| 193 | |||
| 194 | return ret; | ||
| 195 | } | ||
| 196 | |||
| 197 | /** | ||
| 198 | * pm_generic_resume - Generic resume callback for subsystems. | ||
| 199 | * @dev: Device to resume. | ||
| 200 | */ | ||
| 201 | int pm_generic_resume(struct device *dev) | ||
| 202 | { | ||
| 203 | return __pm_generic_resume(dev, PM_EVENT_RESUME); | ||
| 204 | } | ||
| 205 | EXPORT_SYMBOL_GPL(pm_generic_resume); | ||
| 206 | |||
| 207 | /** | ||
| 208 | * pm_generic_restore - Generic restore callback for subsystems. | ||
| 209 | * @dev: Device to restore. | ||
| 210 | */ | ||
| 211 | int pm_generic_restore(struct device *dev) | ||
| 212 | { | ||
| 213 | return __pm_generic_resume(dev, PM_EVENT_RESTORE); | ||
| 214 | } | ||
| 215 | EXPORT_SYMBOL_GPL(pm_generic_restore); | ||
| 216 | #endif /* CONFIG_PM_SLEEP */ | ||
| 217 | |||
| 218 | struct dev_pm_ops generic_subsys_pm_ops = { | ||
| 219 | #ifdef CONFIG_PM_SLEEP | ||
| 220 | .suspend = pm_generic_suspend, | ||
| 221 | .resume = pm_generic_resume, | ||
| 222 | .freeze = pm_generic_freeze, | ||
| 223 | .thaw = pm_generic_thaw, | ||
| 224 | .poweroff = pm_generic_poweroff, | ||
| 225 | .restore = pm_generic_restore, | ||
| 226 | #endif | ||
| 227 | #ifdef CONFIG_PM_RUNTIME | ||
| 228 | .runtime_suspend = pm_generic_runtime_suspend, | ||
| 229 | .runtime_resume = pm_generic_runtime_resume, | ||
| 230 | .runtime_idle = pm_generic_runtime_idle, | ||
| 231 | #endif | ||
| 232 | }; | ||
| 233 | EXPORT_SYMBOL_GPL(generic_subsys_pm_ops); | ||
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 3d2ab03f1296..305c59003963 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
| @@ -9,7 +9,6 @@ menuconfig DRM | |||
| 9 | depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG && MMU | 9 | depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG && MMU |
| 10 | select I2C | 10 | select I2C |
| 11 | select I2C_ALGOBIT | 11 | select I2C_ALGOBIT |
| 12 | select LIST_SORT | ||
| 13 | help | 12 | help |
| 14 | Kernel-level support for the Direct Rendering Infrastructure (DRI) | 13 | Kernel-level support for the Direct Rendering Infrastructure (DRI) |
| 15 | introduced in XFree86 4.0. If you say Y here, you need to select | 14 | introduced in XFree86 4.0. If you say Y here, you need to select |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index c83c975152a6..d41811bfef2a 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
| @@ -117,13 +117,20 @@ static const char *format_endpt = | |||
| 117 | * However, these will come from functions that return ptrs to each of them. | 117 | * However, these will come from functions that return ptrs to each of them. |
| 118 | */ | 118 | */ |
| 119 | 119 | ||
| 120 | static DECLARE_WAIT_QUEUE_HEAD(deviceconndiscwq); | 120 | /* |
| 121 | /* guarded by usbfs_mutex */ | 121 | * Wait for an connect/disconnect event to happen. We initialize |
| 122 | static unsigned int conndiscevcnt; | 122 | * the event counter with an odd number, and each event will increment |
| 123 | 123 | * the event counter by two, so it will always _stay_ odd. That means | |
| 124 | /* this struct stores the poll state for <mountpoint>/devices pollers */ | 124 | * that it will never be zero, so "event 0" will never match a current |
| 125 | struct usb_device_status { | 125 | * event, and thus 'poll' will always trigger as readable for the first |
| 126 | unsigned int lastev; | 126 | * time it gets called. |
| 127 | */ | ||
| 128 | static struct device_connect_event { | ||
| 129 | atomic_t count; | ||
| 130 | wait_queue_head_t wait; | ||
| 131 | } device_event = { | ||
| 132 | .count = ATOMIC_INIT(1), | ||
| 133 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER(device_event.wait) | ||
| 127 | }; | 134 | }; |
| 128 | 135 | ||
| 129 | struct class_info { | 136 | struct class_info { |
| @@ -157,10 +164,8 @@ static const struct class_info clas_info[] = | |||
| 157 | 164 | ||
| 158 | void usbfs_conn_disc_event(void) | 165 | void usbfs_conn_disc_event(void) |
| 159 | { | 166 | { |
| 160 | mutex_lock(&usbfs_mutex); | 167 | atomic_add(2, &device_event.count); |
| 161 | conndiscevcnt++; | 168 | wake_up(&device_event.wait); |
| 162 | mutex_unlock(&usbfs_mutex); | ||
| 163 | wake_up(&deviceconndiscwq); | ||
| 164 | } | 169 | } |
| 165 | 170 | ||
| 166 | static const char *class_decode(const int class) | 171 | static const char *class_decode(const int class) |
| @@ -632,42 +637,16 @@ static ssize_t usb_device_read(struct file *file, char __user *buf, | |||
| 632 | static unsigned int usb_device_poll(struct file *file, | 637 | static unsigned int usb_device_poll(struct file *file, |
| 633 | struct poll_table_struct *wait) | 638 | struct poll_table_struct *wait) |
| 634 | { | 639 | { |
| 635 | struct usb_device_status *st; | 640 | unsigned int event_count; |
| 636 | unsigned int mask = 0; | ||
| 637 | |||
| 638 | mutex_lock(&usbfs_mutex); | ||
| 639 | st = file->private_data; | ||
| 640 | if (!st) { | ||
| 641 | st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL); | ||
| 642 | if (!st) { | ||
| 643 | mutex_unlock(&usbfs_mutex); | ||
| 644 | return POLLIN; | ||
| 645 | } | ||
| 646 | |||
| 647 | st->lastev = conndiscevcnt; | ||
| 648 | file->private_data = st; | ||
| 649 | mask = POLLIN; | ||
| 650 | } | ||
| 651 | 641 | ||
| 652 | if (file->f_mode & FMODE_READ) | 642 | poll_wait(file, &device_event.wait, wait); |
| 653 | poll_wait(file, &deviceconndiscwq, wait); | ||
| 654 | if (st->lastev != conndiscevcnt) | ||
| 655 | mask |= POLLIN; | ||
| 656 | st->lastev = conndiscevcnt; | ||
| 657 | mutex_unlock(&usbfs_mutex); | ||
| 658 | return mask; | ||
| 659 | } | ||
| 660 | 643 | ||
| 661 | static int usb_device_open(struct inode *inode, struct file *file) | 644 | event_count = atomic_read(&device_event.count); |
| 662 | { | 645 | if (file->f_version != event_count) { |
| 663 | file->private_data = NULL; | 646 | file->f_version = event_count; |
| 664 | return 0; | 647 | return POLLIN | POLLRDNORM; |
| 665 | } | 648 | } |
| 666 | 649 | ||
| 667 | static int usb_device_release(struct inode *inode, struct file *file) | ||
| 668 | { | ||
| 669 | kfree(file->private_data); | ||
| 670 | file->private_data = NULL; | ||
| 671 | return 0; | 650 | return 0; |
| 672 | } | 651 | } |
| 673 | 652 | ||
| @@ -699,6 +678,4 @@ const struct file_operations usbfs_devices_fops = { | |||
| 699 | .llseek = usb_device_lseek, | 678 | .llseek = usb_device_lseek, |
| 700 | .read = usb_device_read, | 679 | .read = usb_device_read, |
| 701 | .poll = usb_device_poll, | 680 | .poll = usb_device_poll, |
| 702 | .open = usb_device_open, | ||
| 703 | .release = usb_device_release, | ||
| 704 | }; | 681 | }; |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 1b6573216998..625447f645d9 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
| @@ -649,6 +649,7 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, | |||
| 649 | goto out_req_regions; | 649 | goto out_req_regions; |
| 650 | 650 | ||
| 651 | pci_set_drvdata(pci_dev, vp_dev); | 651 | pci_set_drvdata(pci_dev, vp_dev); |
| 652 | pci_set_master(pci_dev); | ||
| 652 | 653 | ||
| 653 | /* we use the subsystem vendor/device id as the virtio vendor/device | 654 | /* we use the subsystem vendor/device id as the virtio vendor/device |
| 654 | * id. this allows us to use the same PCI vendor/device id for all | 655 | * id. this allows us to use the same PCI vendor/device id for all |
