diff options
| author | Takashi Iwai <tiwai@suse.de> | 2010-04-16 15:20:06 +0200 | 
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2010-04-16 15:20:06 +0200 | 
| commit | cf0dbba515415bb19b11f9323d5f7bebd7f24fd6 (patch) | |
| tree | 375bbc1ade1a92acd6493d224dd701fd7f209014 /kernel/resource.c | |
| parent | 1cff399ecd9125d8e6a634a1957be1aeb3195a12 (diff) | |
| parent | 0340c7dccd80d8706c636e030a6ebbddbddca690 (diff) | |
Merge remote branch 'alsa/devel' into topic/misc
Diffstat (limited to 'kernel/resource.c')
| -rw-r--r-- | kernel/resource.c | 44 | 
1 files changed, 37 insertions, 7 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 2d5be5d9bf5f..9c358e263534 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -219,19 +219,34 @@ void release_child_resources(struct resource *r)  }  /** - * request_resource - request and reserve an I/O or memory resource + * request_resource_conflict - request and reserve an I/O or memory resource   * @root: root resource descriptor   * @new: resource descriptor desired by caller   * - * Returns 0 for success, negative error code on error. + * Returns 0 for success, conflict resource on error.   */ -int request_resource(struct resource *root, struct resource *new) +struct resource *request_resource_conflict(struct resource *root, struct resource *new)  {  	struct resource *conflict;  	write_lock(&resource_lock);  	conflict = __request_resource(root, new);  	write_unlock(&resource_lock); +	return conflict; +} + +/** + * request_resource - request and reserve an I/O or memory resource + * @root: root resource descriptor + * @new: resource descriptor desired by caller + * + * Returns 0 for success, negative error code on error. + */ +int request_resource(struct resource *root, struct resource *new) +{ +	struct resource *conflict; + +	conflict = request_resource_conflict(root, new);  	return conflict ? -EBUSY : 0;  } @@ -474,25 +489,40 @@ static struct resource * __insert_resource(struct resource *parent, struct resou  }  /** - * insert_resource - Inserts a resource in the resource tree + * insert_resource_conflict - Inserts resource in the resource tree   * @parent: parent of the new resource   * @new: new resource to insert   * - * Returns 0 on success, -EBUSY if the resource can't be inserted. + * Returns 0 on success, conflict resource if the resource can't be inserted.   * - * This function is equivalent to request_resource when no conflict + * This function is equivalent to request_resource_conflict when no conflict   * happens. If a conflict happens, and the conflicting resources   * entirely fit within the range of the new resource, then the new   * resource is inserted and the conflicting resources become children of   * the new resource.   */ -int insert_resource(struct resource *parent, struct resource *new) +struct resource *insert_resource_conflict(struct resource *parent, struct resource *new)  {  	struct resource *conflict;  	write_lock(&resource_lock);  	conflict = __insert_resource(parent, new);  	write_unlock(&resource_lock); +	return conflict; +} + +/** + * insert_resource - Inserts a resource in the resource tree + * @parent: parent of the new resource + * @new: new resource to insert + * + * Returns 0 on success, -EBUSY if the resource can't be inserted. + */ +int insert_resource(struct resource *parent, struct resource *new) +{ +	struct resource *conflict; + +	conflict = insert_resource_conflict(parent, new);  	return conflict ? -EBUSY : 0;  }  | 
