Re: [PATCHv4 4/4] wiegand: add Wiegand GPIO bitbanged controller driver

From: kernel test robot
Date: Wed May 10 2023 - 16:16:57 EST


Hi Martin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.4-rc1 next-20230510]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Martin-Za-ovi/dt-bindings-wiegand-add-Wiegand-controller-common-properties/20230511-002708
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20230510162243.95820-5-m.zatovic1%40gmail.com
patch subject: [PATCHv4 4/4] wiegand: add Wiegand GPIO bitbanged controller driver
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230511/202305110450.jjNwIYfp-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/3eb47f0de6aecc78d72c144b36ccd97f22d908c5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Martin-Za-ovi/dt-bindings-wiegand-add-Wiegand-controller-common-properties/20230511-002708
git checkout 3eb47f0de6aecc78d72c144b36ccd97f22d908c5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305110450.jjNwIYfp-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/wiegand/wiegand-gpio.c:70:6: warning: no previous prototype for 'wiegand_gpio_send_bit' [-Wmissing-prototypes]
70 | void wiegand_gpio_send_bit(struct wiegand_gpio *wiegand_gpio, bool value, bool last)
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/wiegand/wiegand-gpio.c:111:5: warning: no previous prototype for 'wiegand_gpio_transfer_message' [-Wmissing-prototypes]
111 | int wiegand_gpio_transfer_message(struct wiegand_controller *ctlr)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/wiegand_gpio_send_bit +70 drivers/wiegand/wiegand-gpio.c

63
64 /*
65 * To send a bit of value 1 following the wiegand protocol, one must set
66 * the wiegand_data_hi to low for the duration of pulse. Similarly to send
67 * a bit of value 0, the wiegand_data_lo is set to low for pulse duration.
68 * This way the two lines are never low at the same time.
69 */
> 70 void wiegand_gpio_send_bit(struct wiegand_gpio *wiegand_gpio, bool value, bool last)
71 {
72 u32 sleep_len;
73 u32 pulse_len = wiegand_gpio->ctlr->pulse_len;
74 u32 interval_len = wiegand_gpio->ctlr->interval_len;
75 u32 frame_gap = wiegand_gpio->ctlr->frame_gap;
76 struct gpio_desc *gpio = value ? wiegand_gpio->data1_gpio : wiegand_gpio->data0_gpio;
77
78 gpiod_set_value_cansleep(gpio, 0);
79 udelay(pulse_len);
80 gpiod_set_value_cansleep(gpio, 1);
81
82 if (last)
83 sleep_len = frame_gap - pulse_len;
84 else
85 sleep_len = interval_len - pulse_len;
86
87 if (sleep_len < 10)
88 udelay(sleep_len);
89 else if (sleep_len < 100)
90 usleep_range(sleep_len - UP_TO_100_USEC_DEVIATION,
91 sleep_len + UP_TO_100_USEC_DEVIATION);
92 else
93 usleep_range(sleep_len - MORE_THAN_100_USEC_DEVIATION,
94 sleep_len + MORE_THAN_100_USEC_DEVIATION);
95 }
96
97 static int wiegand_gpio_write_by_bits(struct wiegand_gpio *wiegand_gpio, u16 bitlen)
98 {
99 size_t i;
100 bool bit_value, is_last_bit;
101
102 for (i = 0; i < bitlen; i++) {
103 bit_value = test_bit(i, wiegand_gpio->ctlr->data_bitmap);
104 is_last_bit = (i + 1) == bitlen;
105 wiegand_gpio_send_bit(wiegand_gpio, bit_value, is_last_bit);
106 }
107
108 return 0;
109 }
110
> 111 int wiegand_gpio_transfer_message(struct wiegand_controller *ctlr)
112 {
113 struct wiegand_gpio *wiegand_gpio = wiegand_primary_get_devdata(ctlr);
114 u8 msg_bitlen = ctlr->payload_len;
115
116 wiegand_gpio_write_by_bits(wiegand_gpio, msg_bitlen);
117
118 return 0;
119 }
120

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