From patchwork Sun Sep 12 09:56:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 173012 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8C9vG6i017975 for ; Sun, 12 Sep 2010 09:57:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751563Ab0ILJ5O (ORCPT ); Sun, 12 Sep 2010 05:57:14 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:32948 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751045Ab0ILJ5O (ORCPT ); Sun, 12 Sep 2010 05:57:14 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from kliteyn@mellanox.co.il) with SMTP; 12 Sep 2010 11:56:28 +0200 Received: from [10.4.1.29] (10.4.1.29) by mtlmail01.mtl.com (10.0.8.12) with Microsoft SMTP Server id 8.2.254.0; Sun, 12 Sep 2010 11:57:10 +0200 Message-ID: <4C8CA3E7.8060406@mellanox.co.il> Date: Sun, 12 Sep 2010 11:56:55 +0200 From: Yevgeny Kliteynik Reply-To: kliteyn@dev.mellanox.co.il User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky , Linux RDMA Subject: [PATCH] opensm/osm_helper.c: use ARR_SIZE macro instead of hardcoded values Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 12 Sep 2010 09:57:16 +0000 (UTC) diff --git a/opensm/opensm/osm_helper.c b/opensm/opensm/osm_helper.c index 58bc86b..2597e50 100644 --- a/opensm/opensm/osm_helper.c +++ b/opensm/opensm/osm_helper.c @@ -84,7 +84,7 @@ static const char *ib_sa_method_str[] = { "UNKNOWN" /* 16 */ }; -#define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16 +#define OSM_SA_METHOD_STR_UNKNOWN_VAL (ARR_SIZE(ib_sa_method_str) - 1) static const char *ib_sa_resp_method_str[] = { "RESERVED", /* 80 */ @@ -148,7 +148,7 @@ static const char *ib_sm_method_str[] = { "UNKNOWN" /* 20 */ }; -#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x20 +#define OSM_SM_METHOD_STR_UNKNOWN_VAL (ARR_SIZE(ib_sm_method_str) - 1) static const char *ib_sm_attr_str[] = { "RESERVED", /* 0 */ @@ -187,7 +187,7 @@ static const char *ib_sm_attr_str[] = { "UNKNOWN" /* 21 - always highest value */ }; -#define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21 +#define OSM_SM_ATTR_STR_UNKNOWN_VAL (ARR_SIZE(ib_sm_attr_str) - 1) static const char *ib_sa_attr_str[] = { "RESERVED", /* 0 */ @@ -437,7 +437,7 @@ static const char *ib_sa_attr_str[] = { "UNKNOWN" /* F4 - always highest value */ }; -#define OSM_SA_ATTR_STR_UNKNOWN_VAL 0xF4 +#define OSM_SA_ATTR_STR_UNKNOWN_VAL (ARR_SIZE(ib_sa_attr_str) - 1) static int sprint_uint8_arr(char *buf, size_t size, const uint8_t * arr, size_t len)