media: smiapp: Use the BIT macro where appropriate, remove useless definition
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 23 Sep 2019 13:05:37 +0000 (10:05 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 24 Oct 2019 21:50:53 +0000 (18:50 -0300)
The BIT macro is a better way to define register bits, for 1 << bit is
risky for 32-bit registers.

Also remove the definition of SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN which
has a value of zero.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/smiapp/smiapp-core.c
drivers/media/i2c/smiapp/smiapp-reg.h

index 9adf8e0..8fa0290 100644 (file)
@@ -986,8 +986,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor,
 
                rval = smiapp_write(sensor,
                                    SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL,
-                                   SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN |
-                                   SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN);
+                                   SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN);
                if (rval)
                        goto out;
 
index 2804a4d..02b0abe 100644 (file)
 #ifndef __SMIAPP_REG_H_
 #define __SMIAPP_REG_H_
 
+#include <linux/bits.h>
+
 #include "smiapp-reg-defs.h"
 
 /* Bits for above register */
-#define SMIAPP_IMAGE_ORIENTATION_HFLIP         (1 << 0)
-#define SMIAPP_IMAGE_ORIENTATION_VFLIP         (1 << 1)
-
-#define SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN              (1 << 0)
-#define SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN           (0 << 1)
-#define SMIAPP_DATA_TRANSFER_IF_1_CTRL_WR_EN           (1 << 1)
-#define SMIAPP_DATA_TRANSFER_IF_1_CTRL_ERR_CLEAR       (1 << 2)
-#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY      (1 << 0)
-#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_WR_READY      (1 << 1)
-#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_EDATA         (1 << 2)
-#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_EUSAGE                (1 << 3)
-
-#define SMIAPP_SOFTWARE_RESET                          (1 << 0)
-
-#define SMIAPP_FLASH_MODE_CAPABILITY_SINGLE_STROBE     (1 << 0)
-#define SMIAPP_FLASH_MODE_CAPABILITY_MULTIPLE_STROBE   (1 << 1)
+#define SMIAPP_IMAGE_ORIENTATION_HFLIP                 BIT(0)
+#define SMIAPP_IMAGE_ORIENTATION_VFLIP                 BIT(1)
+
+#define SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN              BIT(0)
+#define SMIAPP_DATA_TRANSFER_IF_1_CTRL_WR_EN           BIT(1)
+#define SMIAPP_DATA_TRANSFER_IF_1_CTRL_ERR_CLEAR       BIT(2)
+#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY      BIT(0)
+#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_WR_READY      BIT(1)
+#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_EDATA         BIT(2)
+#define SMIAPP_DATA_TRANSFER_IF_1_STATUS_EUSAGE                BIT(3)
+
+#define SMIAPP_SOFTWARE_RESET                          BIT(0)
+
+#define SMIAPP_FLASH_MODE_CAPABILITY_SINGLE_STROBE     BIT(0)
+#define SMIAPP_FLASH_MODE_CAPABILITY_MULTIPLE_STROBE   BIT(1)
 
 #define SMIAPP_DPHY_CTRL_AUTOMATIC                     0
 /* DPHY control based on REQUESTED_LINK_BIT_RATE_MBPS */