2021-05-06 20:31:00

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH] staging: media: atomisp: remove useless breaks

Breaks are not useful after a return, they can
simply be removed.

Signed-off-by: Pavel Skripkin <[email protected]>
---
.../pci/hive_isp_css_common/host/input_system.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index 0f5a231672a8..fd82997b11cc 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -904,16 +904,12 @@ static input_system_err_t input_system_configure_channel(
break;
case INPUT_SYSTEM_SOURCE_TPG:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_PRBS:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_FIFO:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

if (error != INPUT_SYSTEM_ERR_NO_ERROR) return error;
@@ -995,7 +991,6 @@ static input_system_err_t input_buffer_configuration(void)
default:
config.csi_buffer_flags[port] |= INPUT_SYSTEM_CFG_FLAG_CONFLICT;
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

// Check acquisition buffer specified but set it later since it has to be unique.
@@ -1032,7 +1027,6 @@ static input_system_err_t input_buffer_configuration(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
} else {
config.csi_buffer_flags[port] = INPUT_SYSTEM_CFG_FLAG_BLOCKED;
@@ -1319,7 +1313,6 @@ static input_system_err_t configuration_to_registers(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;

} // end of switch (source_type)

@@ -1696,16 +1689,12 @@ static input_system_err_t input_system_configure_channel_sensor(
break;
case INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_CAPTURE:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_ACQUIRE:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
return INPUT_SYSTEM_ERR_NO_ERROR;
}
--
2.31.1


2021-05-07 09:08:29

by Sakari Ailus

[permalink] [raw]
Subject: Re: [PATCH] staging: media: atomisp: remove useless breaks

Hi Pavel,

On Thu, May 06, 2021 at 11:09:56PM +0300, Pavel Skripkin wrote:
> Breaks are not useful after a return, they can
> simply be removed.
>
> Signed-off-by: Pavel Skripkin <[email protected]>
> ---
> .../pci/hive_isp_css_common/host/input_system.c | 11 -----------
> 1 file changed, 11 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
> index 0f5a231672a8..fd82997b11cc 100644
> --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
> +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
> @@ -904,16 +904,12 @@ static input_system_err_t input_system_configure_channel(
> break;
> case INPUT_SYSTEM_SOURCE_TPG:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> case INPUT_SYSTEM_SOURCE_PRBS:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> case INPUT_SYSTEM_SOURCE_FIFO:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;

While at it, you could drop the individual return statements, too. There
seems to be another such location at the end of the patch.

> - break;
> default:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> }
>
> if (error != INPUT_SYSTEM_ERR_NO_ERROR) return error;
> @@ -995,7 +991,6 @@ static input_system_err_t input_buffer_configuration(void)
> default:
> config.csi_buffer_flags[port] |= INPUT_SYSTEM_CFG_FLAG_CONFLICT;
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> }
>
> // Check acquisition buffer specified but set it later since it has to be unique.
> @@ -1032,7 +1027,6 @@ static input_system_err_t input_buffer_configuration(void)
>
> default:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> }
> } else {
> config.csi_buffer_flags[port] = INPUT_SYSTEM_CFG_FLAG_BLOCKED;
> @@ -1319,7 +1313,6 @@ static input_system_err_t configuration_to_registers(void)
>
> default:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
>
> } // end of switch (source_type)
>
> @@ -1696,16 +1689,12 @@ static input_system_err_t input_system_configure_channel_sensor(
> break;
> case INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> case INPUT_SYSTEM_XMEM_CAPTURE:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> case INPUT_SYSTEM_XMEM_ACQUIRE:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> default:
> return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> - break;
> }
> return INPUT_SYSTEM_ERR_NO_ERROR;
> }

--
Regards,

Sakari Ailus

2021-05-07 17:11:14

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH] staging: media: atomisp: remove useless breaks

On Fri, 7 May 2021 10:54:58 +0300
Sakari Ailus <[email protected]> wrote:

Hi, Sakari!

