Re: [PATCH] IB/iser: constify iser_reg_ops structure

2015-11-29 Thread Sagi Grimberg



On 28/11/2015 17:52, Julia Lawall wrote:

The iser_reg_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall 


Thanks,

Acked-by: Sagi Grimberg 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] mstflint source code cleanup patches

2015-11-29 Thread Bart Van Assche
These four patches bring the mstflint coding style closer to that of the 
other RDMA user space software. The patches in this series are:


0001-Fix-several-automake-warnings.patch
0002-Makefile.am-Remove-the-undefined-variable-MFT_EXT_LI.patch
0003-crd_read_line-Rework-code-to-suppress-a-compiler-war.patch
0004-Fix-compiler-warnings-about-set-but-not-used-variabl.patch
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] Fix several automake warnings

2015-11-29 Thread Bart Van Assche
Avoid that automake reports the following warning messages:

configure.ac:13: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are 
deprecated.  For more info, see:
configure.ac:13: 
http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
small_utils/Makefile.am:50: warning: compiling 'mtserver.c' with per-target 
flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
warning: 'libdev_mgt.a': linking libraries using a non-POSIX archiver requires 
'AM_PROG_AR' in 'configure.ac'
warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

Signed-off-by: Bart Van Assche 
---
 cmdif/Makefile.am| 2 +-
 cmdparser/Makefile.am| 2 --
 configure.ac | 4 +++-
 dev_mgt/Makefile.am  | 2 +-
 flint/Makefile.am| 2 +-
 mflash/Makefile.am   | 2 +-
 mft_utils/Makefile.am| 2 +-
 mlxconfig/Makefile.am| 2 +-
 mlxfwops/lib/Makefile.am | 2 +-
 mstdump/crd_lib/Makefile.am  | 2 +-
 mstdump/crd_main/Makefile.am | 2 +-
 mtcr_ul/Makefile.am  | 2 +-
 reg_access/Makefile.am   | 2 +-
 small_utils/Makefile.am  | 2 +-
 tools_layouts/Makefile.am| 2 +-
 tools_res_mgmt/Makefile.am   | 2 +-
 16 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/cmdif/Makefile.am b/cmdif/Makefile.am
index 78aba47..8c03fe9 100644
--- a/cmdif/Makefile.am
+++ b/cmdif/Makefile.am
@@ -34,7 +34,7 @@
 USER_DIR = $(top_srcdir)
 MTCR_DIR = $(USER_DIR)/include/mtcr_ul
 TOOLS_LAYOUTS_DIR = $(USER_DIR)/tools_layouts
-INCLUDES = -I. -I../common -I../tools_layouts  -I$(MTCR_DIR) -I.. 
-I$(USER_DIR)/mtcr_ul
+AM_CPPFLAGS = -I. -I../common -I../tools_layouts  -I$(MTCR_DIR) -I.. 
-I$(USER_DIR)/mtcr_ul
 
 AM_CFLAGS = -W -Wall -Werror -g -MP -MD $(COMPILER_FPIC) -DCMDIF_EXPORTS
 CMDIF_VERSION = 1
diff --git a/cmdparser/Makefile.am b/cmdparser/Makefile.am
index 9696f71..952a074 100644
--- a/cmdparser/Makefile.am
+++ b/cmdparser/Makefile.am
@@ -32,8 +32,6 @@
 
 # Makefile.am -- Process this file with automake to produce Makefile.in
 
-INCLUDES =
-
 AM_CPPFLAGS = -W  -g -MP -MD -fPIC
 
 noinst_LIBRARIES = libcmdparser.a
diff --git a/configure.ac b/configure.ac
index be0f9d1..04fb61d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,11 +10,13 @@ AC_SUBST([VERSION])
 
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_SRCDIR([README])
-AM_INIT_AUTOMAKE(mstflint, 4.1.0)
+AM_INIT_AUTOMAKE([-Wall foreign])
 
 dnl Checks for programs
 AC_PROG_CC
