Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4410920imu; Tue, 29 Jan 2019 00:46:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN59x+fWQloAqhwn5ARQVnMiqHgxLDJVmJ8PW+tdAJlX7M7nrewObXl3jdLljXLliMD9TncQ X-Received: by 2002:a63:b4c:: with SMTP id a12mr23235950pgl.131.1548751568598; Tue, 29 Jan 2019 00:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548751568; cv=none; d=google.com; s=arc-20160816; b=lK5O+IZN69OggZXtMPX67XZObyX92DrStbpf48jr70r9RZvKJhRMat6NbWoDNwtp+c wB8FX/dTtj2xH64+oMngDQtMHoNMCKXLUw4bUcWsyp6azTC3NDbVsiq6aOdbn8L/htey JDS2bVBFlsnorBLM7MMlf2JlkywJFgtTShey4hB2cZ/PQ0g/pIvhoTbLa96yhgS/pzJ4 yPqMh8OnYVfpwAXnyTJ+bZc8cIyG+1PGXYJ9mNdh3jv1yb4kn7R6TEhMwjAUnGhCJAeu Y3xHZ9orUnaU01GgAdnO3XUrMBwEHcK8PAYlQrlV0FFOCsk+YMMPJ7fUJm6sn7j5KAjj ZEuQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=TqGNmy9KB5gLgteplp8cLO+81L5bqfpDnlHvZNRtc6U=; b=YABq560P3ETfhLKwT7qqwWKaI6ZZpxgkKJGg0fUe8UzU7OiSrTGkbqQVxQqGnrEHdK eAnIhSZw/dXJ8zLIeGSa3dnSsnNCPxJok8cfz6zprFs6yJ2MAWLNw/vusGasl5+2QPau 3Nc9rGxco0AtE7+m59RXNiKU59jzcZcEuH46I9bVZHSK6GwN16Bn0Ng8+KwBfRe2Mdx/ ihbl5Q1fGvsadmjWM9gGpGPazzHL+oQRRNKw86OVhzEe8Tr/j44Hf/9GKKCynxbFsYBh EsaXthfeeX+qonFm1RLbXcd3L575EQ1wY4GvrNLz2YXN6l95uIa2xz0M/YLO9SzsMpJR WI9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=DAxMWgGo; 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 u129si34682695pfu.117.2019.01.29.00.45.53; Tue, 29 Jan 2019 00:46:08 -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; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=DAxMWgGo; 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 S1727909AbfA2IoV (ORCPT + 99 others); Tue, 29 Jan 2019 03:44:21 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35156 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727889AbfA2IoU (ORCPT ); Tue, 29 Jan 2019 03:44:20 -0500 Received: by mail-wr1-f65.google.com with SMTP id 96so21066760wrb.2 for ; Tue, 29 Jan 2019 00:44:19 -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=TqGNmy9KB5gLgteplp8cLO+81L5bqfpDnlHvZNRtc6U=; b=DAxMWgGoqh7e4ZLwfMBAsM7bnjdW2ROqq9rOCDdlvxXUK9ohTypfFfYKtp8llxfi2u HjWg1wb57zn35jBjplwuX64Dl8MJ2UDoDwkdxcxvePQDq4ufFjwcPOqV7L+8bC+x3GIv 8MjbpkdzT04E6uSlZdyXwm2LznPYlMKpcy2fAUA35fMKqoubIfisB392N5gMJL24vmlH opDm+a7UFTTokQ/0ZAbHygT/SoiAo+VKltpQ9konMI5CFX6v5lTeUiciKgHmS6qEUonV V6yAvQczW5FqgQp7mS+Z+XRamSH5uJAsj2/2R7iNBYJZ+eMiaXOTKimw2+zvQk7hTVMy +TUw== 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=TqGNmy9KB5gLgteplp8cLO+81L5bqfpDnlHvZNRtc6U=; b=kTAoXpFgduMy48naIyu8h6gK7aOJCTcsJ8SNgbxM13iQpJHGzHJLXcXBejxu6bdT46 Y+/qMCgONRhUBZT6d4rMmYuAuL/Zlvf2FKH3llROT0OuXfI92IsGSDZgPauO6/2w/oqJ foO+664wmohGyGbhcyxg7est2Y+OWLuovKWVYoLjDn5E5uBGEh5MmJPxt6c8gVg3+0dj SBt7/oisHOe/GJjVnor3BH54rSZWms32uy6bPa/4aH3oNfWdaSnvXc8Fk2rw2Tc92qTC coLd0N2N8c2MEJvNlclz5OelxLXEiQSBwPVyYW2wAiLsJ/V8UNuBEKOLVIe5l4gXgqCv eTTA== X-Gm-Message-State: AJcUukeiJ7u4rqKvAcppq7UfvpYoxeJoIujNeIwNUjIEGCwtoOHnRpf4 41Bl7h5Y2/SKvzDjpCZt8LGZOA== X-Received: by 2002:adf:f691:: with SMTP id v17mr24060162wrp.114.1548751458361; Tue, 29 Jan 2019 00:44:18 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c1sm3979319wmb.14.2019.01.29.00.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 00:44:17 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Thomas Gleixner , Marc Zyngier , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 0/9] gpio: mockup: improve the user-space testing interface Date: Tue, 29 Jan 2019 09:44:02 +0100 Message-Id: <20190129084411.30495-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski This series aims at reworking the gpio-mockup debugfs interface. The reason for that is the fact that certain known problems with this testing module exist and the user-space tests are broken anyway after 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). The first three patches improve the interrupt simulator. The first one makes the struct irq_chip part of the irq_sim structure so that we can support multiple instances at once. The second delegates the irq number mapping to the irq domain subsystem. The third patch provides a helper that will allow users to specify the type of the fired interrupt so that the configuration set by the set_type() callback can be taken into account. Next six patches improve the gpio-mockup module. Patches 4-5 have been reviewed before but missed the last merge window. Patch 6 is there because we're already breaking the debugfs interface anyway and it removes a link that has no users. Patches 7-8 are minor tweaks. Last patch introduces a rework of the debugfs interface. With this change each mockup chip is represented by a directory named after the chip's device name under /gpio-mockup/. Each line is represented by a file using the line's offset as the name under the chip's directory. Reading from the line's file yields the current *value*, writing to the line's file changes the current "pull". Default pull for mockup lines is down. More info on that can be found in the comment added by this change to the gpio-mockup code. This is somewhat inspired by the idea of the gpio-simulator by Uwe Kleine-König except that I strongly belive that when testing certain user API code paths we should not be using the same paths for verification. That's why there's a separate interface (debugfs) sharing as little as possible with the character device that allows to check if various operations (reading and setting values, events) work as expected instead of two connected dummy chips sharing the same interface. If accepted this will of course require major modification of user-space tests in libgpiod once upstream. v1 -> v2: - instead of providing the irq_sim_get_type() helper, move the irq type logic into the simulator and provide a helper that allows users to specify the type of the fired interrupt Bartosz Golaszewski (9): irq/irq_sim: don't share the irq_chip structure between simulators irq/irq_sim: use irq domain irq/irq_sim: provide irq_sim_fire_type() gpio: mockup: add locking gpio: mockup: implement get_multiple() gpio: mockup: don't create the debugfs link named after the label gpio: mockup: change the type of 'offset' to unsigned int gpio: mockup: change the signature of unlocked get/set helpers gpio: mockup: rework debugfs interface drivers/gpio/gpio-mockup.c | 185 +++++++++++++++++++++++++++++++------ include/linux/irq_sim.h | 17 +++- kernel/irq/irq_sim.c | 126 ++++++++++++++++++------- 3 files changed, 263 insertions(+), 65 deletions(-) -- 2.19.1