Skip to contentSkip to conversation

drm/i915: Make sure our labels start at column 0

PATCH In review Damien Lespiau 6 participants 9 messages Jun 4, 2015 – Jun 15, 2015

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

PATCH 1/1 drm/i915: Make sure our labels start at column 0

I noticed one of those and it turned out we have a few lingering around.

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index a96f181..2354927 100644
@@ -6980,7 +6980,7 @@ static int i965gm_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%04x\n", vco, tmp);
 	return 200000;
 }
@@ -7021,7 +7021,7 @@ static int g33_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%08x\n", vco, tmp);
 	return 190476;
 }
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 8193a35..f5965fb 100644
@@ -1189,6 +1189,6 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
- out:
+out:
 	return ret;
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 1 line · Damien Lespiau

I noticed one of those and it turned out we have a few lingering around.

Yuck. I'd prefer we got the other way. Consider the following diffs for example:

drivers/gpu/drm/i915/intel_dp.c +1 -0
index 7f6fd85..342509d 100644
@@ -942,6 +942,7 @@ out:
 
 	pps_unlock(intel_dp);
 
+	// foo
 	return ret;
 }
 
drivers/gpu/drm/i915/intel_dp.c +1 -0
index 5901e00..2673347 100644
@@ -942,6 +942,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 
 	pps_unlock(intel_dp);
 
+	// foo
 	return ret;
 }
 
Quoted 48 lines
---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index a96f181..2354927 100644
@@ -6980,7 +6980,7 @@ static int i965gm_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%04x\n", vco, tmp);
 	return 200000;
 }
@@ -7021,7 +7021,7 @@ static int g33_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%08x\n", vco, tmp);
 	return 190476;
 }
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 8193a35..f5965fb 100644
@@ -1189,6 +1189,6 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
- out:
+out:
 	return ret;
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#2 lore raw
Quoted 4 lines · Ville Syrjälä
Quoted 1 line · Damien Lespiau

I noticed one of those and it turned out we have a few lingering around.

Yuck. I'd prefer we got the other way. Consider the following diffs for example:

What's the, uh, diff between those to consider?

Anyway, a quick git grep popularity contest within the kernel tree and checkpatch (WARNING: labels should not be indented) tell me to go with Damien.

BR,
Jani.

Quoted 81 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
index 7f6fd85..342509d 100644
@@ -942,6 +942,7 @@ out:
 
 	pps_unlock(intel_dp);
 
+	// foo
 	return ret;
 }
 
drivers/gpu/drm/i915/intel_dp.c +1 -0
index 5901e00..2673347 100644
@@ -942,6 +942,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 
 	pps_unlock(intel_dp);
 
+	// foo
 	return ret;
 }
 
Quoted 48 lines
---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index a96f181..2354927 100644
@@ -6980,7 +6980,7 @@ static int i965gm_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%04x\n", vco, tmp);
 	return 200000;
 }
@@ -7021,7 +7021,7 @@ static int g33_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%08x\n", vco, tmp);
 	return 190476;
 }
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 8193a35..f5965fb 100644
@@ -1189,6 +1189,6 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
- out:
+out:
 	return ret;
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 7 lines · Jani Nikula
Quoted 4 lines · Ville Syrjälä
Quoted 1 line · Damien Lespiau

I noticed one of those and it turned out we have a few lingering around.

Yuck. I'd prefer we got the other way. Consider the following diffs for example:

What's the, uh, diff between those to consider?

Look at the @@ line. One tells you in which function the line is added, the other one doesn't. It always pisses me off when reviewing patches cause then I have to figure out the function based on the label, surroundng context, and/or line numbers.

I'm also thinking this may have caused some of the numerous misapplied patches we've had since our labels all tend to be similar.

Quoted 92 lines

Anyway, a quick git grep popularity contest within the kernel tree and checkpatch (WARNING: labels should not be indented) tell me to go with Damien.

BR,
Jani.

Quoted 81 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
index 7f6fd85..342509d 100644
@@ -942,6 +942,7 @@ out:
 
 	pps_unlock(intel_dp);
 
+	// foo
 	return ret;
 }
 
drivers/gpu/drm/i915/intel_dp.c +1 -0
index 5901e00..2673347 100644
@@ -942,6 +942,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 
 	pps_unlock(intel_dp);
 
+	// foo
 	return ret;
 }
 
Quoted 48 lines
---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index a96f181..2354927 100644
@@ -6980,7 +6980,7 @@ static int i965gm_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%04x\n", vco, tmp);
 	return 200000;
 }
@@ -7021,7 +7021,7 @@ static int g33_get_display_clock_speed(struct drm_device *dev)
 
 	return DIV_ROUND_CLOSEST(vco, div_table[cdclk_sel]);
 
