diff options
author | Frans Klaver <fransklaver@gmail.com> | 2014-10-22 15:12:36 -0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-11-19 12:07:07 -0500 |
commit | 248d490363906806e0a2ac8417a8bb3f3f8a012c (patch) | |
tree | a7f030c7adbdfc6bf95bb8b6a5da86f42ffa63a8 | |
parent | 98280374ff1750acfa582a4575b94f053a29f749 (diff) |
eeepc-laptop: flatten control flow
In eeepc_rfkill_hotplug there's an if statement with a big tail that
ends right before the out_unlock label. We might as well invert the
condition and jump to out_unlock in that case, pretty much like the rest
of the code does. This removes an indentation level for a large chunk of
code and also stops suggesting there might be an else clause.
Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index db79902c4a8e..bb098e547121 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -580,59 +580,60 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) | |||
580 | mutex_lock(&eeepc->hotplug_lock); | 580 | mutex_lock(&eeepc->hotplug_lock); |
581 | pci_lock_rescan_remove(); | 581 | pci_lock_rescan_remove(); |
582 | 582 | ||
583 | if (eeepc->hotplug_slot) { | 583 | if (!eeepc->hotplug_slot) |
584 | port = acpi_get_pci_dev(handle); | 584 | goto out_unlock; |
585 | if (!port) { | ||
586 | pr_warning("Unable to find port\n"); | ||
587 | goto out_unlock; | ||
588 | } | ||
589 | 585 | ||
590 | bus = port->subordinate; | 586 | port = acpi_get_pci_dev(handle); |
587 | if (!port) { | ||
588 | pr_warning("Unable to find port\n"); | ||
589 | goto out_unlock; | ||
590 | } | ||
591 | 591 | ||
592 | if (!bus) { | 592 | bus = port->subordinate; |
593 | pr_warn("Unable to find PCI bus 1?\n"); | ||
594 | goto out_put_dev; | ||
595 | } | ||
596 | 593 | ||
597 | if (pci_bus_read_config_dword(bus, 0, PCI_VENDOR_ID, &l)) { | 594 | if (!bus) { |
598 | pr_err("Unable to read PCI config space?\n"); | 595 | pr_warn("Unable to find PCI bus 1?\n"); |
599 | goto out_put_dev; | 596 | goto out_put_dev; |
600 | } | 597 | } |
598 | |||
599 | if (pci_bus_read_config_dword(bus, 0, PCI_VENDOR_ID, &l)) { | ||
600 | pr_err("Unable to read PCI config space?\n"); | ||
601 | goto out_put_dev; | ||
602 | } | ||
601 | 603 | ||
602 | absent = (l == 0xffffffff); | 604 | absent = (l == 0xffffffff); |
603 | 605 | ||
604 | if (blocked != absent) { | 606 | if (blocked != absent) { |
605 | pr_warn("BIOS says wireless lan is %s, " | 607 | pr_warn("BIOS says wireless lan is %s, " |
606 | "but the pci device is %s\n", | 608 | "but the pci device is %s\n", |
607 | blocked ? "blocked" : "unblocked", | 609 | blocked ? "blocked" : "unblocked", |
608 | absent ? "absent" : "present"); | 610 | absent ? "absent" : "present"); |
609 | pr_warn("skipped wireless hotplug as probably " | 611 | pr_warn("skipped wireless hotplug as probably " |
610 | "inappropriate for this model\n"); | 612 | "inappropriate for this model\n"); |
613 | goto out_put_dev; | ||
614 | } | ||
615 | |||
616 | if (!blocked) { | ||
617 | dev = pci_get_slot(bus, 0); | ||
618 | if (dev) { | ||
619 | /* Device already present */ | ||
620 | pci_dev_put(dev); | ||
611 | goto out_put_dev; | 621 | goto out_put_dev; |
612 | } | 622 | } |
613 | 623 | dev = pci_scan_single_device(bus, 0); | |
614 | if (!blocked) { | 624 | if (dev) { |
615 | dev = pci_get_slot(bus, 0); | 625 | pci_bus_assign_resources(bus); |
616 | if (dev) { | 626 | pci_bus_add_device(dev); |
617 | /* Device already present */ | 627 | } |
618 | pci_dev_put(dev); | 628 | } else { |
619 | goto out_put_dev; | 629 | dev = pci_get_slot(bus, 0); |
620 | } | 630 | if (dev) { |
621 | dev = pci_scan_single_device(bus, 0); | 631 | pci_stop_and_remove_bus_device(dev); |
622 | if (dev) { | 632 | pci_dev_put(dev); |
623 | pci_bus_assign_resources(bus); | ||
624 | pci_bus_add_device(dev); | ||
625 | } | ||
626 | } else { | ||
627 | dev = pci_get_slot(bus, 0); | ||
628 | if (dev) { | ||
629 | pci_stop_and_remove_bus_device(dev); | ||
630 | pci_dev_put(dev); | ||
631 | } | ||
632 | } | 633 | } |
633 | out_put_dev: | ||
634 | pci_dev_put(port); | ||
635 | } | 634 | } |
635 | out_put_dev: | ||
636 | pci_dev_put(port); | ||
636 | 637 | ||
637 | out_unlock: | 638 | out_unlock: |
638 | pci_unlock_rescan_remove(); | 639 | pci_unlock_rescan_remove(); |