Re: An idea .... with code

From: Marcin Slusarz
Date: Mon Aug 25 2008 - 16:54:16 EST


On Mon, Aug 25, 2008 at 01:22:16PM +0100, =?ISO-8859-1?Q?Jochen_Vo=DF_ wrote:
> >
> > static LIST_HEAD(vbd_head);
> >
> > static struct device vir_dev = {
> > .bus_id = "virblk",
> > };
> >
> > static int data_xfer(struct vir_blk_dev *vbd, struct page *page, unsigned int len,
> > unsigned int off, int wr, sector_t sector)
>
> strange indentation
>
> > {
> > ssize_t ret;
> > loff_t pos = sector * (1<<(vbd->sect_size_bits));
> > void *buf = kmap(page) + off;
> >
> > if(sector + (len >> vbd->sect_size_bits) > get_capacity(vbd->gd)){
>
> Kernel coding style seems to prefer spaces after "if" and before "{"
> (more instances below).

It's better to check this patch with scripts/checkpatch.pl - it will tell you
about all style issues.

> > init_MUTEX(&vbd->sem);

You seem to use this semaphore as a mutex - why don't you convert it to mutex then?
Semaphores should be used only when they are absolutely necessary.

Marcin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/