get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 556245,
    "url": "http://patchwork.ozlabs.org/api/patches/556245/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/566DF5F6.6070901@simon.arlott.org.uk/",
    "project": {
        "id": 3,
        "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api",
        "name": "Linux MTD development",
        "link_name": "linux-mtd",
        "list_id": "linux-mtd.lists.infradead.org",
        "list_email": "linux-mtd@lists.infradead.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<566DF5F6.6070901@simon.arlott.org.uk>",
    "list_archive_url": null,
    "date": "2015-12-13T22:49:26",
    "name": "[linux-next,v4,06/11] mtd: bcm63xxpart: Remove dependency on mach-bcm63xx",
    "commit_ref": "436e94a6fbcdca133a2546769db4ac0a84265ad1",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "78406a0fb87e86e39cdb1e911a9162d09a798afc",
    "submitter": {
        "id": 1123,
        "url": "http://patchwork.ozlabs.org/api/people/1123/?format=api",
        "name": "Simon Arlott",
        "email": "simon@fire.lp0.eu"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/566DF5F6.6070901@simon.arlott.org.uk/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/556245/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/556245/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n\t[IPv6:2001:1868:205::9])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id B51CF140311\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 14 Dec 2015 09:51:05 +1100 (AEDT)",
            "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))\n\tid 1a8FSi-0006XD-D8; Sun, 13 Dec 2015 22:49:52 +0000",
            "from proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530])\n\tby bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))\n\tid 1a8FSg-0006QS-Da\n\tfor linux-mtd@lists.infradead.org; Sun, 13 Dec 2015 22:49:51 +0000",
            "from redrum.lp0.eu ([2001:8b0:ffea:0:2e0:81ff:fe4d:2bec]:44500\n\tident=simon)\n\tby proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530]:465)\n\twith esmtpsav (UNKNOWN:DHE-RSA-AES256-SHA:256/CN=Simon Arlott)\n\tid 1a8FSK-0003yh-06 (Exim); Sun, 13 Dec 2015 22:49:28 +0000"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tsecure) header.d=fire.lp0.eu header.i=@fire.lp0.eu header.b=TT4CpF/V;\n\tdkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=fire.lp0.eu; s=exim; \n\th=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject;\n\tbh=GyerTdue5vlobALSSD5L+4NrKxyLZnwcn5tW6hYp+8k=; \n\tb=TT4CpF/VSOhzUNyXaJW25FiKmrZAmZ/Yb65zrCt3UaDffbyPAtpNjBSC7MVKXUlPBP9Ksd4VM1UXFTqeE5GMaBH+pVhr0QHxihBPEDDTDzKrZ9sit2gtvwG6UBTP9Sw+G6BtIY71v9m4ezVNIiaXNLaCkwdG5NCQTlWvBJEGnYFEM1Yi/bz5C4dG3DVsNAVqvS6xb9ne6zu1ACpvnBFaPi8pLctBehnQgaOppeAcg2wm5JueMF0O6e4oJdA7SU4pVeEg0vhc3iInada77jsztg3pdUL5Z8GuSxCItIp6l6mlKlPwTqXg9obVCvyHu64iORQ5+uMssU+mzwkkPPUPew==;",
        "Subject": "[PATCH linux-next v4 06/11] mtd: bcm63xxpart: Remove dependency on\n\tmach-bcm63xx",
        "To": "Ralf Baechle <ralf@linux-mips.org>, David Woodhouse\n\t<dwmw2@infradead.org>, Brian Norris <computersforpeace@gmail.com>,\n\tKevin Cernekee <cernekee@gmail.com>, Florian Fainelli\n\t<f.fainelli@gmail.com>, Jonas Gorski <jogo@openwrt.org>",
        "References": "<566DF43B.5010400@simon.arlott.org.uk>",
        "From": "Simon Arlott <simon@fire.lp0.eu>",
        "Message-ID": "<566DF5F6.6070901@simon.arlott.org.uk>",
        "Date": "Sun, 13 Dec 2015 22:49:26 +0000",
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101\n\tThunderbird/38.4.0",
        "MIME-Version": "1.0",
        "In-Reply-To": "<566DF43B.5010400@simon.arlott.org.uk>",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20151213_144950_680981_FC002250 ",
        "X-CRM114-Status": "GOOD (  17.63  )",
        "X-Spam-Score": "-4.3 (----)",
        "X-Spam-Report": "SpamAssassin version 3.4.0 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.3 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [2001:8b0:ffea:0:205:b4ff:fe12:530 listed in]\n\t[list.dnswl.org]\n\t-0.0 SPF_HELO_PASS          SPF: HELO matches SPF record\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature",
        "X-BeenThere": "linux-mtd@lists.infradead.org",
        "X-Mailman-Version": "2.1.20",
        "Precedence": "list",
        "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>",
        "List-Post": "<mailto:linux-mtd@lists.infradead.org>",
        "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>",
        "Cc": "MIPS Mailing List <linux-mips@linux-mips.org>,\n\tMTD Maling List <linux-mtd@lists.infradead.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>",
        "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "Read nvram directly from flash instead of using the in-memory copy that\nmach-bcm63xx has, to remove the dependency on mach-bcm63xx and allow the\nparser to work on bmips too.\n\nRename remaining BCM63XX defines to BCM963XX as these are properties of\nthe flash layout on the board.\n\nBCM963XX_DEFAULT_PSI_SIZE changes from SZ_64K to 64 because it will be\nmultiplied by SZ_1K later on.\n\nSigned-off-by: Simon Arlott <simon@fire.lp0.eu>\n---\nv4: New patch.\n\n drivers/mtd/Kconfig       |  2 +-\n drivers/mtd/bcm63xxpart.c | 72 +++++++++++++++++++++++++++++++++++++----------\n 2 files changed, 58 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig\nindex 42cc953..e83a279 100644\n--- a/drivers/mtd/Kconfig\n+++ b/drivers/mtd/Kconfig\n@@ -142,7 +142,7 @@ config MTD_AR7_PARTS\n \n config MTD_BCM63XX_PARTS\n \ttristate \"BCM63XX CFE partitioning support\"\n-\tdepends on BCM63XX\n+\tdepends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST\n \tselect CRC32\n \thelp\n \t  This provides partions parsing for BCM63xx devices with CFE\ndiff --git a/drivers/mtd/bcm63xxpart.c b/drivers/mtd/bcm63xxpart.c\nindex cec3188..1eea8b6 100644\n--- a/drivers/mtd/bcm63xxpart.c\n+++ b/drivers/mtd/bcm63xxpart.c\n@@ -24,6 +24,7 @@\n \n #define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n \n+#include <linux/bcm963xx_nvram.h>\n #include <linux/bcm963xx_tag.h>\n #include <linux/crc32.h>\n #include <linux/module.h>\n@@ -34,12 +35,11 @@\n #include <linux/mtd/mtd.h>\n #include <linux/mtd/partitions.h>\n \n-#include <asm/mach-bcm63xx/bcm63xx_nvram.h>\n-#include <asm/mach-bcm63xx/board_bcm963xx.h>\n+#define BCM963XX_CFE_BLOCK_SIZE\t\tSZ_64K\t/* always at least 64KiB */\n \n-#define BCM63XX_CFE_BLOCK_SIZE\tSZ_64K\t\t/* always at least 64KiB */\n-\n-#define BCM63XX_CFE_MAGIC_OFFSET 0x4e0\n+#define BCM963XX_CFE_MAGIC_OFFSET\t0x4e0\n+#define BCM963XX_CFE_VERSION_OFFSET\t0x570\n+#define BCM963XX_NVRAM_OFFSET\t\t0x580\n \n static int bcm63xx_detect_cfe(struct mtd_info *master)\n {\n@@ -58,20 +58,45 @@ static int bcm63xx_detect_cfe(struct mtd_info *master)\n \t\treturn 0;\n \n \t/* very old CFE's do not have the cfe-v string, so check for magic */\n-\tret = mtd_read(master, BCM63XX_CFE_MAGIC_OFFSET, 8, &retlen,\n+\tret = mtd_read(master, BCM963XX_CFE_MAGIC_OFFSET, 8, &retlen,\n \t\t       (void *)buf);\n \tbuf[retlen] = 0;\n \n \treturn strncmp(\"CFE1CFE1\", buf, 8);\n }\n \n+static int bcm63xx_read_nvram(struct mtd_info *master,\n+\tstruct bcm963xx_nvram *nvram)\n+{\n+\tu32 actual_crc, expected_crc;\n+\tsize_t retlen;\n+\tint ret;\n+\n+\t/* extract nvram data */\n+\tret = mtd_read(master, BCM963XX_NVRAM_OFFSET, BCM963XX_NVRAM_V5_SIZE,\n+\t\t\t&retlen, (void *)nvram);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = bcm963xx_nvram_checksum(nvram, &expected_crc, &actual_crc);\n+\tif (ret)\n+\t\tpr_warn(\"nvram checksum failed, contents may be invalid (expected %08x, got %08x)\\n\",\n+\t\t\texpected_crc, actual_crc);\n+\n+\tif (!nvram->psi_size)\n+\t\tnvram->psi_size = BCM963XX_DEFAULT_PSI_SIZE;\n+\n+\treturn 0;\n+}\n+\n static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \t\t\t\t\tconst struct mtd_partition **pparts,\n \t\t\t\t\tstruct mtd_part_parser_data *data)\n {\n \t/* CFE, NVRAM and global Linux are always present */\n \tint nrparts = 3, curpart = 0;\n-\tstruct bcm_tag *buf;\n+\tstruct bcm963xx_nvram *nvram = NULL;\n+\tstruct bcm_tag *buf = NULL;\n \tstruct mtd_partition *parts;\n \tint ret;\n \tsize_t retlen;\n@@ -86,25 +111,35 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \tif (bcm63xx_detect_cfe(master))\n \t\treturn -EINVAL;\n \n+\tnvram = vzalloc(sizeof(*nvram));\n+\tif (!nvram)\n+\t\treturn -ENOMEM;\n+\n+\tret = bcm63xx_read_nvram(master, nvram);\n+\tif (ret)\n+\t\tgoto out;\n+\n \tcfe_erasesize = max_t(uint32_t, master->erasesize,\n-\t\t\t      BCM63XX_CFE_BLOCK_SIZE);\n+\t\t\t      BCM963XX_CFE_BLOCK_SIZE);\n \n \tcfelen = cfe_erasesize;\n-\tnvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K;\n+\tnvramlen = nvram->psi_size * SZ_1K;\n \tnvramlen = roundup(nvramlen, cfe_erasesize);\n \n \t/* Allocate memory for buffer */\n \tbuf = vmalloc(sizeof(struct bcm_tag));\n-\tif (!buf)\n-\t\treturn -ENOMEM;\n+\tif (!buf) {\n+\t\tret = -ENOMEM;\n+\t\tgoto out;\n+\t}\n \n \t/* Get the tag */\n \tret = mtd_read(master, cfelen, sizeof(struct bcm_tag), &retlen,\n \t\t       (void *)buf);\n \n \tif (retlen != sizeof(struct bcm_tag)) {\n-\t\tvfree(buf);\n-\t\treturn -EIO;\n+\t\tret = -EIO;\n+\t\tgoto out;\n \t}\n \n \tcomputed_crc = crc32_le(IMAGETAG_CRC_START, (u8 *)buf,\n@@ -154,8 +189,8 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \t/* Ask kernel for more memory */\n \tparts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL);\n \tif (!parts) {\n-\t\tvfree(buf);\n-\t\treturn -ENOMEM;\n+\t\tret = -ENOMEM;\n+\t\tgoto out;\n \t}\n \n \t/* Start building partition list */\n@@ -206,8 +241,15 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \t\tsparelen);\n \n \t*pparts = parts;\n+\tret = 0;\n+\n+out:\n+\tvfree(nvram);\n \tvfree(buf);\n \n+\tif (ret)\n+\t\treturn ret;\n+\n \treturn nrparts;\n };\n \n",
    "prefixes": [
        "linux-next",
        "v4",
        "06/11"
    ]
}