From acbb61e012ea0c7bab1972f778580bbfb1e1e4a2 Mon Sep 17 00:00:00 2001
From: Manohar Vanga <manohar.vanga@cern.ch>
Date: Tue, 22 Nov 2011 16:22:02 +0100
Subject: [PATCH] fix style warning across files (used checkpatch.pl)

Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>
---
 Documentation/zio/tools/zio-dump.c |  6 +++---
 buffers/zio-buf-kmalloc.c          |  8 ++++----
 include/linux/zio-buffer.h         |  8 ++++----
 include/linux/zio-sysfs.h          | 14 ++++++++++----
 triggers/zio-trig-timer.c          |  2 +-
 zio-dump.c                         |  6 +++---
 zio-sys.c                          | 18 ++++++++++--------
 7 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/Documentation/zio/tools/zio-dump.c b/Documentation/zio/tools/zio-dump.c
index b9b81e8..0115858 100644
--- a/Documentation/zio/tools/zio-dump.c
+++ b/Documentation/zio/tools/zio-dump.c
@@ -26,7 +26,7 @@ int main(int argc, char **argv)
 	int fd[2];
 	int i, j;
 
-	if (argc !=3) {
+	if (argc != 3) {
 		fprintf(stderr, "%s: use \"%s <ctrl-file> <data-file>\"\n",
 			argv[0], argv[0]);
 		exit(1);
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
 
 		/* This is a blocking read to the control file */
 		i = read(fd[FD_C], &ctrl, sizeof(ctrl));
-		switch(i) {
+		switch (i) {
 		case -1:
 			fprintf(stderr, "%s: %s: read(): %s\n",
 				argv[0], argv[1 + FD_C], strerror(errno));
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
 				printf("Data:");
 			printf(" %02x", buf[j]);
 			if ((j & 0xf) == 0xf || j == i - 1)
-			putchar('\n');
+				putchar('\n');
 		}
 	putchar('\n');
 	}
diff --git a/buffers/zio-buf-kmalloc.c b/buffers/zio-buf-kmalloc.c
index 388b1bc..857c044 100644
--- a/buffers/zio-buf-kmalloc.c
+++ b/buffers/zio-buf-kmalloc.c
@@ -43,7 +43,7 @@ static DEFINE_ZATTR_STD(ZBUF, zbk_std_zattr) = {
 	ZATTR_REG(zbuf, ZATTR_ZBUF_MAXLEN, S_IRUGO | S_IWUGO, 0x0, 16),
 };
 
-int kmalloc_conf_set (struct kobject *kobj, struct zio_attribute *zattr,
+int kmalloc_conf_set(struct kobject *kobj, struct zio_attribute *zattr,
 		uint32_t  usr_val)
 {
 	zattr->value = usr_val;
@@ -251,9 +251,9 @@ static struct zio_buffer_type zbk_buffer = {
 	.zattr_set = {
 		.std_zattr = zbk_std_zattr,
 	},
-	.s_op = 	&zbk_sysfs_ops,
-	.b_op =		&zbk_buffer_ops,
-	.f_op =		&zbk_file_ops,
+	.s_op = &zbk_sysfs_ops,
+	.b_op = &zbk_buffer_ops,
+	.f_op = &zbk_file_ops,
 };
 
 static int zbk_init(void)
diff --git a/include/linux/zio-buffer.h b/include/linux/zio-buffer.h
index 4827575..2e5500c 100644
--- a/include/linux/zio-buffer.h
+++ b/include/linux/zio-buffer.h
@@ -14,12 +14,12 @@
  * indidual devices may do whatever they want to match hardware.
  */
 struct zio_timestamp {
-    uint64_t secs;
-    uint64_t ticks;
-    uint64_t bins;
+	uint64_t secs;
+	uint64_t ticks;
+	uint64_t bins;
 };
 
-/* 
+/*
  * The following data item is the control structure that is being exchanged
  * on the control device associated to each data device. The size of each
  * fields is fixed to ease portability of binary dumps (esp i386/x86-64).
diff --git a/include/linux/zio-sysfs.h b/include/linux/zio-sysfs.h
index 34d4e5e..376b992 100644
--- a/include/linux/zio-sysfs.h
+++ b/include/linux/zio-sysfs.h
@@ -92,13 +92,19 @@ extern const char zio_zbuf_attr_names[ZATTR_STD_NUM_ZBUF][ZIO_NAME_LEN];
  * @ZATTR_EXT_REG: define a zio extended attribute with address register
  * @ZATTR_EXT_PRV: define a zio extended attribute with private register
  */
-#define ZATTR_REG(zobj ,_type, _mode, _add, _val) [_type] = {		\
-		.attr = {.name = zio_##zobj##_attr_names[_type], .mode = _mode},\
+#define ZATTR_REG(zobj, _type, _mode, _add, _val)[_type] = {		\
+		.attr = {						\
+			.name = zio_##zobj##_attr_names[_type],		\
+			.mode = _mode					\
+		},							\
 		.priv.addr = _add,					\
 		.value = _val,						\
 }
-#define ZATTR_PRV(zobj, _type, _mode, _add, _val) [_type] = {		\
-		.attr = {.name = zio_##zobj##_attr_names[_type], .mode = _mode},\
+#define ZATTR_PRV(zobj, _type, _mode, _add, _val)[_type] = {		\
+		.attr = {						\
+			.name = zio_##zobj##_attr_names[_type],		\
+			.mode = _mode					\
+		},							\
 		.priv.ptr = _add,					\
 		.value = _val,						\
 }
diff --git a/triggers/zio-trig-timer.c b/triggers/zio-trig-timer.c
index 6cd2b74..ed21fb5 100644
--- a/triggers/zio-trig-timer.c
+++ b/triggers/zio-trig-timer.c
@@ -34,7 +34,7 @@ static DEFINE_ZATTR_STD(TRIG, ztt_std_attr) = {
 static struct zio_attribute ztt_ext_attr[] = {
 	ZATTR_EXT_REG("ms-period", S_IRUGO | S_IWUGO, 0x10, 2000),
 };
-int timer_conf_set (struct kobject *kobj, struct zio_attribute *zattr,
+int timer_conf_set(struct kobject *kobj, struct zio_attribute *zattr,
 		uint32_t  usr_val)
 {
 	struct zio_ti *ti = to_zio_ti(kobj);
diff --git a/zio-dump.c b/zio-dump.c
index b77fb7d..1611717 100644
--- a/zio-dump.c
+++ b/zio-dump.c
@@ -28,7 +28,7 @@ int main(int argc, char **argv)
 	int fd[2];
 	int i, j;
 
-	if (argc !=3) {
+	if (argc != 3) {
 		fprintf(stderr, "%s: use \"%s <ctrl-file> <data-file>\"\n",
 			argv[0], argv[0]);
 		exit(1);
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
 
 		/* This is a blocking read to the control file */
 		i = read(fd[FD_C], &ctrl, sizeof(ctrl));
-		switch(i) {
+		switch (i) {
 		case -1:
 			fprintf(stderr, "%s: %s: read(): %s\n",
 				argv[0], argv[1 + FD_C], strerror(errno));
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
 				printf("Data:");
 			printf(" %02x", buf[j]);
 			if ((j & 0xf) == 0xf || j == i - 1)
-			putchar('\n');
+				putchar('\n');
 		}
 	putchar('\n');
 	}
diff --git a/zio-sys.c b/zio-sys.c
index 5629838..9584e6f 100644
--- a/zio-sys.c
+++ b/zio-sys.c
@@ -97,7 +97,7 @@ static struct zio_buffer_type *zio_buffer_get(char *name)
 	struct zio_object_list_item *list_item;
 
 	list_item = __zio_object_get(&zstat->all_buffer_types, name);
-	if(!list_item)
+	if (!list_item)
 		return ERR_PTR(-ENODEV);
 	return container_of(list_item->obj_head, struct zio_buffer_type, head);
 }
@@ -111,7 +111,7 @@ static struct zio_trigger_type *zio_trigger_get(char *name)
 	struct zio_object_list_item *list_item;
 
 	list_item = __zio_object_get(&zstat->all_trigger_types, name);
-	if(!list_item)
+	if (!list_item)
 		return ERR_PTR(-ENODEV);
 	return container_of(list_item->obj_head, struct zio_trigger_type, head);
 }
@@ -349,9 +349,12 @@ static struct zio_attribute *__zattr_clone(const struct zio_attribute *src,
 
 	return dest;
 }
-static void __zattr_unclone(struct zio_attribute *zattr){
+
+static void __zattr_unclone(struct zio_attribute *zattr)
+{
 	kfree(zattr);
 }
+
 static int __zattr_set_copy(struct zio_attribute_set *dest,
 				     struct zio_attribute_set *src)
 {
@@ -509,7 +512,7 @@ static ssize_t zattr_store(struct kobject *kobj, struct attribute *attr,
 	spinlock_t *lock;
 
 	pr_debug("%s\n", __func__);
-	err = strict_strtol(buf, 10, &val);
+	err = kstrtol(buf, 10, &val);
 	if (err)
 		return -EINVAL;
 	if (zattr->s_op->conf_set) {
@@ -715,7 +718,7 @@ static int __buffer_create_instance(struct zio_channel *chan)
 			chan->cset->index,
 			chan->index);
 
-	err = __zattr_set_copy(&bi->zattr_set,&zbuf->zattr_set);
+	err = __zattr_set_copy(&bi->zattr_set, &zbuf->zattr_set);
 	if (err)
 		goto out_clone;
 	err = zattr_set_create(&bi->head, zbuf->s_op);
@@ -806,7 +809,7 @@ static int __trigger_create_instance(struct zio_cset *cset)
 			cset->index);
 
 	err = __zattr_set_copy(&ti->zattr_set, &cset->trig->zattr_set);
-	if(err)
+	if (err)
 		goto out_clone;
 	err = zattr_set_create(&ti->head, cset->trig->s_op);
 	if (err)
@@ -960,9 +963,8 @@ static inline void cset_free_chan(struct zio_cset *cset)
 {
 	pr_debug("%s:%d\n", __func__, __LINE__);
 	/* Only allocated channels need to be freed */
-	if (cset->flags & ZCSET_CHAN_ALLOC) {
+	if (cset->flags & ZCSET_CHAN_ALLOC)
 		kfree(cset->chan);
-	}
 }
 
 static int cset_register(struct zio_cset *cset)
-- 
GitLab