Re: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA

From: kernel test robot
Date: Fri Dec 29 2023 - 03:54:08 EST


Hi larry.lai,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 4fe89d07dcc2804c8b562f6c7896a45643d34b2f]

url: https://github.com/intel-lab-lkp/linux/commits/larry-lai/mfd-Add-support-for-UP-board-CPLD-FPGA/20231228-231750
base: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f
patch link: https://lore.kernel.org/r/20231228151544.14408-3-larry.lai%40yunjingtech.com
patch subject: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20231229/202312291646.wfn6dxdH-lkp@xxxxxxxxx/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231229/202312291646.wfn6dxdH-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312291646.wfn6dxdH-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/pinctrl/pinctrl-upboard.c:709:13: warning: variable length array used [-Wvla]
709 | int offset[pctrl->pctldesc->npins];
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:1089:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1089 | .ident = BOARD_UP_APL01,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:46:27: note: expanded from macro 'BOARD_UP_APL01'
46 | #define BOARD_UP_APL01 1
| ^
drivers/pinctrl/pinctrl-upboard.c:1096:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1096 | .ident = BOARD_UP_APL01,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:46:27: note: expanded from macro 'BOARD_UP_APL01'
46 | #define BOARD_UP_APL01 1
| ^
drivers/pinctrl/pinctrl-upboard.c:1103:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1103 | .ident = BOARD_UP_APL03,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:53:27: note: expanded from macro 'BOARD_UP_APL03'
53 | #define BOARD_UP_APL03 9
| ^
drivers/pinctrl/pinctrl-upboard.c:1110:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1110 | .ident = BOARD_UP_WHL01,
| ^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:50:27: note: expanded from macro 'BOARD_UP_WHL01'
50 | #define BOARD_UP_WHL01 5
| ^
drivers/pinctrl/pinctrl-upboard.c:1117:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1117 | .ident = BOARD_UPX_TGL,
| ^~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:55:26: note: expanded from macro 'BOARD_UPX_TGL'
55 | #define BOARD_UPX_TGL 11
| ^~
drivers/pinctrl/pinctrl-upboard.c:1124:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1124 | .ident = BOARD_UPN_EHL01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:57:28: note: expanded from macro 'BOARD_UPN_EHL01'
57 | #define BOARD_UPN_EHL01 13
| ^~
drivers/pinctrl/pinctrl-upboard.c:1131:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1131 | .ident = BOARD_UPS_EHL01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:58:28: note: expanded from macro 'BOARD_UPS_EHL01'
58 | #define BOARD_UPS_EHL01 BOARD_UPN_EHL01
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:57:28: note: expanded from macro 'BOARD_UPN_EHL01'
57 | #define BOARD_UPN_EHL01 13
| ^~
drivers/pinctrl/pinctrl-upboard.c:1138:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1138 | .ident = BOARD_UPX_ADLP01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:59:28: note: expanded from macro 'BOARD_UPX_ADLP01'
59 | #define BOARD_UPX_ADLP01 15
| ^~
drivers/pinctrl/pinctrl-upboard.c:1145:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1145 | .ident = BOARD_UPN_ADLN01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:60:28: note: expanded from macro 'BOARD_UPN_ADLN01'
60 | #define BOARD_UPN_ADLN01 16
| ^~
drivers/pinctrl/pinctrl-upboard.c:1152:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1152 | .ident = BOARD_UPS_ADLP01,
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:61:28: note: expanded from macro 'BOARD_UPS_ADLP01'
61 | #define BOARD_UPS_ADLP01 BOARD_UPX_ADLP01
| ^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:59:28: note: expanded from macro 'BOARD_UPX_ADLP01'
59 | #define BOARD_UPX_ADLP01 15
| ^~
drivers/pinctrl/pinctrl-upboard.c:1159:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
1159 | .ident = BOARD_UP_ADLN01,
| ^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:62:28: note: expanded from macro 'BOARD_UP_ADLN01'
62 | #define BOARD_UP_ADLN01 18
| ^~
drivers/pinctrl/pinctrl-upboard.c:1185:12: error: incompatible pointer to integer conversion assigning to 'int' from 'const char *const' [-Wint-conversion]
1185 | board_id = system_id->ident;
| ^ ~~~~~~~~~~~~~~~~
1 warning and 12 errors generated.


