get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 806294,
    "url": "http://patchwork.ozlabs.org/api/patches/806294/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openbmc/patch/20170827164546.22903-3-clg@kaod.org/",
    "project": {
        "id": 56,
        "url": "http://patchwork.ozlabs.org/api/projects/56/?format=api",
        "name": "OpenBMC development",
        "link_name": "openbmc",
        "list_id": "openbmc.lists.ozlabs.org",
        "list_email": "openbmc@lists.ozlabs.org",
        "web_url": "http://github.com/openbmc/",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170827164546.22903-3-clg@kaod.org>",
    "list_archive_url": null,
    "date": "2017-08-27T16:45:46",
    "name": "[linux,dev-4.10,2/2] leds: pca955x: check for I2C errors",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f2075d5796dfef711a970052ea7a83627f7c7143",
    "submitter": {
        "id": 68548,
        "url": "http://patchwork.ozlabs.org/api/people/68548/?format=api",
        "name": "Cédric Le Goater",
        "email": "clg@kaod.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openbmc/patch/20170827164546.22903-3-clg@kaod.org/mbox/",
    "series": [
        {
            "id": 30,
            "url": "http://patchwork.ozlabs.org/api/series/30/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openbmc/list/?series=30",
            "date": "2017-08-27T16:45:44",
            "name": "leds: pca955x: mainline update and I2C error checking",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/30/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806294/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806294/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "openbmc@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "openbmc@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xgN5x4vHhz9ryr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 04:02:29 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xgN5x08DJzDqhL\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 04:02:28 +1000 (AEST)",
            "from 15.mo6.mail-out.ovh.net (15.mo6.mail-out.ovh.net\n\t[188.165.39.161])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xgN5k6hDTzDqG4\n\tfor <openbmc@lists.ozlabs.org>; Mon, 28 Aug 2017 04:02:18 +1000 (AEST)",
            "from player787.ha.ovh.net (b9.ovh.net [213.186.33.59])\n\tby mo6.mail-out.ovh.net (Postfix) with ESMTP id C4E67103D0A\n\tfor <openbmc@lists.ozlabs.org>; Sun, 27 Aug 2017 18:46:11 +0200 (CEST)",
            "from zorba.kaod.org (LFbn-1-2231-173.w90-76.abo.wanadoo.fr\n\t[90.76.52.173]) (Authenticated sender: clg@kaod.org)\n\tby player787.ha.ovh.net (Postfix) with ESMTPSA id A2A32600072;\n\tSun, 27 Aug 2017 18:46:07 +0200 (CEST)"
        ],
        "From": "=?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@kaod.org>",
        "To": "openbmc@lists.ozlabs.org",
        "Subject": "[PATCH linux dev-4.10 2/2] leds: pca955x: check for I2C errors",
        "Date": "Sun, 27 Aug 2017 18:45:46 +0200",
        "Message-Id": "<20170827164546.22903-3-clg@kaod.org>",
        "X-Mailer": "git-send-email 2.13.5",
        "In-Reply-To": "<20170827164546.22903-1-clg@kaod.org>",
        "References": "<20170827164546.22903-1-clg@kaod.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-Ovh-Tracer-Id": "17821588154200394498",
        "X-VR-SPAMSTATE": "OK",
        "X-VR-SPAMSCORE": "-100",
        "X-VR-SPAMCAUSE": "gggruggvucftvghtrhhoucdtuddrfeelledruddtgddutdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm",
        "X-BeenThere": "openbmc@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "Development list for OpenBMC <openbmc.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/openbmc>,\n\t<mailto:openbmc-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/openbmc/>",
        "List-Post": "<mailto:openbmc@lists.ozlabs.org>",
        "List-Help": "<mailto:openbmc-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/openbmc>,\n\t<mailto:openbmc-request@lists.ozlabs.org?subject=subscribe>",
        "Cc": "Andrew Jeffery <andrew@aj.id.au>, =?utf-8?q?C=C3=A9dric_Le_Goater?=\n\t<clg@kaod.org>",
        "Errors-To": "openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org",
        "Sender": "\"openbmc\"\n\t<openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"
    },
    "content": "This should also allow probing to fail when a pca955x chip is not\nfound on a I2C bus.\n\nSigned-off-by: Cédric Le Goater <clg@kaod.org>\n---\n drivers/leds/leds-pca955x.c | 93 +++++++++++++++++++++++++++++++++++----------\n 1 file changed, 72 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c\nindex f062d1e7640f..5f12d55550a4 100644\n--- a/drivers/leds/leds-pca955x.c\n+++ b/drivers/leds/leds-pca955x.c\n@@ -165,13 +165,18 @@ static inline u8 pca955x_ledsel(u8 oldval, int led_num, int state)\n  * Write to frequency prescaler register, used to program the\n  * period of the PWM output.  period = (PSCx + 1) / 38\n  */\n-static void pca955x_write_psc(struct i2c_client *client, int n, u8 val)\n+static int pca955x_write_psc(struct i2c_client *client, int n, u8 val)\n {\n \tstruct pca955x *pca955x = i2c_get_clientdata(client);\n+\tint ret;\n \n-\ti2c_smbus_write_byte_data(client,\n+\tret = i2c_smbus_write_byte_data(client,\n \t\tpca95xx_num_input_regs(pca955x->chipdef->bits) + 2*n,\n \t\tval);\n+\tif (ret < 0)\n+\t\tdev_err(&client->dev, \"%s: reg 0x%x, val 0x%x, err %d\\n\",\n+\t\t\t__func__, n, val, ret);\n+\treturn ret;\n }\n \n /*\n@@ -181,38 +186,57 @@ static void pca955x_write_psc(struct i2c_client *client, int n, u8 val)\n  *\n  * Duty cycle is (256 - PWMx) / 256\n  */\n-static void pca955x_write_pwm(struct i2c_client *client, int n, u8 val)\n+static int pca955x_write_pwm(struct i2c_client *client, int n, u8 val)\n {\n \tstruct pca955x *pca955x = i2c_get_clientdata(client);\n+\tint ret;\n \n-\ti2c_smbus_write_byte_data(client,\n+\tret = i2c_smbus_write_byte_data(client,\n \t\tpca95xx_num_input_regs(pca955x->chipdef->bits) + 1 + 2*n,\n \t\tval);\n+\tif (ret < 0)\n+\t\tdev_err(&client->dev, \"%s: reg 0x%x, val 0x%x, err %d\\n\",\n+\t\t\t__func__, n, val, ret);\n+\treturn ret;\n }\n \n+\n /*\n  * Write to LED selector register, which determines the source that\n  * drives the LED output.\n  */\n-static void pca955x_write_ls(struct i2c_client *client, int n, u8 val)\n+static int pca955x_write_ls(struct i2c_client *client, int n, u8 val)\n {\n \tstruct pca955x *pca955x = i2c_get_clientdata(client);\n+\tint ret;\n \n-\ti2c_smbus_write_byte_data(client,\n+\tret = i2c_smbus_write_byte_data(client,\n \t\tpca95xx_num_input_regs(pca955x->chipdef->bits) + 4 + n,\n \t\tval);\n+\tif (ret < 0)\n+\t\tdev_err(&client->dev, \"%s: reg 0x%x, val 0x%x, err %d\\n\",\n+\t\t\t__func__, n, val, ret);\n+\treturn ret;\n }\n \n /*\n  * Read the LED selector register, which determines the source that\n  * drives the LED output.\n  */\n-static u8 pca955x_read_ls(struct i2c_client *client, int n)\n+static int pca955x_read_ls(struct i2c_client *client, int n, u8 *val)\n {\n \tstruct pca955x *pca955x = i2c_get_clientdata(client);\n+\tint ret;\n \n-\treturn (u8) i2c_smbus_read_byte_data(client,\n+\tret = i2c_smbus_read_byte_data(client,\n \t\tpca95xx_num_input_regs(pca955x->chipdef->bits) + 4 + n);\n+\tif (ret < 0) {\n+\t\tdev_err(&client->dev, \"%s: reg 0x%x, err %d\\n\",\n+\t\t\t__func__, n, ret);\n+\t\treturn ret;\n+\t}\n+\t*val = (u8) ret;\n+\treturn 0;\n }\n \n static int pca955x_led_set(struct led_classdev *led_cdev,\n@@ -223,6 +247,7 @@ static int pca955x_led_set(struct led_classdev *led_cdev,\n \tu8 ls;\n \tint chip_ls;\t/* which LSx to use (0-3 potentially) */\n \tint ls_led;\t/* which set of bits within LSx to use (0-3) */\n+\tint ret;\n \n \tpca955x_led = container_of(led_cdev, struct pca955x_led, led_cdev);\n \tpca955x = pca955x_led->pca955x;\n@@ -232,7 +257,9 @@ static int pca955x_led_set(struct led_classdev *led_cdev,\n \n \tmutex_lock(&pca955x->lock);\n \n-\tls = pca955x_read_ls(pca955x->client, chip_ls);\n+\tret = pca955x_read_ls(pca955x->client, chip_ls, &ls);\n+\tif (ret)\n+\t\tgoto out;\n \n \tswitch (value) {\n \tcase LED_FULL:\n@@ -252,26 +279,37 @@ static int pca955x_led_set(struct led_classdev *led_cdev,\n \t\t * OFF, HALF, or FULL.  But, this is probably better than\n \t\t * just turning off for all other values.\n \t\t */\n-\t\tpca955x_write_pwm(pca955x->client, 1,\n-\t\t\t\t255 - value);\n+\t\tret = pca955x_write_pwm(pca955x->client, 1, 255 - value);\n+\t\tif (ret)\n+\t\t\tgoto out;\n \t\tls = pca955x_ledsel(ls, ls_led, PCA955X_LS_BLINK1);\n \t\tbreak;\n \t}\n \n-\tpca955x_write_ls(pca955x->client, chip_ls, ls);\n+\tret = pca955x_write_ls(pca955x->client, chip_ls, ls);\n \n+out:\n \tmutex_unlock(&pca955x->lock);\n \n-\treturn 0;\n+\treturn ret;\n }\n \n #ifdef CONFIG_LEDS_PCA955X_GPIO\n /*\n  * Read the INPUT register, which contains the state of LEDs.\n  */\n-static u8 pca955x_read_input(struct i2c_client *client, int n)\n+static int pca955x_read_input(struct i2c_client *client, int n, u8 *val)\n {\n-\treturn (u8)i2c_smbus_read_byte_data(client, n);\n+\tint ret = i2c_smbus_read_byte_data(client, n);\n+\n+\tif (ret < 0) {\n+\t\tdev_err(&client->dev, \"%s: reg 0x%x, err %d\\n\",\n+\t\t\t__func__, n, ret);\n+\t\treturn ret;\n+\t}\n+\t*val = (u8) ret;\n+\treturn 0;\n+\n }\n \n static int pca955x_gpio_request_pin(struct gpio_chip *gc, unsigned int offset)\n@@ -301,7 +339,10 @@ static int pca955x_gpio_get_value(struct gpio_chip *gc, unsigned int offset)\n {\n \tstruct pca955x *pca955x = gpiochip_get_data(gc);\n \tstruct pca955x_led *led = &pca955x->leds[offset];\n-\tu8 reg = pca955x_read_input(pca955x->client, led->led_num / 8);\n+\tu8 reg = 0;\n+\n+\t/* There is nothing we can do about errors */\n+\tpca955x_read_input(pca955x->client, led->led_num / 8, &reg);\n \n \treturn !!(reg & (1 << (led->led_num % 8)));\n }\n@@ -491,19 +532,29 @@ static int pca955x_probe(struct i2c_client *client,\n \t\t\t\treturn err;\n \n \t\t\t/* Turn off LED */\n-\t\t\tpca955x_led_set(&pca955x_led->led_cdev, LED_OFF);\n+\t\t\terr = pca955x_led_set(&pca955x_led->led_cdev, LED_OFF);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n \t\t}\n \t}\n \n \t/* PWM0 is used for half brightness or 50% duty cycle */\n-\tpca955x_write_pwm(client, 0, 255-LED_HALF);\n+\terr = pca955x_write_pwm(client, 0, 255-LED_HALF);\n+\tif (err)\n+\t\treturn err;\n \n \t/* PWM1 is used for variable brightness, default to OFF */\n-\tpca955x_write_pwm(client, 1, 0);\n+\terr = pca955x_write_pwm(client, 1, 0);\n+\tif (err)\n+\t\treturn err;\n \n \t/* Set to fast frequency so we do not see flashing */\n-\tpca955x_write_psc(client, 0, 0);\n-\tpca955x_write_psc(client, 1, 0);\n+\terr = pca955x_write_psc(client, 0, 0);\n+\tif (err)\n+\t\treturn err;\n+\terr = pca955x_write_psc(client, 1, 0);\n+\tif (err)\n+\t\treturn err;\n \n #ifdef CONFIG_LEDS_PCA955X_GPIO\n \tif (ngpios) {\n",
    "prefixes": [
        "linux",
        "dev-4.10",
        "2/2"
    ]
}