---
name: "cdev_set_parent"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/cdev_set_parent"
---

# cdev\_set\_parent(9)

set the parent kobject for a char device

## NAME

cdev\_set\_parent - set the parent kobject for a char device

## SYNOPSIS

**void cdev\_set\_parent(struct cdev \*** *p***, struct kobject \*** *kobj***);**

## ARGUMENTS

*p*

the cdev structure

*kobj*

the kobject to take a reference to

## DESCRIPTION

**cdev\_set\_parent** sets a parent kobject which will be referenced appropriately so the parent is not freed before the cdev. This should be called before cdev\_add.

## COPYRIGHT
