plat/leo/common/include/leo_shres_helpers.h
/* Return 1 if refcnt decrements to 0, else return 0 */
Return 1 if refcnt decrements to 0, else return 0
Return 1 if refcnt decrements to 0 else return 0
static inline int leo_decr_shrefcnt(unsigned int *refcnt, bool secure)
{
	int  rc = 0;
	if (secure) {
		if (*refcnt < SHREFCNT_MAX) {
			if (*refcnt < SHREFCNT_SECURE_STEP) {
				panic();
			}
			*refcnt -= SHREFCNT_SECURE_STEP;
			rc = !*refcnt;
		}
	} else {
		rc = (*refcnt == SHREFCNT_NONSECURE_FLAG) ? 1 : 0;
		*refcnt &= ~SHREFCNT_NONSECURE_FLAG;
	}
	return rc;
}
static inline int leo_decr_shrefcnt ( unsigned int * refcnt , bool secure ) { int rc = 0 ; if ( secure ) { if ( * refcnt < SHREFCNT_MAX ) { if ( * refcnt < SHREFCNT_SECURE_STEP ) { panic ( ) ; } * refcnt -= SHREFCNT_SECURE_STEP ; rc = ! * refcnt ; } } else { rc = ( * refcnt == SHREFCNT_NONSECURE_FLAG ) ? 1 : 0 ; * refcnt &= ~ SHREFCNT_NONSECURE_FLAG ; } return rc ; }
Return 1 if refcnt decrements to 0, else return 0
Return 1 if refcnt decrements to 0 else return 0