blob: 3af539b9e91b2150c3ad659d0e8d77907f063271 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass7d0f1a22016-05-08 16:55:17 -06002/*
3 * Copyright (C) 2014 Samsung Electronics
4 * Przemyslaw Marczak <p.marczak@samsung.com>
Simon Glass7d0f1a22016-05-08 16:55:17 -06005 */
Wolfgang Denk74aedc12010-06-12 00:19:46 +02006#ifndef _ERRNO_H
Simon Glass7d0f1a22016-05-08 16:55:17 -06007#define _ERRNO_H
Wolfgang Denk74aedc12010-06-12 00:19:46 +02008
Masahiro Yamada64e4f7f2016-09-21 11:28:57 +09009#include <linux/errno.h>
Wolfgang Denk74aedc12010-06-12 00:19:46 +020010
11extern int errno;
12
13#define __set_errno(val) do { errno = val; } while (0)
14
Heinrich Schuchardt80bcd842019-10-06 13:58:57 +020015/**
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 Marczak87e31612014-10-08 22:48:37 +020022#ifdef CONFIG_ERRNO_STR
23const char *errno_str(int errno);
Simon Glass21adb082016-05-08 16:55:18 -060024#else
Heinrich Schuchardt80bcd842019-10-06 13:58:57 +020025static const char error_message[] = "";
26
Simon Glass21adb082016-05-08 16:55:18 -060027static inline const char *errno_str(int errno)
28{
Heinrich Schuchardt80bcd842019-10-06 13:58:57 +020029 return error_message;
Simon Glass21adb082016-05-08 16:55:18 -060030}
Przemyslaw Marczak87e31612014-10-08 22:48:37 +020031#endif
Wolfgang Denk74aedc12010-06-12 00:19:46 +020032#endif /* _ERRNO_H */