[PATCH] scst_main: Suppress a checkpatch warning triggered by INIT_CACHEP{,_ALIGN}

Avoid that checkpatch v3.18 reports the following warning for these
two macros:

WARNING: Macros with flow control statements should be avoided

This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5985 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2015-01-22 05:06:45 +00:00
parent ca87894980
commit f5a3f799c3

View File

@@ -2500,55 +2500,59 @@ static int __init init_scst(void)
}
/* Used for rarely used or read-mostly on fast path structures */
#define INIT_CACHEP(p, s, o) do { \
p = KMEM_CACHE(s, SCST_SLAB_FLAGS); \
TRACE_MEM("Slab create: %s at %p size %zd", #s, p, \
#define INIT_CACHEP(p, s) ({ \
(p) = KMEM_CACHE(s, SCST_SLAB_FLAGS); \
TRACE_MEM("Slab create: %s at %p size %zd", #s, (p), \
sizeof(struct s)); \
if (p == NULL) { \
res = -ENOMEM; \
goto o; \
} \
} while (0)
(p); \
})
/* Used for structures with fast path write access */
#define INIT_CACHEP_ALIGN(p, s, o) do { \
p = KMEM_CACHE(s, SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN); \
TRACE_MEM("Slab create: %s at %p size %zd", #s, p, \
#define INIT_CACHEP_ALIGN(p, s) ({ \
(p) = KMEM_CACHE(s, SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN);\
TRACE_MEM("Slab create: %s at %p size %zd", #s, (p), \
sizeof(struct s)); \
if (p == NULL) { \
res = -ENOMEM; \
goto o; \
} \
} while (0)
(p); \
})
INIT_CACHEP(scst_mgmt_cachep, scst_mgmt_cmd, out_lib_exit);
INIT_CACHEP(scst_mgmt_stub_cachep, scst_mgmt_cmd_stub,
out_destroy_mgmt_cache);
INIT_CACHEP(scst_ua_cachep, scst_tgt_dev_UA,
out_destroy_mgmt_stub_cache);
res = -ENOMEM;
if (!INIT_CACHEP(scst_mgmt_cachep, scst_mgmt_cmd))
goto out_lib_exit;
if (!INIT_CACHEP(scst_mgmt_stub_cachep, scst_mgmt_cmd_stub))
goto out_destroy_mgmt_cache;
if (!INIT_CACHEP(scst_ua_cachep, scst_tgt_dev_UA))
goto out_destroy_mgmt_stub_cache;
{
struct scst_sense { uint8_t s[SCST_SENSE_BUFFERSIZE]; };
INIT_CACHEP(scst_sense_cachep, scst_sense,
out_destroy_ua_cache);
if (!INIT_CACHEP(scst_sense_cachep, scst_sense))
goto out_destroy_ua_cache;
}
INIT_CACHEP(scst_aen_cachep, scst_aen, out_destroy_sense_cache); /* read-mostly */
INIT_CACHEP_ALIGN(scst_cmd_cachep, scst_cmd, out_destroy_aen_cache);
if (!INIT_CACHEP(scst_aen_cachep, scst_aen)) /* read-mostly */
goto out_destroy_sense_cache;
if (!INIT_CACHEP_ALIGN(scst_cmd_cachep, scst_cmd))
goto out_destroy_aen_cache;
#ifdef CONFIG_SCST_MEASURE_LATENCY
INIT_CACHEP_ALIGN(scst_sess_cachep, scst_session,
out_destroy_cmd_cache);
if (!INIT_CACHEP_ALIGN(scst_sess_cachep, scst_session))
goto out_destroy_cmd_cache;
#else
/* Big enough with read-mostly head and tail */
INIT_CACHEP(scst_sess_cachep, scst_session, out_destroy_cmd_cache);
if (!INIT_CACHEP(scst_sess_cachep, scst_session))
goto out_destroy_cmd_cache;
#endif
INIT_CACHEP(scst_dev_cachep, scst_device, out_destroy_sess_cache); /* big enough */
INIT_CACHEP(scst_tgt_cachep, scst_tgt, out_destroy_dev_cache); /* read-mostly */
if (!INIT_CACHEP(scst_dev_cachep, scst_device)) /* big enough */
goto out_destroy_sess_cache;
if (!INIT_CACHEP(scst_tgt_cachep, scst_tgt)) /* read-mostly */
goto out_destroy_dev_cache;
#ifdef CONFIG_SCST_MEASURE_LATENCY
INIT_CACHEP_ALIGN(scst_tgtd_cachep, scst_tgt_dev, out_destroy_tgt_cache); /* big enough */
if (!INIT_CACHEP_ALIGN(scst_tgtd_cachep, scst_tgt_dev)) /* big enough */
goto out_destroy_tgt_cache;
#else
/* Big enough with read-mostly head and tail */
INIT_CACHEP(scst_tgtd_cachep, scst_tgt_dev, out_destroy_tgt_cache); /* big enough */
if (!INIT_CACHEP(scst_tgtd_cachep, scst_tgt_dev)) /* big enough */
goto out_destroy_tgt_cache;
#endif
INIT_CACHEP(scst_acgd_cachep, scst_acg_dev, out_destroy_tgtd_cache); /* read-mostly */
if (!INIT_CACHEP(scst_acgd_cachep, scst_acg_dev)) /* read-mostly */
goto out_destroy_tgtd_cache;
scst_mgmt_mempool = mempool_create(64, mempool_alloc_slab,
mempool_free_slab, scst_mgmt_cachep);