On Wed, 20 Mar 2024, Ville Syrjälä wrote: > Hi Julia et al, > > In Linux drm/i915 driver (drivers/gpu/drm/i915/display/intel_pps.[ch]) > we have a magic macro like this: > > #define with_intel_pps_lock(dp, wf) \ Did you try declaring: iterator name with_intel_pps_lock; up with the metavariables? julia > for ((wf) = intel_pps_lock(dp); (wf); (wf) = intel_pps_unlock((dp), (wf))) > > > which we can then use like so: > ... > with_intel_pps_lock(intel_dp, wakeref) > wait_panel_power_cycle(intel_dp); > ... > > > If I try to modify this code with eg. > > @@ > @@ > - wait_panel_power_cycle > + _wait_panel_power_cycle > > spatch fails to parse the macro and won't do the changes here. > > > While experimenting with this I discovered that > I can make it work by: > - moving the macro definition into intel_pps.c file from intel_pps.h > - renaming the macro to contain the substring "for" (doesn't matter > where in the macro name the "for" appears) > > What on earth is going on here? > > -- > Ville Syrjälä > Intel >