Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2a13989 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman
Browse files

staging/lustre/include: Adjust NULL comparison codestyle



All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eb26ebb8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2653,7 +2653,7 @@ static inline int lu_device_is_cl(const struct lu_device *d)

static inline struct cl_device *lu2cl_dev(const struct lu_device *d)
{
	LASSERT(d == NULL || IS_ERR(d) || lu_device_is_cl(d));
	LASSERT(!d || IS_ERR(d) || lu_device_is_cl(d));
	return container_of0(d, struct cl_device, cd_lu_dev);
}

@@ -2664,7 +2664,7 @@ static inline struct lu_device *cl2lu_dev(struct cl_device *d)

static inline struct cl_object *lu2cl(const struct lu_object *o)
{
	LASSERT(o == NULL || IS_ERR(o) || lu_device_is_cl(o->lo_dev));
	LASSERT(!o || IS_ERR(o) || lu_device_is_cl(o->lo_dev));
	return container_of0(o, struct cl_object, co_lu);
}

@@ -2681,7 +2681,7 @@ static inline struct cl_object *cl_object_next(const struct cl_object *obj)

static inline struct cl_device *cl_object_device(const struct cl_object *o)
{
	LASSERT(o == NULL || IS_ERR(o) || lu_device_is_cl(o->co_lu.lo_dev));
	LASSERT(!o || IS_ERR(o) || lu_device_is_cl(o->co_lu.lo_dev));
	return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev);
}

+2 −2
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ static inline struct ccc_thread_info *ccc_env_info(const struct lu_env *env)
	struct ccc_thread_info      *info;

	info = lu_context_key_get(&env->le_ctx, &ccc_key);
	LASSERT(info != NULL);
	LASSERT(info);
	return info;
}

@@ -156,7 +156,7 @@ static inline struct ccc_session *ccc_env_session(const struct lu_env *env)
	struct ccc_session *ses;

	ses = lu_context_key_get(env->le_ses, &ccc_session_key);
	LASSERT(ses != NULL);
	LASSERT(ses);
	return ses;
}

+3 −3
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,

	while (1) {
		if (spin_trylock(&lock->lock)) {
			LASSERT(lock->task == NULL);
			LASSERT(!lock->task);
			lock->task = current;
			lock->func = func;
			lock->line = line;
@@ -85,7 +85,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,
		    time_before(lock->time + 5 * HZ, jiffies)) {
			struct task_struct *task = lock->task;

			if (task == NULL)
			if (!task)
				continue;

			LCONSOLE_WARN("%s:%d: lock %p was acquired by <%s:%d:%s:%d> for %lu seconds.\n",
@@ -108,7 +108,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,

static inline void client_obd_list_unlock(client_obd_lock_t *lock)
{
	LASSERT(lock->task != NULL);
	LASSERT(lock->task);
	lock->task = NULL;
	lock->time = jiffies;
	spin_unlock(&lock->lock);
+3 −3
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc,
		} else {
			unsigned int cpuid = get_cpu();

			if (unlikely(stats->ls_percpu[cpuid] == NULL)) {
			if (unlikely(!stats->ls_percpu[cpuid])) {
				rc = lprocfs_stats_alloc_one(stats, cpuid);
				if (rc < 0) {
					put_cpu();
@@ -521,11 +521,11 @@ static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
	unsigned long flags	= 0;
	__u64	      ret	= 0;

	LASSERT(stats != NULL);
	LASSERT(stats);

	num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
	for (i = 0; i < num_cpu; i++) {
		if (stats->ls_percpu[i] == NULL)
		if (!stats->ls_percpu[i])
			continue;
		ret += lprocfs_read_helper(
				lprocfs_stats_counter_get(stats, i, idx),
+3 −3
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ struct lu_device_type_operations {

static inline int lu_device_is_md(const struct lu_device *d)
{
	return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_MD);
	return ergo(d, d->ld_type->ldt_tags & LU_DEVICE_MD);
}

/**
@@ -1119,7 +1119,7 @@ struct lu_context_key {
		CLASSERT(PAGE_CACHE_SIZE >= sizeof (*value));       \
								  \
		value = kzalloc(sizeof(*value), GFP_NOFS);	\
		if (value == NULL)				\
		if (!value)				\
			value = ERR_PTR(-ENOMEM);		 \
								  \
		return value;				     \
@@ -1174,7 +1174,7 @@ void lu_context_key_revive (struct lu_context_key *key);
		do {						    \
			LU_CONTEXT_KEY_INIT(key);		       \
			key = va_arg(args, struct lu_context_key *);    \
		} while (key != NULL);				  \
		} while (key);				  \
		va_end(args);					   \
	}

Loading