pub struct Data<T, U, V> { /* private fields */ }
Expand description

Device data.

When a device is removed (for whatever reason, for example, because the device was unplugged or because the user decided to unbind the driver), the driver is given a chance to clean its state up, and all io resources should ideally not be used anymore.

However, the device data is reference-counted because other subsystems hold pointers to it. So some device state must be freed and not used anymore, while others must remain accessible.

This struct separates the device data into three categories:

  1. Registrations: are destroyed when the device is removed, but before the io resources become inaccessible.
  2. Io resources: are available until the device is removed.
  3. General data: remain available as long as the ref count is nonzero.

This struct implements the DeviceRemoval trait so that it can clean resources up even if not explicitly called by the device drivers.

Implementations

Creates a new instance of Data.

It is recommended that the [new_device_data] macro be used as it automatically creates the lock classes.

Returns the resources if they’re still available.

Returns the locked registrations if they’re still available.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Cleans resources up when the device is removed. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

This documentation is an old archive. Please see https://rust.docs.kernel.org instead.