> <igor.korotin.linux@xxxxxxxxx> wrote: > > > > Let me know if this pattern is acceptable. To my opinion it is not much > > different from the original 2 functions conditioned by #[cfg] and > > requires some nasty changes. > > In general, the more local a `cfg` can be made, the better, because we > can share more, e.g. the docs and signature. > > But maybe in this case it doesn't work -- what would be the "nasty > changes" required? In particular on this example: fn of_id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> { #[cfg(not(CONFIG_OF))] { None } #[cfg(CONFIG_OF))] { // the rest of logic } } The `dev` is marked as unused if `CONFIG_OF` is not set. So we have 3 options: 1. rename it to `_dev`. This is nasty to my opinion, because it is misleading. 2. add #[alloc(unused_variables)] on top of it. Also not good since it will suppress all other possible unused_variables as well. 3. The third option is `let _ = dev;` in `#[cfg(not(CONFIG_OF))]` section. I came to it while I was writing this reply. This looks like the best option of three in my opinion. Thanks Igor