Linus Torvalds 10fbd36e36 blk: rq_data_dir() should not return a boolean
rq_data_dir() returns either READ or WRITE (0 == READ, 1 == WRITE), not
a boolean value.

Now, admittedly the "!= 0" doesn't really change the value (0 stays as
zero, 1 stays as one), but it's not only redundant, it confuses gcc, and
causes gcc to warn about the construct

    switch (rq_data_dir(req)) {
        case READ:
            ...
        case WRITE:
            ...

that we have in a few drivers.

Now, the gcc warning is silly and stupid (it seems to warn not about the
switch value having a different type from the case statements, but about
_any_ boolean switch value), but in this case the code itself is silly
and stupid too, so let's just change it, and get rid of warnings like
this:

  drivers/block/hd.c: In function ‘hd_request’:
  drivers/block/hd.c:630:11: warning: switch condition has boolean value [-Wswitch-bool]
     switch (rq_data_dir(req)) {

The odd '!= 0' came in when "cmd_flags" got turned into a "u64" in
commit 5953316dbf90 ("block: make rq->cmd_flags be 64-bit") and is
presumably because the old code (that just did a logical 'and' with 1)
would then end up making the type of rq_data_dir() be u64 too.

But if we want to retain the old regular integer type, let's just cast
the result to 'int' rather than use that rather odd '!= 0'.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-12 12:03:30 -07:00
..
2015-09-01 13:00:04 -07:00
2015-06-25 11:49:31 +03:00
2015-09-10 16:42:49 -07:00
2015-09-04 11:46:02 -07:00
2015-09-09 08:33:31 -07:00
2015-09-09 08:33:31 -07:00
2015-09-08 16:33:16 -07:00
2015-09-01 13:00:04 -07:00
2015-09-09 08:33:31 -07:00
2015-08-03 12:01:54 -04:00
2015-08-06 16:17:25 -04:00
2015-09-01 15:52:41 +02:00
2015-09-04 16:54:41 -07:00
2015-09-08 15:35:28 -07:00
2015-08-20 10:20:11 +03:00
2015-06-24 17:49:45 -07:00
2015-07-17 08:41:53 -06:00
2015-06-19 15:18:28 +02:00
2015-09-08 15:35:28 -07:00
2015-09-08 15:35:28 -07:00
2015-08-27 19:40:58 -04:00
2015-08-06 00:14:59 +02:00
2015-06-25 12:06:45 +02:00
2015-08-18 15:49:15 -07:00
2015-07-28 08:50:42 +01:00
2015-09-06 16:27:10 +02:00
2015-06-24 17:49:41 -07:00
2015-09-11 16:42:39 -07:00
2015-09-08 14:35:59 -07:00
2015-07-21 10:39:05 -07:00
2015-06-25 04:20:04 -04:00
2015-08-17 13:32:56 -05:00
2015-08-18 11:56:13 -06:00
2015-07-01 19:40:18 -07:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-09-08 15:35:28 -07:00
2015-06-19 01:18:14 +02:00
2015-08-17 15:40:20 +02:00
2015-06-25 01:13:43 +02:00
2015-06-25 17:00:40 -07:00
2015-06-25 17:00:39 -07:00
2015-08-17 11:25:28 -07:00
2015-07-22 15:27:29 -07:00
2015-08-28 16:27:27 -07:00
2015-06-12 17:26:57 -07:00
2015-09-08 15:35:28 -07:00
2015-09-10 13:29:01 -07:00