Message ID | 20200211131240.15853-1-brgl@bgdev.pl |
---|---|
Headers | show
Return-Path: <SRS0=TFca=37=vger.kernel.org=linux-gpio-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6B05C3B186 for <linux-gpio@archiver.kernel.org>; Tue, 11 Feb 2020 13:13:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B516F20870 for <linux-gpio@archiver.kernel.org>; Tue, 11 Feb 2020 13:13:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="GWfuVkDE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729043AbgBKNNC (ORCPT <rfc822; linux-gpio@archiver.kernel.org>); Tue, 11 Feb 2020 08:13:02 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38623 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728697AbgBKNNC (ORCPT <rfc822; linux-gpio@vger.kernel.org>); Tue, 11 Feb 2020 08:13:02 -0500 Received: by mail-wr1-f68.google.com with SMTP id y17so12314915wrh.5 for <linux-gpio@vger.kernel.org>; Tue, 11 Feb 2020 05:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=be2U1w8cWMwS1znOLLGvyu9gD3io+mzqfXIBluHdiTA=; b=GWfuVkDEtXOKWb5CKYVmrPobVMV94DGgOuRHpsqw2XWeoGhMbdxDxumKlK9Op5DeDf xN5P/aLKYPIW0lEAyt2mJCnBPsvzDGf1yt2NQ9KLtf4Qn0QjL67LUup7M21qw9ezHC9s 7x1iOjCYu7lcLVLRSaHSTmL/fQF4ppIeaxJfYT7EtAHMYIb+Ks62eYtXQeMsGx4goji2 273sZ3Bk1Yp//t6wamQJa2QMN559SRkp4uplHKlxyE6ghi7OL49znMiHs4fwNXiz51q8 Gj7wusjiQmpRgseNqAXkIQvaWRFnMNDBPUxn6Qs2ct2BTCMuymaDWbnqaYhsn8a/QaNr onbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=be2U1w8cWMwS1znOLLGvyu9gD3io+mzqfXIBluHdiTA=; b=tehAofvcxa+t/n+Ho6uaYXA0bsQTKEZ0TtV69f3OmM3TO43BsvcaMUGYBbt6cHs144 /K0EmmKMIypSX9IGDn1GIoaGSgogGfkdbP1I6svjyze4b5W/ctfJz8xwXZhJp+SmjACC lKaZo9+QSiQNFh0EG3W9A6OnH43ILpmCp2EfcWji8/jf5/E/Fbe1rxBQoVq10DjnsDX1 1wPWdoeMVU+GOf6XXXfaVeCOcfmA8LppXm8mEYnASTII3R9JC+TP9xA6/X4te33hRg0S 9RaRsGjt4/xOIwOV3+vFbB+/PZhbeslJ2nDVbCBTzRoi4WwMzk1DjZoGhC4vzh6OEd6U n+sA== X-Gm-Message-State: APjAAAWrwI5U/PDFvhjtH0MO7y6X+1bnnXQp6Bw0Nuo6gWL19kvHwaaw GyR08T4hXZHGkI6KTGXb4aeadQ== X-Google-Smtp-Source: APXvYqzpLaJmI7tDPA2tDGvz6dBZ9VXm3sif/kYnoWcVrXtWSXV8CQS0YhFVElrGpct/CZfo4eHAnQ== X-Received: by 2002:adf:f581:: with SMTP id f1mr8638594wro.264.1581426778842; Tue, 11 Feb 2020 05:12:58 -0800 (PST) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id b21sm3873013wmd.37.2020.02.11.05.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 05:12:58 -0800 (PST) From: Bartosz Golaszewski <brgl@bgdev.pl> To: Linus Walleij <linus.walleij@linaro.org>, Jonathan Cameron <jic23@kernel.org>, Hartmut Knaack <knaack.h@gmx.de>, Lars-Peter Clausen <lars@metafoo.de>, Peter Meerwald-Stadler <pmeerw@pmeerw.net>, Thomas Gleixner <tglx@linutronix.de>, Jason Cooper <jason@lakedaemon.net>, Marc Zyngier <maz@kernel.org> Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Bartosz Golaszewski <bgolaszewski@baylibre.com> Subject: [PATCH v2 0/6] irq/irq_sim: try to improve the API Date: Tue, 11 Feb 2020 14:12:34 +0100 Message-Id: <20200211131240.15853-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: <linux-gpio.vger.kernel.org> X-Mailing-List: linux-gpio@vger.kernel.org |
Series |
irq/irq_sim: try to improve the API
|
expand
|
From: Bartosz Golaszewski <bgolaszewski@baylibre.com> This is my second take at improving the interrupt simulator interface. I marked it as v2 but it actually takes a completely different approach. The interrupt simulator API exposes a lot of custom data structures and functions and doesn't reuse the interfaces already exposed by the irq subsystem. This series tries to address it. First, we make irq_domain_reset_irq_data() available to non-V2 domain API users - that'll be used in the subsequent patch. Next we overhaul the public interfaces - we hide all specific data structures and instead rely on the irq_domain struct and virtual interrupt numberspace. Next four patches simplify the interface even more, but since the change may be a bit more controversial due to modification of the irq_domain I decided to split them out of the second patch. In patch 3/6 we're adding a new callback to irq_domain_ops that is called right before all the other code in irq_domain_remove(). Next we use it to remove the simulator-specific cleanup function from irq_sim.h - users now can simply use the regular irq_domain_remove(). Last two patches show that the new callback isn't limited to the interrupt simulator and can be used to shrink code in real driver too. We introduce a new helper for a common use case of disposing of all mappings before removing the irq_domain and use it in the keystone irqchip driver. The end effect is that we limit the interrupt simulator API to two functions (plus one device managed variant) and zero new structures. v1: https://lkml.org/lkml/2019/8/12/558 v1 -> v2: - instead of just making the new data structures opaque for users, remove them entirely in favor of irq_domain - call irq_set_handler() & irq_domain_reset_irq_data() when unmapping the simulated interrupt - fix a memory leak in error path - make it possible to use irq_find_matching_fwnode() with the simulator domain - correctly use irq_create_mapping() and irq_find_mapping(): only use the former at init-time and the latter at interrupt-time Bartosz Golaszewski (6): irq: make irq_domain_reset_irq_data() available even for non-V2 users irq/irq_sim: simplify the API irq/domain: add a new callback to domain ops irq/irq_sim: remove irq_domain_remove_sim() irq/domain: provide irq_domain_dispose_mappings() helper irqchip: keystone: use irq_domain_dispose_mappings() drivers/gpio/gpio-mockup.c | 47 ++++-- drivers/iio/dummy/iio_dummy_evgen.c | 32 ++-- drivers/irqchip/irq-keystone.c | 5 +- include/linux/irq_sim.h | 33 ++-- include/linux/irqdomain.h | 9 +- kernel/irq/Kconfig | 1 + kernel/irq/irq_sim.c | 225 ++++++++++++++++------------ kernel/irq/irqdomain.c | 44 ++++-- 8 files changed, 238 insertions(+), 158 deletions(-)