+AM_PROG_CC_C_O
 AC_PROG_CXX
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_CONFIG_HEADERS( config.h )
 
diff --git a/dev_mgt/Makefile.am b/dev_mgt/Makefile.am
index 703a27a..147f7aa 100644
--- a/dev_mgt/Makefile.am
+++ b/dev_mgt/Makefile.am
@@ -32,7 +32,7 @@
 
 # Makefile.am -- Process this file with automake to produce Makefile.in
 
-INCLUDES = -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/common  
-I$(top_srcdir)/include/mtcr_ul
+AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/common  
-I$(top_srcdir)/include/mtcr_ul
 
 AM_CFLAGS = -W -Wall -g -MP -MD -Wswitch-enum $(COMPILER_FPIC) -DMTCR_EXPORT
 noinst_LIBRARIES = libdev_mgt.a
diff --git a/flint/Makefile.am b/flint/Makefile.am
index f001515..96bb6ad 100755
--- a/flint/Makefile.am
+++ b/flint/Makefile.am
@@ -38,7 +38,7 @@ LAYOUTS_DIR = $(top_srcdir)/tools_layouts
 MFT_UTILS_DIR = $(top_srcdir)/mft_utils
 CMDIF_DIR   = $(top_srcdir)/cmdif
 
-INCLUDES = -I$(top_srcdir) -I$(srcdir) -I$(MTCR_DIR) -I$(MFLASH_DIR) 
-I$(COMMON_DIR) \
+AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(MTCR_DIR) -I$(MFLASH_DIR) 
-I$(COMMON_DIR) \
-I$(LAYOUTS_DIR) -I$(MFT_UTILS_DIR)
 
 mstflint_CXXFLAGS = -Wall -W -g -MP -MD -pipe -DEXTERNAL
diff --git a/mflash/Makefile.am b/mflash/Makefile.am
index 950cabd..c45351a 100644
--- a/mflash/Makefile.am
+++ b/mflash/Makefile.am
@@ -31,7 +31,7 @@
 #--
 
 # Makefile.am -- Process this file with automake to produce Makefile.in
-INCLUDES= -I. -I$(top_srcdir)/include/mtcr_ul -I$(top_srcdir)/common 
-I$(top_srcdir)/tools_layouts -I$(top_srcdir)/reg_access \
+AM_CPPFLAGS= -I. -I$(top_srcdir)/include/mtcr_ul -I$(top_srcdir)/common 
-I$(top_srcdir)/tools_layouts -I$(top_srcdir)/reg_access \
   -I$(top_srcdir)/cmdif -I$(top_srcdir)/tools_res_mgmt
 
 AM_CFLAGS = -MD -pipe -Wall -W -DMST_UL -g ${MFLASH_INBAND_FLAG}
diff --git a/mft_utils/Makefile.am b/mft_utils/Makefile.am
index ad9ad8e..ebb3bf3 100644
--- a/mft_utils/Makefile.am
+++ b/mft_utils/Makefile.am
@@ -32,7 +32,7 @@
 
 # Makefile.am -- Process this file with automake to produce Makefile.in
 USER_DIR = $(top_srcdir)
-INCLUDES = -I. -I$(USER_DIR)/common
+AM_CPPFLAGS = -I. -I$(USER_DIR)/common
 
 AM_CFLAGS = -MD -pipe -Wall -W -Werror
 
diff --git a/mlxconfig/Makefile.am b/mlxconfig/Makefile.am
index f4ce674..2b2fd3e 100755
--- a/mlxconfig/Makefile.am
+++ b/mlxconfig/Makefile.am
@@ -42,7 +42,7 @@ UTILS_LIB = $(USER_DIR)/mft_utils/libmftutils.a
 CMDIF_DIR = $(USER_DIR)/cmdif
 
 
