lkml.org 
[lkml]   [2012]   [Feb]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix setting bio flags in drivers (sd_dif/floppy).
On Wed, 29 Feb 2012 18:22:14 -0500
Muthu Kumar <muthu.lkml@gmail.com> wrote:

> Fix setting bio flags in drivers (sd_dif/floppy).
>
> ...
>
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 9baf11e..744f078 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -3832,7 +3832,7 @@ static int __floppy_read_block_0(struct
> block_device *bdev)
> bio.bi_size = size;
> bio.bi_bdev = bdev;
> bio.bi_sector = 0;
> - bio.bi_flags = BIO_QUIET;
> + bio.bi_flags = (1 << BIO_QUIET);
> init_completion(&complete);
> bio.bi_private = &complete;
> bio.bi_end_io = floppy_rb0_complete;
> diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
> index 0cb39ff..f8fb2d6 100644
> --- a/drivers/scsi/sd_dif.c
> +++ b/drivers/scsi/sd_dif.c
> @@ -408,7 +408,7 @@ int sd_dif_prepare(struct request *rq, sector_t
> hw_sector, unsigned int sector_s
> kunmap_atomic(sdt, KM_USER0);
> }
>
> - bio->bi_flags |= BIO_MAPPED_INTEGRITY;
> + bio->bi_flags |= (1 << BIO_MAPPED_INTEGRITY);
> }
>
> return 0;

urgh. This isn't the first time.

It's too easy for people to make this mistake. I'm not sure what a
good fix would be - I don't think sparse can save us with __bitwise or
similar.

The approach we took in buffer_head.h with BH_Foo and BUFFER_FNS
accessors worked pretty well.



\
 
 \ /
  Last update: 2012-03-01 01:15    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site