Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1100710imu; Tue, 20 Nov 2018 11:41:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wj92R0QqPyEzBjEMlAm2tTXRtA9XB8yoOdyUliQgDH5ISgvzqalOTwZJ1FsCLxp62Ozma/ X-Received: by 2002:a17:902:7c82:: with SMTP id y2mr3520082pll.33.1542742919772; Tue, 20 Nov 2018 11:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542742919; cv=none; d=google.com; s=arc-20160816; b=wqTWXIZiXRSy+pDNrUQlLtrkTuF3H3CK6rQ0lg5RBzW0l3P1WZVZUyU0roobXz6Yh8 wmSibEdmsXwwp3USIeySYXUKSDYY+416aY9+q+TdQaacNRofX7i0PhKF5qiTEjY9eese mNk2VgdS6MelXHBlBunQOrMA0X8zm6Fto7YzT47a2VtiNZI3GuxDa2rqheHpGoNZA1NX uTIdbUrHANBx5aJxactO5sJAY631mEj6vtMbrUv0wyde2QbFN4NlRSSzul4mXLEr8W9o AtVKVztEYU5Qj8ZToXLOb7fh8VkD70cSCTrkrh/pIyXJIlZ8uROA3snnNvF3G6wmx4F8 vTvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ypCLNi0FQyU6VRiEbjyz1IodJFFnGCHn97w/MVzsmZY=; b=qFzMtXL4LurFdp20qbBtnHpOKWz9qzEtb0g1qdJCkJ7owBh7620UYom2uwnD/vE39/ fdOF5cFqRvdjeDqB+oQamJcewnu/F0Z1fySnndzNQs/or8ypJtw40QVBmKU+rOIezLFA slx/j0VzoRj+OlLBvP5S9Jg1AJ4JNLB60m9cgYRQKvQIoGskVmwFWg9GBCg9AgT+wJk5 T/810kMoUjtWjTOLJsckEaZj83RhPHK4UsHx2LVg6ryAlDIAV4wMUAnGeItOkAjZjHSv ijHc5D57R2DxD6znQZ9mKTeQImsZwMwIxkzvttLnoGvLayxQZgxzRob8tX5uo2D/pdqb DztA== 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 o14si10992150pgi.134.2018.11.20.11.41.44; Tue, 20 Nov 2018 11:41:59 -0800 (PST) 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 S1730342AbeKUDr6 (ORCPT + 99 others); Tue, 20 Nov 2018 22:47:58 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:54701 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbeKUDr6 (ORCPT ); Tue, 20 Nov 2018 22:47:58 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gP9eh-0006uK-Ff; Tue, 20 Nov 2018 18:17:43 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gP9eh-00005D-0Q; Tue, 20 Nov 2018 18:17:43 +0100 Date: Tue, 20 Nov 2018 18:17:42 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Bartosz Golaszewski Cc: Thomas Gleixner , Linus Walleij , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH 1/2] irq/irq_sim: provide irq_sim_fire_edge() Message-ID: <20181120171742.gkwb4s4qbcqvnefj@pengutronix.de> References: <20181120134032.31645-1-brgl@bgdev.pl> <20181120134032.31645-2-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181120134032.31645-2-brgl@bgdev.pl> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 02:40:31PM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > The irq_sim irqchip doesn't allow to configure the sensitivity so every > call to irq_sim_fire() fires a dummy interrupt. This used to not matter > for gpio-mockup (one of the irq_sim users) until commit fa38869b0161 > ("gpiolib: Don't support irq sharing for userspace") which made it > impossible for gpio-mockup to ignore certain events (e.g. only receive > notifications about rising edge events). > > Introduce a specialized variant of irq_sim_fire() which takes another > argument called edge. allowing to specify the trigger type for the > dummy interrupt. I wonder if it's worth the effort to fix irq_sim. If you take a look in my gpio-simulator patch, it is trivial to get it right without external help with an amount of code that is usual for a driver that handles irqs. > @@ -161,12 +171,28 @@ EXPORT_SYMBOL_GPL(devm_irq_sim_init); > */ > void irq_sim_fire(struct irq_sim *sim, unsigned int offset) > { > - if (sim->irqs[offset].enabled) { > + /* Don't care about the edge. */ > + irq_sim_fire_edge(sim, offset, IRQ_TYPE_EDGE_BOTH); Conceptually irq_sim_fire_edge should be defined above irq_sim_fire. > +EXPORT_SYMBOL_GPL(irq_sim_fire); > + > +/** > + * irq_sim_fire_edge - Enqueue an interrupt, specify the edge. > + * > + * @sim: The interrupt simulator object. > + * @offset: Offset of the simulated interrupt which should be fired. > + * edge: Edge of the interrupt (IRQ_TYPE_EDGE_RISING/FALLING). > + */ > +void irq_sim_fire_edge(struct irq_sim *sim, unsigned int offset, int edge) > +{ > + struct irq_sim_irq_ctx *irq = &sim->irqs[offset]; > + > + if (irq->enabled && (irq->edge & edge)) { > set_bit(offset, sim->work_ctx.pending); > irq_work_queue(&sim->work_ctx.work); > } > } > -EXPORT_SYMBOL_GPL(irq_sim_fire); > +EXPORT_SYMBOL_GPL(irq_sim_fire_edge); Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |