scst: Address more checkpatch warnings

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6850 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2016-03-27 16:56:50 +00:00
parent 3990a6ccd4
commit 30f362caa3
19 changed files with 60 additions and 38 deletions
+5 -3
View File
@@ -88,8 +88,10 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
typedef cpumask_t cpumask_var_t[1];
#define cpumask_bits(maskp) ((maskp)->bits)
#ifdef CONFIG_CPUMASK_OFFSTACK
/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
* not all bits may be allocated. */
/*
* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
* not all bits may be allocated.
*/
#define nr_cpumask_bits nr_cpu_ids
#else
#define nr_cpumask_bits NR_CPUS
@@ -341,7 +343,7 @@ static inline bool list_entry_in_list(const struct list_head *entry)
/* <linux/lockdep.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
#define lockdep_assert_held(l) do { (void)(l); } while (0)
#define lockdep_assert_held(l) (void)(l)
#endif
/* <linux/kernel.h> */
+1 -1
View File
@@ -1819,7 +1819,7 @@ struct scst_tgt {
/* Divide two 64-bit numbers with reasonably accuracy. */
static inline void __scst_time_per_cmd(uint64_t *t, uint64_t n)
{
unsigned shift;
unsigned int shift;
if (!n)
return;
+1 -1
View File
@@ -481,7 +481,7 @@ static inline int scst_sense_response_code(const uint8_t *sense)
* From <linux/fs.h>. See also commit
* d30a2605be9d5132d95944916e8f578fcfe4f976.
*/
#define BLKDISCARD _IO(0x12,119)
#define BLKDISCARD _IO(0x12, 119)
#endif
/*************************************************************
+1 -1
View File
@@ -99,7 +99,7 @@ static int cdrom_attach(struct scst_device *dev)
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_CDROM_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
+1
View File
@@ -81,6 +81,7 @@ static int scst_dev_handler_build_std_proc(struct scst_dev_type *dev_type)
/* Create the proc file entry for the device */
/* Workaround to keep /proc ABI intact */
const char *name;
if (strcmp(dev_type->name, "vdisk_fileio") == 0)
name = "vdisk";
else
+1 -1
View File
@@ -196,7 +196,7 @@ static int disk_attach(struct scst_device *dev)
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_DISK_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
+1 -1
View File
@@ -200,7 +200,7 @@ static int modisk_attach(struct scst_device *dev)
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_MODISK_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
+2
View File
@@ -4048,11 +4048,13 @@ static int dev_user_read_proc(struct seq_file *seq, struct scst_dev_type *dev_ty
list_for_each_entry(dev, &dev_list, dev_list_entry) {
int i;
seq_printf(seq, "Device %s commands:\n", dev->name);
spin_lock_irqsave(&dev->udev_cmd_threads.cmd_list_lock, flags);
for (i = 0; i < (int)ARRAY_SIZE(dev->ucmd_hash); i++) {
struct list_head *head = &dev->ucmd_hash[i];
struct scst_user_cmd *ucmd;
list_for_each_entry(ucmd, head, hash_list_entry) {
seq_printf(seq, "ucmd %p (state %x, ref %d), "
"sent_to_user %d, seen_by_user %d, "
+14 -6
View File
@@ -22,6 +22,9 @@
* GNU General Public License for more details.
*/
#ifndef INSIDE_KERNEL_TREE
#include <linux/version.h>
#endif
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/string.h>
@@ -34,14 +37,15 @@
#include <linux/ctype.h>
#include <linux/writeback.h>
#include <linux/vmalloc.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
#include <linux/atomic.h>
#else
#include <asm/atomic.h>
#endif
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/namei.h>
#ifndef INSIDE_KERNEL_TREE
#include <linux/version.h>
#endif
#include <asm/div64.h>
#include <asm/unaligned.h>
#include <linux/slab.h>
@@ -3318,7 +3322,8 @@ err:
* @small_sg_size: size of @small_sg
* @p_sg_cnt: pointer to an int where the sg vector size will be written
*/
static struct scatterlist *alloc_sg(size_t size, unsigned off, gfp_t gfp_mask,
static struct scatterlist *alloc_sg(size_t size, unsigned int off,
gfp_t gfp_mask,
struct scatterlist *small_sg,
int small_sg_size, int *p_sg_cnt)
{
@@ -6447,6 +6452,7 @@ static inline void blockio_check_finish(struct scst_blockio_work *blockio_work)
static void blockio_bio_destructor(struct bio *bio)
{
struct scst_blockio_work *blockio_work = bio->bi_private;
bio_free(bio, blockio_work->bioset);
blockio_check_finish(blockio_work);
}
@@ -7000,6 +7006,7 @@ struct bio_priv_sync {
static void blockio_bio_destructor_sync(struct bio *bio)
{
struct bio_priv_sync *s = bio->bi_private;
bio_free(bio, s->bs);
complete(&s->c1);
}
@@ -7053,7 +7060,7 @@ static void blockio_end_sync_io(struct bio *bio)
* Increments *@loff with the number of bytes transferred upon success.
*/
static ssize_t blockio_rw_sync(struct scst_vdisk_dev *virt_dev, void *buf,
size_t len, loff_t *loff, unsigned rw)
size_t len, loff_t *loff, unsigned int rw)
{
struct bio_priv_sync s = {
COMPLETION_INITIALIZER_ONSTACK(s.c), 0,
@@ -7068,7 +7075,7 @@ static ssize_t blockio_rw_sync(struct scst_vdisk_dev *virt_dev, void *buf,
void *p;
struct page *q;
int max_nr_vecs, rc;
unsigned bytes, off;
unsigned int bytes, off;
ssize_t ret = -ENOMEM;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)) && (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 6, 0))
bool submitted = false;
@@ -10114,6 +10121,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset,
if (isdigit(*p)) {
char *pp;
block_size = simple_strtoul(p, &pp, 0);
p = pp;
if ((*p != '\0') && !isspace(*p)) {
+4 -4
View File
@@ -3025,9 +3025,8 @@ static int scst_cm_add_to_descr_list(struct scst_cmd *ec_cmd,
fcmd = __scst_create_prepare_internal_cmd(ec_cmd->cdb,
ec_cmd->cdb_len, SCST_CMD_QUEUE_SIMPLE, tgt_dev,
GFP_KERNEL, true);
if (fcmd == NULL) {
if (fcmd == NULL)
goto out_enomem_free_e;
}
fcmd->expected_data_direction = ec_cmd->expected_data_direction;
fcmd->expected_transfer_len_full = ec_cmd->expected_transfer_len_full;
@@ -3073,8 +3072,9 @@ skip_fcmd_create:
if (tp != NULL) {
if (((unsigned long)t->cm_fcmd->dev) <= ((unsigned long)tp->cm_fcmd->dev)) {
list_for_each_entry(t, &priv->cm_sorted_devs_list, cm_sorted_devs_list_entry) {
printk(KERN_EMERG "%s: t %p, cm dev %p\n", __func__,
t, t->cm_fcmd->dev);
pr_emerg("%s: t %p, cm dev %p\n",
__func__, t,
t->cm_fcmd->dev);
}
sBUG();
break;
+2 -2
View File
@@ -525,11 +525,11 @@ struct scst_dlm_readdir_context {
/* Append the name of each directory entry to the buffer @arg points to. */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
static int scst_dlm_filldir(void *arg, const char *name_arg, int name_len,
loff_t curr_pos, u64 inode, unsigned dtype)
loff_t curr_pos, u64 inode, unsigned int dtype)
#else
static int scst_dlm_filldir(struct dir_context *arg, const char *name_arg,
int name_len, loff_t curr_pos, u64 inode,
unsigned dtype)
unsigned int dtype)
#endif
{
char *p, *q, name[64];
+1 -1
View File
@@ -27,7 +27,7 @@ static struct class *scst_event_sysfs_class;
static int scst_event_major;
#define SCST_MAX_EVENTS 2048
#define SCST_MAX_PAYLOAD 3*1024
#define SCST_MAX_PAYLOAD (3*1024)
#define SCST_DEFAULT_EVENT_TIMEOUT (60*HZ)
struct scst_event_priv {
+5 -5
View File
@@ -4533,7 +4533,7 @@ out:
*/
int scst_acg_repl_lun(struct scst_acg *acg, struct kobject *parent,
struct scst_device *dev, uint64_t lun,
unsigned flags)
unsigned int flags)
{
struct scst_acg_dev *acg_dev;
bool del_gen_ua = false;
@@ -6759,7 +6759,7 @@ static void scst_send_release(struct scst_device *dev)
"SCSI mid-level");
rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0,
sense, 15, 0, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
@@ -13172,7 +13172,7 @@ int scst_obtain_device_parameters(struct scst_device *dev,
TRACE(TRACE_SCSI, "%s", "Doing internal MODE_SENSE");
rc = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer,
sizeof(buffer), sense_buffer, 15, 0, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
, NULL
#endif
);
@@ -14472,7 +14472,7 @@ out_unlock:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
void scst_vfs_unlink_and_put(struct nameidata *nd)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
vfs_unlink(nd->dentry->d_parent->d_inode, nd->dentry);
dput(nd->dentry);
mntput(nd->mnt);
@@ -14500,7 +14500,7 @@ void scst_vfs_unlink_and_put(struct path *path)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
void scst_path_put(struct nameidata *nd)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
dput(nd->dentry);
mntput(nd->mnt);
#else
+3 -3
View File
@@ -725,7 +725,7 @@ static const char *const scst_cmd_state_name[] = {
[SCST_CMD_STATE_XMIT_WAIT] = "XMIT_WAIT",
};
char *scst_get_cmd_state_name(char *name, int len, unsigned state)
char *scst_get_cmd_state_name(char *name, int len, unsigned int state)
{
if (state < ARRAY_SIZE(scst_cmd_state_name) &&
scst_cmd_state_name[state])
@@ -804,7 +804,7 @@ static const char *const scst_tm_fn_name[] = {
[SCST_PR_ABORT_ALL] = "PR_ABORT_ALL",
};
char *scst_get_tm_fn_name(char *name, int len, unsigned fn)
char *scst_get_tm_fn_name(char *name, int len, unsigned int fn)
{
if (fn < ARRAY_SIZE(scst_tm_fn_name) && scst_tm_fn_name[fn])
strlcpy(name, scst_tm_fn_name[fn], len);
@@ -823,7 +823,7 @@ static const char *const scst_mcmd_state_name[] = {
[SCST_MCMD_STATE_FINISHED] = "FINISHED",
};
char *scst_get_mcmd_state_name(char *name, int len, unsigned state)
char *scst_get_mcmd_state_name(char *name, int len, unsigned int state)
{
if (state < ARRAY_SIZE(scst_mcmd_state_name) &&
scst_mcmd_state_name[state])
+1 -1
View File
@@ -47,7 +47,7 @@
#include <asm/unaligned.h>
#include <stdarg.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
#include <linux/mount.h>
#endif
+5 -5
View File
@@ -277,9 +277,9 @@ extern void scst_tgt_dev_stop_threads(struct scst_tgt_dev *tgt_dev);
extern struct scst_dev_type scst_null_devtype;
char *scst_get_cmd_state_name(char *name, int len, unsigned state);
char *scst_get_mcmd_state_name(char *name, int len, unsigned state);
char *scst_get_tm_fn_name(char *name, int len, unsigned fn);
char *scst_get_cmd_state_name(char *name, int len, unsigned int state);
char *scst_get_mcmd_state_name(char *name, int len, unsigned int state);
char *scst_get_tm_fn_name(char *name, int len, unsigned int fn);
extern struct scst_cmd *__scst_check_deferred_commands_locked(
struct scst_order_data *order_data, bool return_first);
@@ -375,7 +375,7 @@ int scst_acg_del_lun(struct scst_acg *acg, uint64_t lun,
bool gen_report_luns_changed);
int scst_acg_repl_lun(struct scst_acg *acg, struct kobject *parent,
struct scst_device *dev, uint64_t lun,
unsigned flags);
unsigned int flags);
int scst_acg_add_acn(struct scst_acg *acg, const char *name);
#ifdef CONFIG_SCST_PROC
@@ -428,7 +428,7 @@ static inline int scst_dlm_new_lockspace(const char *name, int namelen,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
static inline int scst_exec_req(struct scsi_device *sdev,
const unsigned char *cmd, int cmd_len, int data_direction,
struct scatterlist *sgl, unsigned bufflen, unsigned nents,
struct scatterlist *sgl, unsigned int bufflen, unsigned int nents,
int timeout, int retries, void *privdata,
void (*done)(void *, char *, int, int), gfp_t gfp)
{
+8
View File
@@ -235,6 +235,7 @@ static DEFINE_MUTEX(scst_proc_mutex);
static int strcasecmp(const char *s1, const char *s2)
{
int c1, c2;
do {
c1 = tolower(*s1++);
c2 = tolower(*s2++);
@@ -246,6 +247,7 @@ static int strcasecmp(const char *s1, const char *s2)
static int strncasecmp(const char *s1, const char *s2, size_t n)
{
int c1, c2;
do {
c1 = tolower(*s1++);
c2 = tolower(*s2++);
@@ -595,6 +597,7 @@ static int lat_info_show(struct seq_file *seq, void *v)
struct list_head *head =
&sess->sess_tgt_dev_list[t];
struct scst_tgt_dev *tgt_dev;
list_for_each_entry(tgt_dev, head,
sess_tgt_dev_list_entry) {
@@ -763,6 +766,7 @@ static ssize_t scst_proc_scsi_tgt_gen_write_lat(struct file *file,
struct list_head *head =
&sess->sess_tgt_dev_list[t];
struct scst_tgt_dev *tgt_dev;
list_for_each_entry(tgt_dev, head,
sess_tgt_dev_list_entry) {
tgt_dev->scst_time = 0;
@@ -2106,6 +2110,7 @@ static ssize_t scst_proc_groups_devices_write(struct file *file,
* procfs is now obsoleted.
*/
struct scst_acg_dev *a;
list_for_each_entry(a, &acg->acg_dev_list, acg_dev_list_entry) {
if (a->dev == dev) {
rc = scst_acg_del_lun(acg, a->lun, true);
@@ -2254,6 +2259,7 @@ static ssize_t scst_proc_groups_names_write(struct file *file,
{
struct scst_acg *a, *new_acg = NULL;
char *name = p;
p = pp;
while (!isspace(*pp) && *pp != '\0')
pp++;
@@ -2429,10 +2435,12 @@ static int scst_sessions_info_show(struct seq_file *seq, void *v)
list_for_each_entry(sess, &acg->acg_sess_list,
acg_sess_list_entry) {
int active_cmds = 0, t;
for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) {
struct list_head *head =
&sess->sess_tgt_dev_list[t];
struct scst_tgt_dev *tgt_dev;
list_for_each_entry(tgt_dev, head,
sess_tgt_dev_list_entry) {
active_cmds += atomic_read(&tgt_dev->tgt_dev_cmd_count);
+3 -3
View File
@@ -2802,7 +2802,7 @@ static int scst_tgt_sysfs_##attr##_show_work_fn( \
int res; \
uint64_t c = 0; \
\
BUILD_BUG_ON((unsigned)(dir) >= ARRAY_SIZE(sess->io_stats)); \
BUILD_BUG_ON((unsigned int)(dir) >= ARRAY_SIZE(sess->io_stats));\
\
res = mutex_lock_interruptible(&scst_mutex); \
if (res) \
@@ -3046,7 +3046,7 @@ static ssize_t scst_dev_sysfs_type_show(struct kobject *kobj,
dev = container_of(kobj, struct scst_device, dev_kobj);
pos = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d - %s\n", dev->type,
(unsigned)dev->type >= ARRAY_SIZE(scst_dev_handler_types) ?
(unsigned int)dev->type >= ARRAY_SIZE(scst_dev_handler_types) ?
"unknown" : scst_dev_handler_types[dev->type]);
return pos;
@@ -5744,7 +5744,7 @@ static ssize_t scst_devt_type_show(struct kobject *kobj,
devt = container_of(kobj, struct scst_dev_type, devt_kobj);
pos = sprintf(buf, "%d - %s\n", devt->type,
(unsigned)devt->type >= ARRAY_SIZE(scst_dev_handler_types) ?
(unsigned int)devt->type >= ARRAY_SIZE(scst_dev_handler_types) ?
"unknown" : scst_dev_handler_types[devt->type]);
return pos;
+1
View File
@@ -5210,6 +5210,7 @@ static void scst_ioctx_get(struct scst_cmd_threads *p_cmd_threads)
#warning IO context sharing functionality disabled on 3.5 kernels due to bug in them. \
See "http://lkml.org/lkml/2012/7/17/515" for more details.
static int q;
if (q == 0) {
q++;
PRINT_WARNING("IO context sharing functionality "