Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3730678imm; Sat, 25 Aug 2018 01:20:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbMv6O8GmoY0f+AhJmrwdP3KfQ+UDodetR3p9ze/kjTV/+sC2jzHybbAun3zwjCCAChj/JG X-Received: by 2002:a62:9042:: with SMTP id a63-v6mr5338400pfe.52.1535185226343; Sat, 25 Aug 2018 01:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535185226; cv=none; d=google.com; s=arc-20160816; b=nUJ38AbI3+NM4NZchgPsHUa5lnoVl6cbtjAG+v/Y5Dbyzddgf5967HHbx4eKtakGQM HVJIwYrk9dYjwyVWTYbaeqQdHY1anygoRS7mMBJmPdpkvNDzbuGA/9LIpBKiPPiVqt7r +kyixT6jLSSkJp4KC/TJpG+Ps4RkM3r+R8+zsyUvBzSczfGjJFEXFWlEBtuGxbGyCN5d DMqk6fq9I9xlsxl4GuneIu9FpRamuD2Urod68Z3Wb5nyo+IaQ5BI3QXphejDqFCatjc6 e7vX1Yv/YwogZ9yVjbyivpaoachXGtAvw5FiuFFV6QZ/uhl9A0BVKPg9GMEmDE7VnM/8 eKcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=N/MnCsfsRjnw/REL6MVOmg96QlrRCaIgxnFUP5W2EhA=; b=BdCPVNTpxlcvV+NWfuUq/pHFSZtS7orDxVMGIxDhqWQkYyCMyD96H1vPKYJI+aKrmu AGKfJXPbhX2TmnPyYumfikLvLz6nCqiNk26GbWyvnEHt0Y1dMkEc3KgPTZkK6rIATD// GJIEbLUgJjpaaeCietGXbATNqBhh8Leoqng63rXIaJIrJEjB6Ao/RE+R4TAFYceO76qX P6lJSxHlNWAIbmRvqiY/D8UO1TUczxvdfwpE+dFqLsdFQFtoqlnkKEPKLI4T2el5QIeQ Av44r+NaztqbdstpWChDW6WQIDR8KDPRsN92k6RAtW36ZP4hJY0HQsV73idDm7byzXIb hicg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d130-v6si9376821pgc.189.2018.08.25.01.19.46; Sat, 25 Aug 2018 01:20:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbeHYLzN (ORCPT + 99 others); Sat, 25 Aug 2018 07:55:13 -0400 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:50312 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726412AbeHYLzN (ORCPT ); Sat, 25 Aug 2018 07:55:13 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id 8C3A09E6AB2; Sat, 25 Aug 2018 09:17:00 +0100 (BST) Date: Sat, 25 Aug 2018 09:16:58 +0100 From: Jonathan Cameron To: Lars-Peter Clausen Cc: Stefan Popa , Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] iio: adxl372: Provide validate_trigger and validate_device callbacks Message-ID: <20180825091658.0e4f7cf6@archlinux> In-Reply-To: References: <1534776823-18703-1-git-send-email-stefan.popa@analog.com> <1fc5f7bb-67d1-fa03-2242-b38b94a151ee@metafoo.de> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 20 Aug 2018 17:37:08 +0100 jic23@kernel.org wrote: > On 20.08.2018 16:47, Lars-Peter Clausen wrote: > > On 08/20/2018 04:53 PM, Stefan Popa wrote: > >> This patch provides a validate_device callback for the trigger which > >> makes > >> sure that other devices are rejected. > >> > >> Signed-off-by: Stefan Popa >> --- > >> drivers/iio/accel/adxl372.c | 13 +++++++++++++ > >> 1 file changed, 13 insertions(+) > >> > >> diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c > >> index d2fdc75..5a039ba 100644 > >> --- a/drivers/iio/accel/adxl372.c > >> +++ b/drivers/iio/accel/adxl372.c > >> @@ -762,11 +762,24 @@ static int adxl372_dready_trig_set_state(struct > >> iio_trigger *trig, > >> return adxl372_set_interrupts(st, mask, 0); > >> } > >> > >> +static int adxl372_validate_trigger(struct iio_dev *indio_dev, > >> + struct iio_trigger *trig) > >> +{ > >> + struct adxl372_state *st = iio_priv(indio_dev); > >> + > >> + if (st->dready_trig != trig) > >> + return -EINVAL; > >> + > >> + return 0; > >> +} > >> + > >> static const struct iio_trigger_ops adxl372_trigger_ops = { > >> + .validate_device = &iio_trigger_validate_own_device, > >> .set_trigger_state = adxl372_dready_trig_set_state, > >> }; > >> > >> static const struct iio_info adxl372_info = { > >> + .validate_trigger = &adxl372_validate_trigger, > > > > I wonder, if the device only works with the trigger and the trigger > > only > > works with the device should we actually register a trigger? > > > > Seems to be just extra hassle when setting up the device without any > > extra > > benefits. > > I wondered the same, but there is a reason to do this if we think we > will eventually have support for other triggers (which looks possible > for > this device as we can bypass the fifo). Then we want to do it in order > to avoid a breaking ABI change. There is a way around that by setting > a default trigger so that it'll still use this one unless it is > explicitly > set but that is rather ugly! > > Jonathan Hi Lars, Stefan, I'll apply this as is, but if we continue this debate and reach another conclusion we can always make a change during this cycle. Plenty of time left! Thanks, Jonathan