From patchwork Mon Apr 24 13:08:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 87021 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2736568vqo; Mon, 24 Apr 2023 06:15:29 -0700 (PDT) X-Google-Smtp-Source: AKy350YEjY8MoApHvO+djHFjuw/zq+VnthKKI+92j9710fWFnJLDkQb/5J/ACjYOXNgMYpGR/WEl X-Received: by 2002:a05:6a00:802:b0:63b:5496:7afa with SMTP id m2-20020a056a00080200b0063b54967afamr19472443pfk.11.1682342129199; Mon, 24 Apr 2023 06:15:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682342129; cv=none; d=google.com; s=arc-20160816; b=uLJIdNK3rpAT7A2V0NZ2faIskAeUzcKhhOMkECMyBtcAxP8TwAQsDqZR2caFllcD3f 4yVpA9u3QrFwkUtxsGxjw6NYfFzq68wMT/de47mmGYqY7nuHkYauTPt4R28V0OEIY10B sNvVoCUsuOobYhxsvnRY1aoZwpoGOvefG58hyI5ygw4rqLSxgflxaSmpIj3PMt0iBozS Z++nMdrcTnZWHrQHV14lsvKG0Ml5896yLFNCmV9AVA4u4rB5LIQ9cp8tplcLrqYlsxON 6d0JRMMct6ejmaGWCm9nyBpjVRrwpk5PDm79fXi+kYBfg1Cne4fsPklLpZkDIIL2Ahfh s5cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WccspPnEbBcrRpc7tjCLxW0vQshJEtnsN0ZPyzTWo8s=; b=A8R+A0R/Cgv/F3xykoambOn28X6BRQ4Zmuhey8mthPKincIzGDfDvUooJ+yv100R8v SnnHqLtZkIKNV7TDIEVQ449Q7mWwwqY7gOHYF/lwIr4QFKPEAf9wdscgEYqhcb1GAs/e Vxl5aDbuAQ2ZT8fcRssIzwMuO6e1PgNy6/rd9zS9NhWmYrVRfmsCK0w7ENrvNWpyLAGW Q/jOIfz6RSkEyPT2FEyqTYxkru/HBL/ywVa4g06OZq8/uQUGlHP4L4EbsoZqsWxNW/SW 7AQIM3OE53N1gmkKGIIyQkR0Eg7N8fpVQgb5qnkN9nj3oFbmcHNmAwowC4yLNjHXwQkD sZKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=n5FsccVK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b0050aad8e18a5si10961777pgq.545.2023.04.24.06.15.16; Mon, 24 Apr 2023 06:15:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=n5FsccVK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231859AbjDXNJZ (ORCPT + 99 others); Mon, 24 Apr 2023 09:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231756AbjDXNJX (ORCPT ); Mon, 24 Apr 2023 09:09:23 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3CC468A; Mon, 24 Apr 2023 06:08:43 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4ec94eb6dcaso4714322e87.3; Mon, 24 Apr 2023 06:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682341719; x=1684933719; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WccspPnEbBcrRpc7tjCLxW0vQshJEtnsN0ZPyzTWo8s=; b=n5FsccVK9Gn0Byub+ajDaMLf5X4ddamnxRfGaS+uTlD1AoOubwB4OqDFyKPp5P9cox wAUPqBReZqvZhhKOiQ34hC1U8J/pdNEuwga8biSNFc7GPvizMvSj3Z5G04TwIuWYAHsC 3QTfd36UJ/Nnq5TBaXwOKLJcsrwaxq+al08L3Z/yU/d65nZ+kp7mGjMhY5zi2vcGbnCk xUSGSpx6POzPb9gMGXsi/pVrT+lDPh2DmNMaLaRmT0lx2qhNRu5vy105baH2/6lCmQK1 spgWYRbUAP3XCK0wg9CfDvnpP0WC/qSWRTeuSonh1Y6izA4JvKSLHcs5NB/qXaX/D4nw gZ6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682341719; x=1684933719; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WccspPnEbBcrRpc7tjCLxW0vQshJEtnsN0ZPyzTWo8s=; b=Y7+d1IeO/8IeiJpDlD1Y4P76cykXlP0Fuvu/BY6j/7XYG+XzWCXOvhwQQqXyzh/C3o /HkUxeWZC2Usej2/MswGKTf9H/G8fQwX1bBzFOXTdBMl3Fe+THIMUghZ/VzTm7tI5id1 X0z/qZDfDSg1dHGU5Z1X5SZ9tf8ZnSAh+xKcvKlOgR+Fg4Qj+I/tPDrinmVRrIqruqua 5kDk31/bFJ3DU98xtevCZRVF36FHFc8sS0w97X2zI2Znbc44t/NJcU56C4CPfw71x+SE D7wX3GZvkSJ8bP7coqayXiyGPWz79zHTCrttjmjcqvBuN95KdfVla/OeJ1avI3UxccGx tYAg== X-Gm-Message-State: AAQBX9flE6WB0syfo7R0cQT7y9la8DcDu5s4C14pfpHsPZ3zIDe5yvXC 3UTlNXkTtpuZXLoHWDur7Qw= X-Received: by 2002:ac2:4c30:0:b0:4eb:1158:b24c with SMTP id u16-20020ac24c30000000b004eb1158b24cmr2758085lfq.44.1682341719665; Mon, 24 Apr 2023 06:08:39 -0700 (PDT) Received: from fedora (62-78-225-252.bb.dnainternet.fi. [62.78.225.252]) by smtp.gmail.com with ESMTPSA id v25-20020a056512049900b004eff32d6a21sm291447lfq.121.2023.04.24.06.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 06:08:38 -0700 (PDT) Date: Mon, 24 Apr 2023 16:08:35 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Matti Vaittinen , Andy Shevchenko , Zhigang Shi , Shreeya Patel , Paul Gazzillo , Dmitry Osipenko , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] iio: kx022a: Use new iio_validate_own_trigger() Message-ID: <0a8336feba8ccd3a8c71595b85cec36b9ef7b270.1682340947.git.mazziesaccount@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764063580910306919?= X-GMAIL-MSGID: =?utf-8?q?1764063580910306919?= The new generic iio_validate_own_trigger() can be used as validate_trigger callback for verifying the used trigger belongs to same device as the iio_dev. Use the generic function instead of rolling own one. Signed-off-by: Matti Vaittinen --- Revision history v2: New patch --- drivers/iio/accel/kionix-kx022a.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c index f98393d74666..09814881f513 100644 --- a/drivers/iio/accel/kionix-kx022a.c +++ b/drivers/iio/accel/kionix-kx022a.c @@ -516,17 +516,6 @@ static int kx022a_read_raw(struct iio_dev *idev, return -EINVAL; }; -static int kx022a_validate_trigger(struct iio_dev *idev, - struct iio_trigger *trig) -{ - struct kx022a_data *data = iio_priv(idev); - - if (data->trig != trig) - return -EINVAL; - - return 0; -} - static int kx022a_set_watermark(struct iio_dev *idev, unsigned int val) { struct kx022a_data *data = iio_priv(idev); @@ -725,7 +714,7 @@ static const struct iio_info kx022a_info = { .write_raw = &kx022a_write_raw, .read_avail = &kx022a_read_avail, - .validate_trigger = kx022a_validate_trigger, + .validate_trigger = iio_validate_own_trigger, .hwfifo_set_watermark = kx022a_set_watermark, .hwfifo_flush_to_buffer = kx022a_fifo_flush, };