pub struct Registration<T: Chip> { /* private fields */ }
Expand description

A registration of a gpio chip.

Examples

The following example registers an empty gpio chip.

use kernel::{
    device::RawDevice,
    gpio::{self, Registration},
};

struct MyGpioChip;
#[vtable]
impl gpio::Chip for MyGpioChip {
    type Data = ();
}

fn example(parent: &dyn RawDevice) -> Result<Pin<Box<Registration<MyGpioChip>>>> {
    let mut r = Pin::from(Box::try_new(Registration::new())?);
    kernel::gpio_chip_register!(r.as_mut(), 32, None, parent, ())?;
    Ok(r)
}

Implementations

Creates a new Registration but does not register it yet.

It is allowed to move.

Registers a gpio chip with the rest of the kernel.

Users are encouraged to use the gpio_chip_register macro because it automatically defines the lock classes and calls the registration function.

Trait Implementations

Returns the “default value” for a type. Read more

Removes the registration from the kernel if it has completed successfully before.

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.