Skip to contentSkip to conversation

media: staging: rkisp1 stats: set a measure flag with '|=' instead of '='

PATCH In review Dafna Hirschfeld 4 participants 8 messages May 9, 2020 – May 26, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 media: staging: rkisp1 stats: set a measure flag with '|=' instead of '='

The flag RKISP1_CIF_ISP_STAT_AFM_FIN that indicates a type of statistics is mistakenly set with '=' instead of '|=' this might set off previous flags.

---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +1 -1
index 6dfcbdc3deb8..8351bda0be03 100644
@@ -253,7 +253,7 @@ static void rkisp1_stats_get_afc_meas(struct rkisp1_stats *stats,
 	struct rkisp1_device *rkisp1 = stats->rkisp1;
 	struct rkisp1_cif_isp_af_stat *af;
 
-	pbuf->meas_type = RKISP1_CIF_ISP_STAT_AFM_FIN;
+	pbuf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;
 
 	af = &pbuf->params.af;
 	af->window[0].sum = rkisp1_read(rkisp1, RKISP1_CIF_ISP_AFM_SUM_A);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 media: staging: rkisp1: stats: don't set stats flags in rkisp1_stats_send_measurement

The flags that indicate which statistics are read are already set in the functions that read them so there is no need to set them in the function rkisp1_stats_send_measurement.

---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +3 -10
index 8351bda0be03..0616793ae395 100644
@@ -356,26 +356,19 @@ rkisp1_stats_send_measurement(struct rkisp1_stats *stats,
 	cur_stat_buf =
 		(struct rkisp1_stat_buffer *)(cur_buf->vaddr[0]);
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE)
 		rkisp1_stats_get_awb_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AWB;
-	}
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN)
 		rkisp1_stats_get_afc_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;
-	}
 
 	if (meas_work->isp_ris & RKISP1_CIF_ISP_EXP_END) {
 		rkisp1_stats_get_aec_meas(stats, cur_stat_buf);
 		rkisp1_stats_get_bls_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AUTOEXP;
 	}
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY)
 		rkisp1_stats_get_hst_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_HIST;
-	}
 
 	vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0,
 			      sizeof(struct rkisp1_stat_buffer));
Signature · 1 line
2.17.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] media: staging: rkisp1: stats: don't set stats flags in rkisp1_stats_send_measurement

Quoted 5 lines · Dafna Hirschfeld

The flags that indicate which statistics are read are already set in the functions that read them so there is no need to set them in the function rkisp1_stats_send_measurement.

Thanks
Helen

Quoted 39 lines
---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +3 -10
index 8351bda0be03..0616793ae395 100644
@@ -356,26 +356,19 @@ rkisp1_stats_send_measurement(struct rkisp1_stats *stats,
 	cur_stat_buf =
 		(struct rkisp1_stat_buffer *)(cur_buf->vaddr[0]);
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE)
 		rkisp1_stats_get_awb_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AWB;
-	}
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN)
 		rkisp1_stats_get_afc_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;
-	}
 
 	if (meas_work->isp_ris & RKISP1_CIF_ISP_EXP_END) {
 		rkisp1_stats_get_aec_meas(stats, cur_stat_buf);
 		rkisp1_stats_get_bls_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AUTOEXP;
 	}
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY)
 		rkisp1_stats_get_hst_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_HIST;
-	}
 
 	vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0,
 			      sizeof(struct rkisp1_stat_buffer));
Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] media: staging: rkisp1: stats: don't set stats flags in rkisp1_stats_send_measurement

In reply to Dafna Hirschfeld

Hi Dafna,

Thank you for the patch.

Quoted 5 lines · Dafna Hirschfeld

The flags that indicate which statistics are read are already set in the functions that read them so there is no need to set them in the function rkisp1_stats_send_measurement.

Quoted 38 lines
---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +3 -10
index 8351bda0be03..0616793ae395 100644
@@ -356,26 +356,19 @@ rkisp1_stats_send_measurement(struct rkisp1_stats *stats,
 	cur_stat_buf =
 		(struct rkisp1_stat_buffer *)(cur_buf->vaddr[0]);
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE)
 		rkisp1_stats_get_awb_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AWB;
-	}
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN)
 		rkisp1_stats_get_afc_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;
-	}
 
 	if (meas_work->isp_ris & RKISP1_CIF_ISP_EXP_END) {
 		rkisp1_stats_get_aec_meas(stats, cur_stat_buf);
 		rkisp1_stats_get_bls_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AUTOEXP;
 	}
 
-	if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY) {
+	if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY)
 		rkisp1_stats_get_hst_meas(stats, cur_stat_buf);
-		cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_HIST;
-	}
 
 	vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0,
 			      sizeof(struct rkisp1_stat_buffer));
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

Re: [PATCH 2/2] media: staging: rkisp1: stats: don't set stats flags in rkisp1_stats_send_measurement

In reply to Dafna Hirschfeld
Quoted 15 lines · Dafna Hirschfeld

The flags that indicate which statistics are read are already set in the functions that read them so there is no need to set them in the function rkisp1_stats_send_measurement.

---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +0 -0
index 8351bda0be03..0616793ae395 100644

drivers/staging/media/rkisp1/rkisp1-stats.c rkisp1_stats_send_measurement(struct rkisp1_stats *stats, · line 358

Quoted 3 lines
drivers/staging/media/rkisp1/rkisp1-stats.c +0 -0
@@ -356,26 +356,19 @@ rkisp1_stats_send_measurement(struct rkisp1_stats *stats,
        cur_stat_buf =
                (struct rkisp1_stat_buffer *)(cur_buf->vaddr[0]);
 

Should we perhaps also set cur_stat_buf->meas_type to 0 here?

drivers/staging/media/rkisp1/rkisp1-stats.c rkisp1_stats_send_measurement(struct rkisp1_stats *stats, · line 361

Quoted 4 lines
drivers/staging/media/rkisp1/rkisp1-stats.c +1 -2
-       if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE) {
+       if (meas_work->isp_ris & RKISP1_CIF_ISP_AWB_DONE)
                rkisp1_stats_get_awb_meas(stats, cur_stat_buf);
-               cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AWB;

I wonder if it wouldn't be cleaner if this function took care of meas_type, rather than sprinkling it all over the measurement collection functions.

Quoted 25 lines
drivers/staging/media/rkisp1/rkisp1-stats.c +2 -9
-       }
 
-       if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN) {
+       if (meas_work->isp_ris & RKISP1_CIF_ISP_AFM_FIN)
                rkisp1_stats_get_afc_meas(stats, cur_stat_buf);
-               cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;
-       }
 
        if (meas_work->isp_ris & RKISP1_CIF_ISP_EXP_END) {
                rkisp1_stats_get_aec_meas(stats, cur_stat_buf);
                rkisp1_stats_get_bls_meas(stats, cur_stat_buf);
-               cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_AUTOEXP;
        }
 
-       if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY) {
+       if (meas_work->isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY)
                rkisp1_stats_get_hst_meas(stats, cur_stat_buf);
-               cur_stat_buf->meas_type |= RKISP1_CIF_ISP_STAT_HIST;
-       }
 
        vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0,
                              sizeof(struct rkisp1_stat_buffer));
--

2.17.1

#5 lore raw
In reply to Dafna Hirschfeld

Hi Dafna,

Thanks for the patch.

Quoted 14 lines · Dafna Hirschfeld

The flag RKISP1_CIF_ISP_STAT_AFM_FIN that indicates a type of statistics is mistakenly set with '=' instead of '|=' this might set off previous flags.

---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +0 -0
index 6dfcbdc3deb8..8351bda0be03 100644

drivers/staging/media/rkisp1/rkisp1-stats.c static void rkisp1_stats_get_afc_meas(struct rkisp1_stats *stats, · line 256

Quoted 5 lines
drivers/staging/media/rkisp1/rkisp1-stats.c +1 -1
@@ -253,7 +253,7 @@ static void rkisp1_stats_get_afc_meas(struct rkisp1_stats *stats,
 	struct rkisp1_device *rkisp1 = stats->rkisp1;
 	struct rkisp1_cif_isp_af_stat *af;
 
-	pbuf->meas_type = RKISP1_CIF_ISP_STAT_AFM_FIN;
+	pbuf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;

It seems there is a redundancy, the place that calls this function already sets this bit. It seems there is a similar issue in all rkisp1_stats_get_* functions.

Could you please check and do the proper cleanup?

Thanks
Helen

Quoted 4 lines
drivers/staging/media/rkisp1/rkisp1-stats.c +0 -0
 	af = &pbuf->params.af;
 	af->window[0].sum = rkisp1_read(rkisp1, RKISP1_CIF_ISP_AFM_SUM_A);
 
Acked-by
#6 lore raw
Quoted 22 lines · Helen Koike

Hi Dafna,

Thanks for the patch.

Quoted 17 lines · Dafna Hirschfeld

The flag RKISP1_CIF_ISP_STAT_AFM_FIN that indicates a type of statistics is mistakenly set with '=' instead of '|=' this might set off previous flags.

---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +0 -0
index 6dfcbdc3deb8..8351bda0be03 100644
@@ -253,7 +253,7 @@ static void rkisp1_stats_get_afc_meas(struct rkisp1_stats *stats,
 	struct rkisp1_device *rkisp1 = stats->rkisp1;
 	struct rkisp1_cif_isp_af_stat *af;
 
Quoted 7 lines

drivers/staging/media/rkisp1/rkisp1-stats.c static void rkisp1_stats_get_afc_meas(struct rkisp1_stats *stats, · line 256

Quoted 2 lines
drivers/staging/media/rkisp1/rkisp1-stats.c +1 -1
-	pbuf->meas_type = RKISP1_CIF_ISP_STAT_AFM_FIN;
+	pbuf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;

It seems there is a redundancy, the place that calls this function already sets this bit. It seems there is a similar issue in all rkisp1_stats_get_* functions.

Could you please check and do the proper cleanup?

Please ignore my comment, for some reason I didn't see the second patch.

Thanks
Helen

Quoted 8 lines

Thanks
Helen

Quoted 4 lines
drivers/staging/media/rkisp1/rkisp1-stats.c +0 -0
 	af = &pbuf->params.af;
 	af->window[0].sum = rkisp1_read(rkisp1, RKISP1_CIF_ISP_AFM_SUM_A);
 
Reviewed-by on v1 1/2
#7 lore raw
In reply to Dafna Hirschfeld

Hi Dafna,

Thank you for the patch.

Quoted 5 lines · Dafna Hirschfeld

The flag RKISP1_CIF_ISP_STAT_AFM_FIN that indicates a type of statistics is mistakenly set with '=' instead of '|=' this might set off previous flags.

Quoted 17 lines
---
 drivers/staging/media/rkisp1/rkisp1-stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkisp1/rkisp1-stats.c +1 -1
index 6dfcbdc3deb8..8351bda0be03 100644
@@ -253,7 +253,7 @@ static void rkisp1_stats_get_afc_meas(struct rkisp1_stats *stats,
 	struct rkisp1_device *rkisp1 = stats->rkisp1;
 	struct rkisp1_cif_isp_af_stat *af;
 
-	pbuf->meas_type = RKISP1_CIF_ISP_STAT_AFM_FIN;
+	pbuf->meas_type |= RKISP1_CIF_ISP_STAT_AFM_FIN;
 
 	af = &pbuf->params.af;
 	af->window[0].sum = rkisp1_read(rkisp1, RKISP1_CIF_ISP_AFM_SUM_A);
Signature · 3 lines
Regards,

Laurent Pinchart