lkml.org 
[lkml]   [2013]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] gpio-ich: Check for pin availability at request time
Stop checking for pin availability in get functions. These functions
can be called repeatedly, so checking every time is bad for
performance.

Instead, check at pin request time. This only happens once, and we can
let the caller know of the unavailability much earlier.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-ich.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

--- linux-3.7.orig/drivers/gpio/gpio-ich.c 2013-03-05 08:36:40.940199905 +0100
+++ linux-3.7/drivers/gpio/gpio-ich.c 2013-03-05 08:36:51.047437884 +0100
@@ -169,9 +169,6 @@ static int ichx_gpio_direction_output(st

static int ichx_gpio_get(struct gpio_chip *chip, unsigned nr)
{
- if (!ichx_gpio_check_available(chip, nr))
- return -ENXIO;
-
return ichx_read_bit(GPIO_LVL, nr);
}

@@ -180,9 +177,6 @@ static int ich6_gpio_get(struct gpio_chi
unsigned long flags;
u32 data;

- if (!ichx_gpio_check_available(chip, nr))
- return -ENXIO;
-
/*
* GPI 0 - 15 need to be read from the power management registers on
* a ICH6/3100 bridge.
@@ -207,6 +201,9 @@ static int ich6_gpio_get(struct gpio_chi

static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr)
{
+ if (!ichx_gpio_check_available(chip, nr))
+ return -ENXIO;
+
/*
* Note we assume the BIOS properly set a bridge's USE value. Some
* chips (eg Intel 3100) have bogus USE values though, so first see if

--
Jean Delvare


\
 
 \ /
  Last update: 2013-03-05 09:43    [W:1.208 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site