DEVICE.HINTS(5): Use static hints only

This commit is contained in:
Sebastian Huber 2013-11-06 08:24:53 +01:00
parent cd48afc2ea
commit d328ca274a

View File

@ -39,11 +39,16 @@ __FBSDID("$FreeBSD$");
* Access functions for device resources. * Access functions for device resources.
*/ */
#ifndef __rtems__
static int checkmethod = 1; static int checkmethod = 1;
static int use_kenv; static int use_kenv;
static char *hintp; static char *hintp;
#ifdef __rtems__ #else /* __rtems__ */
int hintmode = 1; /* always use static_hints */ #define hintmode 1
#define hintp static_hints
#define use_kenv 0
static char __used default_static_hints[] = "";
__weak_reference(default_static_hints, static_hints);
#endif /* __rtems__ */ #endif /* __rtems__ */
/* /*
@ -65,6 +70,7 @@ res_find(int *line, int *startln,
const char *s, *cp; const char *s, *cp;
char *p; char *p;
#ifndef __rtems__
if (checkmethod) { if (checkmethod) {
hintp = NULL; hintp = NULL;
@ -127,6 +133,7 @@ res_find(int *line, int *startln,
return (ENOENT); return (ENOENT);
} }
} else } else
#endif /* __rtems__ */
cp = hintp; cp = hintp;
while (cp) { while (cp) {
hit = 1; hit = 1;
@ -156,9 +163,13 @@ res_find(int *line, int *startln,
if (hit) if (hit)
break; break;
if (use_kenv) { if (use_kenv) {
#ifndef __rtems__
cp = kenvp[++i]; cp = kenvp[++i];
if (cp == NULL) if (cp == NULL)
break; break;
#else /* __rtems__ */
(void) i;
#endif /* __rtems__ */
} else { } else {
while (*cp != '\0') while (*cp != '\0')
cp++; cp++;
@ -169,8 +180,10 @@ res_find(int *line, int *startln,
} }
} }
} }
#ifndef __rtems__
if (use_kenv) if (use_kenv)
mtx_unlock(&kenv_lock); mtx_unlock(&kenv_lock);
#endif /* __rtems__ */
if (cp == NULL) if (cp == NULL)
return ENOENT; return ENOENT;