9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 506b99dcbb419aa72712a90be22d5d587d24a6df
parent 0765cb8f789b030e8a14f03f3d28b65db494438b
Author: Roberto Vargas <roberto.vargas@arm.com>
Date:   Mon, 18 Feb 2019 16:09:32 +0000

[drivers] Remove fds from devinfo

Change-Id: I6724e0cb1e3fada4f1dd34711981a3ddfbf7593a

Diffstat:
Mdrivers/dev.c | 15++++++++-------
Mdrivers/dev.h | 1-
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/dev.c b/drivers/dev.c @@ -7,14 +7,15 @@ #include "dev.h" +static Chan fdset[NR_CHANS]; + static Chan * newchan(void) { Chan *c, *lim; - struct devdata *dinfo = devinfo; - lim = &dinfo->fds[NR_CHANS]; - for (c = dinfo->fds; c < lim; c++) { + lim = &fdset[NR_CHANS]; + for (c = fdset; c < lim; c++) { if (c->type == NODEV) return c; } @@ -46,13 +47,13 @@ fd2chan(int fd) errno = EBADF; return NULL; } - return &devinfo->fds[fd]; + return &fdset[fd]; } static int chan2fd(Chan *c) { - return (c == NULL) ? -1 : (c - devinfo->fds); + return (c == NULL) ? -1 : (c - fdset); } static int @@ -446,8 +447,8 @@ idev(void) dinfo = alloc(sizeof(*dinfo)); devinfo = dinfo; - clim = &dinfo->fds[NR_CHANS]; - for (c = dinfo->fds; c < clim; c++) + clim = &fdset[NR_CHANS]; + for (c = fdset; c < clim; c++) c->type = NODEV; diff --git a/drivers/dev.h b/drivers/dev.h @@ -52,7 +52,6 @@ struct bind { struct devdata { Chan slash; - Chan fds[NR_CHANS]; Uart *uarts[NR_UARTS]; Bind binds[NR_BINDS]; };