aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/support.c96
1 files changed, 49 insertions, 47 deletions
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c
index bbf78ef4ba02..b42df1620718 100644
--- a/drivers/pnp/support.c
+++ b/drivers/pnp/support.c
@@ -77,7 +77,7 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
77{ 77{
78#ifdef DEBUG 78#ifdef DEBUG
79 char buf[128]; 79 char buf[128];
80 int len = 0; 80 int len;
81 struct pnp_resource *pnp_res; 81 struct pnp_resource *pnp_res;
82 struct resource *res; 82 struct resource *res;
83 83
@@ -89,9 +89,10 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
89 dev_dbg(&dev->dev, "%s: current resources:\n", desc); 89 dev_dbg(&dev->dev, "%s: current resources:\n", desc);
90 list_for_each_entry(pnp_res, &dev->resources, list) { 90 list_for_each_entry(pnp_res, &dev->resources, list) {
91 res = &pnp_res->res; 91 res = &pnp_res->res;
92 len = 0;
92 93
93 len += snprintf(buf + len, sizeof(buf) - len, " %-3s ", 94 len += scnprintf(buf + len, sizeof(buf) - len, " %-3s ",
94 pnp_resource_type_name(res)); 95 pnp_resource_type_name(res));
95 96
96 if (res->flags & IORESOURCE_DISABLED) { 97 if (res->flags & IORESOURCE_DISABLED) {
97 dev_dbg(&dev->dev, "%sdisabled\n", buf); 98 dev_dbg(&dev->dev, "%sdisabled\n", buf);
@@ -101,18 +102,18 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
101 switch (pnp_resource_type(res)) { 102 switch (pnp_resource_type(res)) {
102 case IORESOURCE_IO: 103 case IORESOURCE_IO:
103 case IORESOURCE_MEM: 104 case IORESOURCE_MEM:
104 len += snprintf(buf + len, sizeof(buf) - len, 105 len += scnprintf(buf + len, sizeof(buf) - len,
105 "%#llx-%#llx flags %#lx", 106 "%#llx-%#llx flags %#lx",
106 (unsigned long long) res->start, 107 (unsigned long long) res->start,
107 (unsigned long long) res->end, 108 (unsigned long long) res->end,
108 res->flags); 109 res->flags);
109 break; 110 break;
110 case IORESOURCE_IRQ: 111 case IORESOURCE_IRQ:
111 case IORESOURCE_DMA: 112 case IORESOURCE_DMA:
112 len += snprintf(buf + len, sizeof(buf) - len, 113 len += scnprintf(buf + len, sizeof(buf) - len,
113 "%lld flags %#lx", 114 "%lld flags %#lx",
114 (unsigned long long) res->start, 115 (unsigned long long) res->start,
115 res->flags); 116 res->flags);
116 break; 117 break;
117 } 118 }
118 dev_dbg(&dev->dev, "%s\n", buf); 119 dev_dbg(&dev->dev, "%s\n", buf);
@@ -144,66 +145,67 @@ void dbg_pnp_show_option(struct pnp_dev *dev, struct pnp_option *option)
144 struct pnp_dma *dma; 145 struct pnp_dma *dma;
145 146
146 if (pnp_option_is_dependent(option)) 147 if (pnp_option_is_dependent(option))
147 len += snprintf(buf + len, sizeof(buf) - len, 148 len += scnprintf(buf + len, sizeof(buf) - len,
148 " dependent set %d (%s) ", 149 " dependent set %d (%s) ",
149 pnp_option_set(option), 150 pnp_option_set(option),
150 pnp_option_priority_name(option)); 151 pnp_option_priority_name(option));
151 else 152 else
152 len += snprintf(buf + len, sizeof(buf) - len, " independent "); 153 len += scnprintf(buf + len, sizeof(buf) - len,
154 " independent ");
153 155
154 switch (option->type) { 156 switch (option->type) {
155 case IORESOURCE_IO: 157 case IORESOURCE_IO:
156 port = &option->u.port; 158 port = &option->u.port;
157 len += snprintf(buf + len, sizeof(buf) - len, "io min %#llx " 159 len += scnprintf(buf + len, sizeof(buf) - len, "io min %#llx "
158 "max %#llx align %lld size %lld flags %#x", 160 "max %#llx align %lld size %lld flags %#x",
159 (unsigned long long) port->min, 161 (unsigned long long) port->min,
160 (unsigned long long) port->max, 162 (unsigned long long) port->max,
161 (unsigned long long) port->align, 163 (unsigned long long) port->align,
162 (unsigned long long) port->size, port->flags); 164 (unsigned long long) port->size, port->flags);
163 break; 165 break;
164 case IORESOURCE_MEM: 166 case IORESOURCE_MEM:
165 mem = &option->u.mem; 167 mem = &option->u.mem;
166 len += snprintf(buf + len, sizeof(buf) - len, "mem min %#llx " 168 len += scnprintf(buf + len, sizeof(buf) - len, "mem min %#llx "
167 "max %#llx align %lld size %lld flags %#x", 169 "max %#llx align %lld size %lld flags %#x",
168 (unsigned long long) mem->min, 170 (unsigned long long) mem->min,
169 (unsigned long long) mem->max, 171 (unsigned long long) mem->max,
170 (unsigned long long) mem->align, 172 (unsigned long long) mem->align,
171 (unsigned long long) mem->size, mem->flags); 173 (unsigned long long) mem->size, mem->flags);
172 break; 174 break;
173 case IORESOURCE_IRQ: 175 case IORESOURCE_IRQ:
174 irq = &option->u.irq; 176 irq = &option->u.irq;
175 len += snprintf(buf + len, sizeof(buf) - len, "irq"); 177 len += scnprintf(buf + len, sizeof(buf) - len, "irq");
176 if (bitmap_empty(irq->map.bits, PNP_IRQ_NR)) 178 if (bitmap_empty(irq->map.bits, PNP_IRQ_NR))
177 len += snprintf(buf + len, sizeof(buf) - len, 179 len += scnprintf(buf + len, sizeof(buf) - len,
178 " <none>"); 180 " <none>");
179 else { 181 else {
180 for (i = 0; i < PNP_IRQ_NR; i++) 182 for (i = 0; i < PNP_IRQ_NR; i++)
181 if (test_bit(i, irq->map.bits)) 183 if (test_bit(i, irq->map.bits))
182 len += snprintf(buf + len, 184 len += scnprintf(buf + len,
183 sizeof(buf) - len, 185 sizeof(buf) - len,
184 " %d", i); 186 " %d", i);
185 } 187 }
186 len += snprintf(buf + len, sizeof(buf) - len, " flags %#x", 188 len += scnprintf(buf + len, sizeof(buf) - len, " flags %#x",
187 irq->flags); 189 irq->flags);
188 if (irq->flags & IORESOURCE_IRQ_OPTIONAL) 190 if (irq->flags & IORESOURCE_IRQ_OPTIONAL)
189 len += snprintf(buf + len, sizeof(buf) - len, 191 len += scnprintf(buf + len, sizeof(buf) - len,
190 " (optional)"); 192 " (optional)");
191 break; 193 break;
192 case IORESOURCE_DMA: 194 case IORESOURCE_DMA:
193 dma = &option->u.dma; 195 dma = &option->u.dma;
194 len += snprintf(buf + len, sizeof(buf) - len, "dma"); 196 len += scnprintf(buf + len, sizeof(buf) - len, "dma");
195 if (!dma->map) 197 if (!dma->map)
196 len += snprintf(buf + len, sizeof(buf) - len, 198 len += scnprintf(buf + len, sizeof(buf) - len,
197 " <none>"); 199 " <none>");
198 else { 200 else {
199 for (i = 0; i < 8; i++) 201 for (i = 0; i < 8; i++)
200 if (dma->map & (1 << i)) 202 if (dma->map & (1 << i))
201 len += snprintf(buf + len, 203 len += scnprintf(buf + len,
202 sizeof(buf) - len, 204 sizeof(buf) - len,
203 " %d", i); 205 " %d", i);
204 } 206 }
205 len += snprintf(buf + len, sizeof(buf) - len, " (bitmask %#x) " 207 len += scnprintf(buf + len, sizeof(buf) - len, " (bitmask %#x) "
206 "flags %#x", dma->map, dma->flags); 208 "flags %#x", dma->map, dma->flags);
207 break; 209 break;
208 } 210 }
209 dev_dbg(&dev->dev, "%s\n", buf); 211 dev_dbg(&dev->dev, "%s\n", buf);