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