From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B068173 for ; Mon, 19 Jul 2021 17:37:49 +0000 (UTC) Received: by mail-io1-f44.google.com with SMTP id k16so20886850ios.10 for ; Mon, 19 Jul 2021 10:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C/mj+LubQMgoP0fQxX80OQnOmxM9tcFadyRatEiW+pY=; b=DHu0B3M7ccBEgRGm5v8YtvoKcf+YzG0eN92Q6J7wSnNufCWMzyY3KV4cNh7d9HDLYf ih0tK2ssVoJuU6wUHamcNWJ75YQhiVGJGZcgBKGXqAhu5NEGjNb8a77qeJ6eKYnfPOTV Y+SZsPYOx3utVJXbblM357lEXdYTM0qvFV6rKdNhV7f/5HWWAfsqbZ0db0qDdl5QfIhL 2cIBuZ/K9AqueFFZiN09QC7hp+LfB5evg1nX7dreMrhhwb7flh8SVrlfiX42zNJkS8ea vCa9J/INPHF5AbVtf4IArYO24XNbwc2n4KorsRBypGZVkkIpjNgWudSAOjorg4AYC5GJ m44w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C/mj+LubQMgoP0fQxX80OQnOmxM9tcFadyRatEiW+pY=; b=G+85d5NwYAodpgqQLsEfy1fH3B+VyBCvuFi1ZO1BcTDnSREl5Fs2fqCpCILqgMS14c K/S3EnmhCltMXVCpj1hvTfBXwJ8Bm0fltQh7bvXGKlKYpoVRD8wtFDlk/FBgenNoqa5u YfcfVROY/4eGA2q8hZPJ98t4NuTNbY3DjBNzIcoCJxT4eMSipNjChvFkvhEWDphIE+vK gkov7/ntNThT8vC/yvvBf1edMX1RGFZLWwicsxlWSyJ1NHfL2IkdLT0ctmd7zJRe1UmO acecHEq7kjfxG3wlboMqLULUCx/QrSIWWxI630SgZnexqSzXWhgSe0nK7WYcWTfA3bxN KhRg== X-Gm-Message-State: AOAM5319Tbk4HYvsZ+FUYSTWEedWniGBokhLGP9Zw6svewUs7/gj+Q1O qb0979pAvgSDb/ZmkGpyFKWWRg6Bka7AAwGD61c= X-Google-Smtp-Source: ABdhPJwW4Hwk1RgtFfQCUfl6VIFjlskZv563XjgegK9BTEOErpCnx/75YRsxjfoJhvr7ped1OUBT8GhXz3k3AbAVm/g= X-Received: by 2002:a02:9508:: with SMTP id y8mr22764918jah.28.1626716268625; Mon, 19 Jul 2021 10:37:48 -0700 (PDT) Precedence: bulk X-Mailing-List: ksummit@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20210707203827.GI18396@quack2.suse.cz> In-Reply-To: From: Miguel Ojeda Date: Mon, 19 Jul 2021 19:37:37 +0200 Message-ID: Subject: Re: [TECH TOPIC] Rust for Linux To: Arnd Bergmann Cc: Wedson Almeida Filho , Linus Walleij , Greg KH , Bartosz Golaszewski , Kees Cook , Jan Kara , James Bottomley , Julia Lawall , Laurent Pinchart , Roland Dreier , ksummit@lists.linux.dev, Viresh Kumar Content-Type: text/plain; charset="UTF-8" On Mon, Jul 19, 2021 at 4:02 PM Arnd Bergmann wrote: > > - What is the mechanism behind power::Operations that replaces the > #ifdef CONFIG_PM of the C version? Will the rust compiler just drop > the dead code when CONFIG_PM is disabled? We support conditional compilation with the kernel configuration, e.g.: #[cfg(CONFIG_X)] // `CONFIG_X` is enabled (`y` or `m`) #[cfg(CONFIG_X="y")] // `CONFIG_X` is enabled as a built-in (`y`) #[cfg(CONFIG_X="m")] // `CONFIG_X` is enabled as a module (`m`) #[cfg(not(CONFIG_X))] // `CONFIG_X` is disabled One can use it, like in C, to fully remove any item as a user, to make an implementation a noop (so that callers do not need to care), etc. Cheers, Miguel