]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/gpio/omap_gpio.c
SPDX-License-Identifier: fixing some problematic GPL-2.0 files
[karo-tx-uboot.git] / drivers / gpio / omap_gpio.c
index fc89f2a42b12b0c8690a80e52d5842b5902e9e0a..13dcf798730f4313e6767dc8078b05a454e6adb2 100644 (file)
@@ -2,20 +2,7 @@
  * Copyright (c) 2009 Wind River Systems, Inc.
  * Tom Rix <Tom.Rix@windriver.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0
  *
  * This work is derived from the linux 2.6.27 kernel source
  * To fetch, use the kernel repository
  *
  * Copyright (C) 2003-2005 Nokia Corporation
  * Written by Juha Yrjölä <juha.yrjola@nokia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
  */
 #include <common.h>
 #include <asm/gpio.h>
@@ -53,18 +36,14 @@ static inline int get_gpio_index(int gpio)
        return gpio & 0x1f;
 }
 
-static inline int gpio_valid(int gpio)
+int gpio_is_valid(int gpio)
 {
-       if (gpio < 0)
-               return -1;
-       if (gpio < 192)
-               return 0;
-       return -1;
+       return (gpio >= 0) && (gpio < OMAP_MAX_GPIO);
 }
 
 static int check_gpio(int gpio)
 {
-       if (gpio_valid(gpio) < 0) {
+       if (!gpio_is_valid(gpio)) {
                printf("ERROR : check_gpio: invalid GPIO %d\n", gpio);
                return -1;
        }