Re: [PATCH v1 1/1] x86/platform/iosf_mbi: Remove duplicate definitions

2015-11-11 Thread kbuild test robot
Hi Andy,

[auto build test ERROR on thermal/next]
[also build test ERROR on v4.3 next-2015]
[cannot apply to tip/x86/core]

url:
https://github.com/0day-ci/linux/commits/Andy-Shevchenko/x86-platform-iosf_mbi-Remove-duplicate-definitions/20151112-002509
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: i386-allmodconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   arch/x86/platform/intel-quark/imr.c: In function 'imr_read':
>> arch/x86/platform/intel-quark/imr.c:114:39: error: 'QRK_MBI_MM_READ' 
>> undeclared (first use in this function)
 ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
  ^
   arch/x86/platform/intel-quark/imr.c:114:39: note: each undeclared identifier 
is reported only once for each function it appears in
   arch/x86/platform/intel-quark/imr.c: In function 'imr_write':
>> arch/x86/platform/intel-quark/imr.c:154:40: error: 'QRK_MBI_MM_WRITE' 
>> undeclared (first use in this function)
 ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, reg++,
   ^
   arch/x86/platform/intel-quark/imr.c: In function 'imr_read':
>> arch/x86/platform/intel-quark/imr.c:131:1: warning: control reaches end of 
>> non-void function [-Wreturn-type]
}
^

vim +/QRK_MBI_MM_READ +114 arch/x86/platform/intel-quark/imr.c

28a375df Bryan O'Donoghue 2015-01-30  108   */
28a375df Bryan O'Donoghue 2015-01-30  109  static int imr_read(struct 
imr_device *idev, u32 imr_id, struct imr_regs *imr)
28a375df Bryan O'Donoghue 2015-01-30  110  {
28a375df Bryan O'Donoghue 2015-01-30  111   u32 reg = imr_id * IMR_NUM_REGS 
+ idev->reg_base;
28a375df Bryan O'Donoghue 2015-01-30  112   int ret;
28a375df Bryan O'Donoghue 2015-01-30  113  
28a375df Bryan O'Donoghue 2015-01-30 @114   ret = 
iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30  115   reg++, 
>addr_lo);
28a375df Bryan O'Donoghue 2015-01-30  116   if (ret)
28a375df Bryan O'Donoghue 2015-01-30  117   return ret;
28a375df Bryan O'Donoghue 2015-01-30  118  
28a375df Bryan O'Donoghue 2015-01-30  119   ret = 
iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30  120   reg++, 
>addr_hi);
28a375df Bryan O'Donoghue 2015-01-30  121   if (ret)
28a375df Bryan O'Donoghue 2015-01-30  122   return ret;
28a375df Bryan O'Donoghue 2015-01-30  123  
28a375df Bryan O'Donoghue 2015-01-30  124   ret = 
iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30  125   reg++, 
>rmask);
28a375df Bryan O'Donoghue 2015-01-30  126   if (ret)
28a375df Bryan O'Donoghue 2015-01-30  127   return ret;
28a375df Bryan O'Donoghue 2015-01-30  128  
c11a25f4 Fengguang Wu 2015-02-19  129   return 
iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
28a375df Bryan O'Donoghue 2015-01-30  130   reg++, 
>wmask);
28a375df Bryan O'Donoghue 2015-01-30 @131  }
28a375df Bryan O'Donoghue 2015-01-30  132  
28a375df Bryan O'Donoghue 2015-01-30  133  /**
28a375df Bryan O'Donoghue 2015-01-30  134   * imr_write - write an IMR at a 
given index.
28a375df Bryan O'Donoghue 2015-01-30  135   *
28a375df Bryan O'Donoghue 2015-01-30  136   * Requires caller to hold imr mutex.
28a375df Bryan O'Donoghue 2015-01-30  137   * Note lock bits need to be written 
independently of address bits.
28a375df Bryan O'Donoghue 2015-01-30  138   *
28a375df Bryan O'Donoghue 2015-01-30  139   * @idev:pointer to imr_device 
structure.
28a375df Bryan O'Donoghue 2015-01-30  140   * @imr_id:  IMR entry to write.
28a375df Bryan O'Donoghue 2015-01-30  141   * @imr: IMR structure 
representing address and access masks.
28a375df Bryan O'Donoghue 2015-01-30  142   * @lock:indicates if the IMR 
lock bit should be applied.
28a375df Bryan O'Donoghue 2015-01-30  143   * @return:  0 on success or error 
code passed from mbi_iosf on failure.
28a375df Bryan O'Donoghue 2015-01-30  144   */
28a375df Bryan O'Donoghue 2015-01-30  145  static int imr_write(struct 
imr_device *idev, u32 imr_id,
28a375df Bryan O'Donoghue 2015-01-30  146struct imr_regs 
*imr, bool lock)
28a375df Bryan O'Donoghue 2015-01-30  147  {
28a375df Bryan O'Donoghue 2015-01-30  148   unsigned long flags;
28a375df Bryan O'Donoghue 2015-01-30  149   u32 reg = imr_id * IMR_NUM_REGS 
+ idev->reg_base;
28a375df Bryan O'Donoghue 2015-01-30  150   int ret;
28a375df Bryan O'Donoghue 2015-01-30  151  
28a375df Bryan O'Donoghue 2015-01-30  152   local_irq_save(flags);
28a375df Bryan O'Donoghue 2015-01-30  153  
28a375df Bryan O'Donoghue 2015-01-30 @154   ret = 
iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE, reg++,
28a375df 

[PATCH v1 1/1] x86/platform/iosf_mbi: Remove duplicate definitions

2015-11-11 Thread Andy Shevchenko
The read and write opcodes are global for all units on SoC and even across
Intel SoCs. Remove duplication of corresponding constants. At the same time
convert all current users.

No functional change.

Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Peter Anvin 
Cc: Wolfram Sang 
Cc: Zhang Rui 
Cc: Eduardo Valentin 

Signed-off-by: Andy Shevchenko 
---
 arch/x86/include/asm/iosf_mbi.h  | 49 +-
 arch/x86/platform/atom/punit_atom_debug.c|  7 +---
 drivers/i2c/busses/i2c-designware-baytrail.c | 17 +++-
 drivers/powercap/intel_rapl.c| 10 ++---
 drivers/thermal/intel_quark_dts_thermal.c| 61 ++--
 drivers/thermal/intel_soc_dts_iosf.c | 43 ++--
 6 files changed, 75 insertions(+), 112 deletions(-)

diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h
index b72ad0f..cdc5f63 100644
--- a/arch/x86/include/asm/iosf_mbi.h
+++ b/arch/x86/include/asm/iosf_mbi.h
@@ -1,5 +1,5 @@
 /*
- * iosf_mbi.h: Intel OnChip System Fabric MailBox access support
+ * Intel OnChip System Fabric MailBox access support
  */
 
 #ifndef IOSF_MBI_SYMS_H
@@ -16,6 +16,16 @@
 #define MBI_MASK_LO0x00FF
 #define MBI_ENABLE 0xF0
 
+/* IOSF SB read/write opcodes */
+#define MBI_MMIO_READ  0x00
+#define MBI_MMIO_WRITE 0x01
+#define MBI_CR_READ0x06
+#define MBI_CR_WRITE   0x07
+#define MBI_REG_READ   0x10
+#define MBI_REG_WRITE  0x11
+#define MBI_ESRAM_READ 0x12
+#define MBI_ESRAM_WRITE0x13
+
 /* Baytrail available units */
 #define BT_MBI_UNIT_AUNIT  0x00
 #define BT_MBI_UNIT_SMC0x01
@@ -28,50 +38,13 @@
 #define BT_MBI_UNIT_SATA   0xA3
 #define BT_MBI_UNIT_PCIE   0xA6
 
