Message ID | 20211204105527.15741-5-rikard.falkeborn@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915/gvt: Constify static structs | expand |
On 12/4/2021 12:55 PM, Rikard Falkeborn wrote: > These are never modified, so make them const to allow the compiler to > put them in read-only memory. > > Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> > --- > drivers/gpu/drm/i915/gvt/sched_policy.c | 2 +- > drivers/gpu/drm/i915/gvt/scheduler.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c > index 036b74fe9298..c077fb4674f0 100644 > --- a/drivers/gpu/drm/i915/gvt/sched_policy.c > +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c > @@ -368,7 +368,7 @@ static void tbs_sched_stop_schedule(struct intel_vgpu *vgpu) > vgpu_data->active = false; > } > > -static struct intel_gvt_sched_policy_ops tbs_schedule_ops = { > +static const struct intel_gvt_sched_policy_ops tbs_schedule_ops = { > .init = tbs_sched_init, > .clean = tbs_sched_clean, > .init_vgpu = tbs_sched_init_vgpu, > diff --git a/drivers/gpu/drm/i915/gvt/scheduler.h b/drivers/gpu/drm/i915/gvt/scheduler.h > index 7c86984a842f..1f391b3da2cc 100644 > --- a/drivers/gpu/drm/i915/gvt/scheduler.h > +++ b/drivers/gpu/drm/i915/gvt/scheduler.h > @@ -56,7 +56,7 @@ struct intel_gvt_workload_scheduler { > wait_queue_head_t waitq[I915_NUM_ENGINES]; > > void *sched_data; > - struct intel_gvt_sched_policy_ops *sched_ops; > + const struct intel_gvt_sched_policy_ops *sched_ops; > }; > > #define INDIRECT_CTX_ADDR_MASK 0xffffffc0 Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>
diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c index 036b74fe9298..c077fb4674f0 100644 --- a/drivers/gpu/drm/i915/gvt/sched_policy.c +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c @@ -368,7 +368,7 @@ static void tbs_sched_stop_schedule(struct intel_vgpu *vgpu) vgpu_data->active = false; } -static struct intel_gvt_sched_policy_ops tbs_schedule_ops = { +static const struct intel_gvt_sched_policy_ops tbs_schedule_ops = { .init = tbs_sched_init, .clean = tbs_sched_clean, .init_vgpu = tbs_sched_init_vgpu, diff --git a/drivers/gpu/drm/i915/gvt/scheduler.h b/drivers/gpu/drm/i915/gvt/scheduler.h index 7c86984a842f..1f391b3da2cc 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.h +++ b/drivers/gpu/drm/i915/gvt/scheduler.h @@ -56,7 +56,7 @@ struct intel_gvt_workload_scheduler { wait_queue_head_t waitq[I915_NUM_ENGINES]; void *sched_data; - struct intel_gvt_sched_policy_ops *sched_ops; + const struct intel_gvt_sched_policy_ops *sched_ops; }; #define INDIRECT_CTX_ADDR_MASK 0xffffffc0
These are never modified, so make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> --- drivers/gpu/drm/i915/gvt/sched_policy.c | 2 +- drivers/gpu/drm/i915/gvt/scheduler.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)