From patchwork Thu Nov 19 10:03:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Xiang X-Patchwork-Id: 328733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AA23C64E8A for ; Thu, 19 Nov 2020 10:03:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64B3D20888 for ; Thu, 19 Nov 2020 10:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbgKSKCt (ORCPT ); Thu, 19 Nov 2020 05:02:49 -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 S1727058AbgKSKCt (ORCPT ); Thu, 19 Nov 2020 05:02:49 -0500 IronPort-SDR: AS2eBuEZPoiat6d5xTwA1LVmv5pw+pyipw+/L1Co9U4qLFzjpKdVXtbrhTuqmW+zRhj9Tlffy+ 7Lp5l4lBtxbw== X-IronPort-AV: E=McAfee;i="6000,8403,9809"; a="170482245" X-IronPort-AV: E=Sophos;i="5.77,490,1596524400"; d="scan'208";a="170482245" 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:49 -0800 IronPort-SDR: jiEDvqRj5GkfRbyDAUn7Iw4gx/IYLh3nZ5pKIsyZlkRfiTmS4Ckc37v5LXtXHb1Ax4vtigu1gU 94jVRv9xMyJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,490,1596524400"; d="scan'208";a="359909801" Received: from host.sh.intel.com ([10.239.154.115]) by fmsmga004.fm.intel.com with ESMTP; 19 Nov 2020 02:02:47 -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 3/4] iio: hid-sensor-trigger: Use iio->trig instead trig field internal structure Date: Thu, 19 Nov 2020 18:03:30 +0800 Message-Id: <20201119100331.2594-4-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-input@vger.kernel.org Use iio->trig instead of attrb->trig as parameter of iio_trigger_unregister and iio_trigger_free. This allows one HID sensor driver to create multiple iio devices. In this case common attributes are shared and there can be one instance for the structure containing common attributes for all iio devices. Signed-off-by: Ye Xiang --- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index 30340abcbc8d..bb5e7c8ff15b 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -236,8 +236,8 @@ void hid_sensor_remove_trigger(struct iio_dev *indio_dev, pm_runtime_put_noidle(&attrb->pdev->dev); cancel_work_sync(&attrb->work); - iio_trigger_unregister(attrb->trigger); - iio_trigger_free(attrb->trigger); + iio_trigger_unregister(indio_dev->trig); + iio_trigger_free(indio_dev->trig); iio_triggered_buffer_cleanup(indio_dev); } EXPORT_SYMBOL(hid_sensor_remove_trigger);