-INCLUDES = -I. -I$(USER_DIR) -I$(top_srcdir)/include/mtcr_ul -I$(MTCR_DIR) 
-I$(C

[PATCH 2/4] Makefile.am: Remove the undefined variable MFT_EXT_LIBS_INC_DIR

2015-11-29 Thread Bart Van Assche
This avoids that the option sequence "-I -I" is passed to the compiler,
a sequence that causes weird error messages to be printed.

Signed-off-by: Bart Van Assche 
---
 mlxconfig/Makefile.am| 2 +-
 mlxfwops/lib/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlxconfig/Makefile.am b/mlxconfig/Makefile.am
index 2b2fd3e..c9189aa 100755
--- a/mlxconfig/Makefile.am
+++ b/mlxconfig/Makefile.am
@@ -43,7 +43,7 @@ CMDIF_DIR = $(USER_DIR)/cmdif
 
 
 AM_CPPFLAGS = -I. -I$(USER_DIR) -I$(top_srcdir)/include/mtcr_ul -I$(MTCR_DIR) 
-I$(COMMON_DIR) $(WIN64_INC)\
-   -I$(MFT_EXT_LIBS_INC_DIR) -I $(LAYOUTS_DIR) 
-I$(MFT_EXT_LIBS_INC_DIR)/zlib -I $(UTILS_DIR) -I$(DEV_MGT_DIR) -I$(CMDIF_DIR)
+   -I $(LAYOUTS_DIR) -I $(UTILS_DIR) -I$(DEV_MGT_DIR) -I$(CMDIF_DIR)
 
 AM_CXXFLAGS = -Wall -W -g -MP -MD -pipe
 bin_PROGRAMS = mstconfig
diff --git a/mlxfwops/lib/Makefile.am b/mlxfwops/lib/Makefile.am
index 8690345..c04d333 100755
--- a/mlxfwops/lib/Makefile.am
+++ b/mlxfwops/lib/Makefile.am
@@ -41,7 +41,7 @@ UTILS_LIB = $(top_srcdir)/mft_utils
 UEFI_COMMON_DIR = $(top_srcdir)/mlxfwops/uefi_c
 
 AM_CPPFLAGS = -I$(srcdir) -I$(MTCR_INC_DIR) -I$(MFLASH_DIR) 
-I$(top_srcdir)/ext_libs/json -I$(MINIXZ_DIR)\
-   -I$(COMMON_DIR) -I$(MFT_EXT_LIBS_INC_DIR)/zlib -I $(LAYOUTS_DIR) 
-I$(top_srcdir)/common -I$(UTILS_LIB) -I$(UEFI_COMMON_DIR)
+   -I$(COMMON_DIR) -I $(LAYOUTS_DIR) -I$(top_srcdir)/common 
-I$(UTILS_LIB) -I$(UEFI_COMMON_DIR)
 
 MLXFWOPS_VERSION = 1
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] crd_read_line(): Rework code to suppress a compiler warning

2015-11-29 Thread Bart Van Assche
Avoid that gcc prints a warning about not checking the result of fgets().

Signed-off-by: Bart Van Assche 
---
 mstdump/crd_lib/crdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mstdump/crd_lib/crdump.c b/mstdump/crd_lib/crdump.c
