From: Andrew Morton <akpm@osdl.org>

- Unneeded casts

- Simplify a few things

- Coding style fixups.

Neil Horman <nhorman@redhat.com>

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/block/genhd.c |   22 ++++++++--------------
 fs/char_dev.c         |   21 ++++++++-------------
 fs/proc/proc_misc.c   |   21 +++++++++++----------
 3 files changed, 27 insertions(+), 37 deletions(-)

diff -puN drivers/block/genhd.c~convert-proc-devices-to-use-seq_file-interface-tidy drivers/block/genhd.c
--- 25/drivers/block/genhd.c~convert-proc-devices-to-use-seq_file-interface-tidy	Thu Sep  1 15:29:48 2005
+++ 25-akpm/drivers/block/genhd.c	Thu Sep  1 15:29:48 2005
@@ -54,7 +54,7 @@ void *get_next_blkdev(void *dev)
         struct blkdev_info *info;
 
         if (dev == NULL) {
-                info = kmalloc(sizeof(struct blkdev_info),GFP_KERNEL);
+                info = kmalloc(sizeof(*info), GFP_KERNEL);
                 if (!info)
                         goto out;
                 info->index=0;
@@ -62,7 +62,7 @@ void *get_next_blkdev(void *dev)
                 if(info->bd)
                         goto out;
         } else {
-                info = (struct blkdev_info *)dev;
+                info = dev;
         }
 
         while (info->index < ARRAY_SIZE(major_names)) {
@@ -74,7 +74,8 @@ void *get_next_blkdev(void *dev)
                  *no devices on this chain, move to the next
                  */
                 info->index++;
-                info->bd = (info->index < ARRAY_SIZE(major_names)) ? major_names[info->index] : NULL;
+                info->bd = (info->index < ARRAY_SIZE(major_names)) ?
+				major_names[info->index] : NULL;
                 if (info->bd)
                         goto out;
         }
@@ -85,13 +86,8 @@ out:
 
 void *acquire_blkdev_list(void)
 {
-        struct chrdev_info *info;
-
         down(&block_subsys_sem);
-
-        info = get_next_blkdev(NULL);
-
-        return info;
+        return get_next_blkdev(NULL);
 }
 
 void release_blkdev_list(void *dev)
@@ -100,7 +96,6 @@ void release_blkdev_list(void *dev)
         kfree(dev);
 }
 
-
 /*
  * Count the number of records in the blkdev_list.
  * must be called with the block_subsys_sem held
@@ -113,9 +108,8 @@ int count_blkdev_list(void)
 	count = 0;
 
 	for (i = 0; i < ARRAY_SIZE(major_names); i++) {
-		for (n = major_names[i]; n; n = n->next) {
-				count++;
-		}
+		for (n = major_names[i]; n; n = n->next)
+			count++;
 	}
 
 	return count;
@@ -128,7 +122,7 @@ int count_blkdev_list(void)
  */
 int get_blkdev_info(void *dev, int *major, char **name)
 {
-        struct blkdev_info *info = (struct blkdev_info *)dev;
+        struct blkdev_info *info = dev;
 
         if (info->bd == NULL)
                 return 1;
diff -puN fs/char_dev.c~convert-proc-devices-to-use-seq_file-interface-tidy fs/char_dev.c
--- 25/fs/char_dev.c~convert-proc-devices-to-use-seq_file-interface-tidy	Thu Sep  1 15:29:48 2005
+++ 25-akpm/fs/char_dev.c	Thu Sep  1 15:29:48 2005
@@ -56,7 +56,7 @@ void *get_next_chrdev(void *dev)
 	struct chrdev_info *info;
 
 	if (dev == NULL) {
-		info = kmalloc(sizeof(struct chrdev_info),GFP_KERNEL);
+		info = kmalloc(sizeof(*info), GFP_KERNEL);
 		if (!info)
 			goto out;
 		info->index=0;
@@ -64,7 +64,7 @@ void *get_next_chrdev(void *dev)
 		if(info->cd)
 			goto out;
 	} else {
-		info = (struct chrdev_info *)dev;
+		info = dev;
 	}
 
 	while (info->index < ARRAY_SIZE(chrdevs)) {
@@ -73,10 +73,11 @@ void *get_next_chrdev(void *dev)
 		if (info->cd)
 			goto out;
 		/*
-		 *no devices on this chain, move to the next
+		 * No devices on this chain, move to the next
 		 */
 		info->index++;
-		info->cd = (info->index < ARRAY_SIZE(chrdevs)) ? chrdevs[info->index] : NULL;
+		info->cd = (info->index < ARRAY_SIZE(chrdevs)) ?
+				chrdevs[info->index] : NULL;
 		if (info->cd)
 			goto out;
 	}
@@ -87,13 +88,8 @@ out:
 
 void *acquire_chrdev_list(void)
 {
-	struct chrdev_info *info;
-
 	down(&chrdevs_lock);
-
-	info = get_next_chrdev(NULL);
-
-	return info;
+	return get_next_chrdev(NULL);
 }
 
 void release_chrdev_list(void *dev)
@@ -110,9 +106,8 @@ int count_chrdev_list(void)
 	count = 0;
 
 	for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) {
-		for (cd = chrdevs[i]; cd; cd = cd->next) {
+		for (cd = chrdevs[i]; cd; cd = cd->next)
 			count++;
-		}
 	}
 
 	return count;
