Re: [PATCH v2 4/5] drm/i915: Wrap access to module params into macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 14 Sep 2017 15:10:22 +0200, Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> wrote:

On Thu, 14 Sep 2017, Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> wrote:
@@ -1031,9 +1031,9 @@ static void i915_driver_cleanup_mmio(struct drm_i915_private *dev_priv)

 static void intel_sanitize_options(struct drm_i915_private *dev_priv)
 {
-	i915.enable_execlists =
+	i915_param(enable_execlists) =

I disapprove using a function-like macro expansion as an lvalue. If you
want to use a getter macro, also provide a setter, and use them
separately.


What about this set of macros:

#define i915_param(n)          ({ i915_params.n; })
#define i915_param_set(n,e)    ({ i915_params.n = e; })
#define i915_param_inc(n)      ({ i915_params.n++; })
#define i915_param_dec(n)      ({ i915_params.n--; })
#define i915_param_ptr(n)      ({ &i915_params.n; })

then corresponding code update can be done with:

@@
identifier n;
expression e;
@@

(
-	i915_param(n) = e;
+	i915_param_set(n, e);
|
-	i915_param(n)++;
+	i915_param_inc(n);
|
-	i915_param(n)--;
+	i915_param_dec(n);
)

Michal

BR,
Jani.

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux