|
|
@@ -77,8 +77,8 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
*
|
|
|
* A side effect of the link creation is re-ordering of dpm_list and the
|
|
|
* devices_kset list by moving the consumer device and all devices depending
|
|
|
-@@ -182,7 +182,8 @@ struct device_link *device_link_add(stru
|
|
|
- struct device_link *link;
|
|
|
+@@ -183,7 +183,8 @@ struct device_link *device_link_add(stru
|
|
|
+ bool rpm_put_supplier = false;
|
|
|
|
|
|
if (!consumer || !supplier ||
|
|
|
- ((flags & DL_FLAG_STATELESS) && (flags & DL_FLAG_AUTOREMOVE)))
|
|
|
@@ -86,8 +86,8 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
+ (flags & DL_FLAG_AUTOREMOVE_CONSUMER)))
|
|
|
return NULL;
|
|
|
|
|
|
- device_links_write_lock();
|
|
|
-@@ -200,8 +201,10 @@ struct device_link *device_link_add(stru
|
|
|
+ if (flags & DL_FLAG_PM_RUNTIME && flags & DL_FLAG_RPM_ACTIVE) {
|
|
|
+@@ -209,8 +210,10 @@ struct device_link *device_link_add(stru
|
|
|
}
|
|
|
|
|
|
list_for_each_entry(link, &supplier->links.consumers, s_node)
|
|
|
@@ -99,7 +99,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
|
|
|
link = kzalloc(sizeof(*link), GFP_KERNEL);
|
|
|
if (!link)
|
|
|
-@@ -233,6 +236,7 @@ struct device_link *device_link_add(stru
|
|
|
+@@ -237,6 +240,7 @@ struct device_link *device_link_add(stru
|
|
|
link->consumer = consumer;
|
|
|
INIT_LIST_HEAD(&link->c_node);
|
|
|
link->flags = flags;
|
|
|
@@ -107,7 +107,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
|
|
|
/* Determine the initial link state. */
|
|
|
if (flags & DL_FLAG_STATELESS) {
|
|
|
-@@ -303,8 +307,10 @@ static void __device_link_free_srcu(stru
|
|
|
+@@ -311,8 +315,10 @@ static void __device_link_free_srcu(stru
|
|
|
device_link_free(container_of(rhead, struct device_link, rcu_head));
|
|
|
}
|
|
|
|
|
|
@@ -119,7 +119,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
dev_info(link->consumer, "Dropping the link to %s\n",
|
|
|
dev_name(link->supplier));
|
|
|
|
|
|
-@@ -316,8 +322,10 @@ static void __device_link_del(struct dev
|
|
|
+@@ -324,8 +330,10 @@ static void __device_link_del(struct dev
|
|
|
call_srcu(&device_links_srcu, &link->rcu_head, __device_link_free_srcu);
|
|
|
}
|
|
|
#else /* !CONFIG_SRCU */
|
|
|
@@ -131,7 +131,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
dev_info(link->consumer, "Dropping the link to %s\n",
|
|
|
dev_name(link->supplier));
|
|
|
|
|
|
-@@ -335,18 +343,50 @@ static void __device_link_del(struct dev
|
|
|
+@@ -343,18 +351,50 @@ static void __device_link_del(struct dev
|
|
|
* @link: Device link to delete.
|
|
|
*
|
|
|
* The caller must ensure proper synchronization of this function with runtime
|
|
|
@@ -184,7 +184,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
static void device_links_missing_supplier(struct device *dev)
|
|
|
{
|
|
|
struct device_link *link;
|
|
|
-@@ -454,8 +494,8 @@ static void __device_links_no_driver(str
|
|
|
+@@ -462,8 +502,8 @@ static void __device_links_no_driver(str
|
|
|
if (link->flags & DL_FLAG_STATELESS)
|
|
|
continue;
|
|
|
|
|
|
@@ -195,7 +195,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
else if (link->status != DL_STATE_SUPPLIER_UNBIND)
|
|
|
WRITE_ONCE(link->status, DL_STATE_AVAILABLE);
|
|
|
}
|
|
|
-@@ -490,8 +530,18 @@ void device_links_driver_cleanup(struct
|
|
|
+@@ -498,8 +538,18 @@ void device_links_driver_cleanup(struct
|
|
|
if (link->flags & DL_FLAG_STATELESS)
|
|
|
continue;
|
|
|
|
|
|
@@ -215,7 +215,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
WRITE_ONCE(link->status, DL_STATE_DORMANT);
|
|
|
}
|
|
|
|
|
|
-@@ -608,13 +658,13 @@ static void device_links_purge(struct de
|
|
|
+@@ -616,13 +666,13 @@ static void device_links_purge(struct de
|
|
|
|
|
|
list_for_each_entry_safe_reverse(link, ln, &dev->links.suppliers, c_node) {
|
|
|
WARN_ON(link->status == DL_STATE_ACTIVE);
|
|
|
@@ -231,7 +231,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
}
|
|
|
|
|
|
device_links_write_unlock();
|
|
|
-@@ -1036,6 +1086,34 @@ static ssize_t online_store(struct devic
|
|
|
+@@ -1044,6 +1094,34 @@ static ssize_t online_store(struct devic
|
|
|
}
|
|
|
static DEVICE_ATTR_RW(online);
|
|
|
|
|
|
@@ -266,7 +266,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
int device_add_groups(struct device *dev, const struct attribute_group **groups)
|
|
|
{
|
|
|
return sysfs_create_groups(&dev->kobj, groups);
|
|
|
-@@ -1207,8 +1285,20 @@ static int device_add_attrs(struct devic
|
|
|
+@@ -1215,8 +1293,20 @@ static int device_add_attrs(struct devic
|
|
|
goto err_remove_dev_groups;
|
|
|
}
|
|
|
|
|
|
@@ -287,7 +287,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
err_remove_dev_groups:
|
|
|
device_remove_groups(dev, dev->groups);
|
|
|
err_remove_type_groups:
|
|
|
-@@ -1226,6 +1316,8 @@ static void device_remove_attrs(struct d
|
|
|
+@@ -1234,6 +1324,8 @@ static void device_remove_attrs(struct d
|
|
|
struct class *class = dev->class;
|
|
|
const struct device_type *type = dev->type;
|
|
|
|
|
|
@@ -462,7 +462,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
|
|
|
extern int __must_check bus_create_file(struct bus_type *,
|
|
|
struct bus_attribute *);
|
|
|
-@@ -750,14 +752,16 @@ enum device_link_state {
|
|
|
+@@ -751,14 +753,16 @@ enum device_link_state {
|
|
|
* Device link flags.
|
|
|
*
|
|
|
* STATELESS: The core won't track the presence of supplier/consumer drivers.
|
|
|
@@ -484,7 +484,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
|
|
|
/**
|
|
|
* struct device_link - Device link representation.
|
|
|
-@@ -768,6 +772,7 @@ enum device_link_state {
|
|
|
+@@ -769,6 +773,7 @@ enum device_link_state {
|
|
|
* @status: The state of the link (with respect to the presence of drivers).
|
|
|
* @flags: Link flags.
|
|
|
* @rpm_active: Whether or not the consumer device is runtime-PM-active.
|
|
|
@@ -492,7 +492,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
* @rcu_head: An RCU head to use for deferred execution of SRCU callbacks.
|
|
|
*/
|
|
|
struct device_link {
|
|
|
-@@ -778,6 +783,7 @@ struct device_link {
|
|
|
+@@ -779,6 +784,7 @@ struct device_link {
|
|
|
enum device_link_state status;
|
|
|
u32 flags;
|
|
|
bool rpm_active;
|
|
|
@@ -500,7 +500,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
#ifdef CONFIG_SRCU
|
|
|
struct rcu_head rcu_head;
|
|
|
#endif
|
|
|
-@@ -850,6 +856,8 @@ struct dev_links_info {
|
|
|
+@@ -851,6 +857,8 @@ struct dev_links_info {
|
|
|
* @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
|
|
|
* hardware supports 64-bit addresses for consistent allocations
|
|
|
* such descriptors.
|
|
|
@@ -509,7 +509,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
* @dma_pfn_offset: offset of DMA memory range relatively of RAM
|
|
|
* @dma_parms: A low level driver may set these to teach IOMMU code about
|
|
|
* segment limitations.
|
|
|
-@@ -929,6 +937,7 @@ struct device {
|
|
|
+@@ -930,6 +938,7 @@ struct device {
|
|
|
not all hardware supports
|
|
|
64 bit addresses for consistent
|
|
|
allocations such descriptors. */
|
|
|
@@ -517,7 +517,7 @@ Signed-off-by: Yangbo Lu <[email protected]>
|
|
|
unsigned long dma_pfn_offset;
|
|
|
|
|
|
struct device_dma_parameters *dma_parms;
|
|
|
-@@ -1267,6 +1276,7 @@ extern const char *dev_driver_string(con
|
|
|
+@@ -1268,6 +1277,7 @@ extern const char *dev_driver_string(con
|
|
|
struct device_link *device_link_add(struct device *consumer,
|
|
|
struct device *supplier, u32 flags);
|
|
|
void device_link_del(struct device_link *link);
|