From patchwork Wed Jun 3 07:00:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99355C433E0 for ; Wed, 3 Jun 2020 07:01:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7449F2068D for ; Wed, 3 Jun 2020 07:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167710; bh=82rWhY70VDMp6r+w208SPFzpIRfRwkocD+byesNur7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KWKgtS1gwIB8o7Pt9d3AeVqtdt08eXHqTVsBpLGfXJqQKeQf3mqw+y3fYFT5Y5O7d +QrN5QTdrKJ//I/hnJrQ8oIg5x0DaMFFAbDjH5hotD2J2XMhwIVcBAEwhKDRvgvbJz vyCRWfebJ32x/NkN6ZB9qo0P5Lq79CenL3DNgBas= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbgFCHBj (ORCPT ); Wed, 3 Jun 2020 03:01:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:43402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbgFCHBI (ORCPT ); Wed, 3 Jun 2020 03:01:08 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 802BF206E6; Wed, 3 Jun 2020 07:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167665; bh=82rWhY70VDMp6r+w208SPFzpIRfRwkocD+byesNur7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lXN/9JNk3vOobT+lUb5Pmbam4kwVpbyuZvYww4tA5Hmwq/SOjHBmEiKTznq7lcBVx rUgW3JYB0/MZgfO0mWl2W1n2wdf4jbBwg7+16E8bxlEIpp8KPaToJxyQO0xJLtYrmb o73ut3UERGeJ753MhZOwTMz2f/y2pCD2iYxkf+xE= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jgNOZ-004j88-50; Wed, 03 Jun 2020 09:01:03 +0200 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/15] media: atomisp: do some cleanup at irq_local.h Date: Wed, 3 Jun 2020 09:00:48 +0200 Message-Id: <4a452db7a606920d3a855322579accd8d21bda27.1591167358.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org - Get rid of typedefs; - Get rid of a duplicated enum type with different names for ISP2400 and ISP2401; - adjust indentation on the touched code. Signed-off-by: Mauro Carvalho Chehab --- .../pci/hive_isp_css_common/host/irq.c | 29 +++++++++---------- .../pci/hive_isp_css_common/host/irq_local.h | 17 +++-------- .../hive_isp_css_include/host/irq_public.h | 16 +++++----- .../pci/runtime/debug/src/ia_css_debug.c | 2 +- drivers/staging/media/atomisp/pci/sh_css.c | 10 +++---- 5 files changed, 30 insertions(+), 44 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq.c index 8b72a40f9ad1..11448ca00a35 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq.c @@ -29,9 +29,8 @@ static inline void irq_wait_for_write_complete( static inline bool any_irq_channel_enabled( const irq_ID_t ID); -static inline irq_ID_t virq_get_irq_id( - const virq_id_t irq_ID, - unsigned int *channel_ID); +static inline irq_ID_t virq_get_irq_id(const enum virq_id irq_ID, + unsigned int *channel_ID); #ifndef __INLINE_IRQ__ #include "irq_private.h" @@ -52,7 +51,7 @@ static unsigned short IRQ_N_ID_OFFSET[N_IRQ_ID + 1] = { IRQ_END_OFFSET }; -static virq_id_t IRQ_NESTING_ID[N_IRQ_ID] = { +static enum virq_id IRQ_NESTING_ID[N_IRQ_ID] = { N_virq_id, virq_ifmt, virq_isys, @@ -228,9 +227,8 @@ void irq_raise( return; } -void irq_controller_get_state( - const irq_ID_t ID, - irq_controller_state_t *state) +void irq_controller_get_state(const irq_ID_t ID, + struct irq_controller_state *state) { assert(ID < N_IRQ_ID); assert(state); @@ -257,7 +255,7 @@ bool any_virq_signal(void) } void cnd_virq_enable_channel( - const virq_id_t irq_ID, + const enum virq_id irq_ID, const bool en) { irq_ID_t i; @@ -297,8 +295,8 @@ void virq_clear_all(void) return; } -enum hrt_isp_css_irq_status virq_get_channel_signals( - virq_info_t *irq_info) +enum hrt_isp_css_irq_status +virq_get_channel_signals(struct virq_info *irq_info) { enum hrt_isp_css_irq_status irq_status = hrt_isp_css_irq_status_error; irq_ID_t ID; @@ -327,8 +325,7 @@ enum hrt_isp_css_irq_status virq_get_channel_signals( return irq_status; } -void virq_clear_info( - virq_info_t *irq_info) +void virq_clear_info(struct virq_info *irq_info) { irq_ID_t ID; @@ -341,7 +338,7 @@ void virq_clear_info( } enum hrt_isp_css_irq_status virq_get_channel_id( - virq_id_t *irq_id) + enum virq_id *irq_id) { unsigned int irq_status = irq_reg_load(IRQ0_ID, _HRT_IRQ_CONTROLLER_STATUS_REG_IDX); @@ -368,7 +365,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id( /* Check whether we have an IRQ on one of the nested devices */ for (ID = N_IRQ_ID - 1 ; ID > (irq_ID_t)0; ID--) { - if (IRQ_NESTING_ID[ID] == (virq_id_t)idx) { + if (IRQ_NESTING_ID[ID] == (enum virq_id)idx) { break; } } @@ -405,7 +402,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id( idx += IRQ_N_ID_OFFSET[ID]; if (irq_id) - *irq_id = (virq_id_t)idx; + *irq_id = (enum virq_id)idx; return status; } @@ -433,7 +430,7 @@ static inline bool any_irq_channel_enabled( } static inline irq_ID_t virq_get_irq_id( - const virq_id_t irq_ID, + const enum virq_id irq_ID, unsigned int *channel_ID) { irq_ID_t ID; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq_local.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq_local.h index 345d41c1d39f..6a25345ae88e 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq_local.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq_local.h @@ -43,10 +43,7 @@ #define IRQ2_ID_N_CHANNEL HIVE_ISYS_IRQ_NUM_BITS #define IRQ3_ID_N_CHANNEL HIVE_ISEL_IRQ_NUM_IRQS -typedef struct virq_info_s virq_info_t; -typedef struct irq_controller_state_s irq_controller_state_t; - -typedef enum { +enum virq_id { virq_gpio_pin_0 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_GPIO_PIN_0_BIT_ID, virq_gpio_pin_1 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_GPIO_PIN_1_BIT_ID, virq_gpio_pin_2 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_GPIO_PIN_2_BIT_ID, @@ -67,13 +64,7 @@ typedef enum { virq_sp_stream_mon = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_SP_STREAM_MON_BIT_ID, virq_isp_stream_mon = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_STREAM_MON_BIT_ID, virq_mod_stream_mon = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_MOD_STREAM_MON_BIT_ID, -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) virq_isp_pmem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID, -#elif defined(IS_ISP_2401_MAMOIADA_SYSTEM) - virq_isys_2401 = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_PMEM_ERROR_BIT_ID, -#else -#error "irq_local.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif virq_isp_bamem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_BAMEM_ERROR_BIT_ID, virq_isp_dmem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_ISP_DMEM_ERROR_BIT_ID, virq_sp_icache_mem_error = IRQ0_ID_OFFSET + HIVE_GP_DEV_IRQ_SP_ICACHE_MEM_ERROR_BIT_ID, @@ -118,13 +109,13 @@ typedef enum { virq_isel_eol = IRQ3_ID_OFFSET + HIVE_ISEL_IRQ_SYNC_GEN_EOL_BIT_ID, N_virq_id = IRQ_END_OFFSET -} virq_id_t; +}; -struct virq_info_s { +struct virq_info { hrt_data irq_status_reg[N_IRQ_ID]; }; -struct irq_controller_state_s { +struct irq_controller_state { unsigned int irq_edge; unsigned int irq_mask; unsigned int irq_status; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h index bc3ad3dcf6d1..d335e7b0a76e 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h @@ -26,9 +26,8 @@ \return none, state = IRQ[ID].state */ -void irq_controller_get_state( - const irq_ID_t ID, - irq_controller_state_t *state); +void irq_controller_get_state(const irq_ID_t ID, + struct irq_controller_state *state); /*! Write to a control register of IRQ[ID] @@ -137,7 +136,7 @@ bool any_virq_signal(void); \return none, VIRQ.channel[irq_ID].enable = en */ void cnd_virq_enable_channel( - const virq_id_t irq_ID, + const enum virq_id irq_ID, const bool en); /*! Clear the state of all IRQ channels of the virtual super IRQ @@ -152,8 +151,7 @@ void virq_clear_all(void); \return none */ -void virq_clear_info( - virq_info_t *irq_info); +void virq_clear_info(struct virq_info *irq_info); /*! Return the ID of a signalling IRQ channel of the virtual super IRQ @@ -166,7 +164,7 @@ void virq_clear_info( \return state(IRQ[...]) */ enum hrt_isp_css_irq_status virq_get_channel_id( - virq_id_t *irq_id); + enum virq_id *irq_id); /*! Return the IDs of all signaling IRQ channels of the virtual super IRQ @@ -179,7 +177,7 @@ enum hrt_isp_css_irq_status virq_get_channel_id( \return (error(state(IRQ[...])) */ -enum hrt_isp_css_irq_status virq_get_channel_signals( - virq_info_t *irq_info); +enum hrt_isp_css_irq_status +virq_get_channel_signals(struct virq_info *irq_info); #endif /* __IRQ_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index e367c5e0fc5a..49836016559f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -2228,7 +2228,7 @@ void ia_css_debug_dump_debug_info(const char *context) ia_css_debug_dump_isys_state(); { - irq_controller_state_t state; + struct irq_controller_state state; irq_controller_get_state(IRQ2_ID, &state); diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 9815c87ca6f3..a722b886b2f5 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -1546,16 +1546,16 @@ enable_interrupts(enum ia_css_irq_type irq_type) /* Enable SW interrupt 0, this is used to signal ISYS events */ cnd_virq_enable_channel( - (virq_id_t)(IRQ_SW_CHANNEL0_ID + IRQ_SW_CHANNEL_OFFSET), + (enum virq_id)(IRQ_SW_CHANNEL0_ID + IRQ_SW_CHANNEL_OFFSET), true); /* Enable SW interrupt 1, this is used to signal PSYS events */ cnd_virq_enable_channel( - (virq_id_t)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET), + (enum virq_id)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET), true); #if !defined(HAS_IRQ_MAP_VERSION_2) /* IRQ_SW_CHANNEL2_ID does not exist on 240x systems */ cnd_virq_enable_channel( - (virq_id_t)(IRQ_SW_CHANNEL2_ID + IRQ_SW_CHANNEL_OFFSET), + (enum virq_id)(IRQ_SW_CHANNEL2_ID + IRQ_SW_CHANNEL_OFFSET), true); virq_clear_all(); #endif @@ -2549,7 +2549,7 @@ ia_css_uninit(void) int ia_css_irq_translate( unsigned int *irq_infos) { - virq_id_t irq; + enum virq_id irq; enum hrt_isp_css_irq_status status = hrt_isp_css_irq_status_more_irqs; unsigned int infos = 0; @@ -2622,7 +2622,7 @@ int ia_css_irq_enable( enum ia_css_irq_info info, bool enable) { - virq_id_t irq = N_virq_id; + enum virq_id irq = N_virq_id; IA_CSS_ENTER("info=%d, enable=%d", info, enable); From patchwork Wed Jun 3 07:00:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1D29C433E0 for ; Wed, 3 Jun 2020 07:02:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B72832077D for ; Wed, 3 Jun 2020 07:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167722; bh=yU4P1s6jg7uPhV1MW+EmpL+ueFr+IMkJzMOUKpTmU/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=h3AdX0btyqgvbEJDvMw2WUp0mw/R772Fd+fne3qtUd9/GXqQVL523eADyI/70S1i0 83JtZ4bEoy00b8qzipMMeuecp2rk8UeCY034/AmLsRWpTLAuelHicUwU7u0t093ALd QjI8XoK829s44VIteLZQNxAMNE1qqQiW3ojkQNy0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726334AbgFCHCB (ORCPT ); Wed, 3 Jun 2020 03:02:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:43116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbgFCHBH (ORCPT ); Wed, 3 Jun 2020 03:01:07 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8373A207ED; Wed, 3 Jun 2020 07:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167665; bh=yU4P1s6jg7uPhV1MW+EmpL+ueFr+IMkJzMOUKpTmU/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PkuFTlIo5RKV+kpPdqfteiRuALT/YbxJSHj5EhTJXIvLIZ4tbIJii0eSrCCX3gT1s iwMe5SlaOujjFSrnmoyXYF/PRlHFR7mQqCY/rZ880lIgRWMDrU8TC2QuNdErgfgviY izU1nGuVLuRW9qLJNPJ9/bgdERjLDevKFAem8gjA= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jgNOZ-004j8M-A8; Wed, 03 Jun 2020 09:01:03 +0200 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/15] media: atomisp: simplify IRQ ifdef logic Date: Wed, 3 Jun 2020 09:00:51 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are lots of mess with IRQ ifdef settings. As the *_global.h will already detect the type of IRQ system at compile time, we can get rid of them, replacing by just one ifdef for ISP2401. Signed-off-by: Mauro Carvalho Chehab --- .../pci/hive_isp_css_common/isp_global.h | 10 ++---- .../pci/hive_isp_css_common/sp_global.h | 10 ------ .../media/atomisp/pci/isp2400_system_global.h | 31 ------------------- .../media/atomisp/pci/isp2400_system_local.h | 8 ----- .../media/atomisp/pci/isp2401_system_global.h | 31 ------------------- .../media/atomisp/pci/isp2401_system_local.h | 8 ----- .../pci/runtime/debug/src/ia_css_debug.c | 10 ------ .../tagger/interface/ia_css_tagger_common.h | 4 --- .../media/atomisp/pci/sh_css_internal.h | 10 ------ 9 files changed, 2 insertions(+), 120 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h index 5ea3f1938fbd..5212d52198bd 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h @@ -18,16 +18,10 @@ #include -#if defined(HAS_ISP_2401_MAMOIADA) -#define IS_ISP_2401_MAMOIADA - +#ifdef ISP2401 #include "isp2401_mamoiada_params.h" -#elif defined(HAS_ISP_2400_MAMOIADA) -#define IS_ISP_2400_MAMOIADA - +#else #include "isp2400_mamoiada_params.h" -#else -#error "isp_global_h: ISP_2400_MAMOIDA must be one of {2400, 2401 }" #endif #define ISP_PMEM_WIDTH_LOG2 ISP_LOG2_PMEM_WIDTH diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h index 125fe577073f..b8338f9b5c0c 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h @@ -18,17 +18,7 @@ #include -#if defined(HAS_SP_2401) -#define IS_SP_2401 -/* 2401 uses 2400 */ #include -#elif defined(HAS_SP_2400) -#define IS_SP_2400 - -#include -#else -#error "sp_global.h: SP_2400 must be one of {2400, 2401 }" -#endif #define SP_PMEM_WIDTH_LOG2 SP_PMEM_LOG_WIDTH_BITS #define SP_PMEM_SIZE SP_PMEM_DEPTH diff --git a/drivers/staging/media/atomisp/pci/isp2400_system_global.h b/drivers/staging/media/atomisp/pci/isp2400_system_global.h index ed3c24a77a3c..d87ddf1d2fe9 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2400_system_global.h @@ -47,27 +47,6 @@ * N.B. the 3 input formatters are of 2 different classess */ -/* - * Since this file is visible everywhere and the system definition - * macros are not, detect the separate definitions for {host, SP, ISP} - * - * The 2401 system has the nice property that it uses a vanilla 2400 SP - * so the SP will believe it is a 2400 system rather than 2401... - */ -//#if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) || defined(__scalar_processor_2401) -#if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) -#define IS_ISP_2401_MAMOIADA_SYSTEM -#define HAS_ISP_2401_MAMOIADA -#define HAS_SP_2400 -//#elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) || defined(__scalar_processor_2400) -#elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) -#define IS_ISP_2400_MAMOIADA_SYSTEM -#define HAS_ISP_2400_MAMOIADA -#define HAS_SP_2400 -#else -#error "system_global.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif - #define USE_INPUT_SYSTEM_VERSION_2 #define HAS_MMU_VERSION_2 @@ -130,21 +109,11 @@ typedef enum { N_SP_ID } sp_ID_t; -#if defined(IS_ISP_2401_MAMOIADA_SYSTEM) typedef enum { MMU0_ID = 0, MMU1_ID, N_MMU_ID } mmu_ID_t; -#elif defined(IS_ISP_2400_MAMOIADA_SYSTEM) -typedef enum { - MMU0_ID = 0, - MMU1_ID, - N_MMU_ID -} mmu_ID_t; -#else -#error "system_global.h: SYSTEM must be one of {2400, 2401}" -#endif typedef enum { DMA0_ID = 0, diff --git a/drivers/staging/media/atomisp/pci/isp2400_system_local.h b/drivers/staging/media/atomisp/pci/isp2400_system_local.h index 0574bb9a0a77..da34e3e5f3fb 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2400_system_local.h @@ -82,7 +82,6 @@ static const hrt_address SP_PMEM_BASE[N_SP_ID] = { }; /* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) || defined(IS_ISP_2401_MAMOIADA_SYSTEM) /* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU @@ -91,9 +90,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = { (hrt_address)0x0000000000070000ULL, (hrt_address)0x00000000000A0000ULL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = { @@ -225,7 +221,6 @@ static const hrt_address SP_PMEM_BASE[N_SP_ID] = { }; /* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) || defined(IS_ISP_2401_MAMOIADA_SYSTEM) /* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU @@ -234,9 +229,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = { (hrt_address)0x00070000UL, (hrt_address)0x000A0000UL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = { diff --git a/drivers/staging/media/atomisp/pci/isp2401_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_system_global.h index 67464e59c35b..8bb2a956f983 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2401_system_global.h @@ -53,27 +53,6 @@ #define USE_INPUT_SYSTEM_VERSION_2401 -/* - * Since this file is visible everywhere and the system definition - * macros are not, detect the separate definitions for {host, SP, ISP} - * - * The 2401 system has the nice property that it uses a vanilla 2400 SP - * so the SP will believe it is a 2400 system rather than 2401... - */ -/* #if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) || defined(__scalar_processor_2401) */ -#if defined(SYSTEM_hive_isp_css_2401_system) || defined(__isp2401_mamoiada) -#define IS_ISP_2401_MAMOIADA_SYSTEM -#define HAS_ISP_2401_MAMOIADA -#define HAS_SP_2400 -/* #elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) || defined(__scalar_processor_2400)*/ -#elif defined(SYSTEM_hive_isp_css_2400_system) || defined(__isp2400_mamoiada) -#define IS_ISP_2400_MAMOIADA_SYSTEM -#define HAS_ISP_2400_MAMOIADA -#define HAS_SP_2400 -#else -#error "system_global.h: 2400_SYSTEM must be one of {2400, 2401 }" -#endif - #define HAS_MMU_VERSION_2 #define HAS_DMA_VERSION_2 #define HAS_GDC_VERSION_2 @@ -144,21 +123,11 @@ typedef enum { N_SP_ID } sp_ID_t; -#if defined(IS_ISP_2401_MAMOIADA_SYSTEM) typedef enum { MMU0_ID = 0, MMU1_ID, N_MMU_ID } mmu_ID_t; -#elif defined(IS_ISP_2400_MAMOIADA_SYSTEM) -typedef enum { - MMU0_ID = 0, - MMU1_ID, - N_MMU_ID -} mmu_ID_t; -#else -#error "system_global.h: SYSTEM must be one of {2400, 2401}" -#endif typedef enum { DMA0_ID = 0, diff --git a/drivers/staging/media/atomisp/pci/isp2401_system_local.h b/drivers/staging/media/atomisp/pci/isp2401_system_local.h index 6605e1a92900..4d9fe06ac1cc 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2401_system_local.h @@ -76,7 +76,6 @@ static const hrt_address SP_DMEM_BASE[N_SP_ID] = { }; /* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) || defined(IS_ISP_2401_MAMOIADA_SYSTEM) /* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU @@ -85,9 +84,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = { 0x0000000000070000ULL, 0x00000000000A0000ULL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = { @@ -261,7 +257,6 @@ static const hrt_address SP_DMEM_BASE[N_SP_ID] = { }; /* MMU */ -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) || defined(IS_ISP_2401_MAMOIADA_SYSTEM) /* * MMU0_ID: The data MMU * MMU1_ID: The icache MMU @@ -270,9 +265,6 @@ static const hrt_address MMU_BASE[N_MMU_ID] = { 0x00070000UL, 0x000A0000UL }; -#else -#error "system_local.h: SYSTEM must be one of {2400, 2401 }" -#endif /* DMA */ static const hrt_address DMA_BASE[N_DMA_ID] = { diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 49836016559f..543359d200af 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -460,7 +460,6 @@ void ia_css_debug_dump_isp_state(void) #endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[2] dma_FIFO stalled", stall.fifo2); -#if defined(HAS_ISP_2400_MAMOIADA) || defined(HAS_ISP_2401_MAMOIADA) || defined(IS_ISP_2500_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[3] gdc0_FIFO stalled", stall.fifo3); @@ -472,9 +471,6 @@ void ia_css_debug_dump_isp_state(void) #endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[6] sp_FIFO stalled", stall.fifo6); -#else -#error "ia_css_debug: ISP cell must be one of {2400_MAMOIADA,, 2401_MAMOIADA, 2500_SKYCAM}" -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "status & control stalled", stall.stat_ctrl); @@ -486,14 +482,12 @@ void ia_css_debug_dump_isp_state(void) stall.vamem1); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "vamem2 stalled", stall.vamem2); -#if defined(HAS_ISP_2400_MAMOIADA) || defined(HAS_ISP_2401_MAMOIADA) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "vamem3 stalled", stall.vamem3); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "hmem stalled", stall.hmem); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "pmem stalled", stall.pmem); -#endif } return; } @@ -506,7 +500,6 @@ void ia_css_debug_dump_sp_state(void) sp_get_state(SP0_ID, &state, &stall); debug_print_sp_state(&state, "SP"); if (state.is_stalling) { -#if defined(HAS_SP_2400) || defined(IS_ISP_2500_SYSTEM) #if !defined(HAS_NO_INPUT_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isys_FIFO stalled", stall.fifo0); @@ -537,9 +530,6 @@ void ia_css_debug_dump_sp_state(void) #endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "irq FIFO stalled", stall.fifoa); -#else -#error "ia_css_debug: SP cell must be one of {SP2400, SP2500}" -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dmem stalled", stall.dmem); ia_css_debug_dtrace(2, "\t%-32s: %d\n", diff --git a/drivers/staging/media/atomisp/pci/runtime/tagger/interface/ia_css_tagger_common.h b/drivers/staging/media/atomisp/pci/runtime/tagger/interface/ia_css_tagger_common.h index 285867ea8aa7..49801fbc1924 100644 --- a/drivers/staging/media/atomisp/pci/runtime/tagger/interface/ia_css_tagger_common.h +++ b/drivers/staging/media/atomisp/pci/runtime/tagger/interface/ia_css_tagger_common.h @@ -24,11 +24,7 @@ * * Should be one less than NUM_CONTINUOUS_FRAMES in sh_css_internal.h */ -#if defined(HAS_SP_2400) #define MAX_CB_ELEMS_FOR_TAGGER 14 -#else -#define MAX_CB_ELEMS_FOR_TAGGER 9 -#endif /** * @brief Data structure for the tagger buffer element. diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h index d56188aa8f09..5c25a25dce92 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h @@ -76,11 +76,7 @@ #define SH_CSS_REF_BIT_DEPTH 8 /* keep next up to date with the definition for MAX_CB_ELEMS_FOR_TAGGER in tagger.sp.c */ -#if defined(HAS_SP_2400) #define NUM_CONTINUOUS_FRAMES 15 -#else -#define NUM_CONTINUOUS_FRAMES 10 -#endif #define NUM_MIPI_FRAMES_PER_STREAM 2 #define NUM_ONLINE_INIT_CONTINUOUS_FRAMES 2 @@ -729,15 +725,9 @@ struct sh_css_sp_output { * separate SP thread for this. */ #define IA_CSS_NUM_ELEMS_HOST2SP_ISYS_EVENT_QUEUE (2 * N_CSI_PORTS) -#if defined(HAS_SP_2400) #define IA_CSS_NUM_ELEMS_HOST2SP_PSYS_EVENT_QUEUE 13 #define IA_CSS_NUM_ELEMS_SP2HOST_BUFFER_QUEUE 19 #define IA_CSS_NUM_ELEMS_SP2HOST_PSYS_EVENT_QUEUE 26 /* holds events for all type of buffers, hence deeper */ -#else -#define IA_CSS_NUM_ELEMS_HOST2SP_PSYS_EVENT_QUEUE 6 -#define IA_CSS_NUM_ELEMS_SP2HOST_BUFFER_QUEUE 6 -#define IA_CSS_NUM_ELEMS_SP2HOST_PSYS_EVENT_QUEUE 6 -#endif struct sh_css_hmm_buffer { union { From patchwork Wed Jun 3 07:00:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 792A8C433E1 for ; Wed, 3 Jun 2020 07:02:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A2D320674 for ; Wed, 3 Jun 2020 07:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167730; bh=X6b/gWynMj6O0LBu5lg93RyXNZhB8+OyiX4pPl3hTxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QqhqT9mvHretLPvLS/iaVegyEZFwAVI+74BQtgmN8v5nVSWK7vtvXIJYBhr2rjzLu j17g5qdIxHQ29aehLH0hJ2U8qNoG0AycA3W3loG8se0f49BT52uJnAJLVTd30aQthM +klEEtixc0AeP+ELPlRnFkYUvzCJS7eNNYmERhg8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725944AbgFCHBG (ORCPT ); Wed, 3 Jun 2020 03:01:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:43086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725275AbgFCHBG (ORCPT ); Wed, 3 Jun 2020 03:01:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B85E2068D; Wed, 3 Jun 2020 07:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167665; bh=X6b/gWynMj6O0LBu5lg93RyXNZhB8+OyiX4pPl3hTxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hm2I/uQnEbenI4pv9BwcBiwMDwyP/m8TuPtpk+K4tDvBJkxjQbmh1Nql44CdXSGfq qXUr1Qrp6zL8b2Zo+7sWMHElYFZWtw1pp6jVp+Hlw63GkMK5XpcCyGYsuZ8X52ZDl0 TwbagmK7gz4rqwepI+/IrzXVy4nTvsJRmrtfpd1k= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jgNOZ-004j8Q-BX; Wed, 03 Jun 2020 09:01:03 +0200 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/15] media: atomisp: remove some unused defines from *mamoiada_params.h Date: Wed, 3 Jun 2020 09:00:52 +0200 Message-Id: <58f2e1d429aaa2d77fbcd96694368b7b7e15d963.1591167358.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are some parameters that are different between isp2400 and isp2401. None of those are actually used. So, get rid of them. Signed-off-by: Mauro Carvalho Chehab --- .../hrt/isp2400_mamoiada_params.h | 20 +------------------ .../atomisp/pci/isp2401_mamoiada_params.h | 20 +------------------ 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h b/drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h index 4a2345c38b8c..e18e5f3576df 100644 --- a/drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h +++ b/drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h @@ -16,11 +16,6 @@ /* Version */ #define RTL_VERSION -/* Cell name */ -#define ISP_CELL_TYPE isp2400_mamoiada -#define ISP_VMEM simd_vmem -#define _HRT_ISP_VMEM isp2400_mamoiada_simd_vmem - /* instruction pipeline depth */ #define ISP_BRANCHDELAY 5 @@ -154,12 +149,6 @@ #define ISP_VEC_ALIGN ISP_VMEM_ALIGN -/* HRT specific vector support */ -#define isp2400_mamoiada_vector_alignment ISP_VEC_ALIGN -#define isp2400_mamoiada_vector_elem_bits ISP_VMEM_ELEMBITS -#define isp2400_mamoiada_vector_elem_precision ISP_VMEM_ELEM_PRECISION -#define isp2400_mamoiada_vector_num_elems ISP_VEC_NELEMS - /* register file sizes */ #define ISP_RF0_SIZE 64 #define ISP_RF1_SIZE 16 @@ -173,14 +162,7 @@ #define ISP_RF9_SIZE 16 #define ISP_RF10_SIZE 16 #define ISP_RF11_SIZE 16 -#define ISP_VRF1_SIZE 24 -#define ISP_VRF2_SIZE 24 -#define ISP_VRF3_SIZE 24 -#define ISP_VRF4_SIZE 24 -#define ISP_VRF5_SIZE 24 -#define ISP_VRF6_SIZE 24 -#define ISP_VRF7_SIZE 24 -#define ISP_VRF8_SIZE 24 + #define ISP_SRF1_SIZE 4 #define ISP_SRF2_SIZE 64 #define ISP_SRF3_SIZE 64 diff --git a/drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h b/drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h index 03d3329cd228..e18e5f3576df 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h +++ b/drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h @@ -16,11 +16,6 @@ /* Version */ #define RTL_VERSION -/* Cell name */ -#define ISP_CELL_TYPE isp2401_mamoiada -#define ISP_VMEM simd_vmem -#define _HRT_ISP_VMEM isp2401_mamoiada_simd_vmem - /* instruction pipeline depth */ #define ISP_BRANCHDELAY 5 @@ -154,12 +149,6 @@ #define ISP_VEC_ALIGN ISP_VMEM_ALIGN -/* HRT specific vector support */ -#define isp2401_mamoiada_vector_alignment ISP_VEC_ALIGN -#define isp2401_mamoiada_vector_elem_bits ISP_VMEM_ELEMBITS -#define isp2401_mamoiada_vector_elem_precision ISP_VMEM_ELEM_PRECISION -#define isp2401_mamoiada_vector_num_elems ISP_VEC_NELEMS - /* register file sizes */ #define ISP_RF0_SIZE 64 #define ISP_RF1_SIZE 16 @@ -173,14 +162,7 @@ #define ISP_RF9_SIZE 16 #define ISP_RF10_SIZE 16 #define ISP_RF11_SIZE 16 -#define ISP_VRF1_SIZE 32 -#define ISP_VRF2_SIZE 32 -#define ISP_VRF3_SIZE 32 -#define ISP_VRF4_SIZE 32 -#define ISP_VRF5_SIZE 32 -#define ISP_VRF6_SIZE 32 -#define ISP_VRF7_SIZE 32 -#define ISP_VRF8_SIZE 32 + #define ISP_SRF1_SIZE 4 #define ISP_SRF2_SIZE 64 #define ISP_SRF3_SIZE 64 From patchwork Wed Jun 3 07:00:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2059FC433DF for ; Wed, 3 Jun 2020 07:02:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E65722068D for ; Wed, 3 Jun 2020 07:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167742; bh=zTgcn1xyeisASr5rtVgAA69S8arZoiZGZVVbiDZboIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=C1brOJYjxfttRRHmNN4jHfL+WdiXNLSpFfy5OLTvWQbCI342p2uhGkFxZP1gdrtyb pB4YTS2Nj2Twm+YbcgkwvQ4jihwOU6g+M+zNMep+5mVk6pCYAgSBb4EcU2/zTbREGn dO14ntetoayknBQv6Wh41KOnCFGI/f1RFKXDTAe4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726390AbgFCHCJ (ORCPT ); Wed, 3 Jun 2020 03:02:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:43120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgFCHBG (ORCPT ); Wed, 3 Jun 2020 03:01:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8076A207D3; Wed, 3 Jun 2020 07:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167665; bh=zTgcn1xyeisASr5rtVgAA69S8arZoiZGZVVbiDZboIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3mW5vRx6VtVR1qOohDuchqIYDATutlTjsBRi+9PvVCCjvla3e+vffujS/0ru4xSE kwjiB0ulPpV4ayluWgkbMb9UVL6/z3ArY+K6bEPtZHr491RkrI99EHYSZS2Othjo/K afoZ1WO9OkKYsPV48QR/mE45FZpgzTkLDC98WA/s= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jgNOZ-004j8V-DI; Wed, 03 Jun 2020 09:01:03 +0200 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH 07/15] media: atomisp: use just one mamoiada_params.h Date: Wed, 3 Jun 2020 09:00:53 +0200 Message-Id: <628be9a7bed955aab004b076f5c6a44c32c90ad9.1591167358.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As both isp2400 and isp2401 files are identical, remove one of them and remove the test for ISP variant. Signed-off-by: Mauro Carvalho Chehab --- .../pci/hive_isp_css_common/isp_global.h | 6 +- .../atomisp/pci/isp2401_mamoiada_params.h | 211 ------------------ ...00_mamoiada_params.h => mamoiada_params.h} | 0 3 files changed, 1 insertion(+), 216 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h rename drivers/staging/media/atomisp/pci/{css_2400_system/hrt/isp2400_mamoiada_params.h => mamoiada_params.h} (100%) diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h index 5212d52198bd..5c6891c9b451 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h @@ -18,11 +18,7 @@ #include -#ifdef ISP2401 -#include "isp2401_mamoiada_params.h" -#else -#include "isp2400_mamoiada_params.h" -#endif +#include "mamoiada_params.h" #define ISP_PMEM_WIDTH_LOG2 ISP_LOG2_PMEM_WIDTH #define ISP_PMEM_SIZE ISP_PMEM_DEPTH diff --git a/drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h b/drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h deleted file mode 100644 index e18e5f3576df..000000000000 --- a/drivers/staging/media/atomisp/pci/isp2401_mamoiada_params.h +++ /dev/null @@ -1,211 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * 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. - */ - -/* Version */ -#define RTL_VERSION - -/* instruction pipeline depth */ -#define ISP_BRANCHDELAY 5 - -/* bus */ -#define ISP_BUS_WIDTH 32 -#define ISP_BUS_ADDR_WIDTH 32 -#define ISP_BUS_BURST_SIZE 1 - -/* data-path */ -#define ISP_SCALAR_WIDTH 32 -#define ISP_SLICE_NELEMS 4 -#define ISP_VEC_NELEMS 64 -#define ISP_VEC_ELEMBITS 14 -#define ISP_VEC_ELEM8BITS 16 -#define ISP_CLONE_DATAPATH_IS_16 1 - -/* memories */ -#define ISP_DMEM_DEPTH 4096 -#define ISP_DMEM_BSEL_DOWNSAMPLE 8 -#define ISP_VMEM_DEPTH 3072 -#define ISP_VMEM_BSEL_DOWNSAMPLE 8 -#define ISP_VMEM_ELEMBITS 14 -#define ISP_VMEM_ELEM_PRECISION 14 -#define ISP_PMEM_DEPTH 2048 -#define ISP_PMEM_WIDTH 640 -#define ISP_VAMEM_ADDRESS_BITS 12 -#define ISP_VAMEM_ELEMBITS 12 -#define ISP_VAMEM_DEPTH 2048 -#define ISP_VAMEM_ALIGNMENT 2 -#define ISP_VA_ADDRESS_WIDTH 896 -#define ISP_VEC_VALSU_LATENCY ISP_VEC_NELEMS -#define ISP_HIST_ADDRESS_BITS 12 -#define ISP_HIST_ALIGNMENT 4 -#define ISP_HIST_COMP_IN_PREC 12 -#define ISP_HIST_DEPTH 1024 -#define ISP_HIST_WIDTH 24 -#define ISP_HIST_COMPONENTS 4 - -/* program counter */ -#define ISP_PC_WIDTH 13 - -/* Template switches */ -#define ISP_SHIELD_INPUT_DMEM 0 -#define ISP_SHIELD_OUTPUT_DMEM 1 -#define ISP_SHIELD_INPUT_VMEM 0 -#define ISP_SHIELD_OUTPUT_VMEM 0 -#define ISP_SHIELD_INPUT_PMEM 1 -#define ISP_SHIELD_OUTPUT_PMEM 1 -#define ISP_SHIELD_INPUT_HIST 1 -#define ISP_SHIELD_OUTPUT_HIST 1 -/* When LUT is select the shielding is always on */ -#define ISP_SHIELD_INPUT_VAMEM 1 -#define ISP_SHIELD_OUTPUT_VAMEM 1 - -#define ISP_HAS_IRQ 1 -#define ISP_HAS_SOFT_RESET 1 -#define ISP_HAS_VEC_DIV 0 -#define ISP_HAS_VFU_W_2O 1 -#define ISP_HAS_DEINT3 1 -#define ISP_HAS_LUT 1 -#define ISP_HAS_HIST 1 -#define ISP_HAS_VALSU 1 -#define ISP_HAS_3rdVALSU 1 -#define ISP_VRF1_HAS_2P 1 - -#define ISP_SRU_GUARDING 1 -#define ISP_VLSU_GUARDING 1 - -#define ISP_VRF_RAM 1 -#define ISP_SRF_RAM 1 - -#define ISP_SPLIT_VMUL_VADD_IS 0 -#define ISP_RFSPLIT_FPGA 0 - -/* RSN or Bus pipelining */ -#define ISP_RSN_PIPE 1 -#define ISP_VSF_BUS_PIPE 0 - -/* extra slave port to vmem */ -#define ISP_IF_VMEM 0 -#define ISP_GDC_VMEM 0 - -/* Streaming ports */ -#define ISP_IF 1 -#define ISP_IF_B 1 -#define ISP_GDC 1 -#define ISP_SCL 1 -#define ISP_GPFIFO 1 -#define ISP_SP 1 - -/* Removing Issue Slot(s) */ -#define ISP_HAS_NOT_SIMD_IS2 0 -#define ISP_HAS_NOT_SIMD_IS3 0 -#define ISP_HAS_NOT_SIMD_IS4 0 -#define ISP_HAS_NOT_SIMD_IS4_VADD 0 -#define ISP_HAS_NOT_SIMD_IS5 0 -#define ISP_HAS_NOT_SIMD_IS6 0 -#define ISP_HAS_NOT_SIMD_IS7 0 -#define ISP_HAS_NOT_SIMD_IS8 0 - -/* ICache */ -#define ISP_ICACHE 1 -#define ISP_ICACHE_ONLY 0 -#define ISP_ICACHE_PREFETCH 1 -#define ISP_ICACHE_INDEX_BITS 8 -#define ISP_ICACHE_SET_BITS 5 -#define ISP_ICACHE_BLOCKS_PER_SET_BITS 1 - -/* Experimental Flags */ -#define ISP_EXP_1 0 -#define ISP_EXP_2 0 -#define ISP_EXP_3 0 -#define ISP_EXP_4 0 -#define ISP_EXP_5 0 -#define ISP_EXP_6 0 - -/* Derived values */ -#define ISP_LOG2_PMEM_WIDTH 10 -#define ISP_VEC_WIDTH 896 -#define ISP_SLICE_WIDTH 56 -#define ISP_VMEM_WIDTH 896 -#define ISP_VMEM_ALIGN 128 -#define ISP_SIMDLSU 1 -#define ISP_LSU_IMM_BITS 12 - -/* convenient shortcuts for software*/ -#define ISP_NWAY ISP_VEC_NELEMS -#define NBITS ISP_VEC_ELEMBITS - -#define _isp_ceil_div(a, b) (((a) + (b) - 1) / (b)) - -#define ISP_VEC_ALIGN ISP_VMEM_ALIGN - -/* register file sizes */ -#define ISP_RF0_SIZE 64 -#define ISP_RF1_SIZE 16 -#define ISP_RF2_SIZE 64 -#define ISP_RF3_SIZE 4 -#define ISP_RF4_SIZE 64 -#define ISP_RF5_SIZE 16 -#define ISP_RF6_SIZE 16 -#define ISP_RF7_SIZE 16 -#define ISP_RF8_SIZE 16 -#define ISP_RF9_SIZE 16 -#define ISP_RF10_SIZE 16 -#define ISP_RF11_SIZE 16 - -#define ISP_SRF1_SIZE 4 -#define ISP_SRF2_SIZE 64 -#define ISP_SRF3_SIZE 64 -#define ISP_SRF4_SIZE 32 -#define ISP_SRF5_SIZE 64 -#define ISP_FRF0_SIZE 16 -#define ISP_FRF1_SIZE 4 -#define ISP_FRF2_SIZE 16 -#define ISP_FRF3_SIZE 4 -#define ISP_FRF4_SIZE 4 -#define ISP_FRF5_SIZE 8 -#define ISP_FRF6_SIZE 4 -/* register file read latency */ -#define ISP_VRF1_READ_LAT 1 -#define ISP_VRF2_READ_LAT 1 -#define ISP_VRF3_READ_LAT 1 -#define ISP_VRF4_READ_LAT 1 -#define ISP_VRF5_READ_LAT 1 -#define ISP_VRF6_READ_LAT 1 -#define ISP_VRF7_READ_LAT 1 -#define ISP_VRF8_READ_LAT 1 -#define ISP_SRF1_READ_LAT 1 -#define ISP_SRF2_READ_LAT 1 -#define ISP_SRF3_READ_LAT 1 -#define ISP_SRF4_READ_LAT 1 -#define ISP_SRF5_READ_LAT 1 -#define ISP_SRF5_READ_LAT 1 -/* immediate sizes */ -#define ISP_IS1_IMM_BITS 14 -#define ISP_IS2_IMM_BITS 13 -#define ISP_IS3_IMM_BITS 14 -#define ISP_IS4_IMM_BITS 14 -#define ISP_IS5_IMM_BITS 9 -#define ISP_IS6_IMM_BITS 16 -#define ISP_IS7_IMM_BITS 9 -#define ISP_IS8_IMM_BITS 16 -#define ISP_IS9_IMM_BITS 11 -/* fifo depths */ -#define ISP_IF_FIFO_DEPTH 0 -#define ISP_IF_B_FIFO_DEPTH 0 -#define ISP_DMA_FIFO_DEPTH 0 -#define ISP_OF_FIFO_DEPTH 0 -#define ISP_GDC_FIFO_DEPTH 0 -#define ISP_SCL_FIFO_DEPTH 0 -#define ISP_GPFIFO_FIFO_DEPTH 0 -#define ISP_SP_FIFO_DEPTH 0 diff --git a/drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h b/drivers/staging/media/atomisp/pci/mamoiada_params.h similarity index 100% rename from drivers/staging/media/atomisp/pci/css_2400_system/hrt/isp2400_mamoiada_params.h rename to drivers/staging/media/atomisp/pci/mamoiada_params.h From patchwork Wed Jun 3 07:01:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 328ECC433E1 for ; Wed, 3 Jun 2020 07:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 047EC2068D for ; Wed, 3 Jun 2020 07:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167712; bh=H8ctQ2sg2LU2YVj/bJeUzHXsZxf6SNLpmvCtQX7m0hU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tteBJx/v+hxawls6nb7XRhYRF0QhNytGHFH9hIKP4F3BistFMDN5otyfh0auX403s mcUy4nnf19jL+LW2vc7jqOFfEBs3POiC4LgroNzNEVjTzcbIGs4TZq/q3Q6r8btwjp HwaYkdi4xJq6oSmO3/QRqLngF7yWP68ga6pD+es8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726234AbgFCHBh (ORCPT ); Wed, 3 Jun 2020 03:01:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:43410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgFCHBI (ORCPT ); Wed, 3 Jun 2020 03:01:08 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB80420878; Wed, 3 Jun 2020 07:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167665; bh=H8ctQ2sg2LU2YVj/bJeUzHXsZxf6SNLpmvCtQX7m0hU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jbnpGrbEEdsD6tzbYDQCSomSWUSMun64MUKh4bQZjckH+uz1npGr2DEBtC54Gx/20 ak2SsVY6elKjL7feWhfFP0Rq7kRacGu7dNKAprkDmdQkqKLCMy3dyzZIPlOU0tQtPp TxVRE8iq5JUsitlp2uEXZv8dZ6kn+jLgp16sfFHA= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jgNOZ-004j95-P5; Wed, 03 Jun 2020 09:01:03 +0200 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Hans Verkuil Subject: [PATCH 14/15] media: atomisp: use strscpy() instead of less secure variants Date: Wed, 3 Jun 2020 09:01:00 +0200 Message-Id: <3fca28b47d2f2e7d646013619a16f754f9632c19.1591167358.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Replace usages of strcpy(), strlcpy() and strncpy() in favor of strscpy(). Suggested-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_file.c | 2 +- .../media/atomisp/pci/atomisp_gmin_platform.c | 2 +- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 12 ++++++------ drivers/staging/media/atomisp/pci/atomisp_tpg.c | 2 +- .../staging/media/atomisp/pci/atomisp_trace_event.h | 6 +++--- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 2 +- drivers/staging/media/atomisp/pci/sh_css_sp.c | 3 +-- drivers/staging/media/atomisp/pci/sh_css_version.c | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_file.c b/drivers/staging/media/atomisp/pci/atomisp_file.c index fa92b5eba740..e568ca99c45a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_file.c +++ b/drivers/staging/media/atomisp/pci/atomisp_file.c @@ -219,7 +219,7 @@ int atomisp_file_input_init(struct atomisp_device *isp) v4l2_subdev_init(sd, &file_input_ops); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - strcpy(sd->name, "file_input_subdev"); + strscpy(sd->name, "file_input_subdev", sizeof(sd->name)); v4l2_set_subdevdata(sd, file_dev); pads[0].flags = MEDIA_PAD_FL_SINK; diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index e8f835c3bbae..5d2bfe2ea971 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -936,7 +936,7 @@ static int gmin_get_hardcoded_var(struct gmin_cfg_var *varlist, if (vl > *out_len - 1) return -ENOSPC; - strcpy(out, gv->val); + strscpy(out, gv->val, *out_len); *out_len = vl; return 0; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 15567623b51b..9404a678fa6f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -547,8 +547,8 @@ static int atomisp_querycap(struct file *file, void *fh, struct video_device *vdev = video_devdata(file); struct atomisp_device *isp = video_get_drvdata(vdev); - strscpy(cap->driver, DRIVER, sizeof(cap->driver) - 1); - strscpy(cap->card, CARD, sizeof(cap->card) - 1); + strscpy(cap->driver, DRIVER, sizeof(cap->driver)); + strscpy(cap->card, CARD, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(isp->pdev)); @@ -573,8 +573,8 @@ static int atomisp_enum_input(struct file *file, void *fh, return -EINVAL; memset(input, 0, sizeof(struct v4l2_input)); - strncpy(input->name, isp->inputs[index].camera->name, - sizeof(input->name) - 1); + strscpy(input->name, isp->inputs[index].camera->name, + sizeof(input->name)); /* * HACK: append actuator's name to sensor's @@ -593,8 +593,8 @@ static int atomisp_enum_input(struct file *file, void *fh, if (max_size > 1) { input->name[cur_len] = '+'; - strncpy(&input->name[cur_len + 1], - motor->name, max_size - 1); + strscpy(&input->name[cur_len + 1], + motor->name, max_size); } } diff --git a/drivers/staging/media/atomisp/pci/atomisp_tpg.c b/drivers/staging/media/atomisp/pci/atomisp_tpg.c index 9477ac5e22b9..1def80bab180 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_tpg.c +++ b/drivers/staging/media/atomisp/pci/atomisp_tpg.c @@ -148,7 +148,7 @@ int atomisp_tpg_init(struct atomisp_device *isp) tpg->isp = isp; v4l2_subdev_init(sd, &tpg_ops); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - strcpy(sd->name, "tpg_subdev"); + strscpy(sd->name, "tpg_subdev", sizeof(sd->name)); v4l2_set_subdevdata(sd, tpg); pads[0].flags = MEDIA_PAD_FL_SINK; diff --git a/drivers/staging/media/atomisp/pci/atomisp_trace_event.h b/drivers/staging/media/atomisp/pci/atomisp_trace_event.h index 61f402a642d4..538d45e008b5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_trace_event.h +++ b/drivers/staging/media/atomisp/pci/atomisp_trace_event.h @@ -44,7 +44,7 @@ TRACE_EVENT(camera_meminfo, ), TP_fast_assign( - strlcpy(__entry->name, name, 24); + strscpy(__entry->name, name, 24); __entry->uptr_size = uptr_size; __entry->counter = counter; __entry->sys_size = sys_size; @@ -74,8 +74,8 @@ TRACE_EVENT(camera_debug, ), TP_fast_assign( - strlcpy(__entry->name, name, 24); - strlcpy(__entry->info, info, 24); + strscpy(__entry->name, name, 24); + strscpy(__entry->info, info, 24); __entry->line = line; ), diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 158f11f4f545..e0d08040df6e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1212,7 +1212,7 @@ static int atomisp_register_entities(struct atomisp_device *isp) isp->media_dev.dev = isp->dev; - strlcpy(isp->media_dev.model, "Intel Atom ISP", + strscpy(isp->media_dev.model, "Intel Atom ISP", sizeof(isp->media_dev.model)); media_device_init(&isp->media_dev); diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index 756aad4a6e43..a40020ad699d 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -991,8 +991,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary, /* Make sure binary name is smaller than allowed string size */ assert(strlen(binary_name) < SH_CSS_MAX_BINARY_NAME - 1); - strncpy(sh_css_isp_stage.binary_name, binary_name, SH_CSS_MAX_BINARY_NAME - 1); - sh_css_isp_stage.binary_name[SH_CSS_MAX_BINARY_NAME - 1] = 0; + strscpy(sh_css_isp_stage.binary_name, binary_name, SH_CSS_MAX_BINARY_NAME); sh_css_isp_stage.mem_initializers = *isp_mem_if; /* diff --git a/drivers/staging/media/atomisp/pci/sh_css_version.c b/drivers/staging/media/atomisp/pci/sh_css_version.c index 3ef690d6f2cf..fa6de61e4995 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_version.c +++ b/drivers/staging/media/atomisp/pci/sh_css_version.c @@ -31,7 +31,7 @@ ia_css_get_version(char *version, int max_size) { if (max_size <= (int)strlen(css_version) + (int)strlen(sh_css_get_fw_version()) + 5) return -EINVAL; - strcpy(version, css_version); + strscpy(version, css_version, max_size); strcat(version, "FW:"); strcat(version, sh_css_get_fw_version()); strcat(version, "; "); From patchwork Wed Jun 3 07:01:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E0DAC433E2 for ; Wed, 3 Jun 2020 07:01:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E13520674 for ; Wed, 3 Jun 2020 07:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167693; bh=yEWmdMtfWS+RkXWM/jVffJ8ardkXYMIQy2MCeetwIjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rAJyeVEOw22ccKo84MJbbh14yOB3y4ZXq3BpMMcDX608PhwgAO3tC8SOAUA7xX6Fu DkrsebuwjvsA9mM7HIal/oX0OLqG81TmC6idqjHzSzTh8dpK6HZV/hb9tKbrCPrtCv UObP0WGnPmBOJ3QDH0TD4oLEkgisKyUkIPsYf6Sw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725867AbgFCHBc (ORCPT ); Wed, 3 Jun 2020 03:01:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:43412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbgFCHBJ (ORCPT ); Wed, 3 Jun 2020 03:01:09 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8EEF2087D; Wed, 3 Jun 2020 07:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591167666; bh=yEWmdMtfWS+RkXWM/jVffJ8ardkXYMIQy2MCeetwIjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWwT3pqmxcbM45q/Ny5q3T+WUlRxKPU+34+S6DAhz7aSDaB8PMXzjUF44WeVfNGSy n1dTNLsBg9jhaBCkMOr5xTwjucxLm6knssFQQ+hKDbpZs/g1FTfPQot5BrofpYEQ7L AkCdbjLCEiHsNAzTT+JVYmdGW9KTX5I18AmUP5fE= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jgNOZ-004j9A-QQ; Wed, 03 Jun 2020 09:01:03 +0200 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH 15/15] media: atomisp: get rid of a string_support.h abstraction layer Date: Wed, 3 Jun 2020 09:01:01 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Some parts of the driver have their own implementation of memcpy() & friends. Replace all of them by strscpy(). Signed-off-by: Mauro Carvalho Chehab --- .../pci/hive_isp_css_include/string_support.h | 165 ------------------ .../ctc/ctc_1.0/ia_css_ctc_table.host.c | 3 +- .../kernels/gc/gc_1.0/ia_css_gc_table.host.c | 3 +- .../kernels/gc/gc_2/ia_css_gc2_table.host.c | 3 +- .../xnr/xnr_1.0/ia_css_xnr_table.host.c | 3 +- .../pci/runtime/debug/src/ia_css_debug.c | 45 +++-- .../pci/runtime/isys/src/virtual_isys.c | 29 +-- .../media/atomisp/pci/sh_css_firmware.c | 2 +- 8 files changed, 38 insertions(+), 215 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/string_support.h diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/string_support.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/string_support.h deleted file mode 100644 index 7805b40a1855..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/string_support.h +++ /dev/null @@ -1,165 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * 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 __STRING_SUPPORT_H_INCLUDED__ -#define __STRING_SUPPORT_H_INCLUDED__ -#include -#include - -/* - * For all non microsoft cases, we need the following functions - */ - -/* @brief Copy from src_buf to dest_buf. - * - * @param[out] dest_buf. Destination buffer to copy to - * @param[in] dest_size. The size of the destination buffer in bytes - * @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 ERANGE on Destination size too small - */ -static inline int memcpy_s( - void *dest_buf, - size_t dest_size, - const void *src_buf, - size_t src_size) -{ - if ((!src_buf) || (!dest_buf)) { - /* Invalid arguments*/ - return -EINVAL; - } - - if ((dest_size < src_size) || (src_size == 0)) { - /* Destination too small*/ - return ERANGE; - } - - memcpy(dest_buf, src_buf, src_size); - return 0; -} - -/* @brief Get the length of the string, excluding the null terminator - * - * @param[in] src_str. The source string - * @param[in] max_len. Look only for max_len bytes in the string - * @return Return the string length excluding null character - * @return Return max_len if no null character in the first max_len bytes - * @return Returns 0 if src_str is NULL - */ -static size_t strnlen_s( - const char *src_str, - size_t max_len) -{ - size_t ix; - - if (!src_str) { - /* Invalid arguments*/ - return 0; - } - - for (ix = 0; ix < max_len && src_str[ix] != '\0'; ix++) - ; - - /* On Error, it will return src_size == max_len*/ - return ix; -} - -/* @brief Copy string from src_str to dest_str - * - * @param[out] dest_str. Destination buffer to copy to - * @param[in] dest_size. The size of the destination buffer in bytes - * @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 ERANGE on destination size too small - */ -static inline int strncpy_s( - char *dest_str, - size_t dest_size, - const char *src_str, - size_t src_size) -{ - size_t len; - - if (!dest_str) { - /* Invalid arguments*/ - return -EINVAL; - } - - if ((!src_str) || (dest_size == 0)) { - /* Invalid arguments*/ - dest_str[0] = '\0'; - return -EINVAL; - } - - len = strnlen_s(src_str, src_size); - - if (len >= dest_size) { - /* Destination too small*/ - dest_str[0] = '\0'; - return ERANGE; - } - - /* dest_str is big enough for the len */ - strncpy(dest_str, src_str, len); - dest_str[len] = '\0'; - return 0; -} - -/* @brief Copy string from src_str to dest_str - * - * @param[out] dest_str. Destination buffer to copy to - * @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 ERANGE on destination size too small - */ -static inline int strcpy_s( - char *dest_str, - size_t dest_size, - const char *src_str) -{ - size_t len; - - if (!dest_str) { - /* Invalid arguments*/ - return -EINVAL; - } - - if ((!src_str) || (dest_size == 0)) { - /* Invalid arguments*/ - dest_str[0] = '\0'; - return -EINVAL; - } - - len = strnlen_s(src_str, dest_size); - - if (len >= dest_size) { - /* Destination too small*/ - dest_str[0] = '\0'; - return ERANGE; - } - - /* dest_str is big enough for the len */ - strncpy(dest_str, src_str, len); - dest_str[len] = '\0'; - return 0; -} - -#endif /* __STRING_SUPPORT_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c index 454697c05b56..f13b79586963 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c @@ -13,8 +13,9 @@ * more details. */ +#include /* for memcpy() */ + #include -#include /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h" diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c index 08e173fff6e0..f48f876777dc 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c @@ -13,8 +13,9 @@ * more details. */ +#include /* for memcpy() */ + #include -#include /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h" diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c index fddb9e2ec24e..7eadb31268eb 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c @@ -13,8 +13,9 @@ * more details. */ +#include /* for memcpy() */ + #include -#include /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h" diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c index b892dd8ebc2e..5566f3c16aac 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c @@ -13,8 +13,9 @@ * more details. */ +#include /* for memcpy() */ + #include -#include /* memcpy */ #include "system_global.h" #include "vamem.h" #include "ia_css_types.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index f64d8243400b..2bca27a04b02 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -31,6 +31,8 @@ #define __INLINE_STREAM2MMIO__ #endif +#include /* for strscpy() */ + #include "ia_css_debug.h" #include "ia_css_debug_pipe.h" #include "ia_css_irq.h" @@ -47,7 +49,6 @@ #include "system_local.h" #include "assert_support.h" #include "print_support.h" -#include "string_support.h" #include "fifo_monitor.h" @@ -2769,8 +2770,9 @@ ia_css_debug_pipe_graph_dump_stage( stage->binary->info->blob->name, stage->stage_num); } else if (stage->firmware) { bin_type = "firmware"; - strncpy_s(blob_name, sizeof(blob_name), - IA_CSS_EXT_ISP_PROG_NAME(stage->firmware), sizeof(blob_name)); + + strscpy(blob_name, IA_CSS_EXT_ISP_PROG_NAME(stage->firmware), + sizeof(blob_name)); } /* Guard in case of binaries that don't have any binary_info */ @@ -2836,10 +2838,8 @@ ia_css_debug_pipe_graph_dump_stage( while (ei[p] != ',') p--; /* Last comma found, copy till that comma */ - strncpy_s(enable_info1, - sizeof(enable_info1), - ei, p); - enable_info1[p] = '\0'; + strscpy(enable_info1, ei, + p > sizeof(enable_info1) ? sizeof(enable_info1) : p); ei += p + 1; l = strlen(ei); @@ -2849,10 +2849,10 @@ ia_css_debug_pipe_graph_dump_stage( /* we cannot use ei as argument because * it is not guaranteed dword aligned */ - strncpy_s(enable_info2, - sizeof(enable_info2), - ei, l); - enable_info2[l] = '\0'; + + strscpy(enable_info2, ei, + l > sizeof(enable_info2) ? sizeof(enable_info2) : l); + snprintf(enable_info, sizeof(enable_info), "%s\\n%s", enable_info1, enable_info2); @@ -2861,10 +2861,10 @@ ia_css_debug_pipe_graph_dump_stage( p = ENABLE_LINE_MAX_LENGTH; while (ei[p] != ',') p--; - strncpy_s(enable_info2, - sizeof(enable_info2), - ei, p); - enable_info2[p] = '\0'; + + strscpy(enable_info2, ei, + p > sizeof(enable_info2) ? sizeof(enable_info2) : p); + ei += p + 1; l = strlen(ei); @@ -2873,9 +2873,8 @@ ia_css_debug_pipe_graph_dump_stage( /* we cannot use ei as argument because * it is not guaranteed dword aligned */ - strcpy_s(enable_info3, - sizeof(enable_info3), ei); - enable_info3[l] = '\0'; + strscpy(enable_info3, ei, + sizeof(enable_info3)); snprintf(enable_info, sizeof(enable_info), "%s\\n%s\\n%s", enable_info1, enable_info2, @@ -2885,13 +2884,11 @@ ia_css_debug_pipe_graph_dump_stage( p = ENABLE_LINE_MAX_LENGTH; while (ei[p] != ',') p--; - strncpy_s(enable_info3, - sizeof(enable_info3), - ei, p); - enable_info3[p] = '\0'; + strscpy(enable_info3, ei, + p > sizeof(enable_info3) ? sizeof(enable_info3) : p); ei += p + 1; - strcpy_s(enable_info3, - sizeof(enable_info3), ei); + strscpy(enable_info3, ei, + sizeof(enable_info3)); snprintf(enable_info, sizeof(enable_info), "%s\\n%s\\n%s", enable_info1, enable_info2, diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c index 95cf6ac342b6..b3c6831cb9e3 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c @@ -13,6 +13,8 @@ * more details. */ +#include /* for memcpy() */ + #include "system_global.h" #ifdef USE_INPUT_SYSTEM_VERSION_2401 @@ -20,7 +22,6 @@ #include "ia_css_isys.h" #include "ia_css_debug.h" #include "math_support.h" -#include "string_support.h" #include "virtual_isys.h" #include "isp.h" #include "sh_css_defs.h" @@ -650,14 +651,8 @@ static bool calculate_tpg_cfg( input_system_cfg_t *isys_cfg, pixelgen_tpg_cfg_t *cfg) { - (void)channel; - (void)input_port; + memcpy(cfg, &isys_cfg->tpg_port_attr, sizeof(pixelgen_tpg_cfg_t)); - memcpy_s( - (void *)cfg, - sizeof(pixelgen_tpg_cfg_t), - (void *)(&isys_cfg->tpg_port_attr), - sizeof(pixelgen_tpg_cfg_t)); return true; } @@ -667,14 +662,8 @@ static bool calculate_prbs_cfg( input_system_cfg_t *isys_cfg, pixelgen_prbs_cfg_t *cfg) { - (void)channel; - (void)input_port; + memcpy(cfg, &isys_cfg->prbs_port_attr, sizeof(pixelgen_prbs_cfg_t)); - memcpy_s( - (void *)cfg, - sizeof(pixelgen_prbs_cfg_t), - (void *)(&isys_cfg->prbs_port_attr), - sizeof(pixelgen_prbs_cfg_t)); return true; } @@ -692,12 +681,10 @@ static bool calculate_be_cfg( bool metadata, csi_rx_backend_cfg_t *cfg) { - memcpy_s( - (void *)(&cfg->lut_entry), - sizeof(csi_rx_backend_lut_entry_t), - metadata ? (void *)(&input_port->metadata.backend_lut_entry) : - (void *)(&input_port->csi_rx.backend_lut_entry), - sizeof(csi_rx_backend_lut_entry_t)); + memcpy(&cfg->lut_entry, + metadata ? &input_port->metadata.backend_lut_entry : + &input_port->csi_rx.backend_lut_entry, + sizeof(csi_rx_backend_lut_entry_t)); cfg->csi_mipi_cfg.virtual_channel = isys_cfg->csi_port_attr.ch_id; if (metadata) { diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index d464052a3d2d..2daee7d85631 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c @@ -13,6 +13,7 @@ * more details. */ +#include /* for memcpy() */ #include #include @@ -28,7 +29,6 @@ #include "ia_css_isp_param.h" #include "assert_support.h" -#include "string_support.h" #include "isp.h" /* PMEM_WIDTH_LOG2 */