get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 814627,
    "url": "http://patchwork.ozlabs.org/api/patches/814627/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20170917093906.16325-8-linus.walleij@linaro.org/",
    "project": {
        "id": 35,
        "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api",
        "name": "Linux I2C development",
        "link_name": "linux-i2c",
        "list_id": "linux-i2c.vger.kernel.org",
        "list_email": "linux-i2c@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170917093906.16325-8-linus.walleij@linaro.org>",
    "list_archive_url": null,
    "date": "2017-09-17T09:39:06",
    "name": "[7/7] i2c: gpio: Add support for named gpios in DT",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4609a9c4224d95607270126bc22c078b235cbb4f",
    "submitter": {
        "id": 7055,
        "url": "http://patchwork.ozlabs.org/api/people/7055/?format=api",
        "name": "Linus Walleij",
        "email": "linus.walleij@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20170917093906.16325-8-linus.walleij@linaro.org/mbox/",
    "series": [
        {
            "id": 3497,
            "url": "http://patchwork.ozlabs.org/api/series/3497/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=3497",
            "date": "2017-09-17T09:38:59",
            "name": "I2C GPIO to use gpiolibs open drain",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/3497/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/814627/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/814627/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-i2c-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"MSWejNoo\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xw3yr1Jy9z9s72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 17 Sep 2017 19:40:20 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751298AbdIQJkT (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 17 Sep 2017 05:40:19 -0400",
            "from mail-lf0-f41.google.com ([209.85.215.41]:56577 \"EHLO\n\tmail-lf0-f41.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751186AbdIQJkS (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Sun, 17 Sep 2017 05:40:18 -0400",
            "by mail-lf0-f41.google.com with SMTP id a18so5563285lfl.13\n\tfor <linux-i2c@vger.kernel.org>; Sun, 17 Sep 2017 02:40:17 -0700 (PDT)",
            "from fabina.bredbandsbolaget.se\n\t(c-2209e055.014-348-6c756e10.cust.bredbandsbolaget.se.\n\t[85.224.9.34]) by smtp.gmail.com with ESMTPSA id\n\tt84sm974559lfi.21.2017.09.17.02.40.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 17 Sep 2017 02:40:15 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=Y1VLeRKXOxFcngVRxxUIqqi7JFtX1kvthA2oNKtATuI=;\n\tb=MSWejNoohC5PPHM0DMfoZpDvQmq0B3GA6vrjmZqDwCvAl7TqA1MH+6WZ45E/7Enqu6\n\tdHWwmoeIkVtQZTABUE1yfDHhRcL99JN5BctIAUYY9NhpeHYEOEhw6sUKMBf/yq3X9575\n\tTboefojb6wMQkF3id0L3JYdyOaU72IWy81ZQw=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=Y1VLeRKXOxFcngVRxxUIqqi7JFtX1kvthA2oNKtATuI=;\n\tb=ad+ihO3p7hwf88Lie7plvp5WdxvsuQnlbcqTJszQHsAmy/h6Wa+J2hCJ6PgiOoiZvt\n\t5YuIXcYaxkucTpPgB6c2LqTJMaihWTNz+PzDZA2PIoQCSnRY6XFgdY0dBxpvy+aV7CQi\n\tq5F0Z0UjMIm5TXVGHp+2Hywt/2UGp+0rjfFQMmYAWLbGJ83Q+IiX2F3Lw5R3SFsTPDAJ\n\to92t84YG70sJ1qKYRmIh5rc9in2jK355g/FgkNn+1RPmFidHseWVQhSbQFomDgPcmIkQ\n\tZigKqdtK25DxZbFms2JUz/yjoo/yTQ7mFAjxobb0vivllCGIgh9knJ0PENCCm6RZwXQs\n\tkTWQ==",
        "X-Gm-Message-State": "AHPjjUgoyR5Thi7O4zKWG/Fe8gpBVuJoISc3x2Qk2hAodMhMUhy+21FO\n\tRgnJ3W4hcycIL+DH",
        "X-Google-Smtp-Source": "AOwi7QAmOLGzGESEjkytdRvn7bxaaTHsN1+LSWjF7+CDybZq/niGRNPrVjIxoUk3U/Uq/vJiRI2M/w==",
        "X-Received": "by 10.25.79.8 with SMTP id d8mr2202310lfb.118.1505641216590;\n\tSun, 17 Sep 2017 02:40:16 -0700 (PDT)",
        "From": "Linus Walleij <linus.walleij@linaro.org>",
        "To": "Wolfram Sang <wsa@the-dreams.de>, linux-i2c@vger.kernel.org",
        "Cc": "linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org,\n\tadi-buildroot-devel@lists.sourceforge.net,\n\tGeert Uytterhoeven <geert@linux-m68k.org>,\n\tLinus Walleij <linus.walleij@linaro.org>",
        "Subject": "[PATCH 7/7] i2c: gpio: Add support for named gpios in DT",
        "Date": "Sun, 17 Sep 2017 11:39:06 +0200",
        "Message-Id": "<20170917093906.16325-8-linus.walleij@linaro.org>",
        "X-Mailer": "git-send-email 2.13.5",
        "In-Reply-To": "<20170917093906.16325-1-linus.walleij@linaro.org>",
        "References": "<20170917093906.16325-1-linus.walleij@linaro.org>",
        "Sender": "linux-i2c-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-i2c.vger.kernel.org>",
        "X-Mailing-List": "linux-i2c@vger.kernel.org"
    },
    "content": "This adds support for using the \"sda\" and \"scl\" GPIOs in\ndevice tree instead of anonymously using index 0 and 1 of\nthe \"gpios\" property.\n\nWe add a helper function to retrieve the GPIO descriptors\nand some explicit error handling since the probe may have\nto be deferred. At least this happened to me when moving\nto using named \"sda\" and \"scl\" lines (all of a sudden this\nstarted to probe before the GPIO driver) so we need to\ngracefully defer probe when we ge -ENOENT in the error\npointer.\n\nSuggested-by: Geert Uytterhoeven <geert+renesas@glider.be>\nSigned-off-by: Linus Walleij <linus.walleij@linaro.org>\n---\nThis is pretty much a rewrite of Geerts patch on top of\nmy own changes to support descriptors.\n---\n drivers/i2c/busses/i2c-gpio.c | 59 +++++++++++++++++++++++++++++++------------\n 1 file changed, 43 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c\nindex beb5ce523684..2738b851f470 100644\n--- a/drivers/i2c/busses/i2c-gpio.c\n+++ b/drivers/i2c/busses/i2c-gpio.c\n@@ -82,6 +82,42 @@ static void of_i2c_gpio_get_props(struct device_node *np,\n \t\tof_property_read_bool(np, \"i2c-gpio,scl-output-only\");\n }\n \n+static struct gpio_desc *i2c_gpio_get_desc(struct device *dev,\n+\t\t\t\t\t   const char *con_id,\n+\t\t\t\t\t   unsigned int index,\n+\t\t\t\t\t   enum gpiod_flags gflags)\n+{\n+\tstruct gpio_desc *retdesc;\n+\tint ret;\n+\n+\tretdesc = devm_gpiod_get(dev, con_id, gflags);\n+\tif (!IS_ERR(retdesc)) {\n+\t\tdev_dbg(dev, \"got GPIO from name %s\\n\", con_id);\n+\t\treturn retdesc;\n+\t}\n+\n+\tretdesc = devm_gpiod_get_index(dev, NULL, index, gflags);\n+\tif (!IS_ERR(retdesc)) {\n+\t\tdev_dbg(dev, \"got GPIO from index %u\\n\", index);\n+\t\treturn retdesc;\n+\t}\n+\n+\tret = PTR_ERR(retdesc);\n+\n+\t/* FIXME: hack in the old code, is this really necessary? */\n+\tif (ret == -EINVAL)\n+\t\tretdesc = ERR_PTR(-EPROBE_DEFER);\n+\n+\t/* This happens if the GPIO driver is not yet probed, let's defer */\n+\tif (ret == -ENOENT)\n+\t\tretdesc = ERR_PTR(-EPROBE_DEFER);\n+\n+\tif (ret != -EPROBE_DEFER)\n+\t\tdev_err(dev, \"error trying to get descriptor: %ld\\n\", ret);\n+\n+\treturn retdesc;\n+}\n+\n static int i2c_gpio_probe(struct platform_device *pdev)\n {\n \tstruct i2c_gpio_private_data *priv;\n@@ -125,14 +161,10 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \t\tgflags = GPIOD_OUT_HIGH;\n \telse\n \t\tgflags = GPIOD_OUT_HIGH_OPEN_DRAIN;\n-\tpriv->sda = devm_gpiod_get_index(dev, NULL, 0, gflags);\n-\tif (IS_ERR(priv->sda)) {\n-\t\tret = PTR_ERR(priv->sda);\n-\t\t/* FIXME: hack in the old code, is this really necessary? */\n-\t\tif (ret == -EINVAL)\n-\t\t\tret = -EPROBE_DEFER;\n-\t\treturn ret;\n-\t}\n+\tpriv->sda = i2c_gpio_get_desc(dev, \"sda\", 0, gflags);\n+\tif (IS_ERR(priv->sda))\n+\t\treturn PTR_ERR(priv->sda);\n+\n \t/*\n \t * If the SCL line is marked from platform data or device tree as\n \t * \"open drain\" it means something outside of our control is making\n@@ -144,14 +176,9 @@ static int i2c_gpio_probe(struct platform_device *pdev)\n \t\tgflags = GPIOD_OUT_LOW;\n \telse\n \t\tgflags = GPIOD_OUT_LOW_OPEN_DRAIN;\n-\tpriv->scl = devm_gpiod_get_index(dev, NULL, 1, gflags);\n-\tif (IS_ERR(priv->scl)) {\n-\t\tret = PTR_ERR(priv->scl);\n-\t\t/* FIXME: hack in the old code, is this really necessary? */\n-\t\tif (ret == -EINVAL)\n-\t\t\tret = -EPROBE_DEFER;\n-\t\treturn ret;\n-\t}\n+\tpriv->scl = i2c_gpio_get_desc(dev, \"scl\", 1, gflags);\n+\tif (IS_ERR(priv->scl))\n+\t\treturn PTR_ERR(priv->scl);\n \n \tbit_data->setsda = i2c_gpio_setsda_val;\n \tbit_data->setscl = i2c_gpio_setscl_val;\n",
    "prefixes": [
        "7/7"
    ]
}