diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-10-21 15:45:54 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-02-09 11:09:48 +0100 |
commit | 6d591c46bce037696d173bd5c8461b2b4bb680ad (patch) | |
tree | 5b7d5e0004de27d1451f38e3e1ddf99837e5d615 /tools/gpio/gpio-utils.h | |
parent | 3c702e9987e261042a07e43460a8148be254412e (diff) | |
download | op-kernel-dev-6d591c46bce037696d173bd5c8461b2b4bb680ad.zip op-kernel-dev-6d591c46bce037696d173bd5c8461b2b4bb680ad.tar.gz |
tools/gpio: create GPIO tools
This creates GPIO tools under tools/gpio/* and adds a single
example program to list the GPIOs on a system. When proper
devices are created it provides this minimal output:
Cc: Johan Hovold <johan@kernel.org>
Cc: Michael Welling <mwelling@ieee.org>
Cc: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'tools/gpio/gpio-utils.h')
-rw-r--r-- | tools/gpio/gpio-utils.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/gpio/gpio-utils.h b/tools/gpio/gpio-utils.h new file mode 100644 index 0000000..b18209a --- /dev/null +++ b/tools/gpio/gpio-utils.h @@ -0,0 +1,25 @@ +/* + * GPIO tools - utility helpers library for the GPIO tools + * + * Copyright (C) 2015 Linus Walleij + * + * Portions copied from iio_utils and lssio: + * Copyright (c) 2010 Manuel Stahl <manuel.stahl@iis.fraunhofer.de> + * Copyright (c) 2008 Jonathan Cameron + * * + * 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. + */ +#ifndef _GPIO_UTILS_H_ +#define _GPIO_UTILS_H_ + +#include <string.h> + +static inline int check_prefix(const char *str, const char *prefix) +{ + return strlen(str) > strlen(prefix) && + strncmp(str, prefix, strlen(prefix)) == 0; +} + +#endif /* _GPIO_UTILS_H_ */ |