> Hi Pavel,
>
> On Thu, May 06, 2021 at 11:09:56PM +0300, Pavel Skripkin wrote:
> > Breaks are not useful after a return, they can
> > simply be removed.
> >
> > Signed-off-by: Pavel Skripkin <[email protected]>
> > ---
> > .../pci/hive_isp_css_common/host/input_system.c | 11
> > ----------- 1 file changed, 11 deletions(-)
> >
> > diff --git
> > a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
> > b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
> > index 0f5a231672a8..fd82997b11cc 100644 ---
> > a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
> > +++
> > b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
> > @@ -904,16 +904,12 @@ static input_system_err_t
> > input_system_configure_channel( break; case
> > INPUT_SYSTEM_SOURCE_TPG: return
> > INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > case INPUT_SYSTEM_SOURCE_PRBS:
> > return
> > INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > case INPUT_SYSTEM_SOURCE_FIFO:
> > return
> > INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
>
> While at it, you could drop the individual return statements, too.
> There seems to be another such location at the end of the patch.
>

Good catch, I will remove them in v2.

Also, I noticed, that there are returns in the end of void functions.
Can I remove them too in v2, or it should be done as another patch?

> > - break;
> > default:
> > return
> > INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > }
> >
> > if (error != INPUT_SYSTEM_ERR_NO_ERROR) return
> > error; @@ -995,7 +991,6 @@ static input_system_err_t
> > input_buffer_configuration(void) default:
> > config.csi_buffer_flags[port] |=
> > INPUT_SYSTEM_CFG_FLAG_CONFLICT; return
> > INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > }
> >
> > // Check acquisition buffer specified but
> > set it later since it has to be unique. @@ -1032,7 +1027,6 @@
> > static input_system_err_t input_buffer_configuration(void)
> > default:
> > return
> > INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > }
> > } else {
> > config.csi_buffer_flags[port] =
> > INPUT_SYSTEM_CFG_FLAG_BLOCKED; @@ -1319,7 +1313,6 @@ static
> > input_system_err_t configuration_to_registers(void)
> > default:
> > return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> >
> > } // end of switch (source_type)
> >
> > @@ -1696,16 +1689,12 @@ static input_system_err_t
> > input_system_configure_channel_sensor( break;
> > case INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING:
> > return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > case INPUT_SYSTEM_XMEM_CAPTURE:
> > return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > case INPUT_SYSTEM_XMEM_ACQUIRE:
> > return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > default:
> > return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
> > - break;
> > }
> > return INPUT_SYSTEM_ERR_NO_ERROR;
> > }
>




With regards,
Pavel Skripkin

2021-05-08 10:53:25

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v2] staging: media: atomisp: code cleanup

Breaks are not useful after a return, they can
simply be removed.

Also, dropped the individual return statements
after or inside switch cases

Signed-off-by: Pavel Skripkin <[email protected]>
---
Changes in v2:
dropped the individual return statements
---
.../hive_isp_css_common/host/input_system.c | 18 ------------------
1 file changed, 18 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index 0f5a231672a8..cbaaec620581 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -903,17 +903,10 @@ static input_system_err_t input_system_configure_channel(
error = input_system_configure_channel_sensor(channel);
break;
case INPUT_SYSTEM_SOURCE_TPG:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_PRBS:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_FIFO:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

if (error != INPUT_SYSTEM_ERR_NO_ERROR) return error;
@@ -995,7 +988,6 @@ static input_system_err_t input_buffer_configuration(void)
default:
config.csi_buffer_flags[port] |= INPUT_SYSTEM_CFG_FLAG_CONFLICT;
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

// Check acquisition buffer specified but set it later since it has to be unique.
@@ -1032,7 +1024,6 @@ static input_system_err_t input_buffer_configuration(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
} else {
config.csi_buffer_flags[port] = INPUT_SYSTEM_CFG_FLAG_BLOCKED;
@@ -1319,7 +1310,6 @@ static input_system_err_t configuration_to_registers(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;

} // end of switch (source_type)

@@ -1695,19 +1685,11 @@ static input_system_err_t input_system_configure_channel_sensor(

break;
case INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_CAPTURE:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_ACQUIRE:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
- return INPUT_SYSTEM_ERR_NO_ERROR;
}

// Test flags and set structure.
--
2.31.1

2021-05-08 10:59:36

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] staging: media: atomisp: code cleanup

On Sat, May 08, 2021 at 01:51:29PM +0300, Pavel Skripkin wrote:
> Breaks are not useful after a return, they can
> simply be removed.
>
> Also, dropped the individual return statements
> after or inside switch cases

Almost always, when you say "also" in a patch changelog, that means this
should be split up into two different patches.

I recommend doing that here as well, this should be a 2 patch series,
right?

thanks,

greg k-h

2021-05-08 11:35:12

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH v2] staging: media: atomisp: code cleanup

