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>
This commit is contained in:
Vivek Gautam 2018-06-27 18:20:55 +05:30 committed by Rafael J. Wysocki
parent 1e4b044d22
commit e88728f46c
7 changed files with 24 additions and 21 deletions

View File

@ -81,10 +81,10 @@ integration is desired.
Two other flags are specifically targeted at use cases where the device Two other flags are specifically targeted at use cases where the device
link is added from the consumer's ``->probe`` callback: ``DL_FLAG_RPM_ACTIVE`` link is added from the consumer's ``->probe`` callback: ``DL_FLAG_RPM_ACTIVE``
can be specified to runtime resume the supplier upon addition of the can be specified to runtime resume the supplier upon addition of the
device link. ``DL_FLAG_AUTOREMOVE`` causes the device link to be automatically device link. ``DL_FLAG_AUTOREMOVE_CONSUMER`` causes the device link to be
purged when the consumer fails to probe or later unbinds. This obviates automatically purged when the consumer fails to probe or later unbinds.
the need to explicitly delete the link in the ``->remove`` callback or in This obviates the need to explicitly delete the link in the ``->remove``
the error path of the ``->probe`` callback. callback or in the error path of the ``->probe`` callback.
Limitations Limitations
=========== ===========

View File

@ -178,10 +178,10 @@ void device_pm_move_to_tail(struct device *dev)
* of the link. If DL_FLAG_PM_RUNTIME is not set, DL_FLAG_RPM_ACTIVE will be * of the link. If DL_FLAG_PM_RUNTIME is not set, DL_FLAG_RPM_ACTIVE will be
* ignored. * ignored.
* *
* If the DL_FLAG_AUTOREMOVE is set, the link will be removed automatically * If the DL_FLAG_AUTOREMOVE_CONSUMER is set, the link will be removed
* when the consumer device driver unbinds from it. The combination of both * automatically when the consumer device driver unbinds from it.
* DL_FLAG_AUTOREMOVE and DL_FLAG_STATELESS set is invalid and will cause NULL * The combination of both DL_FLAG_AUTOREMOVE_CONSUMER and DL_FLAG_STATELESS
* to be returned. * set is invalid and will cause NULL to be returned.
* *
* A side effect of the link creation is re-ordering of dpm_list and the * 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 * devices_kset list by moving the consumer device and all devices depending
@ -198,7 +198,8 @@ struct device_link *device_link_add(struct device *consumer,
struct device_link *link; struct device_link *link;
if (!consumer || !supplier || if (!consumer || !supplier ||
((flags & DL_FLAG_STATELESS) && (flags & DL_FLAG_AUTOREMOVE))) ((flags & DL_FLAG_STATELESS) &&
(flags & DL_FLAG_AUTOREMOVE_CONSUMER)))
return NULL; return NULL;
device_links_write_lock(); device_links_write_lock();
@ -479,7 +480,7 @@ static void __device_links_no_driver(struct device *dev)
if (link->flags & DL_FLAG_STATELESS) if (link->flags & DL_FLAG_STATELESS)
continue; continue;
if (link->flags & DL_FLAG_AUTOREMOVE) if (link->flags & DL_FLAG_AUTOREMOVE_CONSUMER)
kref_put(&link->kref, __device_link_del); kref_put(&link->kref, __device_link_del);
else if (link->status != DL_STATE_SUPPLIER_UNBIND) else if (link->status != DL_STATE_SUPPLIER_UNBIND)
WRITE_ONCE(link->status, DL_STATE_AVAILABLE); WRITE_ONCE(link->status, DL_STATE_AVAILABLE);
@ -515,7 +516,7 @@ void device_links_driver_cleanup(struct device *dev)
if (link->flags & DL_FLAG_STATELESS) if (link->flags & DL_FLAG_STATELESS)
continue; continue;
WARN_ON(link->flags & DL_FLAG_AUTOREMOVE); WARN_ON(link->flags & DL_FLAG_AUTOREMOVE_CONSUMER);
WARN_ON(link->status != DL_STATE_SUPPLIER_UNBIND); WARN_ON(link->status != DL_STATE_SUPPLIER_UNBIND);
WRITE_ONCE(link->status, DL_STATE_DORMANT); WRITE_ONCE(link->status, DL_STATE_DORMANT);
} }

