Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp137359pxb; Wed, 18 Nov 2020 19:05:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2oFooBqJp8XGrzddZpCZdhtZSa96n/QlvtWRgCqyi+/9eC8Y9Pz0WvAqUEb0nst+hoRBG X-Received: by 2002:aa7:c508:: with SMTP id o8mr29072957edq.339.1605755102336; Wed, 18 Nov 2020 19:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605755102; cv=none; d=google.com; s=arc-20160816; b=lC4vOnKlE9aHGSBO9Dn5222abnZEXNEglwBLk4siF7iwOYyjvgQkqkPePtSyuDUg2O DuF4oRglYlONsyf9tnO+EIB2YiO7rcjYywWmRRn3wnpwKMUsgXJVFpEdmZ1zsQ6SLnD3 RPdV2KTzbP6D5zmMX5lf4x2WwNwRtOPeFnsvlgT0P7vfLZnx7/gnUqyAnQQGSaL44rMQ Q/5LfcDOJen03hc35CfXocgREaVx8mjfbWvxwfZ8nPmL11Mp3k8JwAvdQVAD1zpEE70r bKcUbi3gSoemSOj/zC6JjtNLnUGecOZsbjRNglwrQyYVeMfwnWiKNqMhFYc2yUJhrqw0 Ur5g== 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=yst4JMtpPfYbSjJbWm8PynaG3IkE1FIWOaCDCsmDhBEYxlLIryOTF9iEs6F6ORovvG RbzOpn+Xhp7bc+jQeC1smjXBWswxAKqliTS+NZfqjOZpFUfSNoPF5KqWLb8KZvNDp3fd qsHHTvvHtApWcsfYr/rPBhcP3DTTiS1qtLoKAPEf2URNA/OgQwjO66URGG5GDf9cDY6r 0igiFR9sCqXWv49iF//cDWKl0zJm6ChUAlPP57ai4yphE+Cs33vCjFRbJg1dtjCCVFKZ jjeQLaA9afJ12ix0j4SFcZEFjKE3kFnUVPe5VSEPtlugbMqVA6wgMmbJrxcUNWORNYA4 TNUQ== 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 d2si11680491ejm.675.2020.11.18.19.04.39; Wed, 18 Nov 2020 19:05:02 -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 S1726362AbgKSDDE (ORCPT + 99 others); Wed, 18 Nov 2020 22:03:04 -0500 Received: from mga12.intel.com ([192.55.52.136]:4035 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726324AbgKSDDE (ORCPT ); Wed, 18 Nov 2020 22:03:04 -0500 IronPort-SDR: aSDj4f3fhSZBmQUj6Qn4rKHZKbNjs/RJlwOArr3W8SieDv24+CS2Rd9Zl10DFCIUQQ+gXxC7Jp f+MyT7+AKcdA== X-IronPort-AV: E=McAfee;i="6000,8403,9809"; a="150492794" X-IronPort-AV: E=Sophos;i="5.77,489,1596524400"; d="scan'208";a="150492794" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 19:03:03 -0800 IronPort-SDR: BnBn0US9veVnG/yOQigDxEAdvXahGgOhEgjipwF74IpvdMbpGz96HCNmU0+p2yz3VCVhARMSsO M7COZmOm86+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,489,1596524400"; d="scan'208";a="534584678" Received: from host.sh.intel.com ([10.239.154.115]) by fmsmga005.fm.intel.com with ESMTP; 18 Nov 2020 19:03:02 -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 2/4] iio: hid-sensor-trigger: Decrement runtime pm enable count on driver removal Date: Thu, 19 Nov 2020 11:03:24 +0800 Message-Id: <20201119030326.6447-3-xiang.ye@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119030326.6447-1-xiang.ye@intel.com> References: <20201119030326.6447-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