From 1fb38e4ef65f95c5c633a260595029d5fcc6d912 Mon Sep 17 00:00:00 2001 From: Georgiana Chelu Date: Wed, 20 Sep 2017 05:28:46 -0700 Subject: Staging: media: atomisp: Use unsigned int instead of unsigned Fix the checkpatch.pl issue: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Georgiana Chelu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/media') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 05897b747349..b7f22b7a94b0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -155,7 +155,7 @@ static void atomisp_css2_hw_store(hrt_address addr, const void *from, uint32_t n) { unsigned long flags; - unsigned i; + unsigned int i; unsigned int _to = (unsigned int)addr; const char *_from = (const char *)from; @@ -168,7 +168,7 @@ static void atomisp_css2_hw_store(hrt_address addr, static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n) { unsigned long flags; - unsigned i; + unsigned int i; char *_to = (char *)to; unsigned int _from = (unsigned int)addr; @@ -4659,7 +4659,7 @@ int atomisp_css_dump_sp_raw_copy_linecount(bool reduced) int atomisp_css_dump_blob_infor(void) { struct ia_css_blob_descr *bd = sh_css_blob_info; - unsigned i, nm = sh_css_num_binaries; + unsigned int i, nm = sh_css_num_binaries; if (nm == 0) return -EPERM; -- cgit v1.2.3 From 6b78cffc99fc1b9bb1a039e95978dba69c1f994a Mon Sep 17 00:00:00 2001 From: Georgiana Chelu Date: Wed, 20 Sep 2017 05:28:47 -0700 Subject: Staging: media: atomisp: Add blank line after declarations This patch adds a blank line after declarations to improve code readability. Issue find by checkpatch.pl script. WARNING: Missing a blank line after declarations Signed-off-by: Georgiana Chelu Signed-off-by: Greg Kroah-Hartman --- .../staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/staging/media') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index b7f22b7a94b0..55519348026d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -232,9 +232,11 @@ static void __dump_pipe_config(struct atomisp_sub_device *asd, unsigned int pipe_id) { struct atomisp_device *isp = asd->isp; + if (stream_env->pipes[pipe_id]) { struct ia_css_pipe_config *p_config; struct ia_css_pipe_extra_config *pe_config; + p_config = &stream_env->pipe_configs[pipe_id]; pe_config = &stream_env->pipe_extra_configs[pipe_id]; dev_dbg(isp->dev, "dumping pipe[%d] config:\n", pipe_id); @@ -507,6 +509,7 @@ static int __destroy_stream(struct atomisp_sub_device *asd, static int __destroy_streams(struct atomisp_sub_device *asd, bool force) { int ret, i; + for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) { ret = __destroy_stream(asd, &asd->stream_env[i], force); if (ret) @@ -573,6 +576,7 @@ static int __destroy_stream_pipes(struct atomisp_sub_device *asd, struct atomisp_device *isp = asd->isp; int ret = 0; int i; + for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) { if (!stream_env->pipes[i] || !(force || stream_env->update_pipe[i])) @@ -1051,6 +1055,7 @@ int atomisp_css_irq_enable(struct atomisp_device *isp, void atomisp_css_init_struct(struct atomisp_sub_device *asd) { int i, j; + for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) { asd->stream_env[i].stream = NULL; for (j = 0; j < IA_CSS_PIPE_MODE_NUM; j++) { @@ -1189,6 +1194,7 @@ int atomisp_css_start(struct atomisp_sub_device *asd, struct atomisp_device *isp = asd->isp; bool sp_is_started = false; int ret = 0, i = 0; + if (in_reset) { if (__destroy_streams(asd, true)) dev_warn(isp->dev, "destroy stream failed.\n"); @@ -1976,6 +1982,7 @@ void atomisp_css_enable_raw_binning(struct atomisp_sub_device *asd, void atomisp_css_enable_dz(struct atomisp_sub_device *asd, bool enable) { int i; + for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL] .pipe_configs[i].enable_dz = enable; @@ -2002,6 +2009,7 @@ void atomisp_css_input_set_mode(struct atomisp_sub_device *asd, int i; struct atomisp_device *isp = asd->isp; unsigned int size_mem_words; + for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) asd->stream_env[i].stream_config.mode = mode; @@ -2275,6 +2283,7 @@ int atomisp_css_stop(struct atomisp_sub_device *asd, if (!in_reset) { struct atomisp_stream_env *stream_env; int i, j; + for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) { stream_env = &asd->stream_env[i]; for (j = 0; j < IA_CSS_PIPE_ID_NUM; j++) { @@ -2801,6 +2810,7 @@ static void __configure_video_vf_output(struct atomisp_sub_device *asd, struct atomisp_stream_env *stream_env = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]; struct ia_css_frame_info *css_output_info; + stream_env->pipe_configs[pipe_id].mode = __pipe_id_to_pipe_mode(asd, pipe_id); stream_env->update_pipe[pipe_id] = true; -- cgit v1.2.3 From 7dfff5dadcbbc13ba4dc68d1b50f6bdab122df1a Mon Sep 17 00:00:00 2001 From: Georgiana Chelu Date: Wed, 20 Sep 2017 05:28:48 -0700 Subject: Staging: media: atomisp: pci: Move open brace '{' on the next line Fix the following issue found by checkpatch.pl: ERROR: open brace '{' following function definitions go on the next line Signed-off-by: Georgiana Chelu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging/media') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 55519348026d..520d59bda3bd 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -4474,7 +4474,8 @@ int atomisp_css_load_acc_binary(struct atomisp_sub_device *asd, static struct atomisp_sub_device *__get_atomisp_subdev( struct ia_css_pipe *css_pipe, struct atomisp_device *isp, - enum atomisp_input_stream_id *stream_id) { + enum atomisp_input_stream_id *stream_id) +{ int i, j, k; struct atomisp_sub_device *asd; struct atomisp_stream_env *stream_env; -- cgit v1.2.3 From 80fe133a9a8dfa95111f1d30ca60ee05a9f00cc6 Mon Sep 17 00:00:00 2001 From: Georgiana Chelu Date: Wed, 20 Sep 2017 05:28:49 -0700 Subject: Staging: media: atomisp: pci: Place constant on the right side in comparissons Fix issue found by checkpatch.pl script. WARNING: Comparisons should place the constant on the right side of the test Signed-off-by: Georgiana Chelu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/media') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 520d59bda3bd..5027fd20d966 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -896,12 +896,12 @@ static inline int __set_css_print_env(struct atomisp_device *isp, int opt) { int ret = 0; - if (0 == opt) + if (opt == 0) isp->css_env.isp_css_env.print_env.debug_print = NULL; - else if (1 == opt) + else if (opt == 1) isp->css_env.isp_css_env.print_env.debug_print = atomisp_css2_dbg_ftrace_print; - else if (2 == opt) + else if (opt == 2) isp->css_env.isp_css_env.print_env.debug_print = atomisp_css2_dbg_print; else @@ -4706,7 +4706,7 @@ int atomisp_set_css_dbgfunc(struct atomisp_device *isp, int opt) int ret; ret = __set_css_print_env(isp, opt); - if (0 == ret) + if (ret == 0) dbg_func = opt; return ret; -- cgit v1.2.3 From 4d962df5a7771c90da738de0d24c3828fe23e060 Mon Sep 17 00:00:00 2001 From: Aishwarya Pant Date: Fri, 22 Sep 2017 11:43:13 +0530 Subject: atomisp2: remove cast from memory allocation Patch removes the following warning issued was coccicheck: WARNING: casting value returned by memory allocation function to (char *) is useless. Signed-off-by: Aishwarya Pant Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging/media') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c index 63582161050a..53a7891111f9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c @@ -145,8 +145,8 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, struct ia size_t configstruct_size = sizeof(struct ia_css_config_memory_offsets); size_t statestruct_size = sizeof(struct ia_css_state_memory_offsets); - char *parambuf = (char *)kmalloc(paramstruct_size + configstruct_size + statestruct_size, - GFP_KERNEL); + char *parambuf = kmalloc(paramstruct_size + configstruct_size + statestruct_size, + GFP_KERNEL); if (parambuf == NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; -- cgit v1.2.3 From 63342e75e661c1b71a0f33a4329726bcf383b342 Mon Sep 17 00:00:00 2001 From: Georgiana Chelu Date: Tue, 26 Sep 2017 09:01:29 -0700 Subject: Staging: media: atomisp: Use kmalloc_array instead of kmalloc Prefer kmalloc_array over kmalloc with multiply because kmalloc_array performs additional checks before memory allocation. Fix the following issue reported by checkpatch.pl: * WARNING: Prefer kmalloc_array over kmalloc with multiply Signed-off-by: Georgiana Chelu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/media') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c index 11162f595fc7..5232327f5d9c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c @@ -725,7 +725,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo, pgnr = bo->pgnr; - bo->page_obj = kmalloc(sizeof(struct hmm_page_object) * pgnr, + bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object), GFP_KERNEL); if (unlikely(!bo->page_obj)) { dev_err(atomisp_dev, "out of memory for bo->page_obj\n"); @@ -990,13 +990,13 @@ static int alloc_user_pages(struct hmm_buffer_object *bo, struct vm_area_struct *vma; struct page **pages; - pages = kmalloc(sizeof(struct page *) * bo->pgnr, GFP_KERNEL); + pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL); if (unlikely(!pages)) { dev_err(atomisp_dev, "out of memory for pages...\n"); return -ENOMEM; } - bo->page_obj = kmalloc(sizeof(struct hmm_page_object) * bo->pgnr, + bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object), GFP_KERNEL); if (unlikely(!bo->page_obj)) { dev_err(atomisp_dev, "out of memory for bo->page_obj...\n"); @@ -1363,7 +1363,7 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached) bo->status &= ~(HMM_BO_VMAPED | HMM_BO_VMAPED_CACHED); } - pages = kmalloc(sizeof(*pages) * bo->pgnr, GFP_KERNEL); + pages = kmalloc_array(bo->pgnr, sizeof(*pages), GFP_KERNEL); if (unlikely(!pages)) { mutex_unlock(&bo->mutex); dev_err(atomisp_dev, "out of memory for pages...\n"); -- cgit v1.2.3 From 6e047ac922d8dd1293bdb9778bf2f2c0d699e9c6 Mon Sep 17 00:00:00 2001 From: Branislav Radocaj Date: Tue, 10 Oct 2017 15:29:19 +0200 Subject: Staging: bcm2048 fix bare use of 'unsigned' in radio-bcm2048.c This is a patch to the radio-bcm2048.c file that fixes up a warning found by the checkpatch.pl tool. Signed-off-by: Branislav Radocaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'drivers/staging/media') diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 58adaea44eb5..5d3b0e5a1283 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -1964,7 +1964,7 @@ static ssize_t bcm2048_##prop##_write(struct device *dev, \ return err < 0 ? err : count; \ } -#define property_read(prop, size, mask) \ +#define property_read(prop, mask) \ static ssize_t bcm2048_##prop##_read(struct device *dev, \ struct device_attribute *attr, \ char *buf) \ @@ -1999,9 +1999,9 @@ static ssize_t bcm2048_##prop##_read(struct device *dev, \ return sprintf(buf, mask "\n", value); \ } -#define DEFINE_SYSFS_PROPERTY(prop, signal, size, mask, check) \ -property_write(prop, signal size, mask, check) \ -property_read(prop, size, mask) +#define DEFINE_SYSFS_PROPERTY(prop, prop_type, mask, check) \ +property_write(prop, prop_type, mask, check) \ +property_read(prop, mask) \ #define property_str_read(prop, size) \ static ssize_t bcm2048_##prop##_read(struct device *dev, \ @@ -2027,39 +2027,39 @@ static ssize_t bcm2048_##prop##_read(struct device *dev, \ return count; \ } -DEFINE_SYSFS_PROPERTY(power_state, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(mute, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(audio_route, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(dac_output, unsigned, int, "%u", 0) - -DEFINE_SYSFS_PROPERTY(fm_hi_lo_injection, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_frequency, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_af_frequency, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_deemphasis, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_rds_mask, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_best_tune_mode, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_search_rssi_threshold, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_search_mode_direction, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(fm_search_tune_mode, unsigned, int, "%u", value > 3) - -DEFINE_SYSFS_PROPERTY(rds, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(rds_b_block_mask, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(rds_b_block_match, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(rds_pi_mask, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(rds_pi_match, unsigned, int, "%u", 0) -DEFINE_SYSFS_PROPERTY(rds_wline, unsigned, int, "%u", 0) -property_read(rds_pi, unsigned int, "%x") +DEFINE_SYSFS_PROPERTY(power_state, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(mute, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(audio_route, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(dac_output, unsigned int, "%u", 0) + +DEFINE_SYSFS_PROPERTY(fm_hi_lo_injection, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_frequency, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_af_frequency, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_deemphasis, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_rds_mask, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_best_tune_mode, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_search_rssi_threshold, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_search_mode_direction, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(fm_search_tune_mode, unsigned int, "%u", value > 3) + +DEFINE_SYSFS_PROPERTY(rds, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(rds_b_block_mask, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(rds_b_block_match, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(rds_pi_mask, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(rds_pi_match, unsigned int, "%u", 0) +DEFINE_SYSFS_PROPERTY(rds_wline, unsigned int, "%u", 0) +property_read(rds_pi, "%x") property_str_read(rds_rt, (BCM2048_MAX_RDS_RT + 1)) property_str_read(rds_ps, (BCM2048_MAX_RDS_PS + 1)) -property_read(fm_rds_flags, unsigned int, "%u") +property_read(fm_rds_flags, "%u") property_str_read(rds_data, BCM2048_MAX_RDS_RADIO_TEXT * 5) -property_read(region_bottom_frequency, unsigned int, "%u") -property_read(region_top_frequency, unsigned int, "%u") +property_read(region_bottom_frequency, "%u") +property_read(region_top_frequency, "%u") property_signed_read(fm_carrier_error, int, "%d") property_signed_read(fm_rssi, int, "%d") -DEFINE_SYSFS_PROPERTY(region, unsigned, int, "%u", 0) +DEFINE_SYSFS_PROPERTY(region, unsigned int, "%u", 0) static struct device_attribute attrs[] = { __ATTR(power_state, 0644, bcm2048_power_state_read, -- cgit v1.2.3