RE: [PATCH v3 2/4] hv_utils: Support host-initiated restart request

From: Dexuan Cui
Date: Sun Jan 26 2020 - 00:05:37 EST


> From: Michael Kelley <mikelley@xxxxxxxxxxxxx>
> Sent: Saturday, January 25, 2020 8:57 PM
> > @@ -186,6 +214,8 @@ static void shutdown_onchannelcallback(void
> *context)
> >
> > if (execute_shutdown == true)
> > schedule_work(&shutdown_work);
> > + if (execute_reboot == true)
> > + schedule_work(&restart_work);
>
> This works, and responds to my comment. But FWIW, a more compact
> approach would be to drop the boolean execute_shutdown, execute_restart,
> etc. local variables and have just this local variable:
>
> struct work_struct *work_to_do = NULL;
>
> In the "case" branches do:
>
> work_to_do = &shutdown_work;
>
> or
> work_to_do = &restart_work;
>
> Then at the bottom of the function, just do:
>
> if (work_to_do)
> schedule_work(work_to_do);
>
> Patch 3 of this series would then be a little simpler as well.

Good idea! I'll do this in v4.

Thanks,
-- Dexuan