Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/489828/?format=api
{ "id": 489828, "url": "http://patchwork.ozlabs.org/api/patches/489828/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20150630221655.24543.21613.stgit@htfujina-fc.jf.intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20150630221655.24543.21613.stgit@htfujina-fc.jf.intel.com>", "list_archive_url": null, "date": "2015-06-30T22:16:55", "name": "igb: use ARRAY_SIZE to replace calculating sizeof(a)/sizeof(a[0])", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "698c4af57d9921e94730d2ce4bafe6ccb132f8eb", "submitter": { "id": 29211, "url": "http://patchwork.ozlabs.org/api/people/29211/?format=api", "name": "Fujinaka, Todd", "email": "todd.fujinaka@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20150630221655.24543.21613.stgit@htfujina-fc.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/489828/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/489828/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ozlabs.org (Postfix) with ESMTP id 1D1E614030F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 1 Jul 2015 08:20:02 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9CEBA91B59;\n\tTue, 30 Jun 2015 22:20:01 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id cWSLMY+otfBk; Tue, 30 Jun 2015 22:20:00 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 86E2891B55;\n\tTue, 30 Jun 2015 22:20:00 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 2C3D41C0FDB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 30 Jun 2015 22:19:59 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 253F233409\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 30 Jun 2015 22:19:59 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id NR0CYeOqARrt for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 30 Jun 2015 22:19:57 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby silver.osuosl.org (Postfix) with ESMTP id 47F5D33401\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 30 Jun 2015 22:19:57 +0000 (UTC)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga103.fm.intel.com with ESMTP; 30 Jun 2015 15:19:55 -0700", "from htfujina-fc.jf.intel.com ([134.134.145.128])\n\tby orsmga003.jf.intel.com with ESMTP; 30 Jun 2015 15:19:49 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.15,381,1432623600\"; d=\"scan'208\";a=\"597732943\"", "From": "Todd Fujinaka <todd.fujinaka@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 30 Jun 2015 15:16:55 -0700", "Message-ID": "<20150630221655.24543.21613.stgit@htfujina-fc.jf.intel.com>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH] igb: use ARRAY_SIZE to replace\n\tcalculating sizeof(a)/sizeof(a[0])", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "Use the ARRAY_SIZE macro rather than calculating sizeof(a)/sizeof(a[0]).\nAlso directly replace the code rather than using an unnecessary define.\n\nSigned-off-by: Todd Fujinaka <todd.fujinaka@intel.com>\nReported-by: Maninder Singh <maninder1.s@samsung.com>\nReported-by: Joe Perches <joe@perches.com>\n---\n drivers/net/ethernet/intel/igb/e1000_phy.c | 16 +++++-----------\n 1 file changed, 5 insertions(+), 11 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c\nindex c1bb64d..987c9de 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_phy.c\n+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c\n@@ -1,5 +1,5 @@\n /* Intel(R) Gigabit Ethernet Linux driver\n- * Copyright(c) 2007-2014 Intel Corporation.\n+ * Copyright(c) 2007-2015 Intel Corporation.\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms and conditions of the GNU General Public License,\n@@ -36,9 +36,6 @@ static s32 igb_set_master_slave_mode(struct e1000_hw *hw);\n /* Cable length tables */\n static const u16 e1000_m88_cable_length_table[] = {\n \t0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };\n-#define M88E1000_CABLE_LENGTH_TABLE_SIZE \\\n-\t(sizeof(e1000_m88_cable_length_table) / \\\n-\tsizeof(e1000_m88_cable_length_table[0]))\n \n static const u16 e1000_igp_2_cable_length_table[] = {\n \t0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,\n@@ -49,9 +46,6 @@ static const u16 e1000_igp_2_cable_length_table[] = {\n \t60, 66, 72, 77, 82, 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121,\n \t83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,\n \t104, 109, 114, 118, 121, 124};\n-#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \\\n-\t(sizeof(e1000_igp_2_cable_length_table) / \\\n-\t sizeof(e1000_igp_2_cable_length_table[0]))\n \n /**\n * igb_check_reset_block - Check if PHY reset is blocked\n@@ -1700,7 +1694,7 @@ s32 igb_get_cable_length_m88(struct e1000_hw *hw)\n \n \tindex = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >>\n \t\tM88E1000_PSSR_CABLE_LENGTH_SHIFT;\n-\tif (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) {\n+\tif (index >= ARRAY_SIZE(e1000_m88_cable_length_table) - 1) {\n \t\tret_val = -E1000_ERR_PHY;\n \t\tgoto out;\n \t}\n@@ -1796,7 +1790,7 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)\n \n \t\tindex = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >>\n \t\t\tM88E1000_PSSR_CABLE_LENGTH_SHIFT;\n-\t\tif (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) {\n+\t\tif (index >= ARRAY_SIZE(e1000_m88_cable_length_table) - 1) {\n \t\t\tret_val = -E1000_ERR_PHY;\n \t\t\tgoto out;\n \t\t}\n@@ -1840,7 +1834,7 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw)\n \ts32 ret_val = 0;\n \tu16 phy_data, i, agc_value = 0;\n \tu16 cur_agc_index, max_agc_index = 0;\n-\tu16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1;\n+\tu16 min_agc_index = ARRAY_SIZE(e1000_igp_2_cable_length_table) - 1;\n \tstatic const u16 agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = {\n \t\tIGP02E1000_PHY_AGC_A,\n \t\tIGP02E1000_PHY_AGC_B,\n@@ -1863,7 +1857,7 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw)\n \t\t\t\tIGP02E1000_AGC_LENGTH_MASK;\n \n \t\t/* Array index bound check. */\n-\t\tif ((cur_agc_index >= IGP02E1000_CABLE_LENGTH_TABLE_SIZE) ||\n+\t\tif ((cur_agc_index >= ARRAY_SIZE(e1000_igp_2_cable_length_table)) ||\n \t\t (cur_agc_index == 0)) {\n \t\t\tret_val = -E1000_ERR_PHY;\n \t\t\tgoto out;\n", "prefixes": [] }