NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/38885: iic character device breakage



>Number:         38885
>Category:       kern
>Synopsis:       incomplete conversion to CFATTACH_DECL_NEW in dev/i2c
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 07 15:10:00 +0000 2008
>Originator:     Jonathan A. Kollasch
>Release:        NetBSD 4.99.64
>Organization:
>Environment:
System: NetBSD anacreon.kollasch.net 4.99.64 NetBSD 4.99.64 (ANACREON) #1: Sat 
Jun 7 14:41:01 UTC 2008 
root%anacreon.kollasch.net@localhost:/usr/src/sys/arch/amd64/compile/ANACREON 
amd64
Architecture: x86_64
Machine: amd64
>Description:
seeprom(4) et.al. were converted to CFATTACH_DECL_NEW,
but device_lookup() was not changed too.
 
>How-To-Repeat:
config(5)ure in seeprom(4) to access a 24cxx
chip (I used the SPD chips on my DIMMs), note
how opening the device always fails with EBUSY.

>Fix:
this only addresses seeprom,
other i2c devices seem to be
broken as well.

Index: at24cxx.c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/at24cxx.c,v
retrieving revision 1.11
diff -u -r1.11 at24cxx.c
--- at24cxx.c   4 May 2008 15:26:29 -0000       1.11
+++ at24cxx.c   7 Jun 2008 14:54:14 -0000
@@ -183,7 +183,7 @@
 {
        struct seeprom_softc *sc;
 
-       if ((sc = device_lookup(&seeprom_cd, minor(dev))) == NULL)
+       if ((sc = device_lookup_private(&seeprom_cd, minor(dev))) == NULL)
                return (ENXIO);
 
        /* XXX: Locking */
@@ -201,7 +201,7 @@
 {
        struct seeprom_softc *sc;
 
-       if ((sc = device_lookup(&seeprom_cd, minor(dev))) == NULL)
+       if ((sc = device_lookup_private(&seeprom_cd, minor(dev))) == NULL)
                return (ENXIO);
 
        sc->sc_open = 0;
@@ -217,7 +217,7 @@
        u_int8_t ch, cmdbuf[2];
        int a, error;
 
-       if ((sc = device_lookup(&seeprom_cd, minor(dev))) == NULL)
+       if ((sc = device_lookup_private(&seeprom_cd, minor(dev))) == NULL)
                return (ENXIO);
 
        if (uio->uio_offset >= sc->sc_size)
@@ -271,7 +271,7 @@
        u_int8_t ch, cmdbuf[2];
        int a, error;
 
-       if ((sc = device_lookup(&seeprom_cd, minor(dev))) == NULL)
+       if ((sc = device_lookup_private(&seeprom_cd, minor(dev))) == NULL)
                return (ENXIO);
 
        if (uio->uio_offset >= sc->sc_size)



Home | Main Index | Thread Index | Old Index