iic.c (47625) | iic.c (47640) |
---|---|
1/*- 2 * Copyright (c) 1998 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: iic.c,v 1.10 1999/05/09 13:00:35 phk Exp $ | 26 * $Id: iic.c,v 1.11 1999/05/30 16:51:28 phk Exp $ |
27 * 28 */ 29#include <sys/param.h> 30#include <sys/kernel.h> 31#include <sys/systm.h> 32#include <sys/module.h> 33#include <sys/bus.h> 34#include <sys/conf.h> --- 81 unchanged lines hidden (view full) --- 116 117/* 118 * iicprobe() 119 */ 120static int 121iic_probe(device_t dev) 122{ 123 struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev); | 27 * 28 */ 29#include <sys/param.h> 30#include <sys/kernel.h> 31#include <sys/systm.h> 32#include <sys/module.h> 33#include <sys/bus.h> 34#include <sys/conf.h> --- 81 unchanged lines hidden (view full) --- 116 117/* 118 * iicprobe() 119 */ 120static int 121iic_probe(device_t dev) 122{ 123 struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev); |
124 static int once; |
|
124 | 125 |
126 if (!once++) 127 cdevsw_add(&iic_cdevsw); 128 |
|
125 sc->sc_addr = iicbus_get_addr(dev); 126 127 /* XXX detect chip with start/stop conditions */ 128 129 return (0); 130} 131 132/* --- 141 unchanged lines hidden (view full) --- 274 error = ENODEV; 275 } 276 277 iicbus_release_bus(device_get_parent(iicdev), iicdev); 278 279 return (error); 280} 281 | 129 sc->sc_addr = iicbus_get_addr(dev); 130 131 /* XXX detect chip with start/stop conditions */ 132 133 return (0); 134} 135 136/* --- 141 unchanged lines hidden (view full) --- 278 error = ENODEV; 279 } 280 281 iicbus_release_bus(device_get_parent(iicdev), iicdev); 282 283 return (error); 284} 285 |
282static int iic_devsw_installed = 0; 283 284static void 285iic_drvinit(void *unused) 286{ 287 dev_t dev; 288 289 if( ! iic_devsw_installed ) { 290 dev = makedev(CDEV_MAJOR,0); 291 cdevsw_add(&dev,&iic_cdevsw,NULL); 292 iic_devsw_installed = 1; 293 } 294} 295 | |
296DEV_DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, CDEV_MAJOR, 297 NOMAJ, iic_cdevsw, 0, 0); | 286DEV_DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, CDEV_MAJOR, 287 NOMAJ, iic_cdevsw, 0, 0); |
298 299SYSINIT(iicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,iic_drvinit,NULL) | |