/* RETURNS: Pointer to removed devres on success, NULL if not found.  */
void* devres_remove(struct device *dev, dr_release_t release, dr_match_t match, void *match_data)
/* RETURNS: Pointer to removed devres on success, NULL if not found.  */
void* devres_remove(struct device *dev, dr_release_t release, dr_match_t match, void *match_data)
{
	struct devres *dr;
	unsigned long flags;
	spin_lock_irqsave(&dev->devres_lock, flags);
	dr = find_dr(dev, release, match, match_data);
	if (dr) {
		list_del_init(&dr->node.entry);
		devres_log(dev, &dr->node, "REM");
	}
	spin_unlock_irqrestore(&dev->devres_lock, flags);
	if (dr)
		return dr->data;
	return NULL;
}