Hi, Greg!

On Sat, 8 May 2021 12:58:06 +0200
Greg KH <[email protected]> wrote:

> On Sat, May 08, 2021 at 01:51:29PM +0300, Pavel Skripkin wrote:
> > Breaks are not useful after a return, they can
> > simply be removed.
> >
> > Also, dropped the individual return statements
> > after or inside switch cases
>
> Almost always, when you say "also" in a patch changelog, that means
> this should be split up into two different patches.
>

I thought, I could add this to current patch, because It was suggested
by maintainer, but, I guess, I was wrong :)

> I recommend doing that here as well, this should be a 2 patch series,
> right?
>

Thanks for suggestion! I will also remove returns at the end of void
functions as 3rd patch in serie.

> thanks,
>
> greg k-h

With regards,
Pavel Skripkin

2021-05-08 12:24:04

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v3 0/3] staging: media: atomisp: code clean up

This patch series includes code clean up for input_system.c.

Changes from v3:
Removed returns at the end of void functions
Split all changes into 3 patches

Changes from v2:
Removed useless returns

Pavel Skripkin (3):
staging: media: atomisp: remove useless breaks
staging: media: atomisp: remove dublicate code
staging: media: atomisp: remove useless returns

.../hive_isp_css_common/host/input_system.c | 62 -------------------
1 file changed, 62 deletions(-)

--
2.31.1

2021-05-08 12:24:04

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v3 1/3] staging: media: atomisp: remove useless breaks

Breaks are not useful after a return, they can
simply be removed.

Signed-off-by: Pavel Skripkin <[email protected]>
---
.../pci/hive_isp_css_common/host/input_system.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index 0f5a231672a8..fd82997b11cc 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -904,16 +904,12 @@ static input_system_err_t input_system_configure_channel(
break;
case INPUT_SYSTEM_SOURCE_TPG:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_PRBS:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_FIFO:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

if (error != INPUT_SYSTEM_ERR_NO_ERROR) return error;
@@ -995,7 +991,6 @@ static input_system_err_t input_buffer_configuration(void)
default:
config.csi_buffer_flags[port] |= INPUT_SYSTEM_CFG_FLAG_CONFLICT;
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

// Check acquisition buffer specified but set it later since it has to be unique.
@@ -1032,7 +1027,6 @@ static input_system_err_t input_buffer_configuration(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
} else {
config.csi_buffer_flags[port] = INPUT_SYSTEM_CFG_FLAG_BLOCKED;
@@ -1319,7 +1313,6 @@ static input_system_err_t configuration_to_registers(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;

} // end of switch (source_type)

@@ -1696,16 +1689,12 @@ static input_system_err_t input_system_configure_channel_sensor(
break;
case INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_CAPTURE:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_ACQUIRE:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
return INPUT_SYSTEM_ERR_NO_ERROR;
}
--
2.31.1

2021-05-08 12:27:33

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v3 3/3] staging: media: atomisp: remove useless returns

Breaks are not useful at the end of void function,
they can simply be removed.

Signed-off-by: Pavel Skripkin <[email protected]>
---
.../hive_isp_css_common/host/input_system.c | 38 -------------------
1 file changed, 38 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index 76414b6b43c9..8e085dda0c18 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -174,8 +174,6 @@ void input_system_get_state(
ctrl_unit_get_state(ID, sub_id,
&state->ctrl_unit_state[sub_id - CTRL_UNIT0_ID]);
}
-
- return;
}

void receiver_get_state(
@@ -246,8 +244,6 @@ void receiver_get_state(
_HRT_CSS_RECEIVER_BE_IRQ_STATUS_REG_IDX);
state->be_irq_clear = receiver_reg_load(ID,
_HRT_CSS_RECEIVER_BE_IRQ_CLEAR_REG_IDX);
-
- return;
}

bool is_mipi_format_yuv420(
@@ -310,8 +306,6 @@ void receiver_set_compression(
reg = ((field_id < 6) ? (val << (field_id * 5)) : (val << ((
field_id - 6) * 5)));
receiver_reg_store(ID, addr, reg);
-
- return;
}

void receiver_port_enable(
@@ -330,7 +324,6 @@ void receiver_port_enable(

receiver_port_reg_store(ID, port_ID,
_HRT_CSS_RECEIVER_DEVICE_READY_REG_IDX, reg);
- return;
}

bool is_receiver_port_enabled(
@@ -349,7 +342,6 @@ void receiver_irq_enable(
{
receiver_port_reg_store(ID,
port_ID, _HRT_CSS_RECEIVER_IRQ_ENABLE_REG_IDX, irq_info);
- return;
}

rx_irq_info_t receiver_get_irq_info(
@@ -367,7 +359,6 @@ void receiver_irq_clear(
{
receiver_port_reg_store(ID,
port_ID, _HRT_CSS_RECEIVER_IRQ_STATUS_REG_IDX, irq_info);
- return;
}

static inline void capture_unit_get_state(
@@ -428,8 +419,6 @@ static inline void capture_unit_get_state(
state->FSM_State_Info = input_system_sub_system_reg_load(ID,
sub_id,
CAPT_FSM_STATE_INFO_REG_ID);
-
- return;
}

static inline void acquisition_unit_get_state(
@@ -478,8 +467,6 @@ static inline void acquisition_unit_get_state(
state->Int_Cntr_Info = input_system_sub_system_reg_load(ID,
sub_id,
ACQ_INT_CNTR_INFO_REG_ID);
-
- return;
}

static inline void ctrl_unit_get_state(
@@ -561,8 +548,6 @@ static inline void ctrl_unit_get_state(
state->capt_reserve_one_mem_region = input_system_sub_system_reg_load(ID,
sub_id,
ISYS_CTRL_CAPT_RESERVE_ONE_MEM_REGION_REG_ID);
-
- return;
}

static inline void mipi_port_get_state(
@@ -597,8 +582,6 @@ static inline void mipi_port_get_state(
state->lane_sync_count[i] = (uint8_t)((state->sync_count) >> (i * 8));
state->lane_rx_count[i] = (uint8_t)((state->rx_count) >> (i * 8));
}
-
- return;
}

static inline void rx_channel_get_state(
@@ -652,8 +635,6 @@ static inline void rx_channel_get_state(
state->comp[i] = (mipi_compressor_t)(val & 0x07);
state->pred[i] = (mipi_predictor_t)((val & 0x18) >> 3);
}
-
- return;
}

// MW: "2400" in the name is not good, but this is to avoid a naming conflict
@@ -672,8 +653,6 @@ static void receiver_rst(
}

// AM: Additional actions for stopping receiver?
-
- return;
}

//Single function to reset all the devices mapped via GP_DEVICE.
@@ -722,8 +701,6 @@ static void gp_device_rst(const gp_device_ID_t ID)
// gp_device_reg_store(ID, _REG_GP_SYNCGEN_FRAME_CNT_ADDR, ZERO);
gp_device_reg_store(ID, _REG_GP_SOFT_RESET_ADDR,
ZERO); // AM: Maybe this soft reset is not safe.
-
- return;
}

static void input_selector_cfg_for_sensor(const gp_device_ID_t ID)
@@ -740,8 +717,6 @@ static void input_selector_cfg_for_sensor(const gp_device_ID_t ID)
gp_device_reg_store(ID, _REG_GP_ISEL_SBAND_SEL_ADDR, ZERO);
gp_device_reg_store(ID, _REG_GP_ISEL_SYNC_SEL_ADDR, ZERO);
gp_device_reg_store(ID, _REG_GP_SOFT_RESET_ADDR, ZERO);
-
- return;
}

static void input_switch_rst(const gp_device_ID_t ID)
@@ -760,8 +735,6 @@ static void input_switch_rst(const gp_device_ID_t ID)
gp_device_reg_store(ID,
_REG_GP_IFMT_input_switch_fsync_lut,
ZERO);
-
- return;
}

static void input_switch_cfg(
@@ -786,8 +759,6 @@ static void input_switch_cfg(
gp_device_reg_store(ID,
_REG_GP_IFMT_input_switch_fsync_lut,
cfg->vsync_data_reg);
-
- return;
}

static void input_system_network_rst(const input_system_ID_t ID)
@@ -843,8 +814,6 @@ static void input_system_network_rst(const input_system_ID_t ID)
ISYS_CTRL_INIT_REG_ID,
1U); //AM: Is there any named constant?
}
-
- return;
}

// Function that resets current configuration.
@@ -1072,8 +1041,6 @@ static void capture_unit_configure(
sub_id,
CAPT_NUM_MEM_REGIONS_REG_ID,
cfg->nof_mem_regs);
-
- return;
}

static void acquisition_unit_configure(
@@ -1097,8 +1064,6 @@ static void acquisition_unit_configure(
sub_id,
ACQ_MEM_REGION_SIZE_REG_ID,
cfg->mem_reg_size);
-
- return;
}

static void ctrl_unit_configure(
@@ -1165,7 +1130,6 @@ static void ctrl_unit_configure(
sub_id,
ISYS_CTRL_CAPT_RESERVE_ONE_MEM_REGION_REG_ID,
0);
- return;
}

static void input_system_network_configure(
@@ -1223,8 +1187,6 @@ static void input_system_network_configure(
sub_id,
&cfg->ctrl_unit_cfg[sub_id - CTRL_UNIT0_ID]);
}
-
- return;
}

static input_system_err_t configuration_to_registers(void)
--
2.31.1

2021-05-08 12:44:31

by Fabio Aiuto

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] staging: media: atomisp: remove useless returns

