Patchwork [v2,8/8] PCI: acpiphp: sanitize acpiphp_get_[latch|adapter]_status()

login
register
mail settings
Submitter Mika Westerberg
Date July 3, 2013, 2:04 p.m.
Message ID <1372860295-8306-9-git-send-email-mika.westerberg@linux.intel.com>
Download mbox | patch
Permalink /patch/256643/
State Not Applicable
Headers show

Comments

Mika Westerberg - July 3, 2013, 2:04 p.m.
There is no need for a temporary variable and all the tricks with ternary
operators. Change the functions to be a bit more straightforward.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/pci/hotplug/acpiphp_glue.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Patch

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 506f38f..810ca4c 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1271,11 +1271,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);
 }
 
 
@@ -1285,9 +1281,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);
 }