1/* SPDX-License-Identifier: GPL-2.0+ */ 2/* 3 * Copyright (C) 2014 Samsung Electronics 4 * Przemyslaw Marczak <p.marczak@samsung.com> 5 */ 6#ifndef _ERRNO_H 7#define _ERRNO_H 8 9#include <linux/errno.h> 10 11#ifdef __SANDBOX__ 12#define __errno_asm_label asm("__u_boot_errno") 13#else 14#define __errno_asm_label 15#endif 16 17extern int errno __errno_asm_label; 18 19#define __set_errno(val) do { errno = val; } while (0) 20 21/** 22 * errno_str() - get description for error number 23 * 24 * @errno: error number (negative in case of error) 25 * Return: string describing the error. If CONFIG_ERRNO_STR is not 26 * defined an empty string is returned. 27 */ 28#if CONFIG_IS_ENABLED(ERRNO_STR) 29const char *errno_str(int errno); 30#else 31static const char error_message[] = ""; 32 33static inline const char *errno_str(int errno) 34{ 35 return error_message; 36} 37#endif 38#endif /* _ERRNO_H */ 39