get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 110255,
    "url": "http://patchwork.ozlabs.org/api/patches/110255/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1313538332-13515-1-git-send-email-agnel.joel@gmail.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1313538332-13515-1-git-send-email-agnel.joel@gmail.com>",
    "list_archive_url": null,
    "date": "2011-08-16T23:45:32",
    "name": "[U-Boot,v2,7/7] led: Remove state-saving of led for toggle functionality and add toggle option to led command",
    "commit_ref": "b8bc8973a1830bb92e7a9bf3356dc209afb2f4e8",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e8f8e2daf277c409561ca9b5dcd5e7be2ea42255",
    "submitter": {
        "id": 8387,
        "url": "http://patchwork.ozlabs.org/api/people/8387/?format=api",
        "name": "Joel Fernandes",
        "email": "agnel.joel@gmail.com"
    },
    "delegate": {
        "id": 1713,
        "url": "http://patchwork.ozlabs.org/api/users/1713/?format=api",
        "username": "spaulraj",
        "first_name": "Sandeep",
        "last_name": "Paulraj",
        "email": "s-paulraj@ti.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1313538332-13515-1-git-send-email-agnel.joel@gmail.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/110255/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/110255/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Received": [
            "from theia.denx.de (theia.denx.de [85.214.87.163])\n\tby ozlabs.org (Postfix) with ESMTP id 3F11EB6F85\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 17 Aug 2011 09:45:52 +1000 (EST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 864FE2808B;\n\tWed, 17 Aug 2011 01:45:50 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id dRMv6ZPJG50G; Wed, 17 Aug 2011 01:45:50 +0200 (CEST)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 5A27428083;\n\tWed, 17 Aug 2011 01:45:47 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id C4F8428083\n\tfor <u-boot@lists.denx.de>; Wed, 17 Aug 2011 01:45:44 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 9i5SivJUewBc for <u-boot@lists.denx.de>;\n\tWed, 17 Aug 2011 01:45:43 +0200 (CEST)",
            "from mail-yw0-f44.google.com (mail-yw0-f44.google.com\n\t[209.85.213.44]) by theia.denx.de (Postfix) with ESMTPS id 34C2228082\n\tfor <u-boot@lists.denx.de>; Wed, 17 Aug 2011 01:45:41 +0200 (CEST)",
            "by ywm21 with SMTP id 21so335059ywm.3\n\tfor <u-boot@lists.denx.de>; Tue, 16 Aug 2011 16:45:40 -0700 (PDT)",
            "by 10.236.153.8 with SMTP id e8mr1132151yhk.179.1313538340380;\n\tTue, 16 Aug 2011 16:45:40 -0700 (PDT)",
            "from localhost.localdomain (cpe-76-184-244-226.tx.res.rr.com\n\t[76.184.244.226])\n\tby mx.google.com with ESMTPS id o2sm325527yhl.29.2011.08.16.16.45.38\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tTue, 16 Aug 2011 16:45:39 -0700 (PDT)"
        ],
        "X-Virus-Scanned": [
            "Debian amavisd-new at theia.denx.de",
            "Debian amavisd-new at theia.denx.de"
        ],
        "X-policyd-weight": "NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5\n\tNOT_IN_BL_NJABL=-1.5 (only DNSBL check requested)",
        "From": "Joel A Fernandes <agnel.joel@gmail.com>",
        "To": "u-boot@lists.denx.de",
        "Date": "Tue, 16 Aug 2011 18:45:32 -0500",
        "Message-Id": "<1313538332-13515-1-git-send-email-agnel.joel@gmail.com>",
        "X-Mailer": "git-send-email 1.7.1",
        "Cc": "Syed Mohammed Khasim <khasim@ti.com>, k-kooi@ti.com, jdk@ti.com",
        "Subject": "[U-Boot] [PATCH v2 7/7] led: Remove state-saving of led for toggle\n\tfunctionality and add toggle option to led command",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.9",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<http://lists.denx.de/mailman/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://lists.denx.de/pipermail/u-boot>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<http://lists.denx.de/mailman/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "u-boot-bounces@lists.denx.de",
        "Errors-To": "u-boot-bounces@lists.denx.de"
    },
    "content": "* Read the led output state from GPIO instead saving state in memory when it is [re]set\n* Added a toggle option to the led command\n\nPrevious discussion:\nhttp://lists.denx.de/pipermail/u-boot/2011-May/093068.html\n\nChanges since v1:\nFixed checkpatch errors\n\nSigned-off-by: Joel A Fernandes <agnel.joel@gmail.com>\nSigned-off-by: Jason Kridner <jkridner@beagleboard.org>\n---\n board/ti/beagle/led.c |   28 +++++++++------------\n common/cmd_led.c      |   64 ++++++++++++++++++++++++++++++------------------\n 2 files changed, 52 insertions(+), 40 deletions(-)",
    "diff": "diff --git a/board/ti/beagle/led.c b/board/ti/beagle/led.c\nindex d3de51f..f08c08a 100644\n--- a/board/ti/beagle/led.c\n+++ b/board/ti/beagle/led.c\n@@ -24,8 +24,6 @@\n #include <asm/arch/sys_proto.h>\n #include <asm/arch/gpio.h>\n \n-static unsigned int saved_state[2] = {STATUS_LED_OFF, STATUS_LED_OFF};\n-\n /* GPIO pins for the LEDs */\n #define BEAGLE_LED_USR0\t150\n #define BEAGLE_LED_USR1\t149\n@@ -49,22 +47,22 @@ void __led_init (led_id_t mask, int state)\n \n void __led_toggle (led_id_t mask)\n {\n+\tint state, toggle_gpio = 0;\n #ifdef STATUS_LED_BIT\n-\tif (STATUS_LED_BIT & mask) {\n-\t\tif (STATUS_LED_ON == saved_state[0])\n-\t\t\t__led_set(STATUS_LED_BIT, 0);\n-\t\telse\n-\t\t\t__led_set(STATUS_LED_BIT, 1);\n-\t}\n+\tif (!toggle_gpio && STATUS_LED_BIT & mask)\n+\t\ttoggle_gpio = BEAGLE_LED_USR0;\n #endif\n #ifdef STATUS_LED_BIT1\n-\tif (STATUS_LED_BIT1 & mask) {\n-\t\tif (STATUS_LED_ON == saved_state[1])\n-\t\t\t__led_set(STATUS_LED_BIT1, 0);\n-\t\telse\n-\t\t\t__led_set(STATUS_LED_BIT1, 1);\n-\t}\n+\tif (!toggle_gpio && STATUS_LED_BIT1 & mask)\n+\t\ttoggle_gpio = BEAGLE_LED_USR1;\n #endif\n+\tif (toggle_gpio) {\n+\t\tif (!omap_request_gpio(toggle_gpio)) {\n+\t\t\tomap_set_gpio_direction(toggle_gpio, 0);\n+\t\t\tstate = omap_get_gpio_dataout(toggle_gpio);\n+\t\t\tomap_set_gpio_dataout(toggle_gpio, !state);\n+\t\t}\n+\t}\n }\n \n void __led_set (led_id_t mask, int state)\n@@ -75,7 +73,6 @@ void __led_set (led_id_t mask, int state)\n \t\t\tomap_set_gpio_direction(BEAGLE_LED_USR0, 0);\n \t\t\tomap_set_gpio_dataout(BEAGLE_LED_USR0, state);\n \t\t}\n-\t\tsaved_state[0] = state;\n \t}\n #endif\n #ifdef STATUS_LED_BIT1\n@@ -84,7 +81,6 @@ void __led_set (led_id_t mask, int state)\n \t\t\tomap_set_gpio_direction(BEAGLE_LED_USR1, 0);\n \t\t\tomap_set_gpio_dataout(BEAGLE_LED_USR1, state);\n \t\t}\n-\t\tsaved_state[1] = state;\n \t}\n #endif\n }\ndiff --git a/common/cmd_led.c b/common/cmd_led.c\nindex 183dc0b..0e4ebc5 100644\n--- a/common/cmd_led.c\n+++ b/common/cmd_led.c\n@@ -36,6 +36,7 @@ struct led_tbl_s {\n \tled_id_t\tmask;\t\t/* Mask used for calling __led_set() */\n \tvoid\t\t(*off)(void);\t/* Optional function for turning LED off */\n \tvoid\t\t(*on)(void);\t/* Optional function for turning LED on */\n+\tvoid\t\t(*toggle)(void);/* Optional function for toggling LED */\n };\n \n typedef struct led_tbl_s led_tbl_t;\n@@ -43,70 +44,85 @@ typedef struct led_tbl_s led_tbl_t;\n static const led_tbl_t led_commands[] = {\n #ifdef CONFIG_BOARD_SPECIFIC_LED\n #ifdef STATUS_LED_BIT\n-\t{ \"0\", STATUS_LED_BIT, NULL, NULL },\n+\t{ \"0\", STATUS_LED_BIT, NULL, NULL, NULL },\n #endif\n #ifdef STATUS_LED_BIT1\n-\t{ \"1\", STATUS_LED_BIT1, NULL, NULL },\n+\t{ \"1\", STATUS_LED_BIT1, NULL, NULL, NULL },\n #endif\n #ifdef STATUS_LED_BIT2\n-\t{ \"2\", STATUS_LED_BIT2, NULL, NULL },\n+\t{ \"2\", STATUS_LED_BIT2, NULL, NULL, NULL },\n #endif\n #ifdef STATUS_LED_BIT3\n-\t{ \"3\", STATUS_LED_BIT3, NULL, NULL },\n+\t{ \"3\", STATUS_LED_BIT3, NULL, NULL, NULL },\n #endif\n #endif\n #ifdef STATUS_LED_GREEN\n-\t{ \"green\", STATUS_LED_GREEN, green_LED_off, green_LED_on },\n+\t{ \"green\", STATUS_LED_GREEN, green_LED_off, green_LED_on, NULL },\n #endif\n #ifdef STATUS_LED_YELLOW\n-\t{ \"yellow\", STATUS_LED_YELLOW, yellow_LED_off, yellow_LED_on },\n+\t{ \"yellow\", STATUS_LED_YELLOW, yellow_LED_off, yellow_LED_on, NULL },\n #endif\n #ifdef STATUS_LED_RED\n-\t{ \"red\", STATUS_LED_RED, red_LED_off, red_LED_on },\n+\t{ \"red\", STATUS_LED_RED, red_LED_off, red_LED_on, NULL },\n #endif\n #ifdef STATUS_LED_BLUE\n-\t{ \"blue\", STATUS_LED_BLUE, blue_LED_off, blue_LED_on },\n+\t{ \"blue\", STATUS_LED_BLUE, blue_LED_off, blue_LED_on, NULL },\n #endif\n-\t{ NULL, 0, NULL, NULL }\n+\t{ NULL, 0, NULL, NULL, NULL }\n };\n \n-int str_onoff (char *var)\n+enum led_cmd { LED_ON, LED_OFF, LED_TOGGLE };\n+\n+enum led_cmd get_led_cmd(char *var)\n {\n \tif (strcmp(var, \"off\") == 0) {\n-\t\treturn 0;\n+\t\treturn LED_OFF;\n \t}\n \tif (strcmp(var, \"on\") == 0) {\n-\t\treturn 1;\n+\t\treturn LED_ON;\n \t}\n+\tif (strcmp(var, \"toggle\") == 0)\n+\t\treturn LED_TOGGLE;\n \treturn -1;\n }\n \n int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n {\n-\tint state, i, match = 0;\n+\tint i, match = 0;\n+\tenum led_cmd cmd;\n \n \t/* Validate arguments */\n \tif ((argc != 3)) {\n \t\treturn cmd_usage(cmdtp);\n \t}\n \n-\tstate = str_onoff(argv[2]);\n-\tif (state < 0) {\n+\tcmd = get_led_cmd(argv[2]);\n+\tif (cmd < 0) {\n \t\treturn cmd_usage(cmdtp);\n \t}\n \n \tfor (i = 0; led_commands[i].string; i++) {\n \t\tif ((strcmp(\"all\", argv[1]) == 0) ||\n \t\t    (strcmp(led_commands[i].string, argv[1]) == 0)) {\n-\t\t    \tmatch = 1;\n-\t\t\tif (led_commands[i].on) {\n-\t\t\t\tif (state) {\n+\t\t\tmatch = 1;\n+\t\t\tswitch (cmd) {\n+\t\t\tcase LED_ON:\n+\t\t\t\tif (led_commands[i].on)\n \t\t\t\t\tled_commands[i].on();\n-\t\t\t\t} else {\n+\t\t\t\telse\n+\t\t\t\t\t__led_set(led_commands[i].mask, 1);\n+\t\t\t\tbreak;\n+\t\t\tcase LED_OFF:\n+\t\t\t\tif (led_commands[i].off)\n \t\t\t\t\tled_commands[i].off();\n-\t\t\t\t}\n-\t\t\t} else {\n-\t\t\t\t__led_set(led_commands[i].mask, state);\n+\t\t\t\telse\n+\t\t\t\t\t__led_set(led_commands[i].mask, 0);\n+\t\t\t\tbreak;\n+\t\t\tcase LED_TOGGLE:\n+\t\t\t\tif (led_commands[i].toggle)\n+\t\t\t\t\tled_commands[i].toggle();\n+\t\t\t\telse\n+\t\t\t\t\t__led_toggle(led_commands[i].mask);\n \t\t\t}\n \t\t\t/* Need to set only 1 led if led_name wasn't 'all' */\n \t\t\tif (strcmp(\"all\", argv[1]) != 0)\n@@ -151,6 +167,6 @@ U_BOOT_CMD(\n #ifdef STATUS_LED_BLUE\n \t\"blue|\"\n #endif\n-\t\"all] [on|off]\\n\",\n-\t\"led [led_name] [on|off] sets or clears led(s)\\n\"\n+\t\"all] [on|off|toggle]\\n\",\n+\t\"led [led_name] [on|off|toggle] sets or clears led(s)\\n\"\n );\n",
    "prefixes": [
        "U-Boot",
        "v2",
        "7/7"
    ]
}