get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 961,
    "url": "http://patchwork.ozlabs.org/api/patches/961/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/200809222152.m8MLqAdT031941@imap1.linux-foundation.org/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<200809222152.m8MLqAdT031941@imap1.linux-foundation.org>",
    "list_archive_url": null,
    "date": "2008-09-22T21:52:10",
    "name": "[03/21] sundance: set carrier status on link change events",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "346932c627cf7bb4a2f5b42721f8711f99722e22",
    "submitter": {
        "id": 107,
        "url": "http://patchwork.ozlabs.org/api/people/107/?format=api",
        "name": "Andrew Morton",
        "email": "akpm@linux-foundation.org"
    },
    "delegate": {
        "id": 36,
        "url": "http://patchwork.ozlabs.org/api/users/36/?format=api",
        "username": "jgarzik",
        "first_name": "Jeff",
        "last_name": "Garzik",
        "email": "jgarzik@pobox.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/200809222152.m8MLqAdT031941@imap1.linux-foundation.org/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/961/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/961/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 87DF7DDF16\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 07:53:51 +1000 (EST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753665AbYIVVxr (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 17:53:47 -0400",
            "(majordomo@vger.kernel.org) by vger.kernel.org id S1753651AbYIVVxr\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 17:53:47 -0400",
            "from smtp1.linux-foundation.org ([140.211.169.13]:59575 \"EHLO\n\tsmtp1.linux-foundation.org\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1753563AbYIVVxp (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 17:53:45 -0400",
            "from imap1.linux-foundation.org (imap1.linux-foundation.org\n\t[140.211.169.55])\n\tby smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with\n\tESMTP id m8MLqAmD018333\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tMon, 22 Sep 2008 14:52:11 -0700",
            "from localhost.localdomain (localhost [127.0.0.1])\n\tby imap1.linux-foundation.org\n\t(8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id\n\tm8MLqAdT031941; Mon, 22 Sep 2008 14:52:10 -0700"
        ],
        "Message-Id": "<200809222152.m8MLqAdT031941@imap1.linux-foundation.org>",
        "Subject": "[patch 03/21] sundance: set carrier status on link change events",
        "To": "jeff@garzik.org",
        "Cc": "netdev@vger.kernel.org, akpm@linux-foundation.org,\n\tdbn.lists@gmail.com",
        "From": "akpm@linux-foundation.org",
        "Date": "Mon, 22 Sep 2008 14:52:10 -0700",
        "X-Spam-Status": "No, hits=-3.359 required=5 tests=AWL, BAYES_00,\n\tOSDL_HEADER_SUBJECT_BRACKETED",
        "X-Spam-Checker-Version": "SpamAssassin 3.2.4-osdl_revision__1.47__",
        "X-MIMEDefang-Filter": "lf$Revision: 1.188 $",
        "X-Scanned-By": "MIMEDefang 2.63 on 140.211.169.13",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "From: Dan Nicholson <dbn.lists@gmail.com>\n\nCheck if the link is available when a changed interrupt has been received and\nset the carrier status appropriately.  The code is copied nearly verbatim from\nthe dl2k module.  The link status could be used in more places in the driver,\nbut this is enough to get the carrier status reported to userspace.  Fixes\nkernel bug #7487:\n\n    http://bugzilla.kernel.org/show_bug.cgi?id=7487\n\n[akpm@linux-foundation.org: coding-style fixes]\nSigned-off-by: Dan Nicholson <dbn.lists@gmail.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\n---\n\n drivers/net/sundance.c |   95 +++++++++++++++++++++++++--------------\n 1 file changed, 62 insertions(+), 33 deletions(-)",
    "diff": "diff -puN drivers/net/sundance.c~sundance-set-carrier-status-on-link-change-events drivers/net/sundance.c\n--- a/drivers/net/sundance.c~sundance-set-carrier-status-on-link-change-events\n+++ a/drivers/net/sundance.c\n@@ -409,6 +409,7 @@ static int  change_mtu(struct net_device\n static int  eeprom_read(void __iomem *ioaddr, int location);\n static int  mdio_read(struct net_device *dev, int phy_id, int location);\n static void mdio_write(struct net_device *dev, int phy_id, int location, int value);\n+static int  mdio_wait_link(struct net_device *dev, int wait);\n static int  netdev_open(struct net_device *dev);\n static void check_duplex(struct net_device *dev);\n static void netdev_timer(unsigned long data);\n@@ -785,6 +786,24 @@ static void mdio_write(struct net_device\n \treturn;\n }\n \n+static int mdio_wait_link(struct net_device *dev, int wait)\n+{\n+\tint bmsr;\n+\tint phy_id;\n+\tstruct netdev_private *np;\n+\n+\tnp = netdev_priv(dev);\n+\tphy_id = np->phys[0];\n+\n+\tdo {\n+\t\tbmsr = mdio_read(dev, phy_id, MII_BMSR);\n+\t\tif (bmsr & 0x0004)\n+\t\t\treturn 0;\n+\t\tmdelay(1);\n+\t} while (--wait > 0);\n+\treturn -1;\n+}\n+\n static int netdev_open(struct net_device *dev)\n {\n \tstruct netdev_private *np = netdev_priv(dev);\n@@ -1393,41 +1412,51 @@ static void netdev_error(struct net_devi\n \tint speed;\n \n \tif (intr_status & LinkChange) {\n-\t\tif (np->an_enable) {\n-\t\t\tmii_advertise = mdio_read (dev, np->phys[0], MII_ADVERTISE);\n-\t\t\tmii_lpa= mdio_read (dev, np->phys[0], MII_LPA);\n-\t\t\tmii_advertise &= mii_lpa;\n-\t\t\tprintk (KERN_INFO \"%s: Link changed: \", dev->name);\n-\t\t\tif (mii_advertise & ADVERTISE_100FULL) {\n-\t\t\t\tnp->speed = 100;\n-\t\t\t\tprintk (\"100Mbps, full duplex\\n\");\n-\t\t\t} else if (mii_advertise & ADVERTISE_100HALF) {\n-\t\t\t\tnp->speed = 100;\n-\t\t\t\tprintk (\"100Mbps, half duplex\\n\");\n-\t\t\t} else if (mii_advertise & ADVERTISE_10FULL) {\n-\t\t\t\tnp->speed = 10;\n-\t\t\t\tprintk (\"10Mbps, full duplex\\n\");\n-\t\t\t} else if (mii_advertise & ADVERTISE_10HALF) {\n-\t\t\t\tnp->speed = 10;\n-\t\t\t\tprintk (\"10Mbps, half duplex\\n\");\n-\t\t\t} else\n-\t\t\t\tprintk (\"\\n\");\n+\t\tif (mdio_wait_link(dev, 10) == 0) {\n+\t\t\tprintk(KERN_INFO \"%s: Link up\\n\", dev->name);\n+\t\t\tif (np->an_enable) {\n+\t\t\t\tmii_advertise = mdio_read(dev, np->phys[0],\n+\t\t\t\t\t\t\t   MII_ADVERTISE);\n+\t\t\t\tmii_lpa = mdio_read(dev, np->phys[0], MII_LPA);\n+\t\t\t\tmii_advertise &= mii_lpa;\n+\t\t\t\tprintk(KERN_INFO \"%s: Link changed: \",\n+\t\t\t\t\tdev->name);\n+\t\t\t\tif (mii_advertise & ADVERTISE_100FULL) {\n+\t\t\t\t\tnp->speed = 100;\n+\t\t\t\t\tprintk(\"100Mbps, full duplex\\n\");\n+\t\t\t\t} else if (mii_advertise & ADVERTISE_100HALF) {\n+\t\t\t\t\tnp->speed = 100;\n+\t\t\t\t\tprintk(\"100Mbps, half duplex\\n\");\n+\t\t\t\t} else if (mii_advertise & ADVERTISE_10FULL) {\n+\t\t\t\t\tnp->speed = 10;\n+\t\t\t\t\tprintk(\"10Mbps, full duplex\\n\");\n+\t\t\t\t} else if (mii_advertise & ADVERTISE_10HALF) {\n+\t\t\t\t\tnp->speed = 10;\n+\t\t\t\t\tprintk(\"10Mbps, half duplex\\n\");\n+\t\t\t\t} else\n+\t\t\t\t\tprintk(\"\\n\");\n \n+\t\t\t} else {\n+\t\t\t\tmii_ctl = mdio_read(dev, np->phys[0], MII_BMCR);\n+\t\t\t\tspeed = (mii_ctl & BMCR_SPEED100) ? 100 : 10;\n+\t\t\t\tnp->speed = speed;\n+\t\t\t\tprintk(KERN_INFO \"%s: Link changed: %dMbps ,\",\n+\t\t\t\t\tdev->name, speed);\n+\t\t\t\tprintk(\"%s duplex.\\n\",\n+\t\t\t\t\t(mii_ctl & BMCR_FULLDPLX) ?\n+\t\t\t\t\t\t\"full\" : \"half\");\n+\t\t\t}\n+\t\t\tcheck_duplex(dev);\n+\t\t\tif (np->flowctrl && np->mii_if.full_duplex) {\n+\t\t\t\tiowrite16(ioread16(ioaddr + MulticastFilter1+2) | 0x0200,\n+\t\t\t\t\tioaddr + MulticastFilter1+2);\n+\t\t\t\tiowrite16(ioread16(ioaddr + MACCtrl0) | EnbFlowCtrl,\n+\t\t\t\t\tioaddr + MACCtrl0);\n+\t\t\t}\n+\t\t\tnetif_carrier_on(dev);\n \t\t} else {\n-\t\t\tmii_ctl = mdio_read (dev, np->phys[0], MII_BMCR);\n-\t\t\tspeed = (mii_ctl & BMCR_SPEED100) ? 100 : 10;\n-\t\t\tnp->speed = speed;\n-\t\t\tprintk (KERN_INFO \"%s: Link changed: %dMbps ,\",\n-\t\t\t\tdev->name, speed);\n-\t\t\tprintk (\"%s duplex.\\n\", (mii_ctl & BMCR_FULLDPLX) ?\n-\t\t\t\t\"full\" : \"half\");\n-\t\t}\n-\t\tcheck_duplex (dev);\n-\t\tif (np->flowctrl && np->mii_if.full_duplex) {\n-\t\t\tiowrite16(ioread16(ioaddr + MulticastFilter1+2) | 0x0200,\n-\t\t\t\tioaddr + MulticastFilter1+2);\n-\t\t\tiowrite16(ioread16(ioaddr + MACCtrl0) | EnbFlowCtrl,\n-\t\t\t\tioaddr + MACCtrl0);\n+\t\t\tprintk(KERN_INFO \"%s: Link down\\n\", dev->name);\n+\t\t\tnetif_carrier_off(dev);\n \t\t}\n \t}\n \tif (intr_status & StatsMax) {\n",
    "prefixes": [
        "03/21"
    ]
}