From: kernel test robot <lkp@intel.com>
To: "Martin Zaťovič" <m.zatovic1@gmail.com>, linux-kernel@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, gregkh@linuxfoundation.org,
martin.petersen@oracle.com, beanhuo@micron.com, arnd@arndb.de,
avri.altman@wdc.com, iwona.winiarska@intel.com,
fmdefrancesco@gmail.com, dipenp@nvidia.com, ogabbay@kernel.org,
bvanassche@acm.org, mathieu.poirier@linaro.org,
yangyicong@hisilicon.com, dan.j.williams@intel.com,
devicetree@vger.kernel.org, linus.walleij@linaro.org,
"Martin Zaťovič" <m.zatovic1@gmail.com>
Subject: Re: [PATCHv2 4/4] wiegand: add Wiegand GPIO bit-banged controller driver
Date: Fri, 3 Feb 2023 04:39:57 +0800 [thread overview]
Message-ID: <202302030403.qE5eN2x8-lkp@intel.com> (raw)
In-Reply-To: <20230202143305.21789-5-m.zatovic1@gmail.com>
Hi Martin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.2-rc6 next-20230202]
[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/20230202-223510
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20230202143305.21789-5-m.zatovic1%40gmail.com
patch subject: [PATCHv2 4/4] wiegand: add Wiegand GPIO bit-banged controller driver
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230203/202302030403.qE5eN2x8-lkp@intel.com/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/d2c4bf0953d186dba735c1f95b5c25ff5523872c
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/20230202-223510
git checkout d2c4bf0953d186dba735c1f95b5c25ff5523872c
# 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@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/wiegand/wiegand-gpio.c:51:9: warning: no previous prototype for 'payload_len_show' [-Wmissing-prototypes]
51 | ssize_t payload_len_show(struct device *dev, struct device_attribute *attr,
| ^~~~~~~~~~~~~~~~
>> drivers/wiegand/wiegand-gpio.c:61:9: warning: no previous prototype for 'payload_len_store' [-Wmissing-prototypes]
61 | ssize_t payload_len_store(struct device *dev, struct device_attribute *attr,
| ^~~~~~~~~~~~~~~~~
>> drivers/wiegand/wiegand-gpio.c:79:6: warning: no previous prototype for 'wiegand_gpio_send_bit' [-Wmissing-prototypes]
79 | void wiegand_gpio_send_bit(struct wiegand_gpio *wiegand_gpio, bool value,
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/wiegand/wiegand-gpio.c:198:5: warning: no previous prototype for 'wiegand_gpio_transfer_message' [-Wmissing-prototypes]
198 | int wiegand_gpio_transfer_message(struct wiegand_device *dev, u8 *message,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/payload_len_show +51 drivers/wiegand/wiegand-gpio.c
47
48 /*
49 * Attribute file for setting payload length of Wiegand messages.
50 */
> 51 ssize_t payload_len_show(struct device *dev, struct device_attribute *attr,
52 char *buf)
53 {
54 struct wiegand_gpio *wiegand_gpio = (struct wiegand_gpio *)
55 dev->driver_data;
56 struct wiegand_controller *ctlr = wiegand_gpio->ctlr;
57
58 return sysfs_emit(buf, "%u\n", ctlr->payload_len);
59 }
60
> 61 ssize_t payload_len_store(struct device *dev, struct device_attribute *attr,
62 const char *buf, size_t count)
63 {
64 struct wiegand_gpio *wiegand_gpio = (struct wiegand_gpio *)
65 dev->driver_data;
66 struct wiegand_controller *ctlr = wiegand_gpio->ctlr;
67
68 return store_ulong(&(ctlr->payload_len), buf, count,
69 WIEGAND_MAX_PAYLEN_BYTES * 8);
70 }
71 DEVICE_ATTR_RW(payload_len);
72
73 /*
74 * To send a bit of value 1 following the wiegand protocol, one must set
75 * the wiegand_data_hi to low for the duration of pulse. Similarly to send
76 * a bit of value 0, the wiegand_data_lo is set to low for pulse duration.
77 * This way the two lines are never low at the same time.
78 */
> 79 void wiegand_gpio_send_bit(struct wiegand_gpio *wiegand_gpio, bool value,
80 bool last)
81 {
82 u32 pulse_len = wiegand_gpio->ctlr->pulse_len;
83 u32 interval_len = wiegand_gpio->ctlr->interval_len;
84 u32 frame_gap = wiegand_gpio->ctlr->frame_gap;
85 struct gpio_desc *gpio = value ? wiegand_gpio->gpio_data_hi
86 : wiegand_gpio->gpio_data_lo;
87
88 gpiod_set_value_cansleep(gpio, 0);
89 udelay(pulse_len);
90 gpiod_set_value_cansleep(gpio, 1);
91
92 if (last)
93 udelay(frame_gap - pulse_len);
94 else
95 udelay(interval_len - pulse_len);
96 }
97
98 /* This function is used for writing from file in dev directory */
99 static int wiegand_gpio_write_by_bits(struct wiegand_gpio *wiegand_gpio,
100 u16 bitlen)
101 {
102 size_t i;
103 bool bit_value, is_last_bit;
104
105 for (i = 0; i < bitlen; i++) {
106 bit_value = ((wiegand_gpio->data[i / 8] >> (7 - (i % 8)))
107 & 0x01);
108 is_last_bit = (i + 1) == bitlen;
109 wiegand_gpio_send_bit(wiegand_gpio, bit_value, is_last_bit);
110 }
111
112 return 0;
113 }
114
115 static ssize_t wiegand_gpio_get_user_data(struct wiegand_gpio *wiegand_gpio,
116 char __user const *buf, size_t len)
117 {
118 size_t rc;
119
120 if (len > WIEGAND_MAX_PAYLEN_BYTES)
121 return -EBADMSG;
122
123 rc = copy_from_user(&wiegand_gpio->data[0], buf,
124 WIEGAND_MAX_PAYLEN_BYTES);
125 if (rc < 0)
126 return rc;
127
128 return len;
129 }
130
131 static int wiegand_gpio_frelease(struct inode *ino, struct file *filp)
132 {
133 struct wiegand_gpio_instance *info = filp->private_data;
134 struct wiegand_gpio *wiegand_gpio = info->dev;
135
136 mutex_lock(&wiegand_gpio->mutex);
137 info->flags = 0;
138 mutex_unlock(&wiegand_gpio->mutex);
139
140 kfree(info);
141
142 return 0;
143 }
144
145 static ssize_t wiegand_gpio_fwrite(struct file *filp, char __user const *buf,
146 size_t len, loff_t *offset)
147 {
148 struct wiegand_gpio_instance *info = filp->private_data;
149 struct wiegand_gpio *wiegand_gpio = info->dev;
150 u32 msg_length = wiegand_gpio->ctlr->payload_len;
151 int rc;
152
153 if (buf == NULL || len == 0 || len * 8 < msg_length)
154 return -EINVAL;
155
156 rc = wiegand_gpio_get_user_data(wiegand_gpio, buf, len);
157 if (rc < 0)
158 return rc;
159
160 wiegand_gpio_write_by_bits(wiegand_gpio, msg_length);
161
162 return len;
163 }
164
165 static int wiegand_gpio_fopen(struct inode *ino, struct file *filp)
166 {
167 int rc;
168 struct wiegand_gpio_instance *info;
169 struct wiegand_gpio *wiegand_gpio = container_of(filp->f_op,
170 struct wiegand_gpio,
171 fops);
172 mutex_lock(&wiegand_gpio->mutex);
173 if ((filp->f_flags & O_ACCMODE) == O_RDONLY ||
174 (filp->f_flags & O_ACCMODE) == O_RDWR) {
175 dev_err(wiegand_gpio->dev, "Device is write only\n");
176 rc = -EIO;
177 goto err;
178 }
179 info = kzalloc(sizeof(*info), GFP_KERNEL);
180 if (!info) {
181 rc = -ENOMEM;
182 goto err;
183 }
184
185 info->dev = wiegand_gpio;
186 info->flags = filp->f_flags;
187 mutex_unlock(&wiegand_gpio->mutex);
188
189 filp->private_data = info;
190
191 return 0;
192 err:
193 mutex_unlock(&wiegand_gpio->mutex);
194 return rc;
195 }
196
197 /* This function is used by device drivers */
> 198 int wiegand_gpio_transfer_message(struct wiegand_device *dev, u8 *message,
199 u8 msg_bitlen)
200 {
201 struct wiegand_controller *ctlr = dev->controller;
202 struct wiegand_gpio *wiegand_gpio = wiegand_master_get_devdata(ctlr);
203 u8 msg_bytelength = (msg_bitlen % 8) ?
204 (msg_bitlen / 8) + 1 : (msg_bitlen / 8);
205
206 memcpy(wiegand_gpio->data, message, msg_bytelength);
207 wiegand_gpio_write_by_bits(wiegand_gpio, msg_bitlen);
208
209 return 0;
210 }
211
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next prev parent reply other threads:[~2023-02-02 20:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 14:33 [PATCHv2 0/4] Wiegand bus driver and GPIO bit-banged controller Martin Zaťovič
2023-02-02 14:33 ` [PATCHv2 1/4] dt-bindings: wiegand: add Wiegand controller common properties Martin Zaťovič
2023-02-03 20:35 ` Rob Herring
2023-02-02 14:33 ` [PATCHv2 2/4] wiegand: add Wiegand bus driver Martin Zaťovič
2023-02-03 6:19 ` Greg KH
2023-02-06 9:49 ` Zhou Furong
2023-02-06 10:26 ` Greg KH
2023-02-07 0:36 ` Zhou Furong
2023-02-07 6:08 ` Greg KH
2023-02-07 12:59 ` Krzysztof Kozlowski
2023-02-03 22:42 ` kernel test robot
2023-02-02 14:33 ` [PATCHv2 3/4] dt-bindings: wiegand: add GPIO bitbanged Wiegand documentation Martin Zaťovič
2023-02-03 7:22 ` Krzysztof Kozlowski
2023-02-02 14:33 ` [PATCHv2 4/4] wiegand: add Wiegand GPIO bit-banged controller driver Martin Zaťovič
2023-02-02 20:39 ` kernel test robot [this message]
2023-02-03 6:20 ` Greg KH
2023-02-02 22:20 ` [PATCHv2 0/4] Wiegand bus driver and GPIO bit-banged controller Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202302030403.qE5eN2x8-lkp@intel.com \
--to=lkp@intel.com \
--cc=arnd@arndb.de \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=dan.j.williams@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dipenp@nvidia.com \
--cc=fmdefrancesco@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=iwona.winiarska@intel.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.zatovic1@gmail.com \
--cc=martin.petersen@oracle.com \
--cc=mathieu.poirier@linaro.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=ogabbay@kernel.org \
--cc=robh+dt@kernel.org \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.