Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 00e9e6d | 2016-05-08 16:55:17 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2014 Samsung Electronics |
| 4 | * Przemyslaw Marczak <p.marczak@samsung.com> |
Simon Glass | 00e9e6d | 2016-05-08 16:55:17 -0600 | [diff] [blame] | 5 | */ |
Wolfgang Denk | 65cd3fa | 2010-06-12 00:19:46 +0200 | [diff] [blame] | 6 | #ifndef _ERRNO_H |
Simon Glass | 00e9e6d | 2016-05-08 16:55:17 -0600 | [diff] [blame] | 7 | #define _ERRNO_H |
Wolfgang Denk | 65cd3fa | 2010-06-12 00:19:46 +0200 | [diff] [blame] | 8 | |
Masahiro Yamada | 5d97dff | 2016-09-21 11:28:57 +0900 | [diff] [blame] | 9 | #include <linux/errno.h> |
Wolfgang Denk | 65cd3fa | 2010-06-12 00:19:46 +0200 | [diff] [blame] | 10 | |
| 11 | extern int errno; |
| 12 | |
| 13 | #define __set_errno(val) do { errno = val; } while (0) |
| 14 | |
Heinrich Schuchardt | f279e1d | 2019-10-06 13:58:57 +0200 | [diff] [blame] | 15 | /** |
| 16 | * errno_str() - get description for error number |
| 17 | * |
| 18 | * @errno: error number (negative in case of error) |
| 19 | * Return: string describing the error. If CONFIG_ERRNO_STR is not |
| 20 | * defined an empty string is returned. |
| 21 | */ |
Przemyslaw Marczak | 59345b1 | 2014-10-08 22:48:37 +0200 | [diff] [blame] | 22 | #ifdef CONFIG_ERRNO_STR |
| 23 | const char *errno_str(int errno); |
Simon Glass | 862887d | 2016-05-08 16:55:18 -0600 | [diff] [blame] | 24 | #else |
Heinrich Schuchardt | f279e1d | 2019-10-06 13:58:57 +0200 | [diff] [blame] | 25 | static const char error_message[] = ""; |
| 26 | |
Simon Glass | 862887d | 2016-05-08 16:55:18 -0600 | [diff] [blame] | 27 | static inline const char *errno_str(int errno) |
| 28 | { |
Heinrich Schuchardt | f279e1d | 2019-10-06 13:58:57 +0200 | [diff] [blame] | 29 | return error_message; |
Simon Glass | 862887d | 2016-05-08 16:55:18 -0600 | [diff] [blame] | 30 | } |
Przemyslaw Marczak | 59345b1 | 2014-10-08 22:48:37 +0200 | [diff] [blame] | 31 | #endif |
Wolfgang Denk | 65cd3fa | 2010-06-12 00:19:46 +0200 | [diff] [blame] | 32 | #endif /* _ERRNO_H */ |