summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroger <roger@FreeBSD.org>1999-06-13 16:05:00 +0000
committerroger <roger@FreeBSD.org>1999-06-13 16:05:00 +0000
commit6d320ce99c21de5b6d9bb2321c36949c91bd8420 (patch)
tree1b31a0ce35bcffef1e652733b930aeb0a59ef19b
parentd3d8c4e7a1eb2ae5c17397a71939052abb53ad69 (diff)
downloadFreeBSD-src-6d320ce99c21de5b6d9bb2321c36949c91bd8420.zip
FreeBSD-src-6d320ce99c21de5b6d9bb2321c36949c91bd8420.tar.gz
Removed checking for unit>NBKTR.
No longer need when using device_get_softc. (also fixed bug where loadable bktr module could only access 1st device)
-rw-r--r--sys/dev/bktr/bktr_core.c19
-rw-r--r--sys/pci/brooktree848.c19
2 files changed, 4 insertions, 34 deletions
diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c
index 03aa77e..23ccdea 100644
--- a/sys/dev/bktr/bktr_core.c
+++ b/sys/dev/bktr/bktr_core.c
@@ -1,4 +1,4 @@
-/* $Id: brooktree848.c,v 1.84 1999/06/04 13:24:54 roger Exp $ */
+/* $Id: brooktree848.c,v 1.85 1999/06/12 14:54:54 roger Exp $ */
/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
Jim Lowe's driver for the Matrox Meteor PCI card . The
@@ -1409,13 +1409,6 @@ bktr_attach( device_t dev )
unit = device_get_unit(dev);
- if (unit >= NBKTR) {
- printf("brooktree%d: attach: only %d units configured.\n",
- unit, NBKTR);
- printf("brooktree%d: attach: invalid unit number.\n", unit);
- return ENXIO;
- }
-
/*
* Enable bus mastering and Memory Mapped device
*/
@@ -1957,8 +1950,6 @@ bktr_open( dev_t dev, int flags, int fmt, struct proc *p )
int result;
unit = UNIT( minor(dev) );
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -2204,8 +2195,6 @@ bktr_close( dev_t dev, int flags, int fmt, struct proc *p )
int result;
unit = UNIT( minor(dev) );
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -2303,8 +2292,6 @@ bktr_read( dev_t dev, struct uio *uio, int ioflag )
int unit;
unit = UNIT(minor(dev));
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -2444,8 +2431,6 @@ bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr )
int unit;
unit = UNIT(minor(dev));
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -3618,7 +3603,7 @@ bktr_mmap( dev_t dev, vm_offset_t offset, int nprot )
unit = UNIT(minor(dev));
- if (unit >= NBKTR || MINOR(minor(dev)) > 0)/* could this happen here? */
+ if (MINOR(minor(dev)) > 0) /* only allow mmap on /dev/bktr[n] */
return( -1 );
/* Get the device data */
diff --git a/sys/pci/brooktree848.c b/sys/pci/brooktree848.c
index 03aa77e..23ccdea 100644
--- a/sys/pci/brooktree848.c
+++ b/sys/pci/brooktree848.c
@@ -1,4 +1,4 @@
-/* $Id: brooktree848.c,v 1.84 1999/06/04 13:24:54 roger Exp $ */
+/* $Id: brooktree848.c,v 1.85 1999/06/12 14:54:54 roger Exp $ */
/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
Jim Lowe's driver for the Matrox Meteor PCI card . The
@@ -1409,13 +1409,6 @@ bktr_attach( device_t dev )
unit = device_get_unit(dev);
- if (unit >= NBKTR) {
- printf("brooktree%d: attach: only %d units configured.\n",
- unit, NBKTR);
- printf("brooktree%d: attach: invalid unit number.\n", unit);
- return ENXIO;
- }
-
/*
* Enable bus mastering and Memory Mapped device
*/
@@ -1957,8 +1950,6 @@ bktr_open( dev_t dev, int flags, int fmt, struct proc *p )
int result;
unit = UNIT( minor(dev) );
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -2204,8 +2195,6 @@ bktr_close( dev_t dev, int flags, int fmt, struct proc *p )
int result;
unit = UNIT( minor(dev) );
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -2303,8 +2292,6 @@ bktr_read( dev_t dev, struct uio *uio, int ioflag )
int unit;
unit = UNIT(minor(dev));
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -2444,8 +2431,6 @@ bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr )
int unit;
unit = UNIT(minor(dev));
- if (unit >= NBKTR) /* unit out of range */
- return( ENXIO );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -3618,7 +3603,7 @@ bktr_mmap( dev_t dev, vm_offset_t offset, int nprot )
unit = UNIT(minor(dev));
- if (unit >= NBKTR || MINOR(minor(dev)) > 0)/* could this happen here? */
+ if (MINOR(minor(dev)) > 0) /* only allow mmap on /dev/bktr[n] */
return( -1 );
/* Get the device data */
OpenPOWER on IntegriCloud