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

driver core: Rename flag AUTOREMOVE to AUTOREMOVE_CONSUMER

Now that we want to add another flag to autoremove the device link
on supplier unbind, it's fair to rename the existing flag from
DL_FLAG_AUTOREMOVE to DL_FLAG_AUTOREMOVE_CONSUMER so that we can
add similar flag for supplier later.
And, while we are touching device.h, fix a doc build warning.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Vivek Gautam and committed by
Rafael J. Wysocki
e88728f4 1e4b044d

+24 -21
+4 -4
Documentation/driver-api/device_link.rst
··· 81 81 Two other flags are specifically targeted at use cases where the device 82 82 link is added from the consumer's ``->probe`` callback: ``DL_FLAG_RPM_ACTIVE`` 83 83 can be specified to runtime resume the supplier upon addition of the 84 - device link. ``DL_FLAG_AUTOREMOVE`` causes the device link to be automatically 85 - purged when the consumer fails to probe or later unbinds. This obviates 86 - the need to explicitly delete the link in the ``->remove`` callback or in 87 - the error path of the ``->probe`` callback. 84 + device link. ``DL_FLAG_AUTOREMOVE_CONSUMER`` causes the device link to be 85 + automatically purged when the consumer fails to probe or later unbinds. 86 + This obviates the need to explicitly delete the link in the ``->remove`` 87 + callback or in the error path of the ``->probe`` callback. 88 88 89 89 Limitations 90 90 ===========
+8 -7
drivers/base/core.c
··· 178 178 * of the link. If DL_FLAG_PM_RUNTIME is not set, DL_FLAG_RPM_ACTIVE will be 179 179 * ignored. 180 180 * 181 - * If the DL_FLAG_AUTOREMOVE is set, the link will be removed automatically 182 - * when the consumer device driver unbinds from it. The combination of both 183 - * DL_FLAG_AUTOREMOVE and DL_FLAG_STATELESS set is invalid and will cause NULL 184 - * to be returned. 181 + * If the DL_FLAG_AUTOREMOVE_CONSUMER is set, the link will be removed 182 + * automatically when the consumer device driver unbinds from it. 183 + * The combination of both DL_FLAG_AUTOREMOVE_CONSUMER and DL_FLAG_STATELESS 184 + * set is invalid and will cause NULL to be returned. 185 185 * 186 186 * A side effect of the link creation is re-ordering of dpm_list and the 187 187 * devices_kset list by moving the consumer device and all devices depending ··· 198 198 struct device_link *link; 199 199 200 200 if (!consumer || !supplier || 201 - ((flags & DL_FLAG_STATELESS) && (flags & DL_FLAG_AUTOREMOVE))) 201 + ((flags & DL_FLAG_STATELESS) && 202 + (flags & DL_FLAG_AUTOREMOVE_CONSUMER))) 202 203 return NULL; 203 204 204 205 device_links_write_lock(); ··· 480 479 if (link->flags & DL_FLAG_STATELESS) 481 480 continue; 482 481 483 - if (link->flags & DL_FLAG_AUTOREMOVE) 482 + if (link->flags & DL_FLAG_AUTOREMOVE_CONSUMER) 484 483 kref_put(&link->kref, __device_link_del); 485 484 else if (link->status != DL_STATE_SUPPLIER_UNBIND) 486 485 WRITE_ONCE(link->status, DL_STATE_AVAILABLE); ··· 516 515 if (link->flags & DL_FLAG_STATELESS) 517 516 continue; 518 517 519 - WARN_ON(link->flags & DL_FLAG_AUTOREMOVE); 518 + WARN_ON(link->flags & DL_FLAG_AUTOREMOVE_CONSUMER); 520 519 WARN_ON(link->status != DL_STATE_SUPPLIER_UNBIND); 521 520 WRITE_ONCE(link->status, DL_STATE_DORMANT); 522 521 }
+1 -1
drivers/gpu/drm/tegra/dc.c
··· 2312 2312 * POWER_CONTROL registers during CRTC enabling. 2313 2313 */ 2314 2314 if (dc->soc->coupled_pm && dc->pipe == 1) { 2315 - u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE; 2315 + u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER; 2316 2316 struct device_link *link; 2317 2317 struct device *partner; 2318 2318
+2 -1
drivers/gpu/ipu-v3/ipu-pre.c
··· 128 128 list_for_each_entry(pre, &ipu_pre_list, list) { 129 129 if (pre_node == pre->dev->of_node) { 130 130 mutex_unlock(&ipu_pre_list_mutex); 131 - device_link_add(dev, pre->dev, DL_FLAG_AUTOREMOVE); 131 + device_link_add(dev, pre->dev, 132 + DL_FLAG_AUTOREMOVE_CONSUMER); 132 133 of_node_put(pre_node); 133 134 return pre; 134 135 }
+2 -1
drivers/gpu/ipu-v3/ipu-prg.c
··· 100 100 list_for_each_entry(prg, &ipu_prg_list, list) { 101 101 if (prg_node == prg->dev->of_node) { 102 102 mutex_unlock(&ipu_prg_list_mutex); 103 - device_link_add(dev, prg->dev, DL_FLAG_AUTOREMOVE); 103 + device_link_add(dev, prg->dev, 104 + DL_FLAG_AUTOREMOVE_CONSUMER); 104 105 prg->id = ipu_id; 105 106 of_node_put(prg_node); 106 107 return prg;
+1 -1
drivers/soc/imx/gpc.c
··· 202 202 goto genpd_err; 203 203 } 204 204 205 - device_link_add(dev, dev->parent, DL_FLAG_AUTOREMOVE); 205 + device_link_add(dev, dev->parent, DL_FLAG_AUTOREMOVE_CONSUMER); 206 206 207 207 return 0; 208 208
+6 -6
include/linux/device.h
··· 90 90 * @num_vf: Called to find out how many virtual functions a device on this 91 91 * bus supports. 92 92 * @dma_configure: Called to setup DMA configuration on a device on 93 - this bus. 93 + * this bus. 94 94 * @pm: Power management operations of this bus, callback the specific 95 95 * device driver's pm-ops. 96 96 * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU ··· 784 784 * Device link flags. 785 785 * 786 786 * STATELESS: The core won't track the presence of supplier/consumer drivers. 787 - * AUTOREMOVE: Remove this link automatically on consumer driver unbind. 787 + * AUTOREMOVE_CONSUMER: Remove the link automatically on consumer driver unbind. 788 788 * PM_RUNTIME: If set, the runtime PM framework will use this link. 789 789 * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. 790 790 */ 791 - #define DL_FLAG_STATELESS BIT(0) 792 - #define DL_FLAG_AUTOREMOVE BIT(1) 793 - #define DL_FLAG_PM_RUNTIME BIT(2) 794 - #define DL_FLAG_RPM_ACTIVE BIT(3) 791 + #define DL_FLAG_STATELESS BIT(0) 792 + #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) 793 + #define DL_FLAG_PM_RUNTIME BIT(2) 794 + #define DL_FLAG_RPM_ACTIVE BIT(3) 795 795 796 796 /** 797 797 * struct device_link - Device link representation.