Skip to content

Commit

Permalink
ACPI / hotplug / PCI: Sanitize acpiphp_get_(latch)|(adapter)_status()
Browse files Browse the repository at this point in the history
There is no need for a temporary variable and all the tricks with
ternary operators in acpiphp_get_(latch)|(adapter)_status(). Change
those functions to be a bit more straightforward.

[rjw: Changelog]
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Mika Westerberg authored and Rafael J. Wysocki committed Jul 23, 2013
1 parent c38f82c commit 1ad3790
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions drivers/pci/hotplug/acpiphp_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,7 @@ u8 acpiphp_get_power_status(struct acpiphp_slot *slot)
*/
u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
{
unsigned int sta;

sta = get_slot_status(slot);

return (sta & ACPI_STA_DEVICE_UI) ? 0 : 1;
return !(get_slot_status(slot) & ACPI_STA_DEVICE_UI);
}


Expand All @@ -1121,9 +1117,5 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
*/
u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot)
{
unsigned int sta;

sta = get_slot_status(slot);

return (sta == 0) ? 0 : 1;
return !!get_slot_status(slot);
}

0 comments on commit 1ad3790

Please sign in to comment.