Skip to contentSkip to conversation

mt76x0u: Probing issues on Raspberry Pi 3 B+

BUG Stanislaw Gruszka 1 participant 1 message Feb 12, 2019 USB

lore
Share & tools
lore
#0 lore raw
Quoted 16 lines · Lorenzo Bianconi

Review

Quoted 11 lines
(quoted diff) +11 -0
+	usb_fill_bulk_urb(buf->urb, udev, pipe, NULL, buf->len, complete_fn,
+			  context);
+
+	if (udev->bus->sg_tablesize > 0) {
+		buf->urb->num_sgs = buf->num_sgs;
+	} else {
+		WARN_ON_ONCE(buf->num_sgs != 1);
+		/* See usb_sg_init() */
+		buf->urb->num_sgs = 0;
+		if (!PageHighMem(sg_page(buf->urb->sg)))
+			buf->urb->transfer_buffer = sg_virt(buf->urb->sg);

please correct me if I am wrong but doing so we will use transfer_buffer for 95% of the use cases, right? If so why not keep it simple and always use it when sg_tablesize is 0 (avoiding SG I/O)?

Quoted 2 lines

Btw this is what I proposed with the RFC series actually :) (always use transfer_buffer in the usb 2.0 case)

Because this way we do not change allocation method (use SG allocation) what is simpler IMHO than having two buffer allocation methods.

And this way we do not hide problems with SG allocation and test it.

Additionally this patch address actual bug: using wrong urb->num_sgs and can be easier to backport to older releases than 4 patch series.

Stanislaw