Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'pm-runtime' into pm-for-linus

* pm-runtime:
PM / Tracing: build rpm-traces.c only if CONFIG_PM_RUNTIME is set
PM / Runtime: Replace dev_dbg() with trace_rpm_*()
PM / Runtime: Introduce trace points for tracing rpm_* functions
PM / Runtime: Don't run callbacks under lock for power.irq_safe set
USB: Add wakeup info to debugging messages
PM / Runtime: pm_runtime_idle() can be called in atomic context
PM / Runtime: Add macro to test for runtime PM events
PM / Runtime: Add might_sleep() to runtime PM functions

+226 -66
+2
Documentation/power/runtime_pm.txt
··· 477 477 If pm_runtime_irq_safe() has been called for a device then the following helper 478 478 functions may also be used in interrupt context: 479 479 480 + pm_runtime_idle() 480 481 pm_runtime_suspend() 481 482 pm_runtime_autosuspend() 482 483 pm_runtime_resume() 483 484 pm_runtime_get_sync() 484 485 pm_runtime_put_sync() 485 486 pm_runtime_put_sync_suspend() 487 + pm_runtime_put_sync_autosuspend() 486 488 487 489 5. Runtime PM Initialization, Device Probing and Removal 488 490
+4 -4
Documentation/usb/power-management.txt
··· 439 439 device. 440 440 441 441 External suspend calls should never be allowed to fail in this way, 442 - only autosuspend calls. The driver can tell them apart by checking 443 - the PM_EVENT_AUTO bit in the message.event argument to the suspend 444 - method; this bit will be set for internal PM events (autosuspend) and 445 - clear for external PM events. 442 + only autosuspend calls. The driver can tell them apart by applying 443 + the PMSG_IS_AUTO() macro to the message argument to the suspend 444 + method; it will return True for internal PM events (autosuspend) and 445 + False for external PM events. 446 446 447 447 448 448 Mutual exclusion
+65 -29
drivers/base/power/runtime.c
··· 9 9 10 10 #include <linux/sched.h> 11 11 #include <linux/pm_runtime.h> 12 + #include <trace/events/rpm.h> 12 13 #include "power.h" 13 14 14 15 static int rpm_resume(struct device *dev, int rpmflags); ··· 156 155 } 157 156 158 157 /** 158 + * __rpm_callback - Run a given runtime PM callback for a given device. 159 + * @cb: Runtime PM callback to run. 160 + * @dev: Device to run the callback for. 161 + */ 162 + static int __rpm_callback(int (*cb)(struct device *), struct device *dev) 163 + __releases(&dev->power.lock) __acquires(&dev->power.lock) 164 + { 165 + int retval; 166 + 167 + if (dev->power.irq_safe) 168 + spin_unlock(&dev->power.lock); 169 + else 170 + spin_unlock_irq(&dev->power.lock); 171 + 172 + retval = cb(dev); 173 + 174 + if (dev->power.irq_safe) 175 + spin_lock(&dev->power.lock); 176 + else 177 + spin_lock_irq(&dev->power.lock); 178 + 179 + return retval; 180 + } 181 + 182 + /** 159 183 * rpm_idle - Notify device bus type if the device can be suspended. 160 184 * @dev: Device to notify the bus type about. 161 185 * @rpmflags: Flag bits. ··· 197 171 int (*callback)(struct device *); 198 172 int retval; 199 173 174 + trace_rpm_idle(dev, rpmflags); 200 175 retval = rpm_check_suspend_allowed(dev); 201 176 if (retval < 0) 202 177 ; /* Conditions are wrong. */ ··· 252 225 else 253 226 callback = NULL; 254 227 255 - if (callback) { 256 - if (dev->power.irq_safe) 257 - spin_unlock(&dev->power.lock); 258 - else 259 - spin_unlock_irq(&dev->power.lock); 260 - 261 - callback(dev); 262 - 263 - if (dev->power.irq_safe) 264 - spin_lock(&dev->power.lock); 265 - else 266 - spin_lock_irq(&dev->power.lock); 267 - } 228 + if (callback) 229 + __rpm_callback(callback, dev); 268 230 269 231 dev->power.idle_notification = false; 270 232 wake_up_all(&dev->power.wait_queue); 271 233 272 234 out: 235 + trace_rpm_return_int(dev, _THIS_IP_, retval); 273 236 return retval; 274 237 } 275 238 ··· 269 252 * @dev: Device to run the callback for. 270 253 */ 271 254 static int rpm_callback(int (*cb)(struct device *), struct device *dev) 272 - __releases(&dev->power.lock) __acquires(&dev->power.lock) 273 255 { 274 256 int retval; 275 257 276 258 if (!cb) 277 259 return -ENOSYS; 278 260 279 - if (dev->power.irq_safe) { 280 - retval = cb(dev); 281 - } else { 282 - spin_unlock_irq(&dev->power.lock); 261 + retval = __rpm_callback(cb, dev); 283 262 284 - retval = cb(dev); 285 - 286 - spin_lock_irq(&dev->power.lock); 287 - } 288 263 dev->power.runtime_error = retval; 289 264 return retval != -EACCES ? retval : -EIO; 290 265 } ··· 304 295 struct device *parent = NULL; 305 296 int retval; 306 297 307 - dev_dbg(dev, "%s flags 0x%x\n", __func__, rpmflags); 298 + trace_rpm_suspend(dev, rpmflags); 308 299 309 300 repeat: 310 301 retval = rpm_check_suspend_allowed(dev); ··· 354 345 if (rpmflags & (RPM_ASYNC | RPM_NOWAIT)) { 355 346 retval = -EINPROGRESS; 356 347 goto out; 348 + } 349 + 350 + if (dev->power.irq_safe) { 351 + spin_unlock(&dev->power.lock); 352 + 353 + cpu_relax(); 354 + 355 + spin_lock(&dev->power.lock); 356 + goto repeat; 357 357 } 358 358 359 359 /* Wait for the other suspend running in parallel with us. */ ··· 448 430 } 449 431 450 432 out: 451 - dev_dbg(dev, "%s returns %d\n", __func__, retval); 433 + trace_rpm_return_int(dev, _THIS_IP_, retval); 452 434 453 435 return retval; 454 436 } ··· 477 459 struct device *parent = NULL; 478 460 int retval = 0; 479 461 480 - dev_dbg(dev, "%s flags 0x%x\n", __func__, rpmflags); 462 + trace_rpm_resume(dev, rpmflags); 481 463 482 464 repeat: 483 465 if (dev->power.runtime_error) ··· 512 494 else 513 495 retval = -EINPROGRESS; 514 496 goto out; 497 + } 498 + 499 + if (dev->power.irq_safe) { 500 + spin_unlock(&dev->power.lock); 501 + 502 + cpu_relax(); 503 + 504 + spin_lock(&dev->power.lock); 505 + goto repeat; 515 506 } 516 507 517 508 /* Wait for the operation carried out in parallel with us. */ ··· 642 615 spin_lock_irq(&dev->power.lock); 643 616 } 644 617 645 - dev_dbg(dev, "%s returns %d\n", __func__, retval); 618 + trace_rpm_return_int(dev, _THIS_IP_, retval); 646 619 647 620 return retval; 648 621 } ··· 759 732 * return immediately if it is larger than zero. Then carry out an idle 760 733 * notification, either synchronous or asynchronous. 761 734 * 762 - * This routine may be called in atomic context if the RPM_ASYNC flag is set. 735 + * This routine may be called in atomic context if the RPM_ASYNC flag is set, 736 + * or if pm_runtime_irq_safe() has been called. 763 737 */ 764 738 int __pm_runtime_idle(struct device *dev, int rpmflags) 765 739 { 766 740 unsigned long flags; 767 741 int retval; 742 + 743 + might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); 768 744 769 745 if (rpmflags & RPM_GET_PUT) { 770 746 if (!atomic_dec_and_test(&dev->power.usage_count)) ··· 791 761 * return immediately if it is larger than zero. Then carry out a suspend, 792 762 * either synchronous or asynchronous. 793 763 * 794 - * This routine may be called in atomic context if the RPM_ASYNC flag is set. 764 + * This routine may be called in atomic context if the RPM_ASYNC flag is set, 765 + * or if pm_runtime_irq_safe() has been called. 795 766 */ 796 767 int __pm_runtime_suspend(struct device *dev, int rpmflags) 797 768 { 798 769 unsigned long flags; 799 770 int retval; 771 + 772 + might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); 800 773 801 774 if (rpmflags & RPM_GET_PUT) { 802 775 if (!atomic_dec_and_test(&dev->power.usage_count)) ··· 822 789 * If the RPM_GET_PUT flag is set, increment the device's usage count. Then 823 790 * carry out a resume, either synchronous or asynchronous. 824 791 * 825 - * This routine may be called in atomic context if the RPM_ASYNC flag is set. 792 + * This routine may be called in atomic context if the RPM_ASYNC flag is set, 793 + * or if pm_runtime_irq_safe() has been called. 826 794 */ 827 795 int __pm_runtime_resume(struct device *dev, int rpmflags) 828 796 { 829 797 unsigned long flags; 830 798 int retval; 799 + 800 + might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); 831 801 832 802 if (rpmflags & RPM_GET_PUT) 833 803 atomic_inc(&dev->power.usage_count);
+1 -1
drivers/bluetooth/btusb.c
··· 1116 1116 return 0; 1117 1117 1118 1118 spin_lock_irq(&data->txlock); 1119 - if (!((message.event & PM_EVENT_AUTO) && data->tx_in_flight)) { 1119 + if (!(PMSG_IS_AUTO(message) && data->tx_in_flight)) { 1120 1120 set_bit(BTUSB_SUSPENDING, &data->flags); 1121 1121 spin_unlock_irq(&data->txlock); 1122 1122 } else {
+1 -1
drivers/hid/hid-picolcd.c
··· 2409 2409 #ifdef CONFIG_PM 2410 2410 static int picolcd_suspend(struct hid_device *hdev, pm_message_t message) 2411 2411 { 2412 - if (message.event & PM_EVENT_AUTO) 2412 + if (PMSG_IS_AUTO(message)) 2413 2413 return 0; 2414 2414 2415 2415 picolcd_suspend_backlight(hid_get_drvdata(hdev));
+3 -4
drivers/hid/usbhid/hid-core.c
··· 1332 1332 struct usbhid_device *usbhid = hid->driver_data; 1333 1333 int status; 1334 1334 1335 - if (message.event & PM_EVENT_AUTO) { 1335 + if (PMSG_IS_AUTO(message)) { 1336 1336 spin_lock_irq(&usbhid->lock); /* Sync with error handler */ 1337 1337 if (!test_bit(HID_RESET_PENDING, &usbhid->iofl) 1338 1338 && !test_bit(HID_CLEAR_HALT, &usbhid->iofl) ··· 1367 1367 return -EIO; 1368 1368 } 1369 1369 1370 - if (!ignoreled && (message.event & PM_EVENT_AUTO)) { 1370 + if (!ignoreled && PMSG_IS_AUTO(message)) { 1371 1371 spin_lock_irq(&usbhid->lock); 1372 1372 if (test_bit(HID_LED_ON, &usbhid->iofl)) { 1373 1373 spin_unlock_irq(&usbhid->lock); ··· 1380 1380 hid_cancel_delayed_stuff(usbhid); 1381 1381 hid_cease_io(usbhid); 1382 1382 1383 - if ((message.event & PM_EVENT_AUTO) && 1384 - test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) { 1383 + if (PMSG_IS_AUTO(message) && test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) { 1385 1384 /* lost race against keypresses */ 1386 1385 status = hid_start_in(hid); 1387 1386 if (status < 0)
+1 -1
drivers/net/usb/usbnet.c
··· 1470 1470 if (!dev->suspend_count++) { 1471 1471 spin_lock_irq(&dev->txq.lock); 1472 1472 /* don't autosuspend while transmitting */ 1473 - if (dev->txq.qlen && (message.event & PM_EVENT_AUTO)) { 1473 + if (dev->txq.qlen && PMSG_IS_AUTO(message)) { 1474 1474 spin_unlock_irq(&dev->txq.lock); 1475 1475 return -EBUSY; 1476 1476 } else {
+2 -2
drivers/net/wimax/i2400m/usb.c
··· 599 599 * 600 600 * As well, the device might refuse going to sleep for whichever 601 601 * reason. In this case we just fail. For system suspend/hibernate, 602 - * we *can't* fail. We check PM_EVENT_AUTO to see if the 602 + * we *can't* fail. We check PMSG_IS_AUTO to see if the 603 603 * suspend call comes from the USB stack or from the system and act 604 604 * in consequence. 605 605 * ··· 615 615 struct i2400m *i2400m = &i2400mu->i2400m; 616 616 617 617 #ifdef CONFIG_PM 618 - if (pm_msg.event & PM_EVENT_AUTO) 618 + if (PMSG_IS_AUTO(pm_msg)) 619 619 is_autosuspend = 1; 620 620 #endif 621 621
+1 -1
drivers/usb/class/cdc-acm.c
··· 1305 1305 struct acm *acm = usb_get_intfdata(intf); 1306 1306 int cnt; 1307 1307 1308 - if (message.event & PM_EVENT_AUTO) { 1308 + if (PMSG_IS_AUTO(message)) { 1309 1309 int b; 1310 1310 1311 1311 spin_lock_irq(&acm->write_lock);
+3 -3
drivers/usb/class/cdc-wdm.c
··· 798 798 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); 799 799 800 800 /* if this is an autosuspend the caller does the locking */ 801 - if (!(message.event & PM_EVENT_AUTO)) 801 + if (!PMSG_IS_AUTO(message)) 802 802 mutex_lock(&desc->lock); 803 803 spin_lock_irq(&desc->iuspin); 804 804 805 - if ((message.event & PM_EVENT_AUTO) && 805 + if (PMSG_IS_AUTO(message) && 806 806 (test_bit(WDM_IN_USE, &desc->flags) 807 807 || test_bit(WDM_RESPONDING, &desc->flags))) { 808 808 spin_unlock_irq(&desc->iuspin); ··· 815 815 kill_urbs(desc); 816 816 cancel_work_sync(&desc->rxwork); 817 817 } 818 - if (!(message.event & PM_EVENT_AUTO)) 818 + if (!PMSG_IS_AUTO(message)) 819 819 mutex_unlock(&desc->lock); 820 820 821 821 return rv;
+4 -5
drivers/usb/core/driver.c
··· 1046 1046 /* Non-root devices on a full/low-speed bus must wait for their 1047 1047 * companion high-speed root hub, in case a handoff is needed. 1048 1048 */ 1049 - if (!(msg.event & PM_EVENT_AUTO) && udev->parent && 1050 - udev->bus->hs_companion) 1049 + if (!PMSG_IS_AUTO(msg) && udev->parent && udev->bus->hs_companion) 1051 1050 device_pm_wait_for_dev(&udev->dev, 1052 1051 &udev->bus->hs_companion->root_hub->dev); 1053 1052 ··· 1074 1075 1075 1076 if (driver->suspend) { 1076 1077 status = driver->suspend(intf, msg); 1077 - if (status && !(msg.event & PM_EVENT_AUTO)) 1078 + if (status && !PMSG_IS_AUTO(msg)) 1078 1079 dev_err(&intf->dev, "%s error %d\n", 1079 1080 "suspend", status); 1080 1081 } else { ··· 1188 1189 status = usb_suspend_interface(udev, intf, msg); 1189 1190 1190 1191 /* Ignore errors during system sleep transitions */ 1191 - if (!(msg.event & PM_EVENT_AUTO)) 1192 + if (!PMSG_IS_AUTO(msg)) 1192 1193 status = 0; 1193 1194 if (status != 0) 1194 1195 break; ··· 1198 1199 status = usb_suspend_device(udev, msg); 1199 1200 1200 1201 /* Again, ignore errors during system sleep transitions */ 1201 - if (!(msg.event & PM_EVENT_AUTO)) 1202 + if (!PMSG_IS_AUTO(msg)) 1202 1203 status = 0; 1203 1204 } 1204 1205
+5 -4
drivers/usb/core/hcd.c
··· 1961 1961 int status; 1962 1962 int old_state = hcd->state; 1963 1963 1964 - dev_dbg(&rhdev->dev, "bus %s%s\n", 1965 - (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "suspend"); 1964 + dev_dbg(&rhdev->dev, "bus %ssuspend, wakeup %d\n", 1965 + (PMSG_IS_AUTO(msg) ? "auto-" : ""), 1966 + rhdev->do_remote_wakeup); 1966 1967 if (HCD_DEAD(hcd)) { 1967 1968 dev_dbg(&rhdev->dev, "skipped %s of dead bus\n", "suspend"); 1968 1969 return 0; ··· 1998 1997 int status; 1999 1998 int old_state = hcd->state; 2000 1999 2001 - dev_dbg(&rhdev->dev, "usb %s%s\n", 2002 - (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); 2000 + dev_dbg(&rhdev->dev, "usb %sresume\n", 2001 + (PMSG_IS_AUTO(msg) ? "auto-" : "")); 2003 2002 if (HCD_DEAD(hcd)) { 2004 2003 dev_dbg(&rhdev->dev, "skipped %s of dead bus\n", "resume"); 2005 2004 return 0;
+7 -8
drivers/usb/core/hub.c
··· 2324 2324 int port1 = udev->portnum; 2325 2325 int status; 2326 2326 2327 - // dev_dbg(hub->intfdev, "suspend port %d\n", port1); 2328 - 2329 2327 /* enable remote wakeup when appropriate; this lets the device 2330 2328 * wake up the upstream hub (including maybe the root hub). 2331 2329 * ··· 2340 2342 dev_dbg(&udev->dev, "won't remote wakeup, status %d\n", 2341 2343 status); 2342 2344 /* bail if autosuspend is requested */ 2343 - if (msg.event & PM_EVENT_AUTO) 2345 + if (PMSG_IS_AUTO(msg)) 2344 2346 return status; 2345 2347 } 2346 2348 } ··· 2365 2367 USB_CTRL_SET_TIMEOUT); 2366 2368 2367 2369 /* System sleep transitions should never fail */ 2368 - if (!(msg.event & PM_EVENT_AUTO)) 2370 + if (!PMSG_IS_AUTO(msg)) 2369 2371 status = 0; 2370 2372 } else { 2371 2373 /* device has up to 10 msec to fully suspend */ 2372 - dev_dbg(&udev->dev, "usb %ssuspend\n", 2373 - (msg.event & PM_EVENT_AUTO ? "auto-" : "")); 2374 + dev_dbg(&udev->dev, "usb %ssuspend, wakeup %d\n", 2375 + (PMSG_IS_AUTO(msg) ? "auto-" : ""), 2376 + udev->do_remote_wakeup); 2374 2377 usb_set_device_state(udev, USB_STATE_SUSPENDED); 2375 2378 msleep(10); 2376 2379 } ··· 2522 2523 } else { 2523 2524 /* drive resume for at least 20 msec */ 2524 2525 dev_dbg(&udev->dev, "usb %sresume\n", 2525 - (msg.event & PM_EVENT_AUTO ? "auto-" : "")); 2526 + (PMSG_IS_AUTO(msg) ? "auto-" : "")); 2526 2527 msleep(25); 2527 2528 2528 2529 /* Virtual root hubs can trigger on GET_PORT_STATUS to ··· 2624 2625 udev = hdev->children [port1-1]; 2625 2626 if (udev && udev->can_submit) { 2626 2627 dev_warn(&intf->dev, "port %d nyet suspended\n", port1); 2627 - if (msg.event & PM_EVENT_AUTO) 2628 + if (PMSG_IS_AUTO(msg)) 2628 2629 return -EBUSY; 2629 2630 } 2630 2631 }
+1 -1
drivers/usb/serial/sierra.c
··· 1009 1009 struct sierra_intf_private *intfdata; 1010 1010 int b; 1011 1011 1012 - if (message.event & PM_EVENT_AUTO) { 1012 + if (PMSG_IS_AUTO(message)) { 1013 1013 intfdata = serial->private; 1014 1014 spin_lock_irq(&intfdata->susp_lock); 1015 1015 b = intfdata->in_flight;
+1 -1
drivers/usb/serial/usb_wwan.c
··· 651 651 652 652 dbg("%s entered", __func__); 653 653 654 - if (message.event & PM_EVENT_AUTO) { 654 + if (PMSG_IS_AUTO(message)) { 655 655 spin_lock_irq(&intfdata->susp_lock); 656 656 b = intfdata->in_flight; 657 657 spin_unlock_irq(&intfdata->susp_lock);
+2
include/linux/pm.h
··· 366 366 #define PMSG_AUTO_RESUME ((struct pm_message) \ 367 367 { .event = PM_EVENT_AUTO_RESUME, }) 368 368 369 + #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0) 370 + 369 371 /** 370 372 * Device run-time power management status. 371 373 *
+99
include/trace/events/rpm.h
··· 1 + 2 + #undef TRACE_SYSTEM 3 + #define TRACE_SYSTEM rpm 4 + 5 + #if !defined(_TRACE_RUNTIME_POWER_H) || defined(TRACE_HEADER_MULTI_READ) 6 + #define _TRACE_RUNTIME_POWER_H 7 + 8 + #include <linux/ktime.h> 9 + #include <linux/tracepoint.h> 10 + #include <linux/device.h> 11 + 12 + /* 13 + * The rpm_internal events are used for tracing some important 14 + * runtime pm internal functions. 15 + */ 16 + DECLARE_EVENT_CLASS(rpm_internal, 17 + 18 + TP_PROTO(struct device *dev, int flags), 19 + 20 + TP_ARGS(dev, flags), 21 + 22 + TP_STRUCT__entry( 23 + __string( name, dev_name(dev) ) 24 + __field( int, flags ) 25 + __field( int , usage_count ) 26 + __field( int , disable_depth ) 27 + __field( int , runtime_auto ) 28 + __field( int , request_pending ) 29 + __field( int , irq_safe ) 30 + __field( int , child_count ) 31 + ), 32 + 33 + TP_fast_assign( 34 + __assign_str(name, dev_name(dev)); 35 + __entry->flags = flags; 36 + __entry->usage_count = atomic_read( 37 + &dev->power.usage_count); 38 + __entry->disable_depth = dev->power.disable_depth; 39 + __entry->runtime_auto = dev->power.runtime_auto; 40 + __entry->request_pending = dev->power.request_pending; 41 + __entry->irq_safe = dev->power.irq_safe; 42 + __entry->child_count = atomic_read( 43 + &dev->power.child_count); 44 + ), 45 + 46 + TP_printk("%s flags-%x cnt-%-2d dep-%-2d auto-%-1d p-%-1d" 47 + " irq-%-1d child-%d", 48 + __get_str(name), __entry->flags, 49 + __entry->usage_count, 50 + __entry->disable_depth, 51 + __entry->runtime_auto, 52 + __entry->request_pending, 53 + __entry->irq_safe, 54 + __entry->child_count 55 + ) 56 + ); 57 + DEFINE_EVENT(rpm_internal, rpm_suspend, 58 + 59 + TP_PROTO(struct device *dev, int flags), 60 + 61 + TP_ARGS(dev, flags) 62 + ); 63 + DEFINE_EVENT(rpm_internal, rpm_resume, 64 + 65 + TP_PROTO(struct device *dev, int flags), 66 + 67 + TP_ARGS(dev, flags) 68 + ); 69 + DEFINE_EVENT(rpm_internal, rpm_idle, 70 + 71 + TP_PROTO(struct device *dev, int flags), 72 + 73 + TP_ARGS(dev, flags) 74 + ); 75 + 76 + TRACE_EVENT(rpm_return_int, 77 + TP_PROTO(struct device *dev, unsigned long ip, int ret), 78 + TP_ARGS(dev, ip, ret), 79 + 80 + TP_STRUCT__entry( 81 + __string( name, dev_name(dev)) 82 + __field( unsigned long, ip ) 83 + __field( int, ret ) 84 + ), 85 + 86 + TP_fast_assign( 87 + __assign_str(name, dev_name(dev)); 88 + __entry->ip = ip; 89 + __entry->ret = ret; 90 + ), 91 + 92 + TP_printk("%pS:%s ret=%d", (void *)__entry->ip, __get_str(name), 93 + __entry->ret) 94 + ); 95 + 96 + #endif /* _TRACE_RUNTIME_POWER_H */ 97 + 98 + /* This part must be outside protection */ 99 + #include <trace/define_trace.h>
+3
kernel/trace/Makefile
··· 53 53 obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o 54 54 obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o 55 55 obj-$(CONFIG_TRACEPOINTS) += power-traces.o 56 + ifeq ($(CONFIG_PM_RUNTIME),y) 57 + obj-$(CONFIG_TRACEPOINTS) += rpm-traces.o 58 + endif 56 59 ifeq ($(CONFIG_TRACING),y) 57 60 obj-$(CONFIG_KGDB_KDB) += trace_kdb.o 58 61 endif
+20
kernel/trace/rpm-traces.c
··· 1 + /* 2 + * Power trace points 3 + * 4 + * Copyright (C) 2009 Ming Lei <ming.lei@canonical.com> 5 + */ 6 + 7 + #include <linux/string.h> 8 + #include <linux/types.h> 9 + #include <linux/workqueue.h> 10 + #include <linux/sched.h> 11 + #include <linux/module.h> 12 + #include <linux/usb.h> 13 + 14 + #define CREATE_TRACE_POINTS 15 + #include <trace/events/rpm.h> 16 + 17 + EXPORT_TRACEPOINT_SYMBOL_GPL(rpm_return_int); 18 + EXPORT_TRACEPOINT_SYMBOL_GPL(rpm_idle); 19 + EXPORT_TRACEPOINT_SYMBOL_GPL(rpm_suspend); 20 + EXPORT_TRACEPOINT_SYMBOL_GPL(rpm_resume);
+1 -1
sound/usb/card.c
··· 631 631 if (chip == (void *)-1L) 632 632 return 0; 633 633 634 - if (!(message.event & PM_EVENT_AUTO)) { 634 + if (!PMSG_IS_AUTO(message)) { 635 635 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); 636 636 if (!chip->num_suspended_intf++) { 637 637 list_for_each(p, &chip->pcm_list) {