From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756074AbbJIObf (ORCPT ); Fri, 9 Oct 2015 10:31:35 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:48336 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754026AbbJIObc (ORCPT ); Fri, 9 Oct 2015 10:31:32 -0400 Subject: Re: [PATCH 2/2] PM / sleep: prohibit devices probing during suspend/hibernation To: "Rafael J. Wysocki" , Alan Stern References: <15556679.oJAEDkJbZ7@vostro.rjw.lan> CC: Greg Kroah-Hartman , Pavel Machek , Len Brown , , , Thierry Reding From: Grygorii Strashko Message-ID: <5617CFBC.1090409@ti.com> Date: Fri, 9 Oct 2015 09:31:24 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <15556679.oJAEDkJbZ7@vostro.rjw.lan> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/08/2015 03:46 PM, Rafael J. Wysocki wrote: > 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? > NP. Will do. -- regards, -grygorii