From 5fac236a9703827666df452f093d2849625afd4d Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 6 Oct 2011 12:52:22 +0000 Subject: tegra2: Use new GPIO APIs in gpio_config_uart() ... rather than open-coding the register accesses. However, gpio_request() typically stores the "label" parameter in a global data structure. This causes problems when called from gpio_config_uart(), since the code is running before relocation. To solve this, pass a NULL string to gpio_request(), and modify gpio_request() not to touch the string if it's NULL. Signed-off-by: Stephen Warren Acked-by: Simon Glass Tested-by: Simon Glass Signed-off-by: Tom Warren --- drivers/gpio/tegra2_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/tegra2_gpio.c b/drivers/gpio/tegra2_gpio.c index f686e80637..22669b6160 100644 --- a/drivers/gpio/tegra2_gpio.c +++ b/drivers/gpio/tegra2_gpio.c @@ -146,8 +146,10 @@ int gpio_request(int gp, const char *label) if (gp >= MAX_NUM_GPIOS) return -1; - strncpy(gpio_names[gp].name, label, GPIO_NAME_SIZE); - gpio_names[gp].name[GPIO_NAME_SIZE - 1] = '\0'; + if (label != NULL) { + strncpy(gpio_names[gp].name, label, GPIO_NAME_SIZE); + gpio_names[gp].name[GPIO_NAME_SIZE - 1] = '\0'; + } /* Configure as a GPIO */ set_config(gp, 1); -- cgit