lkml.org 
[lkml]   [2008]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] bkl2mtd: cleanup
On Wed, Mar 26, 2008 at 11:14:52AM +0100, Ingo Molnar wrote:
> /* Info for the block device */
> struct block2mtd_dev {
> - struct list_head list;
> - struct block_device *blkdev;
> - struct mtd_info mtd;
> - struct mutex write_mutex;
> + struct list_head list;
> + struct block_device *blkdev;
> + struct mtd_info mtd;
> + /* serializes writes with each other and also with erase: */
> + struct mutex write_mutex;
> };

Why the hell?

> -static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf,
> - loff_t to, size_t len, size_t *retlen)
> +static int
> +_block2mtd_write(struct block2mtd_dev *dev, const u_char *buf, loff_t to,
> + size_t len, size_t *retlen)

That's actually worse... BTW, single-underscore-... for identifiers? Odd.

> -static int block2mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
> +static int
> +block2mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
> size_t *retlen, const u_char *buf)

Again, why split it that way?

> - dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
> - dev->mtd.erasesize = erase_size;
> - dev->mtd.writesize = 1;
> - dev->mtd.type = MTD_RAM;
> - dev->mtd.flags = MTD_CAP_RAM;
> - dev->mtd.erase = block2mtd_erase;
> - dev->mtd.write = block2mtd_write;
> - dev->mtd.writev = default_mtd_writev;
> - dev->mtd.sync = block2mtd_sync;
> - dev->mtd.read = block2mtd_read;
> - dev->mtd.priv = dev;
> - dev->mtd.owner = THIS_MODULE;
> + dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
> + dev->mtd.erasesize = erase_size;
> + dev->mtd.writesize = 1;
> + dev->mtd.type = MTD_RAM;
> + dev->mtd.flags = MTD_CAP_RAM;
> + dev->mtd.erase = block2mtd_erase;
> + dev->mtd.write = block2mtd_write;
> + dev->mtd.writev = default_mtd_writev;
> + dev->mtd.sync = block2mtd_sync;
> + dev->mtd.read = block2mtd_read;
> + dev->mtd.priv = dev;
> + dev->mtd.owner = THIS_MODULE;

Bogus.

> - if (ret) {
> + if (ret)
> parse_err("illegal erase size");
> - }
> }

BTW, I certainly wouldn't inflict that on patches; at some point in
series the body of if may shrink to one line only to get longer in
the next patch. Removing and restoring {} would only add noise.
OTOH, you've missed quite a few of my pet peeves, starting with
u_char in the quoted part...


\
 
 \ /
  Last update: 2008-03-26 11:51    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site