Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/208834/?format=api
{ "id": 208834, "url": "http://patchwork.ozlabs.org/api/patches/208834/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1356952428-19824-6-git-send-email-jagannadh.teki@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": "<1356952428-19824-6-git-send-email-jagannadh.teki@gmail.com>", "list_archive_url": null, "date": "2012-12-31T11:13:44", "name": "[U-Boot,05/12] cmd_sf: Define a functions for parsing read and write instructions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "530dfe101bd1aa86d11332b79a56991d47739a77", "submitter": { "id": 20045, "url": "http://patchwork.ozlabs.org/api/people/20045/?format=api", "name": "Jagan Teki", "email": "jagannadh.teki@gmail.com" }, "delegate": { "id": 17739, "url": "http://patchwork.ozlabs.org/api/users/17739/?format=api", "username": "jagan", "first_name": "Jagannadha Sutradharudu", "last_name": "Teki", "email": "jagannadh.teki@gmail.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1356952428-19824-6-git-send-email-jagannadh.teki@gmail.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/208834/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/208834/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 8A2142C0086\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 31 Dec 2012 22:16:36 +1100 (EST)", "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 0F0534A166;\n\tMon, 31 Dec 2012 12:16:34 +0100 (CET)", "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 Df44MmKs+I2F; Mon, 31 Dec 2012 12:16:33 +0100 (CET)", "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id AAEF14A026;\n\tMon, 31 Dec 2012 12:15:40 +0100 (CET)", "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 708824A01E\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:15:02 +0100 (CET)", "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 D-8g46WqXEnz for <u-boot@lists.denx.de>;\n\tMon, 31 Dec 2012 12:14:56 +0100 (CET)", "from mail-pb0-f50.google.com (mail-pb0-f50.google.com\n\t[209.85.160.50]) by theia.denx.de (Postfix) with ESMTPS id 859484A027\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:14:21 +0100 (CET)", "by mail-pb0-f50.google.com with SMTP id wz7so7004966pbc.23\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 03:14:20 -0800 (PST)", "from localhost.localdomain ([49.204.11.250])\n\tby mx.google.com with ESMTPS id\n\tnw9sm24715215pbb.42.2012.12.31.03.14.18\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tMon, 31 Dec 2012 03:14:19 -0800 (PST)" ], "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)", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\n\t:references; bh=/5ncC5EgsN3woSBHhYFzrHL4dYtSJVCH80B+T4BESNg=;\n\tb=Ed8y2sEZdn98i8QEOCxZzKaL/Kb3NdBedprmRpDC2Slbs9HCty0R0E107lkR9wtN4K\n\tQcg11VAfoOB2yRYPrU/RtIay77JwFRY2FS4nCMh3NxbNiDe5NTX58EGvo57HAqfsIFVI\n\tnisxgBw+vfWcjRn525FyrpMVLNiUoKL+CHunGUWHtRAv7ainCsRFlj/SrG/abWWFHjDD\n\t6Qcg0GXbrBm0XZcn0CS3/1Pq/AesFeFnMECGBjyyDWu3eeGd1p07f30Gatu1lMegDP5E\n\tg1WX58x5q87aQmvB8dVuE3dHq85IJGDZ84x9JKt6HHcRPSVfuOga6MVPZZ/Bgem0JNM1\n\t521g==", "X-Received": "by 10.68.238.8 with SMTP id vg8mr127155417pbc.26.1356952460068; \n\tMon, 31 Dec 2012 03:14:20 -0800 (PST)", "From": "Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>", "To": "u-boot@lists.denx.de", "Date": "Mon, 31 Dec 2012 16:43:44 +0530", "Message-Id": "<1356952428-19824-6-git-send-email-jagannadh.teki@gmail.com>", "X-Mailer": "git-send-email 1.7.0.4", "In-Reply-To": "<1356952428-19824-1-git-send-email-jagannadh.teki@gmail.com>", "References": "<1356952428-19824-1-git-send-email-jagannadh.teki@gmail.com>", "Subject": "[U-Boot] [PATCH 05/12] cmd_sf: Define a functions for parsing read\n\tand write instructions", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.11", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<http://lists.denx.de/mailman/options/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": "This patch provides to define a separate functions for parsing read\nand write instructions by taking instruction argument from user.\n\nSo-that the common functions can used in a different levels for\nparsing read and write instructions.\n\nSigned-off-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>\n---\n common/cmd_sf.c | 70 ++++++++++++++++++++++++++++++++++++++++++------------\n 1 files changed, 54 insertions(+), 16 deletions(-)", "diff": "diff --git a/common/cmd_sf.c b/common/cmd_sf.c\nindex 4cfd48a..d59ecce 100644\n--- a/common/cmd_sf.c\n+++ b/common/cmd_sf.c\n@@ -234,6 +234,48 @@ static int spi_flash_update(struct spi_flash *flash, u8 wr_inst, u8 rd_inst,\n \treturn 0;\n }\n \n+/*\n+ * This function parsed the write instruction for write operation\n+ *\n+ * Input:\n+ * arg: specified write instruction from user\n+ * Output:\n+ * wr_inst: parsed write instruction for write operation\n+ * Return:\n+ * 1: for Unknown wr_inst from user\n+ * 0: Success\n+ */\n+static int sf_parse_wr_inst_arg(char *arg, u8 *wr_inst)\n+{\n+\tif (strcmp(arg, \"pp\") == 0)\n+\t\t*wr_inst = CMD_PAGE_PROGRAM;\n+\telse\n+\t\treturn 1;\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * This function parsed the read instruction for read operation\n+ *\n+ * Input:\n+ * arg: specified read instruction from user\n+ * Output:\n+ * rd_inst: parsed read instruction for write operation\n+ * Return:\n+ * 1: for Unknown rd_inst from user\n+ * 0: Success\n+ */\n+static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst)\n+{\n+\tif (strcmp(arg, \"afr\") == 0)\n+\t\t*rd_inst = CMD_READ_ARRAY_FAST;\n+\telse\n+\t\treturn 1;\n+\n+\treturn 0;\n+}\n+\n static int do_spi_flash_read_write(int argc, char * const argv[])\n {\n \tunsigned long addr;\n@@ -281,41 +323,37 @@ static int do_spi_flash_read_write(int argc, char * const argv[])\n \t}\n \n \tif (strcmp(argv[0], \"update\") == 0) {\n-\t\tif (strcmp(argv[1], \"pp\") == 0)\n-\t\t\twr_inst = CMD_PAGE_PROGRAM;\n-\t\telse {\n+\t\tret = sf_parse_wr_inst_arg(argv[1], &wr_inst);\n+\t\tif (ret) {\n \t\t\tprintf(\"SF: Unknown %s wr_inst on 'sf update'\\n\",\n \t\t\t\t\targv[1]);\n-\t\t\treturn 1;\n+\t\t\treturn ret;\n \t\t}\n \n-\t\tif (strcmp(argv[2], \"afr\") == 0)\n-\t\t\trd_inst = CMD_READ_ARRAY_FAST;\n-\t\telse {\n+\t\tret = sf_parse_rd_inst_arg(argv[2], &rd_inst);\n+\t\tif (ret) {\n \t\t\tprintf(\"SF: Unknown %s rd_inst on 'sf update'\\n\",\n \t\t\t\t\targv[2]);\n-\t\t\treturn 1;\n+\t\t\treturn ret;\n \t\t}\n \n \t\tret = spi_flash_update(flash, wr_inst, rd_inst,\n \t\t\t\t\toffset, len, buf);\n \t} else if (strcmp(argv[0], \"read\") == 0) {\n-\t\tif (strcmp(argv[1], \"afr\") == 0)\n-\t\t\trd_inst = CMD_READ_ARRAY_FAST;\n-\t\telse {\n+\t\tret = sf_parse_rd_inst_arg(argv[1], &rd_inst);\n+\t\tif (ret) {\n \t\t\tprintf(\"SF: Unknown %s rd_inst on 'sf read'\\n\",\n \t\t\t\t\targv[1]);\n-\t\t\treturn 1;\n+\t\t\treturn ret;\n \t\t}\n \n \t\tret = spi_flash_read(flash, rd_inst, offset, len, buf);\n \t} else {\n-\t\tif (strcmp(argv[1], \"pp\") == 0)\n-\t\t\twr_inst = CMD_PAGE_PROGRAM;\n-\t\telse {\n+\t\tret = sf_parse_wr_inst_arg(argv[1], &wr_inst);\n+\t\tif (ret) {\n \t\t\tprintf(\"SF: Unknown %s wr_inst on 'sf write'\\n\",\n \t\t\t\t\targv[1]);\n-\t\t\treturn 1;\n+\t\t\treturn ret;\n \t\t}\n \n \t\tret = spi_flash_write(flash, wr_inst, offset, len, buf);\n", "prefixes": [ "U-Boot", "05/12" ] }