Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809265/?format=api
{ "id": 809265, "url": "http://patchwork.ozlabs.org/api/patches/809265/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504439110050-1961876957-7-diffsplit-thomas@m3y3r.de/", "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": "<1504439110050-1961876957-7-diffsplit-thomas@m3y3r.de>", "list_archive_url": null, "date": "2017-09-03T12:19:31", "name": "[7/10] net/mlx4_core: Use ARRAY_SIZE macro", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "117f0869bde2f7117ca1fdcc276ffa56c5cc0fa4", "submitter": { "id": 10277, "url": "http://patchwork.ozlabs.org/api/people/10277/?format=api", "name": "Thomas Meyer", "email": "thomas@m3y3r.de" }, "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/1504439110050-1961876957-7-diffsplit-thomas@m3y3r.de/mbox/", "series": [ { "id": 1221, "url": "http://patchwork.ozlabs.org/api/series/1221/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1221", "date": "2017-09-03T12:19:31", "name": null, "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1221/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809265/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809265/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlXRf18wbz9sP3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSun, 3 Sep 2017 22:32:14 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753093AbdICMbn (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 3 Sep 2017 08:31:43 -0400", "from www17.your-server.de ([213.133.104.17]:34288 \"EHLO\n\twww17.your-server.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752863AbdICMae (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 3 Sep 2017 08:30:34 -0400", "from [95.222.27.54] (helo=olymp)\n\tby www17.your-server.de with esmtpsa\n\t(TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2)\n\t(envelope-from <thomas@m3y3r.de>)\n\tid 1doU2q-0007Pj-Us; Sun, 03 Sep 2017 14:30:33 +0200" ], "Subject": "[PATCH 7/10] net/mlx4_core: Use ARRAY_SIZE macro", "From": "Thomas Meyer <thomas@m3y3r.de>", "To": "netdev@vger.kernel.org, linux-rdma@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org", "Content-Type": "text/plain; charset=\"UTF-8\"", "Mime-Version": "1.0", "Message-ID": "<1504439110050-1961876957-7-diffsplit-thomas@m3y3r.de>", "References": "<1504439110050-939061377-0-diffsplit-thomas@m3y3r.de>", "In-Reply-To": "<1504439110050-939061377-0-diffsplit-thomas@m3y3r.de>", "Date": "Sun, 03 Sep 2017 14:19:31 +0200", "X-Mailer": "Evolution 3.22.6-1 ", "Content-Transfer-Encoding": "7bit", "X-Authenticated-Sender": "thomas@m3y3r.de", "X-Virus-Scanned": "Clear (ClamAV 0.99.2/23763/Sun Sep 3 10:37:41 2017)", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Use ARRAY_SIZE macro, rather than explicitly coding some variant of it\nyourself.\nFound with: find -type f -name \"*.c\" -o -name \"*.h\" | xargs perl -p -i -e\n's/\\bsizeof\\s*\\(\\s*(\\w+)\\s*\\)\\s*\\ /\\s*sizeof\\s*\\(\\s*\\1\\s*\\[\\s*0\\s*\\]\\s*\\)\n/ARRAY_SIZE(\\1)/g' and manual check/verification.\n\nSigned-off-by: Thomas Meyer <thomas@m3y3r.de>\n---", "diff": "diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c\nindex 041c0ed65929..8eca12927be0 100644\n--- a/drivers/net/ethernet/mellanox/mlx4/fw.c\n+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c\n@@ -36,6 +36,7 @@\n #include <linux/mlx4/cmd.h>\n #include <linux/module.h>\n #include <linux/cache.h>\n+#include <linux/kernel.h>\n \n #include \"fw.h\"\n #include \"icm.h\"\n@@ -2450,14 +2451,14 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev,\n \tcsum_mask = (config_dev.rx_checksum_val >> CONFIG_DEV_RX_CSUM_MODE_PORT1_BIT_OFFSET) &\n \t\t\tCONFIG_DEV_RX_CSUM_MODE_MASK;\n \n-\tif (csum_mask >= sizeof(config_dev_csum_flags)/sizeof(config_dev_csum_flags[0]))\n+\tif (csum_mask >= ARRAY_SIZE(config_dev_csum_flags))\n \t\treturn -EINVAL;\n \tparams->rx_csum_flags_port_1 = config_dev_csum_flags[csum_mask];\n \n \tcsum_mask = (config_dev.rx_checksum_val >> CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET) &\n \t\t\tCONFIG_DEV_RX_CSUM_MODE_MASK;\n \n-\tif (csum_mask >= sizeof(config_dev_csum_flags)/sizeof(config_dev_csum_flags[0]))\n+\tif (csum_mask >= ARRAY_SIZE(config_dev_csum_flags))\n \t\treturn -EINVAL;\n \tparams->rx_csum_flags_port_2 = config_dev_csum_flags[csum_mask];\n \ndiff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c\nindex 5fe5cdc51357..fe18650c9342 100644\n--- a/drivers/net/ethernet/mellanox/mlx4/main.c\n+++ b/drivers/net/ethernet/mellanox/mlx4/main.c\n@@ -34,6 +34,7 @@\n */\n \n #include <linux/module.h>\n+#include <linux/kernel.h>\n #include <linux/init.h>\n #include <linux/errno.h>\n #include <linux/pci.h>\n@@ -3658,7 +3659,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,\n \t * per port, we must limit the number of VFs to 63 (since their are\n \t * 128 MACs)\n \t */\n-\tfor (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]) && i < num_vfs_argc;\n+\tfor (i = 0; i < ARRAY_SIZE(nvfs) && i < num_vfs_argc;\n \t total_vfs += nvfs[param_map[num_vfs_argc - 1][i]], i++) {\n \t\tnvfs[param_map[num_vfs_argc - 1][i]] = num_vfs[i];\n \t\tif (nvfs[i] < 0) {\n@@ -3667,7 +3668,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,\n \t\t\tgoto err_disable_pdev;\n \t\t}\n \t}\n-\tfor (i = 0; i < sizeof(prb_vf)/sizeof(prb_vf[0]) && i < probe_vfs_argc;\n+\tfor (i = 0; i < ARRAY_SIZE(prb_vf) && i < probe_vfs_argc;\n \t i++) {\n \t\tprb_vf[param_map[probe_vfs_argc - 1][i]] = probe_vf[i];\n \t\tif (prb_vf[i] < 0 || prb_vf[i] > nvfs[i]) {\n@@ -3746,11 +3747,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,\n \t\tif (total_vfs) {\n \t\t\tunsigned vfs_offset = 0;\n \n-\t\t\tfor (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]) &&\n+\t\t\tfor (i = 0; i < ARRAY_SIZE(nvfs) &&\n \t\t\t vfs_offset + nvfs[i] < extended_func_num(pdev);\n \t\t\t vfs_offset += nvfs[i], i++)\n \t\t\t\t;\n-\t\t\tif (i == sizeof(nvfs)/sizeof(nvfs[0])) {\n+\t\t\tif (i == ARRAY_SIZE(nvfs)) {\n \t\t\t\terr = -ENODEV;\n \t\t\t\tgoto err_release_regions;\n \t\t\t}\n", "prefixes": [ "7/10" ] }