Hi Pavel,

On Sat, May 08, 2021 at 03:21:52PM +0300, Pavel Skripkin wrote:
> Breaks are not useful at the end of void function,
> they can simply be removed.

this commit description is not really describing the changes that
have been made

>
> Signed-off-by: Pavel Skripkin <[email protected]>

thank you,

fabio

2021-05-08 12:49:49

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] staging: media: atomisp: remove useless returns

On Sat, May 08, 2021 at 02:43:35PM +0200, Fabio Aiuto wrote:
> Hi Pavel,
>
> On Sat, May 08, 2021 at 03:21:52PM +0300, Pavel Skripkin wrote:
> > Breaks are not useful at the end of void function,
> > they can simply be removed.
>
> this commit description is not really describing the changes that
> have been made
>

Pavel clearly intended to say "Returns" instead of "Breaks". But when
you're complaining about commit messages please write a better one so
the people can cut and paste it.

regards,
dan carpenter

2021-05-08 13:01:10

by Fabio Aiuto

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] staging: media: atomisp: remove useless returns

On Sat, May 08, 2021 at 03:48:41PM +0300, Dan Carpenter wrote:
> On Sat, May 08, 2021 at 02:43:35PM +0200, Fabio Aiuto wrote:
> > Hi Pavel,
> >
> > On Sat, May 08, 2021 at 03:21:52PM +0300, Pavel Skripkin wrote:
> > > Breaks are not useful at the end of void function,
> > > they can simply be removed.
> >
> > this commit description is not really describing the changes that
> > have been made
> >
>
> Pavel clearly intended to say "Returns" instead of "Breaks". But when
> you're complaining about commit messages please write a better one so
> the people can cut and paste it.
>
> regards,
> dan carpenter
>

