1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Medifield PNW Camera Imaging ISP subsystem. 4 * 5 * Copyright (c) 2010 Intel Corporation. All Rights Reserved. 6 * 7 * Copyright (c) 2010 Silicon Hive www.siliconhive.com. 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License version 11 * 2 as published by the Free Software Foundation. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * 19 */ 20 21 #ifndef __HMM_BO_COMMON_H__ 22 #define __HMM_BO_COMMON_H__ 23 24 #define HMM_BO_NAME "HMM" 25 26 /* 27 * some common use micros 28 */ 29 #define var_equal_return(var1, var2, exp, fmt, arg ...) \ 30 do { \ 31 if ((var1) == (var2)) { \ 32 dev_err(atomisp_dev, \ 33 fmt, ## arg); \ 34 return exp;\ 35 } \ 36 } while (0) 37 38 #define var_equal_return_void(var1, var2, fmt, arg ...) \ 39 do { \ 40 if ((var1) == (var2)) { \ 41 dev_err(atomisp_dev, \ 42 fmt, ## arg); \ 43 return;\ 44 } \ 45 } while (0) 46 47 #define var_equal_goto(var1, var2, label, fmt, arg ...) \ 48 do { \ 49 if ((var1) == (var2)) { \ 50 dev_err(atomisp_dev, \ 51 fmt, ## arg); \ 52 goto label;\ 53 } \ 54 } while (0) 55 56 #define var_not_equal_goto(var1, var2, label, fmt, arg ...) \ 57 do { \ 58 if ((var1) != (var2)) { \ 59 dev_err(atomisp_dev, \ 60 fmt, ## arg); \ 61 goto label;\ 62 } \ 63 } while (0) 64 65 #define check_null_return(ptr, exp, fmt, arg ...) \ 66 var_equal_return(ptr, NULL, exp, fmt, ## arg) 67 68 #define check_null_return_void(ptr, fmt, arg ...) \ 69 var_equal_return_void(ptr, NULL, fmt, ## arg) 70 71 #endif 72