- fail:
+fail:
 	DRM_ERROR("Unable to determine CDCLK. HPLL VCO=%u kHz, CFGC=0x%08x\n", vco, tmp);
 	return 190476;
 }
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 8193a35..f5965fb 100644
@@ -1189,6 +1189,6 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
- out:
+out:
 	return ret;
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 9 lines · Ville Syrjälä
Quoted 7 lines · Jani Nikula
Quoted 4 lines · Ville Syrjälä
Quoted 1 line · Damien Lespiau

I noticed one of those and it turned out we have a few lingering around.

Yuck. I'd prefer we got the other way. Consider the following diffs for example:

What's the, uh, diff between those to consider?

Quoted 7 lines

Look at the @@ line. One tells you in which function the line is added, the other one doesn't. It always pisses me off when reviewing patches cause then I have to figure out the function based on the label, surroundng context, and/or line numbers.

I'm also thinking this may have caused some of the numerous misapplied patches we've had since our labels all tend to be similar.

Oh wtf!

That sounds like something that should be fixed in the tool, a fun little project for a dark winter night.

Signature · 5 lines
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 15 lines · Damien Lespiau
Quoted 14 lines · Ville Syrjälä
Quoted 7 lines · Jani Nikula
Quoted 4 lines · Ville Syrjälä
Quoted 1 line · Damien Lespiau

I noticed one of those and it turned out we have a few lingering around.

Yuck. I'd prefer we got the other way. Consider the following diffs for example:

What's the, uh, diff between those to consider?

Look at the @@ line. One tells you in which function the line is added, the other one doesn't. It always pisses me off when reviewing patches cause then I have to figure out the function based on the label, surroundng context, and/or line numbers.

Quoted 7 lines
Quoted 2 lines

I'm also thinking this may have caused some of the numerous misapplied patches we've had since our labels all tend to be similar.

Oh wtf!

That sounds like something that should be fixed in the tool, a fun little project for a dark winter night.

As a quick workaround, consider putting this in a .gitattributes file:

*.c diff=cpp

This will tell git diff to use the predefined regex for finding function headers in c++ files for all C files as well. It differs from the default C regex in that it tries to exclude visibility class labels ("protected:" etc) and therefore incidentally excludes all labels ;-)

Enjoy!
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Ville Syrjälä
Quoted 5 lines · Ville Syrjälä
Quoted 4 lines · Jani Nikula
Quoted 3 lines · Ville Syrjälä
Quoted 1 line · Damien Lespiau

I noticed one of those and it turned out we have a few lingering around.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Yuck. I'd prefer we got the other way. Consider the following diffs for example:

What's the, uh, diff between those to consider?

Look at the @@ line. One tells you in which function the line is added, the other one doesn't. It always pisses me off when reviewing patches cause then I have to figure out the function based on the label, surroundng context, and/or line numbers.

Yeah that's an annoying sucker but I guess just part of the fail. Imo consistency wins this bikeshed ;-)

Quoted 2 lines

I'm also thinking this may have caused some of the numerous misapplied patches we've had since our labels all tend to be similar.

Diff doesn't look at the heading after the @@ but only at concept. And when applying with some mismatches that can end up in really surprising places. Chaning how we place labels won't help.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 18 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjälä
Quoted 4 lines · Jani Nikula
Quoted 3 lines · Ville Syrjälä
Quoted 1 line · Damien Lespiau

I noticed one of those and it turned out we have a few lingering around.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Yuck. I'd prefer we got the other way. Consider the following diffs for example:

What's the, uh, diff between those to consider?

Look at the @@ line. One tells you in which function the line is added, the other one doesn't. It always pisses me off when reviewing patches cause then I have to figure out the function based on the label, surroundng context, and/or line numbers.

Yeah that's an annoying sucker but I guess just part of the fail. Imo consistency wins this bikeshed ;-)

Quoted 7 lines
Quoted 2 lines

I'm also thinking this may have caused some of the numerous misapplied patches we've had since our labels all tend to be similar.

Diff doesn't look at the heading after the @@ but only at concept. And when applying with some mismatches that can end up in really surprising places. Chaning how we place labels won't help.
-Daniel

You could vary the label by giving each one some compressed prefix based on the name of the function it's in, a sort of poor man's namespacing ...

i915_do_some_stuff()

{
	...
	goto dss_exit;
	...

dss_exit:

	return ret;
}

i915_exciting_new_function()

{
	...
	goto enf_exit;
	...

enf_exit:

	return ret;
}

.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Tested-by on v1 1/1
#8 lore raw
In reply to Damien Lespiau

Task id: 6538 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                                  270/270              270/270
ILK                                  303/303              303/303
SNB                                  312/312              312/312
IVB                                  343/343              343/343
BYT                                  287/287              287/287
BDW                                  318/318              318/318

-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx