Hi Shihlun,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on linux/master v5.9]
[cannot apply to lee-mfd/for-mfd-next next-20201013]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
b5fc7a89e58bcc059a3d5e4db79c481fb437de59
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # 
https://github.com/0day-ci/linux/commit/f939b81446bccbb73682a795ea5422386d6b15bb
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Shihlun-Lin/mfd-ahc1ec0-Add-support-for-Advantech-embedded-controller/20201014-164627
        git checkout f939b81446bccbb73682a795ea5422386d6b15bb
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

   drivers/mfd/ahc1ec0.c:71:5: warning: no previous prototype for 'wait_ibf' 
[-Wmissing-prototypes]
      71 | int wait_ibf(void)
         |     ^~~~~~~~
   drivers/mfd/ahc1ec0.c:86:5: warning: no previous prototype for 'wait_obf' 
[-Wmissing-prototypes]
      86 | int wait_obf(void)
         |     ^~~~~~~~
   drivers/mfd/ahc1ec0.c:101:5: warning: no previous prototype for 
'read_hw_ram' [-Wmissing-prototypes]
     101 | int read_hw_ram(uchar addr, uchar *data)
         |     ^~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:182:5: warning: no previous prototype for 
'wait_smbus_protocol_finish' [-Wmissing-prototypes]
     182 | int wait_smbus_protocol_finish(void)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:203:5: warning: no previous prototype for 
'adv_get_dynamic_tab' [-Wmissing-prototypes]
     203 | int adv_get_dynamic_tab(struct adv_ec_platform_data *pdata)
         |     ^~~~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:409:5: warning: no previous prototype for 
'write_acpi_value' [-Wmissing-prototypes]
     409 | int write_acpi_value(uchar addr, uchar value)
         |     ^~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:442:5: warning: no previous prototype for 
'read_gpio_status' [-Wmissing-prototypes]
     442 | int read_gpio_status(uchar PinNumber, uchar *pvalue)
         |     ^~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:493:5: warning: no previous prototype for 
'write_gpio_status' [-Wmissing-prototypes]
     493 | int write_gpio_status(uchar PinNumber, uchar value)
         |     ^~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:538:5: warning: no previous prototype for 
'read_gpio_dir' [-Wmissing-prototypes]
     538 | int read_gpio_dir(uchar PinNumber, uchar *pvalue)
         |     ^~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:585:5: warning: no previous prototype for 
'write_gpio_dir' [-Wmissing-prototypes]
     585 | int write_gpio_dir(uchar PinNumber, uchar value)
         |     ^~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:631:5: warning: no previous prototype for 
'write_hw_extend_ram' [-Wmissing-prototypes]
     631 | int write_hw_extend_ram(uchar addr, uchar data)
         |     ^~~~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:866:5: warning: no previous prototype for 
'smbus_write_byte' [-Wmissing-prototypes]
     866 | int smbus_write_byte(struct EC_SMBUS_WRITE_BYTE 
*ptr_ec_smbus_write_byte)
         |     ^~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:946:5: warning: no previous prototype for 
'read_onekey_status' [-Wmissing-prototypes]
     946 | int read_onekey_status(uchar addr, uchar *pdata)
         |     ^~~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:990:5: warning: no previous prototype for 
'write_onekey_status' [-Wmissing-prototypes]
     990 | int write_onekey_status(uchar addr)
         |     ^~~~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:1024:5: warning: no previous prototype for 
'ec_oem_get_status' [-Wmissing-prototypes]
    1024 | int ec_oem_get_status(uchar addr, uchar *pdata)
         |     ^~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c:1076:5: warning: no previous prototype for 
'ec_oem_set_status' [-Wmissing-prototypes]
    1076 | int ec_oem_set_status(uchar addr, uchar pdata)
         |     ^~~~~~~~~~~~~~~~~
   drivers/mfd/ahc1ec0.c: In function 'adv_ec_get_productname':
   drivers/mfd/ahc1ec0.c:1167:13: error: implicit declaration of function 
'ioremap_cache'; did you mean 'ioremap_uc'? 
[-Werror=implicit-function-declaration]
    1167 |     (char *)ioremap_cache(((unsigned int 
*)&uc_ptaddr[index+0x18])[0],
         |             ^~~~~~~~~~~~~
         |             ioremap_uc
>> drivers/mfd/ahc1ec0.c:1167:5: warning: cast to pointer from integer of 
>> different size [-Wint-to-pointer-cast]
    1167 |     (char *)ioremap_cache(((unsigned int 
*)&uc_ptaddr[index+0x18])[0],
         |     ^
   At top level:
   drivers/mfd/ahc1ec0.c:1244:30: warning: 'adv_ec_util_cells' defined but not 
used [-Wunused-const-variable=]
    1244 | static const struct mfd_cell adv_ec_util_cells[] = {
         |                              ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +1167 drivers/mfd/ahc1ec0.c

  1124  
  1125  static int adv_ec_get_productname(char *product)
  1126  {
  1127          static unsigned char *uc_ptaddr;
  1128          static unsigned char *uc_epsaddr;
  1129          int index = 0, eps_table;
  1130          int i = 0;
  1131          int length = 0;
  1132          int type0_str = 0;
  1133          int type1_str = 0;
  1134          int is_advantech = 0;
  1135  
  1136          uc_ptaddr = ioremap(AMI_UEFI_ADVANTECH_BOARD_NAME_ADDRESS,
  1137                          AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH);
  1138          if (!uc_ptaddr) {
  1139                  pr_err("Error: ioremap_nocache()");
  1140                  return -ENXIO;
  1141          }
  1142  
  1143          /* Try to Read the product name from UEFI BIOS(DMI) EPS table */
  1144          for (index = 0; index < AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH; 
index++) {
  1145                  if (uc_ptaddr[index] == '_'
  1146                                  && uc_ptaddr[index+0x1] == 'S'
  1147                                  && uc_ptaddr[index+0x2] == 'M'
  1148                                  && uc_ptaddr[index+0x3] == '_'
  1149                                  && uc_ptaddr[index+0x10] == '_'
  1150                                  && uc_ptaddr[index+0x11] == 'D'
  1151                                  && uc_ptaddr[index+0x12] == 'M'
  1152                                  && uc_ptaddr[index+0x13] == 'I'
  1153                                  && uc_ptaddr[index+0x14] == '_'
  1154                                  ) {
  1155                          eps_table = 1;
  1156                          break;
  1157                  }
  1158          }
  1159  
  1160          /* If EPS table exist, read type1(system information) */
  1161          if (eps_table) {
  1162                  uc_epsaddr =
  1163                          (char *)ioremap(((unsigned int 
*)&uc_ptaddr[index+0x18])[0],
  1164                          ((unsigned short *)&uc_ptaddr[index+0x16])[0]);
  1165                  if (!uc_epsaddr) {
  1166                          uc_epsaddr =
> 1167                                  (char *)ioremap_cache(((unsigned int 
> *)&uc_ptaddr[index+0x18])[0],
  1168                                  ((unsigned short 
*)&uc_ptaddr[index+0x16])[0]);
  1169                          if (!uc_epsaddr) {
  1170                                  pr_err("Error: both ioremap() and 
ioremap_cache() exec failed!");
  1171                                  return -ENXIO;
  1172                          }
  1173                  }
  1174  
  1175                  type0_str = (int)uc_epsaddr[1];
  1176                  for (i = type0_str; i < (type0_str+512); i++) {
  1177                          if (uc_epsaddr[i] == 0 && uc_epsaddr[i+1] == 0 
&& uc_epsaddr[i+2] == 1) {
  1178                                  type1_str = i + uc_epsaddr[i+3];
  1179                                  break;
  1180                          }
  1181                  }
  1182                  for (i = type1_str; i < (type1_str+512); i++) {
  1183                          if (!strncmp(&uc_epsaddr[i], "Advantech", 9))
  1184                                  is_advantech = 1;
  1185  
  1186                          if (uc_epsaddr[i] == 0) {
  1187                                  i++;
  1188                                  type1_str = i;
  1189                                  break;
  1190                          }
  1191                  }
  1192                  length = 2;
  1193                  while ((uc_epsaddr[type1_str + length] != 0)
  1194                                  && (length < 
AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH)) {
  1195                          length += 1;
  1196                  }
  1197                  memmove(product, &uc_epsaddr[type1_str], length);
  1198                  iounmap((void *)uc_epsaddr);
  1199                  if (is_advantech) {
  1200                          iounmap((void *)uc_ptaddr);
  1201                          return 0;
  1202                  }
  1203          }
  1204  
  1205          /* It is an old BIOS, read from 0x000F0000 */
  1206          for (index = 0; index < (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 
3); index++) {
  1207                  if (!strncmp(&uc_ptaddr[index], "TPC", 3)
  1208                                  || !strncmp(&uc_ptaddr[index], "UNO", 3)
  1209                                  || !strncmp(&uc_ptaddr[index], "ITA", 3)
  1210                                  || !strncmp(&uc_ptaddr[index], "MIO", 3)
  1211                                  || !strncmp(&uc_ptaddr[index], "ECU", 3)
  1212                                  || !strncmp(&uc_ptaddr[index], "APAX", 
4))
  1213                          break;
  1214          }
  1215  
  1216          if (index == (AMI_UEFI_ADVANTECH_BOARD_NAME_LENGTH - 3)) {
  1217                  pr_err("%s: Can't find the product name, line: %d", 
__func__, __LINE__);
  1218                  product[0] = '\0';
  1219                  iounmap((void *)uc_ptaddr);
  1220                  return -ENODATA;
  1221          }
  1222  
  1223          /* Use char "Space" (ASCII code: 32) to check the end of the 
Product Name. */
  1224          for (i = 0; (uc_ptaddr[index+i] != 32) && (i < 31); i++)
  1225                  product[i] = uc_ptaddr[index+i];
  1226  
  1227          product[i] = '\0';
  1228          pr_info("%s: BIOS Product Name = %s, line: %d", __func__, 
product, __LINE__);
  1229  
  1230          iounmap((void *)uc_ptaddr);
  1231  
  1232          return 0;
  1233  }
  1234  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to