diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2009-11-25 07:05:35 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-12-04 18:56:10 -0500 |
commit | 40717c39b1e6c064f48a263a27e58642221e8661 (patch) | |
tree | 62c92897f5370900b5cfd6769bfa193ae1a61320 /drivers/pci | |
parent | fbb5de70bbe13ecbebb04226dd6d52b1258dc247 (diff) |
PCI: portdrv: minor cleanup for pcie_port_device_register
Minor cleanups for pcie_port_device_register().
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 82a27f93d38b..758e3d339287 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -297,13 +297,15 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq) | |||
297 | int pcie_port_device_register(struct pci_dev *dev) | 297 | int pcie_port_device_register(struct pci_dev *dev) |
298 | { | 298 | { |
299 | struct pcie_port_data *port_data; | 299 | struct pcie_port_data *port_data; |
300 | int status, capabilities, i, nr_serv; | 300 | int status, capabilities, i, nr_service; |
301 | int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; | 301 | int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; |
302 | 302 | ||
303 | /* Get and check PCI Express port services */ | ||
303 | capabilities = get_port_device_capability(dev); | 304 | capabilities = get_port_device_capability(dev); |
304 | if (!capabilities) | 305 | if (!capabilities) |
305 | return -ENODEV; | 306 | return -ENODEV; |
306 | 307 | ||
308 | /* Allocate driver data for port device */ | ||
307 | port_data = kzalloc(sizeof(*port_data), GFP_KERNEL); | 309 | port_data = kzalloc(sizeof(*port_data), GFP_KERNEL); |
308 | if (!port_data) | 310 | if (!port_data) |
309 | return -ENOMEM; | 311 | return -ENOMEM; |
@@ -315,7 +317,6 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
315 | if (status) | 317 | if (status) |
316 | goto error_kfree; | 318 | goto error_kfree; |
317 | pci_set_master(dev); | 319 | pci_set_master(dev); |
318 | |||
319 | /* | 320 | /* |
320 | * Initialize service irqs. Don't use service devices that | 321 | * Initialize service irqs. Don't use service devices that |
321 | * require interrupts if there is no way to generate them. | 322 | * require interrupts if there is no way to generate them. |
@@ -328,20 +329,18 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
328 | } | 329 | } |
329 | 330 | ||
330 | /* Allocate child services if any */ | 331 | /* Allocate child services if any */ |
331 | for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { | 332 | status = -ENODEV; |
333 | nr_service = 0; | ||
334 | for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { | ||
332 | int service = 1 << i; | 335 | int service = 1 << i; |
333 | |||
334 | if (!(capabilities & service)) | 336 | if (!(capabilities & service)) |
335 | continue; | 337 | continue; |
336 | 338 | if (!pcie_device_init(dev, service, irqs[i])) | |
337 | status = pcie_device_init(dev, service, irqs[i]); | 339 | nr_service++; |
338 | if (!status) | ||
339 | nr_serv++; | ||
340 | } | 340 | } |
341 | if (!nr_serv) { | 341 | if (!nr_service) |
342 | status = -ENODEV; | ||
343 | goto error_cleanup_irqs; | 342 | goto error_cleanup_irqs; |
344 | } | 343 | |
345 | return 0; | 344 | return 0; |
346 | 345 | ||
347 | error_cleanup_irqs: | 346 | error_cleanup_irqs: |