-/* Baytrail read/write opcodes */
-#define BT_MBI_AUNIT_READ  0x10
-#define BT_MBI_AUNIT_WRITE 0x11
-#define BT_MBI_SMC_READ0x10
-#define BT_MBI_SMC_WRITE   0x11
-#define BT_MBI_CPU_READ0x10
-#define BT_MBI_CPU_WRITE   0x11
-#define BT_MBI_BUNIT_READ  0x10
-#define BT_MBI_BUNIT_WRITE 0x11
-#define BT_MBI_PMC_READ0x06
-#define BT_MBI_PMC_WRITE   0x07
-#define BT_MBI_GFX_READ0x00
-#define BT_MBI_GFX_WRITE   0x01
-#define BT_MBI_SMIO_READ   0x06
-#define BT_MBI_SMIO_WRITE  0x07
-#define BT_MBI_USB_READ0x06
-#define BT_MBI_USB_WRITE   0x07
-#define BT_MBI_SATA_READ   0x00
-#define BT_MBI_SATA_WRITE  0x01
-#define BT_MBI_PCIE_READ   0x00
-#define BT_MBI_PCIE_WRITE  0x01
-
 /* Quark available units */
 #define QRK_MBI_UNIT_HBA   0x00
 #define QRK_MBI_UNIT_HB0x03
 #define QRK_MBI_UNIT_RMU   0x04
 #define QRK_MBI_UNIT_MM0x05
-#define QRK_MBI_UNIT_MMESRAM   0x05
 #define QRK_MBI_UNIT_SOC   0x31
 
-/* Quark read/write opcodes */
-#define QRK_MBI_HBA_READ   0x10
-#define QRK_MBI_HBA_WRITE  0x11
-#define QRK_MBI_HB_READ0x10
-#define QRK_MBI_HB_WRITE   0x11
-#define QRK_MBI_RMU_READ   0x10
-#define QRK_MBI_RMU_WRITE  0x11
-#define QRK_MBI_MM_READ0x10
-#define QRK_MBI_MM_WRITE   0x11
-#define QRK_MBI_MMESRAM_READ   0x12
-#define QRK_MBI_MMESRAM_WRITE  0x13
-#define QRK_MBI_SOC_READ   0x06
-#define QRK_MBI_SOC_WRITE  0x07
-
 #if IS_ENABLED(CONFIG_IOSF_MBI)
 
 bool iosf_mbi_available(void);
diff --git a/arch/x86/platform/atom/punit_atom_debug.c 
b/arch/x86/platform/atom/punit_atom_debug.c
index 5ca8ead..81c769e 100644
--- a/arch/x86/platform/atom/punit_atom_debug.c
+++ b/arch/x86/platform/atom/punit_atom_debug.c
@@ -25,8 +25,6 @@
 #include 
 #include 
 
-/* Side band Interface port */
-#define PUNIT_PORT 0x04
 /* Power gate status reg */
 #define PWRGT_STATUS   0x61
 /* Subsystem config/status Video processor */
@@ -85,9 +83,8 @@ static int punit_dev_state_show(struct seq_file *seq_file, 
void *unused)
 
seq_puts(seq_file, "\n\nPUNIT NORTH COMPLEX DEVICES :\n");
while (punit_devp->name) {
-   status = iosf_mbi_read(PUNIT_PORT, BT_MBI_PMC_READ,
-  punit_devp->reg,
-  _pwr_status);
+   status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ,
+  punit_devp->reg, _pwr_status);
if (status) {
seq_printf(seq_file, "%9s : Read Failed\n",
   punit_devp->name);
diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c 
b/drivers/i2c/busses/i2c-designware-baytrail.c
index 7d7ae97..e38c2bb 100644
--- a/drivers/i2c/busses/i2c-designware-baytrail.c
+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
@@ -34,8 +34,7 @@ static int