---
name: "device_initialize"
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/device_initialize"
---

# device\_initialize(9)

init device structure.

## NAME

device\_initialize - init device structure.

## SYNOPSIS

**void device\_initialize(struct device \*** *dev***);**

## ARGUMENTS

*dev*

device.

## DESCRIPTION

This prepares the device for use by other layers by initializing its fields. It is the first half of **device\_register**, if called by that function, though it can also be called separately, so one may use *dev*'s fields. In particular, **get\_device**/**put\_device** may be used for reference counting of *dev* after calling this function.

All fields in *dev* must be initialized by the caller to 0, except for those explicitly set to some other value. The simplest approach is to use **kzalloc** to allocate the structure containing *dev*.

## NOTE

Use **put\_device** to give up your reference instead of freeing *dev* directly once you have called this function.

## COPYRIGHT
