Re: [PATCH] drm/i915: Remove pointer indirection for hangcheck_state local

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

 



Quoting Rodrigo Vivi (2017-12-19 20:54:40)
> On Tue, Dec 19, 2017 at 01:09:48PM +0000, Chris Wilson wrote:
> > Use the local on-stack struct directly rather than hide it behind a
> > pointer. This should be both clearer for the reader and the compiler (we
> > rely on the compiler seeing through the functions to spot uninitialized
> > uses of the local).
> 
> much better!
> 
> > 
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Cc: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/intel_hangcheck.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_hangcheck.c b/drivers/gpu/drm/i915/intel_hangcheck.c
> > index 0acd9dd3ed5c..fe99439aaf39 100644
> > --- a/drivers/gpu/drm/i915/intel_hangcheck.c
> > +++ b/drivers/gpu/drm/i915/intel_hangcheck.c
> > @@ -429,18 +429,18 @@ static void i915_hangcheck_elapsed(struct work_struct *work)
> >       intel_uncore_arm_unclaimed_mmio_detection(dev_priv);
> >  
> >       for_each_engine(engine, dev_priv, id) {
> > -             struct intel_engine_hangcheck cur_state, *hc = &cur_state;
> > +             struct intel_engine_hangcheck hc;
> 
> I wonder if we couldn't move these definition up...

This is the tightest scope for hc, so one argument is to keep it tightly
scope to prevent leakage. Just sometimes the code ends up more readable
without a new set of variables at the start of a block.
-Chris
_______________________________________________
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