---
name: "devres_get"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/devres_get"
---

# devres\_get(9)

Find devres, if non-existent, add one atomically

## NAME

devres\_get - Find devres, if non-existent, add one atomically

## SYNOPSIS

**void \* devres\_get(struct device \*** *dev***, void \*** *new\_res***, dr\_match\_t** *match***, void \*** *match\_data***);**

## ARGUMENTS

*dev*

Device to lookup or add devres for

*new\_res*

Pointer to new initialized devres to add if not found

*match*

Match function (optional)

*match\_data*

Data for the match function

## DESCRIPTION

Find the latest devres of *dev* which has the same release function as *new\_res* and for which *match* return 1. If found, *new\_res* is freed; otherwise, *new\_res* is added atomically.

## RETURNS

Pointer to found or added devres.

## COPYRIGHT
