get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2217398/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2217398,
    "url": "http://patchwork.ozlabs.org/api/patches/2217398/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20260328-mips-input-rb532-button-v1-1-98e201621501@kernel.org/",
    "project": {
        "id": 3,
        "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api",
        "name": "Linux MTD development",
        "link_name": "linux-mtd",
        "list_id": "linux-mtd.lists.infradead.org",
        "list_email": "linux-mtd@lists.infradead.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260328-mips-input-rb532-button-v1-1-98e201621501@kernel.org>",
    "list_archive_url": null,
    "date": "2026-03-28T15:55:47",
    "name": "[1/2] MIPS/input: Move RB532 button to GPIO descriptors",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "76e79482450246b0d9dd09ecb94c451cc6be86da",
    "submitter": {
        "id": 92050,
        "url": "http://patchwork.ozlabs.org/api/people/92050/?format=api",
        "name": "Linus Walleij",
        "email": "linusw@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20260328-mips-input-rb532-button-v1-1-98e201621501@kernel.org/mbox/",
    "series": [
        {
            "id": 497875,
            "url": "http://patchwork.ozlabs.org/api/series/497875/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/list/?series=497875",
            "date": "2026-03-28T15:55:46",
            "name": "MIPS RB532 GPIO descriptor conversion",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/497875/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2217398/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217398/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Wvf6GaDE;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=tpFKCaCb;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fjhvH0Gh7z1yGQ\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 29 Mar 2026 02:56:07 +1100 (AEDT)",
            "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w6W10-000000095Uh-3RHW;\n\tSat, 28 Mar 2026 15:55:58 +0000",
            "from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w6W0x-000000095UB-1rQv\n\tfor linux-mtd@lists.infradead.org;\n\tSat, 28 Mar 2026 15:55:55 +0000",
            "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id 44BD1600AC;\n\tSat, 28 Mar 2026 15:55:54 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id E2E16C2BCB1;\n\tSat, 28 Mar 2026 15:55:51 +0000 (UTC)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id\n\t:MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=peQNdrexbNt56SBjvEB27ekjhcnoBgDL+5oaJH3UzGE=; b=Wvf6GaDEsCPSGX\n\t3toV+QhKjCdXVocS8b8xkyQdapWIlFvkgr3W3pd9xY0j4ftDCeHLlGTX9vdpXE/BSsVXDXTTF0xxW\n\tZbBjeszCs6Fr5BnTNrFAh+iTiItZwGYzwv4FMPYzhO/v/c+cwtogIu9VlfkkRc/etm8Lr1mIzCYvo\n\tGWSR2nGlLRCwkB1CUuE1QM5baKON1KwruMLwojf7Tji7vf/hRM/l5liANnuGBFBD9LsSlalJfnZZj\n\tINoV56lf5yMBpGLDIPINnHGHwo9K9XFoe40rMCL7Gt6X4+XZRn1KZzeY2JtiDBZmFfhyd5wl9FoG1\n\tG1mefzYacow2s7ZKXipw==;",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774713354;\n\tbh=43UWjfwmGTJsvatojEzQ6a+djIbk4+udgzPTzi5vJy0=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=tpFKCaCbTTyDGqXi3yWG6BVj5ObYU89fGMLU9/IJtb5tNISlKPrfcj+GpsGSDNxNR\n\t rT9HTpLkzPGWCydC0sCHje+KrvUXRm3fXOh1XUqmUFCMjvrHimJQzGNR8+0MZR7mdg\n\t 1xFEAhAC0gmMNCq8gXsccRa5Up6bZDAjyil4NKJtvrCBC2seVnlh7R1ThCTIpf6D/U\n\t FsTBBuhRTlrJ+WttXdcghPWrBYJlWVLbCvvJ9iWdv7Wul2VT/j3s6WWR/DT44rjqmo\n\t hgtZWEJVYsTEhZIDPHa8wM8OAh9jnxYHENmFEuKNBGJFefSXFa2aJGV+cLWCMWwDHG\n\t CQkOdY0ISBqHw=="
        ],
        "From": "Linus Walleij <linusw@kernel.org>",
        "Date": "Sat, 28 Mar 2026 16:55:47 +0100",
        "Subject": "[PATCH 1/2] MIPS/input: Move RB532 button to GPIO descriptors",
        "MIME-Version": "1.0",
        "Message-Id": "<20260328-mips-input-rb532-button-v1-1-98e201621501@kernel.org>",
        "References": "<20260328-mips-input-rb532-button-v1-0-98e201621501@kernel.org>",
        "In-Reply-To": "<20260328-mips-input-rb532-button-v1-0-98e201621501@kernel.org>",
        "To": "Thomas Bogendoerfer <tsbogend@alpha.franken.de>,\n Dmitry Torokhov <dmitry.torokhov@gmail.com>,\n Bartosz Golaszewski <brgl@kernel.org>,\n Miquel Raynal <miquel.raynal@bootlin.com>,\n Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>",
        "Cc": "linux-mips@vger.kernel.org, linux-input@vger.kernel.org,\n linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org,\n Linus Walleij <linusw@kernel.org>",
        "X-Mailer": "b4 0.14.3",
        "X-BeenThere": "linux-mtd@lists.infradead.org",
        "X-Mailman-Version": "2.1.34",
        "Precedence": "list",
        "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>",
        "List-Post": "<mailto:linux-mtd@lists.infradead.org>",
        "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>",
        "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "Convert the Mikrotik RouterBoard RB532 to use GPIO descriptors\nby defining a software node for the GPIO chip, then register\nthe button platform device with full info passing the GPIO\nas a device property.\n\nThis can be used as a base to move more of the RB532 devices\nover to passing GPIOs using device properties.\n\nUse the GPIO_ACTIVE_LOW flag and drop the inversion in the\nrb532_button_pressed() function.\n\nSigned-off-by: Linus Walleij <linusw@kernel.org>\n---\n arch/mips/rb532/devices.c         | 47 +++++++++++++++++++++++++++++++++------\n drivers/input/misc/rb532_button.c | 35 ++++++++++++++++++++++++-----\n 2 files changed, 69 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c\nindex 4f027efbf27b..3f56d9feb73a 100644\n--- a/arch/mips/rb532/devices.c\n+++ b/arch/mips/rb532/devices.c\n@@ -16,8 +16,10 @@\n #include <linux/mtd/mtd.h>\n #include <linux/gpio.h>\n #include <linux/gpio/machine.h>\n+#include <linux/gpio/property.h>\n #include <linux/gpio_keys.h>\n #include <linux/input.h>\n+#include <linux/property.h>\n #include <linux/serial_8250.h>\n \n #include <asm/bootinfo.h>\n@@ -38,6 +40,10 @@ extern unsigned int idt_cpu_freq;\n \n static struct mpmc_device dev3;\n \n+static const struct software_node rb532_gpio0_node = {\n+\t.name = \"gpio0\",\n+};\n+\n void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)\n {\n \tunsigned long flags;\n@@ -189,11 +195,6 @@ static struct platform_device rb532_led = {\n \t.id = -1,\n };\n \n-static struct platform_device rb532_button = {\n-\t.name\t= \"rb532-button\",\n-\t.id\t= -1,\n-};\n-\n static struct resource rb532_wdt_res[] = {\n \t{\n \t\t.name = \"rb532_wdt_res\",\n@@ -236,11 +237,23 @@ static struct platform_device *rb532_devs[] = {\n \t&nand_slot0,\n \t&cf_slot0,\n \t&rb532_led,\n-\t&rb532_button,\n \t&rb532_uart,\n \t&rb532_wdt\n };\n \n+static const struct property_entry rb532_button_properties[] = {\n+\tPROPERTY_ENTRY_GPIO(\"button-gpios\", &rb532_gpio0_node,\n+\t\t\t    GPIO_BTN_S1, GPIO_ACTIVE_LOW),\n+\t{ }\n+};\n+\n+static const struct platform_device_info rb532_button_info  __initconst = {\n+\t.name\t\t= \"rb532-button\",\n+\t.id\t\t= PLATFORM_DEVID_NONE,\n+\t.properties\t= rb532_button_properties,\n+};\n+\n+\n /* NAND definitions */\n #define NAND_CHIP_DELAY 25\n \n@@ -267,6 +280,9 @@ static void __init rb532_nand_setup(void)\n \n static int __init plat_setup_devices(void)\n {\n+\tstruct platform_device *pd;\n+\tint ret;\n+\n \t/* Look for the CF card reader */\n \tif (!readl(IDT434_REG_BASE + DEV1MASK))\n \t\trb532_devs[2] = NULL;\t/* disable cf_slot0 at index 2 */\n@@ -295,7 +311,24 @@ static int __init plat_setup_devices(void)\n \trb532_uart_res[0].uartclk = idt_cpu_freq;\n \n \tgpiod_add_lookup_table(&cf_slot0_gpio_table);\n-\treturn platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));\n+\tret = platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/*\n+\t * Stack devices using full info and properties here, after we\n+\t * register the node for the GPIO chip.\n+\t */\n+\tsoftware_node_register(&rb532_gpio0_node);\n+\n+\tpd = platform_device_register_full(&rb532_button_info);\n+\tret = PTR_ERR_OR_ZERO(pd);\n+\tif (ret) {\n+\t\tpr_err(\"failed to create RB532 button device: %d\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n }\n \n #ifdef CONFIG_NET\ndiff --git a/drivers/input/misc/rb532_button.c b/drivers/input/misc/rb532_button.c\nindex 190a80e1e2c1..40173bf7a235 100644\n--- a/drivers/input/misc/rb532_button.c\n+++ b/drivers/input/misc/rb532_button.c\n@@ -8,7 +8,7 @@\n #include <linux/input.h>\n #include <linux/module.h>\n #include <linux/platform_device.h>\n-#include <linux/gpio.h>\n+#include <linux/gpio/consumer.h>\n \n #include <asm/mach-rc32434/gpio.h>\n #include <asm/mach-rc32434/rb.h>\n@@ -18,6 +18,14 @@\n #define RB532_BTN_RATE 100 /* msec */\n #define RB532_BTN_KSYM BTN_0\n \n+/**\n+ * struct rb532_button - RB532 button information\n+ * @gpio: GPIO connected to the button\n+ */\n+struct rb532_button {\n+\tstruct gpio_desc\t*gpio;\n+};\n+\n /* The S1 button state is provided by GPIO pin 1. But as this\n  * pin is also used for uart input as alternate function, the\n  * operational modes must be switched first:\n@@ -31,35 +39,48 @@\n  * The GPIO value occurs to be inverted, so pin high means\n  * button is not pressed.\n  */\n-static bool rb532_button_pressed(void)\n+static bool rb532_button_pressed(struct rb532_button *button)\n {\n \tint val;\n \n \tset_latch_u5(0, LO_FOFF);\n-\tgpio_direction_input(GPIO_BTN_S1);\n+\tgpiod_direction_input(button->gpio);\n \n-\tval = gpio_get_value(GPIO_BTN_S1);\n+\tval = gpiod_get_value(button->gpio);\n \n \trb532_gpio_set_func(GPIO_BTN_S1);\n \tset_latch_u5(LO_FOFF, 0);\n \n-\treturn !val;\n+\treturn val;\n }\n \n static void rb532_button_poll(struct input_dev *input)\n {\n-\tinput_report_key(input, RB532_BTN_KSYM, rb532_button_pressed());\n+\tstruct rb532_button *button = input_get_drvdata(input);\n+\n+\tinput_report_key(input, RB532_BTN_KSYM, rb532_button_pressed(button));\n \tinput_sync(input);\n }\n \n static int rb532_button_probe(struct platform_device *pdev)\n {\n+\tstruct rb532_button *button;\n \tstruct input_dev *input;\n \tint error;\n \n+\tbutton = devm_kzalloc(&pdev->dev, sizeof(*button), GFP_KERNEL);\n+\tif (!button)\n+\t\treturn -ENOMEM;\n+\n+\tbutton->gpio = devm_gpiod_get(&pdev->dev, \"button\", GPIOD_IN);\n+\tif (IS_ERR(button->gpio))\n+\t\treturn dev_err_probe(&pdev->dev, PTR_ERR(button->gpio),\n+\t\t\t\t     \"error getting button GPIO\\n\");\n+\n \tinput = devm_input_allocate_device(&pdev->dev);\n \tif (!input)\n \t\treturn -ENOMEM;\n+\tinput_set_drvdata(input, button);\n \n \tinput->name = \"rb532 button\";\n \tinput->phys = \"rb532/button0\";\n@@ -77,6 +98,8 @@ static int rb532_button_probe(struct platform_device *pdev)\n \tif (error)\n \t\treturn error;\n \n+\tplatform_set_drvdata(pdev, button);\n+\n \treturn 0;\n }\n \n",
    "prefixes": [
        "1/2"
    ]
}