aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-4.4/821-usb-Remove-annoying-warning-about-bogus-URB.patch
blob: eb7cc809c73d15472dcc3dc97fcfce68ab8db81f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From f13ad28ba4280d2283ca2b49f0bd384bc51e6a68 Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin@synopsys.com>
Date: Tue, 5 Jul 2016 14:28:31 +0300
Subject: [PATCH] usb: Remove annoying warning about bogus URB

When ath9k-htc Wi-Fi dongle is used with generic OHCI controller
infinite stream of warnings appears in debug console like this:
-------------------------->8----------------------
usb 1-1: new full-speed USB device number 2 using ohci-platform
usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size:
51008
------------[ cut here ]------------
WARNING: CPU: 0 PID: 19 at drivers/usb/core/urb.c:449
usb_submit_urb+0x1b4/0x498()
usb 1-1: BOGUS urb xfer, pipe 1 != type 3
Modules linked in:
CPU: 0 PID: 19 Comm: kworker/0:1 Not tainted
4.4.0-rc4-00017-g00e2d79-dirty #3
Workqueue: events request_firmware_work_func

Stack Trace:
  arc_unwind_core.constprop.1+0xa4/0x110
---[ end trace 649ef8c342817fc2 ]---
------------[ cut here ]------------
WARNING: CPU: 0 PID: 19 at drivers/usb/core/urb.c:449
usb_submit_urb+0x1b4/0x498()
usb 1-1: BOGUS urb xfer, pipe 1 != type 3
Modules linked in:
CPU: 0 PID: 19 Comm: kworker/0:1 Tainted: G        W
4.4.0-rc4-00017-g00e2d79-dirty #3
Workqueue: events request_firmware_work_func

Stack Trace:
  arc_unwind_core.constprop.1+0xa4/0x110
---[ end trace 649ef8c342817fc3 ]---
------------[ cut here ]------------
-------------------------->8----------------------

There're some discussions in mailing lists proposing to disable
that particular check alltogether and magically all seem to work
fine with muted warning.

Anyways new thread on that regard could be found here:
http://lists.infradead.org/pipermail/linux-snps-arc/2016-July/001310.html

Let's see what comes out of that new discussion, hopefully patching
of generic USB stuff won't be required then.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
 drivers/usb/core/urb.c | 5 -----
 1 file changed, 5 deletions(-)

--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -323,9 +323,6 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb);
  */
 int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 {
-	static int			pipetypes[4] = {
-		PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT
-	};
 	int				xfertype, max;
 	struct usb_device		*dev;
 	struct usb_host_endpoint	*ep;
@@ -443,11 +440,6 @@ int usb_submit_urb(struct urb *urb, gfp_
 	 * cause problems in HCDs if they get it wrong.
 	 */
 
-	/* Check that the pipe's type matches the endpoint's type */
-	if (usb_pipetype(urb->pipe) != pipetypes[xfertype])
-		dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
-			usb_pipetype(urb->pipe), pipetypes[xfertype]);
-
 	/* Check against a simple/standard policy */
 	allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK |
 			URB_FREE_BUFFER);
"gi">+ string "Firmware partition name" + depends on MTD_SPLIT_FIRMWARE + default "firmware" + +endmenu + config MTD_TESTS tristate "MTD tests support (DANGEROUS)" depends on m --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -30,9 +30,11 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/of.h> +#include <linux/magic.h> #include <linux/err.h> #include "mtdcore.h" +#include "mtdsplit/mtdsplit.h" /* Our partition linked list */ static LIST_HEAD(mtd_partitions); @@ -46,13 +48,14 @@ struct mtd_part { struct list_head list; }; +static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); + /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve * the pointer to that structure with this macro. */ #define PART(x) ((struct mtd_part *)(x)) - /* * MTD methods which simply translate the effective address and pass through * to the _real_ device. @@ -548,8 +551,10 @@ out_register: return slave; } -int mtd_add_partition(struct mtd_info *master, const char *name, - long long offset, long long length) + +static int +__mtd_add_partition(struct mtd_info *master, const char *name, + long long offset, long long length, bool dup_check) { struct mtd_partition part; struct mtd_part *p, *new; @@ -581,21 +586,24 @@ int mtd_add_partition(struct mtd_info *m end = offset + length; mutex_lock(&mtd_partitions_mutex); - list_for_each_entry(p, &mtd_partitions, list) - if (p->master == master) { - if ((start >= p->offset) && - (start < (p->offset + p->mtd.size))) - goto err_inv; - - if ((end >= p->offset) && - (end < (p->offset + p->mtd.size))) - goto err_inv; - } + if (dup_check) { + list_for_each_entry(p, &mtd_partitions, list) + if (p->master == master) { + if ((start >= p->offset) && + (start < (p->offset + p->mtd.size))) + goto err_inv; + + if ((end >= p->offset) && + (end < (p->offset + p->mtd.size))) + goto err_inv; + } + } list_add(&new->list, &mtd_partitions); mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); + mtd_partition_split(master, new); return ret; err_inv: @@ -605,6 +613,12 @@ err_inv: } EXPORT_SYMBOL_GPL(mtd_add_partition); +int mtd_add_partition(struct mtd_info *master, const char *name, + long long offset, long long length) +{ + return __mtd_add_partition(master, name, offset, length, true); +} + int mtd_del_partition(struct mtd_info *master, int partno) { struct mtd_part *slave, *next; @@ -628,6 +642,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); +#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME +#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME +#else +#define SPLIT_FIRMWARE_NAME "unused" +#endif + +static void split_firmware(struct mtd_info *master, struct mtd_part *part) +{ +} + +void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, + int offset, int size) +{ +} + +static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) +{ + static int rootfs_found = 0; + + if (rootfs_found) + return; + + if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && + config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) + split_firmware(master, part); + + arch_split_mtd_part(master, part->mtd.name, part->offset, + part->mtd.size); +} /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to @@ -657,6 +700,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); + mtd_partition_split(master, slave); cur_offset = slave->offset + slave->mtd.size; } --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h @@ -84,5 +84,7 @@ int mtd_add_partition(struct mtd_info *m long long offset, long long length); int mtd_del_partition(struct mtd_info *master, int partno); uint64_t mtd_get_device_size(const struct mtd_info *mtd); +extern void __weak arch_split_mtd_part(struct mtd_info *master, + const char *name, int offset, int size); #endif