From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758341AbbJHURa (ORCPT ); Thu, 8 Oct 2015 16:17:30 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:45326 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1758099AbbJHUR3 (ORCPT ); Thu, 8 Oct 2015 16:17:29 -0400 From: "Rafael J. Wysocki" To: Alan Stern , Grygorii Strashko Cc: Greg Kroah-Hartman , Pavel Machek , Len Brown , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Thierry Reding Subject: Re: [PATCH 2/2] PM / sleep: prohibit devices probing during suspend/hibernation Date: Thu, 08 Oct 2015 22:46:02 +0200 Message-ID: <15556679.oJAEDkJbZ7@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, October 08, 2015 03:20:08 PM Alan Stern wrote: > On Thu, 8 Oct 2015, Grygorii Strashko wrote: > > > >> /** > > >> + * device_defer_all_probes() - Enable/disable probing of devices > > >> + * @enable: Enable/disable probing of devices > > >> + * > > >> + * if @enable = true > > >> + * It will disable probing of devices and defer their probes. > > >> + * otherwise > > >> + * It will restore normal behavior and trigger re-probing of deferred > > >> + * devices. > > >> + */ > > >> +void device_defer_all_probes(bool enable) > > >> +{ > > >> + defer_all_probes = enable; > > >> + if (enable) > > >> + /* sync with probes to avoid any races. */ > > >> + wait_for_device_probe(); > > > > ^ pls, pay attention on above code line > > > > >> + else > > >> + driver_deferred_probe_trigger(); > > >> +} > > > > > > Some people might prefer to see two separate functions, an enable > > > routine and a disable routine. I don't much care. > > > > May be. Should I change it? > > It would then be more in line with functions like > pm_runtime_set_{active|suspended} or pm_runtime_[dont_]use_autosuspend. Also it would be cleaner code without conditionals: enable: defer_all_probes = true; wait_for_device_probe(); disable: defer_all_probes = false; driver_deferred_probe_trigger(); Cleaner, no? Thanks, Rafael