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>
This commit is contained in:
Greg Kroah-Hartman 2008-01-30 15:21:33 -08:00
parent 04e482ffd8
commit 34bbe4c16c

View File

@ -1,6 +1,6 @@
/*
* (C) Copyright David Brownell 2000-2002
*
*
* 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
* Free Software Foundation; either version 2 of the License, or (at your
@ -55,7 +55,7 @@
*
* 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 usb_hcd *hcd;
@ -64,66 +64,71 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
if (usb_disabled())
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;
if (pci_enable_device (dev) < 0)
if (pci_enable_device(dev) < 0)
return -ENODEV;
dev->current_state = PCI_D0;
dev->dev.power.power_state = PMSG_ON;
if (!dev->irq) {
dev_err (&dev->dev,
if (!dev->irq) {
dev_err(&dev->dev,
"Found HC with no IRQ. Check BIOS/PCI %s setup!\n",
pci_name(dev));
retval = -ENODEV;
retval = -ENODEV;
goto err1;
}
}
hcd = usb_create_hcd (driver, &dev->dev, pci_name(dev));
hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev));
if (!hcd) {
retval = -ENOMEM;
goto err1;
}
if (driver->flags & HCD_MEMORY) { // EHCI, OHCI
hcd->rsrc_start = pci_resource_start (dev, 0);
hcd->rsrc_len = pci_resource_len (dev, 0);
if (!request_mem_region (hcd->rsrc_start, hcd->rsrc_len,
if (driver->flags & HCD_MEMORY) {
/* EHCI, OHCI */
hcd->rsrc_start = pci_resource_start(dev, 0);
hcd->rsrc_len = pci_resource_len(dev, 0);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
driver->description)) {
dev_dbg (&dev->dev, "controller already in use\n");
dev_dbg(&dev->dev, "controller already in use\n");
retval = -EBUSY;
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) {
dev_dbg (&dev->dev, "error mapping memory\n");
dev_dbg(&dev->dev, "error mapping memory\n");
retval = -EFAULT;
goto err3;
}
} else { // UHCI
} else {
/* UHCI */
int region;
for (region = 0; region < PCI_ROM_RESOURCE; region++) {
if (!(pci_resource_flags (dev, region) &
if (!(pci_resource_flags(dev, region) &
IORESOURCE_IO))
continue;
hcd->rsrc_start = pci_resource_start (dev, region);
hcd->rsrc_len = pci_resource_len (dev, region);
if (request_region (hcd->rsrc_start, hcd->rsrc_len,
hcd->rsrc_start = pci_resource_start(dev, region);
hcd->rsrc_len = pci_resource_len(dev, region);
if (request_region(hcd->rsrc_start, hcd->rsrc_len,
driver->description))
break;
}
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;
goto err1;
}
}
pci_set_master (dev);
pci_set_master(dev);
retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
if (retval != 0)
@ -132,18 +137,18 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
err4:
if (driver->flags & HCD_MEMORY) {
iounmap (hcd->regs);
iounmap(hcd->regs);
err3:
release_mem_region (hcd->rsrc_start, hcd->rsrc_len);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
} else
release_region (hcd->rsrc_start, hcd->rsrc_len);
release_region(hcd->rsrc_start, hcd->rsrc_len);
err2:
usb_put_hcd (hcd);
usb_put_hcd(hcd);
err1:
pci_disable_device (dev);
dev_err (&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);
pci_disable_device(dev);
dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);
return retval;
}
}
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().
*/
void usb_hcd_pci_remove (struct pci_dev *dev)
void usb_hcd_pci_remove(struct pci_dev *dev)
{
struct usb_hcd *hcd;
@ -169,14 +174,14 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
if (!hcd)
return;
usb_remove_hcd (hcd);
usb_remove_hcd(hcd);
if (hcd->driver->flags & HCD_MEMORY) {
iounmap (hcd->regs);
release_mem_region (hcd->rsrc_start, hcd->rsrc_len);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
} 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);
}
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().
*/
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;
int retval = 0;
@ -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 */
if (dev->current_state == PCI_D0) {
pci_save_state (dev);
pci_disable_device (dev);
pci_save_state(dev);
pci_disable_device(dev);
}
if (message.event == PM_EVENT_FREEZE ||
@ -257,7 +262,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
}
if (!has_pci_pm) {
dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n");
dev_dbg(hcd->self.controller, "--> PCI D0/legacy\n");
goto done;
}
@ -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
* 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);
if (retval == 0) {
int wake = device_can_wakeup(&hcd->self.root_hub->dev);
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" : "");
/* Ignore these return values. We rely on pci code to
* reject requests the hardware can't implement, rather
* than coding the same thing.
*/
(void) pci_enable_wake (dev, PCI_D3hot, wake);
(void) pci_enable_wake (dev, PCI_D3cold, wake);
(void) pci_enable_wake(dev, PCI_D3hot, wake);
(void) pci_enable_wake(dev, PCI_D3cold, wake);
} else {
dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",
dev_dbg(&dev->dev, "PCI D3 suspend fail, %d\n",
retval);
(void) usb_hcd_pci_resume (dev);
(void) usb_hcd_pci_resume(dev);
}
} 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);
WARN_ON(1);
retval = -EINVAL;
@ -304,7 +309,7 @@ done:
if (machine_is(powermac)) {
struct device_node *of_node;
of_node = pci_device_to_OF_node (dev);
of_node = pci_device_to_OF_node(dev);
if (of_node)
pmac_call_feature(PMAC_FTR_USB_ENABLE,
of_node, 0, 0);
@ -322,14 +327,14 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
*
* 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;
int retval;
hcd = pci_get_drvdata(dev);
if (hcd->state != HC_STATE_SUSPENDED) {
dev_dbg (hcd->self.controller,
dev_dbg(hcd->self.controller,
"can't resume, not suspended!\n");
return 0;
}
@ -339,9 +344,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
if (machine_is(powermac)) {
struct device_node *of_node;
of_node = pci_device_to_OF_node (dev);
of_node = pci_device_to_OF_node(dev);
if (of_node)
pmac_call_feature (PMAC_FTR_USB_ENABLE,
pmac_call_feature(PMAC_FTR_USB_ENABLE,
of_node, 0, 1);
}
#endif
@ -380,8 +385,8 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
}
#endif
/* yes, ignore these results too... */
(void) pci_enable_wake (dev, dev->current_state, 0);
(void) pci_enable_wake (dev, PCI_D3cold, 0);
(void) pci_enable_wake(dev, dev->current_state, 0);
(void) pci_enable_wake(dev, PCI_D3cold, 0);
} else {
/* Same basic cases: clean (powered/not), dirty */
dev_dbg(hcd->self.controller, "PCI legacy resume\n");
@ -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()
* explicitly disables bus mastering...
*/
retval = pci_enable_device (dev);
retval = pci_enable_device(dev);
if (retval < 0) {
dev_err (hcd->self.controller,
dev_err(hcd->self.controller,
"can't re-enable after resume, %d!\n", retval);
return retval;
}
pci_set_master (dev);
pci_restore_state (dev);
pci_set_master(dev);
pci_restore_state(dev);
dev->dev.power.power_state = PMSG_ON;
@ -408,9 +413,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
if (hcd->driver->resume) {
retval = hcd->driver->resume(hcd);
if (retval) {
dev_err (hcd->self.controller,
dev_err(hcd->self.controller,
"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);
* usb_hcd_pci_shutdown - shutdown host controller
* @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;