public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Muthu Kumar <muthu.lkml@gmail.com>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	Jens Axboe <axboe@kernel.dk>,
	martin.petersen@oracle.com
Subject: Re: [PATCH] Fix setting bio flags in drivers (sd_dif/floppy).
Date: Wed, 29 Feb 2012 16:12:15 -0800	[thread overview]
Message-ID: <20120229161215.81505738.akpm@linux-foundation.org> (raw)
In-Reply-To: <CAFR8uef08sDCR=FM_v4EV0CLX9f4UuJezSTPFX6V7T-4b7xBVQ@mail.gmail.com>

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.


  parent reply	other threads:[~2012-03-01  0:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 23:22 [PATCH] Fix setting bio flags in drivers (sd_dif/floppy) Muthu Kumar
2012-03-01  0:08 ` Linus Torvalds
2012-03-01  0:20   ` Andrew Morton
2012-03-01  8:23   ` Jens Axboe
2012-03-01  0:12 ` Andrew Morton [this message]
2012-03-01  0:22   ` Martin K. Petersen
2012-03-01 20:23   ` Muthu Kumar
2012-03-01 20:25     ` Jens Axboe
2012-03-01 21:20       ` Muthu Kumar
2012-03-01 22:03         ` Jens Axboe
2012-03-01 23:27           ` Muthu Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120229161215.81505738.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=muthu.lkml@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox