ppi.c (47625) | ppi.c (47640) |
---|---|
1/*- 2 * Copyright (c) 1997, 1998 Nicolas Souchu, Michael Smith 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) 1997, 1998 Nicolas Souchu, Michael Smith 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: ppi.c,v 1.13 1999/04/28 10:51:39 dt Exp $ | 26 * $Id: ppi.c,v 1.14 1999/05/30 16:51:35 phk Exp $ |
27 * 28 */ 29#include "ppi.h" 30 31#if NPPI > 0 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 106 unchanged lines hidden (view full) --- 141 142/* 143 * ppiprobe() 144 */ 145static struct ppb_device * 146ppiprobe(struct ppb_data *ppb) 147{ 148 struct ppi_data *ppi; | 27 * 28 */ 29#include "ppi.h" 30 31#if NPPI > 0 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 106 unchanged lines hidden (view full) --- 141 142/* 143 * ppiprobe() 144 */ 145static struct ppb_device * 146ppiprobe(struct ppb_data *ppb) 147{ 148 struct ppi_data *ppi; |
149 static int once; |
|
149 | 150 |
151 if (!once++) 152 cdevsw_add(&ppi_cdevsw); 153 |
|
150 ppi = (struct ppi_data *) malloc(sizeof(struct ppi_data), 151 M_TEMP, M_NOWAIT); 152 if (!ppi) { 153 printf("ppi: cannot malloc!\n"); 154 return 0; 155 } 156 bzero(ppi, sizeof(struct ppi_data)); 157 --- 384 unchanged lines hidden (view full) --- 542 default: 543 error = ENOTTY; 544 break; 545 } 546 547 return (error); 548} 549 | 154 ppi = (struct ppi_data *) malloc(sizeof(struct ppi_data), 155 M_TEMP, M_NOWAIT); 156 if (!ppi) { 157 printf("ppi: cannot malloc!\n"); 158 return 0; 159 } 160 bzero(ppi, sizeof(struct ppi_data)); 161 --- 384 unchanged lines hidden (view full) --- 546 default: 547 error = ENOTTY; 548 break; 549 } 550 551 return (error); 552} 553 |
550static int ppi_devsw_installed; 551 552static void ppi_drvinit(void *unused) 553{ 554 dev_t dev; 555 556 if (!ppi_devsw_installed ) { 557 dev = makedev(CDEV_MAJOR, 0); 558 cdevsw_add(&dev, &ppi_cdevsw, NULL); 559 ppi_devsw_installed = 1; 560 } 561} 562 563SYSINIT(ppidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ppi_drvinit,NULL) 564 | |
565#endif /* NPPI */ | 554#endif /* NPPI */ |