vim +709 drivers/pinctrl/pinctrl-upboard.c

705
706 static void upboard_alt_func_enable(struct gpio_chip *gc, const char *name, int id)
707 {
708 struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip);
> 709 int offset[pctrl->pctldesc->npins];
710 int i, cnt;
711 bool input;
712 int mode;
713 unsigned int val;
714
715 /* find all pins */
716 for (i = 0, cnt = 0; i < pctrl->pctldesc->npins; i++) {
717 if (strstr(pctrl->pctldesc->pins[i].name, name))
718 offset[cnt++] = i;
719 }
720
721 /* change to alternate function */
722 for (i = 0; i < cnt; i++) {
723 if (pctrl->pins[offset[i]].regs == NULL)
724 continue;
725 input = false;
726 mode = 0; /* default GPIO */
727 val = readl(pctrl->pins[offset[i]].regs);
728
729 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2C") ||
730 strstr(pctrl->pctldesc->pins[offset[i]].name, "PINMUX")) {
731 mode = 1;
732 switch (id) {
733 case BOARD_UPN_ADLN01:
734 case BOARD_UPX_ADLP01:
735 mode = 2;
736 break;
737 default:
738 break;
739 }
740
741 val |= mode<<PADCFG0_PMODE_SHIFT;
742 writel(val, pctrl->pins[offset[i]].regs);
743 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
744 continue;
745 }
746
747 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "UART")) {
748 mode = 1;
749 switch (id) {
750 case BOARD_UPN_EHL01:
751 mode = 4;
752 break;
753 case BOARD_UP_ADLN01:
754 case BOARD_UPN_ADLN01:
755 case BOARD_UPX_ADLP01:
756 mode = 2;
757 break;
758 default:
759 break;
760 }
761 }
762
763 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SPI")) {
764 mode = 1;
765 switch (id) {
766 case BOARD_UP_WHL01:
767 mode = 3;
768 break;
769 case BOARD_UP_ADLN01:
770 case BOARD_UPN_ADLN01:
771 case BOARD_UPX_ADLP01:
772 mode = 7;
773 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MOSI")) {
774 val &= ~PADCFG0_GPIOTXDIS;
775 val |= PADCFG0_GPIORXDIS;
776 }
777
778 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
779 val |= PADCFG0_GPIORXDIS;
780
781 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CLK")) {
782 val &= ~PADCFG0_GPIOTXDIS;
783 val |= PADCFG0_GPIORXDIS;
784 }
785 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS0"))
786 val |= PADCFG0_GPIORXDIS;
787
788 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS1"))
789 continue;
790 break;
791 default:
792 break;
793 }
794 }
795
796 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2S")) {
797 mode = 1;
798 switch (id) {
799 case BOARD_UPX_ADLP01:
800 mode = 4;
801 break;
802 default:
803 break;
804 }
805 }
806
807 val |= mode<<PADCFG0_PMODE_SHIFT;
808 writel(val, pctrl->pins[offset[i]].regs);
809
810 /* input pins */
811 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "RX"))
812 input = true;
813
814 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CTS"))
815 input = true;
816
817 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "ADC")) {
818 input = true;
819 if (id == BOARD_UP_APL01)
820 upboard_fpga_request_enable(pctrl->pctldev, NULL, offset[i]);
821 else
822 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
823 }
824
825 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
826 input = true;
827
828 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "DIN"))
829 input = true;
830
831 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SDI"))
832 input = true;
833
834 upboard_fpga_set_direction(pctrl->pctldev, NULL, offset[i], input);
835 }
836 }
837

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki