smb.c (47625) | smb.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: smb.c,v 1.11 1999/05/09 13:00:37 phk Exp $ | 26 * $Id: smb.c,v 1.12 1999/05/30 16:51:37 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> --- 82 unchanged lines hidden (view full) --- 117 118/* 119 * smbprobe() 120 */ 121static int 122smb_probe(device_t dev) 123{ 124 struct smb_softc *sc = (struct smb_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> --- 82 unchanged lines hidden (view full) --- 117 118/* 119 * smbprobe() 120 */ 121static int 122smb_probe(device_t dev) 123{ 124 struct smb_softc *sc = (struct smb_softc *)device_get_softc(dev); |
125 static int once; |
|
125 | 126 |
127 if (!once++) 128 cdevsw_add(&smb_cdevsw); 129 |
|
126 sc->sc_addr = smbus_get_addr(dev); 127 128 /* XXX detect chip with start/stop conditions */ 129 130 return (0); 131} 132 133/* --- 133 unchanged lines hidden (view full) --- 267 } 268 269 /* release the bus */ 270 smbus_release_bus(parent, smbdev); 271 272 return (error); 273} 274 | 130 sc->sc_addr = smbus_get_addr(dev); 131 132 /* XXX detect chip with start/stop conditions */ 133 134 return (0); 135} 136 137/* --- 133 unchanged lines hidden (view full) --- 271 } 272 273 /* release the bus */ 274 smbus_release_bus(parent, smbdev); 275 276 return (error); 277} 278 |
275static int smb_devsw_installed = 0; 276 277static void 278smb_drvinit(void *unused) 279{ 280 dev_t dev; 281 282 if( ! smb_devsw_installed ) { 283 dev = makedev(CDEV_MAJOR,0); 284 cdevsw_add(&dev,&smb_cdevsw,NULL); 285 smb_devsw_installed = 1; 286 } 287} 288 | |
289DEV_DRIVER_MODULE(smb, smbus, smb_driver, smb_devclass, CDEV_MAJOR, NOMAJ, 290 smb_cdevsw, 0, 0); | 279DEV_DRIVER_MODULE(smb, smbus, smb_driver, smb_devclass, CDEV_MAJOR, NOMAJ, 280 smb_cdevsw, 0, 0); |
291 292SYSINIT(smbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,smb_drvinit,NULL) | |