Commit a86b4936 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: atomisp: get rid of an error abstraction layer



There is an abstraction layer there meant to convert to
the Linux standard error codes. As the driver now use
such errors everywhere. we can get rid of this.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 41022d35
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
 *
 *
 */
#include <linux/errno.h>
#include <linux/firmware.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
@@ -58,7 +59,6 @@
#include "ia_css_types.h"
#include "ia_css_stream.h"
#include "ia_css_debug.h"
#include "error_support.h"
#include "bits.h"

/* We should never need to run the flash for more than 2 frames.
+2 −1
Original line number Diff line number Diff line
@@ -15,8 +15,9 @@
#ifndef __IA_CSS_UTIL_H__
#define __IA_CSS_UTIL_H__

#include <linux/errno.h>

#include <ia_css_err.h>
#include <error_support.h>
#include <type_support.h>
#include <ia_css_frame_public.h>
#include <ia_css_stream_public.h>
+0 −29
Original line number Diff line number Diff line
@@ -20,35 +20,6 @@
/* for ia_css_binary_max_vf_width() */
#include "ia_css_binary.h"

int ia_css_convert_errno(
    int in_err)
{
	int out_err;

	switch (in_err) {
	case 0:
		out_err = 0;
		break;
	case EINVAL:
		out_err = -EINVAL;
		break;
	case ENODATA:
		out_err = -ENODATA;
		break;
	case ENOSYS:
	case ENOTSUP:
		out_err = -EINVAL;
		break;
	case ENOBUFS:
		out_err = -ENOBUFS;
		break;
	default:
		out_err = -EINVAL;
		break;
	}
	return out_err;
}

/* MW: Table look-up ??? */
unsigned int ia_css_util_input_format_bpp(
    enum atomisp_input_format format,
+0 −39
Original line number Diff line number Diff line
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef __ERROR_SUPPORT_H_INCLUDED__
#define __ERROR_SUPPORT_H_INCLUDED__

#include <linux/errno.h>
/*
 * Put here everything __KERNEL__ specific not covered in
 * "errno.h"
 */
#define ENOTSUP 252

#define verifexit(cond, error_tag)  \
do {                               \
	if (!(cond)) {              \
		goto EXIT;         \
	}                          \
} while (0)

#define verifjmpexit(cond)         \
do {                               \
	if (!(cond)) {              \
		goto EXIT;         \
	}                          \
} while (0)

#endif /* __ERROR_SUPPORT_H_INCLUDED__ */
+8 −8
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
 * @param[in]  src_buf. The source buffer
 * @param[in]  src_size. The size of the source buffer in bytes
 * @return     0 on success, error code on failure
 * @return     EINVAL on Invalid arguments
 * @return     -EINVAL on Invalid arguments
 * @return     ERANGE on Destination size too small
 */
static inline int memcpy_s(
@@ -39,7 +39,7 @@ static inline int memcpy_s(
{
	if ((!src_buf) || (!dest_buf)) {
		/* Invalid arguments*/
		return EINVAL;
		return -EINVAL;
	}

	if ((dest_size < src_size) || (src_size == 0)) {
@@ -84,7 +84,7 @@ static size_t strnlen_s(
 * @param[in]  src_str. The source buffer
 * @param[in]  src_size. The size of the source buffer in bytes
 * @return     Returns 0 on success
 * @return     Returns EINVAL on invalid arguments
 * @return     Returns -EINVAL on invalid arguments
 * @return     Returns ERANGE on destination size too small
 */
static inline int strncpy_s(
@@ -97,13 +97,13 @@ static inline int strncpy_s(

	if (!dest_str) {
		/* Invalid arguments*/
		return EINVAL;
		return -EINVAL;
	}

	if ((!src_str) || (dest_size == 0)) {
		/* Invalid arguments*/
		dest_str[0] = '\0';
		return EINVAL;
		return -EINVAL;
	}

	len = strnlen_s(src_str, src_size);
@@ -126,7 +126,7 @@ static inline int strncpy_s(
 * @param[in]  dest_size. The size of the destination buffer in bytes
 * @param[in]  src_str. The source buffer
 * @return     Returns 0 on success
 * @return     Returns EINVAL on invalid arguments
 * @return     Returns -EINVAL on invalid arguments
 * @return     Returns ERANGE on destination size too small
 */
static inline int strcpy_s(
@@ -138,13 +138,13 @@ static inline int strcpy_s(

	if (!dest_str) {
		/* Invalid arguments*/
		return EINVAL;
		return -EINVAL;
	}

	if ((!src_str) || (dest_size == 0)) {
		/* Invalid arguments*/
		dest_str[0] = '\0';
		return EINVAL;
		return -EINVAL;
	}

	len = strnlen_s(src_str, dest_size);
Loading