Re: [PATCH 05/16] Introduce slices

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

 



On Thu, Mar 12, 2020 at 10:18:10AM +0100, Daniel Glöckner wrote:
> On Thu, Mar 12, 2020 at 09:24:59AM +0100, Sascha Hauer wrote:
> > On Thu, Mar 12, 2020 at 12:51:54AM +0100, Daniel Glöckner wrote:
> > > Hello Sascha,
> > > 
> > > On Wed, Mar 11, 2020 at 03:27:46PM +0100, Sascha Hauer wrote:
> > > > +/**
> > > > + * slice_acquired: test if a slice is acquired
> > > > + * @slice: The slice to test
> > > > + *
> > > > + * This tests if a slice is acquired. Returns true if it is, false otherwise
> > > > + */
> > > > +bool slice_acquired(struct slice *slice)
> > > > +{
> > > > +	struct slice_entry *se;
> > > > +	int acquired = slice->acquired;
> > > > +	bool ret = false;
> > > > +
> > > > +	if (acquired > 0)
> > > > +		return true;
> > > > +
> > > > +	if (acquired < 0) {
> > > > +		pr_err("Recursive dependency detected in slice %s\n",
> > > > +		       slice_name(slice));
> > > > +		panic("Cannot continue");
> > > > +	}
> > > > +
> > > > +	slice->acquired = -1;
> > > > +
> > > > +	list_for_each_entry(se, &slice->deps, list)
> > > > +		if (slice_acquired(se->slice)) {
> > > > +			ret = true;
> > > > +			break;
> > > > +		}
> > > > +
> > > > +	slice->acquired = acquired;
> > > 
> > > no need to restore slice->acquire from acquired since
> > > acquired must have been zero if we reach this line.
> > 
> > Hm, no. Nothing changes slice->acquired in this function besides
> > ourselves. It is still -1 how we have set it previously.
> 
> What I wanted to say is that you can simply use
> 	slice->acquired = 0;
> at the end.

Yes, in the meantime a collegue explained that to me as well ;)
Changed accordingly.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux