Unverified Commit 3809d7a8 authored by Andreas Hindborg's avatar Andreas Hindborg Committed by Daniel Gomez
Browse files

rust: module: use a reference in macros::module::module



When we add parameter support to the module macro, we want to be able to
pass a reference to `ModuleInfo` to a helper function. That is not possible
when we move out of the local `modinfo`. So change the function to access
the local via reference rather than value.

Reviewed-by: default avatarBenno Lossin <lossin@kernel.org>
Signed-off-by: default avatarAndreas Hindborg <a.hindborg@kernel.org>
Tested-by: default avatarDaniel Gomez <da.gomez@samsung.com>
Signed-off-by: default avatarDaniel Gomez <da.gomez@kernel.org>
parent 0b08fc29
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -176,23 +176,23 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
    // Rust does not allow hyphens in identifiers, use underscore instead.
    let ident = info.name.replace('-', "_");
    let mut modinfo = ModInfoBuilder::new(ident.as_ref());
    if let Some(authors) = info.authors {
    if let Some(authors) = &info.authors {
        for author in authors {
            modinfo.emit("author", &author);
            modinfo.emit("author", author);
        }
    }
    if let Some(description) = info.description {
        modinfo.emit("description", &description);
    if let Some(description) = &info.description {
        modinfo.emit("description", description);
    }
    modinfo.emit("license", &info.license);
    if let Some(aliases) = info.alias {
    if let Some(aliases) = &info.alias {
        for alias in aliases {
            modinfo.emit("alias", &alias);
            modinfo.emit("alias", alias);
        }
    }
    if let Some(firmware) = info.firmware {
    if let Some(firmware) = &info.firmware {
        for fw in firmware {
            modinfo.emit("firmware", &fw);
            modinfo.emit("firmware", fw);
        }
    }