Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1690109rdb; Thu, 25 Jan 2024 03:21:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+FUmqtuT1Gf/nh3ruXOJOF1S+ZpJY6pes5EemhbpFrpnhP18F4rpCK7vxm8486nbrQkQx X-Received: by 2002:a17:906:e2d0:b0:a28:f8d2:7897 with SMTP id gr16-20020a170906e2d000b00a28f8d27897mr420119ejb.20.1706181689806; Thu, 25 Jan 2024 03:21:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706181689; cv=pass; d=google.com; s=arc-20160816; b=LHKr39D4O/vT7fNYFWFFatLVfp++i2jlBHV2+TG6oHrDLZWRxOA1eFLgJk7/zgY85n Tw44npC/48tyUkHAtVsOIeEKZMHgxAA0lVCJp9ZomIxpXTqN5rfQhPaLU8aGHFlOQClM X4foSJ6zWN2o0HtYtY0MNlOlkE6S3bdheKyA4Byzvqa2jkp2H9ZksbbMEM4fE69kyFXf XsgzPFhXDODnjqZ7WJSSKsys9htq4aivGxcj6+ByHZsKbg5tEF/rNP+PXA9laN+K3j2g FPsABXI6F17W1T2R7uha4BVJksaKYr9rUwLhbjOTv6D430tyHK/y8sg77RqEV+dy9cJN qxnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Aza2UHwlpi3KJsJOY941URPI8ivKc2WesjydekJG3+s=; fh=3lCNSO6LQCqhm4IvCPXj5H7Te/C8INRvRb78PtOk2Ps=; b=VzzoDkDdFdun0+L82MZpCMJfwQwNONWiEebtIp90bbjgh1/CxTAAHzvKOwCNkUxqvr 7LXOfhBWKN5p76LNxAvJoRKJhBewmICQ0mCqdt18ImIMwxygHXBKFrQn/cDm/jUOYmjy W5S/XZsrzyL62HqzWCTDzX22h1iJOcRogHnVp+ftbsRdoPpyGzY3C3vNmJ5VOjW1OvYF JkMEDljA3a0Vp3yKMeMxzQDbYOX6d1YDJYjNDKhYenxvD7tmetYE/aw2odUGMFstSaV4 qIzxYixldUrDuLSnxkfYl6oFgXLJ5OmbdNquLufBS0iBmRC0o4NFmLVb8HhCty8BbAKP y0lA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LxBMI6Ow; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v21-20020a170906489500b00a3281ba645dsi90172ejq.663.2024.01.25.03.21.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:21:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LxBMI6Ow; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2B7B51F253C3 for ; Thu, 25 Jan 2024 07:42:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 841FD17BAF; Thu, 25 Jan 2024 07:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LxBMI6Ow" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2292E12E54; Thu, 25 Jan 2024 07:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.120 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706168458; cv=none; b=uQOUsMbciyylHC76ADVHzOYGz0CPSePn3pmuUVcpUK4BA6xo84rgHJhMOaVT4xRvFgq+g5lXUBsKnMWQSzN/khmkY4bk5f3HqYPR02qxRQZ0oZfF+A5td8FC99KpXjKQeWLmM3+3l2N92S9jUAwZ7+Qn8TuYSXwfDJKxinvmV1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706168458; c=relaxed/simple; bh=r3JtH1Ui6kSD1qodWct9HfimeEcB9akkZ4WQUOcpEMY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BiIxHD2azegZkJTrBP7ICOSsfPjZBj7QXhagoka2kggfaXIvsYRR8z1HxM5DC0kfB3ZVasF3bc9Y3N4g2hDAAIgy6EEbuBRClZheoNQ9vAhS5cbAsmSxiNCkaDKP78fW+84IdreMPU/lQxysWvEAQko7+Ekt3pOM+FsDtWBvSd4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LxBMI6Ow; arc=none smtp.client-ip=192.55.52.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706168456; x=1737704456; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=r3JtH1Ui6kSD1qodWct9HfimeEcB9akkZ4WQUOcpEMY=; b=LxBMI6Owc5OgGoQoBxMFw0H1Gl6Kj27cBdN4sUMeROQxO/d8z4NOc/yy xoNNy+seFU2mqmE+nWHwsx1LXorHyoyqA5cEMKcxELvrvkvmkENv5vOom V6n6OlL+KM/ndBHU3djkri2ivOoCRORR+6fr/7lVlymE+x310TUggsAB8 6NljKd6X9bZZ6b6dTuUMg/CB2XYF2jWq9EbCSqySl8Eser866keCYpHO7 CXt3XHkxH6IXMdI58SDpsNqrRUPil2iHEwuDWiEjtaEfPugkj0D7tKmzW LFzeTeTYM4lifXUZ9rEcjfBeLdNO0TxOnnVXuwcXQje8hNWx3+J0l8yrL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="400943284" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="400943284" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 23:40:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="2137835" Received: from sgruszka-mobl.ger.corp.intel.com (HELO localhost) ([10.252.58.119]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 23:40:54 -0800 Date: Thu, 25 Jan 2024 08:40:50 +0100 From: Stanislaw Gruszka To: "Rafael J. Wysocki" Cc: Linux PM , LKML , Ulf Hansson Subject: Re: [PATCH v1 02/12] PM: sleep: Relocate two device PM core functions Message-ID: References: <5760158.DvuYhMxLoT@kreacher> <4876491.GXAFRqVoOG@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4876491.GXAFRqVoOG@kreacher> On Mon, Jan 22, 2024 at 12:24:21PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Move is_async() and dpm_async_fn() in the PM core to a more suitable > place. > > No functional impact. > > Signed-off-by: Rafael J. Wysocki Reviewed-by: Stanislaw Gruszka > --- > drivers/base/power/main.c | 58 +++++++++++++++++++++++----------------------- > 1 file changed, 29 insertions(+), 29 deletions(-) > > Index: linux-pm/drivers/base/power/main.c > =================================================================== > --- linux-pm.orig/drivers/base/power/main.c > +++ linux-pm/drivers/base/power/main.c > @@ -578,6 +578,35 @@ bool dev_pm_skip_resume(struct device *d > return !dev->power.must_resume; > } > > +static bool is_async(struct device *dev) > +{ > + return dev->power.async_suspend && pm_async_enabled > + && !pm_trace_is_enabled(); > +} > + > +static bool dpm_async_fn(struct device *dev, async_func_t func) > +{ > + reinit_completion(&dev->power.completion); > + > + if (is_async(dev)) { > + dev->power.async_in_progress = true; > + > + get_device(dev); > + > + if (async_schedule_dev_nocall(func, dev)) > + return true; > + > + put_device(dev); > + } > + /* > + * Because async_schedule_dev_nocall() above has returned false or it > + * has not been called at all, func() is not running and it is safe to > + * update the async_in_progress flag without extra synchronization. > + */ > + dev->power.async_in_progress = false; > + return false; > +} > + > /** > * device_resume_noirq - Execute a "noirq resume" callback for given device. > * @dev: Device to handle. > @@ -664,35 +693,6 @@ Out: > } > } > > -static bool is_async(struct device *dev) > -{ > - return dev->power.async_suspend && pm_async_enabled > - && !pm_trace_is_enabled(); > -} > - > -static bool dpm_async_fn(struct device *dev, async_func_t func) > -{ > - reinit_completion(&dev->power.completion); > - > - if (is_async(dev)) { > - dev->power.async_in_progress = true; > - > - get_device(dev); > - > - if (async_schedule_dev_nocall(func, dev)) > - return true; > - > - put_device(dev); > - } > - /* > - * Because async_schedule_dev_nocall() above has returned false or it > - * has not been called at all, func() is not running and it is safe to > - * update the async_in_progress flag without extra synchronization. > - */ > - dev->power.async_in_progress = false; > - return false; > -} > - > static void async_resume_noirq(void *data, async_cookie_t cookie) > { > struct device *dev = data; > > > >