Macro kernel::from_kernel_result[][src]

macro_rules! from_kernel_result {
    ($($tt:tt)*) => { ... };
Expand description

Transforms a crate::error::Result<T> to a kernel C integer result.

This is useful when calling Rust functions that return crate::error::Result<T> from inside extern "C" functions that need to return an integer error result.

T should be convertible to an i16 via From<i16>.


unsafe extern "C" fn probe_callback(
    pdev: *mut bindings::platform_device,
) -> c_types::c_int {
    from_kernel_result! {
        let ptr = devm_alloc(pdev)?;
        rust_helper_platform_set_drvdata(pdev, ptr);