Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/972/?format=api
{ "id": 972, "url": "http://patchwork.ozlabs.org/api/patches/972/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/200809222150.m8MLod61031866@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": "<200809222150.m8MLod61031866@imap1.linux-foundation.org>", "list_archive_url": null, "date": "2008-09-22T21:50:39", "name": "[4/8] drivers/atm: Use DIV_ROUND_UP", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "4a0582c64e2d27abe9e89f4f69f0717cd387fdb0", "submitter": { "id": 107, "url": "http://patchwork.ozlabs.org/api/people/107/?format=api", "name": "Andrew Morton", "email": "akpm@linux-foundation.org" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/200809222150.m8MLod61031866@imap1.linux-foundation.org/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/972/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/972/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 51EF9DDE08\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 07:57:52 +1000 (EST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754010AbYIVV5r (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 17:57:47 -0400", "(majordomo@vger.kernel.org) by vger.kernel.org id S1753929AbYIVV5q\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 17:57:46 -0400", "from smtp1.linux-foundation.org ([140.211.169.13]:34492 \"EHLO\n\tsmtp1.linux-foundation.org\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1753920AbYIVV5n (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 17:57:43 -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 m8MLrDO9018507\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tMon, 22 Sep 2008 14:57:33 -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\tm8MLod61031866; Mon, 22 Sep 2008 14:50:39 -0700" ], "Message-Id": "<200809222150.m8MLod61031866@imap1.linux-foundation.org>", "Subject": "[patch 4/8] drivers/atm: Use DIV_ROUND_UP", "To": "davem@davemloft.net", "Cc": "netdev@vger.kernel.org, akpm@linux-foundation.org, julia@diku.dk,\n\tchas@cmf.nrl.navy.mil", "From": "akpm@linux-foundation.org", "Date": "Mon, 22 Sep 2008 14:50:39 -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: Julia Lawall <julia@diku.dk>\n\nThe kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /\n(d)) but is perhaps more readable.\n\nIn the case of the file drivers/atm/eni.c, I am a little bit suspicious of\nthe -1 at the end of the affected expression. Please check that that is\nwhat is wanted.\n\nAn extract of the semantic patch that makes this change is as follows:\n(http://www.emn.fr/x-info/coccinelle/)\n\n// <smpl>\n@haskernel@\n@@\n\n#include <linux/kernel.h>\n\n@depends on haskernel@\nexpression n,d;\n@@\n\n(\n- (n + d - 1) / d\n+ DIV_ROUND_UP(n,d)\n|\n- (n + (d - 1)) / d\n+ DIV_ROUND_UP(n,d)\n)\n\n@depends on haskernel@\nexpression n,d;\n@@\n\n- DIV_ROUND_UP((n),d)\n+ DIV_ROUND_UP(n,d)\n\n@depends on haskernel@\nexpression n,d;\n@@\n\n- DIV_ROUND_UP(n,(d))\n+ DIV_ROUND_UP(n,d)\n// </smpl>\n\nSigned-off-by: Julia Lawall <julia@diku.dk>\nCc: Chas Williams <chas@cmf.nrl.navy.mil>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\n---\n\n drivers/atm/eni.c | 2 +-\n drivers/atm/horizon.c | 8 ++++----\n drivers/atm/zatm.c | 6 +++---\n 3 files changed, 8 insertions(+), 8 deletions(-)", "diff": "diff -puN drivers/atm/eni.c~drivers-atm-use-div_round_up drivers/atm/eni.c\n--- a/drivers/atm/eni.c~drivers-atm-use-div_round_up\n+++ a/drivers/atm/eni.c\n@@ -1270,7 +1270,7 @@ static int comp_tx(struct eni_dev *eni_d\n \t\t\tif (*pre < 3) (*pre)++; /* else fail later */\n \t\t\tdiv = pre_div[*pre]*-*pcr;\n \t\t\tDPRINTK(\"max div %d\\n\",div);\n-\t\t\t*res = (TS_CLOCK+div-1)/div-1;\n+\t\t\t*res = DIV_ROUND_UP(TS_CLOCK, div)-1;\n \t\t}\n \t\tif (*res < 0) *res = 0;\n \t\tif (*res > MID_SEG_MAX_RATE) *res = MID_SEG_MAX_RATE;\ndiff -puN drivers/atm/horizon.c~drivers-atm-use-div_round_up drivers/atm/horizon.c\n--- a/drivers/atm/horizon.c~drivers-atm-use-div_round_up\n+++ a/drivers/atm/horizon.c\n@@ -635,7 +635,7 @@ static int make_rate (const hrz_dev * de\n \t\t// take care of rounding\n \t\tswitch (r) {\n \t\t\tcase round_down:\n-\t\t\t\tpre = (br+(c<<div)-1)/(c<<div);\n+\t\t\t\tpre = DIV_ROUND_UP(br, c<<div);\n \t\t\t\t// but p must be non-zero\n \t\t\t\tif (!pre)\n \t\t\t\t\tpre = 1;\n@@ -668,7 +668,7 @@ static int make_rate (const hrz_dev * de\n \t\t\t// take care of rounding\n \t\t\tswitch (r) {\n \t\t\t\tcase round_down:\n-\t\t\t\t\tpre = (br+(c<<div)-1)/(c<<div);\n+\t\t\t\t\tpre = DIV_ROUND_UP(br, c<<div);\n \t\t\t\t\tbreak;\n \t\t\t\tcase round_nearest:\n \t\t\t\t\tpre = (br+(c<<div)/2)/(c<<div);\n@@ -698,7 +698,7 @@ got_it:\n \t\tif (bits)\n \t\t\t*bits = (div<<CLOCK_SELECT_SHIFT) | (pre-1);\n \t\tif (actual) {\n-\t\t\t*actual = (br + (pre<<div) - 1) / (pre<<div);\n+\t\t\t*actual = DIV_ROUND_UP(br, pre<<div);\n \t\t\tPRINTD (DBG_QOS, \"actual rate: %u\", *actual);\n \t\t}\n \t\treturn 0;\n@@ -1967,7 +1967,7 @@ static int __devinit hrz_init (hrz_dev *\n // Set the max AAL5 cell count to be just enough to contain the\n // largest AAL5 frame that the user wants to receive\n wr_regw (dev, MAX_AAL5_CELL_COUNT_OFF,\n-\t (max_rx_size + ATM_AAL5_TRAILER + ATM_CELL_PAYLOAD - 1) / ATM_CELL_PAYLOAD);\n+\t DIV_ROUND_UP(max_rx_size + ATM_AAL5_TRAILER, ATM_CELL_PAYLOAD));\n \n // Enable receive\n wr_regw (dev, RX_CONFIG_OFF, rd_regw (dev, RX_CONFIG_OFF) | RX_ENABLE);\ndiff -puN drivers/atm/zatm.c~drivers-atm-use-div_round_up drivers/atm/zatm.c\n--- a/drivers/atm/zatm.c~drivers-atm-use-div_round_up\n+++ a/drivers/atm/zatm.c\n@@ -496,8 +496,8 @@ static int open_rx_first(struct atm_vcc \n \t\t\tvcc->qos.rxtp.max_sdu = 65464;\n \t\t\t/* fix this - we may want to receive 64kB SDUs\n \t\t\t later */\n-\t\tcells = (vcc->qos.rxtp.max_sdu+ATM_AAL5_TRAILER+\n-\t\t ATM_CELL_PAYLOAD-1)/ATM_CELL_PAYLOAD;\n+\t\tcells = DIV_ROUND_UP(vcc->qos.rxtp.max_sdu + ATM_AAL5_TRAILER,\n+\t\t\t\tATM_CELL_PAYLOAD);\n \t\tzatm_vcc->pool = pool_index(cells*ATM_CELL_PAYLOAD);\n \t}\n \telse {\n@@ -820,7 +820,7 @@ static int alloc_shaper(struct atm_dev *\n \t\t\t}\n \t\t\telse {\n \t\t\t\ti = 255;\n-\t\t\t\tm = (ATM_OC3_PCR*255+max-1)/max;\n+\t\t\t\tm = DIV_ROUND_UP(ATM_OC3_PCR*255, max);\n \t\t\t}\n \t\t}\n \t\tif (i > m) {\n", "prefixes": [ "4/8" ] }