Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp138376pxb; Wed, 18 Nov 2020 19:07:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLiWbKMibbkXXuJJCSRK8yPUNkMEps5qQKvu233VEiIDKgEiwN5bnEydXhION7IkRj2Qy8 X-Received: by 2002:a05:6402:1644:: with SMTP id s4mr11306185edx.221.1605755227473; Wed, 18 Nov 2020 19:07:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605755227; cv=none; d=google.com; s=arc-20160816; b=CT4eoYTj2znAwYFW9FhvjssQbSoQ6sUhcrSEZIhndTX+ijd2xh3S1pmNzk7zbib3YT nIPTKNsBwsXypobMrMZ6eOAMszRihz9PdMIfBGT1ipW+Snj+qjE5yyar27Ej4XM6BvJY sNYGF5QVR7tXbGl9rHEQlhkCfqCjHbwf/FjgyiYjwlO9IjpxSuTkWOW3VYbrENR9hKXY papFjO2MvTh2J3JtCj8pcCRMR/TOuNoaueTagSHyqNvb5qW7V9Q5UJTit3El8C8tpso+ j79RlNHvVr6QhO3kG1GU1BQPqwsS1lx6zjmbgqpiSMuk27Siy3ckXjPmCjV3SxyHvkcJ 6lWQ== 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=x8EnwH3MCVdGTzFTnGr9qL4YpEzorXYHKHZCM8Q7lfk=; b=ahpyDjNleQskU985c87thAT9cbTMBvZHDZl12MMVPfgVTWuM12vkNxwTajm2MA8JkO h8LUE3A47VYdClaO7OOtV4NfHdPRy17YemPupe87X/Z+PVBUMyLGhRB8iELf77bqcu2S pAeW0Gm2det5Ampw77aWDl+x/Ol0M9CcngY2t6OSLoyrMAfBkGX6NW34REZ7sKLbt4Qc r//doawo5LhIBhJG+oreOz49CVgcmCZsOrCRzp5dLXq0zZ1zA6/D1uC0bH6uHedpc/6R S27UHFgDLCxkyi6K3hrYVuGLOBsulvMPN0i2x28Lf8WfdxG7ce6EM//rWcnLK/hTSkN3 NK1g== 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 nw21si16842390ejb.708.2020.11.18.19.06.44; Wed, 18 Nov 2020 19:07:07 -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 S1726391AbgKSDDR (ORCPT + 99 others); Wed, 18 Nov 2020 22:03:17 -0500 Received: from mga04.intel.com ([192.55.52.120]:56445 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbgKSDDR (ORCPT ); Wed, 18 Nov 2020 22:03:17 -0500 IronPort-SDR: lm/lv2E6GG7guUgJKUztIbSg/pzytGTbdGLF/Odu+Ci3QdzWC5rhXLhBHU+kzsYunGrJN2XKk0 DmrYV0DID0Nw== X-IronPort-AV: E=McAfee;i="6000,8403,9809"; a="168651437" X-IronPort-AV: E=Sophos;i="5.77,489,1596524400"; d="scan'208";a="168651437" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 19:03:17 -0800 IronPort-SDR: +VU2x0HdSHtJaUEJaNUCmhJgAKmTwQOOHCvtKWjhVBpWSlPkpxxl5iiVH2fr+YXKULA2Osctpo AEgfx2uEkbCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,489,1596524400"; d="scan'208";a="534584740" Received: from host.sh.intel.com ([10.239.154.115]) by fmsmga005.fm.intel.com with ESMTP; 18 Nov 2020 19:03:08 -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 3/4] iio: hid-sensor-trigger: Use iio->trig instead trig field internal structure Date: Thu, 19 Nov 2020 11:03:25 +0800 Message-Id: <20201119030326.6447-4-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 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); -- 2.17.1