get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2217501,
    "url": "http://patchwork.ozlabs.org/api/patches/2217501/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260329-ti-ads7950-facelift-v4-1-c568c508c49a@gmail.com/",
    "project": {
        "id": 42,
        "url": "http://patchwork.ozlabs.org/api/projects/42/?format=api",
        "name": "Linux GPIO development",
        "link_name": "linux-gpio",
        "list_id": "linux-gpio.vger.kernel.org",
        "list_email": "linux-gpio@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260329-ti-ads7950-facelift-v4-1-c568c508c49a@gmail.com>",
    "list_archive_url": null,
    "date": "2026-03-29T22:47:06",
    "name": "[v4,1/4] iio: adc: ti-ads7950: switch to using guard() notation",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5d4f21067d46acad50b77c583897b5d12f622ccf",
    "submitter": {
        "id": 695,
        "url": "http://patchwork.ozlabs.org/api/people/695/?format=api",
        "name": "Dmitry Torokhov",
        "email": "dmitry.torokhov@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260329-ti-ads7950-facelift-v4-1-c568c508c49a@gmail.com/mbox/",
    "series": [
        {
            "id": 497938,
            "url": "http://patchwork.ozlabs.org/api/series/497938/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=497938",
            "date": "2026-03-29T22:47:07",
            "name": "ti-ads7950: fix gpio handling and facelift",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/497938/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2217501/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217501/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-gpio+bounces-34372-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-gpio@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=pgjaB1Ku;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-gpio+bounces-34372-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"pgjaB1Ku\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=74.125.82.170",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"
        ],
        "Received": [
            "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fkV135wzCz1xrn\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 09:48:55 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id A31A83013267\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 29 Mar 2026 22:47:15 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5E0F836E482;\n\tSun, 29 Mar 2026 22:47:15 +0000 (UTC)",
            "from mail-dy1-f170.google.com (mail-dy1-f170.google.com\n [74.125.82.170])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D1E1E2E54AA\n\tfor <linux-gpio@vger.kernel.org>; Sun, 29 Mar 2026 22:47:13 +0000 (UTC)",
            "by mail-dy1-f170.google.com with SMTP id\n 5a478bee46e88-2c56aa62931so467036eec.0\n        for <linux-gpio@vger.kernel.org>;\n Sun, 29 Mar 2026 15:47:13 -0700 (PDT)",
            "from dtor-ws.sjc.corp.google.com\n ([2a00:79e0:2ebe:8:7265:773a:8e51:c62f])\n        by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2c3c7971d97sm5840295eec.30.2026.03.29.15.47.11\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 29 Mar 2026 15:47:12 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774824435; cv=none;\n b=T9grH/HKu/CcHo1ESUXyM6B6Racs6ECr+aeu3tMuV+pimaDe4hvTUczHuIIihRpkO+P82as60YoSMXdsYGW7gDo+KIn6ro5YOVXeYY9gUt13W+LFOfEDQeQm/1zXFDdwKb/DkVofOp+VQA46KTIt1T+L5lLDbOdRrfjDA5b7LuQ=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774824435; c=relaxed/simple;\n\tbh=xIe8W+1jIXINgmxwa9p/U0LcjRjeCYfnSgMBa9JCf9s=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=oJKR5VgKrDQ5XnzQgn0+PGQNQUAgwfLTSuDAvxRuDZ/CVKLqaxu6EGvtKw80yGT0zGJHuf2AH0m2SBad8Zsbk/xVfnylZAlX1MRcs6RerRznfRWfeeP1SP7TeTi+tqR1D7gWyydMFU8d8NQ6BWAVVktCfAcY7SxNmBC6VTdsHy4=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=pgjaB1Ku; arc=none smtp.client-ip=74.125.82.170",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1774824433; x=1775429233;\n darn=vger.kernel.org;\n        h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n         :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n         :reply-to;\n        bh=+vjudEEXqzxPRbybQTwtbPdouiJ0uhGQsqsaFK6mvh4=;\n        b=pgjaB1KuyntZIlWVUj4gkhYhItg5ID7LnV7IN+zlMzTuT5k7K0X2b64ipOwahkRfQu\n         Uys5MpawM0bA+SEdkOgt34sDbT7X4FUoczU7DiqN0kwPBZwV78HD7JqZcVEcUmYYkbw9\n         K9Ngu5jNsgdm7IDMN9XoflcC74cFiQ7TWvqaYLwS9+N/SazV/yJkVARRhs9ig9f+NwJ1\n         bhqpQJz09ikLGygGo7MxUQNryGSWbHC7nDNhK1v95htuvRPK7EJOv/oEI3sH+u1Tfrhw\n         XFtd51vQUtpdiSb8/hxdaBlzlIde8P/W/uC5klvzcNcLhMpAwcit6I8iq9cSvTDyALoF\n         Kveg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1774824433; x=1775429233;\n        h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n         :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n         :cc:subject:date:message-id:reply-to;\n        bh=+vjudEEXqzxPRbybQTwtbPdouiJ0uhGQsqsaFK6mvh4=;\n        b=swWRoB3wV+N7eu5tejWAAb1LgBZrY4RbEmDUlTxjEfqQrWqJjMF2BU7Htait3gjk+2\n         He/qgN2be0N3GD9bjsHDJPD81bi44s5BLCXKmZJRSSFayQIOvHDzb0h+1l0julh/EWfY\n         0RmQ2j4QRKycjZvilHijAm7EivPOtOvqySvBhMw3cuE5j/dD6GaTPishEJrJrvZZBNSy\n         CyNGiILCB7r+vUbbg6FGbJWcywrj2FGPdBfgroPXREY21c/7uXBH9zsRb9ah7h8CiIJE\n         7gs0/PZMRMsWG1O4VvkgtESJDyfXgnJYqzj1ggttW4NBaZ7D7BPbqq09+3N5tuTrcuh1\n         ydgw==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCUYLZE/w6/N0iVtsigOQyGD+X0og4ERT3IDRdTOxZPAFry7iRWpa9WIu/JBIA9vr7Ur9LIZohvq9PdG@vger.kernel.org",
        "X-Gm-Message-State": "AOJu0Yzk0+ec3bjU5o0sUPqEdpGeEOqC1wwXvhZuBwQ9G8I3wBkEwDC3\n\tf7qEJ0USptjMbiHbYyDSMsBjJGvyT0Iyta5waEUk3JxSx6hdiY40eiyG",
        "X-Gm-Gg": "ATEYQzyUfykbX+6urghG2qIZt3CmaVFG/ARdA4nUU+TwHQCptk4lJjEeMTJq8Rk0otC\n\tMFTXzTlPzJD5pIOE0XDURAAfUsE7JzRA4H/5zng6PoqBylL4ak4+v3ZVtdCB8iGMMWbTHUFj9Vh\n\tr4eVBYkUV5ausjoczjCan02up3rGQg0VV63HemKRzcgDw3oTSNqCmgdjTx56+2u/Z/EhRM3vz/Y\n\tAMXbgZWj6jxijYVwNVWQCGDZSQ0yidiBwOF7HXol0QjIHeRWLvoSXdWEPcTsce3VRx/p2deOgUl\n\tr9hQiTnFDgQGZeA/5DG0ZHKyOtph4b7dZ1KXtPfG9IzaMtt2Ds1v/SDFjenlNVASSsu1iqSGnUM\n\tLXkg5H+9bFKsOF/uDwqkr09+twoQOWZchr/AGnFPowWyx6s5YQp3TdOuuJ4R7iyYtrWH0u+IH+w\n\tmarjkirpXlf3V6YwugSJ3s+hLg7ygJkBAK++9ZIfBVyuk0i5wtnGrQ49Ie+9E+xTlmY5mXHRPAo\n\tO0xpH2mIAFYmbQ=",
        "X-Received": "by 2002:a05:7301:3d19:b0:2ba:7875:10c9 with SMTP id\n 5a478bee46e88-2c185e4da2dmr5231209eec.26.1774824433027;\n        Sun, 29 Mar 2026 15:47:13 -0700 (PDT)",
        "From": "Dmitry Torokhov <dmitry.torokhov@gmail.com>",
        "Date": "Sun, 29 Mar 2026 15:47:06 -0700",
        "Subject": "[PATCH v4 1/4] iio: adc: ti-ads7950: switch to using guard()\n notation",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-gpio@vger.kernel.org",
        "List-Id": "<linux-gpio.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-gpio+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-gpio+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260329-ti-ads7950-facelift-v4-1-c568c508c49a@gmail.com>",
        "References": "<20260329-ti-ads7950-facelift-v4-0-c568c508c49a@gmail.com>",
        "In-Reply-To": "<20260329-ti-ads7950-facelift-v4-0-c568c508c49a@gmail.com>",
        "To": "Jonathan Cameron <jic23@kernel.org>,\n David Lechner <dlechner@baylibre.com>",
        "Cc": "=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@analog.com>,\n  Andy Shevchenko <andy@kernel.org>, Linus Walleij <linusw@kernel.org>,\n  Bartosz Golaszewski <brgl@kernel.org>, linux-iio@vger.kernel.org,\n  linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,\n  Jonathan Cameron <Jonathan.Cameron@huawei.com>",
        "X-Mailer": "b4 0.15-dev-a6826"
    },
    "content": "guard() notation allows early returns when encountering errors, making\ncontrol flow more obvious. Use it.\n\nReviewed-by: David Lechner <dlechner@baylibre.com>\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>\n---\n drivers/iio/adc/ti-ads7950.c | 83 +++++++++++++++++---------------------------\n 1 file changed, 31 insertions(+), 52 deletions(-)",
    "diff": "diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c\nindex 028acd42741f..6e9ea9cc33bf 100644\n--- a/drivers/iio/adc/ti-ads7950.c\n+++ b/drivers/iio/adc/ti-ads7950.c\n@@ -299,18 +299,19 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p)\n \tstruct ti_ads7950_state *st = iio_priv(indio_dev);\n \tint ret;\n \n-\tmutex_lock(&st->slock);\n-\tret = spi_sync(st->spi, &st->ring_msg);\n-\tif (ret < 0)\n-\t\tgoto out;\n-\n-\tiio_push_to_buffers_with_ts_unaligned(indio_dev, &st->rx_buf[2],\n-\t\t\t\t\t      sizeof(*st->rx_buf) *\n-\t\t\t\t\t      TI_ADS7950_MAX_CHAN,\n-\t\t\t\t\t      iio_get_time_ns(indio_dev));\n-\n-out:\n-\tmutex_unlock(&st->slock);\n+\tdo {\n+\t\tguard(mutex)(&st->slock);\n+\n+\t\tret = spi_sync(st->spi, &st->ring_msg);\n+\t\tif (ret)\n+\t\t\tbreak;\n+\n+\t\tiio_push_to_buffers_with_ts_unaligned(indio_dev, &st->rx_buf[2],\n+\t\t\t\t\t\t      sizeof(*st->rx_buf) *\n+\t\t\t\t\t\t      TI_ADS7950_MAX_CHAN,\n+\t\t\t\t\t\t      iio_get_time_ns(indio_dev));\n+\t} while (0);\n+\n \tiio_trigger_notify_done(indio_dev->trig);\n \n \treturn IRQ_HANDLED;\n@@ -321,20 +322,16 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch)\n \tstruct ti_ads7950_state *st = iio_priv(indio_dev);\n \tint ret, cmd;\n \n-\tmutex_lock(&st->slock);\n+\tguard(mutex)(&st->slock);\n+\n \tcmd = TI_ADS7950_MAN_CMD(TI_ADS7950_CR_CHAN(ch));\n \tst->single_tx = cmd;\n \n \tret = spi_sync(st->spi, &st->scan_single_msg);\n \tif (ret)\n-\t\tgoto out;\n-\n-\tret = st->single_rx;\n-\n-out:\n-\tmutex_unlock(&st->slock);\n+\t\treturn ret;\n \n-\treturn ret;\n+\treturn st->single_rx;\n }\n \n static int ti_ads7950_get_range(struct ti_ads7950_state *st)\n@@ -400,9 +397,8 @@ static int ti_ads7950_set(struct gpio_chip *chip, unsigned int offset,\n \t\t\t  int value)\n {\n \tstruct ti_ads7950_state *st = gpiochip_get_data(chip);\n-\tint ret;\n \n-\tmutex_lock(&st->slock);\n+\tguard(mutex)(&st->slock);\n \n \tif (value)\n \t\tst->cmd_settings_bitmask |= BIT(offset);\n@@ -410,11 +406,8 @@ static int ti_ads7950_set(struct gpio_chip *chip, unsigned int offset,\n \t\tst->cmd_settings_bitmask &= ~BIT(offset);\n \n \tst->single_tx = TI_ADS7950_MAN_CMD_SETTINGS(st);\n-\tret = spi_sync(st->spi, &st->scan_single_msg);\n-\n-\tmutex_unlock(&st->slock);\n \n-\treturn ret;\n+\treturn spi_sync(st->spi, &st->scan_single_msg);\n }\n \n static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)\n@@ -423,13 +416,12 @@ static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)\n \tbool state;\n \tint ret;\n \n-\tmutex_lock(&st->slock);\n+\tguard(mutex)(&st->slock);\n \n \t/* If set as output, return the output */\n \tif (st->gpio_cmd_settings_bitmask & BIT(offset)) {\n \t\tstate = st->cmd_settings_bitmask & BIT(offset);\n-\t\tret = 0;\n-\t\tgoto out;\n+\t\treturn state;\n \t}\n \n \t/* GPIO data bit sets SDO bits 12-15 to GPIO input */\n@@ -437,7 +429,7 @@ static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)\n \tst->single_tx = TI_ADS7950_MAN_CMD_SETTINGS(st);\n \tret = spi_sync(st->spi, &st->scan_single_msg);\n \tif (ret)\n-\t\tgoto out;\n+\t\treturn ret;\n \n \tstate = (st->single_rx >> 12) & BIT(offset);\n \n@@ -446,12 +438,9 @@ static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)\n \tst->single_tx = TI_ADS7950_MAN_CMD_SETTINGS(st);\n \tret = spi_sync(st->spi, &st->scan_single_msg);\n \tif (ret)\n-\t\tgoto out;\n-\n-out:\n-\tmutex_unlock(&st->slock);\n+\t\treturn ret;\n \n-\treturn ret ?: state;\n+\treturn state;\n }\n \n static int ti_ads7950_get_direction(struct gpio_chip *chip,\n@@ -467,9 +456,8 @@ static int _ti_ads7950_set_direction(struct gpio_chip *chip, int offset,\n \t\t\t\t     int input)\n {\n \tstruct ti_ads7950_state *st = gpiochip_get_data(chip);\n-\tint ret = 0;\n \n-\tmutex_lock(&st->slock);\n+\tguard(mutex)(&st->slock);\n \n \t/* Only change direction if needed */\n \tif (input && (st->gpio_cmd_settings_bitmask & BIT(offset)))\n@@ -477,15 +465,11 @@ static int _ti_ads7950_set_direction(struct gpio_chip *chip, int offset,\n \telse if (!input && !(st->gpio_cmd_settings_bitmask & BIT(offset)))\n \t\tst->gpio_cmd_settings_bitmask |= BIT(offset);\n \telse\n-\t\tgoto out;\n+\t\treturn 0;\n \n \tst->single_tx = TI_ADS7950_GPIO_CMD_SETTINGS(st);\n-\tret = spi_sync(st->spi, &st->scan_single_msg);\n-\n-out:\n-\tmutex_unlock(&st->slock);\n \n-\treturn ret;\n+\treturn spi_sync(st->spi, &st->scan_single_msg);\n }\n \n static int ti_ads7950_direction_input(struct gpio_chip *chip,\n@@ -508,9 +492,9 @@ static int ti_ads7950_direction_output(struct gpio_chip *chip,\n \n static int ti_ads7950_init_hw(struct ti_ads7950_state *st)\n {\n-\tint ret = 0;\n+\tint ret;\n \n-\tmutex_lock(&st->slock);\n+\tguard(mutex)(&st->slock);\n \n \t/* Settings for Manual/Auto1/Auto2 commands */\n \t/* Default to 5v ref */\n@@ -518,17 +502,12 @@ static int ti_ads7950_init_hw(struct ti_ads7950_state *st)\n \tst->single_tx = TI_ADS7950_MAN_CMD_SETTINGS(st);\n \tret = spi_sync(st->spi, &st->scan_single_msg);\n \tif (ret)\n-\t\tgoto out;\n+\t\treturn ret;\n \n \t/* Settings for GPIO command */\n \tst->gpio_cmd_settings_bitmask = 0x0;\n \tst->single_tx = TI_ADS7950_GPIO_CMD_SETTINGS(st);\n-\tret = spi_sync(st->spi, &st->scan_single_msg);\n-\n-out:\n-\tmutex_unlock(&st->slock);\n-\n-\treturn ret;\n+\treturn spi_sync(st->spi, &st->scan_single_msg);\n }\n \n static int ti_ads7950_probe(struct spi_device *spi)\n",
    "prefixes": [
        "v4",
        "1/4"
    ]
}