Re: [PATCH v4 5/8] usb: mausb_host: Introduce PAL processing
From: kbuild test robot
Date: Fri Mar 27 2020 - 23:57:36 EST
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on balbi-usb/next peter.chen-usb/ci-for-usb-next linus/master linux/master v5.6-rc7 next-20200327]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/vladimir-stankovic-displaylink-com/Add-MA-USB-Host-driver/20200328-042436
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: c6x-allyesconfig (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=c6x
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/usb/mausb_host/hpal.c: In function 'mausb_release_event_resources':
>> drivers/usb/mausb_host/hpal.c:221:45: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
221 | struct ma_usb_hdr_common *receive_buffer = (struct ma_usb_hdr_common *)
| ^
drivers/usb/mausb_host/hpal.c: In function 'mausb_complete_urb':
drivers/usb/mausb_host/hpal.c:229:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
229 | struct urb *urb = (struct urb *)event->data.urb;
| ^
drivers/usb/mausb_host/hpal.c: In function 'mausb_data_req_enqueue_event':
>> drivers/usb/mausb_host/hpal.c:357:26: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
357 | mausb_event.data.urb = (u64)request;
| ^
drivers/usb/mausb_host/hpal.c: In function 'mausb_execute_urb_dequeue':
drivers/usb/mausb_host/hpal.c:492:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
492 | mausb_event.data.urb = (u64)urb;
| ^
drivers/usb/mausb_host/hpal.c: In function 'mausb_send_data_msg':
drivers/usb/mausb_host/hpal.c:725:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
725 | urb_ctx = mausb_find_urb_in_tree((struct urb *)event->data.urb);
| ^
drivers/usb/mausb_host/hpal.c: In function 'mausb_receive_data_msg':
drivers/usb/mausb_host/hpal.c:752:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
752 | urb_ctx = mausb_find_urb_in_tree((struct urb *)event->data.urb);
| ^
/tmp/ccABqgDp.s: Assembler messages:
/tmp/ccABqgDp.s:3838: Warning: ignoring changed section attributes for .far
vim +221 drivers/usb/mausb_host/hpal.c
218
219 void mausb_release_event_resources(struct mausb_event *event)
220 {
> 221 struct ma_usb_hdr_common *receive_buffer = (struct ma_usb_hdr_common *)
222 event->data.recv_buf;
223
224 kfree(receive_buffer);
225 }
226
227 void mausb_complete_urb(struct mausb_event *event)
228 {
229 struct urb *urb = (struct urb *)event->data.urb;
230
231 mausb_pr_debug("transfer_size=%d, rem_transfer_size=%d, status=%d",
232 event->data.transfer_size,
233 event->data.rem_transfer_size, event->status);
234 mausb_complete_request(urb,
235 event->data.transfer_size -
236 event->data.rem_transfer_size,
237 event->status);
238 }
239
240 static int mausb_get_first_free_port_number(u16 *port_number)
241 {
242 (*port_number) = 0;
243 while ((mhcd->connected_ports & (1 << *port_number)) != 0 &&
244 *port_number < NUMBER_OF_PORTS)
245 ++(*port_number);
246
247 if (*port_number == NUMBER_OF_PORTS)
248 return -EINVAL;
249
250 mhcd->connected_ports |= (1 << *port_number);
251
252 return 0;
253 }
254
255 static inline void mausb_port_has_changed_event(struct mausb_device *dev,
256 struct mausb_event *event)
257 {
258 int status;
259 u16 port_number;
260 unsigned long flags = 0;
261
262 spin_lock_irqsave(&mhcd->lock, flags);
263
264 status = mausb_get_first_free_port_number(&port_number);
265 if (status < 0) {
266 spin_unlock_irqrestore(&mhcd->lock, flags);
267 mausb_pr_err("There is no free port, schedule delete ma_dev");
268 queue_work(dev->workq, &dev->socket_disconnect_work);
269 return;
270 }
271
272 spin_unlock_irqrestore(&mhcd->lock, flags);
273
274 dev->dev_type = event->port_changed.dev_type;
275 dev->dev_speed = event->port_changed.dev_speed;
276 dev->lse = event->port_changed.lse;
277 dev->dev_connected = 1;
278 dev->port_number = port_number;
279
280 mausb_port_has_changed(event->port_changed.dev_type,
281 event->port_changed.dev_speed, dev);
282
283 if ((enum mausb_device_type)event->port_changed.dev_type == USB30HUB)
284 mausb_port_has_changed(USB20HUB, HIGH_SPEED, dev);
285 }
286
287 static void mausb_heartbeat_timer_func(struct timer_list *timer)
288 {
289 unsigned long flags = 0;
290 struct mausb_device *dev = NULL;
291
292 if (mausb_start_heartbeat_timer() < 0) {
293 mausb_pr_err("Devices disconnecting - app is unresponsive");
294 spin_lock_irqsave(&mss.lock, flags);
295
296 /* Reset connected clients */
297 mss.client_connected = false;
298 mss.missed_heartbeats = 0;
299
300 list_for_each_entry(dev, &mss.madev_list, list_entry) {
301 mausb_pr_debug("Enqueue heartbeat_work madev_addr=%x",
302 dev->madev_addr);
303 queue_work(dev->workq, &dev->heartbeat_work);
304 }
305
306 complete(&mss.client_stopped);
307 spin_unlock_irqrestore(&mss.lock, flags);
308 }
309 }
310
311 void mausb_release_ma_dev_async(struct kref *kref)
312 {
313 struct mausb_device *dev = container_of(kref, struct mausb_device,
314 refcount);
315
316 mausb_pr_info("Scheduling work for MAUSB device to be deleted");
317
318 schedule_work(&dev->madev_delete_work);
319 }
320
321 int mausb_enqueue_event_from_user(u8 madev_addr, u16 num_of_events,
322 u16 num_of_completed)
323 {
324 unsigned long flags;
325 struct mausb_device *dev;
326
327 spin_lock_irqsave(&mss.lock, flags);
328 dev = mausb_get_dev_from_addr_unsafe(madev_addr);
329
330 if (!dev) {
331 spin_unlock_irqrestore(&mss.lock, flags);
332 return -EINVAL;
333 }
334
335 spin_lock(&dev->num_of_user_events_lock);
336 dev->num_of_user_events += num_of_events;
337 dev->num_of_completed_events += num_of_completed;
338 spin_unlock(&dev->num_of_user_events_lock);
339 queue_work(dev->workq, &dev->work);
340 spin_unlock_irqrestore(&mss.lock, flags);
341
342 return 0;
343 }
344
345 int mausb_data_req_enqueue_event(struct mausb_device *dev, u16 ep_handle,
346 struct urb *request)
347 {
348 struct mausb_event mausb_event;
349
350 mausb_event.type = MAUSB_EVENT_TYPE_SEND_DATA_MSG;
351 mausb_event.status = 0;
352
353 mausb_event.data.transfer_type =
354 mausb_transfer_type_from_usb(&request->ep->desc);
355 mausb_event.data.device_id = dev->id;
356 mausb_event.data.ep_handle = ep_handle;
> 357 mausb_event.data.urb = (u64)request;
358 mausb_event.data.setup_packet =
359 (usb_endpoint_xfer_control(&request->ep->desc) &&
360 request->setup_packet);
361 mausb_event.data.transfer_size = request->transfer_buffer_length;
362 mausb_event.data.direction = (usb_urb_dir_in(request) ?
363 MAUSB_DATA_MSG_DIRECTION_IN :
364 MAUSB_DATA_MSG_DIRECTION_OUT);
365 mausb_event.data.transfer_size +=
366 ((mausb_event.data.direction == MAUSB_DATA_MSG_DIRECTION_OUT &&
367 mausb_event.data.setup_packet) ?
368 MAUSB_CONTROL_SETUP_SIZE : 0);
369 mausb_event.data.rem_transfer_size = mausb_event.data.transfer_size;
370 mausb_event.data.transfer_flags = request->transfer_flags;
371 mausb_event.data.transfer_eot = false;
372 mausb_event.data.isoch_seg_num = (u32)request->number_of_packets;
373 mausb_event.data.recv_buf = 0;
374 mausb_event.data.payload_size =
375 (usb_endpoint_xfer_isoc(&request->ep->desc) &&
376 usb_endpoint_dir_out(&request->ep->desc)) ?
377 (request->iso_frame_desc[request->number_of_packets - 1]
378 .offset +
379 request->iso_frame_desc[request->number_of_packets - 1]
380 .length) : 0;
381
382 if (mausb_event.data.setup_packet) {
383 memcpy(mausb_event.data.hdr_ack, request->setup_packet,
384 MAUSB_CONTROL_SETUP_SIZE);
385 memcpy(shift_ptr(mausb_event.data.hdr_ack,
386 MAUSB_CONTROL_SETUP_SIZE),
387 &request->dev->route, sizeof(request->dev->route));
388 }
389
390 return 0;
391 }
392
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip