---
name: "device_schedule_callback_owner"
section: "9"
platform: "linux"
package: "linux-manual-3.2"
version: "3.2.78-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/device_schedule_callback_owner"
---

# device\_schedule\_callback\_owner(9)

helper to schedule a callback for a device

## NAME

device\_schedule\_callback\_owner - helper to schedule a callback for a device

## SYNOPSIS

**int device\_schedule\_callback\_owner(struct device \*** *dev***, void (\****func***) (struct device \*), struct module \*** *owner***);**

## ARGUMENTS

*dev*

device.

*func*

callback function to invoke later.

*owner*

module owning the callback routine

## DESCRIPTION

Attribute methods must not unregister themselves or their parent device (which would amount to the same thing). Attempts to do so will deadlock, since unregistration is mutually exclusive with driver callbacks.

Instead methods can call this routine, which will attempt to allocate and schedule a workqueue request to call back *func* with *dev* as its argument in the workqueue's process context. *dev* will be pinned until *func* returns.

This routine is usually called via the inline **device\_schedule\_callback**, which automatically sets *owner* to THIS\_MODULE.

Returns 0 if the request was submitted, -ENOMEM if storage could not be allocated, -ENODEV if a reference to *owner* isn't available.

## NOTE

This routine won't work if CONFIG\_SYSFS isn't set! It uses an underlying sysfs routine (since it is intended for use by attribute methods), and if sysfs isn't available you'll get nothing but -ENOSYS.

## COPYRIGHT
