Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103906690
D33068.id98968.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D33068.id98968.diff
View Options
Index: sys/dev/agp/agp.c
===================================================================
--- sys/dev/agp/agp.c
+++ sys/dev/agp/agp.c
@@ -205,8 +205,9 @@
int
agp_generic_attach(device_t dev)
{
+ struct make_dev_args mdargs;
struct agp_softc *sc = device_get_softc(dev);
- int i;
+ int error, i, unit;
u_int memsize;
/*
@@ -250,11 +251,29 @@
TAILQ_INIT(&sc->as_memory);
sc->as_nextid = 1;
- sc->as_devnode = make_dev(&agp_cdevsw,
- 0, UID_ROOT, GID_WHEEL, 0600, "agpgart");
- sc->as_devnode->si_drv1 = dev;
+ sc->as_devalias = NULL;
- return 0;
+ make_dev_args_init(&mdargs);
+ mdargs.mda_devsw = &agp_cdevsw;
+ mdargs.mda_uid = UID_ROOT;
+ mdargs.mda_gid = GID_WHEEL;
+ mdargs.mda_mode = 0600;
+ mdargs.mda_si_drv1 = sc;
+ mdargs.mda_si_drv2 = NULL;
+
+ unit = device_get_unit(dev);
+ error = make_dev_s(&mdargs, &sc->as_devnode, "agpgart%d", unit);
+ if (error == 0 && unit == 0) {
+ /*
+ * Create an alias for the first device that shows up.
+ */
+ (void)make_dev_alias_p(MAKEDEV_CHECKNAME, &sc->as_devalias,
+ sc->as_devnode, "agpgart");
+ } else {
+ agp_free_res(dev);
+ }
+
+ return error;
}
void
@@ -263,6 +282,8 @@
struct agp_softc *sc = device_get_softc(dev);
destroy_dev(sc->as_devnode);
+ if (sc->as_devalias != NULL)
+ destroy_dev(sc->as_devalias);
}
void
Index: sys/dev/agp/agppriv.h
===================================================================
--- sys/dev/agp/agppriv.h
+++ sys/dev/agp/agppriv.h
@@ -76,6 +76,7 @@
int as_nextid; /* next memory block id */
int as_isopen; /* user device is open */
struct cdev *as_devnode; /* from make_dev */
+ struct cdev *as_devalias;
struct mtx as_lock; /* lock for access to GATT */
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 12:56 AM (18 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14974086
Default Alt Text
D33068.id98968.diff (1 KB)
Attached To
Mode
D33068: agp: Gracefully handle make_dev() errors if /dev/agpgart already exists
Attached
Detach File
Event Timeline
Log In to Comment