[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <HK0P153MB01485A90EA8D0D7A8CF5F97EBF080@HK0P153MB0148.APCP153.PROD.OUTLOOK.COM>
Date: Sun, 26 Jan 2020 05:05:26 +0000
From: Dexuan Cui <decui@...rosoft.com>
To: Michael Kelley <mikelley@...rosoft.com>,
KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"sashal@...nel.org" <sashal@...nel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
vkuznets <vkuznets@...hat.com>
Subject: RE: [PATCH v3 2/4] hv_utils: Support host-initiated restart request
> From: Michael Kelley <mikelley@...rosoft.com>
> 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
Powered by blists - more mailing lists