@@ -120,7 +115,7 @@ int count_chrdev_list(void)
 
 int get_chrdev_info(void *dev, int *major, char **name)
 {
-	struct chrdev_info *info = (struct chrdev_info *)dev;
+	struct chrdev_info *info = dev;
 
 	if (info->cd == NULL)
 		return 1;
diff -puN fs/proc/proc_misc.c~convert-proc-devices-to-use-seq_file-interface-tidy fs/proc/proc_misc.c
--- 25/fs/proc/proc_misc.c~convert-proc-devices-to-use-seq_file-interface-tidy	Thu Sep  1 15:29:48 2005
+++ 25-akpm/fs/proc/proc_misc.c	Thu Sep  1 15:29:48 2005
@@ -277,21 +277,21 @@ struct devinfo_state {
 
 static void *devinfo_start(struct seq_file *f, loff_t *pos)
 {
-	struct devinfo_state *info = (struct devinfo_state *)f->private;
+	struct devinfo_state *info = f->private;
 
 	if (*pos) {
 		if ((info) && (*pos < info->num_records))
 			return info;
 		return NULL;
 	}
-	info = kmalloc(sizeof(struct devinfo_state),GFP_KERNEL);
+	info = kmalloc(sizeof(*info), GFP_KERNEL);
 	f->private = info;
 	info->chrdev = acquire_chrdev_list();
 	info->blkdev = acquire_blkdev_list();
 	info->state = CHR_HDR;
 	info->num_records = count_chrdev_list();
 	info->num_records += count_blkdev_list();
-	info->num_records += 2; /*Character and Block headers*/
+	info->num_records += 2; /* Character and Block headers */
 	*pos = 0;
 	info->cur_record = *pos;
 	return info;
@@ -301,8 +301,8 @@ static void *devinfo_next(struct seq_fil
 {
 	int idummy;
 	char *ndummy;
+	struct devinfo_state *info = f->private;
 
-	struct devinfo_state *info = (struct devinfo_state *)f->private;
 	switch (info->state) {
 		case CHR_HDR:
 			info->state = CHR_LIST;
@@ -311,7 +311,7 @@ static void *devinfo_next(struct seq_fil
 		case CHR_LIST:
 			if (get_chrdev_info(info->chrdev,&idummy,&ndummy)) {
 				/*
-				 *the character dev list is complete
+				 * The character dev list is complete
 				 */
 				info->state = BLK_HDR;
 			} else {
@@ -326,7 +326,7 @@ static void *devinfo_next(struct seq_fil
 		case BLK_LIST:
 			if (get_blkdev_info(info->blkdev,&idummy,&ndummy)) {
 				/*
-				 *the block dev list is complete
+				 * The block dev list is complete
 				 */
 				info->state = DEVINFO_DONE;
 			} else {
@@ -349,7 +349,8 @@ static void *devinfo_next(struct seq_fil
 
 static void devinfo_stop(struct seq_file *f, void *v)
 {
-	struct devinfo_state *info = (struct devinfo_state *)f->private;
+	struct devinfo_state *info = f->private;
+
 	if ((info) && (info->cur_record >= info->num_records)) {
 		release_chrdev_list(info->chrdev);
 		release_blkdev_list(info->blkdev);
@@ -362,19 +363,19 @@ static int devinfo_show(struct seq_file 
 {
 	int major;
 	char *name;
+	struct devinfo_state *info = f->private;
 
-	struct devinfo_state *info = (struct devinfo_state *)f->private;
 	switch(info->state) {
 		case CHR_HDR:
 			seq_printf(f,"Character devices:\n");
-			/*fallthrough*/
+			/* fallthrough */
 		case CHR_LIST:
 			if (!get_chrdev_info(info->chrdev,&major,&name))
 				seq_printf(f,"%3d %s\n",major,name);
 			break;
 		case BLK_HDR:
 			seq_printf(f,"\nBlock devices:\n");
-			/*fallthrough*/
+			/* fallthrough */
 		case BLK_LIST:
 			if (!get_blkdev_info(info->blkdev,&major,&name))
 				seq_printf(f,"%3d %s\n",major,name);
_