File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -580,7 +580,7 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
580
580
pr_debug ("bus: '%s': %s: matched device %s with driver %s\n" ,
581
581
drv -> bus -> name , __func__ , dev_name (dev ), drv -> name );
582
582
583
- pm_runtime_resume_suppliers (dev );
583
+ pm_runtime_get_suppliers (dev );
584
584
if (dev -> parent )
585
585
pm_runtime_get_sync (dev -> parent );
586
586
@@ -591,6 +591,7 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
591
591
if (dev -> parent )
592
592
pm_runtime_put (dev -> parent );
593
593
594
+ pm_runtime_put_suppliers (dev );
594
595
return ret ;
595
596
}
596
597
Original file line number Diff line number Diff line change @@ -1563,16 +1563,37 @@ void pm_runtime_clean_up_links(struct device *dev)
1563
1563
}
1564
1564
1565
1565
/**
1566
- * pm_runtime_resume_suppliers - Resume supplier devices.
1566
+ * pm_runtime_get_suppliers - Resume and reference-count supplier devices.
1567
1567
* @dev: Consumer device.
1568
1568
*/
1569
- void pm_runtime_resume_suppliers (struct device * dev )
1569
+ void pm_runtime_get_suppliers (struct device * dev )
1570
1570
{
1571
+ struct device_link * link ;
1571
1572
int idx ;
1572
1573
1573
1574
idx = device_links_read_lock ();
1574
1575
1575
- rpm_get_suppliers (dev );
1576
+ list_for_each_entry_rcu (link , & dev -> links .suppliers , c_node )
1577
+ if (link -> flags & DL_FLAG_PM_RUNTIME )
1578
+ pm_runtime_get_sync (link -> supplier );
1579
+
1580
+ device_links_read_unlock (idx );
1581
+ }
1582
+
1583
+ /**
1584
+ * pm_runtime_put_suppliers - Drop references to supplier devices.
1585
+ * @dev: Consumer device.
1586
+ */
1587
+ void pm_runtime_put_suppliers (struct device * dev )
1588
+ {
1589
+ struct device_link * link ;
1590
+ int idx ;
1591
+
1592
+ idx = device_links_read_lock ();
1593
+
1594
+ list_for_each_entry_rcu (link , & dev -> links .suppliers , c_node )
1595
+ if (link -> flags & DL_FLAG_PM_RUNTIME )
1596
+ pm_runtime_put (link -> supplier );
1576
1597
1577
1598
device_links_read_unlock (idx );
1578
1599
}
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ extern void pm_runtime_update_max_time_suspended(struct device *dev,
56
56
s64 delta_ns );
57
57
extern void pm_runtime_set_memalloc_noio (struct device * dev , bool enable );
58
58
extern void pm_runtime_clean_up_links (struct device * dev );
59
- extern void pm_runtime_resume_suppliers (struct device * dev );
59
+ extern void pm_runtime_get_suppliers (struct device * dev );
60
+ extern void pm_runtime_put_suppliers (struct device * dev );
60
61
extern void pm_runtime_new_link (struct device * dev );
61
62
extern void pm_runtime_drop_link (struct device * dev );
62
63
@@ -172,7 +173,8 @@ static inline unsigned long pm_runtime_autosuspend_expiration(
172
173
static inline void pm_runtime_set_memalloc_noio (struct device * dev ,
173
174
bool enable ){}
174
175
static inline void pm_runtime_clean_up_links (struct device * dev ) {}
175
- static inline void pm_runtime_resume_suppliers (struct device * dev ) {}
176
+ static inline void pm_runtime_get_suppliers (struct device * dev ) {}
177
+ static inline void pm_runtime_put_suppliers (struct device * dev ) {}
176
178
static inline void pm_runtime_new_link (struct device * dev ) {}
177
179
static inline void pm_runtime_drop_link (struct device * dev ) {}
178
180
You can’t perform that action at this time.
0 commit comments