changeset 3911:3e3d341d6726

arch/psoc4: Fix bit manipulation API usage
author Nicolas Pouillon <nipo@ssji.net>
date Thu, 19 Apr 2018 06:59:21 +0200
parents c9329f215ff5
children 68e03a1815ba
files arch/psoc4/drivers/gpio.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/arch/psoc4/drivers/gpio.c	Thu Apr 19 06:11:46 2018 +0200
+++ b/arch/psoc4/drivers/gpio.c	Thu Apr 19 06:59:21 2018 +0200
@@ -114,7 +114,7 @@
     return err;
 
   uint64_t m
-    = (endian_le64_na_load(mask) & bit_mask(io_last - io_first + 1))
+    = (endian_le64_na_load(mask) & bit_mask(0, io_last - io_first + 1))
     << io_first;
 
   LOCK_SPIN_IRQ(&dev->lock);
@@ -187,8 +187,7 @@
 
   dprintk("Read %llx\n", tmp);
 
-  tmp >>= io_first;
-  tmp &= bit_mask(io_last - io_first + 1);
+  tmp = bit_get_range(tmp, io_first, io_last);
   endian_le64_na_store(data, tmp);
 
   dprintk("Read2 %llx\n", tmp);