Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp324382pxb; Thu, 19 Nov 2020 02:04:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDNVQkGNS8bXYkxhUFEnscrdzbUJpiADIaN+fQYJyCHX9kswW+VhxCMkqGYCrRVLmV36dE X-Received: by 2002:a17:906:a3ca:: with SMTP id ca10mr22431282ejb.40.1605780273900; Thu, 19 Nov 2020 02:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605780273; cv=none; d=google.com; s=arc-20160816; b=NtGj6hRB0Os4tsWHGeZ68hoFU2fS1O0z8x+ZgIaxHnnQK96hOikrja0e/m8Auyu4ha +Q3dIJ8jdi4ph88TyPJatzM7oNRY0mcrUwz+xx9VJuEWsIWMo5jQh2PmIBIB5RaVWKp/ hZDkwqvA4eOGzX1q+HGyKIIme4zxH3KN36BExboAEAWPJ8X88xQ6Eqt6RfbnbGXjiEhI vZiZgc2i/7ehnQtiHNjWhoCwkETGnY4EHwaPSevpr0iCCOXp32Js2CrPjeZCLTNW+Qom Q3Qsxy+dHN6b4vgtwUG9KqyUYpb8OPfspGquqL/lu7FEYMFhAispbCNRRvf/hSKLR0lM 92kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=u4laf9A0VAYXv2tfpSbcaIXLhJ9FQ0tHgplbDCrO4zw=; b=cUE9n4g8GdUDRGSCw6wphX0wirLcGLDq81uf+Zlnscr2BZHshxYLdA3AaAS76tLkSq U5I6+SnNhIksfab/UaElwZHSGoEhLgllGEt7sRds8xwlWfetbHYC+eGj9MNaQdd4NrDz 3o0jigYnbOpfezqw0FO6CWv5OVDV1cwFQkhSlqZ+nNZdfbNKYi/J9EfZg08zRGwKeeKl V7rfU0M3cuNbd/+vIRE9pAg0JJzvQui1NeluFkW1TRhF7/sBt6PG0WtvdGhuO3GL672Q RN/fYOzzDoL7jsb8Cf8ueVGHmX/LxUr3Gji9EUS6jJZX8PQGEiHkTpbnzfNA96cMnO60 nhjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si17099680ejq.157.2020.11.19.02.04.11; Thu, 19 Nov 2020 02:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727182AbgKSKCr (ORCPT + 99 others); Thu, 19 Nov 2020 05:02:47 -0500 Received: from mga14.intel.com ([192.55.52.115]:10879 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbgKSKCq (ORCPT ); Thu, 19 Nov 2020 05:02:46 -0500 IronPort-SDR: PAUFLMMmENz6CgUxHPAK6bAlcS8mrSp6wLWHgXvY4AN2drEUpJ2X2hif3pnwgNVz44uJmcEh/P muZknd6kRdzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9809"; a="170482240" X-IronPort-AV: E=Sophos;i="5.77,490,1596524400"; d="scan'208";a="170482240" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2020 02:02:46 -0800 IronPort-SDR: 4rP8QmvTHyGMSLXW+TaqC3wxA+tat2EQI+ouizZ472FCyqqkQLDL32IzmH0v6Rk+IyDqVeCNqB yBR2uzPwKlJg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,490,1596524400"; d="scan'208";a="359909776" Received: from host.sh.intel.com ([10.239.154.115]) by fmsmga004.fm.intel.com with ESMTP; 19 Nov 2020 02:02:44 -0800 From: Ye Xiang To: jikos@kernel.org, jic23@kernel.org, srinivas.pandruvada@linux.intel.com Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Ye Xiang Subject: [PATCH v2 2/4] iio: hid-sensor-trigger: Decrement runtime pm enable count on driver removal Date: Thu, 19 Nov 2020 18:03:29 +0800 Message-Id: <20201119100331.2594-3-xiang.ye@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119100331.2594-1-xiang.ye@intel.com> References: <20201119100331.2594-1-xiang.ye@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To avoid pm_runtime_disable called repeatedly by hid sensor drivers, decrease runtime pm enable count after call it. Signed-off-by: Ye Xiang --- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index ff375790b7e8..30340abcbc8d 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -227,8 +227,10 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, void hid_sensor_remove_trigger(struct iio_dev *indio_dev, struct hid_sensor_common *attrb) { - if (atomic_read(&attrb->runtime_pm_enable)) + if (atomic_read(&attrb->runtime_pm_enable)) { pm_runtime_disable(&attrb->pdev->dev); + atomic_dec(&attrb->runtime_pm_enable); + } pm_runtime_set_suspended(&attrb->pdev->dev); pm_runtime_put_noidle(&attrb->pdev->dev); -- 2.17.1