Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 7d0f1a2 | 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 | 7d0f1a2 | 2016-05-08 16:55:17 -0600 | [diff] [blame] | 5 | */ |
Wolfgang Denk | 74aedc1 | 2010-06-12 00:19:46 +0200 | [diff] [blame] | 6 | #ifndef _ERRNO_H |
Simon Glass | 7d0f1a2 | 2016-05-08 16:55:17 -0600 | [diff] [blame] | 7 | #define _ERRNO_H |
Wolfgang Denk | 74aedc1 | 2010-06-12 00:19:46 +0200 | [diff] [blame] | 8 | |
Masahiro Yamada | 64e4f7f | 2016-09-21 11:28:57 +0900 | [diff] [blame] | 9 | #include <linux/errno.h> |
Wolfgang Denk | 74aedc1 | 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 | 80bcd84 | 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 | 87e3161 | 2014-10-08 22:48:37 +0200 | [diff] [blame] | 22 | #ifdef CONFIG_ERRNO_STR |
| 23 | const char *errno_str(int errno); |
Simon Glass | 21adb08 | 2016-05-08 16:55:18 -0600 | [diff] [blame] | 24 | #else |
Heinrich Schuchardt | 80bcd84 | 2019-10-06 13:58:57 +0200 | [diff] [blame] | 25 | static const char error_message[] = ""; |
| 26 | |
Simon Glass | 21adb08 | 2016-05-08 16:55:18 -0600 | [diff] [blame] | 27 | static inline const char *errno_str(int errno) |
| 28 | { |
Heinrich Schuchardt | 80bcd84 | 2019-10-06 13:58:57 +0200 | [diff] [blame] | 29 | return error_message; |
Simon Glass | 21adb08 | 2016-05-08 16:55:18 -0600 | [diff] [blame] | 30 | } |
Przemyslaw Marczak | 87e3161 | 2014-10-08 22:48:37 +0200 | [diff] [blame] | 31 | #endif |
Wolfgang Denk | 74aedc1 | 2010-06-12 00:19:46 +0200 | [diff] [blame] | 32 | #endif /* _ERRNO_H */ |