got it, thank you Dan, and sorry Pavel

fabio

2021-05-08 13:08:04

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] staging: media: atomisp: remove useless returns

Hi, Fabio!

On Sat, 8 May 2021 14:43:35 +0200
Fabio Aiuto <[email protected]> wrote:

> Hi Pavel,
>
> On Sat, May 08, 2021 at 03:21:52PM +0300, Pavel Skripkin wrote:
> > Breaks are not useful at the end of void function,
> > they can simply be removed.
>
> this commit description is not really describing the changes that
> have been made
>

oh..., it's copy-paste error. Thank you for pointing it out :)
Will fix it in v4

> >
> > Signed-off-by: Pavel Skripkin <[email protected]>
>
> thank you,
>
> fabio


With regards,
Pavel Skripkin

2021-05-08 13:18:47

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v4 0/3] staging: media: atomisp: code clean up

This patch series include code clean up for input_system.c.

Changes from v4:
Fixed commit message in 3rd patch

Changes from v3:
Removed returns at the end of void functions
Split all changes into 3 patches

Changes from v2:
Removed useless returns


Pavel Skripkin (3):
staging: media: atomisp: remove useless breaks
staging: media: atomisp: remove dublicate code
staging: media: atomisp: remove useless returns

.../hive_isp_css_common/host/input_system.c | 62 -------------------
1 file changed, 62 deletions(-)

--
2.31.1

2021-05-08 13:18:49

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v4 1/3] staging: media: atomisp: remove useless breaks

Breaks are not useful after a return, they can
simply be removed.

Signed-off-by: Pavel Skripkin <[email protected]>
---
.../pci/hive_isp_css_common/host/input_system.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index 0f5a231672a8..fd82997b11cc 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -904,16 +904,12 @@ static input_system_err_t input_system_configure_channel(
break;
case INPUT_SYSTEM_SOURCE_TPG:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_PRBS:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_SOURCE_FIFO:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

if (error != INPUT_SYSTEM_ERR_NO_ERROR) return error;
@@ -995,7 +991,6 @@ static input_system_err_t input_buffer_configuration(void)
default:
config.csi_buffer_flags[port] |= INPUT_SYSTEM_CFG_FLAG_CONFLICT;
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}

// Check acquisition buffer specified but set it later since it has to be unique.
@@ -1032,7 +1027,6 @@ static input_system_err_t input_buffer_configuration(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
} else {
config.csi_buffer_flags[port] = INPUT_SYSTEM_CFG_FLAG_BLOCKED;
@@ -1319,7 +1313,6 @@ static input_system_err_t configuration_to_registers(void)

default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;

} // end of switch (source_type)

@@ -1696,16 +1689,12 @@ static input_system_err_t input_system_configure_channel_sensor(
break;
case INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_CAPTURE:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
case INPUT_SYSTEM_XMEM_ACQUIRE:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
- break;
}
return INPUT_SYSTEM_ERR_NO_ERROR;
}
--
2.31.1

2021-05-08 13:20:09

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v4 2/3] staging: media: atomisp: remove dublicate code

Removed dublicate returns and breaks inside switch
statements and useless return after switch.

Signed-off-by: Pavel Skripkin <[email protected]>
---
.../pci/hive_isp_css_common/host/input_system.c | 13 -------------
1 file changed, 13 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index fd82997b11cc..76414b6b43c9 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -903,11 +903,8 @@ static input_system_err_t input_system_configure_channel(
error = input_system_configure_channel_sensor(channel);
break;
case INPUT_SYSTEM_SOURCE_TPG:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
case INPUT_SYSTEM_SOURCE_PRBS:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
case INPUT_SYSTEM_SOURCE_FIFO:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
}
@@ -1301,13 +1298,7 @@ static input_system_err_t configuration_to_registers(void)
break;

case INPUT_SYSTEM_SOURCE_TPG:
-
- break;
-
case INPUT_SYSTEM_SOURCE_PRBS:
-
- break;
-
case INPUT_SYSTEM_SOURCE_FIFO:
break;