View File

@ -2312,7 +2312,7 @@ static int tegra_dc_couple(struct tegra_dc *dc)
* POWER_CONTROL registers during CRTC enabling. * POWER_CONTROL registers during CRTC enabling.
*/ */
if (dc->soc->coupled_pm && dc->pipe == 1) { if (dc->soc->coupled_pm && dc->pipe == 1) {
u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE; u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER;
struct device_link *link; struct device_link *link;
struct device *partner; struct device *partner;

View File

@ -128,7 +128,8 @@ ipu_pre_lookup_by_phandle(struct device *dev, const char *name, int index)
list_for_each_entry(pre, &ipu_pre_list, list) { list_for_each_entry(pre, &ipu_pre_list, list) {
if (pre_node == pre->dev->of_node) { if (pre_node == pre->dev->of_node) {
mutex_unlock(&ipu_pre_list_mutex); mutex_unlock(&ipu_pre_list_mutex);
device_link_add(dev, pre->dev, DL_FLAG_AUTOREMOVE); device_link_add(dev, pre->dev,
DL_FLAG_AUTOREMOVE_CONSUMER);
of_node_put(pre_node); of_node_put(pre_node);
return pre; return pre;
} }

View File

@ -100,7 +100,8 @@ ipu_prg_lookup_by_phandle(struct device *dev, const char *name, int ipu_id)
list_for_each_entry(prg, &ipu_prg_list, list) { list_for_each_entry(prg, &ipu_prg_list, list) {
if (prg_node == prg->dev->of_node) { if (prg_node == prg->dev->of_node) {
mutex_unlock(&ipu_prg_list_mutex); mutex_unlock(&ipu_prg_list_mutex);
device_link_add(dev, prg->dev, DL_FLAG_AUTOREMOVE); device_link_add(dev, prg->dev,
DL_FLAG_AUTOREMOVE_CONSUMER);
prg->id = ipu_id; prg->id = ipu_id;
of_node_put(prg_node); of_node_put(prg_node);
return prg; return prg;

View File

@ -202,7 +202,7 @@ static int imx_pgc_power_domain_probe(struct platform_device *pdev)
goto genpd_err; goto genpd_err;
} }
device_link_add(dev, dev->parent, DL_FLAG_AUTOREMOVE); device_link_add(dev, dev->parent, DL_FLAG_AUTOREMOVE_CONSUMER);
return 0; return 0;

View File

@ -90,7 +90,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
* @num_vf: Called to find out how many virtual functions a device on this * @num_vf: Called to find out how many virtual functions a device on this
* bus supports. * bus supports.
* @dma_configure: Called to setup DMA configuration on a device on * @dma_configure: Called to setup DMA configuration on a device on
this bus. * this bus.
* @pm: Power management operations of this bus, callback the specific * @pm: Power management operations of this bus, callback the specific
* device driver's pm-ops. * device driver's pm-ops.
* @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU
@ -784,14 +784,14 @@ enum device_link_state {
* Device link flags. * Device link flags.
* *
* STATELESS: The core won't track the presence of supplier/consumer drivers. * STATELESS: The core won't track the presence of supplier/consumer drivers.
* AUTOREMOVE: Remove this link automatically on consumer driver unbind. * AUTOREMOVE_CONSUMER: Remove the link automatically on consumer driver unbind.
* PM_RUNTIME: If set, the runtime PM framework will use this link. * PM_RUNTIME: If set, the runtime PM framework will use this link.
* RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation.
*/ */
#define DL_FLAG_STATELESS BIT(0) #define DL_FLAG_STATELESS BIT(0)
#define DL_FLAG_AUTOREMOVE BIT(1) #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1)
#define DL_FLAG_PM_RUNTIME BIT(2) #define DL_FLAG_PM_RUNTIME BIT(2)
#define DL_FLAG_RPM_ACTIVE BIT(3) #define DL_FLAG_RPM_ACTIVE BIT(3)
/** /**
* struct device_link - Device link representation. * struct device_link - Device link representation.