index 451a944..3e3c4bc 100755
--- a/mstdump/crd_lib/crdump.c
+++ b/mstdump/crd_lib/crdump.c
@@ -504,8 +504,8 @@ static int crd_read_line(IN FILE *fd, OUT char *tmp) {
 if (!feof(fd)) {
 int c = fgetc(fd);
 if (c == '#') {
-char* _ptr=fgets (tmp, 300, fd);
-(void)_ptr;//avoid warning
+if (fgets(tmp, 300, fd)) {
+}
 tmp[0] = 0;
 continue;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] Fix compiler warnings about set-but-not-used variables

2015-11-29 Thread Bart Van Assche
Recent gcc versions emit a warning if a variable is set but not used.
Suppress these warnings by removing dummy assignments to unused arguments.
Additionally, enable the compiler command-line option -Wno-unused-parameter
and remove the '(void)arg' statements that thereby became superfluous.

Signed-off-by: Bart Van Assche 
---
 cmdif/tools_cif.c|   1 -
 cmdparser/my_getopt.c|   3 -
 common/compatibility.h   |   7 +
 flint/Makefile.am|   2 +-
 flint/subcommands.cpp|   5 -
 mflash/Makefile.am   |   2 +-
 mflash/mflash.c  |  15 +-
 mlxconfig/Makefile.am|   2 +-
 mlxconfig/mlxcfg_param_lib.cpp   |  19 -
 mlxconfig/mlxcfg_param_lib.h |  10 +-
 mlxconfig/mlxcfg_ui.cpp  |   1 -
 mlxfwops/lib/Makefile.am |   2 +-
 mlxfwops/lib/flint_io.cpp|   5 +-
 mlxfwops/lib/fs2_ops.cpp |  31 --
 mlxfwops/lib/fs3_ops.cpp |  17 +-
 mlxfwops/lib/fw_ops.cpp  |   4 -
 mtcr_ul/Makefile.am  |   2 +-
 mtcr_ul/mtcr_ib_ofed.c   |   1 -
 mtcr_ul/mtcr_ul.c|  22 +-
 mtcr_ul/mtcr_ul_icmd_cif.c   |   1 -
 small_utils/mcra.c   |   1 -
 tools_layouts/cibfw_layouts.c| 249 --
 tools_layouts/cx4fw_layouts.c|  95 
 tools_layouts/register_access_open_layouts.c |  49 --
 tools_layouts/register_access_sib_layouts.c  |  97 
 tools_layouts/tools_open_layouts.c   | 685 ---
 26 files changed, 25 insertions(+), 1303 deletions(-)

diff --git a/cmdif/tools_cif.c b/cmdif/tools_cif.c
index c6afc68..d767ada 100644
--- a/cmdif/tools_cif.c
+++ b/cmdif/tools_cif.c
@@ -132,7 +132,6 @@ const char* tcif_err2str(MError rc) {
 MError tcif_cr_mbox_supported(mfile* dev)
 {
 #if defined(__FreeBSD__) || defined(UEFI_BUILD)
-(void)dev;
 return ME_NOT_IMPLEMENTED;
 #else
 return tools_cmdif_is_cr_mbox_supported(dev);
diff --git a/cmdparser/my_getopt.c b/cmdparser/my_getopt.c
index be6281d..6e64b35 100755
--- a/cmdparser/my_getopt.c
+++ b/cmdparser/my_getopt.c
@@ -394,9 +394,6 @@
/* Start processing options with ARGV-element 1 (since ARGV-element 0
   is the program name); the sequence of previously skipped
   non-option ARGV-elements is empty.  */
-   // avoid compiler warnings
-   (void) argc;
-   (void) argv;
first_nonopt = last_nonopt = tools_optind;
 
nextchar = NULL;
diff --git a/common/compatibility.h b/common/compatibility.h
index 8dc85e3..8f3b4d5 100644
--- a/common/compatibility.h
+++ b/common/compatibility.h
@@ -215,6 +215,13 @@
 #endif
 
 /*
+ * Windows (Microsoft C Compiler)
+ */
+#ifdef _MSC_VER
+#pragma warning (disable: 4100) // 'identifier' : unreferenced formal parameter
+#endif
+
+/*
  * Windows (CYGWIN)
  */
 #if defined(__CYGWIN32__)
diff --git a/flint/Makefile.am b/flint/Makefile.am
index 96bb6ad..5ae5ee5 100755
--- a/flint/Makefile.am
+++ b/flint/Makefile.am
@@ -41,7 +41,7 @@ CMDIF_DIR   = $(top_srcdir)/cmdif
 AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(MTCR_DIR) -I$(MFLASH_DIR) 
-I$(COMMON_DIR) \
-I$(LAYOUTS_DIR) -I$(MFT_UTILS_DIR)
 
-mstflint_CXXFLAGS = -Wall -W -g -MP -MD -pipe -DEXTERNAL
+mstflint_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter -g -MP -MD -pipe 
-DEXTERNAL
 bin_PROGRAMS = mstflint
 
 mstflint_SOURCES = flint.cpp flint.h subcommands.cpp subcommands.h\
diff --git a/flint/subcommands.cpp b/flint/subcommands.cpp
index 91400a5..5b60334 100644
--- a/flint/subcommands.cpp
+++ b/flint/subcommands.cpp
@@ -981,10 +981,6 @@ bool SubCommand::unzipDataFile (std::vector 
data, std::vector& data, con
 
 bool SubCommand::checkGuidsFlags (chip_type_t ct, u_int16_t devType, u_int8_t 
fwType,
 bool guidsSpecified, bool macsSpecified, bool 
uidsSpecified, bool ibDev, bool ethDev) {
-(void)ibDev;
 if (guidsSpecified || macsSpecified || uidsSpecified) {
 if (ct == CT_BRIDGEX) {
 if (macsSpecified || guidsSpecified) {
diff --git a/mflash/Makefile.am b/mflash/Makefile.am
index c45351a..12da860 100644
--- a/mflash/Makefile.am
+++ b/mflash/Makefile.am
@@ -34,7 +34,7 @@
 AM_CPPFLAGS= -I. -I$(top_srcdir)/include/mtcr_ul -I$(top_srcdir)/common 
-I$(top_srcdir)/tools_layouts -I$(top_srcdir)/reg_access \
   -I$(top_srcdir)/cmdif -I$(top_srcdir)/tools_res_mgmt
 
-AM_CFLAGS = -MD -pipe -Wall -W -DMST_UL -g ${MFLASH_INBAND_FLAG}
+AM_CFLAGS = -MD -pipe -Wall -Wextra -Wno-unused-parameter -DMST_UL -g 
${MFLASH_INBAND_FLAG}
 
 noinst_LIBRARIES = libmflash.a
 
diff --git a/mflash/mflash.c b/mflash/mflash.c
index c039127..4174f39 100644
--- a/mflash/mflash.c
+++ b/mflash/mflash.c
@@ -100,9 +100,7 @@
 #include 
 #define TIMER_INIT()\

[PATCH 0/3] constify mmu_notifier_ops structures

2015-11-29 Thread Julia Lawall
mmu_notifier_ops structures are never modified, so declare them all as
const.

---

 drivers/infiniband/core/umem_odp.c |2 +-
 drivers/iommu/amd_iommu_v2.c   |2 +-
 drivers/xen/gntdev.c   |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] IB/core: constify mmu_notifier_ops structures

2015-11-29 Thread Julia Lawall
This mmu_notifier_ops structure is never modified, so declare it as
const, like the other mmu_notifier_ops structures.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall 

---
The patches in this series are independent of each other.

 drivers/infiniband/core/umem_odp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/umem_odp.c 
b/drivers/infiniband/core/umem_odp.c
index 40becdb..e69bf26 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -232,7 +232,7 @@ static void ib_umem_notifier_invalidate_range_end(struct 
mmu_notifier *mn,
ib_ucontext_notifier_end_account(context);
 }
 
-static struct mmu_notifier_ops ib_umem_notifiers = {
+static const struct mmu_notifier_ops ib_umem_notifiers = {
.release= ib_umem_notifier_release,
.invalidate_page= ib_umem_notifier_invalidate_page,
.invalidate_range_start = ib_umem_notifier_invalidate_range_start,

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] IB/core: constify mmu_notifier_ops structures

2015-11-29 Thread Haggai Eran
On 30/11/2015 00:02, Julia Lawall wrote:
> This mmu_notifier_ops structure is never modified, so declare it as
> const, like the other mmu_notifier_ops structures.
> 
> Done with the help of Coccinelle.
> 
> Signed-off-by: Julia Lawall 

Reviewed-by: Haggai Eran 

Thanks,
Haggai

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html