Message ID | bd84fc17e9d22eab998bf48720297f9a77689f45.1677761379.git.mehdi.djait.k@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4228309wrd; Thu, 2 Mar 2023 05:16:34 -0800 (PST) X-Google-Smtp-Source: AK7set8Q96DATdxp23TdXiR6t9AILecCb5PMDGn3ph02jz2GEsDCut1oTIbgRTe2m+iCi7V9EssD X-Received: by 2002:a17:90b:3ec1:b0:237:ae7c:15b9 with SMTP id rm1-20020a17090b3ec100b00237ae7c15b9mr11724359pjb.36.1677762993793; Thu, 02 Mar 2023 05:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677762993; cv=none; d=google.com; s=arc-20160816; b=lR0OvNa4a2PV+7axHu+Lt2eekxOgPp4YMXDvQdxt809w4fdsf29vTYMZmD2CyV+2LB 6pDrJJn9yyUPo1XdOgSSuV0KHWZe6eY/Q5RALSE5pkxurFd7TmS6sDmOQZmqm39o0IpM +1LJ3IBIvlRyBdyOcvGglh1iaqmIA9kHr7KDa7qqwiNCDdHNQUxtUnFsH7ZlPk8ZvVry LNc6l++KQ4s7UTg7nGtzNf/MTP8xxHB4/Q5I/upTXbk6EoLXfWcx5o13qOdnyYDpAvi4 Nhn4ShCqX6s3u+g6wPJzfHZxe8NN4F2tothQVogKDI8sgkJ1GKgSJCwE5GsUIXUs4C3r 0GSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RzkzX1RgURPfixBUIM5rPRAXQ0wme5cmqoYe05Kozgg=; b=Y4JPRj6UPnl74xVv/ERMGmzQcn4klsKzR39+iEMw1IwQR4romjRvSGKc/apOfeV1F3 vYmFbjAkwkrdpT4nQUsbVJCeTuSNjK9nr4UlEwNn4Fbzpy7gJCcyXMa89OIl5qy9tfwL ZsXtVUg3jw5WpW3AvNyR6t7nVpqH84MRW7Qas1jlt2rR22Zx4bHUc5rXy4e1jwicIoHr GuAau49OOPZOlvqEKraiSWXVJA00m4HaQw70uprk4M1F2M8Cd48HUwCmWp7HkTfRTGKV FEzV0MEzSsYjoGmw1ZeKEu4OeurUZF/QHew7rYnMGR8q08IDGwEogwad57sKzWFL8r87 0HeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hX/GniBW"; 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 j14-20020a17090a738e00b00233a9c98466si2201011pjg.189.2023.03.02.05.16.17; Thu, 02 Mar 2023 05:16:33 -0800 (PST) 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=20210112 header.b="hX/GniBW"; 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 S230004AbjCBNFe (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Thu, 2 Mar 2023 08:05:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbjCBNFd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Mar 2023 08:05:33 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BF7034F5E; Thu, 2 Mar 2023 05:05:29 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id g3so11828060eda.1; Thu, 02 Mar 2023 05:05:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RzkzX1RgURPfixBUIM5rPRAXQ0wme5cmqoYe05Kozgg=; b=hX/GniBWzMvBnDAlzovo5h0O8iQGQvHl6FYLmuQIxa8sqaI4bnF9VjcBmLWwWwsgnK R7quH4LaPShX3r1dtDB27Ph48mn+AV1Ow3rli3+e+56phry0hVtR2CoZ2BMKs69jMvpX O7isb1vGNbHm2bx3AhZ3Z0m2K9Q+uGd3LgvNIsdI704TN9puJpu3pM4gqyULxf5mhVXY R3XwWXc76l1A+RNhodVVAIwIhf9zdYHcbday/Pfap9EPcqnObntPxkYUwws4rfUBAwxW FQzhwhLWLdtEpkEjtw0JE1EwKAUojXempx06r2vUkEejzitrUlG0h9WuIt1MbyJawFQW yk5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RzkzX1RgURPfixBUIM5rPRAXQ0wme5cmqoYe05Kozgg=; b=wnDr97OcuULc6hhQh0q8V63F3/43aWG/MQYKHohOS9jfXo0y1edGcvFTA3/x7tk3n7 00iITU56Qk2T/uWrPpIEr0fGQTFy5CncN/wbjudumdVrAKjyjR09s15t5Lahjqa7Elcy BIn7mCd5l5i1F3vBTpFpc0FmXkABQ+t9WDr3RG12mpwt4RfkSq5/Z2NzgOkwpUXSw6lL usSuJWvNCi+GmnAMmNVuHlVpbwpwXyYhXdGf50fQMT3ju8E7QwKfanrrveQRYXqqL3RU xPp/rbK3UPH34yek7zLM/rNF/8J0MylN7LKiuNRFkHRGqGd6zj9XhfKjCc4EbSun+aIG XyMQ== X-Gm-Message-State: AO0yUKV9o0yQsoOUsVeCL0Q/hGqJ9Nll8/qPM4PZ4RxJrPiJYjuDCNn7 hpZBPl/6Z5sI16Io99ieyac= X-Received: by 2002:a17:906:2cd3:b0:878:5372:a34b with SMTP id r19-20020a1709062cd300b008785372a34bmr10359533ejr.45.1677762327784; Thu, 02 Mar 2023 05:05:27 -0800 (PST) Received: from carbian.corp.quobyte.com ([2a02:8109:aa3f:ead8::dc02]) by smtp.gmail.com with ESMTPSA id u7-20020a50d507000000b004af759bc79asm6932903edi.7.2023.03.02.05.05.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 05:05:27 -0800 (PST) From: Mehdi Djait <mehdi.djait.k@gmail.com> To: jic23@kernel.org, lars@metafoo.de, andriy.shevchenko@linux.intel.com Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Mehdi Djait <mehdi.djait.k@gmail.com> Subject: [PATCH v2 1/2] iio: Improve the kernel-doc of iio_trigger_poll Date: Thu, 2 Mar 2023 14:04:35 +0100 Message-Id: <bd84fc17e9d22eab998bf48720297f9a77689f45.1677761379.git.mehdi.djait.k@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <cover.1677761379.git.mehdi.djait.k@gmail.com> References: <cover.1677761379.git.mehdi.djait.k@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759262009249086400?= X-GMAIL-MSGID: =?utf-8?q?1759262009249086400?= |
Series |
iio: Add kernel-docs and rename iio_trigger_poll_chained
|
|
Commit Message
Mehdi Djait
March 2, 2023, 1:04 p.m. UTC
Move the kernel-doc of the function to industrialio-trigger.c
Add a note on the context where the function is expected to be called.
Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
---
v2:
- Changed the expected context of from interrupt to hard IRQ context
drivers/iio/industrialio-trigger.c | 7 +++++++
include/linux/iio/trigger.h | 6 ------
2 files changed, 7 insertions(+), 6 deletions(-)
Comments
On Thu, Mar 02, 2023 at 02:04:35PM +0100, Mehdi Djait wrote: > Move the kernel-doc of the function to industrialio-trigger.c > Add a note on the context where the function is expected to be called. ... > v2: > - Changed the expected context of from interrupt to hard IRQ context Thank you for an update. But it seems I messed up with this and my previous remark shouldn't be taken into consideration. The "relevant hardware interrupt handler" may be hard and threaded IRQ context, which looks like your first version was correct. Let's wait for Jonathan opinion on this as he is a native speaker.
Hello Andy, On Thu, Mar 02, 2023 at 05:54:05PM +0200, Andy Shevchenko wrote: > On Thu, Mar 02, 2023 at 02:04:35PM +0100, Mehdi Djait wrote: > > Move the kernel-doc of the function to industrialio-trigger.c > > Add a note on the context where the function is expected to be called. > > ... > > > v2: > > - Changed the expected context of from interrupt to hard IRQ context > > Thank you for an update. > > But it seems I messed up with this and my previous remark shouldn't be > taken into consideration. > > The "relevant hardware interrupt handler" may be hard and threaded IRQ context, > which looks like your first version was correct. > > Let's wait for Jonathan opinion on this as he is a native speaker. If I understood the function correctly I think you were right. It should be hard IRQ context The relevant functions calls: iio_trigger_poll --> generic_handle_irq --> handle_irq_desc handle_irq_desc: returns Operation not permitted if !in_hardirq() && handle_enforce_irqctx and it is the reason why the sysfs trigger uses the irq_framework to call iio_trigger_poll from hard IRQ context [1][2] [1] https://lwn.net/Articles/411605/ [2] https://lore.kernel.org/all/1346922337-17088-1-git-send-email-lars@metafoo.de/ -- Kind Regards Mehdi Djait
On Thu, Mar 02, 2023 at 05:18:14PM +0100, Mehdi Djait wrote: > On Thu, Mar 02, 2023 at 05:54:05PM +0200, Andy Shevchenko wrote: > > On Thu, Mar 02, 2023 at 02:04:35PM +0100, Mehdi Djait wrote: > > > Move the kernel-doc of the function to industrialio-trigger.c > > > Add a note on the context where the function is expected to be called. ... > > > v2: > > > - Changed the expected context of from interrupt to hard IRQ context > > > > Thank you for an update. > > > > But it seems I messed up with this and my previous remark shouldn't be > > taken into consideration. > > > > The "relevant hardware interrupt handler" may be hard and threaded IRQ context, > > which looks like your first version was correct. > > > > Let's wait for Jonathan opinion on this as he is a native speaker. > > If I understood the function correctly I think you were right. It should > be hard IRQ context > > The relevant functions calls: > iio_trigger_poll --> generic_handle_irq --> handle_irq_desc > > handle_irq_desc: returns Operation not permitted if !in_hardirq() && handle_enforce_irqctx > and it is the reason why the sysfs trigger uses the irq_framework to call iio_trigger_poll > from hard IRQ context [1][2] Cool, thank you for elaboration! In any case it's up to Jonathan now what to do. With your explanation it seems correct to phrase as you did in v2. Hence, Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > [1] https://lwn.net/Articles/411605/ > [2] https://lore.kernel.org/all/1346922337-17088-1-git-send-email-lars@metafoo.de/
On Thu, 2 Mar 2023 18:23:23 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Thu, Mar 02, 2023 at 05:18:14PM +0100, Mehdi Djait wrote: > > On Thu, Mar 02, 2023 at 05:54:05PM +0200, Andy Shevchenko wrote: > > > On Thu, Mar 02, 2023 at 02:04:35PM +0100, Mehdi Djait wrote: > > > > Move the kernel-doc of the function to industrialio-trigger.c > > > > Add a note on the context where the function is expected to be called. > > ... > > > > > v2: > > > > - Changed the expected context of from interrupt to hard IRQ context > > > > > > Thank you for an update. > > > > > > But it seems I messed up with this and my previous remark shouldn't be > > > taken into consideration. > > > > > > The "relevant hardware interrupt handler" may be hard and threaded IRQ context, > > > which looks like your first version was correct. > > > > > > Let's wait for Jonathan opinion on this as he is a native speaker. > > > > If I understood the function correctly I think you were right. It should > > be hard IRQ context > > > > The relevant functions calls: > > iio_trigger_poll --> generic_handle_irq --> handle_irq_desc > > > > handle_irq_desc: returns Operation not permitted if !in_hardirq() && handle_enforce_irqctx > > and it is the reason why the sysfs trigger uses the irq_framework to call iio_trigger_poll > > from hard IRQ context [1][2] > > Cool, thank you for elaboration! > > In any case it's up to Jonathan now what to do. With your explanation it seems > correct to phrase as you did in v2. Hence, > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> It is indeed hard interrupt context that matters here so I'm fine with this version. Though I'm going to tweak it to drop the empty line at the end of the comment block whilst applying it. Thanks, Jonathan > > > [1] https://lwn.net/Articles/411605/ > > [2] https://lore.kernel.org/all/1346922337-17088-1-git-send-email-lars@metafoo.de/ >
On Thu, 2 Mar 2023 14:04:35 +0100 Mehdi Djait <mehdi.djait.k@gmail.com> wrote: > Move the kernel-doc of the function to industrialio-trigger.c > Add a note on the context where the function is expected to be called. > > Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com> > --- > v2: > - Changed the expected context of from interrupt to hard IRQ context > > drivers/iio/industrialio-trigger.c | 7 +++++++ > include/linux/iio/trigger.h | 6 ------ > 2 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c > index a2f3cc2f65ef..bb0a44df8740 100644 > --- a/drivers/iio/industrialio-trigger.c > +++ b/drivers/iio/industrialio-trigger.c > @@ -192,6 +192,13 @@ static void iio_trigger_notify_done_atomic(struct iio_trigger *trig) > schedule_work(&trig->reenable_work); > } > > +/** > + * iio_trigger_poll() - Call the IRQ trigger handler of the consumers > + * @trig: trigger which occurred > + * > + * This function needs to be called from a hard IRQ context. I tweaked this to drop the line below and to say This function should only be called from a hard IRQ context. Fun subtlety of English that reminds me of the sign on the London underground escalators that said "Guide dogs must be carried" thus apparently limiting their use to people who could find a guide dog to carry. Here we don't want to oblige all code to call the function :) > + * > + */ > void iio_trigger_poll(struct iio_trigger *trig) > { > int i; > diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h > index f6360d9a492d..42da55dc3aa7 100644 > --- a/include/linux/iio/trigger.h > +++ b/include/linux/iio/trigger.h > @@ -151,12 +151,6 @@ void iio_trigger_unregister(struct iio_trigger *trig_info); > **/ > int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *trig); > > -/** > - * iio_trigger_poll() - called on a trigger occurring > - * @trig: trigger which occurred > - * > - * Typically called in relevant hardware interrupt handler. > - **/ > void iio_trigger_poll(struct iio_trigger *trig); > void iio_trigger_poll_chained(struct iio_trigger *trig); >
On Sat, Mar 04, 2023 at 04:46:01PM +0000, Jonathan Cameron wrote: > On Thu, 2 Mar 2023 14:04:35 +0100 > Mehdi Djait <mehdi.djait.k@gmail.com> wrote: > > > Move the kernel-doc of the function to industrialio-trigger.c > > Add a note on the context where the function is expected to be called. > > > > Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com> > > --- > > v2: > > - Changed the expected context of from interrupt to hard IRQ context > > > > drivers/iio/industrialio-trigger.c | 7 +++++++ > > include/linux/iio/trigger.h | 6 ------ > > 2 files changed, 7 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c > > index a2f3cc2f65ef..bb0a44df8740 100644 > > --- a/drivers/iio/industrialio-trigger.c > > +++ b/drivers/iio/industrialio-trigger.c > > @@ -192,6 +192,13 @@ static void iio_trigger_notify_done_atomic(struct iio_trigger *trig) > > schedule_work(&trig->reenable_work); > > } > > > > +/** > > + * iio_trigger_poll() - Call the IRQ trigger handler of the consumers > > + * @trig: trigger which occurred > > + * > > + * This function needs to be called from a hard IRQ context. > I tweaked this to drop the line below and to say > This function should only be called from a hard IRQ context. > > Fun subtlety of English that reminds me of the sign on the London underground > escalators that said "Guide dogs must be carried" thus apparently limiting > their use to people who could find a guide dog to carry. > > Here we don't want to oblige all code to call the function :) I was even going for "must be called from hard IRQ context" first :) but then decided that I need more accepted patches before instructing others on what must be done in the kernel :) -- Kind Regards Mehdi Djait
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index a2f3cc2f65ef..bb0a44df8740 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -192,6 +192,13 @@ static void iio_trigger_notify_done_atomic(struct iio_trigger *trig) schedule_work(&trig->reenable_work); } +/** + * iio_trigger_poll() - Call the IRQ trigger handler of the consumers + * @trig: trigger which occurred + * + * This function needs to be called from a hard IRQ context. + * + */ void iio_trigger_poll(struct iio_trigger *trig) { int i; diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index f6360d9a492d..42da55dc3aa7 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -151,12 +151,6 @@ void iio_trigger_unregister(struct iio_trigger *trig_info); **/ int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *trig); -/** - * iio_trigger_poll() - called on a trigger occurring - * @trig: trigger which occurred - * - * Typically called in relevant hardware interrupt handler. - **/ void iio_trigger_poll(struct iio_trigger *trig); void iio_trigger_poll_chained(struct iio_trigger *trig);