@@ -1688,15 +1679,11 @@ static input_system_err_t input_system_configure_channel_sensor(

break;
case INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
case INPUT_SYSTEM_XMEM_CAPTURE:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
case INPUT_SYSTEM_XMEM_ACQUIRE:
- return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
default:
return INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED;
}
- return INPUT_SYSTEM_ERR_NO_ERROR;
}

// Test flags and set structure.
--
2.31.1

2021-05-08 13:20:55

by Pavel Skripkin

[permalink] [raw]
Subject: [PATCH v4 3/3] staging: media: atomisp: remove useless returns

Returns are not useful at the end of void functions,
they can simply be removed.

Signed-off-by: Pavel Skripkin <[email protected]>
---
.../hive_isp_css_common/host/input_system.c | 38 -------------------
1 file changed, 38 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index 76414b6b43c9..8e085dda0c18 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -174,8 +174,6 @@ void input_system_get_state(
ctrl_unit_get_state(ID, sub_id,
&state->ctrl_unit_state[sub_id - CTRL_UNIT0_ID]);
}
-
- return;
}

void receiver_get_state(
@@ -246,8 +244,6 @@ void receiver_get_state(
_HRT_CSS_RECEIVER_BE_IRQ_STATUS_REG_IDX);
state->be_irq_clear = receiver_reg_load(ID,
_HRT_CSS_RECEIVER_BE_IRQ_CLEAR_REG_IDX);
-
- return;
}

