aa50f8c48ba3246ef49cde55b92fe59836cd20b8
[openwrt/staging/pepe2k.git] /
1 --- a/drivers/usb/host/adm5120-dbg.c
2 +++ b/drivers/usb/host/adm5120-dbg.c
3 @@ -419,7 +419,7 @@ static struct dentry *admhc_debug_root;
4
5 struct debug_buffer {
6 ssize_t (*fill_func)(struct debug_buffer *); /* fill method */
7 - struct device *dev;
8 + struct admhcd *ahcd;
9 struct mutex mutex; /* protect filling of buffer */
10 size_t count; /* number of characters filled into buffer */
11 char *page;
12 @@ -494,15 +494,11 @@ show_list(struct admhcd *ahcd, char *buf
13
14 static ssize_t fill_async_buffer(struct debug_buffer *buf)
15 {
16 - struct usb_bus *bus;
17 - struct usb_hcd *hcd;
18 struct admhcd *ahcd;
19 size_t temp;
20 unsigned long flags;
21
22 - bus = dev_get_drvdata(buf->dev);
23 - hcd = bus_to_hcd(bus);
24 - ahcd = hcd_to_admhcd(hcd);
25 + ahcd = buf->ahcd;
26
27 spin_lock_irqsave(&ahcd->lock, flags);
28 temp = show_list(ahcd, buf->page, PAGE_SIZE, ahcd->ed_head);
29 @@ -516,8 +512,6 @@ static ssize_t fill_async_buffer(struct
30
31 static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
32 {
33 - struct usb_bus *bus;
34 - struct usb_hcd *hcd;
35 struct admhcd *ahcd;
36 struct ed **seen, *ed;
37 unsigned long flags;
38 @@ -529,9 +523,7 @@ static ssize_t fill_periodic_buffer(stru
39 return 0;
40 seen_count = 0;
41
42 - bus = dev_get_drvdata(buf->dev);
43 - hcd = bus_to_hcd(bus);
44 - ahcd = hcd_to_admhcd(hcd);
45 + ahcd = buf->ahcd;
46 next = buf->page;
47 size = PAGE_SIZE;
48
49 @@ -613,7 +605,6 @@ static ssize_t fill_periodic_buffer(stru
50
51 static ssize_t fill_registers_buffer(struct debug_buffer *buf)
52 {
53 - struct usb_bus *bus;
54 struct usb_hcd *hcd;
55 struct admhcd *ahcd;
56 struct admhcd_regs __iomem *regs;
57 @@ -622,9 +613,8 @@ static ssize_t fill_registers_buffer(str
58 char *next;
59 u32 rdata;
60
61 - bus = dev_get_drvdata(buf->dev);
62 - hcd = bus_to_hcd(bus);
63 - ahcd = hcd_to_admhcd(hcd);
64 + ahcd = buf->ahcd;
65 + hcd = admhcd_to_hcd(ahcd);
66 regs = ahcd->regs;
67 next = buf->page;
68 size = PAGE_SIZE;
69 @@ -689,7 +679,7 @@ done:
70 }
71
72
73 -static struct debug_buffer *alloc_buffer(struct device *dev,
74 +static struct debug_buffer *alloc_buffer(struct admhcd *ahcd,
75 ssize_t (*fill_func)(struct debug_buffer *))
76 {
77 struct debug_buffer *buf;
78 @@ -697,7 +687,7 @@ static struct debug_buffer *alloc_buffer
79 buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
80
81 if (buf) {
82 - buf->dev = dev;
83 + buf->ahcd = ahcd;
84 buf->fill_func = fill_func;
85 mutex_init(&buf->mutex);
86 }
87 @@ -790,26 +780,25 @@ static int debug_registers_open(struct i
88 static inline void create_debug_files(struct admhcd *ahcd)
89 {
90 struct usb_bus *bus = &admhcd_to_hcd(ahcd)->self;
91 - struct device *dev = bus->dev;
92
93 ahcd->debug_dir = debugfs_create_dir(bus->bus_name, admhc_debug_root);
94 if (!ahcd->debug_dir)
95 goto dir_error;
96
97 ahcd->debug_async = debugfs_create_file("async", S_IRUGO,
98 - ahcd->debug_dir, dev,
99 + ahcd->debug_dir, ahcd,
100 &debug_async_fops);
101 if (!ahcd->debug_async)
102 goto async_error;
103
104 ahcd->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
105 - ahcd->debug_dir, dev,
106 + ahcd->debug_dir, ahcd,
107 &debug_periodic_fops);
108 if (!ahcd->debug_periodic)
109 goto periodic_error;
110
111 ahcd->debug_registers = debugfs_create_file("registers", S_IRUGO,
112 - ahcd->debug_dir, dev,
113 + ahcd->debug_dir, ahcd,
114 &debug_registers_fops);
115 if (!ahcd->debug_registers)
116 goto registers_error;