skd: Remove useless barrier() calls
authorBart Van Assche <bart.vanassche@wdc.com>
Thu, 17 Aug 2017 20:12:57 +0000 (13:12 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 18 Aug 2017 14:45:29 +0000 (08:45 -0600)
The purpose of barrier() is to prevent reordering by the compiler.
Since the compiler does not reorder calls to non-pure functions,
remove the barrier() calls from skd_reg_{read,write}{32,64}().

Since pr_debug() is able to report file name and line number
information, remove __FILE__ and __LINE__ from the pr_debug() calls.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/skd_main.c

index 53c84c846a5efd05d98c838ee4c21cfa74b0ac7d..54c6711a42d1d2a49dcf5f356e5b6a35caa0afab 100644 (file)
@@ -341,49 +341,27 @@ struct skd_device {
 
 static inline u32 skd_reg_read32(struct skd_device *skdev, u32 offset)
 {
-       u32 val;
-
-       if (likely(skdev->dbg_level < 2))
-               return readl(skdev->mem_map[1] + offset);
-       else {
-               barrier();
-               val = readl(skdev->mem_map[1] + offset);
-               barrier();
-               pr_debug("%s:%s:%d offset %x = %x\n",
-                        skdev->name, __func__, __LINE__, offset, val);
-               return val;
-       }
+       u32 val = readl(skdev->mem_map[1] + offset);
 
+       if (unlikely(skdev->dbg_level >= 2))
+               pr_debug("%s offset %x = %x\n", skdev->name, offset, val);
+       return val;
 }
 
 static inline void skd_reg_write32(struct skd_device *skdev, u32 val,
                                   u32 offset)
 {
-       if (likely(skdev->dbg_level < 2)) {
-               writel(val, skdev->mem_map[1] + offset);
-               barrier();
-       } else {
-               barrier();
-               writel(val, skdev->mem_map[1] + offset);
-               barrier();
-               pr_debug("%s:%s:%d offset %x = %x\n",
-                        skdev->name, __func__, __LINE__, offset, val);
-       }
+       writel(val, skdev->mem_map[1] + offset);
+       if (unlikely(skdev->dbg_level >= 2))
+               pr_debug("%s offset %x = %x\n", skdev->name, offset, val);
 }
 
 static inline void skd_reg_write64(struct skd_device *skdev, u64 val,
                                   u32 offset)
 {
-       if (likely(skdev->dbg_level < 2)) {
-               writeq(val, skdev->mem_map[1] + offset);
-               barrier();
-       } else {
-               barrier();
-               writeq(val, skdev->mem_map[1] + offset);
-               barrier();
-               pr_debug("%s:%s:%d offset %x = %016llx\n",
-                        skdev->name, __func__, __LINE__, offset, val);
-       }
+       writeq(val, skdev->mem_map[1] + offset);
+       if (unlikely(skdev->dbg_level >= 2))
+               pr_debug("%s offset %x = %016llx\n", skdev->name, offset, val);
 }