RE: [PATCH 1/1] mshv: Add conditional VMBus dependency

From: Michael Kelley

Date: Thu May 21 2026 - 17:19:22 EST


From: Arnd Bergmann <arnd@xxxxxxxx> Sent: Thursday, May 21, 2026 1:16 PM
>
> On Thu, May 21, 2026, at 18:49, Michael Kelley wrote:
> >
> > Existing code ensures that the VMBus driver loads first if it is
> > built-in. The VMBus driver uses subsys_initcall(), which is
> > initcall level 4. The MSHV root driver uses module_init(), which
> > becomes device_init() when built-in, and device_init() is
> > initcall level 6.
> >
> > Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
> > Closes: https://lore.kernel.org/all/20260520074044.923728-1-arnd@xxxxxxxxxx/
> > Signed-off-by: Michael Kelley <mhklinux@xxxxxxxxxxx>
>
> Looks good to me, thanks for fixing it!
>
> Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> > /*
> > * VMBus owns SIMP/SIEFP/SCONTROL when it is active.
> > * See hv_hyp_synic_enable_regs() for that initialization.
> > */
> > - bool vmbus_active = hv_vmbus_exists();
> > +#if IS_ENABLED(CONFIG_HYPERV_VMBUS)
> > + vmbus_active = hv_vmbus_exists();
> > +#endif
>
> I would usually write this as
>
> if (IS_ENABLED(CONFIG_HYPERV_VMBUS))
> vmbus_active = hv_vmbus_exists();
>
> for readability, since the hv_vmbus_exists() declarations is still
> visible and the IS_ENABLED() check avoids the link failure.
>

I thought about doing that, but wasn't sure it would work. There
are nuances of #ifdef vs. #if IS_ENABLED() vs. if (IS_ENABLED())
that I haven't learned. :-(

I'll wait a few days to see if any comments come in from Jork
Jork or other MSFT folks, and then spin a v2 with your change
so the cleaner version is what goes upstream.

Thanks!

Michael