aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-01-30 18:21:33 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 17:35:08 -0500
commit34bbe4c16ca06cb762b99a6263832cfdbbe154ad (patch)
treedeba07ce108189a5152d40a0b0de1d2998aa69f3 /drivers/usb/core
parent04e482ffd81437e7f551373d56c72c237e163000 (diff)
USB: fix codingstyle issues in drivers/usb/core/hcd-pci.c
Fixes a number of coding style issues in the hcd-pci.c file. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/hcd-pci.c129
1 files changed, 67 insertions, 62 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 851d5e1625d..84760ddbc33 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * (C) Copyright David Brownell 2000-2002 2 * (C) Copyright David Brownell 2000-2002
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the 5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your 6 * Free Software Foundation; either version 2 of the License, or (at your
@@ -55,7 +55,7 @@
55 * 55 *
56 * Store this function in the HCD's struct pci_driver as probe(). 56 * Store this function in the HCD's struct pci_driver as probe().
57 */ 57 */
58int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) 58int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
59{ 59{
60 struct hc_driver *driver; 60 struct hc_driver *driver;
61 struct usb_hcd *hcd; 61 struct usb_hcd *hcd;
@@ -64,66 +64,71 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
64 if (usb_disabled()) 64 if (usb_disabled())
65 return -ENODEV; 65 return -ENODEV;
66 66
67 if (!id || !(driver = (struct hc_driver *) id->driver_data)) 67 if (!id)
68 return -EINVAL;
69 driver = (struct hc_driver *)id->driver_data;
70 if (!driver)
68 return -EINVAL; 71 return -EINVAL;
69 72
70 if (pci_enable_device (dev) < 0) 73 if (pci_enable_device(dev) < 0)
71 return -ENODEV; 74 return -ENODEV;
72 dev->current_state = PCI_D0; 75 dev->current_state = PCI_D0;
73 dev->dev.power.power_state = PMSG_ON; 76 dev->dev.power.power_state = PMSG_ON;
74 77
75 if (!dev->irq) { 78 if (!dev->irq) {
76 dev_err (&dev->dev, 79 dev_err(&dev->dev,
77 "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", 80 "Found HC with no IRQ. Check BIOS/PCI %s setup!\n",
78 pci_name(dev)); 81 pci_name(dev));
79 retval = -ENODEV; 82 retval = -ENODEV;
80 goto err1; 83 goto err1;
81 } 84 }
82 85
83 hcd = usb_create_hcd (driver, &dev->dev, pci_name(dev)); 86 hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev));
84 if (!hcd) { 87 if (!hcd) {
85 retval = -ENOMEM; 88 retval = -ENOMEM;
86 goto err1; 89 goto err1;
87 } 90 }
88 91
89 if (driver->flags & HCD_MEMORY) { // EHCI, OHCI 92 if (driver->flags & HCD_MEMORY) {
90 hcd->rsrc_start = pci_resource_start (dev, 0); 93 /* EHCI, OHCI */
91 hcd->rsrc_len = pci_resource_len (dev, 0); 94 hcd->rsrc_start = pci_resource_start(dev, 0);
92 if (!request_mem_region (hcd->rsrc_start, hcd->rsrc_len, 95 hcd->rsrc_len = pci_resource_len(dev, 0);
96 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
93 driver->description)) { 97 driver->description)) {
94 dev_dbg (&dev->dev, "controller already in use\n"); 98 dev_dbg(&dev->dev, "controller already in use\n");
95 retval = -EBUSY; 99 retval = -EBUSY;
96 goto err2; 100 goto err2;
97 } 101 }
98 hcd->regs = ioremap_nocache (hcd->rsrc_start, hcd->rsrc_len); 102 hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
99 if (hcd->regs == NULL) { 103 if (hcd->regs == NULL) {
100 dev_dbg (&dev->dev, "error mapping memory\n"); 104 dev_dbg(&dev->dev, "error mapping memory\n");
101 retval = -EFAULT; 105 retval = -EFAULT;
102 goto err3; 106 goto err3;
103 } 107 }
104 108
105 } else { // UHCI 109 } else {
110 /* UHCI */
106 int region; 111 int region;
107 112
108 for (region = 0; region < PCI_ROM_RESOURCE; region++) { 113 for (region = 0; region < PCI_ROM_RESOURCE; region++) {
109 if (!(pci_resource_flags (dev, region) & 114 if (!(pci_resource_flags(dev, region) &
110 IORESOURCE_IO)) 115 IORESOURCE_IO))
111 continue; 116 continue;
112 117
113 hcd->rsrc_start = pci_resource_start (dev, region); 118 hcd->rsrc_start = pci_resource_start(dev, region);
114 hcd->rsrc_len = pci_resource_len (dev, region); 119 hcd->rsrc_len = pci_resource_len(dev, region);
115 if (request_region (hcd->rsrc_start, hcd->rsrc_len, 120 if (request_region(hcd->rsrc_start, hcd->rsrc_len,
116 driver->description)) 121 driver->description))
117 break; 122 break;
118 } 123 }
119 if (region == PCI_ROM_RESOURCE) { 124 if (region == PCI_ROM_RESOURCE) {
120 dev_dbg (&dev->dev, "no i/o regions available\n"); 125 dev_dbg(&dev->dev, "no i/o regions available\n");
121 retval = -EBUSY; 126 retval = -EBUSY;
122 goto err1; 127 goto err1;
123 } 128 }
124 } 129 }
125 130
126 pci_set_master (dev); 131 pci_set_master(dev);
127 132
128 retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); 133 retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
129 if (retval != 0) 134 if (retval != 0)
@@ -132,18 +137,18 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
132 137
133 err4: 138 err4:
134 if (driver->flags & HCD_MEMORY) { 139 if (driver->flags & HCD_MEMORY) {
135 iounmap (hcd->regs); 140 iounmap(hcd->regs);
136 err3: 141 err3:
137 release_mem_region (hcd->rsrc_start, hcd->rsrc_len); 142 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
138 } else 143 } else
139 release_region (hcd->rsrc_start, hcd->rsrc_len); 144 release_region(hcd->rsrc_start, hcd->rsrc_len);
140 err2: 145 err2:
141 usb_put_hcd (hcd); 146 usb_put_hcd(hcd);
142 err1: 147 err1:
143 pci_disable_device (dev); 148 pci_disable_device(dev);
144 dev_err (&dev->dev, "init %s fail, %d\n", pci_name(dev), retval); 149 dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);
145 return retval; 150 return retval;
146} 151}
147EXPORT_SYMBOL_GPL(usb_hcd_pci_probe); 152EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
148 153
149 154
@@ -161,7 +166,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
161 * 166 *
162 * Store this function in the HCD's struct pci_driver as remove(). 167 * Store this function in the HCD's struct pci_driver as remove().
163 */ 168 */
164void usb_hcd_pci_remove (struct pci_dev *dev) 169void usb_hcd_pci_remove(struct pci_dev *dev)
165{ 170{
166 struct usb_hcd *hcd; 171 struct usb_hcd *hcd;
167 172
@@ -169,14 +174,14 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
169 if (!hcd) 174 if (!hcd)
170 return; 175 return;
171 176
172 usb_remove_hcd (hcd); 177 usb_remove_hcd(hcd);
173 if (hcd->driver->flags & HCD_MEMORY) { 178 if (hcd->driver->flags & HCD_MEMORY) {
174 iounmap (hcd->regs); 179 iounmap(hcd->regs);
175 release_mem_region (hcd->rsrc_start, hcd->rsrc_len); 180 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
176 } else { 181 } else {
177 release_region (hcd->rsrc_start, hcd->rsrc_len); 182 release_region(hcd->rsrc_start, hcd->rsrc_len);
178 } 183 }
179 usb_put_hcd (hcd); 184 usb_put_hcd(hcd);
180 pci_disable_device(dev); 185 pci_disable_device(dev);
181} 186}
182EXPORT_SYMBOL_GPL(usb_hcd_pci_remove); 187EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
@@ -191,7 +196,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
191 * 196 *
192 * Store this function in the HCD's struct pci_driver as suspend(). 197 * Store this function in the HCD's struct pci_driver as suspend().
193 */ 198 */
194int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) 199int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
195{ 200{
196 struct usb_hcd *hcd; 201 struct usb_hcd *hcd;
197 int retval = 0; 202 int retval = 0;
@@ -246,8 +251,8 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
246 251
247 /* no DMA or IRQs except when HC is active */ 252 /* no DMA or IRQs except when HC is active */
248 if (dev->current_state == PCI_D0) { 253 if (dev->current_state == PCI_D0) {
249 pci_save_state (dev); 254 pci_save_state(dev);
250 pci_disable_device (dev); 255 pci_disable_device(dev);
251 } 256 }
252 257
253 if (message.event == PM_EVENT_FREEZE || 258 if (message.event == PM_EVENT_FREEZE ||
@@ -257,7 +262,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
257 } 262 }
258 263
259 if (!has_pci_pm) { 264 if (!has_pci_pm) {
260 dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n"); 265 dev_dbg(hcd->self.controller, "--> PCI D0/legacy\n");
261 goto done; 266 goto done;
262 } 267 }
263 268
@@ -266,30 +271,30 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
266 * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset 271 * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset
267 * some device state (e.g. as part of clock reinit). 272 * some device state (e.g. as part of clock reinit).
268 */ 273 */
269 retval = pci_set_power_state (dev, PCI_D3hot); 274 retval = pci_set_power_state(dev, PCI_D3hot);
270 suspend_report_result(pci_set_power_state, retval); 275 suspend_report_result(pci_set_power_state, retval);
271 if (retval == 0) { 276 if (retval == 0) {
272 int wake = device_can_wakeup(&hcd->self.root_hub->dev); 277 int wake = device_can_wakeup(&hcd->self.root_hub->dev);
273 278
274 wake = wake && device_may_wakeup(hcd->self.controller); 279 wake = wake && device_may_wakeup(hcd->self.controller);
275 280
276 dev_dbg (hcd->self.controller, "--> PCI D3%s\n", 281 dev_dbg(hcd->self.controller, "--> PCI D3%s\n",
277 wake ? "/wakeup" : ""); 282 wake ? "/wakeup" : "");
278 283
279 /* Ignore these return values. We rely on pci code to 284 /* Ignore these return values. We rely on pci code to
280 * reject requests the hardware can't implement, rather 285 * reject requests the hardware can't implement, rather
281 * than coding the same thing. 286 * than coding the same thing.
282 */ 287 */
283 (void) pci_enable_wake (dev, PCI_D3hot, wake); 288 (void) pci_enable_wake(dev, PCI_D3hot, wake);
284 (void) pci_enable_wake (dev, PCI_D3cold, wake); 289 (void) pci_enable_wake(dev, PCI_D3cold, wake);
285 } else { 290 } else {
286 dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n", 291 dev_dbg(&dev->dev, "PCI D3 suspend fail, %d\n",
287 retval); 292 retval);
288 (void) usb_hcd_pci_resume (dev); 293 (void) usb_hcd_pci_resume(dev);
289 } 294 }
290 295
291 } else if (hcd->state != HC_STATE_HALT) { 296 } else if (hcd->state != HC_STATE_HALT) {
292 dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n", 297 dev_dbg(hcd->self.controller, "hcd state %d; not suspended\n",
293 hcd->state); 298 hcd->state);
294 WARN_ON(1); 299 WARN_ON(1);
295 retval = -EINVAL; 300 retval = -EINVAL;
@@ -304,7 +309,7 @@ done:
304 if (machine_is(powermac)) { 309 if (machine_is(powermac)) {
305 struct device_node *of_node; 310 struct device_node *of_node;
306 311
307 of_node = pci_device_to_OF_node (dev); 312 of_node = pci_device_to_OF_node(dev);
308 if (of_node) 313 if (of_node)
309 pmac_call_feature(PMAC_FTR_USB_ENABLE, 314 pmac_call_feature(PMAC_FTR_USB_ENABLE,
310 of_node, 0, 0); 315 of_node, 0, 0);
@@ -322,14 +327,14 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
322 * 327 *
323 * Store this function in the HCD's struct pci_driver as resume(). 328 * Store this function in the HCD's struct pci_driver as resume().
324 */ 329 */
325int usb_hcd_pci_resume (struct pci_dev *dev) 330int usb_hcd_pci_resume(struct pci_dev *dev)
326{ 331{
327 struct usb_hcd *hcd; 332 struct usb_hcd *hcd;
328 int retval; 333 int retval;
329 334
330 hcd = pci_get_drvdata(dev); 335 hcd = pci_get_drvdata(dev);
331 if (hcd->state != HC_STATE_SUSPENDED) { 336 if (hcd->state != HC_STATE_SUSPENDED) {
332 dev_dbg (hcd->self.controller, 337 dev_dbg(hcd->self.controller,
333 "can't resume, not suspended!\n"); 338 "can't resume, not suspended!\n");
334 return 0; 339 return 0;
335 } 340 }
@@ -339,9 +344,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
339 if (machine_is(powermac)) { 344 if (machine_is(powermac)) {
340 struct device_node *of_node; 345 struct device_node *of_node;
341 346
342 of_node = pci_device_to_OF_node (dev); 347 of_node = pci_device_to_OF_node(dev);
343 if (of_node) 348 if (of_node)
344 pmac_call_feature (PMAC_FTR_USB_ENABLE, 349 pmac_call_feature(PMAC_FTR_USB_ENABLE,
345 of_node, 0, 1); 350 of_node, 0, 1);
346 } 351 }
347#endif 352#endif
@@ -380,8 +385,8 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
380 } 385 }
381#endif 386#endif
382 /* yes, ignore these results too... */ 387 /* yes, ignore these results too... */
383 (void) pci_enable_wake (dev, dev->current_state, 0); 388 (void) pci_enable_wake(dev, dev->current_state, 0);
384 (void) pci_enable_wake (dev, PCI_D3cold, 0); 389 (void) pci_enable_wake(dev, PCI_D3cold, 0);
385 } else { 390 } else {
386 /* Same basic cases: clean (powered/not), dirty */ 391 /* Same basic cases: clean (powered/not), dirty */
387 dev_dbg(hcd->self.controller, "PCI legacy resume\n"); 392 dev_dbg(hcd->self.controller, "PCI legacy resume\n");
@@ -392,14 +397,14 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
392 * but that won't re-enable bus mastering. Yet pci_disable_device() 397 * but that won't re-enable bus mastering. Yet pci_disable_device()
393 * explicitly disables bus mastering... 398 * explicitly disables bus mastering...
394 */ 399 */
395 retval = pci_enable_device (dev); 400 retval = pci_enable_device(dev);
396 if (retval < 0) { 401 if (retval < 0) {
397 dev_err (hcd->self.controller, 402 dev_err(hcd->self.controller,
398 "can't re-enable after resume, %d!\n", retval); 403 "can't re-enable after resume, %d!\n", retval);
399 return retval; 404 return retval;
400 } 405 }
401 pci_set_master (dev); 406 pci_set_master(dev);
402 pci_restore_state (dev); 407 pci_restore_state(dev);
403 408
404 dev->dev.power.power_state = PMSG_ON; 409 dev->dev.power.power_state = PMSG_ON;
405 410
@@ -408,9 +413,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
408 if (hcd->driver->resume) { 413 if (hcd->driver->resume) {
409 retval = hcd->driver->resume(hcd); 414 retval = hcd->driver->resume(hcd);
410 if (retval) { 415 if (retval) {
411 dev_err (hcd->self.controller, 416 dev_err(hcd->self.controller,
412 "PCI post-resume error %d!\n", retval); 417 "PCI post-resume error %d!\n", retval);
413 usb_hc_died (hcd); 418 usb_hc_died(hcd);
414 } 419 }
415 } 420 }
416 421
@@ -424,7 +429,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_resume);
424 * usb_hcd_pci_shutdown - shutdown host controller 429 * usb_hcd_pci_shutdown - shutdown host controller
425 * @dev: USB Host Controller being shutdown 430 * @dev: USB Host Controller being shutdown
426 */ 431 */
427void usb_hcd_pci_shutdown (struct pci_dev *dev) 432void usb_hcd_pci_shutdown(struct pci_dev *dev)
428{ 433{
429 struct usb_hcd *hcd; 434 struct usb_hcd *hcd;
430 435