Commit 34bbe4c1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 04e482ff
/* /*
* (C) Copyright David Brownell 2000-2002 * (C) Copyright David Brownell 2000-2002
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your * Free Software Foundation; either version 2 of the License, or (at your
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
* *
* Store this function in the HCD's struct pci_driver as probe(). * Store this function in the HCD's struct pci_driver as probe().
*/ */
int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
{ {
struct hc_driver *driver; struct hc_driver *driver;
struct usb_hcd *hcd; struct usb_hcd *hcd;
...@@ -64,66 +64,71 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -64,66 +64,71 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
if (usb_disabled()) if (usb_disabled())
return -ENODEV; return -ENODEV;
if (!id || !(driver = (struct hc_driver *) id->driver_data)) if (!id)
return -EINVAL;
driver = (struct hc_driver *)id->driver_data;
if (!driver)
return -EINVAL; return -EINVAL;
if (pci_enable_device (dev) < 0) if (pci_enable_device(dev) < 0)
return -ENODEV; return -ENODEV;
dev->current_state = PCI_D0; dev->current_state = PCI_D0;
dev->dev.power.power_state = PMSG_ON; dev->dev.power.power_state = PMSG_ON;
if (!dev->irq) { if (!dev->irq) {
dev_err (&dev->dev, dev_err(&dev->dev,
"Found HC with no IRQ. Check BIOS/PCI %s setup!\n", "Found HC with no IRQ. Check BIOS/PCI %s setup!\n",
pci_name(dev)); pci_name(dev));
retval = -ENODEV; retval = -ENODEV;
goto err1; goto err1;
} }
hcd = usb_create_hcd (driver, &dev->dev, pci_name(dev)); hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev));
if (!hcd) { if (!hcd) {
retval = -ENOMEM; retval = -ENOMEM;
goto err1; goto err1;
} }
if (driver->flags & HCD_MEMORY) { // EHCI, OHCI if (driver->flags & HCD_MEMORY) {
hcd->rsrc_start = pci_resource_start (dev, 0); /* EHCI, OHCI */
hcd->rsrc_len = pci_resource_len (dev, 0); hcd->rsrc_start = pci_resource_start(dev, 0);
if (!request_mem_region (hcd->rsrc_start, hcd->rsrc_len, hcd->rsrc_len = pci_resource_len(dev, 0);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
driver->description)) { driver->description)) {
dev_dbg (&dev->dev, "controller already in use\n"); dev_dbg(&dev->dev, "controller already in use\n");
retval = -EBUSY; retval = -EBUSY;
goto err2; goto err2;
} }
hcd->regs = ioremap_nocache (hcd->rsrc_start, hcd->rsrc_len); hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
if (hcd->regs == NULL) { if (hcd->regs == NULL) {
dev_dbg (&dev->dev, "error mapping memory\n"); dev_dbg(&dev->dev, "error mapping memory\n");
retval = -EFAULT; retval = -EFAULT;
goto err3; goto err3;
} }
} else { // UHCI } else {
/* UHCI */
int region; int region;
for (region = 0; region < PCI_ROM_RESOURCE; region++) { for (region = 0; region < PCI_ROM_RESOURCE; region++) {
if (!(pci_resource_flags (dev, region) & if (!(pci_resource_flags(dev, region) &
IORESOURCE_IO)) IORESOURCE_IO))
continue; continue;
hcd->rsrc_start = pci_resource_start (dev, region); hcd->rsrc_start = pci_resource_start(dev, region);
hcd->rsrc_len = pci_resource_len (dev, region); hcd->rsrc_len = pci_resource_len(dev, region);
if (request_region (hcd->rsrc_start, hcd->rsrc_len, if (request_region(hcd->rsrc_start, hcd->rsrc_len,
driver->description)) driver->description))
break; break;
} }
if (region == PCI_ROM_RESOURCE) { if (region == PCI_ROM_RESOURCE) {
dev_dbg (&dev->dev, "no i/o regions available\n"); dev_dbg(&dev->dev, "no i/o regions available\n");
retval = -EBUSY; retval = -EBUSY;
goto err1; goto err1;
} }
} }
pci_set_master (dev); pci_set_master(dev);
retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
if (retval != 0) if (retval != 0)
...@@ -132,18 +137,18 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -132,18 +137,18 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
err4: err4:
if (driver->flags & HCD_MEMORY) { if (driver->flags & HCD_MEMORY) {
iounmap (hcd->regs); iounmap(hcd->regs);
err3: err3:
release_mem_region (hcd->rsrc_start, hcd->rsrc_len); release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
} else } else
release_region (hcd->rsrc_start, hcd->rsrc_len); release_region(hcd->rsrc_start, hcd->rsrc_len);
err2: err2:
usb_put_hcd (hcd); usb_put_hcd(hcd);
err1: err1:
pci_disable_device (dev); pci_disable_device(dev);
dev_err (&dev->dev, "init %s fail, %d\n", pci_name(dev), retval); dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);
return retval; return retval;
} }
EXPORT_SYMBOL_GPL(usb_hcd_pci_probe); EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
...@@ -161,7 +166,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_probe); ...@@ -161,7 +166,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
* *
* Store this function in the HCD's struct pci_driver as remove(). * Store this function in the HCD's struct pci_driver as remove().
*/ */
void usb_hcd_pci_remove (struct pci_dev *dev) void usb_hcd_pci_remove(struct pci_dev *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
...@@ -169,14 +174,14 @@ void usb_hcd_pci_remove (struct pci_dev *dev) ...@@ -169,14 +174,14 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
if (!hcd) if (!hcd)
return; return;
usb_remove_hcd (hcd); usb_remove_hcd(hcd);
if (hcd->driver->flags & HCD_MEMORY) { if (hcd->driver->flags & HCD_MEMORY) {
iounmap (hcd->regs); iounmap(hcd->regs);
release_mem_region (hcd->rsrc_start, hcd->rsrc_len); release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
} else { } else {
release_region (hcd->rsrc_start, hcd->rsrc_len); release_region(hcd->rsrc_start, hcd->rsrc_len);
} }
usb_put_hcd (hcd); usb_put_hcd(hcd);
pci_disable_device(dev); pci_disable_device(dev);
} }
EXPORT_SYMBOL_GPL(usb_hcd_pci_remove); EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
...@@ -191,7 +196,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_remove); ...@@ -191,7 +196,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
* *
* Store this function in the HCD's struct pci_driver as suspend(). * Store this function in the HCD's struct pci_driver as suspend().
*/ */
int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
int retval = 0; int retval = 0;
...@@ -246,8 +251,8 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) ...@@ -246,8 +251,8 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
/* no DMA or IRQs except when HC is active */ /* no DMA or IRQs except when HC is active */
if (dev->current_state == PCI_D0) { if (dev->current_state == PCI_D0) {
pci_save_state (dev); pci_save_state(dev);
pci_disable_device (dev); pci_disable_device(dev);
} }
if (message.event == PM_EVENT_FREEZE || if (message.event == PM_EVENT_FREEZE ||
...@@ -257,7 +262,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) ...@@ -257,7 +262,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
} }
if (!has_pci_pm) { if (!has_pci_pm) {
dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n"); dev_dbg(hcd->self.controller, "--> PCI D0/legacy\n");
goto done; goto done;
} }
...@@ -266,30 +271,30 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) ...@@ -266,30 +271,30 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
* PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset
* some device state (e.g. as part of clock reinit). * some device state (e.g. as part of clock reinit).
*/ */
retval = pci_set_power_state (dev, PCI_D3hot); retval = pci_set_power_state(dev, PCI_D3hot);
suspend_report_result(pci_set_power_state, retval); suspend_report_result(pci_set_power_state, retval);
if (retval == 0) { if (retval == 0) {
int wake = device_can_wakeup(&hcd->self.root_hub->dev); int wake = device_can_wakeup(&hcd->self.root_hub->dev);
wake = wake && device_may_wakeup(hcd->self.controller); wake = wake && device_may_wakeup(hcd->self.controller);
dev_dbg (hcd->self.controller, "--> PCI D3%s\n", dev_dbg(hcd->self.controller, "--> PCI D3%s\n",
wake ? "/wakeup" : ""); wake ? "/wakeup" : "");
/* Ignore these return values. We rely on pci code to /* Ignore these return values. We rely on pci code to
* reject requests the hardware can't implement, rather * reject requests the hardware can't implement, rather
* than coding the same thing. * than coding the same thing.
*/ */
(void) pci_enable_wake (dev, PCI_D3hot, wake); (void) pci_enable_wake(dev, PCI_D3hot, wake);
(void) pci_enable_wake (dev, PCI_D3cold, wake); (void) pci_enable_wake(dev, PCI_D3cold, wake);
} else { } else {
dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n", dev_dbg(&dev->dev, "PCI D3 suspend fail, %d\n",
retval); retval);
(void) usb_hcd_pci_resume (dev); (void) usb_hcd_pci_resume(dev);
} }
} else if (hcd->state != HC_STATE_HALT) { } else if (hcd->state != HC_STATE_HALT) {
dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n", dev_dbg(hcd->self.controller, "hcd state %d; not suspended\n",
hcd->state); hcd->state);
WARN_ON(1); WARN_ON(1);
retval = -EINVAL; retval = -EINVAL;
...@@ -304,7 +309,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) ...@@ -304,7 +309,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
if (machine_is(powermac)) { if (machine_is(powermac)) {
struct device_node *of_node; struct device_node *of_node;
of_node = pci_device_to_OF_node (dev); of_node = pci_device_to_OF_node(dev);
if (of_node) if (of_node)
pmac_call_feature(PMAC_FTR_USB_ENABLE, pmac_call_feature(PMAC_FTR_USB_ENABLE,
of_node, 0, 0); of_node, 0, 0);
...@@ -322,14 +327,14 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); ...@@ -322,14 +327,14 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
* *
* Store this function in the HCD's struct pci_driver as resume(). * Store this function in the HCD's struct pci_driver as resume().
*/ */
int usb_hcd_pci_resume (struct pci_dev *dev) int usb_hcd_pci_resume(struct pci_dev *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
int retval; int retval;
hcd = pci_get_drvdata(dev); hcd = pci_get_drvdata(dev);
if (hcd->state != HC_STATE_SUSPENDED) { if (hcd->state != HC_STATE_SUSPENDED) {
dev_dbg (hcd->self.controller, dev_dbg(hcd->self.controller,
"can't resume, not suspended!\n"); "can't resume, not suspended!\n");
return 0; return 0;
} }
...@@ -339,9 +344,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev) ...@@ -339,9 +344,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
if (machine_is(powermac)) { if (machine_is(powermac)) {
struct device_node *of_node; struct device_node *of_node;
of_node = pci_device_to_OF_node (dev); of_node = pci_device_to_OF_node(dev);
if (of_node) if (of_node)
pmac_call_feature (PMAC_FTR_USB_ENABLE, pmac_call_feature(PMAC_FTR_USB_ENABLE,
of_node, 0, 1); of_node, 0, 1);
} }
#endif #endif
...@@ -380,8 +385,8 @@ int usb_hcd_pci_resume (struct pci_dev *dev) ...@@ -380,8 +385,8 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
} }
#endif #endif
/* yes, ignore these results too... */ /* yes, ignore these results too... */
(void) pci_enable_wake (dev, dev->current_state, 0); (void) pci_enable_wake(dev, dev->current_state, 0);
(void) pci_enable_wake (dev, PCI_D3cold, 0); (void) pci_enable_wake(dev, PCI_D3cold, 0);
} else { } else {
/* Same basic cases: clean (powered/not), dirty */ /* Same basic cases: clean (powered/not), dirty */
dev_dbg(hcd->self.controller, "PCI legacy resume\n"); dev_dbg(hcd->self.controller, "PCI legacy resume\n");
...@@ -392,14 +397,14 @@ int usb_hcd_pci_resume (struct pci_dev *dev) ...@@ -392,14 +397,14 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
* but that won't re-enable bus mastering. Yet pci_disable_device() * but that won't re-enable bus mastering. Yet pci_disable_device()
* explicitly disables bus mastering... * explicitly disables bus mastering...
*/ */
retval = pci_enable_device (dev); retval = pci_enable_device(dev);
if (retval < 0) { if (retval < 0) {
dev_err (hcd->self.controller, dev_err(hcd->self.controller,
"can't re-enable after resume, %d!\n", retval); "can't re-enable after resume, %d!\n", retval);
return retval; return retval;
} }
pci_set_master (dev); pci_set_master(dev);
pci_restore_state (dev); pci_restore_state(dev);
dev->dev.power.power_state = PMSG_ON; dev->dev.power.power_state = PMSG_ON;
...@@ -408,9 +413,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev) ...@@ -408,9 +413,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
if (hcd->driver->resume) { if (hcd->driver->resume) {
retval = hcd->driver->resume(hcd); retval = hcd->driver->resume(hcd);
if (retval) { if (retval) {
dev_err (hcd->self.controller, dev_err(hcd->self.controller,
"PCI post-resume error %d!\n", retval); "PCI post-resume error %d!\n", retval);
usb_hc_died (hcd); usb_hc_died(hcd);
} }
} }
...@@ -424,7 +429,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_resume); ...@@ -424,7 +429,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_resume);
* usb_hcd_pci_shutdown - shutdown host controller * usb_hcd_pci_shutdown - shutdown host controller
* @dev: USB Host Controller being shutdown * @dev: USB Host Controller being shutdown
*/ */
void usb_hcd_pci_shutdown (struct pci_dev *dev) void usb_hcd_pci_shutdown(struct pci_dev *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment