VERSION = 2
PATCHLEVEL = 2
SUBLEVEL = 17
-EXTRAVERSION = pre17
+EXTRAVERSION = pre18
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
addi r4, r3, __secondary_start - _start
mfmsr r3
andi. r0,r3,MSR_DR|MSR_IR /* MMU enabled? */
- beq 1f
- ori r3,r3,MSR_DR|MSR_IR
- xori r3,r3,MSR_DR|MSR_IR
+ beqlr
+ andc r3,r3,r0
mtspr SRR0,r4
mtspr SRR1,r3
- sync
+ SYNC
rfi
-1: blr
/*
* This code is jumped to from the startup code to copy
mfspr r9,PVR
rlwinm r9,r9,16,16,31
cmpi 0,r9,1
- beq 4f /* not needed for 601 */
+ beq 6f /* not needed for 601 */
mfspr r11,HID0
andi. r0,r11,HID0_DCE
ori r11,r11,HID0_ICE|HID0_DCE
stwcx. r5,0,r3 /* Update with new value */
bne- 10b /* Retry if "reservation" (i.e. lock) lost */
SMP_MB
- cmpi 0,r5,0 /* Return 'true' IFF 0 */
- li r3,1
- beqlr
- li r3,0
+ cntlzw r3,r5
+ srwi r3,r3,5
blr
_GLOBAL(atomic_clear_mask)
SMP_WMB /* wmb() */
blr
/*
- * Extended precision shifts
+ * Extended precision shifts.
+ *
+ * Updated to be valid for shift counts from 0 to 63 inclusive.
+ * -- Gabriel
*
* R3/R4 has 64 bit value
* R5 has shift count
* result in R3/R4
*
- * ashrdi3: XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ
- * ashldi3: XXXYYY/ZZZAAA -> YYYZZZ/AAA000
- * lshrdi3: XXXYYY/ZZZAAA -> 000XXX/YYYZZZ
+ * ashrdi3: arithmetic right shift (sign propagation)
+ * lshrdi3: logical right shift
+ * ashldi3: left shift
*/
_GLOBAL(__ashrdi3)
- li r6,32
- sub r6,r6,r5
- slw r7,r3,r6 /* isolate YYY */
- srw r4,r4,r5 /* isolate ZZZ */
- or r4,r4,r7 /* YYYZZZ */
- sraw r3,r3,r5 /* SSSXXX */
+ subfic r6,r5,32
+ srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
+ addi r7,r5,32 # could be xori, or addi with -32
+ slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
+ rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0
+ sraw r7,r3,r7 # t2 = MSW >> (count-32)
+ or r4,r4,r6 # LSW |= t1
+ slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2
+ sraw r3,r3,r5 # MSW = MSW >> count
+ or r4,r4,r7 # LSW |= t2
blr
_GLOBAL(__ashldi3)
- li r6,32
- sub r6,r6,r5
- srw r7,r4,r6 /* isolate ZZZ */
- slw r4,r4,r5 /* AAA000 */
- slw r3,r3,r5 /* YYY--- */
- or r3,r3,r7 /* YYYZZZ */
+ subfic r6,r5,32
+ slw r3,r3,r5 # MSW = count > 31 ? 0 : MSW << count
+ addi r7,r5,32 # could be xori, or addi with -32
+ srw r6,r4,r6 # t1 = count > 31 ? 0 : LSW >> (32-count)
+ slw r7,r4,r7 # t2 = count < 32 ? 0 : LSW << (count-32)
+ or r3,r3,r6 # MSW |= t1
+ slw r4,r4,r5 # LSW = LSW << count
+ or r3,r3,r7 # MSW |= t2
blr
_GLOBAL(__lshrdi3)
- li r6,32
- sub r6,r6,r5
- slw r7,r3,r6 /* isolate YYY */
- srw r4,r4,r5 /* isolate ZZZ */
- or r4,r4,r7 /* YYYZZZ */
- srw r3,r3,r5 /* 000XXX */
+ subfic r6,r5,32
+ srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
+ addi r7,r5,32 # could be xori, or addi with -32
+ slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
+ srw r7,r3,r7 # t2 = count < 32 ? 0 : MSW >> (count-32)
+ or r4,r4,r6 # LSW |= t1
+ srw r3,r3,r5 # MSW = MSW >> count
+ or r4,r4,r7 # LSW |= t2
blr
_GLOBAL(abs)
- cmpi 0,r3,0
- bge 10f
- neg r3,r3
-10: blr
+ srawi r4,r3,31
+ xor r3,r3,r4
+ sub r3,r3,r4
+ blr
_GLOBAL(_get_SP)
mr r3,r1 /* Close enough */
CDROM_CONFIG_FLAGS (drive)->limit_nframes = 0;
if (drive->id != NULL) {
/* a testament to the nice quality of Samsung drives... */
- if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430"))
+ if (!strcmp(drive->id->model, "SAMSUNG SCR-2030"))
+ CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1;
+ else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430"))
CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1;
else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2432"))
CDROM_CONFIG_FLAGS (drive)->limit_nframes = 1;
zss->irq = ch->intrs[0].line;
zss->has_dma = 0;
#if !defined(CONFIG_KGDB) && defined(SUPPORT_SERIAL_DMA)
- if (ch->n_addrs == 3 && ch->n_intrs == 3)
+ if (ch->n_addrs >= 3 && ch->n_intrs == 3)
zss->has_dma = 1;
#endif
zss->dma_initted = 0;
dev = vortex_probe1(bus, devfn, NULL, io, irq, chip_idx, MAX_UNITS+1);
if (dev) {
dev_node_t *node = kmalloc(sizeof(dev_node_t), GFP_KERNEL);
+ if (!node)
+ return NULL;
strcpy(node->dev_name, dev->name);
node->major = node->minor = 0;
node->next = NULL;
/* Make certain the descriptor lists are aligned. */
{
void *mem = kmalloc(sizeof(*vp) + 15, GFP_KERNEL);
+ if (!mem)
+ return NULL;
vp = (void *)(((long)mem + 15) & ~15);
vp->priv_addr = mem;
}
* Copyright (C) 1998 Elmer.Joandi@ut.ee, +37-255-13500
* Gnu Public License applies
* This module provides support for the Arlan 655 card made by Aironet
+ *
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/15/2000
+ * - fix some leaks on failure at arlan_allocate_device
+ * - check kmalloc in arlan_probe and init_module
*/
return 0;
}
- memset(dev->priv,0,sizeof(struct arlan_private));
+ if (devs)
+ memset(dev->priv,0,sizeof(struct arlan_private));
((struct arlan_private *) dev->priv)->conf =
kmalloc(sizeof(struct arlan_shmem), GFP_KERNEL);
- if (dev == NULL || dev->priv == NULL ||
- ((struct arlan_private *) dev->priv)->conf == NULL)
+ if (((struct arlan_private *) dev->priv)->conf == NULL)
{
- return 0;
printk(KERN_CRIT " No memory at arlan_allocate_device \n");
+ if (!devs)
+ kfree(dev);
+ else
+ kfree(dev->priv);
+ return 0;
}
/* Fill in the 'dev' fields. */
dev->base_addr = 0;
printk("Arlan driver %s\n", arlan_version);
if (arlan_probe_everywhere(dev))
- return ENODEV;
+ return -ENODEV;
arlans_found++;
- if (arlans_found == 1)
+ if (arlans_found == 1) {
siteName = kmalloc(100, GFP_KERNEL);
+ if (!siteName)
+ return -ENOMEM;
+ }
return 0;
}
}
for (i = 0; i < numDevices && i < MAX_ARLANS; i++)
{
- if (!arlan_allocate_device(i, NULL))
+ if (!arlan_allocate_device(i, NULL)) {
+ kfree(siteName);
return -1;
+ }
if (arlan_device[i] == NULL)
{
+ kfree(siteName);
printk(KERN_CRIT "arlan: Not Enough memory \n");
return -1;
}
*
* v0.1 - first working version.
* v0.2 - changed stats to be calculated by summing slaves stats.
+ *
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ * - fix leaks on failure at bond_init
*
*/
slave=next;
queue->num_slaves--;
}
-
+ queue->head = NULL;
+
restore_flags(flags);
MOD_DEC_USE_COUNT;
bond = (struct bonding *) dev->priv;
bond->queue = kmalloc(sizeof(struct slave_queue), GFP_KERNEL);
- if (bond->queue == NULL)
+ if (bond->queue == NULL) {
+ kfree(dev->priv);
return -ENOMEM;
+ }
memset(bond->queue, 0, sizeof(struct slave_queue));
bond->stats = kmalloc(sizeof(struct enet_statistics), GFP_KERNEL);
- if (bond->stats == NULL)
+ if (bond->stats == NULL) {
+ kfree(dev->priv);
+ kfree(bond->queue);
return -ENOMEM;
+ }
memset(bond->stats, 0, sizeof(struct enet_statistics));
static __inline__ void open_port(port_t *port)
{
writeb(1, port->win0base+C101_DTR);
+ sca_out(0, MSCI1_OFFSET + CTL, port); /* RTS uses ch#2 output */
}
static __inline__ void close_port(port_t *port)
{
writeb(0, port->win0base+C101_DTR);
+ sca_out(CTL_NORTS, MSCI1_OFFSET + CTL, port);
}
/* $Id: com20020.c,v 1.6 1997/11/09 11:04:58 mj Exp $
- Written 1997 by David Woodhouse <dwmw2@cam.ac.uk>
+ Written 1997 by David Woodhouse <dwmw2@infradead.org>
Derived from the original arcnet.c,
Written 1994-1996 by Avery Pennarun,
if (dev->irq==2) dev->irq=9;
- if (register_netdev(dev) != 0)
+ if (register_netdev(dev) != 0) {
+ kfree(dev->name);
+ kfree(dev);
return -EIO;
+ }
/* Increase use count of arcnet.o */
arcnet_use_count(1);
/* $Id: com90io.c,v 1.6 1997/11/09 11:04:59 mj Exp $
- Written 1997 by David Woodhouse <dwmw2@cam.ac.uk>
+ Written 1997 by David Woodhouse <dwmw2@infradead.org>
Derived from the original arcnet.c,
Written 1994-1996 by Avery Pennarun,
if (dev->irq==2) dev->irq=9;
- if (register_netdev(dev) != 0)
+ if (register_netdev(dev) != 0) {
+ kfree(dev->name);
+ kfree(dev);
return -EIO;
+ }
/* Increase use count of arcnet.o */
arcnet_use_count(1);
*
* Copyright (C) 1995-2000 ITConsult-Pro Co. <info@itc.hu>
*
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 0.86
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* Version 0.85 (00/01/14):
* - some additional workarounds :/
* - printk cleanups
+ * Version 0.86 (00/08/15):
+ * - resource release on failure at COMX_init
*/
-#define VERSION "0.85"
+#define VERSION "0.86"
#include <asm/uaccess.h>
#include <asm/io.h>
if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir))
== NULL) {
- return -EIO;
+ goto cleanup_HW_privdata;
}
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir))
== NULL) {
- return -EIO;
+ goto cleanup_filename_io;
}
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_irq;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = &comxhw_write_proc;
if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw) {
if ((new_file = create_proc_entry(FILENAME_CLOCK, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_channel;
}
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
if ((new_file = create_proc_entry(FILENAME_MEMADDR, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_clock;
}
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_memaddr;
}
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
if ((new_file = create_proc_entry(FILENAME_FIRMWARE, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_twin;
}
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
MOD_INC_USE_COUNT;
return 0;
+cleanup_filename_twin:
+ remove_proc_entry(FILENAME_TWIN, ch->procdir);
+cleanup_filename_memaddr:
+ remove_proc_entry(FILENAME_MEMADDR, ch->procdir);
+cleanup_filename_clock:
+ if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw)
+ remove_proc_entry(FILENAME_CLOCK, ch->procdir);
+cleanup_filename_channel:
+ remove_proc_entry(FILENAME_CHANNEL, ch->procdir);
+cleanup_filename_irq:
+ remove_proc_entry(FILENAME_IRQ, ch->procdir);
+cleanup_filename_io:
+ remove_proc_entry(FILENAME_IO, ch->procdir);
+cleanup_HW_privdata:
+ kfree(ch->HW_privdata);
+ return -EIO;
}
/* Called on echo valami >boardtype */
* Based on skeleton code and old LoCOMX driver by Tivadar Szemethy <tiv@itc.hu>
* and the hostess_sv11 driver
*
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.14)
+ *
* Copyright (C) 1999 ITConsult-Pro Co. <info@itc.hu>
*
* This program is free software; you can redistribute it and/or
* Version 0.13 (99/07/08):
* - Fix the transmitter status check
* - Handle the net device statistics better
+ * Version 0.14 (00/08/15):
+ * - resource release on failure at LOCOMX_init
*/
-#define VERSION "0.13"
+#define VERSION "0.14"
#include <linux/config.h>
#include <linux/module.h>
/* Register /proc files */
if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_HW_privdata;
}
new_file->data = (void *)new_file;
new_file->read_proc = &locomx_read_proc;
if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_io;
}
new_file->data = (void *)new_file;
new_file->read_proc = &locomx_read_proc;
/* O.K. Count one more user on this module */
MOD_INC_USE_COUNT;
return 0;
+cleanup_filename_io:
+ remove_proc_entry(FILENAME_IO, ch->procdir);
+cleanup_HW_privdata:
+ kfree(ch->HW_privdata);
+ return -EIO;
}
*
* Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu>
*
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.65)
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
*
* Version 0.64 (99/12/01):
* - some more cosmetical fixes
+ *
+ * Version 0.65 (00/08/15)
+ * - resource release on failure at MIXCOM_init
*/
-#define VERSION "0.64"
+#define VERSION "0.65"
#include <linux/config.h>
#include <linux/module.h>
if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_HW_privdata;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_io;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_irq;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_channel;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
MOD_INC_USE_COUNT;
return 0;
+cleanup_filename_channel:
+ remove_proc_entry(FILENAME_CHANNEL, ch->procdir);
+cleanup_filename_irq:
+ remove_proc_entry(FILENAME_IRQ, ch->procdir);
+cleanup_filename_io:
+ remove_proc_entry(FILENAME_IO, ch->procdir);
+cleanup_HW_privdata:
+ kfree(ch->HW_privdata);
+ return -EIO;
}
static int MIXCOM_exit(struct device *dev)
* Maintainer: Gergely Madarasz <gorgo@itc.hu>
*
* Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu>
+ *
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.73)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 0.72 (99/07/09):
* - handle slave tbusy with master tbusy (should be fixed)
* - fix the keepalive timer addition/deletion
+ * Version 0.73 (00/08/15)
+ * - resource release on failure at fr_master_init and
+ * fr_slave_init
*/
-#define VERSION "0.72"
+#define VERSION "0.73"
#include <linux/config.h>
#include <linux/module.h>
if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -ENOMEM;
+ goto cleanup_LINE_privdata;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &fr_read_proc;
new_file->write_proc = &fr_write_proc;
if ((new_file = create_proc_entry(FILENAME_KEEPALIVE, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -ENOMEM;
+ goto cleanup_filename_dlci;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &fr_read_proc;
new_file->write_proc = &fr_write_proc;
MOD_INC_USE_COUNT;
return 0;
+cleanup_filename_dlci:
+ remove_proc_entry(FILENAME_DLCI, ch->procdir);
+cleanup_LINE_privdata:
+ kfree(fr);
+ return -EIO;
}
static int fr_slave_init(struct device *dev)
if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -ENOMEM;
+ goto cleanup_LINE_privdata;
}
new_file->data = (void *)new_file;
if ((new_file = create_proc_entry(FILENAME_MASTER, S_IFREG | 0644,
ch->procdir)) == NULL) {
- return -EIO;
+ goto cleanup_filename_dlci;
}
+
new_file->data = (void *)new_file;
new_file->read_proc = &fr_read_proc;
new_file->write_proc = &fr_write_proc;
new_file->nlink = 1;
MOD_INC_USE_COUNT;
return 0;
+cleanup_filename_dlci:
+ remove_proc_entry(FILENAME_DLCI, ch->procdir);
+cleanup_LINE_privdata:
+ kfree(fr);
+ return -EIO;
}
static int dlci_open(struct device *dev)
ch->LINE_privdata = kmalloc(sizeof(struct syncppp_data), GFP_KERNEL);
+ if (!ch->LINE_privdata)
+ return -ENOMEM;
+
pppdev->dev = dev;
sppp_attach(pppdev);
*
* Copyright (C) 1995-1999 ITConsult-Pro Co.
*
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.85)
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* Version 0.84 (99/12/01):
* - comx_status should not check for IFF_UP (to report
* line status from dev->open())
+ * Version 0.85 (00/08/15):
+ * - resource release on failure in comx_mkdir
+ * - fix return value on failure at comx_write_proc
*/
-#define VERSION "0.84"
+#define VERSION "0.85"
#include <linux/config.h>
#include <linux/module.h>
ch->loadavg_size = ch->loadavg[2] / ch->loadavg[0] + 1;
if ((ch->avg_bytes = kmalloc(ch->loadavg_size *
sizeof(unsigned long) * 2, GFP_KERNEL)) == NULL) {
+ kfree(ch);
return -ENOMEM;
}
ch->debug_start = ch->debug_end = 0;
restore_flags(flags);
free_page((unsigned long)page);
- return count;
+ return ret ? ret : count;
}
if (*page != '+' && *page != '-') {
struct proc_dir_entry *new_dir, *debug_file;
struct device *dev;
struct comx_channel *ch;
+ int ret = -EIO;
if (dir->i_ino != comx_root_dir.low_ino) return -ENOTDIR;
+ if ((dev = kmalloc(sizeof(struct device), GFP_KERNEL)) == NULL) {
+ return -ENOMEM;
+ }
+ memset(dev, 0, sizeof(struct device));
+
if ((new_dir = create_proc_entry(dentry->d_name.name, mode | S_IFDIR,
&comx_root_dir)) == NULL) {
- return -EIO;
+ goto cleanup_dev;
}
new_dir->ops = &proc_dir_inode_operations; // ez egy normalis /proc konyvtar
/* Ezek kellenek */
if (!create_comx_proc_entry(FILENAME_HARDWARE, 0644,
strlen(HWNAME_NONE) + 1, new_dir)) {
- return -ENOMEM;
+ goto cleanup_new_dir;
}
if (!create_comx_proc_entry(FILENAME_PROTOCOL, 0644,
strlen(PROTONAME_NONE) + 1, new_dir)) {
- return -ENOMEM;
+ goto cleanup_filename_hardware;
}
if (!create_comx_proc_entry(FILENAME_STATUS, 0444, 0, new_dir)) {
- return -ENOMEM;
+ goto cleanup_filename_protocol;
}
if (!create_comx_proc_entry(FILENAME_LINEUPDELAY, 0644, 2, new_dir)) {
- return -ENOMEM;
+ goto cleanup_filename_status;
}
if ((debug_file = create_proc_entry(FILENAME_DEBUG,
S_IFREG | 0644, new_dir)) == NULL) {
- return -ENOMEM;
+ goto cleanup_filename_lineupdelay;
}
debug_file->ops = &comx_debug_inode_ops;
debug_file->data = (void *)debug_file;
debug_file->write_proc = &comx_write_proc;
debug_file->nlink = 1;
- if ((dev = kmalloc(sizeof(struct device), GFP_KERNEL)) == NULL) {
- return -ENOMEM;
- }
- memset(dev, 0, sizeof(struct device));
dev->name = (char *)new_dir->name;
dev->init = comx_init_dev;
if (register_netdevice(dev)) {
- return -EIO;
+ goto cleanup_filename_debug;
}
ch=dev->priv;
if((ch->if_ptr = (void *)kmalloc(sizeof(struct ppp_device),
GFP_KERNEL)) == NULL) {
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto cleanup_register;
}
memset(ch->if_ptr, 0, sizeof(struct ppp_device));
ch->debug_file = debug_file;
ch->debug_start = ch->debug_end = 0;
if ((ch->debug_area = kmalloc(ch->debug_size = DEFAULT_DEBUG_SIZE,
GFP_KERNEL)) == NULL) {
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto cleanup_if_ptr;
}
ch->lineup_delay = DEFAULT_LINEUP_DELAY;
MOD_INC_USE_COUNT;
return 0;
+cleanup_if_ptr:
+ kfree(ch->if_ptr);
+cleanup_register:
+ unregister_netdevice(dev);
+cleanup_filename_debug:
+ remove_proc_entry(FILENAME_DEBUG, new_dir);
+cleanup_filename_lineupdelay:
+ remove_proc_entry(FILENAME_LINEUPDELAY, new_dir);
+cleanup_filename_status:
+ remove_proc_entry(FILENAME_STATUS, new_dir);
+cleanup_filename_protocol:
+ remove_proc_entry(FILENAME_PROTOCOL, new_dir);
+cleanup_filename_hardware:
+ remove_proc_entry(FILENAME_HARDWARE, new_dir);
+cleanup_new_dir:
+ remove_proc_entry(dentry->d_name.name, &comx_root_dir);
+cleanup_dev:
+ kfree(dev);
+ return ret;
}
static int comx_rmdir(struct inode *dir, struct dentry *dentry)
#define MD2_NRZI 0x20 /* NRZI mode */
#define MD2_LOOPBACK 0x03 /* Local data Loopback */
-#define CTL_RTS 0x01
+#define CTL_NORTS 0x01
#define CTL_IDLE 0x10 /* Transmit an idle pattern */
#define CTL_UDRNC 0x20 /* Idle after CRC or FCS+flag transmition */
if(z8530_init(dev)!=0)
{
printk(KERN_ERR "Z8530 series device not found.\n");
+ restore_flags(flags);
goto dmafail2;
}
z8530_channel_load(&dev->chanB, z8530_dead_port);
/* NS8390 NIC (network interface controller) clone, 16 or 64K on-board RAM */
/* and 10BASE-2 (thin coax) and AUI connectors. */
+/* Changes: */
+/* Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/15/2000 */
+/* - check resource allocation in hydra_probe */
+
#include <linux/module.h>
#include <linux/kernel.h>
init_etherdev(dev, 0);
dev->priv = kmalloc(sizeof(struct hydra_private), GFP_KERNEL);
+
+ if (!dev->priv)
+ return -ENOMEM;
+
priv = (struct hydra_private *)dev->priv;
memset(priv, 0, sizeof(struct hydra_private));
#define sca_reg(reg, card) (0x8000 | (card)->io | \
((reg)&0x0F) | (((reg)&0xF0) << 6))
-#define sca_in(reg, card) readb(sca_reg(reg, card))
-#define sca_out(value, reg, card) writeb(value, sca_reg(reg, card))
-#define sca_inw(reg, card) readw(sca_reg(reg, card))
-#define sca_outw(value, reg, card) writew(value, sca_reg(reg, card))
+#define sca_in(reg, card) inb(sca_reg(reg, card))
+#define sca_out(value, reg, card) outb(value, sca_reg(reg, card))
+#define sca_inw(reg, card) inw(sca_reg(reg, card))
+#define sca_outw(value, reg, card) outw(value, sca_reg(reg, card))
#define port_to_card(port) ((port)->card)
#define log_node(port) ((port)->log_node)
u8 mcr = inb(io+N2_MCR);
if (clock == LINE_EXT_CLOCK) /* External clock */
- mcr |= port->phy_node ? CLOCK_OUT_PORT1 : CLOCK_OUT_PORT0;
- else
mcr &= port->phy_node ? ~CLOCK_OUT_PORT1 : ~CLOCK_OUT_PORT0;
+ else
+ mcr |= port->phy_node ? CLOCK_OUT_PORT1 : CLOCK_OUT_PORT0;
outb(mcr, io+N2_MCR);
port->clkmode = clock;
if(z8530_init(dev)!=0)
{
printk(KERN_ERR "Z8530 series device not found.\n");
+ restore_flags(flags);
goto dmafail2;
}
if(dev->type==Z85C30)
/* We need a codec->codec_reset() function here but the delay is a
reasonable hack for the moment */
+ current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout((5*HZ)/100);
if ((audio = codec->codec_read(codec, AC97_RESET)) & 0x8000) {
printk(KERN_ERR "ac97_codec: %s ac97 codec not present\n",
memcpy(state->dmabuf.rawbuf + (2048*state->dmabuf.pringbuf++),
state->dmabuf.pbuf+2048*state->dmabuf.ppingbuf++, 2048);
state->dmabuf.ppingbuf&=1;
- if(state->dmabuf.pringbuf > (PAGE_SIZE<<state->dmabuf.buforder)/2048)
+ if(state->dmabuf.pringbuf >= (PAGE_SIZE<<state->dmabuf.buforder)/2048)
state->dmabuf.pringbuf=0;
cs_update_ptr(state);
}
return cs461x_peekBA0(card, BA0_ACSDA);
}
+/*
+ * Do we have the CD potentially enabled either left or right ?
+ */
+
+static int cd_active(int r)
+{
+ int l=(r>>8)&0x7;
+ r&=7;
+ if(l==1 || r==1)
+ return 1; /* CD input */
+ if(l==5 || r==5)
+ return 1; /* Mixer input */
+ if(l==6 || r==6)
+ return 1; /* Mixer 16bit input */
+ return 0;
+}
+
static void cs_ac97_set(struct ac97_codec *dev, u8 reg, u16 val)
{
struct cs_card *card = dev->private_data;
int count;
+ int val2;
+ int val3;
+
+ if(reg==AC97_RECORD_SELECT || reg == AC97_CD_VOL)
+ {
+ val2 = cs_ac97_get(dev, AC97_RECORD_SELECT);
+ val3 = cs_ac97_get(dev, AC97_CD_VOL);
+ }
/*
* 1. Write ACCAD = Command Address Register = 46Ch for AC97 register address
*/
if (cs461x_peekBA0(card, BA0_ACCTL) & ACCTL_DCV)
printk(KERN_WARNING "cs461x: AC'97 write problem, reg = 0x%x, val = 0x%x\n", reg, val);
+
+ /*
+ * Adjust power if the mixer is selected/deselected according
+ * to the CD.
+ *
+ * IF the CD is a valid input source (mixer or direct) AND
+ * the CD is not muted THEN power is needed
+ *
+ * We do two things. When record select changes the input to
+ * add/remove the CD we adjust the power count if the CD is
+ * unmuted.
+ *
+ * When the CD mute changes we adjust the power level if the
+ * CD was a valid input.
+ */
+
+ if(reg==AC97_RECORD_SELECT && cd_active(val)!=cd_active(val2))
+ {
+ int n=-1;
+ /* If we are turning on the port and it is not muted then
+ bump the power level. If we are turning it off and its
+ not muted drop the power level */
+ if(cd_active(val))
+ n=1;
+ if(!(val3 & 0x8000))
+ card->amplifier_ctrl(card, n);
+ }
+
+ /* CD mute change ? */
+
+ if(reg==AC97_CD_VOL)
+ {
+ if(cd_active(val2))
+ {
+ /* Mute bit change ? */
+ if((val3^val)&0x8000)
+ {
+ /* Mute on */
+ if(val&0x8000)
+ card->amplifier_ctrl(card, -1);
+ else /* Mute off power on */
+ card->amplifier_ctrl(card, 1);
+ }
+ }
+ }
}
}
card->ac97_features = eid;
-
+
+ /* If the card has the CD enabled then bump the power to
+ account for it */
+
+ if(cd_active(cs_ac97_get(codec, AC97_RECORD_SELECT)))
+ card->amplifier_ctrl(card, 1);
if ((codec->dev_mixer = register_sound_mixer(&cs_mixer_fops, -1)) < 0) {
printk(KERN_ERR "cs461x: couldn't register mixer!\n");
{
u_long length;
- length = (xres_virtual+bpp-1)/bpp;
+ length = xres_virtual*bpp;
length = (length+31)&-32;
length >>= 3;
return(length);
tmp = *p;
found_first:
tmp |= ~0UL << size;
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
tmp = cpu_to_le32p(p);
found_first:
tmp |= ~0U << size;
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
}
}
+struct task_struct;
extern void __sti(void);
extern void __cli(void);
struct device_node;
extern void note_scsi_host(struct device_node *, void *);
-struct task_struct;
#define switch_to(prev,next,last) _switch_to((prev),(next),&(last))
extern void _switch_to(struct task_struct *, struct task_struct *,
struct task_struct **);
EXPORT_SYMBOL(do_gettimeofday);
EXPORT_SYMBOL(loops_per_sec);
EXPORT_SYMBOL(kstat);
+EXPORT_SYMBOL(pidhash);
/* misc */
EXPORT_SYMBOL(panic);
/* init task, for moving kthread roots - ought to export a function ?? */
EXPORT_SYMBOL(init_task_union);
+/* Support for external backtracer */
+extern char _stext[], _etext[];
+EXPORT_SYMBOL(_stext);
+EXPORT_SYMBOL(_etext);
+EXPORT_SYMBOL(module_list);
+
+
* Created at: Sun May 31 10:12:43 1998
* Modified at: Tue Apr 11 19:06:24 2000
* Modified by: Dag Brattli <dagb@cs.uit.no>
- * Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc.
+ * Sources: af_netrom.c, af_ax25.c, af_rose.c, af_x25.c etc.
*
* Copyright (c) 1999-2000 Dag Brattli <dagb@cs.uit.no>
* Copyright (c) 1999 Jean Tourrilhes <jeant@rockfort.hpl.hp.com>
sock->sk = NULL;
sk->socket = NULL; /* Not used, but we should do this. */
sk->protinfo.irda = NULL;
- sock_put(sk);
return 0;
}
buf[0]);
/* Skip this parameter */
- n += (2 + buf[n+1]);
- len -= (2 + buf[n+1]);
-
- return 0; /* Continue */
+ return 2 + buf[n + 1]; /* Continue */
}
/* Lookup the info on how to parse this parameter */
if (!pi_minor_info->func) {
MESSAGE(__FUNCTION__"(), no handler for pi=%#x\n", buf[n]);
/* Skip this parameter */
- n += (2 + buf[n+1]);
- len -= (2 + buf[n+1]);
-
- return 0; /* Continue */
+ return 2 + buf[n + 1]; /* Continue */
}
/* Parse parameter value */
if (current->pid == rpciod_pid)
printk(KERN_ERR "RPC: rpciod waiting on sync task!\n");
- sti();
__wait_event(task->tk_wait, RPC_IS_RUNNING(task));
- cli();
/*
* When the task received a signal, remove from
* any queues etc, and make runnable again.
*/
- if (signalled())
+ if (signalled()) {
+ cli();
__rpc_wake_up(task);
+ }
dprintk("RPC: %4d sync task resuming\n",
task->tk_pid);