core.c (287905e68dd29873bcb7986a8290cd1e4cfde600) | core.c (da6d647598a6d182eb6a0344a7b14ae005244399) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * drivers/base/core.c - core driver model code (device registration, etc) 4 * 5 * Copyright (c) 2002-3 Patrick Mochel 6 * Copyright (c) 2002-3 Open Source Development Labs 7 * Copyright (c) 2006 Greg Kroah-Hartman <gregkh@suse.de> 8 * Copyright (c) 2006 Novell, Inc. --- 1027 unchanged lines hidden (view full) --- 1036 1037static void device_link_drop_managed(struct device_link *link) 1038{ 1039 link->flags &= ~DL_FLAG_MANAGED; 1040 WRITE_ONCE(link->status, DL_STATE_NONE); 1041 kref_put(&link->kref, __device_link_del); 1042} 1043 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * drivers/base/core.c - core driver model code (device registration, etc) 4 * 5 * Copyright (c) 2002-3 Patrick Mochel 6 * Copyright (c) 2002-3 Open Source Development Labs 7 * Copyright (c) 2006 Greg Kroah-Hartman <gregkh@suse.de> 8 * Copyright (c) 2006 Novell, Inc. --- 1027 unchanged lines hidden (view full) --- 1036 1037static void device_link_drop_managed(struct device_link *link) 1038{ 1039 link->flags &= ~DL_FLAG_MANAGED; 1040 WRITE_ONCE(link->status, DL_STATE_NONE); 1041 kref_put(&link->kref, __device_link_del); 1042} 1043 |
1044static ssize_t waiting_for_supplier_show(struct device *dev, 1045 struct device_attribute *attr, 1046 char *buf) 1047{ 1048 bool val; 1049 1050 device_lock(dev); 1051 mutex_lock(&wfs_lock); 1052 val = !list_empty(&dev->links.needs_suppliers) 1053 && dev->links.need_for_probe; 1054 mutex_unlock(&wfs_lock); 1055 device_unlock(dev); 1056 return sprintf(buf, "%u\n", val); 1057} 1058static DEVICE_ATTR_RO(waiting_for_supplier); 1059 |
|
1044/** 1045 * device_links_driver_bound - Update device links after probing its driver. 1046 * @dev: Device to update the links for. 1047 * 1048 * The probe has been successful, so update links from this device to any 1049 * consumers by changing their status to "available". 1050 * 1051 * Also change the status of @dev's links to suppliers to "active". --- 8 unchanged lines hidden (view full) --- 1060 /* 1061 * If a device probes successfully, it's expected to have created all 1062 * the device links it needs to or make new device links as it needs 1063 * them. So, it no longer needs to wait on any suppliers. 1064 */ 1065 mutex_lock(&wfs_lock); 1066 list_del_init(&dev->links.needs_suppliers); 1067 mutex_unlock(&wfs_lock); | 1060/** 1061 * device_links_driver_bound - Update device links after probing its driver. 1062 * @dev: Device to update the links for. 1063 * 1064 * The probe has been successful, so update links from this device to any 1065 * consumers by changing their status to "available". 1066 * 1067 * Also change the status of @dev's links to suppliers to "active". --- 8 unchanged lines hidden (view full) --- 1076 /* 1077 * If a device probes successfully, it's expected to have created all 1078 * the device links it needs to or make new device links as it needs 1079 * them. So, it no longer needs to wait on any suppliers. 1080 */ 1081 mutex_lock(&wfs_lock); 1082 list_del_init(&dev->links.needs_suppliers); 1083 mutex_unlock(&wfs_lock); |
1084 device_remove_file(dev, &dev_attr_waiting_for_supplier); |
|
1068 1069 device_links_write_lock(); 1070 1071 list_for_each_entry(link, &dev->links.consumers, s_node) { 1072 if (!(link->flags & DL_FLAG_MANAGED)) 1073 continue; 1074 1075 /* --- 1063 unchanged lines hidden (view full) --- 2139 goto err_remove_type_groups; 2140 2141 if (device_supports_offline(dev) && !dev->offline_disabled) { 2142 error = device_create_file(dev, &dev_attr_online); 2143 if (error) 2144 goto err_remove_dev_groups; 2145 } 2146 | 1085 1086 device_links_write_lock(); 1087 1088 list_for_each_entry(link, &dev->links.consumers, s_node) { 1089 if (!(link->flags & DL_FLAG_MANAGED)) 1090 continue; 1091 1092 /* --- 1063 unchanged lines hidden (view full) --- 2156 goto err_remove_type_groups; 2157 2158 if (device_supports_offline(dev) && !dev->offline_disabled) { 2159 error = device_create_file(dev, &dev_attr_online); 2160 if (error) 2161 goto err_remove_dev_groups; 2162 } 2163 |
2164 if (fw_devlink_flags && !fw_devlink_is_permissive()) { 2165 error = device_create_file(dev, &dev_attr_waiting_for_supplier); 2166 if (error) 2167 goto err_remove_dev_online; 2168 } 2169 |
|
2147 return 0; 2148 | 2170 return 0; 2171 |
2172 err_remove_dev_online: 2173 device_remove_file(dev, &dev_attr_online); |
|
2149 err_remove_dev_groups: 2150 device_remove_groups(dev, dev->groups); 2151 err_remove_type_groups: 2152 if (type) 2153 device_remove_groups(dev, type->groups); 2154 err_remove_class_groups: 2155 if (class) 2156 device_remove_groups(dev, class->dev_groups); 2157 2158 return error; 2159} 2160 2161static void device_remove_attrs(struct device *dev) 2162{ 2163 struct class *class = dev->class; 2164 const struct device_type *type = dev->type; 2165 | 2174 err_remove_dev_groups: 2175 device_remove_groups(dev, dev->groups); 2176 err_remove_type_groups: 2177 if (type) 2178 device_remove_groups(dev, type->groups); 2179 err_remove_class_groups: 2180 if (class) 2181 device_remove_groups(dev, class->dev_groups); 2182 2183 return error; 2184} 2185 2186static void device_remove_attrs(struct device *dev) 2187{ 2188 struct class *class = dev->class; 2189 const struct device_type *type = dev->type; 2190 |
2191 device_remove_file(dev, &dev_attr_waiting_for_supplier); |
|
2166 device_remove_file(dev, &dev_attr_online); 2167 device_remove_groups(dev, dev->groups); 2168 2169 if (type) 2170 device_remove_groups(dev, type->groups); 2171 2172 if (class) 2173 device_remove_groups(dev, class->dev_groups); --- 2082 unchanged lines hidden --- | 2192 device_remove_file(dev, &dev_attr_online); 2193 device_remove_groups(dev, dev->groups); 2194 2195 if (type) 2196 device_remove_groups(dev, type->groups); 2197 2198 if (class) 2199 device_remove_groups(dev, class->dev_groups); --- 2082 unchanged lines hidden --- |