bool is_mipi_format_yuv420(
@@ -310,8 +306,6 @@ void receiver_set_compression(
reg = ((field_id < 6) ? (val << (field_id * 5)) : (val << ((
field_id - 6) * 5)));
receiver_reg_store(ID, addr, reg);
-
- return;
}

void receiver_port_enable(
@@ -330,7 +324,6 @@ void receiver_port_enable(

receiver_port_reg_store(ID, port_ID,
_HRT_CSS_RECEIVER_DEVICE_READY_REG_IDX, reg);
- return;
}

bool is_receiver_port_enabled(
@@ -349,7 +342,6 @@ void receiver_irq_enable(
{
receiver_port_reg_store(ID,
port_ID, _HRT_CSS_RECEIVER_IRQ_ENABLE_REG_IDX, irq_info);
- return;
}

rx_irq_info_t receiver_get_irq_info(
@@ -367,7 +359,6 @@ void receiver_irq_clear(
{
receiver_port_reg_store(ID,
port_ID, _HRT_CSS_RECEIVER_IRQ_STATUS_REG_IDX, irq_info);
- return;
}

static inline void capture_unit_get_state(
@@ -428,8 +419,6 @@ static inline void capture_unit_get_state(
state->FSM_State_Info = input_system_sub_system_reg_load(ID,
sub_id,
CAPT_FSM_STATE_INFO_REG_ID);
-
- return;
}

static inline void acquisition_unit_get_state(
@@ -478,8 +467,6 @@ static inline void acquisition_unit_get_state(
state->Int_Cntr_Info = input_system_sub_system_reg_load(ID,
sub_id,
ACQ_INT_CNTR_INFO_REG_ID);
-
- return;
}

static inline void ctrl_unit_get_state(
@@ -561,8 +548,6 @@ static inline void ctrl_unit_get_state(
state->capt_reserve_one_mem_region = input_system_sub_system_reg_load(ID,
sub_id,
ISYS_CTRL_CAPT_RESERVE_ONE_MEM_REGION_REG_ID);
-
- return;
}

static inline void mipi_port_get_state(
@@ -597,8 +582,6 @@ static inline void mipi_port_get_state(
state->lane_sync_count[i] = (uint8_t)((state->sync_count) >> (i * 8));
state->lane_rx_count[i] = (uint8_t)((state->rx_count) >> (i * 8));
}
-
- return;
}

static inline void rx_channel_get_state(
@@ -652,8 +635,6 @@ static inline void rx_channel_get_state(
state->comp[i] = (mipi_compressor_t)(val & 0x07);
state->pred[i] = (mipi_predictor_t)((val & 0x18) >> 3);
}
-
- return;
}

// MW: "2400" in the name is not good, but this is to avoid a naming conflict
@@ -672,8 +653,6 @@ static void receiver_rst(
}

// AM: Additional actions for stopping receiver?
-
- return;
}

//Single function to reset all the devices mapped via GP_DEVICE.
@@ -722,8 +701,6 @@ static void gp_device_rst(const gp_device_ID_t ID)
// gp_device_reg_store(ID, _REG_GP_SYNCGEN_FRAME_CNT_ADDR, ZERO);
gp_device_reg_store(ID, _REG_GP_SOFT_RESET_ADDR,
ZERO); // AM: Maybe this soft reset is not safe.
-
- return;
}

static void input_selector_cfg_for_sensor(const gp_device_ID_t ID)
@@ -740,8 +717,6 @@ static void input_selector_cfg_for_sensor(const gp_device_ID_t ID)
gp_device_reg_store(ID, _REG_GP_ISEL_SBAND_SEL_ADDR, ZERO);
gp_device_reg_store(ID, _REG_GP_ISEL_SYNC_SEL_ADDR, ZERO);
gp_device_reg_store(ID, _REG_GP_SOFT_RESET_ADDR, ZERO);
-
- return;
}

static void input_switch_rst(const gp_device_ID_t ID)
@@ -760,8 +735,6 @@ static void input_switch_rst(const gp_device_ID_t ID)
gp_device_reg_store(ID,
_REG_GP_IFMT_input_switch_fsync_lut,
ZERO);
-
- return;
}

static void input_switch_cfg(
@@ -786,8 +759,6 @@ static void input_switch_cfg(
gp_device_reg_store(ID,
_REG_GP_IFMT_input_switch_fsync_lut,
cfg->vsync_data_reg);
-
- return;
}

static void input_system_network_rst(const input_system_ID_t ID)
@@ -843,8 +814,6 @@ static void input_system_network_rst(const input_system_ID_t ID)
ISYS_CTRL_INIT_REG_ID,
1U); //AM: Is there any named constant?
}
-
- return;
}

// Function that resets current configuration.
@@ -1072,8 +1041,6 @@ static void capture_unit_configure(
sub_id,
CAPT_NUM_MEM_REGIONS_REG_ID,
cfg->nof_mem_regs);
-
- return;
}

static void acquisition_unit_configure(
@@ -1097,8 +1064,6 @@ static void acquisition_unit_configure(
sub_id,
ACQ_MEM_REGION_SIZE_REG_ID,
cfg->mem_reg_size);
-
- return;
}

static void ctrl_unit_configure(
@@ -1165,7 +1130,6 @@ static void ctrl_unit_configure(
sub_id,
ISYS_CTRL_CAPT_RESERVE_ONE_MEM_REGION_REG_ID,
0);
- return;
}

static void input_system_network_configure(
@@ -1223,8 +1187,6 @@ static void input_system_network_configure(
sub_id,
&cfg->ctrl_unit_cfg[sub_id - CTRL_UNIT0_ID]);
}
-
- return;
}

static input_system_err_t configuration_to_registers(void)
--
2.31.1

2021-05-25 18:00:32

by Sakari Ailus

[permalink] [raw]
Subject: Re: [PATCH v4 0/3] staging: media: atomisp: code clean up

On Sat, May 08, 2021 at 04:16:47PM +0300, Pavel Skripkin wrote:
> This patch series include code clean up for input_system.c.
>
> Changes from v4:
> Fixed commit message in 3rd patch
>
> Changes from v3:
> Removed returns at the end of void functions
> Split all changes into 3 patches
>
> Changes from v2:
> Removed useless returns
>
>
> Pavel Skripkin (3):
> staging: media: atomisp: remove useless breaks
> staging: media: atomisp: remove dublicate code
> staging: media: atomisp: remove useless returns
>
> .../hive_isp_css_common/host/input_system.c | 62 -------------------
> 1 file changed, 62 deletions(-)

Acked-by: Sakari Ailus <[email protected]>

--
Sakari Ailus