aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/pci_irq.c1
-rw-r--r--drivers/base/cpu.c11
-rw-r--r--drivers/block/ll_rw_blk.c73
-rw-r--r--drivers/block/pktcdvd.c3
-rw-r--r--drivers/cdrom/cm206.c113
-rw-r--r--drivers/cdrom/sonycd535.c3
-rw-r--r--drivers/char/Kconfig4
-rw-r--r--drivers/char/amiserial.c4
-rw-r--r--drivers/char/applicom.c2
-rw-r--r--drivers/char/drm/Kconfig2
-rw-r--r--drivers/char/drm/Makefile5
-rw-r--r--drivers/char/drm/drmP.h5
-rw-r--r--drivers/char/drm/drm_bufs.c25
-rw-r--r--drivers/char/drm/drm_context.c6
-rw-r--r--drivers/char/drm/drm_ioc32.c1069
-rw-r--r--drivers/char/drm/i915_dma.c24
-rw-r--r--drivers/char/drm/i915_drm.h27
-rw-r--r--drivers/char/drm/i915_drv.c25
-rw-r--r--drivers/char/drm/i915_drv.h24
-rw-r--r--drivers/char/drm/i915_irq.c24
-rw-r--r--drivers/char/drm/i915_mem.c24
-rw-r--r--drivers/char/drm/radeon_drv.c3
-rw-r--r--drivers/char/drm/radeon_drv.h3
-rw-r--r--drivers/char/drm/radeon_ioc32.c395
-rw-r--r--drivers/char/drm/radeon_irq.c27
-rw-r--r--drivers/char/ds1620.c3
-rw-r--r--drivers/char/ftape/compressor/zftape-compress.c4
-rw-r--r--drivers/char/hpet.c2
-rw-r--r--drivers/char/i8k.c909
-rw-r--r--drivers/char/ip2/i2cmd.c6
-rw-r--r--drivers/char/ip2/i2cmd.h12
-rw-r--r--drivers/char/ip2main.c10
-rw-r--r--drivers/char/isicom.c12
-rw-r--r--drivers/char/istallion.c3
-rw-r--r--drivers/char/mem.c53
-rw-r--r--drivers/char/misc.c8
-rw-r--r--drivers/char/mwave/3780i.c6
-rw-r--r--drivers/char/mwave/3780i.h4
-rw-r--r--drivers/char/mwave/tp3780i.c14
-rw-r--r--drivers/char/nvram.c6
-rw-r--r--drivers/char/rio/func.h1
-rw-r--r--drivers/char/rio/rio_linux.c5
-rw-r--r--drivers/char/rio/rioinit.c7
-rw-r--r--drivers/char/rio/riotty.c15
-rw-r--r--drivers/char/rocket.c226
-rw-r--r--drivers/char/rocket_int.h40
-rw-r--r--drivers/char/sysrq.c24
-rw-r--r--drivers/char/toshiba.c60
-rw-r--r--drivers/char/tpm/tpm.c12
-rw-r--r--drivers/char/tpm/tpm.h14
-rw-r--r--drivers/char/tpm/tpm_atmel.c16
-rw-r--r--drivers/char/tpm/tpm_nsc.c93
-rw-r--r--drivers/char/tty_io.c10
-rw-r--r--drivers/firmware/efivars.c7
-rw-r--r--drivers/i2c/busses/i2c-mpc.c204
-rw-r--r--drivers/ieee1394/ieee1394_core.c4
-rw-r--r--drivers/ieee1394/nodemgr.c2
-rw-r--r--drivers/input/gameport/gameport.c2
-rw-r--r--drivers/input/serio/i8042.c2
-rw-r--r--drivers/input/serio/serio.c2
-rw-r--r--drivers/isdn/act2000/capi.c2
-rw-r--r--drivers/isdn/act2000/capi.h1
-rw-r--r--drivers/isdn/hardware/avm/b1dma.c4
-rw-r--r--drivers/isdn/hardware/avm/c4.c6
-rw-r--r--drivers/isdn/hardware/avm/t1isa.c2
-rw-r--r--drivers/isdn/hisax/Makefile2
-rw-r--r--drivers/isdn/hisax/amd7930_fn.c8
-rw-r--r--drivers/isdn/hisax/asuscom.c4
-rw-r--r--drivers/isdn/hisax/avm_pci.c18
-rw-r--r--drivers/isdn/hisax/bkm_a4t.c4
-rw-r--r--drivers/isdn/hisax/bkm_a8.c6
-rw-r--r--drivers/isdn/hisax/callc.c6
-rw-r--r--drivers/isdn/hisax/config.c14
-rw-r--r--drivers/isdn/hisax/diva.c4
-rw-r--r--drivers/isdn/hisax/elsa.c8
-rw-r--r--drivers/isdn/hisax/elsa_ser.c20
-rw-r--r--drivers/isdn/hisax/enternow.h51
-rw-r--r--drivers/isdn/hisax/enternow_pci.c91
-rw-r--r--drivers/isdn/hisax/gazel.c5
-rw-r--r--drivers/isdn/hisax/hfc4s8s_l1.c2
-rw-r--r--drivers/isdn/hisax/hfc_2bds0.c12
-rw-r--r--drivers/isdn/hisax/hfc_2bs0.c12
-rw-r--r--drivers/isdn/hisax/hfc_pci.c12
-rw-r--r--drivers/isdn/hisax/hfc_pci.h1
-rw-r--r--drivers/isdn/hisax/hfc_sx.c10
-rw-r--r--drivers/isdn/hisax/hfc_sx.h1
-rw-r--r--drivers/isdn/hisax/hfc_usb.c6
-rw-r--r--drivers/isdn/hisax/hfc_usb.h4
-rw-r--r--drivers/isdn/hisax/hfcscard.c2
-rw-r--r--drivers/isdn/hisax/hisax.h5
-rw-r--r--drivers/isdn/hisax/hscx.c4
-rw-r--r--drivers/isdn/hisax/icc.c6
-rw-r--r--drivers/isdn/hisax/ipacx.c86
-rw-r--r--drivers/isdn/hisax/isac.c6
-rw-r--r--drivers/isdn/hisax/isar.c46
-rw-r--r--drivers/isdn/hisax/isdnl1.c8
-rw-r--r--drivers/isdn/hisax/isdnl2.c100
-rw-r--r--drivers/isdn/hisax/isdnl3.c2
-rw-r--r--drivers/isdn/hisax/isurf.c2
-rw-r--r--drivers/isdn/hisax/ix1_micro.c4
-rw-r--r--drivers/isdn/hisax/jade.c6
-rw-r--r--drivers/isdn/hisax/jade.h1
-rw-r--r--drivers/isdn/hisax/l3_1tr6.c2
-rw-r--r--drivers/isdn/hisax/l3dss1.c2
-rw-r--r--drivers/isdn/hisax/l3ni1.c4
-rw-r--r--drivers/isdn/hisax/mic.c4
-rw-r--r--drivers/isdn/hisax/netjet.c12
-rw-r--r--drivers/isdn/hisax/niccy.c4
-rw-r--r--drivers/isdn/hisax/nj_s.c2
-rw-r--r--drivers/isdn/hisax/nj_u.c2
-rw-r--r--drivers/isdn/hisax/q931.c4
-rw-r--r--drivers/isdn/hisax/s0box.c4
-rw-r--r--drivers/isdn/hisax/saphir.c2
-rw-r--r--drivers/isdn/hisax/sedlbauer.c6
-rw-r--r--drivers/isdn/hisax/sportster.c6
-rw-r--r--drivers/isdn/hisax/st5481.h4
-rw-r--r--drivers/isdn/hisax/st5481_hdlc.c580
-rw-r--r--drivers/isdn/hisax/st5481_hdlc.h62
-rw-r--r--drivers/isdn/hisax/st5481_usb.c10
-rw-r--r--drivers/isdn/hisax/tei.c2
-rw-r--r--drivers/isdn/hisax/teleint.c4
-rw-r--r--drivers/isdn/hisax/teles0.c4
-rw-r--r--drivers/isdn/hisax/teles3.c4
-rw-r--r--drivers/isdn/hisax/telespci.c4
-rw-r--r--drivers/isdn/hisax/w6692.c6
-rw-r--r--drivers/isdn/i4l/isdn_audio.c10
-rw-r--r--drivers/isdn/i4l/isdn_audio.h1
-rw-r--r--drivers/isdn/i4l/isdn_common.c6
-rw-r--r--drivers/isdn/i4l/isdn_common.h1
-rw-r--r--drivers/isdn/i4l/isdn_concap.c15
-rw-r--r--drivers/isdn/i4l/isdn_concap.h1
-rw-r--r--drivers/isdn/i4l/isdn_net.c10
-rw-r--r--drivers/isdn/i4l/isdn_tty.c4
-rw-r--r--drivers/isdn/i4l/isdn_tty.h1
-rw-r--r--drivers/isdn/i4l/isdn_ttyfax.c6
-rw-r--r--drivers/isdn/i4l/isdn_x25iface.c36
-rw-r--r--drivers/isdn/pcbit/callbacks.c17
-rw-r--r--drivers/isdn/pcbit/callbacks.h3
-rw-r--r--drivers/isdn/pcbit/capi.c10
-rw-r--r--drivers/isdn/pcbit/capi.h1
-rw-r--r--drivers/isdn/pcbit/drv.c16
-rw-r--r--drivers/isdn/sc/Makefile2
-rw-r--r--drivers/isdn/sc/command.c88
-rw-r--r--drivers/isdn/sc/debug.c46
-rw-r--r--drivers/isdn/sc/init.c21
-rw-r--r--drivers/isdn/sc/interrupt.c2
-rw-r--r--drivers/isdn/sc/ioctl.c5
-rw-r--r--drivers/isdn/sc/packet.c16
-rw-r--r--drivers/isdn/sc/shmem.c2
-rw-r--r--drivers/isdn/sc/timer.c18
-rw-r--r--drivers/macintosh/therm_adt746x.c4
-rw-r--r--drivers/mca/mca-legacy.c1
-rw-r--r--drivers/md/md.c3
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c3
-rw-r--r--drivers/media/video/cx88/cx88.h1
-rw-r--r--drivers/media/video/msp3400.c3
-rw-r--r--drivers/media/video/video-buf-dvb.c3
-rw-r--r--drivers/net/8139too.c2
-rw-r--r--drivers/net/irda/sir_kthread.c3
-rw-r--r--drivers/net/irda/stir4200.c4
-rw-r--r--drivers/net/tg3.c337
-rw-r--r--drivers/net/tg3.h24
-rw-r--r--drivers/net/wan/Kconfig2
-rw-r--r--drivers/net/wireless/airo.c2
-rw-r--r--drivers/pcmcia/cs.c2
-rw-r--r--drivers/pnp/pnpbios/core.c2
-rw-r--r--drivers/s390/Kconfig7
-rw-r--r--drivers/s390/block/dasd.c30
-rw-r--r--drivers/s390/block/dasd_proc.c3
-rw-r--r--drivers/s390/block/dcssblk.c4
-rw-r--r--drivers/s390/char/Makefile1
-rw-r--r--drivers/s390/char/con3215.c4
-rw-r--r--drivers/s390/char/con3270.c4
-rw-r--r--drivers/s390/char/tape_34xx.c6
-rw-r--r--drivers/s390/char/tape_core.c2
-rw-r--r--drivers/s390/char/tape_proc.c1
-rw-r--r--drivers/s390/char/vmcp.c219
-rw-r--r--drivers/s390/char/vmcp.h30
-rw-r--r--drivers/s390/char/vmlogrdr.c10
-rw-r--r--drivers/s390/cio/ccwgroup.c30
-rw-r--r--drivers/s390/cio/cio.c8
-rw-r--r--drivers/s390/cio/css.c34
-rw-r--r--drivers/s390/cio/device.c84
-rw-r--r--drivers/s390/cio/qdio.c14
-rw-r--r--drivers/s390/cio/qdio.h16
-rw-r--r--drivers/s390/net/claw.c4
-rw-r--r--drivers/s390/net/ctcdbug.c10
-rw-r--r--drivers/s390/net/ctcdbug.h10
-rw-r--r--drivers/s390/net/iucv.h6
-rw-r--r--drivers/s390/net/lcs.c8
-rw-r--r--drivers/s390/net/netiucv.c12
-rw-r--r--drivers/s390/net/qeth.h14
-rw-r--r--drivers/s390/net/qeth_main.c14
-rw-r--r--drivers/s390/net/smsgiucv.c4
-rw-r--r--drivers/s390/s390mach.c321
-rw-r--r--drivers/s390/s390mach.h35
-rw-r--r--drivers/scsi/dpt_i2o.c7
-rw-r--r--drivers/scsi/dpti.h12
-rw-r--r--drivers/scsi/initio.c85
-rw-r--r--drivers/scsi/initio.h18
-rw-r--r--drivers/serial/68328serial.c9
-rw-r--r--drivers/serial/68360serial.c9
-rw-r--r--drivers/serial/icom.h2
-rw-r--r--drivers/serial/mpsc.c8
-rw-r--r--drivers/serial/sunzilog.c8
-rw-r--r--drivers/telephony/ixj.c52
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/gadget/file_storage.c3
-rw-r--r--drivers/usb/storage/usb.c4
-rw-r--r--drivers/video/au1100fb.c18
-rw-r--r--drivers/video/console/Kconfig5
-rw-r--r--drivers/video/fbsysfs.c2
-rw-r--r--drivers/video/matrox/matroxfb_misc.c5
-rw-r--r--drivers/video/vesafb.c9
-rw-r--r--drivers/w1/w1.c4
216 files changed, 3737 insertions, 3234 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 670fdb5142d1..86c52520ed34 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -55,7 +55,7 @@ if ACPI_INTERPRETER
55 55
56config ACPI_SLEEP 56config ACPI_SLEEP
57 bool "Sleep States (EXPERIMENTAL)" 57 bool "Sleep States (EXPERIMENTAL)"
58 depends on X86 58 depends on X86 && (!SMP || SUSPEND_SMP)
59 depends on EXPERIMENTAL && PM 59 depends on EXPERIMENTAL && PM
60 default y 60 default y
61 ---help--- 61 ---help---
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 8093f2e00321..8dbf802ee7f8 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -435,6 +435,7 @@ acpi_pci_irq_enable (
435 /* Interrupt Line values above 0xF are forbidden */ 435 /* Interrupt Line values above 0xF are forbidden */
436 if (dev->irq >= 0 && (dev->irq <= 0xF)) { 436 if (dev->irq >= 0 && (dev->irq <= 0xF)) {
437 printk(" - using IRQ %d\n", dev->irq); 437 printk(" - using IRQ %d\n", dev->irq);
438 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
438 return_VALUE(0); 439 return_VALUE(0);
439 } 440 }
440 else { 441 else {
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 6ef3069b5710..b79badd0f158 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -16,6 +16,11 @@ struct sysdev_class cpu_sysdev_class = {
16EXPORT_SYMBOL(cpu_sysdev_class); 16EXPORT_SYMBOL(cpu_sysdev_class);
17 17
18#ifdef CONFIG_HOTPLUG_CPU 18#ifdef CONFIG_HOTPLUG_CPU
19int __attribute__((weak)) smp_prepare_cpu (int cpu)
20{
21 return 0;
22}
23
19static ssize_t show_online(struct sys_device *dev, char *buf) 24static ssize_t show_online(struct sys_device *dev, char *buf)
20{ 25{
21 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 26 struct cpu *cpu = container_of(dev, struct cpu, sysdev);
@@ -36,7 +41,11 @@ static ssize_t store_online(struct sys_device *dev, const char *buf,
36 kobject_hotplug(&dev->kobj, KOBJ_OFFLINE); 41 kobject_hotplug(&dev->kobj, KOBJ_OFFLINE);
37 break; 42 break;
38 case '1': 43 case '1':
39 ret = cpu_up(cpu->sysdev.id); 44 ret = smp_prepare_cpu(cpu->sysdev.id);
45 if (!ret)
46 ret = cpu_up(cpu->sysdev.id);
47 if (!ret)
48 kobject_hotplug(&dev->kobj, KOBJ_ONLINE);
40 break; 49 break;
41 default: 50 default:
42 ret = -EINVAL; 51 ret = -EINVAL;
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index fd94ea27d594..60e64091de1b 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -37,6 +37,7 @@
37 37
38static void blk_unplug_work(void *data); 38static void blk_unplug_work(void *data);
39static void blk_unplug_timeout(unsigned long data); 39static void blk_unplug_timeout(unsigned long data);
40static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io);
40 41
41/* 42/*
42 * For the allocated request tables 43 * For the allocated request tables
@@ -1137,7 +1138,7 @@ new_hw_segment:
1137} 1138}
1138 1139
1139 1140
1140int blk_phys_contig_segment(request_queue_t *q, struct bio *bio, 1141static int blk_phys_contig_segment(request_queue_t *q, struct bio *bio,
1141 struct bio *nxt) 1142 struct bio *nxt)
1142{ 1143{
1143 if (!(q->queue_flags & (1 << QUEUE_FLAG_CLUSTER))) 1144 if (!(q->queue_flags & (1 << QUEUE_FLAG_CLUSTER)))
@@ -1158,9 +1159,7 @@ int blk_phys_contig_segment(request_queue_t *q, struct bio *bio,
1158 return 0; 1159 return 0;
1159} 1160}
1160 1161
1161EXPORT_SYMBOL(blk_phys_contig_segment); 1162static int blk_hw_contig_segment(request_queue_t *q, struct bio *bio,
1162
1163int blk_hw_contig_segment(request_queue_t *q, struct bio *bio,
1164 struct bio *nxt) 1163 struct bio *nxt)
1165{ 1164{
1166 if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) 1165 if (unlikely(!bio_flagged(bio, BIO_SEG_VALID)))
@@ -1176,8 +1175,6 @@ int blk_hw_contig_segment(request_queue_t *q, struct bio *bio,
1176 return 1; 1175 return 1;
1177} 1176}
1178 1177
1179EXPORT_SYMBOL(blk_hw_contig_segment);
1180
1181/* 1178/*
1182 * map a request to scatterlist, return number of sg entries setup. Caller 1179 * map a request to scatterlist, return number of sg entries setup. Caller
1183 * must make sure sg can hold rq->nr_phys_segments entries 1180 * must make sure sg can hold rq->nr_phys_segments entries
@@ -1347,8 +1344,8 @@ static int ll_front_merge_fn(request_queue_t *q, struct request *req,
1347static int ll_merge_requests_fn(request_queue_t *q, struct request *req, 1344static int ll_merge_requests_fn(request_queue_t *q, struct request *req,
1348 struct request *next) 1345 struct request *next)
1349{ 1346{
1350 int total_phys_segments = req->nr_phys_segments +next->nr_phys_segments; 1347 int total_phys_segments;
1351 int total_hw_segments = req->nr_hw_segments + next->nr_hw_segments; 1348 int total_hw_segments;
1352 1349
1353 /* 1350 /*
1354 * First check if the either of the requests are re-queued 1351 * First check if the either of the requests are re-queued
@@ -1358,7 +1355,7 @@ static int ll_merge_requests_fn(request_queue_t *q, struct request *req,
1358 return 0; 1355 return 0;
1359 1356
1360 /* 1357 /*
1361 * Will it become to large? 1358 * Will it become too large?
1362 */ 1359 */
1363 if ((req->nr_sectors + next->nr_sectors) > q->max_sectors) 1360 if ((req->nr_sectors + next->nr_sectors) > q->max_sectors)
1364 return 0; 1361 return 0;
@@ -1825,7 +1822,7 @@ static inline int ioc_batching(request_queue_t *q, struct io_context *ioc)
1825 * is the behaviour we want though - once it gets a wakeup it should be given 1822 * is the behaviour we want though - once it gets a wakeup it should be given
1826 * a nice run. 1823 * a nice run.
1827 */ 1824 */
1828void ioc_set_batching(request_queue_t *q, struct io_context *ioc) 1825static void ioc_set_batching(request_queue_t *q, struct io_context *ioc)
1829{ 1826{
1830 if (!ioc || ioc_batching(q, ioc)) 1827 if (!ioc || ioc_batching(q, ioc))
1831 return; 1828 return;
@@ -2254,45 +2251,7 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
2254 2251
2255EXPORT_SYMBOL(blkdev_issue_flush); 2252EXPORT_SYMBOL(blkdev_issue_flush);
2256 2253
2257/** 2254static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
2258 * blkdev_scsi_issue_flush_fn - issue flush for SCSI devices
2259 * @q: device queue
2260 * @disk: gendisk
2261 * @error_sector: error offset
2262 *
2263 * Description:
2264 * Devices understanding the SCSI command set, can use this function as
2265 * a helper for issuing a cache flush. Note: driver is required to store
2266 * the error offset (in case of error flushing) in ->sector of struct
2267 * request.
2268 */
2269int blkdev_scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk,
2270 sector_t *error_sector)
2271{
2272 struct request *rq = blk_get_request(q, WRITE, __GFP_WAIT);
2273 int ret;
2274
2275 rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER;
2276 rq->sector = 0;
2277 memset(rq->cmd, 0, sizeof(rq->cmd));
2278 rq->cmd[0] = 0x35;
2279 rq->cmd_len = 12;
2280 rq->data = NULL;
2281 rq->data_len = 0;
2282 rq->timeout = 60 * HZ;
2283
2284 ret = blk_execute_rq(q, disk, rq);
2285
2286 if (ret && error_sector)
2287 *error_sector = rq->sector;
2288
2289 blk_put_request(rq);
2290 return ret;
2291}
2292
2293EXPORT_SYMBOL(blkdev_scsi_issue_flush_fn);
2294
2295void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
2296{ 2255{
2297 int rw = rq_data_dir(rq); 2256 int rw = rq_data_dir(rq);
2298 2257
@@ -2551,16 +2510,6 @@ void blk_attempt_remerge(request_queue_t *q, struct request *rq)
2551 2510
2552EXPORT_SYMBOL(blk_attempt_remerge); 2511EXPORT_SYMBOL(blk_attempt_remerge);
2553 2512
2554/*
2555 * Non-locking blk_attempt_remerge variant.
2556 */
2557void __blk_attempt_remerge(request_queue_t *q, struct request *rq)
2558{
2559 attempt_back_merge(q, rq);
2560}
2561
2562EXPORT_SYMBOL(__blk_attempt_remerge);
2563
2564static int __make_request(request_queue_t *q, struct bio *bio) 2513static int __make_request(request_queue_t *q, struct bio *bio)
2565{ 2514{
2566 struct request *req, *freereq = NULL; 2515 struct request *req, *freereq = NULL;
@@ -2971,7 +2920,7 @@ void submit_bio(int rw, struct bio *bio)
2971 2920
2972EXPORT_SYMBOL(submit_bio); 2921EXPORT_SYMBOL(submit_bio);
2973 2922
2974void blk_recalc_rq_segments(struct request *rq) 2923static void blk_recalc_rq_segments(struct request *rq)
2975{ 2924{
2976 struct bio *bio, *prevbio = NULL; 2925 struct bio *bio, *prevbio = NULL;
2977 int nr_phys_segs, nr_hw_segs; 2926 int nr_phys_segs, nr_hw_segs;
@@ -3013,7 +2962,7 @@ void blk_recalc_rq_segments(struct request *rq)
3013 rq->nr_hw_segments = nr_hw_segs; 2962 rq->nr_hw_segments = nr_hw_segs;
3014} 2963}
3015 2964
3016void blk_recalc_rq_sectors(struct request *rq, int nsect) 2965static void blk_recalc_rq_sectors(struct request *rq, int nsect)
3017{ 2966{
3018 if (blk_fs_request(rq)) { 2967 if (blk_fs_request(rq)) {
3019 rq->hard_sector += nsect; 2968 rq->hard_sector += nsect;
@@ -3601,7 +3550,7 @@ static struct sysfs_ops queue_sysfs_ops = {
3601 .store = queue_attr_store, 3550 .store = queue_attr_store,
3602}; 3551};
3603 3552
3604struct kobj_type queue_ktype = { 3553static struct kobj_type queue_ktype = {
3605 .sysfs_ops = &queue_sysfs_ops, 3554 .sysfs_ops = &queue_sysfs_ops,
3606 .default_attrs = default_attrs, 3555 .default_attrs = default_attrs,
3607}; 3556};
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 7f3d78de265c..7b838342f0a3 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1251,8 +1251,7 @@ static int kcdrwd(void *foobar)
1251 VPRINTK("kcdrwd: wake up\n"); 1251 VPRINTK("kcdrwd: wake up\n");
1252 1252
1253 /* make swsusp happy with our thread */ 1253 /* make swsusp happy with our thread */
1254 if (current->flags & PF_FREEZE) 1254 try_to_freeze();
1255 refrigerator(PF_FREEZE);
1256 1255
1257 list_for_each_entry(pkt, &pd->cdrw.pkt_active_list, list) { 1256 list_for_each_entry(pkt, &pd->cdrw.pkt_active_list, list) {
1258 if (!pkt->sleep_time) 1257 if (!pkt->sleep_time)
diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c
index da80b14335a5..01f035173328 100644
--- a/drivers/cdrom/cm206.c
+++ b/drivers/cdrom/cm206.c
@@ -307,7 +307,7 @@ static DEFINE_SPINLOCK(cm206_lock);
307/* First, we define some polling functions. These are actually 307/* First, we define some polling functions. These are actually
308 only being used in the initialization. */ 308 only being used in the initialization. */
309 309
310void send_command_polled(int command) 310static void send_command_polled(int command)
311{ 311{
312 int loop = POLLOOP; 312 int loop = POLLOOP;
313 while (!(inw(r_line_status) & ls_transmitter_buffer_empty) 313 while (!(inw(r_line_status) & ls_transmitter_buffer_empty)
@@ -318,7 +318,7 @@ void send_command_polled(int command)
318 outw(command, r_uart_transmit); 318 outw(command, r_uart_transmit);
319} 319}
320 320
321uch receive_echo_polled(void) 321static uch receive_echo_polled(void)
322{ 322{
323 int loop = POLLOOP; 323 int loop = POLLOOP;
324 while (!(inw(r_line_status) & ls_receive_buffer_full) && loop > 0) { 324 while (!(inw(r_line_status) & ls_receive_buffer_full) && loop > 0) {
@@ -328,13 +328,13 @@ uch receive_echo_polled(void)
328 return ((uch) inw(r_uart_receive)); 328 return ((uch) inw(r_uart_receive));
329} 329}
330 330
331uch send_receive_polled(int command) 331static uch send_receive_polled(int command)
332{ 332{
333 send_command_polled(command); 333 send_command_polled(command);
334 return receive_echo_polled(); 334 return receive_echo_polled();
335} 335}
336 336
337inline void clear_ur(void) 337static inline void clear_ur(void)
338{ 338{
339 if (cd->ur_r != cd->ur_w) { 339 if (cd->ur_r != cd->ur_w) {
340 debug(("Deleting bytes from fifo:")); 340 debug(("Deleting bytes from fifo:"));
@@ -439,7 +439,7 @@ static irqreturn_t cm206_interrupt(int sig, void *dev_id, struct pt_regs *regs)
439} 439}
440 440
441/* we have put the address of the wait queue in who */ 441/* we have put the address of the wait queue in who */
442void cm206_timeout(unsigned long who) 442static void cm206_timeout(unsigned long who)
443{ 443{
444 cd->timed_out = 1; 444 cd->timed_out = 1;
445 debug(("Timing out\n")); 445 debug(("Timing out\n"));
@@ -448,7 +448,7 @@ void cm206_timeout(unsigned long who)
448 448
449/* This function returns 1 if a timeout occurred, 0 if an interrupt 449/* This function returns 1 if a timeout occurred, 0 if an interrupt
450 happened */ 450 happened */
451int sleep_or_timeout(wait_queue_head_t * wait, int timeout) 451static int sleep_or_timeout(wait_queue_head_t * wait, int timeout)
452{ 452{
453 cd->timed_out = 0; 453 cd->timed_out = 0;
454 init_timer(&cd->timer); 454 init_timer(&cd->timer);
@@ -465,13 +465,7 @@ int sleep_or_timeout(wait_queue_head_t * wait, int timeout)
465 return 0; 465 return 0;
466} 466}
467 467
468void cm206_delay(int nr_jiffies) 468static void send_command(int command)
469{
470 DECLARE_WAIT_QUEUE_HEAD(wait);
471 sleep_or_timeout(&wait, nr_jiffies);
472}
473
474void send_command(int command)
475{ 469{
476 debug(("Sending 0x%x\n", command)); 470 debug(("Sending 0x%x\n", command));
477 if (!(inw(r_line_status) & ls_transmitter_buffer_empty)) { 471 if (!(inw(r_line_status) & ls_transmitter_buffer_empty)) {
@@ -490,7 +484,7 @@ void send_command(int command)
490 outw(command, r_uart_transmit); 484 outw(command, r_uart_transmit);
491} 485}
492 486
493uch receive_byte(int timeout) 487static uch receive_byte(int timeout)
494{ 488{
495 uch ret; 489 uch ret;
496 cli(); 490 cli();
@@ -521,23 +515,23 @@ uch receive_byte(int timeout)
521 return ret; 515 return ret;
522} 516}
523 517
524inline uch receive_echo(void) 518static inline uch receive_echo(void)
525{ 519{
526 return receive_byte(UART_TIMEOUT); 520 return receive_byte(UART_TIMEOUT);
527} 521}
528 522
529inline uch send_receive(int command) 523static inline uch send_receive(int command)
530{ 524{
531 send_command(command); 525 send_command(command);
532 return receive_echo(); 526 return receive_echo();
533} 527}
534 528
535inline uch wait_dsb(void) 529static inline uch wait_dsb(void)
536{ 530{
537 return receive_byte(DSB_TIMEOUT); 531 return receive_byte(DSB_TIMEOUT);
538} 532}
539 533
540int type_0_command(int command, int expect_dsb) 534static int type_0_command(int command, int expect_dsb)
541{ 535{
542 int e; 536 int e;
543 clear_ur(); 537 clear_ur();
@@ -552,7 +546,7 @@ int type_0_command(int command, int expect_dsb)
552 return 0; 546 return 0;
553} 547}
554 548
555int type_1_command(int command, int bytes, uch * status) 549static int type_1_command(int command, int bytes, uch * status)
556{ /* returns info */ 550{ /* returns info */
557 int i; 551 int i;
558 if (type_0_command(command, 0)) 552 if (type_0_command(command, 0))
@@ -564,7 +558,7 @@ int type_1_command(int command, int bytes, uch * status)
564 558
565/* This function resets the adapter card. We'd better not do this too 559/* This function resets the adapter card. We'd better not do this too
566 * often, because it tends to generate `lost interrupts.' */ 560 * often, because it tends to generate `lost interrupts.' */
567void reset_cm260(void) 561static void reset_cm260(void)
568{ 562{
569 outw(dc_normal | dc_initialize | READ_AHEAD, r_data_control); 563 outw(dc_normal | dc_initialize | READ_AHEAD, r_data_control);
570 udelay(10); /* 3.3 mu sec minimum */ 564 udelay(10); /* 3.3 mu sec minimum */
@@ -572,7 +566,7 @@ void reset_cm260(void)
572} 566}
573 567
574/* fsm: frame-sec-min from linear address; one of many */ 568/* fsm: frame-sec-min from linear address; one of many */
575void fsm(int lba, uch * fsm) 569static void fsm(int lba, uch * fsm)
576{ 570{
577 fsm[0] = lba % 75; 571 fsm[0] = lba % 75;
578 lba /= 75; 572 lba /= 75;
@@ -581,17 +575,17 @@ void fsm(int lba, uch * fsm)
581 fsm[2] = lba / 60; 575 fsm[2] = lba / 60;
582} 576}
583 577
584inline int fsm2lba(uch * fsm) 578static inline int fsm2lba(uch * fsm)
585{ 579{
586 return fsm[0] + 75 * (fsm[1] - 2 + 60 * fsm[2]); 580 return fsm[0] + 75 * (fsm[1] - 2 + 60 * fsm[2]);
587} 581}
588 582
589inline int f_s_m2lba(uch f, uch s, uch m) 583static inline int f_s_m2lba(uch f, uch s, uch m)
590{ 584{
591 return f + 75 * (s - 2 + 60 * m); 585 return f + 75 * (s - 2 + 60 * m);
592} 586}
593 587
594int start_read(int start) 588static int start_read(int start)
595{ 589{
596 uch read_sector[4] = { c_read_data, }; 590 uch read_sector[4] = { c_read_data, };
597 int i, e; 591 int i, e;
@@ -613,7 +607,7 @@ int start_read(int start)
613 return 0; 607 return 0;
614} 608}
615 609
616int stop_read(void) 610static int stop_read(void)
617{ 611{
618 int e; 612 int e;
619 type_0_command(c_stop, 0); 613 type_0_command(c_stop, 0);
@@ -630,7 +624,7 @@ int stop_read(void)
630 routine takes care of this. Set a flag `background' in the cd 624 routine takes care of this. Set a flag `background' in the cd
631 struct to indicate the process. */ 625 struct to indicate the process. */
632 626
633int read_background(int start, int reading) 627static int read_background(int start, int reading)
634{ 628{
635 if (cd->background) 629 if (cd->background)
636 return -1; /* can't do twice */ 630 return -1; /* can't do twice */
@@ -658,7 +652,7 @@ void transport_data(int port, ush * dest, int count)
658 652
659 653
660#define MAX_TRIES 100 654#define MAX_TRIES 100
661int read_sector(int start) 655static int read_sector(int start)
662{ 656{
663 int tries = 0; 657 int tries = 0;
664 if (cd->background) { 658 if (cd->background) {
@@ -753,7 +747,7 @@ static DECLARE_TASKLET(cm206_tasklet, cm206_tasklet_func, 0);
753/* This command clears the dsb_possible_media_change flag, so we must 747/* This command clears the dsb_possible_media_change flag, so we must
754 * retain it. 748 * retain it.
755 */ 749 */
756void get_drive_status(void) 750static void get_drive_status(void)
757{ 751{
758 uch status[2]; 752 uch status[2];
759 type_1_command(c_drive_status, 2, status); /* this might be done faster */ 753 type_1_command(c_drive_status, 2, status); /* this might be done faster */
@@ -764,7 +758,7 @@ void get_drive_status(void)
764 dsb_drive_not_ready | dsb_tray_not_closed)); 758 dsb_drive_not_ready | dsb_tray_not_closed));
765} 759}
766 760
767void get_disc_status(void) 761static void get_disc_status(void)
768{ 762{
769 if (type_1_command(c_disc_status, 7, cd->disc_status)) { 763 if (type_1_command(c_disc_status, 7, cd->disc_status)) {
770 debug(("get_disc_status: error\n")); 764 debug(("get_disc_status: error\n"));
@@ -801,7 +795,7 @@ static void cm206_release(struct cdrom_device_info *cdi)
801 795
802/* Empty buffer empties $sectors$ sectors of the adapter card buffer, 796/* Empty buffer empties $sectors$ sectors of the adapter card buffer,
803 * and then reads a sector in kernel memory. */ 797 * and then reads a sector in kernel memory. */
804void empty_buffer(int sectors) 798static void empty_buffer(int sectors)
805{ 799{
806 while (sectors >= 0) { 800 while (sectors >= 0) {
807 transport_data(r_fifo_output_buffer, 801 transport_data(r_fifo_output_buffer,
@@ -819,7 +813,7 @@ void empty_buffer(int sectors)
819/* try_adapter. This function determines if the requested sector is 813/* try_adapter. This function determines if the requested sector is
820 in adapter memory, or will appear there soon. Returns 0 upon 814 in adapter memory, or will appear there soon. Returns 0 upon
821 success */ 815 success */
822int try_adapter(int sector) 816static int try_adapter(int sector)
823{ 817{
824 if (cd->adapter_first <= sector && sector < cd->adapter_last) { 818 if (cd->adapter_first <= sector && sector < cd->adapter_last) {
825 /* sector is in adapter memory */ 819 /* sector is in adapter memory */
@@ -910,7 +904,7 @@ static void do_cm206_request(request_queue_t * q)
910*/ 904*/
911 905
912/* seek seeks to address lba. It does wait to arrive there. */ 906/* seek seeks to address lba. It does wait to arrive there. */
913void seek(int lba) 907static void seek(int lba)
914{ 908{
915 int i; 909 int i;
916 uch seek_command[4] = { c_seek, }; 910 uch seek_command[4] = { c_seek, };
@@ -926,7 +920,7 @@ uch bcdbin(unsigned char bcd)
926 return (bcd >> 4) * 10 + (bcd & 0xf); 920 return (bcd >> 4) * 10 + (bcd & 0xf);
927} 921}
928 922
929inline uch normalize_track(uch track) 923static inline uch normalize_track(uch track)
930{ 924{
931 if (track < 1) 925 if (track < 1)
932 return 1; 926 return 1;
@@ -939,7 +933,7 @@ inline uch normalize_track(uch track)
939 * tracks seen in the process. Input $track$ must be between 1 and 933 * tracks seen in the process. Input $track$ must be between 1 and
940 * #-of-tracks+1. Note that the start of the disc must be in toc[1].fsm. 934 * #-of-tracks+1. Note that the start of the disc must be in toc[1].fsm.
941 */ 935 */
942int get_toc_lba(uch track) 936static int get_toc_lba(uch track)
943{ 937{
944 int max = 74 * 60 * 75 - 150, min = fsm2lba(cd->toc[1].fsm); 938 int max = 74 * 60 * 75 - 150, min = fsm2lba(cd->toc[1].fsm);
945 int i, lba, l, old_lba = 0; 939 int i, lba, l, old_lba = 0;
@@ -991,7 +985,7 @@ int get_toc_lba(uch track)
991 return lba; 985 return lba;
992} 986}
993 987
994void update_toc_entry(uch track) 988static void update_toc_entry(uch track)
995{ 989{
996 track = normalize_track(track); 990 track = normalize_track(track);
997 if (!cd->toc[track].track) 991 if (!cd->toc[track].track)
@@ -999,7 +993,7 @@ void update_toc_entry(uch track)
999} 993}
1000 994
1001/* return 0 upon success */ 995/* return 0 upon success */
1002int read_toc_header(struct cdrom_tochdr *hp) 996static int read_toc_header(struct cdrom_tochdr *hp)
1003{ 997{
1004 if (!FIRST_TRACK) 998 if (!FIRST_TRACK)
1005 get_disc_status(); 999 get_disc_status();
@@ -1016,7 +1010,7 @@ int read_toc_header(struct cdrom_tochdr *hp)
1016 return -1; 1010 return -1;
1017} 1011}
1018 1012
1019void play_from_to_msf(struct cdrom_msf *msfp) 1013static void play_from_to_msf(struct cdrom_msf *msfp)
1020{ 1014{
1021 uch play_command[] = { c_play, 1015 uch play_command[] = { c_play,
1022 msfp->cdmsf_frame0, msfp->cdmsf_sec0, msfp->cdmsf_min0, 1016 msfp->cdmsf_frame0, msfp->cdmsf_sec0, msfp->cdmsf_min0,
@@ -1032,7 +1026,7 @@ void play_from_to_msf(struct cdrom_msf *msfp)
1032 cd->dsb = wait_dsb(); 1026 cd->dsb = wait_dsb();
1033} 1027}
1034 1028
1035void play_from_to_track(int from, int to) 1029static void play_from_to_track(int from, int to)
1036{ 1030{
1037 uch play_command[8] = { c_play, }; 1031 uch play_command[8] = { c_play, };
1038 int i; 1032 int i;
@@ -1059,7 +1053,7 @@ void play_from_to_track(int from, int to)
1059 cd->dsb = wait_dsb(); 1053 cd->dsb = wait_dsb();
1060} 1054}
1061 1055
1062int get_current_q(struct cdrom_subchnl *qp) 1056static int get_current_q(struct cdrom_subchnl *qp)
1063{ 1057{
1064 int i; 1058 int i;
1065 uch *q = cd->q; 1059 uch *q = cd->q;
@@ -1093,14 +1087,14 @@ int get_current_q(struct cdrom_subchnl *qp)
1093 return 0; 1087 return 0;
1094} 1088}
1095 1089
1096void invalidate_toc(void) 1090static void invalidate_toc(void)
1097{ 1091{
1098 memset(cd->toc, 0, sizeof(cd->toc)); 1092 memset(cd->toc, 0, sizeof(cd->toc));
1099 memset(cd->disc_status, 0, sizeof(cd->disc_status)); 1093 memset(cd->disc_status, 0, sizeof(cd->disc_status));
1100} 1094}
1101 1095
1102/* cdrom.c guarantees that cdte_format == CDROM_MSF */ 1096/* cdrom.c guarantees that cdte_format == CDROM_MSF */
1103void get_toc_entry(struct cdrom_tocentry *ep) 1097static void get_toc_entry(struct cdrom_tocentry *ep)
1104{ 1098{
1105 uch track = normalize_track(ep->cdte_track); 1099 uch track = normalize_track(ep->cdte_track);
1106 update_toc_entry(track); 1100 update_toc_entry(track);
@@ -1117,8 +1111,8 @@ void get_toc_entry(struct cdrom_tocentry *ep)
1117 * upon success. Memory checking has been done by cdrom_ioctl(), the 1111 * upon success. Memory checking has been done by cdrom_ioctl(), the
1118 * calling function, as well as LBA/MSF sanitization. 1112 * calling function, as well as LBA/MSF sanitization.
1119*/ 1113*/
1120int cm206_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, 1114static int cm206_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
1121 void *arg) 1115 void *arg)
1122{ 1116{
1123 switch (cmd) { 1117 switch (cmd) {
1124 case CDROMREADTOCHDR: 1118 case CDROMREADTOCHDR:
@@ -1189,7 +1183,7 @@ static int cm206_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
1189 } 1183 }
1190} 1184}
1191 1185
1192int cm206_media_changed(struct cdrom_device_info *cdi, int disc_nr) 1186static int cm206_media_changed(struct cdrom_device_info *cdi, int disc_nr)
1193{ 1187{
1194 if (cd != NULL) { 1188 if (cd != NULL) {
1195 int r; 1189 int r;
@@ -1204,16 +1198,9 @@ int cm206_media_changed(struct cdrom_device_info *cdi, int disc_nr)
1204/* The new generic cdrom support. Routines should be concise, most of 1198/* The new generic cdrom support. Routines should be concise, most of
1205 the logic should be in cdrom.c */ 1199 the logic should be in cdrom.c */
1206 1200
1207/* returns number of times device is in use */
1208int cm206_open_files(struct cdrom_device_info *cdi)
1209{
1210 if (cd)
1211 return cd->openfiles;
1212 return -1;
1213}
1214 1201
1215/* controls tray movement */ 1202/* controls tray movement */
1216int cm206_tray_move(struct cdrom_device_info *cdi, int position) 1203static int cm206_tray_move(struct cdrom_device_info *cdi, int position)
1217{ 1204{
1218 if (position) { /* 1: eject */ 1205 if (position) { /* 1: eject */
1219 type_0_command(c_open_tray, 1); 1206 type_0_command(c_open_tray, 1);
@@ -1224,7 +1211,7 @@ int cm206_tray_move(struct cdrom_device_info *cdi, int position)
1224} 1211}
1225 1212
1226/* gives current state of the drive */ 1213/* gives current state of the drive */
1227int cm206_drive_status(struct cdrom_device_info *cdi, int slot_nr) 1214static int cm206_drive_status(struct cdrom_device_info *cdi, int slot_nr)
1228{ 1215{
1229 get_drive_status(); 1216 get_drive_status();
1230 if (cd->dsb & dsb_tray_not_closed) 1217 if (cd->dsb & dsb_tray_not_closed)
@@ -1237,7 +1224,7 @@ int cm206_drive_status(struct cdrom_device_info *cdi, int slot_nr)
1237} 1224}
1238 1225
1239/* locks or unlocks door lock==1: lock; return 0 upon success */ 1226/* locks or unlocks door lock==1: lock; return 0 upon success */
1240int cm206_lock_door(struct cdrom_device_info *cdi, int lock) 1227static int cm206_lock_door(struct cdrom_device_info *cdi, int lock)
1241{ 1228{
1242 uch command = (lock) ? c_lock_tray : c_unlock_tray; 1229 uch command = (lock) ? c_lock_tray : c_unlock_tray;
1243 type_0_command(command, 1); /* wait and get dsb */ 1230 type_0_command(command, 1); /* wait and get dsb */
@@ -1248,8 +1235,8 @@ int cm206_lock_door(struct cdrom_device_info *cdi, int lock)
1248/* Although a session start should be in LBA format, we return it in 1235/* Although a session start should be in LBA format, we return it in
1249 MSF format because it is slightly easier, and the new generic ioctl 1236 MSF format because it is slightly easier, and the new generic ioctl
1250 will take care of the necessary conversion. */ 1237 will take care of the necessary conversion. */
1251int cm206_get_last_session(struct cdrom_device_info *cdi, 1238static int cm206_get_last_session(struct cdrom_device_info *cdi,
1252 struct cdrom_multisession *mssp) 1239 struct cdrom_multisession *mssp)
1253{ 1240{
1254 if (!FIRST_TRACK) 1241 if (!FIRST_TRACK)
1255 get_disc_status(); 1242 get_disc_status();
@@ -1268,7 +1255,7 @@ int cm206_get_last_session(struct cdrom_device_info *cdi,
1268 return 0; 1255 return 0;
1269} 1256}
1270 1257
1271int cm206_get_upc(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) 1258static int cm206_get_upc(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
1272{ 1259{
1273 uch upc[10]; 1260 uch upc[10];
1274 char *ret = mcn->medium_catalog_number; 1261 char *ret = mcn->medium_catalog_number;
@@ -1287,7 +1274,7 @@ int cm206_get_upc(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
1287 return 0; 1274 return 0;
1288} 1275}
1289 1276
1290int cm206_reset(struct cdrom_device_info *cdi) 1277static int cm206_reset(struct cdrom_device_info *cdi)
1291{ 1278{
1292 stop_read(); 1279 stop_read();
1293 reset_cm260(); 1280 reset_cm260();
@@ -1300,7 +1287,7 @@ int cm206_reset(struct cdrom_device_info *cdi)
1300 return 0; 1287 return 0;
1301} 1288}
1302 1289
1303int cm206_select_speed(struct cdrom_device_info *cdi, int speed) 1290static int cm206_select_speed(struct cdrom_device_info *cdi, int speed)
1304{ 1291{
1305 int r; 1292 int r;
1306 switch (speed) { 1293 switch (speed) {
@@ -1392,7 +1379,7 @@ static struct gendisk *cm206_gendisk;
1392 request_region, 15 bits of one port and 6 of another make things 1379 request_region, 15 bits of one port and 6 of another make things
1393 likely enough to accept the region on the first hit... 1380 likely enough to accept the region on the first hit...
1394 */ 1381 */
1395int __init probe_base_port(int base) 1382static int __init probe_base_port(int base)
1396{ 1383{
1397 int b = 0x300, e = 0x370; /* this is the range of start addresses */ 1384 int b = 0x300, e = 0x370; /* this is the range of start addresses */
1398 volatile int fool, i; 1385 volatile int fool, i;
@@ -1416,7 +1403,7 @@ int __init probe_base_port(int base)
1416 1403
1417#if !defined(MODULE) || defined(AUTO_PROBE_MODULE) 1404#if !defined(MODULE) || defined(AUTO_PROBE_MODULE)
1418/* Probe for irq# nr. If nr==0, probe for all possible irq's. */ 1405/* Probe for irq# nr. If nr==0, probe for all possible irq's. */
1419int __init probe_irq(int nr) 1406static int __init probe_irq(int nr)
1420{ 1407{
1421 int irqs, irq; 1408 int irqs, irq;
1422 outw(dc_normal | READ_AHEAD, r_data_control); /* disable irq-generation */ 1409 outw(dc_normal | READ_AHEAD, r_data_control); /* disable irq-generation */
@@ -1558,7 +1545,7 @@ static void __init parse_options(void)
1558 } 1545 }
1559} 1546}
1560 1547
1561int __cm206_init(void) 1548static int __cm206_init(void)
1562{ 1549{
1563 parse_options(); 1550 parse_options();
1564#if !defined(AUTO_PROBE_MODULE) 1551#if !defined(AUTO_PROBE_MODULE)
@@ -1567,7 +1554,7 @@ int __cm206_init(void)
1567 return cm206_init(); 1554 return cm206_init();
1568} 1555}
1569 1556
1570void __exit cm206_exit(void) 1557static void __exit cm206_exit(void)
1571{ 1558{
1572 del_gendisk(cm206_gendisk); 1559 del_gendisk(cm206_gendisk);
1573 put_disk(cm206_gendisk); 1560 put_disk(cm206_gendisk);
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index f4be7bfd6675..9f22e8f1f6c0 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -1605,8 +1605,7 @@ out7:
1605 put_disk(cdu_disk); 1605 put_disk(cdu_disk);
1606out6: 1606out6:
1607 for (i = 0; i < sony_buffer_sectors; i++) 1607 for (i = 0; i < sony_buffer_sectors; i++)
1608 if (sony_buffer[i]) 1608 kfree(sony_buffer[i]);
1609 kfree(sony_buffer[i]);
1610out5: 1609out5:
1611 kfree(sony_buffer); 1610 kfree(sony_buffer);
1612out4: 1611out4:
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 7ccf871d3c9d..43d0cb19ef6a 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -940,8 +940,8 @@ config RAW_DRIVER
940 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O. 940 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
941 See the raw(8) manpage for more details. 941 See the raw(8) manpage for more details.
942 942
943 The raw driver is deprecated and may be removed from 2.7 943 The raw driver is deprecated and will be removed soon.
944 kernels. Applications should simply open the device (eg /dev/hda1) 944 Applications should simply open the device (eg /dev/hda1)
945 with the O_DIRECT flag. 945 with the O_DIRECT flag.
946 946
947config HPET 947config HPET
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 777bc499bbbd..2a36561eec68 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -1973,10 +1973,6 @@ static _INLINE_ void show_serial_version(void)
1973} 1973}
1974 1974
1975 1975
1976int register_serial(struct serial_struct *req);
1977void unregister_serial(int line);
1978
1979
1980static struct tty_operations serial_ops = { 1976static struct tty_operations serial_ops = {
1981 .open = rs_open, 1977 .open = rs_open,
1982 .close = rs_close, 1978 .close = rs_close,
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 6bf2e27dc23a..11f9ee581124 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -599,7 +599,7 @@ static ssize_t ac_read (struct file *filp, char __user *buf, size_t count, loff_
599 599
600#ifdef DEBUG 600#ifdef DEBUG
601 if (loopcount++ > 2) { 601 if (loopcount++ > 2) {
602 printk("Looping in ac_read. loopcount %d\n", loopcount); 602 printk(KERN_DEBUG "Looping in ac_read. loopcount %d\n", loopcount);
603 } 603 }
604#endif 604#endif
605 } 605 }
diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig
index d9a029934678..c2b12eab67c9 100644
--- a/drivers/char/drm/Kconfig
+++ b/drivers/char/drm/Kconfig
@@ -6,7 +6,7 @@
6# 6#
7config DRM 7config DRM
8 tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" 8 tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
9 depends on AGP || AGP=n 9 depends on (AGP || AGP=n) && PCI
10 help 10 help
11 Kernel-level support for the Direct Rendering Infrastructure (DRI) 11 Kernel-level support for the Direct Rendering Infrastructure (DRI)
12 introduced in XFree86 4.0. If you say Y here, you need to select 12 introduced in XFree86 4.0. If you say Y here, you need to select
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index 23ab26321e9a..7444dec40b94 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -19,6 +19,11 @@ radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o
19ffb-objs := ffb_drv.o ffb_context.o 19ffb-objs := ffb_drv.o ffb_context.o
20sis-objs := sis_drv.o sis_ds.o sis_mm.o 20sis-objs := sis_drv.o sis_ds.o sis_mm.o
21 21
22ifeq ($(CONFIG_COMPAT),y)
23drm-objs += drm_ioc32.o
24radeon-objs += radeon_ioc32.o
25endif
26
22obj-$(CONFIG_DRM) += drm.o 27obj-$(CONFIG_DRM) += drm.o
23obj-$(CONFIG_DRM_GAMMA) += gamma.o 28obj-$(CONFIG_DRM_GAMMA) += gamma.o
24obj-$(CONFIG_DRM_TDFX) += tdfx.o 29obj-$(CONFIG_DRM_TDFX) += tdfx.o
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 21f4c54e1a8d..b04ddf12a0ff 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -316,6 +316,9 @@ do { \
316typedef int drm_ioctl_t( struct inode *inode, struct file *filp, 316typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
317 unsigned int cmd, unsigned long arg ); 317 unsigned int cmd, unsigned long arg );
318 318
319typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
320 unsigned long arg);
321
319typedef struct drm_ioctl_desc { 322typedef struct drm_ioctl_desc {
320 drm_ioctl_t *func; 323 drm_ioctl_t *func;
321 int auth_needed; 324 int auth_needed;
@@ -775,6 +778,8 @@ extern int drm_version(struct inode *inode, struct file *filp,
775 unsigned int cmd, unsigned long arg); 778 unsigned int cmd, unsigned long arg);
776extern int drm_ioctl(struct inode *inode, struct file *filp, 779extern int drm_ioctl(struct inode *inode, struct file *filp,
777 unsigned int cmd, unsigned long arg); 780 unsigned int cmd, unsigned long arg);
781extern long drm_compat_ioctl(struct file *filp,
782 unsigned int cmd, unsigned long arg);
778extern int drm_takedown(drm_device_t * dev); 783extern int drm_takedown(drm_device_t * dev);
779 784
780 /* Device support (drm_fops.h) */ 785 /* Device support (drm_fops.h) */
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index 4113bcba67fe..3407380b865a 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -60,6 +60,15 @@ int drm_order( unsigned long size )
60} 60}
61EXPORT_SYMBOL(drm_order); 61EXPORT_SYMBOL(drm_order);
62 62
63#ifdef CONFIG_COMPAT
64/*
65 * Used to allocate 32-bit handles for _DRM_SHM regions
66 * The 0x10000000 value is chosen to be out of the way of
67 * FB/register and GART physical addresses.
68 */
69static unsigned int map32_handle = 0x10000000;
70#endif
71
63/** 72/**
64 * Ioctl to specify a range of memory that is available for mapping by a non-root process. 73 * Ioctl to specify a range of memory that is available for mapping by a non-root process.
65 * 74 *
@@ -187,16 +196,18 @@ int drm_addmap( struct inode *inode, struct file *filp,
187 196
188 down(&dev->struct_sem); 197 down(&dev->struct_sem);
189 list_add(&list->head, &dev->maplist->head); 198 list_add(&list->head, &dev->maplist->head);
199#ifdef CONFIG_COMPAT
200 /* Assign a 32-bit handle for _DRM_SHM mappings */
201 /* We do it here so that dev->struct_sem protects the increment */
202 if (map->type == _DRM_SHM)
203 map->offset = map32_handle += PAGE_SIZE;
204#endif
190 up(&dev->struct_sem); 205 up(&dev->struct_sem);
191 206
192 if ( copy_to_user( argp, map, sizeof(*map) ) ) 207 if ( copy_to_user( argp, map, sizeof(*map) ) )
193 return -EFAULT; 208 return -EFAULT;
194 if ( map->type != _DRM_SHM ) { 209 if (copy_to_user(&argp->handle, &map->offset, sizeof(map->offset)))
195 if ( copy_to_user( &argp->handle, 210 return -EFAULT;
196 &map->offset,
197 sizeof(map->offset) ) )
198 return -EFAULT;
199 }
200 return 0; 211 return 0;
201} 212}
202 213
@@ -240,7 +251,7 @@ int drm_rmmap(struct inode *inode, struct file *filp,
240 r_list = list_entry(list, drm_map_list_t, head); 251 r_list = list_entry(list, drm_map_list_t, head);
241 252
242 if(r_list->map && 253 if(r_list->map &&
243 r_list->map->handle == request.handle && 254 r_list->map->offset == (unsigned long) request.handle &&
244 r_list->map->flags & _DRM_REMOVABLE) break; 255 r_list->map->flags & _DRM_REMOVABLE) break;
245 } 256 }
246 257
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
index f15c86c57875..fdf661f234ed 100644
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -225,7 +225,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
225 map = dev->context_sareas[request.ctx_id]; 225 map = dev->context_sareas[request.ctx_id];
226 up(&dev->struct_sem); 226 up(&dev->struct_sem);
227 227
228 request.handle = map->handle; 228 request.handle = (void *) map->offset;
229 if (copy_to_user(argp, &request, sizeof(request))) 229 if (copy_to_user(argp, &request, sizeof(request)))
230 return -EFAULT; 230 return -EFAULT;
231 return 0; 231 return 0;
@@ -261,8 +261,8 @@ int drm_setsareactx(struct inode *inode, struct file *filp,
261 down(&dev->struct_sem); 261 down(&dev->struct_sem);
262 list_for_each(list, &dev->maplist->head) { 262 list_for_each(list, &dev->maplist->head) {
263 r_list = list_entry(list, drm_map_list_t, head); 263 r_list = list_entry(list, drm_map_list_t, head);
264 if(r_list->map && 264 if (r_list->map
265 r_list->map->handle == request.handle) 265 && r_list->map->offset == (unsigned long) request.handle)
266 goto found; 266 goto found;
267 } 267 }
268bad: 268bad:
diff --git a/drivers/char/drm/drm_ioc32.c b/drivers/char/drm/drm_ioc32.c
new file mode 100644
index 000000000000..8087a9636399
--- /dev/null
+++ b/drivers/char/drm/drm_ioc32.c
@@ -0,0 +1,1069 @@
1/**
2 * \file drm_ioc32.c
3 *
4 * 32-bit ioctl compatibility routines for the DRM.
5 *
6 * \author Paul Mackerras <paulus@samba.org>
7 *
8 * Copyright (C) Paul Mackerras 2005.
9 * All Rights Reserved.
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice (including the next
19 * paragraph) shall be included in all copies or substantial portions of the
20 * Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * IN THE SOFTWARE.
29 */
30#include <linux/compat.h>
31#include <linux/ioctl32.h>
32
33#include "drmP.h"
34#include "drm_core.h"
35
36#define DRM_IOCTL_VERSION32 DRM_IOWR(0x00, drm_version32_t)
37#define DRM_IOCTL_GET_UNIQUE32 DRM_IOWR(0x01, drm_unique32_t)
38#define DRM_IOCTL_GET_MAP32 DRM_IOWR(0x04, drm_map32_t)
39#define DRM_IOCTL_GET_CLIENT32 DRM_IOWR(0x05, drm_client32_t)
40#define DRM_IOCTL_GET_STATS32 DRM_IOR( 0x06, drm_stats32_t)
41
42#define DRM_IOCTL_SET_UNIQUE32 DRM_IOW( 0x10, drm_unique32_t)
43#define DRM_IOCTL_ADD_MAP32 DRM_IOWR(0x15, drm_map32_t)
44#define DRM_IOCTL_ADD_BUFS32 DRM_IOWR(0x16, drm_buf_desc32_t)
45#define DRM_IOCTL_MARK_BUFS32 DRM_IOW( 0x17, drm_buf_desc32_t)
46#define DRM_IOCTL_INFO_BUFS32 DRM_IOWR(0x18, drm_buf_info32_t)
47#define DRM_IOCTL_MAP_BUFS32 DRM_IOWR(0x19, drm_buf_map32_t)
48#define DRM_IOCTL_FREE_BUFS32 DRM_IOW( 0x1a, drm_buf_free32_t)
49
50#define DRM_IOCTL_RM_MAP32 DRM_IOW( 0x1b, drm_map32_t)
51
52#define DRM_IOCTL_SET_SAREA_CTX32 DRM_IOW( 0x1c, drm_ctx_priv_map32_t)
53#define DRM_IOCTL_GET_SAREA_CTX32 DRM_IOWR(0x1d, drm_ctx_priv_map32_t)
54
55#define DRM_IOCTL_RES_CTX32 DRM_IOWR(0x26, drm_ctx_res32_t)
56#define DRM_IOCTL_DMA32 DRM_IOWR(0x29, drm_dma32_t)
57
58#define DRM_IOCTL_AGP_ENABLE32 DRM_IOW( 0x32, drm_agp_mode32_t)
59#define DRM_IOCTL_AGP_INFO32 DRM_IOR( 0x33, drm_agp_info32_t)
60#define DRM_IOCTL_AGP_ALLOC32 DRM_IOWR(0x34, drm_agp_buffer32_t)
61#define DRM_IOCTL_AGP_FREE32 DRM_IOW( 0x35, drm_agp_buffer32_t)
62#define DRM_IOCTL_AGP_BIND32 DRM_IOW( 0x36, drm_agp_binding32_t)
63#define DRM_IOCTL_AGP_UNBIND32 DRM_IOW( 0x37, drm_agp_binding32_t)
64
65#define DRM_IOCTL_SG_ALLOC32 DRM_IOW( 0x38, drm_scatter_gather32_t)
66#define DRM_IOCTL_SG_FREE32 DRM_IOW( 0x39, drm_scatter_gather32_t)
67
68#define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t)
69
70typedef struct drm_version_32 {
71 int version_major; /**< Major version */
72 int version_minor; /**< Minor version */
73 int version_patchlevel;/**< Patch level */
74 u32 name_len; /**< Length of name buffer */
75 u32 name; /**< Name of driver */
76 u32 date_len; /**< Length of date buffer */
77 u32 date; /**< User-space buffer to hold date */
78 u32 desc_len; /**< Length of desc buffer */
79 u32 desc; /**< User-space buffer to hold desc */
80} drm_version32_t;
81
82static int compat_drm_version(struct file *file, unsigned int cmd,
83 unsigned long arg)
84{
85 drm_version32_t v32;
86 drm_version_t __user *version;
87 int err;
88
89 if (copy_from_user(&v32, (void __user *) arg, sizeof(v32)))
90 return -EFAULT;
91
92 version = compat_alloc_user_space(sizeof(*version));
93 if (!access_ok(VERIFY_WRITE, version, sizeof(*version)))
94 return -EFAULT;
95 if (__put_user(v32.name_len, &version->name_len)
96 || __put_user((void __user *)(unsigned long)v32.name,
97 &version->name)
98 || __put_user(v32.date_len, &version->date_len)
99 || __put_user((void __user *)(unsigned long)v32.date,
100 &version->date)
101 || __put_user(v32.desc_len, &version->desc_len)
102 || __put_user((void __user *)(unsigned long)v32.desc,
103 &version->desc))
104 return -EFAULT;
105
106 err = drm_ioctl(file->f_dentry->d_inode, file,
107 DRM_IOCTL_VERSION, (unsigned long) version);
108 if (err)
109 return err;
110
111 if (__get_user(v32.version_major, &version->version_major)
112 || __get_user(v32.version_minor, &version->version_minor)
113 || __get_user(v32.version_patchlevel, &version->version_patchlevel)
114 || __get_user(v32.name_len, &version->name_len)
115 || __get_user(v32.date_len, &version->date_len)
116 || __get_user(v32.desc_len, &version->desc_len))
117 return -EFAULT;
118
119 if (copy_to_user((void __user *) arg, &v32, sizeof(v32)))
120 return -EFAULT;
121 return 0;
122}
123
124typedef struct drm_unique32 {
125 u32 unique_len; /**< Length of unique */
126 u32 unique; /**< Unique name for driver instantiation */
127} drm_unique32_t;
128
129static int compat_drm_getunique(struct file *file, unsigned int cmd,
130 unsigned long arg)
131{
132 drm_unique32_t uq32;
133 drm_unique_t __user *u;
134 int err;
135
136 if (copy_from_user(&uq32, (void __user *) arg, sizeof(uq32)))
137 return -EFAULT;
138
139 u = compat_alloc_user_space(sizeof(*u));
140 if (!access_ok(VERIFY_WRITE, u, sizeof(*u)))
141 return -EFAULT;
142 if (__put_user(uq32.unique_len, &u->unique_len)
143 || __put_user((void __user *)(unsigned long) uq32.unique,
144 &u->unique))
145 return -EFAULT;
146
147 err = drm_ioctl(file->f_dentry->d_inode, file,
148 DRM_IOCTL_GET_UNIQUE, (unsigned long) u);
149 if (err)
150 return err;
151
152 if (__get_user(uq32.unique_len, &u->unique_len))
153 return -EFAULT;
154 if (copy_to_user((void __user *) arg, &uq32, sizeof(uq32)))
155 return -EFAULT;
156 return 0;
157}
158
159static int compat_drm_setunique(struct file *file, unsigned int cmd,
160 unsigned long arg)
161{
162 drm_unique32_t uq32;
163 drm_unique_t __user *u;
164
165 if (copy_from_user(&uq32, (void __user *) arg, sizeof(uq32)))
166 return -EFAULT;
167
168 u = compat_alloc_user_space(sizeof(*u));
169 if (!access_ok(VERIFY_WRITE, u, sizeof(*u)))
170 return -EFAULT;
171 if (__put_user(uq32.unique_len, &u->unique_len)
172 || __put_user((void __user *)(unsigned long) uq32.unique,
173 &u->unique))
174 return -EFAULT;
175
176 return drm_ioctl(file->f_dentry->d_inode, file,
177 DRM_IOCTL_SET_UNIQUE, (unsigned long) u);
178}
179
180typedef struct drm_map32 {
181 u32 offset; /**< Requested physical address (0 for SAREA)*/
182 u32 size; /**< Requested physical size (bytes) */
183 drm_map_type_t type; /**< Type of memory to map */
184 drm_map_flags_t flags; /**< Flags */
185 u32 handle; /**< User-space: "Handle" to pass to mmap() */
186 int mtrr; /**< MTRR slot used */
187} drm_map32_t;
188
189static int compat_drm_getmap(struct file *file, unsigned int cmd,
190 unsigned long arg)
191{
192 drm_map32_t __user *argp = (void __user *)arg;
193 drm_map32_t m32;
194 drm_map_t __user *map;
195 int idx, err;
196 void *handle;
197
198 if (get_user(idx, &argp->offset))
199 return -EFAULT;
200
201 map = compat_alloc_user_space(sizeof(*map));
202 if (!access_ok(VERIFY_WRITE, map, sizeof(*map)))
203 return -EFAULT;
204 if (__put_user(idx, &map->offset))
205 return -EFAULT;
206
207 err = drm_ioctl(file->f_dentry->d_inode, file,
208 DRM_IOCTL_GET_MAP, (unsigned long) map);
209 if (err)
210 return err;
211
212 if (__get_user(m32.offset, &map->offset)
213 || __get_user(m32.size, &map->size)
214 || __get_user(m32.type, &map->type)
215 || __get_user(m32.flags, &map->flags)
216 || __get_user(handle, &map->handle)
217 || __get_user(m32.mtrr, &map->mtrr))
218 return -EFAULT;
219
220 m32.handle = (unsigned long) handle;
221 if (copy_to_user(argp, &m32, sizeof(m32)))
222 return -EFAULT;
223 return 0;
224
225}
226
227static int compat_drm_addmap(struct file *file, unsigned int cmd,
228 unsigned long arg)
229{
230 drm_map32_t __user *argp = (void __user *)arg;
231 drm_map32_t m32;
232 drm_map_t __user *map;
233 int err;
234 void *handle;
235
236 if (copy_from_user(&m32, argp, sizeof(m32)))
237 return -EFAULT;
238
239 map = compat_alloc_user_space(sizeof(*map));
240 if (!access_ok(VERIFY_WRITE, map, sizeof(*map)))
241 return -EFAULT;
242 if (__put_user(m32.offset, &map->offset)
243 || __put_user(m32.size, &map->size)
244 || __put_user(m32.type, &map->type)
245 || __put_user(m32.flags, &map->flags))
246 return -EFAULT;
247
248 err = drm_ioctl(file->f_dentry->d_inode, file,
249 DRM_IOCTL_ADD_MAP, (unsigned long) map);
250 if (err)
251 return err;
252
253 if (__get_user(m32.offset, &map->offset)
254 || __get_user(m32.mtrr, &map->mtrr)
255 || __get_user(handle, &map->handle))
256 return -EFAULT;
257
258 m32.handle = (unsigned long) handle;
259 if (m32.handle != (unsigned long) handle && printk_ratelimit())
260 printk(KERN_ERR "compat_drm_addmap truncated handle"
261 " %p for type %d offset %x\n",
262 handle, m32.type, m32.offset);
263
264 if (copy_to_user(argp, &m32, sizeof(m32)))
265 return -EFAULT;
266
267 return 0;
268}
269
270static int compat_drm_rmmap(struct file *file, unsigned int cmd,
271 unsigned long arg)
272{
273 drm_map32_t __user *argp = (void __user *)arg;
274 drm_map_t __user *map;
275 u32 handle;
276
277 if (get_user(handle, &argp->handle))
278 return -EFAULT;
279
280 map = compat_alloc_user_space(sizeof(*map));
281 if (!access_ok(VERIFY_WRITE, map, sizeof(*map)))
282 return -EFAULT;
283 if (__put_user((void *)(unsigned long) handle, &map->handle))
284 return -EFAULT;
285
286 return drm_ioctl(file->f_dentry->d_inode, file,
287 DRM_IOCTL_RM_MAP, (unsigned long) map);
288}
289
290typedef struct drm_client32 {
291 int idx; /**< Which client desired? */
292 int auth; /**< Is client authenticated? */
293 u32 pid; /**< Process ID */
294 u32 uid; /**< User ID */
295 u32 magic; /**< Magic */
296 u32 iocs; /**< Ioctl count */
297} drm_client32_t;
298
299static int compat_drm_getclient(struct file *file, unsigned int cmd,
300 unsigned long arg)
301{
302 drm_client32_t c32;
303 drm_client32_t __user *argp = (void __user *)arg;
304 drm_client_t __user *client;
305 int idx, err;
306
307 if (get_user(idx, &argp->idx))
308 return -EFAULT;
309
310 client = compat_alloc_user_space(sizeof(*client));
311 if (!access_ok(VERIFY_WRITE, client, sizeof(*client)))
312 return -EFAULT;
313 if (__put_user(idx, &client->idx))
314 return -EFAULT;
315
316 err = drm_ioctl(file->f_dentry->d_inode, file,
317 DRM_IOCTL_GET_CLIENT, (unsigned long) client);
318 if (err)
319 return err;
320
321 if (__get_user(c32.auth, &client->auth)
322 || __get_user(c32.pid, &client->pid)
323 || __get_user(c32.uid, &client->uid)
324 || __get_user(c32.magic, &client->magic)
325 || __get_user(c32.iocs, &client->iocs))
326 return -EFAULT;
327
328 if (copy_to_user(argp, &c32, sizeof(c32)))
329 return -EFAULT;
330 return 0;
331}
332
333typedef struct drm_stats32 {
334 u32 count;
335 struct {
336 u32 value;
337 drm_stat_type_t type;
338 } data[15];
339} drm_stats32_t;
340
341static int compat_drm_getstats(struct file *file, unsigned int cmd,
342 unsigned long arg)
343{
344 drm_stats32_t s32;
345 drm_stats32_t __user *argp = (void __user *)arg;
346 drm_stats_t __user *stats;
347 int i, err;
348
349 stats = compat_alloc_user_space(sizeof(*stats));
350 if (!access_ok(VERIFY_WRITE, stats, sizeof(*stats)))
351 return -EFAULT;
352
353 err = drm_ioctl(file->f_dentry->d_inode, file,
354 DRM_IOCTL_GET_STATS, (unsigned long) stats);
355 if (err)
356 return err;
357
358 if (__get_user(s32.count, &stats->count))
359 return -EFAULT;
360 for (i = 0; i < 15; ++i)
361 if (__get_user(s32.data[i].value, &stats->data[i].value)
362 || __get_user(s32.data[i].type, &stats->data[i].type))
363 return -EFAULT;
364
365 if (copy_to_user(argp, &s32, sizeof(s32)))
366 return -EFAULT;
367 return 0;
368}
369
370typedef struct drm_buf_desc32 {
371 int count; /**< Number of buffers of this size */
372 int size; /**< Size in bytes */
373 int low_mark; /**< Low water mark */
374 int high_mark; /**< High water mark */
375 int flags;
376 u32 agp_start; /**< Start address in the AGP aperture */
377} drm_buf_desc32_t;
378
379static int compat_drm_addbufs(struct file *file, unsigned int cmd,
380 unsigned long arg)
381{
382 drm_buf_desc32_t __user *argp = (void __user *)arg;
383 drm_buf_desc_t __user *buf;
384 int err;
385 unsigned long agp_start;
386
387 buf = compat_alloc_user_space(sizeof(*buf));
388 if (!access_ok(VERIFY_WRITE, buf, sizeof(*buf))
389 || !access_ok(VERIFY_WRITE, argp, sizeof(*argp)))
390 return -EFAULT;
391
392 if (__copy_in_user(buf, argp, offsetof(drm_buf_desc32_t, agp_start))
393 || __get_user(agp_start, &argp->agp_start)
394 || __put_user(agp_start, &buf->agp_start))
395 return -EFAULT;
396
397 err = drm_ioctl(file->f_dentry->d_inode, file,
398 DRM_IOCTL_ADD_BUFS, (unsigned long) buf);
399 if (err)
400 return err;
401
402 if (__copy_in_user(argp, buf, offsetof(drm_buf_desc32_t, agp_start))
403 || __get_user(agp_start, &buf->agp_start)
404 || __put_user(agp_start, &argp->agp_start))
405 return -EFAULT;
406
407 return 0;
408}
409
410static int compat_drm_markbufs(struct file *file, unsigned int cmd,
411 unsigned long arg)
412{
413 drm_buf_desc32_t b32;
414 drm_buf_desc32_t __user *argp = (void __user *)arg;
415 drm_buf_desc_t __user *buf;
416
417 if (copy_from_user(&b32, argp, sizeof(b32)))
418 return -EFAULT;
419
420 buf = compat_alloc_user_space(sizeof(*buf));
421 if (!access_ok(VERIFY_WRITE, buf, sizeof(*buf)))
422 return -EFAULT;
423
424 if (__put_user(b32.size, &buf->size)
425 || __put_user(b32.low_mark, &buf->low_mark)
426 || __put_user(b32.high_mark, &buf->high_mark))
427 return -EFAULT;
428
429 return drm_ioctl(file->f_dentry->d_inode, file,
430 DRM_IOCTL_MARK_BUFS, (unsigned long) buf);
431}
432
433typedef struct drm_buf_info32 {
434 int count; /**< Entries in list */
435 u32 list;
436} drm_buf_info32_t;
437
438static int compat_drm_infobufs(struct file *file, unsigned int cmd,
439 unsigned long arg)
440{
441 drm_buf_info32_t req32;
442 drm_buf_info32_t __user *argp = (void __user *)arg;
443 drm_buf_desc32_t __user *to;
444 drm_buf_info_t __user *request;
445 drm_buf_desc_t __user *list;
446 size_t nbytes;
447 int i, err;
448 int count, actual;
449
450 if (copy_from_user(&req32, argp, sizeof(req32)))
451 return -EFAULT;
452
453 count = req32.count;
454 to = (drm_buf_desc32_t __user *)(unsigned long) req32.list;
455 if (count < 0)
456 count = 0;
457 if (count > 0
458 && !access_ok(VERIFY_WRITE, to, count * sizeof(drm_buf_desc32_t)))
459 return -EFAULT;
460
461 nbytes = sizeof(*request) + count * sizeof(drm_buf_desc_t);
462 request = compat_alloc_user_space(nbytes);
463 if (!access_ok(VERIFY_WRITE, request, nbytes))
464 return -EFAULT;
465 list = (drm_buf_desc_t *) (request + 1);
466
467 if (__put_user(count, &request->count)
468 || __put_user(list, &request->list))
469 return -EFAULT;
470
471 err = drm_ioctl(file->f_dentry->d_inode, file,
472 DRM_IOCTL_INFO_BUFS, (unsigned long) request);
473 if (err)
474 return err;
475
476 if (__get_user(actual, &request->count))
477 return -EFAULT;
478 if (count >= actual)
479 for (i = 0; i < actual; ++i)
480 if (__copy_in_user(&to[i], &list[i],
481 offsetof(drm_buf_desc_t, flags)))
482 return -EFAULT;
483
484 if (__put_user(actual, &argp->count))
485 return -EFAULT;
486
487 return 0;
488}
489
490typedef struct drm_buf_pub32 {
491 int idx; /**< Index into the master buffer list */
492 int total; /**< Buffer size */
493 int used; /**< Amount of buffer in use (for DMA) */
494 u32 address; /**< Address of buffer */
495} drm_buf_pub32_t;
496
497typedef struct drm_buf_map32 {
498 int count; /**< Length of the buffer list */
499 u32 virtual; /**< Mmap'd area in user-virtual */
500 u32 list; /**< Buffer information */
501} drm_buf_map32_t;
502
503static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
504 unsigned long arg)
505{
506 drm_buf_map32_t __user *argp = (void __user *)arg;
507 drm_buf_map32_t req32;
508 drm_buf_pub32_t __user *list32;
509 drm_buf_map_t __user *request;
510 drm_buf_pub_t __user *list;
511 int i, err;
512 int count, actual;
513 size_t nbytes;
514 void __user *addr;
515
516 if (copy_from_user(&req32, argp, sizeof(req32)))
517 return -EFAULT;
518 count = req32.count;
519 list32 = (void __user *)(unsigned long)req32.list;
520
521 if (count < 0)
522 return -EINVAL;
523 nbytes = sizeof(*request) + count * sizeof(drm_buf_pub_t);
524 request = compat_alloc_user_space(nbytes);
525 if (!access_ok(VERIFY_WRITE, request, nbytes))
526 return -EFAULT;
527 list = (drm_buf_pub_t *) (request + 1);
528
529 if (__put_user(count, &request->count)
530 || __put_user(list, &request->list))
531 return -EFAULT;
532
533 err = drm_ioctl(file->f_dentry->d_inode, file,
534 DRM_IOCTL_MAP_BUFS, (unsigned long) request);
535 if (err)
536 return err;
537
538 if (__get_user(actual, &request->count))
539 return -EFAULT;
540 if (count >= actual)
541 for (i = 0; i < actual; ++i)
542 if (__copy_in_user(&list32[i], &list[i],
543 offsetof(drm_buf_pub_t, address))
544 || __get_user(addr, &list[i].address)
545 || __put_user((unsigned long) addr,
546 &list32[i].address))
547 return -EFAULT;
548
549 if (__put_user(actual, &argp->count)
550 || __get_user(addr, &request->virtual)
551 || __put_user((unsigned long) addr, &argp->virtual))
552 return -EFAULT;
553
554 return 0;
555}
556
557typedef struct drm_buf_free32 {
558 int count;
559 u32 list;
560} drm_buf_free32_t;
561
562static int compat_drm_freebufs(struct file *file, unsigned int cmd,
563 unsigned long arg)
564{
565 drm_buf_free32_t req32;
566 drm_buf_free_t __user *request;
567 drm_buf_free32_t __user *argp = (void __user *)arg;
568
569 if (copy_from_user(&req32, argp, sizeof(req32)))
570 return -EFAULT;
571
572 request = compat_alloc_user_space(sizeof(*request));
573 if (!access_ok(VERIFY_WRITE, request, sizeof(*request)))
574 return -EFAULT;
575 if (__put_user(req32.count, &request->count)
576 || __put_user((int __user *)(unsigned long) req32.list,
577 &request->list))
578 return -EFAULT;
579
580 return drm_ioctl(file->f_dentry->d_inode, file,
581 DRM_IOCTL_FREE_BUFS, (unsigned long) request);
582}
583
584typedef struct drm_ctx_priv_map32 {
585 unsigned int ctx_id; /**< Context requesting private mapping */
586 u32 handle; /**< Handle of map */
587} drm_ctx_priv_map32_t;
588
589static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
590 unsigned long arg)
591{
592 drm_ctx_priv_map32_t req32;
593 drm_ctx_priv_map_t __user *request;
594 drm_ctx_priv_map32_t __user *argp = (void __user *)arg;
595
596 if (copy_from_user(&req32, argp, sizeof(req32)))
597 return -EFAULT;
598
599 request = compat_alloc_user_space(sizeof(*request));
600 if (!access_ok(VERIFY_WRITE, request, sizeof(*request)))
601 return -EFAULT;
602 if (__put_user(req32.ctx_id, &request->ctx_id)
603 || __put_user((void *)(unsigned long) req32.handle,
604 &request->handle))
605 return -EFAULT;
606
607 return drm_ioctl(file->f_dentry->d_inode, file,
608 DRM_IOCTL_SET_SAREA_CTX, (unsigned long) request);
609}
610
611static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
612 unsigned long arg)
613{
614 drm_ctx_priv_map_t __user *request;
615 drm_ctx_priv_map32_t __user *argp = (void __user *)arg;
616 int err;
617 unsigned int ctx_id;
618 void *handle;
619
620 if (!access_ok(VERIFY_WRITE, argp, sizeof(*argp))
621 || __get_user(ctx_id, &argp->ctx_id))
622 return -EFAULT;
623
624 request = compat_alloc_user_space(sizeof(*request));
625 if (!access_ok(VERIFY_WRITE, request, sizeof(*request)))
626 return -EFAULT;
627 if (__put_user(ctx_id, &request->ctx_id))
628 return -EFAULT;
629
630 err = drm_ioctl(file->f_dentry->d_inode, file,
631 DRM_IOCTL_GET_SAREA_CTX, (unsigned long) request);
632 if (err)
633 return err;
634
635 if (__get_user(handle, &request->handle)
636 || __put_user((unsigned long) handle, &argp->handle))
637 return -EFAULT;
638
639 return 0;
640}
641
642typedef struct drm_ctx_res32 {
643 int count;
644 u32 contexts;
645} drm_ctx_res32_t;
646
647static int compat_drm_resctx(struct file *file, unsigned int cmd,
648 unsigned long arg)
649{
650 drm_ctx_res32_t __user *argp = (void __user *)arg;
651 drm_ctx_res32_t res32;
652 drm_ctx_res_t __user *res;
653 int err;
654
655 if (copy_from_user(&res32, argp, sizeof(res32)))
656 return -EFAULT;
657
658 res = compat_alloc_user_space(sizeof(*res));
659 if (!access_ok(VERIFY_WRITE, res, sizeof(*res)))
660 return -EFAULT;
661 if (__put_user(res32.count, &res->count)
662 || __put_user((drm_ctx_t __user *)(unsigned long) res32.contexts,
663 &res->contexts))
664 return -EFAULT;
665
666 err = drm_ioctl(file->f_dentry->d_inode, file,
667 DRM_IOCTL_RES_CTX, (unsigned long) res);
668 if (err)
669 return err;
670
671 if (__get_user(res32.count, &res->count)
672 || __put_user(res32.count, &argp->count))
673 return -EFAULT;
674
675 return 0;
676}
677
678typedef struct drm_dma32 {
679 int context; /**< Context handle */
680 int send_count; /**< Number of buffers to send */
681 u32 send_indices; /**< List of handles to buffers */
682 u32 send_sizes; /**< Lengths of data to send */
683 drm_dma_flags_t flags; /**< Flags */
684 int request_count; /**< Number of buffers requested */
685 int request_size; /**< Desired size for buffers */
686 u32 request_indices; /**< Buffer information */
687 u32 request_sizes;
688 int granted_count; /**< Number of buffers granted */
689} drm_dma32_t;
690
691static int compat_drm_dma(struct file *file, unsigned int cmd,
692 unsigned long arg)
693{
694 drm_dma32_t d32;
695 drm_dma32_t __user *argp = (void __user *) arg;
696 drm_dma_t __user *d;
697 int err;
698
699 if (copy_from_user(&d32, argp, sizeof(d32)))
700 return -EFAULT;
701
702 d = compat_alloc_user_space(sizeof(*d));
703 if (!access_ok(VERIFY_WRITE, d, sizeof(*d)))
704 return -EFAULT;
705
706 if (__put_user(d32.context, &d->context)
707 || __put_user(d32.send_count, &d->send_count)
708 || __put_user((int __user *)(unsigned long) d32.send_indices,
709 &d->send_indices)
710 || __put_user((int __user *)(unsigned long) d32.send_sizes,
711 &d->send_sizes)
712 || __put_user(d32.flags, &d->flags)
713 || __put_user(d32.request_count, &d->request_count)
714 || __put_user((int __user *)(unsigned long) d32.request_indices,
715 &d->request_indices)
716 || __put_user((int __user *)(unsigned long) d32.request_sizes,
717 &d->request_sizes))
718 return -EFAULT;
719
720 err = drm_ioctl(file->f_dentry->d_inode, file,
721 DRM_IOCTL_DMA, (unsigned long) d);
722 if (err)
723 return err;
724
725 if (__get_user(d32.request_size, &d->request_size)
726 || __get_user(d32.granted_count, &d->granted_count)
727 || __put_user(d32.request_size, &argp->request_size)
728 || __put_user(d32.granted_count, &argp->granted_count))
729 return -EFAULT;
730
731 return 0;
732}
733
734#if __OS_HAS_AGP
735typedef struct drm_agp_mode32 {
736 u32 mode; /**< AGP mode */
737} drm_agp_mode32_t;
738
739static int compat_drm_agp_enable(struct file *file, unsigned int cmd,
740 unsigned long arg)
741{
742 drm_agp_mode32_t __user *argp = (void __user *)arg;
743 drm_agp_mode32_t m32;
744 drm_agp_mode_t __user *mode;
745
746 if (get_user(m32.mode, &argp->mode))
747 return -EFAULT;
748
749 mode = compat_alloc_user_space(sizeof(*mode));
750 if (put_user(m32.mode, &mode->mode))
751 return -EFAULT;
752
753 return drm_ioctl(file->f_dentry->d_inode, file,
754 DRM_IOCTL_AGP_ENABLE, (unsigned long) mode);
755}
756
757typedef struct drm_agp_info32 {
758 int agp_version_major;
759 int agp_version_minor;
760 u32 mode;
761 u32 aperture_base; /* physical address */
762 u32 aperture_size; /* bytes */
763 u32 memory_allowed; /* bytes */
764 u32 memory_used;
765
766 /* PCI information */
767 unsigned short id_vendor;
768 unsigned short id_device;
769} drm_agp_info32_t;
770
771static int compat_drm_agp_info(struct file *file, unsigned int cmd,
772 unsigned long arg)
773{
774 drm_agp_info32_t __user *argp = (void __user *)arg;
775 drm_agp_info32_t i32;
776 drm_agp_info_t __user *info;
777 int err;
778
779 info = compat_alloc_user_space(sizeof(*info));
780 if (!access_ok(VERIFY_WRITE, info, sizeof(*info)))
781 return -EFAULT;
782
783 err = drm_ioctl(file->f_dentry->d_inode, file,
784 DRM_IOCTL_AGP_INFO, (unsigned long) info);
785 if (err)
786 return err;
787
788 if (__get_user(i32.agp_version_major, &info->agp_version_major)
789 || __get_user(i32.agp_version_minor, &info->agp_version_minor)
790 || __get_user(i32.mode, &info->mode)
791 || __get_user(i32.aperture_base, &info->aperture_base)
792 || __get_user(i32.aperture_size, &info->aperture_size)
793 || __get_user(i32.memory_allowed, &info->memory_allowed)
794 || __get_user(i32.memory_used, &info->memory_used)
795 || __get_user(i32.id_vendor, &info->id_vendor)
796 || __get_user(i32.id_device, &info->id_device))
797 return -EFAULT;
798
799 if (copy_to_user(argp, &i32, sizeof(i32)))
800 return -EFAULT;
801
802 return 0;
803}
804
805typedef struct drm_agp_buffer32 {
806 u32 size; /**< In bytes -- will round to page boundary */
807 u32 handle; /**< Used for binding / unbinding */
808 u32 type; /**< Type of memory to allocate */
809 u32 physical; /**< Physical used by i810 */
810} drm_agp_buffer32_t;
811
812static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
813 unsigned long arg)
814{
815 drm_agp_buffer32_t __user *argp = (void __user *)arg;
816 drm_agp_buffer32_t req32;
817 drm_agp_buffer_t __user *request;
818 int err;
819
820 if (copy_from_user(&req32, argp, sizeof(req32)))
821 return -EFAULT;
822
823 request = compat_alloc_user_space(sizeof(*request));
824 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
825 || __put_user(req32.size, &request->size)
826 || __put_user(req32.type, &request->type))
827 return -EFAULT;
828
829 err = drm_ioctl(file->f_dentry->d_inode, file,
830 DRM_IOCTL_AGP_ALLOC, (unsigned long) request);
831 if (err)
832 return err;
833
834 if (__get_user(req32.handle, &request->handle)
835 || __get_user(req32.physical, &request->physical)
836 || copy_to_user(argp, &req32, sizeof(req32))) {
837 drm_ioctl(file->f_dentry->d_inode, file,
838 DRM_IOCTL_AGP_FREE, (unsigned long) request);
839 return -EFAULT;
840 }
841
842 return 0;
843}
844
845static int compat_drm_agp_free(struct file *file, unsigned int cmd,
846 unsigned long arg)
847{
848 drm_agp_buffer32_t __user *argp = (void __user *)arg;
849 drm_agp_buffer_t __user *request;
850 u32 handle;
851
852 request = compat_alloc_user_space(sizeof(*request));
853 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
854 || get_user(handle, &argp->handle)
855 || __put_user(handle, &request->handle))
856 return -EFAULT;
857
858 return drm_ioctl(file->f_dentry->d_inode, file,
859 DRM_IOCTL_AGP_FREE, (unsigned long) request);
860}
861
862typedef struct drm_agp_binding32 {
863 u32 handle; /**< From drm_agp_buffer */
864 u32 offset; /**< In bytes -- will round to page boundary */
865} drm_agp_binding32_t;
866
867static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
868 unsigned long arg)
869{
870 drm_agp_binding32_t __user *argp = (void __user *)arg;
871 drm_agp_binding32_t req32;
872 drm_agp_binding_t __user *request;
873
874 if (copy_from_user(&req32, argp, sizeof(req32)))
875 return -EFAULT;
876
877 request = compat_alloc_user_space(sizeof(*request));
878 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
879 || __put_user(req32.handle, &request->handle)
880 || __put_user(req32.offset, &request->offset))
881 return -EFAULT;
882
883 return drm_ioctl(file->f_dentry->d_inode, file,
884 DRM_IOCTL_AGP_BIND, (unsigned long) request);
885}
886
887static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
888 unsigned long arg)
889{
890 drm_agp_binding32_t __user *argp = (void __user *)arg;
891 drm_agp_binding_t __user *request;
892 u32 handle;
893
894 request = compat_alloc_user_space(sizeof(*request));
895 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
896 || get_user(handle, &argp->handle)
897 || __put_user(handle, &request->handle))
898 return -EFAULT;
899
900 return drm_ioctl(file->f_dentry->d_inode, file,
901 DRM_IOCTL_AGP_UNBIND, (unsigned long) request);
902}
903#endif /* __OS_HAS_AGP */
904
905typedef struct drm_scatter_gather32 {
906 u32 size; /**< In bytes -- will round to page boundary */
907 u32 handle; /**< Used for mapping / unmapping */
908} drm_scatter_gather32_t;
909
910static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
911 unsigned long arg)
912{
913 drm_scatter_gather32_t __user *argp = (void __user *)arg;
914 drm_scatter_gather_t __user *request;
915 int err;
916 unsigned long x;
917
918 request = compat_alloc_user_space(sizeof(*request));
919 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
920 || !access_ok(VERIFY_WRITE, argp, sizeof(*argp))
921 || __get_user(x, &argp->size)
922 || __put_user(x, &request->size))
923 return -EFAULT;
924
925 err = drm_ioctl(file->f_dentry->d_inode, file,
926 DRM_IOCTL_SG_ALLOC, (unsigned long) request);
927 if (err)
928 return err;
929
930 /* XXX not sure about the handle conversion here... */
931 if (__get_user(x, &request->handle)
932 || __put_user(x >> PAGE_SHIFT, &argp->handle))
933 return -EFAULT;
934
935 return 0;
936}
937
938static int compat_drm_sg_free(struct file *file, unsigned int cmd,
939 unsigned long arg)
940{
941 drm_scatter_gather32_t __user *argp = (void __user *)arg;
942 drm_scatter_gather_t __user *request;
943 unsigned long x;
944
945 request = compat_alloc_user_space(sizeof(*request));
946 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
947 || !access_ok(VERIFY_WRITE, argp, sizeof(*argp))
948 || __get_user(x, &argp->handle)
949 || __put_user(x << PAGE_SHIFT, &request->handle))
950 return -EFAULT;
951
952 return drm_ioctl(file->f_dentry->d_inode, file,
953 DRM_IOCTL_SG_FREE, (unsigned long) request);
954}
955
956struct drm_wait_vblank_request32 {
957 drm_vblank_seq_type_t type;
958 unsigned int sequence;
959 u32 signal;
960};
961
962struct drm_wait_vblank_reply32 {
963 drm_vblank_seq_type_t type;
964 unsigned int sequence;
965 s32 tval_sec;
966 s32 tval_usec;
967};
968
969typedef union drm_wait_vblank32 {
970 struct drm_wait_vblank_request32 request;
971 struct drm_wait_vblank_reply32 reply;
972} drm_wait_vblank32_t;
973
974static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
975 unsigned long arg)
976{
977 drm_wait_vblank32_t __user *argp = (void __user *)arg;
978 drm_wait_vblank32_t req32;
979 drm_wait_vblank_t __user *request;
980 int err;
981
982 if (copy_from_user(&req32, argp, sizeof(req32)))
983 return -EFAULT;
984
985 request = compat_alloc_user_space(sizeof(*request));
986 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
987 || __put_user(req32.request.type, &request->request.type)
988 || __put_user(req32.request.sequence, &request->request.sequence)
989 || __put_user(req32.request.signal, &request->request.signal))
990 return -EFAULT;
991
992 err = drm_ioctl(file->f_dentry->d_inode, file,
993 DRM_IOCTL_WAIT_VBLANK, (unsigned long) request);
994 if (err)
995 return err;
996
997 if (__get_user(req32.reply.type, &request->reply.type)
998 || __get_user(req32.reply.sequence, &request->reply.sequence)
999 || __get_user(req32.reply.tval_sec, &request->reply.tval_sec)
1000 || __get_user(req32.reply.tval_usec, &request->reply.tval_usec))
1001 return -EFAULT;
1002
1003 if (copy_to_user(argp, &req32, sizeof(req32)))
1004 return -EFAULT;
1005
1006 return 0;
1007}
1008
1009drm_ioctl_compat_t *drm_compat_ioctls[] = {
1010 [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version,
1011 [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE32)] = compat_drm_getunique,
1012 [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP32)] = compat_drm_getmap,
1013 [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT32)] = compat_drm_getclient,
1014 [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS32)] = compat_drm_getstats,
1015 [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE32)] = compat_drm_setunique,
1016 [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP32)] = compat_drm_addmap,
1017 [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS32)] = compat_drm_addbufs,
1018 [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS32)] = compat_drm_markbufs,
1019 [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS32)] = compat_drm_infobufs,
1020 [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS32)] = compat_drm_mapbufs,
1021 [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS32)] = compat_drm_freebufs,
1022 [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP32)] = compat_drm_rmmap,
1023 [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX32)] = compat_drm_setsareactx,
1024 [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX32)] = compat_drm_getsareactx,
1025 [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX32)] = compat_drm_resctx,
1026 [DRM_IOCTL_NR(DRM_IOCTL_DMA32)] = compat_drm_dma,
1027#if __OS_HAS_AGP
1028 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE32)] = compat_drm_agp_enable,
1029 [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO32)] = compat_drm_agp_info,
1030 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC32)] = compat_drm_agp_alloc,
1031 [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE32)] = compat_drm_agp_free,
1032 [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND32)] = compat_drm_agp_bind,
1033 [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND32)] = compat_drm_agp_unbind,
1034#endif
1035 [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC32)] = compat_drm_sg_alloc,
1036 [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE32)] = compat_drm_sg_free,
1037 [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank,
1038};
1039
1040/**
1041 * Called whenever a 32-bit process running under a 64-bit kernel
1042 * performs an ioctl on /dev/drm.
1043 *
1044 * \param filp file pointer.
1045 * \param cmd command.
1046 * \param arg user argument.
1047 * \return zero on success or negative number on failure.
1048 */
1049long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1050{
1051 unsigned int nr = DRM_IOCTL_NR(cmd);
1052 drm_ioctl_compat_t *fn;
1053 int ret;
1054
1055 if (nr >= DRM_ARRAY_SIZE(drm_compat_ioctls))
1056 return -ENOTTY;
1057
1058 fn = drm_compat_ioctls[nr];
1059
1060 lock_kernel(); /* XXX for now */
1061 if (fn != NULL)
1062 ret = (*fn)(filp, cmd, arg);
1063 else
1064 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
1065 unlock_kernel();
1066
1067 return ret;
1068}
1069EXPORT_SYMBOL(drm_compat_ioctl);
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 7300a09dbd5c..b5903f9f1423 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -1,10 +1,30 @@
1/* i915_dma.c -- DMA support for the I915 -*- linux-c -*- 1/* i915_dma.c -- DMA support for the I915 -*- linux-c -*-
2 */ 2 */
3/************************************************************************** 3/**************************************************************************
4 * 4 *
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 *
8 **************************************************************************/ 28 **************************************************************************/
9 29
10#include "drmP.h" 30#include "drmP.h"
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h
index 7e55edf45c4f..23e027d29080 100644
--- a/drivers/char/drm/i915_drm.h
+++ b/drivers/char/drm/i915_drm.h
@@ -1,3 +1,30 @@
1/**************************************************************************
2 *
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
1#ifndef _I915_DRM_H_ 28#ifndef _I915_DRM_H_
2#define _I915_DRM_H_ 29#define _I915_DRM_H_
3 30
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 002b7082e21b..e6a9e1d1d283 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -1,11 +1,30 @@
1/* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*- 1/* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
2 */ 2 */
3
4/************************************************************************** 3/**************************************************************************
5 * 4 *
6 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
7 * All Rights Reserved. 6 * All Rights Reserved.
8 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 *
9 **************************************************************************/ 28 **************************************************************************/
10 29
11#include "drmP.h" 30#include "drmP.h"
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index f6ca92a565db..fa940d64b85d 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -1,10 +1,30 @@
1/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- 1/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
2 */ 2 */
3/************************************************************************** 3/**************************************************************************
4 * 4 *
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 *
8 **************************************************************************/ 28 **************************************************************************/
9 29
10#ifndef _I915_DRV_H_ 30#ifndef _I915_DRV_H_
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index b0239262a84a..a101cc9cfd7e 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -1,10 +1,30 @@
1/* i915_dma.c -- DMA support for the I915 -*- linux-c -*- 1/* i915_dma.c -- DMA support for the I915 -*- linux-c -*-
2 */ 2 */
3/************************************************************************** 3/**************************************************************************
4 * 4 *
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 *
8 **************************************************************************/ 28 **************************************************************************/
9 29
10#include "drmP.h" 30#include "drmP.h"
diff --git a/drivers/char/drm/i915_mem.c b/drivers/char/drm/i915_mem.c
index d54a3005946b..9b1698f521be 100644
--- a/drivers/char/drm/i915_mem.c
+++ b/drivers/char/drm/i915_mem.c
@@ -1,10 +1,30 @@
1/* i915_mem.c -- Simple agp/fb memory manager for i915 -*- linux-c -*- 1/* i915_mem.c -- Simple agp/fb memory manager for i915 -*- linux-c -*-
2 */ 2 */
3/************************************************************************** 3/**************************************************************************
4 * 4 *
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 *
8 **************************************************************************/ 28 **************************************************************************/
9 29
10#include "drmP.h" 30#include "drmP.h"
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index 7b983d96e53b..18e4e5b0952f 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -101,6 +101,9 @@ static struct drm_driver driver = {
101 .mmap = drm_mmap, 101 .mmap = drm_mmap,
102 .poll = drm_poll, 102 .poll = drm_poll,
103 .fasync = drm_fasync, 103 .fasync = drm_fasync,
104#ifdef CONFIG_COMPAT
105 .compat_ioctl = radeon_compat_ioctl,
106#endif
104 }, 107 },
105 .pci_driver = { 108 .pci_driver = {
106 .name = DRIVER_NAME, 109 .name = DRIVER_NAME,
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 5837098afae8..771aa80a5e8c 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -317,6 +317,9 @@ extern int radeon_preinit( struct drm_device *dev, unsigned long flags );
317extern int radeon_postinit( struct drm_device *dev, unsigned long flags ); 317extern int radeon_postinit( struct drm_device *dev, unsigned long flags );
318extern int radeon_postcleanup( struct drm_device *dev ); 318extern int radeon_postcleanup( struct drm_device *dev );
319 319
320extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
321 unsigned long arg);
322
320/* Flags for stats.boxes 323/* Flags for stats.boxes
321 */ 324 */
322#define RADEON_BOX_DMA_IDLE 0x1 325#define RADEON_BOX_DMA_IDLE 0x1
diff --git a/drivers/char/drm/radeon_ioc32.c b/drivers/char/drm/radeon_ioc32.c
new file mode 100644
index 000000000000..bfe612215fb3
--- /dev/null
+++ b/drivers/char/drm/radeon_ioc32.c
@@ -0,0 +1,395 @@
1/**
2 * \file radeon_ioc32.c
3 *
4 * 32-bit ioctl compatibility routines for the Radeon DRM.
5 *
6 * \author Paul Mackerras <paulus@samba.org>
7 *
8 * Copyright (C) Paul Mackerras 2005
9 * All Rights Reserved.
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice (including the next
19 * paragraph) shall be included in all copies or substantial portions of the
20 * Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * IN THE SOFTWARE.
29 */
30#include <linux/compat.h>
31#include <linux/ioctl32.h>
32
33#include "drmP.h"
34#include "drm.h"
35#include "radeon_drm.h"
36#include "radeon_drv.h"
37
38typedef struct drm_radeon_init32 {
39 int func;
40 u32 sarea_priv_offset;
41 int is_pci;
42 int cp_mode;
43 int gart_size;
44 int ring_size;
45 int usec_timeout;
46
47 unsigned int fb_bpp;
48 unsigned int front_offset, front_pitch;
49 unsigned int back_offset, back_pitch;
50 unsigned int depth_bpp;
51 unsigned int depth_offset, depth_pitch;
52
53 u32 fb_offset;
54 u32 mmio_offset;
55 u32 ring_offset;
56 u32 ring_rptr_offset;
57 u32 buffers_offset;
58 u32 gart_textures_offset;
59} drm_radeon_init32_t;
60
61static int compat_radeon_cp_init(struct file *file, unsigned int cmd,
62 unsigned long arg)
63{
64 drm_radeon_init32_t init32;
65 drm_radeon_init_t __user *init;
66
67 if (copy_from_user(&init32, (void __user *)arg, sizeof(init32)))
68 return -EFAULT;
69
70 init = compat_alloc_user_space(sizeof(*init));
71 if (!access_ok(VERIFY_WRITE, init, sizeof(*init))
72 || __put_user(init32.func, &init->func)
73 || __put_user(init32.sarea_priv_offset, &init->sarea_priv_offset)
74 || __put_user(init32.is_pci, &init->is_pci)
75 || __put_user(init32.cp_mode, &init->cp_mode)
76 || __put_user(init32.gart_size, &init->gart_size)
77 || __put_user(init32.ring_size, &init->ring_size)
78 || __put_user(init32.usec_timeout, &init->usec_timeout)
79 || __put_user(init32.fb_bpp, &init->fb_bpp)
80 || __put_user(init32.front_offset, &init->front_offset)
81 || __put_user(init32.front_pitch, &init->front_pitch)
82 || __put_user(init32.back_offset, &init->back_offset)
83 || __put_user(init32.back_pitch, &init->back_pitch)
84 || __put_user(init32.depth_bpp, &init->depth_bpp)
85 || __put_user(init32.depth_offset, &init->depth_offset)
86 || __put_user(init32.depth_pitch, &init->depth_pitch)
87 || __put_user(init32.fb_offset, &init->fb_offset)
88 || __put_user(init32.mmio_offset, &init->mmio_offset)
89 || __put_user(init32.ring_offset, &init->ring_offset)
90 || __put_user(init32.ring_rptr_offset, &init->ring_rptr_offset)
91 || __put_user(init32.buffers_offset, &init->buffers_offset)
92 || __put_user(init32.gart_textures_offset,
93 &init->gart_textures_offset))
94 return -EFAULT;
95
96 return drm_ioctl(file->f_dentry->d_inode, file,
97 DRM_IOCTL_RADEON_CP_INIT, (unsigned long) init);
98}
99
100typedef struct drm_radeon_clear32 {
101 unsigned int flags;
102 unsigned int clear_color;
103 unsigned int clear_depth;
104 unsigned int color_mask;
105 unsigned int depth_mask; /* misnamed field: should be stencil */
106 u32 depth_boxes;
107} drm_radeon_clear32_t;
108
109static int compat_radeon_cp_clear(struct file *file, unsigned int cmd,
110 unsigned long arg)
111{
112 drm_radeon_clear32_t clr32;
113 drm_radeon_clear_t __user *clr;
114
115 if (copy_from_user(&clr32, (void __user *)arg, sizeof(clr32)))
116 return -EFAULT;
117
118 clr = compat_alloc_user_space(sizeof(*clr));
119 if (!access_ok(VERIFY_WRITE, clr, sizeof(*clr))
120 || __put_user(clr32.flags, &clr->flags)
121 || __put_user(clr32.clear_color, &clr->clear_color)
122 || __put_user(clr32.clear_depth, &clr->clear_depth)
123 || __put_user(clr32.color_mask, &clr->color_mask)
124 || __put_user(clr32.depth_mask, &clr->depth_mask)
125 || __put_user((void __user *)(unsigned long)clr32.depth_boxes,
126 &clr->depth_boxes))
127 return -EFAULT;
128
129 return drm_ioctl(file->f_dentry->d_inode, file,
130 DRM_IOCTL_RADEON_CLEAR, (unsigned long) clr);
131}
132
133typedef struct drm_radeon_stipple32 {
134 u32 mask;
135} drm_radeon_stipple32_t;
136
137static int compat_radeon_cp_stipple(struct file *file, unsigned int cmd,
138 unsigned long arg)
139{
140 drm_radeon_stipple32_t __user *argp = (void __user *) arg;
141 drm_radeon_stipple_t __user *request;
142 u32 mask;
143
144 if (get_user(mask, &argp->mask))
145 return -EFAULT;
146
147 request = compat_alloc_user_space(sizeof(*request));
148 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
149 || __put_user((unsigned int __user *)(unsigned long) mask,
150 &request->mask))
151 return -EFAULT;
152
153 return drm_ioctl(file->f_dentry->d_inode, file,
154 DRM_IOCTL_RADEON_STIPPLE, (unsigned long) request);
155}
156
157typedef struct drm_radeon_tex_image32 {
158 unsigned int x, y; /* Blit coordinates */
159 unsigned int width, height;
160 u32 data;
161} drm_radeon_tex_image32_t;
162
163typedef struct drm_radeon_texture32 {
164 unsigned int offset;
165 int pitch;
166 int format;
167 int width; /* Texture image coordinates */
168 int height;
169 u32 image;
170} drm_radeon_texture32_t;
171
172static int compat_radeon_cp_texture(struct file *file, unsigned int cmd,
173 unsigned long arg)
174{
175 drm_radeon_texture32_t req32;
176 drm_radeon_texture_t __user *request;
177 drm_radeon_tex_image32_t img32;
178 drm_radeon_tex_image_t __user *image;
179
180 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
181 return -EFAULT;
182 if (req32.image == 0)
183 return -EINVAL;
184 if (copy_from_user(&img32, (void __user *)(unsigned long)req32.image,
185 sizeof(img32)))
186 return -EFAULT;
187
188 request = compat_alloc_user_space(sizeof(*request) + sizeof(*image));
189 if (!access_ok(VERIFY_WRITE, request,
190 sizeof(*request) + sizeof(*image)))
191 return -EFAULT;
192 image = (drm_radeon_tex_image_t __user *) (request + 1);
193
194 if (__put_user(req32.offset, &request->offset)
195 || __put_user(req32.pitch, &request->pitch)
196 || __put_user(req32.format, &request->format)
197 || __put_user(req32.width, &request->width)
198 || __put_user(req32.height, &request->height)
199 || __put_user(image, &request->image)
200 || __put_user(img32.x, &image->x)
201 || __put_user(img32.y, &image->y)
202 || __put_user(img32.width, &image->width)
203 || __put_user(img32.height, &image->height)
204 || __put_user((const void __user *)(unsigned long)img32.data,
205 &image->data))
206 return -EFAULT;
207
208 return drm_ioctl(file->f_dentry->d_inode, file,
209 DRM_IOCTL_RADEON_TEXTURE, (unsigned long) request);
210}
211
212typedef struct drm_radeon_vertex2_32 {
213 int idx; /* Index of vertex buffer */
214 int discard; /* Client finished with buffer? */
215 int nr_states;
216 u32 state;
217 int nr_prims;
218 u32 prim;
219} drm_radeon_vertex2_32_t;
220
221static int compat_radeon_cp_vertex2(struct file *file, unsigned int cmd,
222 unsigned long arg)
223{
224 drm_radeon_vertex2_32_t req32;
225 drm_radeon_vertex2_t __user *request;
226
227 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
228 return -EFAULT;
229
230 request = compat_alloc_user_space(sizeof(*request));
231 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
232 || __put_user(req32.idx, &request->idx)
233 || __put_user(req32.discard, &request->discard)
234 || __put_user(req32.nr_states, &request->nr_states)
235 || __put_user((void __user *)(unsigned long)req32.state,
236 &request->state)
237 || __put_user(req32.nr_prims, &request->nr_prims)
238 || __put_user((void __user *)(unsigned long)req32.prim,
239 &request->prim))
240 return -EFAULT;
241
242 return drm_ioctl(file->f_dentry->d_inode, file,
243 DRM_IOCTL_RADEON_VERTEX2, (unsigned long) request);
244}
245
246typedef struct drm_radeon_cmd_buffer32 {
247 int bufsz;
248 u32 buf;
249 int nbox;
250 u32 boxes;
251} drm_radeon_cmd_buffer32_t;
252
253static int compat_radeon_cp_cmdbuf(struct file *file, unsigned int cmd,
254 unsigned long arg)
255{
256 drm_radeon_cmd_buffer32_t req32;
257 drm_radeon_cmd_buffer_t __user *request;
258
259 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
260 return -EFAULT;
261
262 request = compat_alloc_user_space(sizeof(*request));
263 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
264 || __put_user(req32.bufsz, &request->bufsz)
265 || __put_user((void __user *)(unsigned long)req32.buf,
266 &request->buf)
267 || __put_user(req32.nbox, &request->nbox)
268 || __put_user((void __user *)(unsigned long)req32.boxes,
269 &request->boxes))
270 return -EFAULT;
271
272 return drm_ioctl(file->f_dentry->d_inode, file,
273 DRM_IOCTL_RADEON_CMDBUF, (unsigned long) request);
274}
275
276typedef struct drm_radeon_getparam32 {
277 int param;
278 u32 value;
279} drm_radeon_getparam32_t;
280
281static int compat_radeon_cp_getparam(struct file *file, unsigned int cmd,
282 unsigned long arg)
283{
284 drm_radeon_getparam32_t req32;
285 drm_radeon_getparam_t __user *request;
286
287 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
288 return -EFAULT;
289
290 request = compat_alloc_user_space(sizeof(*request));
291 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
292 || __put_user(req32.param, &request->param)
293 || __put_user((void __user *)(unsigned long)req32.value,
294 &request->value))
295 return -EFAULT;
296
297 return drm_ioctl(file->f_dentry->d_inode, file,
298 DRM_IOCTL_RADEON_GETPARAM, (unsigned long) request);
299}
300
301typedef struct drm_radeon_mem_alloc32 {
302 int region;
303 int alignment;
304 int size;
305 u32 region_offset; /* offset from start of fb or GART */
306} drm_radeon_mem_alloc32_t;
307
308static int compat_radeon_mem_alloc(struct file *file, unsigned int cmd,
309 unsigned long arg)
310{
311 drm_radeon_mem_alloc32_t req32;
312 drm_radeon_mem_alloc_t __user *request;
313
314 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
315 return -EFAULT;
316
317 request = compat_alloc_user_space(sizeof(*request));
318 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
319 || __put_user(req32.region, &request->region)
320 || __put_user(req32.alignment, &request->alignment)
321 || __put_user(req32.size, &request->size)
322 || __put_user((int __user *)(unsigned long)req32.region_offset,
323 &request->region_offset))
324 return -EFAULT;
325
326 return drm_ioctl(file->f_dentry->d_inode, file,
327 DRM_IOCTL_RADEON_ALLOC, (unsigned long) request);
328}
329
330typedef struct drm_radeon_irq_emit32 {
331 u32 irq_seq;
332} drm_radeon_irq_emit32_t;
333
334static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
335 unsigned long arg)
336{
337 drm_radeon_irq_emit32_t req32;
338 drm_radeon_irq_emit_t __user *request;
339
340 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
341 return -EFAULT;
342
343 request = compat_alloc_user_space(sizeof(*request));
344 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
345 || __put_user((int __user *)(unsigned long)req32.irq_seq,
346 &request->irq_seq))
347 return -EFAULT;
348
349 return drm_ioctl(file->f_dentry->d_inode, file,
350 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long) request);
351}
352
353drm_ioctl_compat_t *radeon_compat_ioctls[] = {
354 [DRM_RADEON_CP_INIT] = compat_radeon_cp_init,
355 [DRM_RADEON_CLEAR] = compat_radeon_cp_clear,
356 [DRM_RADEON_STIPPLE] = compat_radeon_cp_stipple,
357 [DRM_RADEON_TEXTURE] = compat_radeon_cp_texture,
358 [DRM_RADEON_VERTEX2] = compat_radeon_cp_vertex2,
359 [DRM_RADEON_CMDBUF] = compat_radeon_cp_cmdbuf,
360 [DRM_RADEON_GETPARAM] = compat_radeon_cp_getparam,
361 [DRM_RADEON_ALLOC] = compat_radeon_mem_alloc,
362 [DRM_RADEON_IRQ_EMIT] = compat_radeon_irq_emit,
363};
364
365/**
366 * Called whenever a 32-bit process running under a 64-bit kernel
367 * performs an ioctl on /dev/dri/card<n>.
368 *
369 * \param filp file pointer.
370 * \param cmd command.
371 * \param arg user argument.
372 * \return zero on success or negative number on failure.
373 */
374long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
375 unsigned long arg)
376{
377 unsigned int nr = DRM_IOCTL_NR(cmd);
378 drm_ioctl_compat_t *fn = NULL;
379 int ret;
380
381 if (nr < DRM_COMMAND_BASE)
382 return drm_compat_ioctl(filp, cmd, arg);
383
384 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(radeon_compat_ioctls))
385 fn = radeon_compat_ioctls[nr - DRM_COMMAND_BASE];
386
387 lock_kernel(); /* XXX for now */
388 if (fn != NULL)
389 ret = (*fn)(filp, cmd, arg);
390 else
391 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
392 unlock_kernel();
393
394 return ret;
395}
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c
index cd25f28e26a3..40474a65f56d 100644
--- a/drivers/char/drm/radeon_irq.c
+++ b/drivers/char/drm/radeon_irq.c
@@ -35,6 +35,14 @@
35#include "radeon_drm.h" 35#include "radeon_drm.h"
36#include "radeon_drv.h" 36#include "radeon_drv.h"
37 37
38static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv, u32 mask)
39{
40 u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) & mask;
41 if (irqs)
42 RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs);
43 return irqs;
44}
45
38/* Interrupts - Used for device synchronization and flushing in the 46/* Interrupts - Used for device synchronization and flushing in the
39 * following circumstances: 47 * following circumstances:
40 * 48 *
@@ -63,8 +71,8 @@ irqreturn_t radeon_driver_irq_handler( DRM_IRQ_ARGS )
63 /* Only consider the bits we're interested in - others could be used 71 /* Only consider the bits we're interested in - others could be used
64 * outside the DRM 72 * outside the DRM
65 */ 73 */
66 stat = RADEON_READ(RADEON_GEN_INT_STATUS) 74 stat = radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK |
67 & (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT); 75 RADEON_CRTC_VBLANK_STAT));
68 if (!stat) 76 if (!stat)
69 return IRQ_NONE; 77 return IRQ_NONE;
70 78
@@ -80,19 +88,9 @@ irqreturn_t radeon_driver_irq_handler( DRM_IRQ_ARGS )
80 drm_vbl_send_signals( dev ); 88 drm_vbl_send_signals( dev );
81 } 89 }
82 90
83 /* Acknowledge interrupts we handle */
84 RADEON_WRITE(RADEON_GEN_INT_STATUS, stat);
85 return IRQ_HANDLED; 91 return IRQ_HANDLED;
86} 92}
87 93
88static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv)
89{
90 u32 tmp = RADEON_READ( RADEON_GEN_INT_STATUS )
91 & (RADEON_SW_INT_TEST_ACK | RADEON_CRTC_VBLANK_STAT);
92 if (tmp)
93 RADEON_WRITE( RADEON_GEN_INT_STATUS, tmp );
94}
95
96static int radeon_emit_irq(drm_device_t *dev) 94static int radeon_emit_irq(drm_device_t *dev)
97{ 95{
98 drm_radeon_private_t *dev_priv = dev->dev_private; 96 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -141,7 +139,7 @@ int radeon_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence)
141 return DRM_ERR(EINVAL); 139 return DRM_ERR(EINVAL);
142 } 140 }
143 141
144 radeon_acknowledge_irqs( dev_priv ); 142 radeon_acknowledge_irqs(dev_priv, RADEON_CRTC_VBLANK_STAT);
145 143
146 dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; 144 dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE;
147 145
@@ -219,7 +217,8 @@ void radeon_driver_irq_preinstall( drm_device_t *dev ) {
219 RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 ); 217 RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 );
220 218
221 /* Clear bits if they're already high */ 219 /* Clear bits if they're already high */
222 radeon_acknowledge_irqs( dev_priv ); 220 radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK |
221 RADEON_CRTC_VBLANK_STAT));
223} 222}
224 223
225void radeon_driver_irq_postinstall( drm_device_t *dev ) { 224void radeon_driver_irq_postinstall( drm_device_t *dev ) {
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c
index 7def6ad51798..62cda25724e3 100644
--- a/drivers/char/ds1620.c
+++ b/drivers/char/ds1620.c
@@ -163,8 +163,7 @@ static void ds1620_out(int cmd, int bits, int value)
163 netwinder_ds1620_reset(); 163 netwinder_ds1620_reset();
164 netwinder_unlock(&flags); 164 netwinder_unlock(&flags);
165 165
166 set_current_state(TASK_INTERRUPTIBLE); 166 msleep(20);
167 schedule_timeout(2);
168} 167}
169 168
170static unsigned int ds1620_in(int cmd, int bits) 169static unsigned int ds1620_in(int cmd, int bits)
diff --git a/drivers/char/ftape/compressor/zftape-compress.c b/drivers/char/ftape/compressor/zftape-compress.c
index 220a227e6061..65ffc0be3df9 100644
--- a/drivers/char/ftape/compressor/zftape-compress.c
+++ b/drivers/char/ftape/compressor/zftape-compress.c
@@ -1176,8 +1176,8 @@ KERN_INFO "Compressor for zftape (lzrw3 algorithm)\n");
1176 } 1176 }
1177#else /* !MODULE */ 1177#else /* !MODULE */
1178 /* print a short no-nonsense boot message */ 1178 /* print a short no-nonsense boot message */
1179 printk("zftape compressor v1.00a 970514\n"); 1179 printk(KERN_INFO "zftape compressor v1.00a 970514\n");
1180 printk("For use with " FTAPE_VERSION "\n"); 1180 printk(KERN_INFO "For use with " FTAPE_VERSION "\n");
1181#endif /* MODULE */ 1181#endif /* MODULE */
1182 TRACE(ft_t_info, "zft_compressor_init @ 0x%p", zft_compressor_init); 1182 TRACE(ft_t_info, "zft_compressor_init @ 0x%p", zft_compressor_init);
1183 TRACE(ft_t_info, "installing compressor for zftape ..."); 1183 TRACE(ft_t_info, "installing compressor for zftape ...");
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 5ec732e6ca92..762fa430fb5b 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -834,7 +834,7 @@ int hpet_alloc(struct hpet_data *hdp)
834 printk("\n"); 834 printk("\n");
835 835
836 ns = hpetp->hp_period; /* femptoseconds, 10^-15 */ 836 ns = hpetp->hp_period; /* femptoseconds, 10^-15 */
837 do_div(ns, 1000000); /* convert to nanoseconds, 10^-9 */ 837 ns /= 1000000; /* convert to nanoseconds, 10^-9 */
838 printk(KERN_INFO "hpet%d: %ldns tick, %d %d-bit timers\n", 838 printk(KERN_INFO "hpet%d: %ldns tick, %d %d-bit timers\n",
839 hpetp->hp_which, ns, hpetp->hp_ntimer, 839 hpetp->hp_which, ns, hpetp->hp_ntimer,
840 cap & HPET_COUNTER_SIZE_MASK ? 64 : 32); 840 cap & HPET_COUNTER_SIZE_MASK ? 64 : 32);
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index a81197640283..6c4b3f986d0c 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -20,13 +20,14 @@
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
23#include <linux/apm_bios.h> 23#include <linux/seq_file.h>
24#include <linux/dmi.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/io.h> 26#include <asm/io.h>
26 27
27#include <linux/i8k.h> 28#include <linux/i8k.h>
28 29
29#define I8K_VERSION "1.13 14/05/2002" 30#define I8K_VERSION "1.14 21/02/2005"
30 31
31#define I8K_SMM_FN_STATUS 0x0025 32#define I8K_SMM_FN_STATUS 0x0025
32#define I8K_SMM_POWER_STATUS 0x0069 33#define I8K_SMM_POWER_STATUS 0x0069
@@ -34,7 +35,8 @@
34#define I8K_SMM_GET_FAN 0x00a3 35#define I8K_SMM_GET_FAN 0x00a3
35#define I8K_SMM_GET_SPEED 0x02a3 36#define I8K_SMM_GET_SPEED 0x02a3
36#define I8K_SMM_GET_TEMP 0x10a3 37#define I8K_SMM_GET_TEMP 0x10a3
37#define I8K_SMM_GET_DELL_SIG 0xffa3 38#define I8K_SMM_GET_DELL_SIG1 0xfea3
39#define I8K_SMM_GET_DELL_SIG2 0xffa3
38#define I8K_SMM_BIOS_VERSION 0x00a6 40#define I8K_SMM_BIOS_VERSION 0x00a6
39 41
40#define I8K_FAN_MULT 30 42#define I8K_FAN_MULT 30
@@ -52,18 +54,7 @@
52 54
53#define I8K_TEMPERATURE_BUG 1 55#define I8K_TEMPERATURE_BUG 1
54 56
55#define DELL_SIGNATURE "Dell Computer" 57static char bios_version[4];
56
57static char *supported_models[] = {
58 "Inspiron",
59 "Latitude",
60 NULL
61};
62
63static char system_vendor[48] = "?";
64static char product_name [48] = "?";
65static char bios_version [4] = "?";
66static char serial_number[16] = "?";
67 58
68MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); 59MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)");
69MODULE_DESCRIPTION("Driver for accessing SMM BIOS on Dell laptops"); 60MODULE_DESCRIPTION("Driver for accessing SMM BIOS on Dell laptops");
@@ -73,6 +64,10 @@ static int force;
73module_param(force, bool, 0); 64module_param(force, bool, 0);
74MODULE_PARM_DESC(force, "Force loading without checking for supported models"); 65MODULE_PARM_DESC(force, "Force loading without checking for supported models");
75 66
67static int ignore_dmi;
68module_param(ignore_dmi, bool, 0);
69MODULE_PARM_DESC(ignore_dmi, "Continue probing hardware even if DMI data does not match");
70
76static int restricted; 71static int restricted;
77module_param(restricted, bool, 0); 72module_param(restricted, bool, 0);
78MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set"); 73MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set");
@@ -81,69 +76,69 @@ static int power_status;
81module_param(power_status, bool, 0600); 76module_param(power_status, bool, 0600);
82MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); 77MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k");
83 78
84static ssize_t i8k_read(struct file *, char __user *, size_t, loff_t *); 79static int i8k_open_fs(struct inode *inode, struct file *file);
85static int i8k_ioctl(struct inode *, struct file *, unsigned int, 80static int i8k_ioctl(struct inode *, struct file *, unsigned int,
86 unsigned long); 81 unsigned long);
87 82
88static struct file_operations i8k_fops = { 83static struct file_operations i8k_fops = {
89 .read = i8k_read, 84 .open = i8k_open_fs,
90 .ioctl = i8k_ioctl, 85 .read = seq_read,
86 .llseek = seq_lseek,
87 .release = single_release,
88 .ioctl = i8k_ioctl,
89};
90
91struct smm_regs {
92 unsigned int eax;
93 unsigned int ebx __attribute__ ((packed));
94 unsigned int ecx __attribute__ ((packed));
95 unsigned int edx __attribute__ ((packed));
96 unsigned int esi __attribute__ ((packed));
97 unsigned int edi __attribute__ ((packed));
91}; 98};
92 99
93typedef struct { 100static inline char *i8k_get_dmi_data(int field)
94 unsigned int eax; 101{
95 unsigned int ebx __attribute__ ((packed)); 102 return dmi_get_system_info(field) ? : "N/A";
96 unsigned int ecx __attribute__ ((packed)); 103}
97 unsigned int edx __attribute__ ((packed));
98 unsigned int esi __attribute__ ((packed));
99 unsigned int edi __attribute__ ((packed));
100} SMMRegisters;
101
102typedef struct {
103 u8 type;
104 u8 length;
105 u16 handle;
106} DMIHeader;
107 104
108/* 105/*
109 * Call the System Management Mode BIOS. Code provided by Jonathan Buzzard. 106 * Call the System Management Mode BIOS. Code provided by Jonathan Buzzard.
110 */ 107 */
111static int i8k_smm(SMMRegisters *regs) 108static int i8k_smm(struct smm_regs *regs)
112{ 109{
113 int rc; 110 int rc;
114 int eax = regs->eax; 111 int eax = regs->eax;
115 112
116 asm("pushl %%eax\n\t" \ 113 asm("pushl %%eax\n\t"
117 "movl 0(%%eax),%%edx\n\t" \ 114 "movl 0(%%eax),%%edx\n\t"
118 "push %%edx\n\t" \ 115 "push %%edx\n\t"
119 "movl 4(%%eax),%%ebx\n\t" \ 116 "movl 4(%%eax),%%ebx\n\t"
120 "movl 8(%%eax),%%ecx\n\t" \ 117 "movl 8(%%eax),%%ecx\n\t"
121 "movl 12(%%eax),%%edx\n\t" \ 118 "movl 12(%%eax),%%edx\n\t"
122 "movl 16(%%eax),%%esi\n\t" \ 119 "movl 16(%%eax),%%esi\n\t"
123 "movl 20(%%eax),%%edi\n\t" \ 120 "movl 20(%%eax),%%edi\n\t"
124 "popl %%eax\n\t" \ 121 "popl %%eax\n\t"
125 "out %%al,$0xb2\n\t" \ 122 "out %%al,$0xb2\n\t"
126 "out %%al,$0x84\n\t" \ 123 "out %%al,$0x84\n\t"
127 "xchgl %%eax,(%%esp)\n\t" 124 "xchgl %%eax,(%%esp)\n\t"
128 "movl %%ebx,4(%%eax)\n\t" \ 125 "movl %%ebx,4(%%eax)\n\t"
129 "movl %%ecx,8(%%eax)\n\t" \ 126 "movl %%ecx,8(%%eax)\n\t"
130 "movl %%edx,12(%%eax)\n\t" \ 127 "movl %%edx,12(%%eax)\n\t"
131 "movl %%esi,16(%%eax)\n\t" \ 128 "movl %%esi,16(%%eax)\n\t"
132 "movl %%edi,20(%%eax)\n\t" \ 129 "movl %%edi,20(%%eax)\n\t"
133 "popl %%edx\n\t" \ 130 "popl %%edx\n\t"
134 "movl %%edx,0(%%eax)\n\t" \ 131 "movl %%edx,0(%%eax)\n\t"
135 "lahf\n\t" \ 132 "lahf\n\t"
136 "shrl $8,%%eax\n\t" \ 133 "shrl $8,%%eax\n\t"
137 "andl $1,%%eax\n" \ 134 "andl $1,%%eax\n":"=a"(rc)
138 : "=a" (rc) 135 : "a"(regs)
139 : "a" (regs) 136 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
140 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); 137
141 138 if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax)
142 if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff) || (regs->eax == eax)) { 139 return -EINVAL;
143 return -EINVAL; 140
144 } 141 return 0;
145
146 return 0;
147} 142}
148 143
149/* 144/*
@@ -152,24 +147,9 @@ static int i8k_smm(SMMRegisters *regs)
152 */ 147 */
153static int i8k_get_bios_version(void) 148static int i8k_get_bios_version(void)
154{ 149{
155 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 150 struct smm_regs regs = { .eax = I8K_SMM_BIOS_VERSION, };
156 int rc;
157
158 regs.eax = I8K_SMM_BIOS_VERSION;
159 if ((rc=i8k_smm(&regs)) < 0) {
160 return rc;
161 }
162
163 return regs.eax;
164}
165 151
166/* 152 return i8k_smm(&regs) ? : regs.eax;
167 * Read the machine id.
168 */
169static int i8k_get_serial_number(unsigned char *buff)
170{
171 strlcpy(buff, serial_number, sizeof(serial_number));
172 return 0;
173} 153}
174 154
175/* 155/*
@@ -177,24 +157,22 @@ static int i8k_get_serial_number(unsigned char *buff)
177 */ 157 */
178static int i8k_get_fn_status(void) 158static int i8k_get_fn_status(void)
179{ 159{
180 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 160 struct smm_regs regs = { .eax = I8K_SMM_FN_STATUS, };
181 int rc; 161 int rc;
182 162
183 regs.eax = I8K_SMM_FN_STATUS; 163 if ((rc = i8k_smm(&regs)) < 0)
184 if ((rc=i8k_smm(&regs)) < 0) { 164 return rc;
185 return rc; 165
186 } 166 switch ((regs.eax >> I8K_FN_SHIFT) & I8K_FN_MASK) {
187 167 case I8K_FN_UP:
188 switch ((regs.eax >> I8K_FN_SHIFT) & I8K_FN_MASK) { 168 return I8K_VOL_UP;
189 case I8K_FN_UP: 169 case I8K_FN_DOWN:
190 return I8K_VOL_UP; 170 return I8K_VOL_DOWN;
191 case I8K_FN_DOWN: 171 case I8K_FN_MUTE:
192 return I8K_VOL_DOWN; 172 return I8K_VOL_MUTE;
193 case I8K_FN_MUTE: 173 default:
194 return I8K_VOL_MUTE; 174 return 0;
195 default: 175 }
196 return 0;
197 }
198} 176}
199 177
200/* 178/*
@@ -202,20 +180,13 @@ static int i8k_get_fn_status(void)
202 */ 180 */
203static int i8k_get_power_status(void) 181static int i8k_get_power_status(void)
204{ 182{
205 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 183 struct smm_regs regs = { .eax = I8K_SMM_POWER_STATUS, };
206 int rc; 184 int rc;
207 185
208 regs.eax = I8K_SMM_POWER_STATUS; 186 if ((rc = i8k_smm(&regs)) < 0)
209 if ((rc=i8k_smm(&regs)) < 0) { 187 return rc;
210 return rc; 188
211 } 189 return (regs.eax & 0xff) == I8K_POWER_AC ? I8K_AC : I8K_BATTERY;
212
213 switch (regs.eax & 0xff) {
214 case I8K_POWER_AC:
215 return I8K_AC;
216 default:
217 return I8K_BATTERY;
218 }
219} 190}
220 191
221/* 192/*
@@ -223,16 +194,10 @@ static int i8k_get_power_status(void)
223 */ 194 */
224static int i8k_get_fan_status(int fan) 195static int i8k_get_fan_status(int fan)
225{ 196{
226 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 197 struct smm_regs regs = { .eax = I8K_SMM_GET_FAN, };
227 int rc;
228
229 regs.eax = I8K_SMM_GET_FAN;
230 regs.ebx = fan & 0xff;
231 if ((rc=i8k_smm(&regs)) < 0) {
232 return rc;
233 }
234 198
235 return (regs.eax & 0xff); 199 regs.ebx = fan & 0xff;
200 return i8k_smm(&regs) ? : regs.eax & 0xff;
236} 201}
237 202
238/* 203/*
@@ -240,16 +205,10 @@ static int i8k_get_fan_status(int fan)
240 */ 205 */
241static int i8k_get_fan_speed(int fan) 206static int i8k_get_fan_speed(int fan)
242{ 207{
243 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 208 struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, };
244 int rc;
245 209
246 regs.eax = I8K_SMM_GET_SPEED; 210 regs.ebx = fan & 0xff;
247 regs.ebx = fan & 0xff; 211 return i8k_smm(&regs) ? : (regs.eax & 0xffff) * I8K_FAN_MULT;
248 if ((rc=i8k_smm(&regs)) < 0) {
249 return rc;
250 }
251
252 return (regs.eax & 0xffff) * I8K_FAN_MULT;
253} 212}
254 213
255/* 214/*
@@ -257,532 +216,318 @@ static int i8k_get_fan_speed(int fan)
257 */ 216 */
258static int i8k_set_fan(int fan, int speed) 217static int i8k_set_fan(int fan, int speed)
259{ 218{
260 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 219 struct smm_regs regs = { .eax = I8K_SMM_SET_FAN, };
261 int rc;
262
263 speed = (speed < 0) ? 0 : ((speed > I8K_FAN_MAX) ? I8K_FAN_MAX : speed);
264 220
265 regs.eax = I8K_SMM_SET_FAN; 221 speed = (speed < 0) ? 0 : ((speed > I8K_FAN_MAX) ? I8K_FAN_MAX : speed);
266 regs.ebx = (fan & 0xff) | (speed << 8); 222 regs.ebx = (fan & 0xff) | (speed << 8);
267 if ((rc=i8k_smm(&regs)) < 0) {
268 return rc;
269 }
270 223
271 return (i8k_get_fan_status(fan)); 224 return i8k_smm(&regs) ? : i8k_get_fan_status(fan);
272} 225}
273 226
274/* 227/*
275 * Read the cpu temperature. 228 * Read the cpu temperature.
276 */ 229 */
277static int i8k_get_cpu_temp(void) 230static int i8k_get_temp(int sensor)
278{ 231{
279 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 232 struct smm_regs regs = { .eax = I8K_SMM_GET_TEMP, };
280 int rc; 233 int rc;
281 int temp; 234 int temp;
282 235
283#ifdef I8K_TEMPERATURE_BUG 236#ifdef I8K_TEMPERATURE_BUG
284 static int prev = 0; 237 static int prev;
285#endif 238#endif
239 regs.ebx = sensor & 0xff;
240 if ((rc = i8k_smm(&regs)) < 0)
241 return rc;
286 242
287 regs.eax = I8K_SMM_GET_TEMP; 243 temp = regs.eax & 0xff;
288 if ((rc=i8k_smm(&regs)) < 0) {
289 return rc;
290 }
291 temp = regs.eax & 0xff;
292 244
293#ifdef I8K_TEMPERATURE_BUG 245#ifdef I8K_TEMPERATURE_BUG
294 /* 246 /*
295 * Sometimes the temperature sensor returns 0x99, which is out of range. 247 * Sometimes the temperature sensor returns 0x99, which is out of range.
296 * In this case we return (once) the previous cached value. For example: 248 * In this case we return (once) the previous cached value. For example:
297 # 1003655137 00000058 00005a4b 249 # 1003655137 00000058 00005a4b
298 # 1003655138 00000099 00003a80 <--- 0x99 = 153 degrees 250 # 1003655138 00000099 00003a80 <--- 0x99 = 153 degrees
299 # 1003655139 00000054 00005c52 251 # 1003655139 00000054 00005c52
300 */ 252 */
301 if (temp > I8K_MAX_TEMP) { 253 if (temp > I8K_MAX_TEMP) {
302 temp = prev; 254 temp = prev;
303 prev = I8K_MAX_TEMP; 255 prev = I8K_MAX_TEMP;
304 } else { 256 } else {
305 prev = temp; 257 prev = temp;
306 } 258 }
307#endif 259#endif
308 260
309 return temp; 261 return temp;
310} 262}
311 263
312static int i8k_get_dell_signature(void) 264static int i8k_get_dell_signature(int req_fn)
313{ 265{
314 SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; 266 struct smm_regs regs = { .eax = req_fn, };
315 int rc; 267 int rc;
316 268
317 regs.eax = I8K_SMM_GET_DELL_SIG; 269 if ((rc = i8k_smm(&regs)) < 0)
318 if ((rc=i8k_smm(&regs)) < 0) { 270 return rc;
319 return rc;
320 }
321 271
322 if ((regs.eax == 1145651527) && (regs.edx == 1145392204)) { 272 return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1;
323 return 0;
324 } else {
325 return -1;
326 }
327} 273}
328 274
329static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, 275static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
330 unsigned long arg) 276 unsigned long arg)
331{ 277{
332 int val; 278 int val = 0;
333 int speed; 279 int speed;
334 unsigned char buff[16]; 280 unsigned char buff[16];
335 int __user *argp = (int __user *)arg; 281 int __user *argp = (int __user *)arg;
336
337 if (!argp)
338 return -EINVAL;
339
340 switch (cmd) {
341 case I8K_BIOS_VERSION:
342 val = i8k_get_bios_version();
343 break;
344
345 case I8K_MACHINE_ID:
346 memset(buff, 0, 16);
347 val = i8k_get_serial_number(buff);
348 break;
349
350 case I8K_FN_STATUS:
351 val = i8k_get_fn_status();
352 break;
353
354 case I8K_POWER_STATUS:
355 val = i8k_get_power_status();
356 break;
357
358 case I8K_GET_TEMP:
359 val = i8k_get_cpu_temp();
360 break;
361
362 case I8K_GET_SPEED:
363 if (copy_from_user(&val, argp, sizeof(int))) {
364 return -EFAULT;
365 }
366 val = i8k_get_fan_speed(val);
367 break;
368
369 case I8K_GET_FAN:
370 if (copy_from_user(&val, argp, sizeof(int))) {
371 return -EFAULT;
372 }
373 val = i8k_get_fan_status(val);
374 break;
375 282
376 case I8K_SET_FAN: 283 if (!argp)
377 if (restricted && !capable(CAP_SYS_ADMIN)) { 284 return -EINVAL;
378 return -EPERM;
379 }
380 if (copy_from_user(&val, argp, sizeof(int))) {
381 return -EFAULT;
382 }
383 if (copy_from_user(&speed, argp+1, sizeof(int))) {
384 return -EFAULT;
385 }
386 val = i8k_set_fan(val, speed);
387 break;
388 285
389 default: 286 switch (cmd) {
390 return -EINVAL; 287 case I8K_BIOS_VERSION:
391 } 288 val = i8k_get_bios_version();
289 break;
392 290
393 if (val < 0) { 291 case I8K_MACHINE_ID:
394 return val; 292 memset(buff, 0, 16);
395 } 293 strlcpy(buff, i8k_get_dmi_data(DMI_PRODUCT_SERIAL), sizeof(buff));
294 break;
396 295
397 switch (cmd) { 296 case I8K_FN_STATUS:
398 case I8K_BIOS_VERSION: 297 val = i8k_get_fn_status();
399 if (copy_to_user(argp, &val, 4)) { 298 break;
400 return -EFAULT;
401 }
402 break;
403 case I8K_MACHINE_ID:
404 if (copy_to_user(argp, buff, 16)) {
405 return -EFAULT;
406 }
407 break;
408 default:
409 if (copy_to_user(argp, &val, sizeof(int))) {
410 return -EFAULT;
411 }
412 break;
413 }
414 299
415 return 0; 300 case I8K_POWER_STATUS:
416} 301 val = i8k_get_power_status();
302 break;
417 303
418/* 304 case I8K_GET_TEMP:
419 * Print the information for /proc/i8k. 305 val = i8k_get_temp(0);
420 */ 306 break;
421static int i8k_get_info(char *buffer, char **start, off_t fpos, int length)
422{
423 int n, fn_key, cpu_temp, ac_power;
424 int left_fan, right_fan, left_speed, right_speed;
425
426 cpu_temp = i8k_get_cpu_temp(); /* 11100 µs */
427 left_fan = i8k_get_fan_status(I8K_FAN_LEFT); /* 580 µs */
428 right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); /* 580 µs */
429 left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); /* 580 µs */
430 right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); /* 580 µs */
431 fn_key = i8k_get_fn_status(); /* 750 µs */
432 if (power_status) {
433 ac_power = i8k_get_power_status(); /* 14700 µs */
434 } else {
435 ac_power = -1;
436 }
437
438 /*
439 * Info:
440 *
441 * 1) Format version (this will change if format changes)
442 * 2) BIOS version
443 * 3) BIOS machine ID
444 * 4) Cpu temperature
445 * 5) Left fan status
446 * 6) Right fan status
447 * 7) Left fan speed
448 * 8) Right fan speed
449 * 9) AC power
450 * 10) Fn Key status
451 */
452 n = sprintf(buffer, "%s %s %s %d %d %d %d %d %d %d\n",
453 I8K_PROC_FMT,
454 bios_version,
455 serial_number,
456 cpu_temp,
457 left_fan,
458 right_fan,
459 left_speed,
460 right_speed,
461 ac_power,
462 fn_key);
463
464 return n;
465}
466 307
467static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t *fpos) 308 case I8K_GET_SPEED:
468{ 309 if (copy_from_user(&val, argp, sizeof(int)))
469 int n; 310 return -EFAULT;
470 char info[128];
471 311
472 n = i8k_get_info(info, NULL, 0, 128); 312 val = i8k_get_fan_speed(val);
473 if (n <= 0) { 313 break;
474 return n;
475 }
476 314
477 if (*fpos >= n) { 315 case I8K_GET_FAN:
478 return 0; 316 if (copy_from_user(&val, argp, sizeof(int)))
479 } 317 return -EFAULT;
480 318
481 if ((*fpos + len) >= n) { 319 val = i8k_get_fan_status(val);
482 len = n - *fpos; 320 break;
483 }
484 321
485 if (copy_to_user(buffer, info, len) != 0) { 322 case I8K_SET_FAN:
486 return -EFAULT; 323 if (restricted && !capable(CAP_SYS_ADMIN))
487 } 324 return -EPERM;
488 325
489 *fpos += len; 326 if (copy_from_user(&val, argp, sizeof(int)))
490 return len; 327 return -EFAULT;
491}
492 328
493static char* __init string_trim(char *s, int size) 329 if (copy_from_user(&speed, argp + 1, sizeof(int)))
494{ 330 return -EFAULT;
495 int len;
496 char *p;
497 331
498 if ((len = strlen(s)) > size) { 332 val = i8k_set_fan(val, speed);
499 len = size; 333 break;
500 }
501 334
502 for (p=s+len-1; len && (*p==' '); len--,p--) { 335 default:
503 *p = '\0'; 336 return -EINVAL;
504 } 337 }
505 338
506 return s; 339 if (val < 0)
507} 340 return val;
508 341
509/* DMI code, stolen from arch/i386/kernel/dmi_scan.c */ 342 switch (cmd) {
343 case I8K_BIOS_VERSION:
344 if (copy_to_user(argp, &val, 4))
345 return -EFAULT;
510 346
511/* 347 break;
512 * |<-- dmi->length -->| 348 case I8K_MACHINE_ID:
513 * | | 349 if (copy_to_user(argp, buff, 16))
514 * |dmi header s=N | string1,\0, ..., stringN,\0, ..., \0 350 return -EFAULT;
515 * | |
516 * +-----------------------+
517 */
518static char* __init dmi_string(DMIHeader *dmi, u8 s)
519{
520 u8 *p;
521 351
522 if (!s) { 352 break;
523 return ""; 353 default:
524 } 354 if (copy_to_user(argp, &val, sizeof(int)))
525 s--; 355 return -EFAULT;
526 356
527 p = (u8 *)dmi + dmi->length; 357 break;
528 while (s > 0) { 358 }
529 p += strlen(p);
530 p++;
531 s--;
532 }
533 359
534 return p; 360 return 0;
535} 361}
536 362
537static void __init dmi_decode(DMIHeader *dmi) 363/*
364 * Print the information for /proc/i8k.
365 */
366static int i8k_proc_show(struct seq_file *seq, void *offset)
538{ 367{
539 u8 *data = (u8 *) dmi; 368 int fn_key, cpu_temp, ac_power;
540 char *p; 369 int left_fan, right_fan, left_speed, right_speed;
541 370
542#ifdef I8K_DEBUG 371 cpu_temp = i8k_get_temp(0); /* 11100 µs */
543 int i; 372 left_fan = i8k_get_fan_status(I8K_FAN_LEFT); /* 580 µs */
544 printk("%08x ", (int)data); 373 right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); /* 580 µs */
545 for (i=0; i<data[1] && i<64; i++) { 374 left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); /* 580 µs */
546 printk("%02x ", data[i]); 375 right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); /* 580 µs */
547 } 376 fn_key = i8k_get_fn_status(); /* 750 µs */
548 printk("\n"); 377 if (power_status)
549#endif 378 ac_power = i8k_get_power_status(); /* 14700 µs */
550 379 else
551 switch (dmi->type) { 380 ac_power = -1;
552 case 0: /* BIOS Information */
553 p = dmi_string(dmi,data[5]);
554 if (*p) {
555 strlcpy(bios_version, p, sizeof(bios_version));
556 string_trim(bios_version, sizeof(bios_version));
557 }
558 break;
559 case 1: /* System Information */
560 p = dmi_string(dmi,data[4]);
561 if (*p) {
562 strlcpy(system_vendor, p, sizeof(system_vendor));
563 string_trim(system_vendor, sizeof(system_vendor));
564 }
565 p = dmi_string(dmi,data[5]);
566 if (*p) {
567 strlcpy(product_name, p, sizeof(product_name));
568 string_trim(product_name, sizeof(product_name));
569 }
570 p = dmi_string(dmi,data[7]);
571 if (*p) {
572 strlcpy(serial_number, p, sizeof(serial_number));
573 string_trim(serial_number, sizeof(serial_number));
574 }
575 break;
576 }
577}
578 381
579static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*))
580{
581 u8 *buf;
582 u8 *data;
583 DMIHeader *dmi;
584 int i = 1;
585
586 buf = ioremap(base, len);
587 if (buf == NULL) {
588 return -1;
589 }
590 data = buf;
591
592 /*
593 * Stop when we see al the items the table claimed to have
594 * or we run off the end of the table (also happens)
595 */
596 while ((i<num) && ((data-buf) < len)) {
597 dmi = (DMIHeader *)data;
598 /*
599 * Avoid misparsing crud if the length of the last
600 * record is crap
601 */
602 if ((data-buf+dmi->length) >= len) {
603 break;
604 }
605 fn(dmi);
606 data += dmi->length;
607 /* 382 /*
608 * Don't go off the end of the data if there is 383 * Info:
609 * stuff looking like string fill past the end 384 *
385 * 1) Format version (this will change if format changes)
386 * 2) BIOS version
387 * 3) BIOS machine ID
388 * 4) Cpu temperature
389 * 5) Left fan status
390 * 6) Right fan status
391 * 7) Left fan speed
392 * 8) Right fan speed
393 * 9) AC power
394 * 10) Fn Key status
610 */ 395 */
611 while (((data-buf) < len) && (*data || data[1])) { 396 return seq_printf(seq, "%s %s %s %d %d %d %d %d %d %d\n",
612 data++; 397 I8K_PROC_FMT,
613 } 398 bios_version,
614 data += 2; 399 dmi_get_system_info(DMI_PRODUCT_SERIAL) ? : "N/A",
615 i++; 400 cpu_temp,
616 } 401 left_fan, right_fan, left_speed, right_speed,
617 iounmap(buf); 402 ac_power, fn_key);
618
619 return 0;
620} 403}
621 404
622static int __init dmi_iterate(void (*decode)(DMIHeader *)) 405static int i8k_open_fs(struct inode *inode, struct file *file)
623{ 406{
624 unsigned char buf[20]; 407 return single_open(file, i8k_proc_show, NULL);
625 void __iomem *p = ioremap(0xe0000, 0x20000), *q;
626
627 if (!p)
628 return -1;
629
630 for (q = p; q < p + 0x20000; q += 16) {
631 memcpy_fromio(buf, q, 20);
632 if (memcmp(buf, "_DMI_", 5)==0) {
633 u16 num = buf[13]<<8 | buf[12];
634 u16 len = buf [7]<<8 | buf [6];
635 u32 base = buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8];
636#ifdef I8K_DEBUG
637 printk(KERN_INFO "DMI %d.%d present.\n",
638 buf[14]>>4, buf[14]&0x0F);
639 printk(KERN_INFO "%d structures occupying %d bytes.\n",
640 buf[13]<<8 | buf[12],
641 buf [7]<<8 | buf[6]);
642 printk(KERN_INFO "DMI table at 0x%08X.\n",
643 buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]);
644#endif
645 if (dmi_table(base, len, num, decode)==0) {
646 iounmap(p);
647 return 0;
648 }
649 }
650 }
651 iounmap(p);
652 return -1;
653} 408}
654/* end of DMI code */
655
656/*
657 * Get DMI information.
658 */
659static int __init i8k_dmi_probe(void)
660{
661 char **p;
662
663 if (dmi_iterate(dmi_decode) != 0) {
664 printk(KERN_INFO "i8k: unable to get DMI information\n");
665 return -ENODEV;
666 }
667
668 if (strncmp(system_vendor,DELL_SIGNATURE,strlen(DELL_SIGNATURE)) != 0) {
669 printk(KERN_INFO "i8k: not running on a Dell system\n");
670 return -ENODEV;
671 }
672
673 for (p=supported_models; ; p++) {
674 if (!*p) {
675 printk(KERN_INFO "i8k: unsupported model: %s\n", product_name);
676 return -ENODEV;
677 }
678 if (strncmp(product_name,*p,strlen(*p)) == 0) {
679 break;
680 }
681 }
682 409
683 return 0; 410static struct dmi_system_id __initdata i8k_dmi_table[] = {
684} 411 {
412 .ident = "Dell Inspiron",
413 .matches = {
414 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer"),
415 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron"),
416 },
417 },
418 {
419 .ident = "Dell Latitude",
420 .matches = {
421 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer"),
422 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"),
423 },
424 },
425 {
426 .ident = "Dell Inspiron 2",
427 .matches = {
428 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
429 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron"),
430 },
431 },
432 {
433 .ident = "Dell Latitude 2",
434 .matches = {
435 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
436 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"),
437 },
438 },
439 { }
440};
685 441
686/* 442/*
687 * Probe for the presence of a supported laptop. 443 * Probe for the presence of a supported laptop.
688 */ 444 */
689static int __init i8k_probe(void) 445static int __init i8k_probe(void)
690{ 446{
691 char buff[4]; 447 char buff[4];
692 int version; 448 int version;
693 int smm_found = 0; 449
694
695 /*
696 * Get DMI information
697 */
698 if (i8k_dmi_probe() != 0) {
699 printk(KERN_INFO "i8k: vendor=%s, model=%s, version=%s\n",
700 system_vendor, product_name, bios_version);
701 }
702
703 /*
704 * Get SMM Dell signature
705 */
706 if (i8k_get_dell_signature() != 0) {
707 printk(KERN_INFO "i8k: unable to get SMM Dell signature\n");
708 } else {
709 smm_found = 1;
710 }
711
712 /*
713 * Get SMM BIOS version.
714 */
715 version = i8k_get_bios_version();
716 if (version <= 0) {
717 printk(KERN_INFO "i8k: unable to get SMM BIOS version\n");
718 } else {
719 smm_found = 1;
720 buff[0] = (version >> 16) & 0xff;
721 buff[1] = (version >> 8) & 0xff;
722 buff[2] = (version) & 0xff;
723 buff[3] = '\0';
724 /* 450 /*
725 * If DMI BIOS version is unknown use SMM BIOS version. 451 * Get DMI information
726 */ 452 */
727 if (bios_version[0] == '?') { 453 if (!dmi_check_system(i8k_dmi_table)) {
728 strcpy(bios_version, buff); 454 if (!ignore_dmi && !force)
455 return -ENODEV;
456
457 printk(KERN_INFO "i8k: not running on a supported Dell system.\n");
458 printk(KERN_INFO "i8k: vendor=%s, model=%s, version=%s\n",
459 i8k_get_dmi_data(DMI_SYS_VENDOR),
460 i8k_get_dmi_data(DMI_PRODUCT_NAME),
461 i8k_get_dmi_data(DMI_BIOS_VERSION));
729 } 462 }
463
464 strlcpy(bios_version, i8k_get_dmi_data(DMI_BIOS_VERSION), sizeof(bios_version));
465
730 /* 466 /*
731 * Check if the two versions match. 467 * Get SMM Dell signature
732 */ 468 */
733 if (strncmp(buff,bios_version,sizeof(bios_version)) != 0) { 469 if (i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG1) &&
734 printk(KERN_INFO "i8k: BIOS version mismatch: %s != %s\n", 470 i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG2)) {
735 buff, bios_version); 471 printk(KERN_ERR "i8k: unable to get SMM Dell signature\n");
472 if (!force)
473 return -ENODEV;
736 } 474 }
737 }
738 475
739 if (!smm_found && !force) { 476 /*
740 return -ENODEV; 477 * Get SMM BIOS version.
741 } 478 */
479 version = i8k_get_bios_version();
480 if (version <= 0) {
481 printk(KERN_WARNING "i8k: unable to get SMM BIOS version\n");
482 } else {
483 buff[0] = (version >> 16) & 0xff;
484 buff[1] = (version >> 8) & 0xff;
485 buff[2] = (version) & 0xff;
486 buff[3] = '\0';
487 /*
488 * If DMI BIOS version is unknown use SMM BIOS version.
489 */
490 if (!dmi_get_system_info(DMI_BIOS_VERSION))
491 strlcpy(bios_version, buff, sizeof(bios_version));
492
493 /*
494 * Check if the two versions match.
495 */
496 if (strncmp(buff, bios_version, sizeof(bios_version)) != 0)
497 printk(KERN_WARNING "i8k: BIOS version mismatch: %s != %s\n",
498 buff, bios_version);
499 }
742 500
743 return 0; 501 return 0;
744} 502}
745 503
746#ifdef MODULE 504static int __init i8k_init(void)
747static
748#endif
749int __init i8k_init(void)
750{ 505{
751 struct proc_dir_entry *proc_i8k; 506 struct proc_dir_entry *proc_i8k;
752
753 /* Are we running on an supported laptop? */
754 if (i8k_probe() != 0) {
755 return -ENODEV;
756 }
757
758 /* Register the proc entry */
759 proc_i8k = create_proc_info_entry("i8k", 0, NULL, i8k_get_info);
760 if (!proc_i8k) {
761 return -ENOENT;
762 }
763 proc_i8k->proc_fops = &i8k_fops;
764 proc_i8k->owner = THIS_MODULE;
765
766 printk(KERN_INFO
767 "Dell laptop SMM driver v%s Massimo Dal Zotto (dz@debian.org)\n",
768 I8K_VERSION);
769
770 return 0;
771}
772 507
773#ifdef MODULE 508 /* Are we running on an supported laptop? */
774int init_module(void) 509 if (i8k_probe())
775{ 510 return -ENODEV;
776 return i8k_init(); 511
512 /* Register the proc entry */
513 proc_i8k = create_proc_entry("i8k", 0, NULL);
514 if (!proc_i8k)
515 return -ENOENT;
516
517 proc_i8k->proc_fops = &i8k_fops;
518 proc_i8k->owner = THIS_MODULE;
519
520 printk(KERN_INFO
521 "Dell laptop SMM driver v%s Massimo Dal Zotto (dz@debian.org)\n",
522 I8K_VERSION);
523
524 return 0;
777} 525}
778 526
779void cleanup_module(void) 527static void __exit i8k_exit(void)
780{ 528{
781 /* Remove the proc entry */ 529 remove_proc_entry("i8k", NULL);
782 remove_proc_entry("i8k", NULL);
783
784 printk(KERN_INFO "i8k: module unloaded\n");
785} 530}
786#endif
787 531
788/* end of file */ 532module_init(i8k_init);
533module_exit(i8k_exit);
diff --git a/drivers/char/ip2/i2cmd.c b/drivers/char/ip2/i2cmd.c
index fd299d6c42ac..cb8f4198e9a3 100644
--- a/drivers/char/ip2/i2cmd.c
+++ b/drivers/char/ip2/i2cmd.c
@@ -97,7 +97,7 @@ static UCHAR ct41[] = { 1, BYP, 0x29 }; // RESUME
97//static UCHAR ct44[]={ 2, BTH, 0x2C,0 }; // MS PING 97//static UCHAR ct44[]={ 2, BTH, 0x2C,0 }; // MS PING
98//static UCHAR ct45[]={ 1, BTH, 0x2D }; // HOTENAB 98//static UCHAR ct45[]={ 1, BTH, 0x2D }; // HOTENAB
99//static UCHAR ct46[]={ 1, BTH, 0x2E }; // HOTDSAB 99//static UCHAR ct46[]={ 1, BTH, 0x2E }; // HOTDSAB
100static UCHAR ct47[] = { 7, BTH, 0x2F,0,0,0,0,0,0 }; // UNIX FLAGS 100//static UCHAR ct47[]={ 7, BTH, 0x2F,0,0,0,0,0,0 }; // UNIX FLAGS
101//static UCHAR ct48[]={ 1, BTH, 0x30 }; // DSRFLOWENAB 101//static UCHAR ct48[]={ 1, BTH, 0x30 }; // DSRFLOWENAB
102//static UCHAR ct49[]={ 1, BTH, 0x31 }; // DSRFLOWDSAB 102//static UCHAR ct49[]={ 1, BTH, 0x31 }; // DSRFLOWDSAB
103//static UCHAR ct50[]={ 1, BTH, 0x32 }; // DTRFLOWENAB 103//static UCHAR ct50[]={ 1, BTH, 0x32 }; // DTRFLOWENAB
@@ -162,6 +162,7 @@ static UCHAR ct89[]={ 1, BYP, 0x59 }; // DSS_NOW
162// This routine sets the parameters of command 47 and returns a pointer to the 162// This routine sets the parameters of command 47 and returns a pointer to the
163// appropriate structure. 163// appropriate structure.
164//****************************************************************************** 164//******************************************************************************
165#if 0
165cmdSyntaxPtr 166cmdSyntaxPtr
166i2cmdUnixFlags(unsigned short iflag,unsigned short cflag,unsigned short lflag) 167i2cmdUnixFlags(unsigned short iflag,unsigned short cflag,unsigned short lflag)
167{ 168{
@@ -175,6 +176,7 @@ i2cmdUnixFlags(unsigned short iflag,unsigned short cflag,unsigned short lflag)
175 pCM->cmd[6] = (unsigned char) (lflag >> 8); 176 pCM->cmd[6] = (unsigned char) (lflag >> 8);
176 return pCM; 177 return pCM;
177} 178}
179#endif /* 0 */
178 180
179//****************************************************************************** 181//******************************************************************************
180// Function: i2cmdBaudDef(which, rate) 182// Function: i2cmdBaudDef(which, rate)
@@ -187,7 +189,7 @@ i2cmdUnixFlags(unsigned short iflag,unsigned short cflag,unsigned short lflag)
187// This routine sets the parameters of commands 54 or 55 (according to the 189// This routine sets the parameters of commands 54 or 55 (according to the
188// argument which), and returns a pointer to the appropriate structure. 190// argument which), and returns a pointer to the appropriate structure.
189//****************************************************************************** 191//******************************************************************************
190cmdSyntaxPtr 192static cmdSyntaxPtr
191i2cmdBaudDef(int which, unsigned short rate) 193i2cmdBaudDef(int which, unsigned short rate)
192{ 194{
193 cmdSyntaxPtr pCM; 195 cmdSyntaxPtr pCM;
diff --git a/drivers/char/ip2/i2cmd.h b/drivers/char/ip2/i2cmd.h
index c41728a85710..baa4e721b758 100644
--- a/drivers/char/ip2/i2cmd.h
+++ b/drivers/char/ip2/i2cmd.h
@@ -64,16 +64,6 @@ typedef struct _cmdSyntax
64 // directly from user-level 64 // directly from user-level
65#define VAR 0x10 // This command is of variable length! 65#define VAR 0x10 // This command is of variable length!
66 66
67//-----------------------------------
68// External declarations for i2cmd.c
69//-----------------------------------
70// Routine to set up parameters for the "define hot-key sequence" command. Since
71// there is more than one parameter to assign, we must use a function rather
72// than a macro (used usually).
73//
74extern cmdSyntaxPtr i2cmdUnixFlags(USHORT iflag,USHORT cflag,USHORT lflag);
75extern cmdSyntaxPtr i2cmdBaudDef(int which, USHORT rate);
76
77// Declarations for the global arrays used to bear the commands and their 67// Declarations for the global arrays used to bear the commands and their
78// arguments. 68// arguments.
79// 69//
@@ -433,6 +423,7 @@ static UCHAR cc02[];
433#define CMD_HOT_ENAB (cmdSyntaxPtr)(ct45) // Enable Hot-key checking 423#define CMD_HOT_ENAB (cmdSyntaxPtr)(ct45) // Enable Hot-key checking
434#define CMD_HOT_DSAB (cmdSyntaxPtr)(ct46) // Disable Hot-key checking 424#define CMD_HOT_DSAB (cmdSyntaxPtr)(ct46) // Disable Hot-key checking
435 425
426#if 0
436// COMMAND 47: Send Protocol info via Unix flags: 427// COMMAND 47: Send Protocol info via Unix flags:
437// iflag = Unix tty t_iflag 428// iflag = Unix tty t_iflag
438// cflag = Unix tty t_cflag 429// cflag = Unix tty t_cflag
@@ -441,6 +432,7 @@ static UCHAR cc02[];
441// within these flags 432// within these flags
442// 433//
443#define CMD_UNIX_FLAGS(iflag,cflag,lflag) i2cmdUnixFlags(iflag,cflag,lflag) 434#define CMD_UNIX_FLAGS(iflag,cflag,lflag) i2cmdUnixFlags(iflag,cflag,lflag)
435#endif /* 0 */
444 436
445#define CMD_DSRFL_ENAB (cmdSyntaxPtr)(ct48) // Enable DSR receiver ctrl 437#define CMD_DSRFL_ENAB (cmdSyntaxPtr)(ct48) // Enable DSR receiver ctrl
446#define CMD_DSRFL_DSAB (cmdSyntaxPtr)(ct49) // Disable DSR receiver ctrl 438#define CMD_DSRFL_DSAB (cmdSyntaxPtr)(ct49) // Disable DSR receiver ctrl
diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c
index 3b8314b4249a..cf0cd58d6305 100644
--- a/drivers/char/ip2main.c
+++ b/drivers/char/ip2main.c
@@ -2691,16 +2691,6 @@ no_xon:
2691 pCh->flags |= ASYNC_CHECK_CD; 2691 pCh->flags |= ASYNC_CHECK_CD;
2692 } 2692 }
2693 2693
2694#ifdef XXX
2695do_flags_thing: // This is a test, we don't do the flags thing
2696
2697 if ( (cflag & CRTSCTS) ) {
2698 cflag |= 014000000000;
2699 }
2700 i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1,
2701 CMD_UNIX_FLAGS(iflag,cflag,lflag));
2702#endif
2703
2704service_it: 2694service_it:
2705 i2DrainOutput( pCh, 100 ); 2695 i2DrainOutput( pCh, 100 );
2706} 2696}
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 601c7fccb4cf..1bbf507adda5 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1756,7 +1756,7 @@ static void isicom_flush_buffer(struct tty_struct * tty)
1756} 1756}
1757 1757
1758 1758
1759static int __init register_ioregion(void) 1759static int __devinit register_ioregion(void)
1760{ 1760{
1761 int count, done=0; 1761 int count, done=0;
1762 for (count=0; count < BOARD_COUNT; count++ ) { 1762 for (count=0; count < BOARD_COUNT; count++ ) {
@@ -1771,7 +1771,7 @@ static int __init register_ioregion(void)
1771 return done; 1771 return done;
1772} 1772}
1773 1773
1774static void __exit unregister_ioregion(void) 1774static void unregister_ioregion(void)
1775{ 1775{
1776 int count; 1776 int count;
1777 for (count=0; count < BOARD_COUNT; count++ ) 1777 for (count=0; count < BOARD_COUNT; count++ )
@@ -1803,7 +1803,7 @@ static struct tty_operations isicom_ops = {
1803 .tiocmset = isicom_tiocmset, 1803 .tiocmset = isicom_tiocmset,
1804}; 1804};
1805 1805
1806static int __init register_drivers(void) 1806static int __devinit register_drivers(void)
1807{ 1807{
1808 int error; 1808 int error;
1809 1809
@@ -1834,7 +1834,7 @@ static int __init register_drivers(void)
1834 return 0; 1834 return 0;
1835} 1835}
1836 1836
1837static void __exit unregister_drivers(void) 1837static void unregister_drivers(void)
1838{ 1838{
1839 int error = tty_unregister_driver(isicom_normal); 1839 int error = tty_unregister_driver(isicom_normal);
1840 if (error) 1840 if (error)
@@ -1842,7 +1842,7 @@ static void __exit unregister_drivers(void)
1842 put_tty_driver(isicom_normal); 1842 put_tty_driver(isicom_normal);
1843} 1843}
1844 1844
1845static int __init register_isr(void) 1845static int __devinit register_isr(void)
1846{ 1846{
1847 int count, done=0; 1847 int count, done=0;
1848 unsigned long irqflags; 1848 unsigned long irqflags;
@@ -1883,7 +1883,7 @@ static void __exit unregister_isr(void)
1883 } 1883 }
1884} 1884}
1885 1885
1886static int __init isicom_init(void) 1886static int __devinit isicom_init(void)
1887{ 1887{
1888 int card, channel, base; 1888 int card, channel, base;
1889 struct isi_port * port; 1889 struct isi_port * port;
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index c02a21dbad5d..52a073eee201 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -407,7 +407,6 @@ static unsigned long stli_eisamemprobeaddrs[] = {
407}; 407};
408 408
409static int stli_eisamempsize = sizeof(stli_eisamemprobeaddrs) / sizeof(unsigned long); 409static int stli_eisamempsize = sizeof(stli_eisamemprobeaddrs) / sizeof(unsigned long);
410int stli_eisaprobe = STLI_EISAPROBE;
411 410
412/* 411/*
413 * Define the Stallion PCI vendor and device IDs. 412 * Define the Stallion PCI vendor and device IDs.
@@ -4685,7 +4684,7 @@ static int stli_initbrds(void)
4685#ifdef MODULE 4684#ifdef MODULE
4686 stli_argbrds(); 4685 stli_argbrds();
4687#endif 4686#endif
4688 if (stli_eisaprobe) 4687 if (STLI_EISAPROBE)
4689 stli_findeisabrds(); 4688 stli_findeisabrds();
4690#ifdef CONFIG_PCI 4689#ifdef CONFIG_PCI
4691 stli_findpcibrds(); 4690 stli_findpcibrds();
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index e3085b22a365..42187381506b 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -23,7 +23,10 @@
23#include <linux/devfs_fs_kernel.h> 23#include <linux/devfs_fs_kernel.h>
24#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/highmem.h>
27#include <linux/crash_dump.h>
26#include <linux/backing-dev.h> 28#include <linux/backing-dev.h>
29#include <linux/bootmem.h>
27 30
28#include <asm/uaccess.h> 31#include <asm/uaccess.h>
29#include <asm/io.h> 32#include <asm/io.h>
@@ -273,6 +276,40 @@ static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
273 return mmap_mem(file, vma); 276 return mmap_mem(file, vma);
274} 277}
275 278
279#ifdef CONFIG_CRASH_DUMP
280/*
281 * Read memory corresponding to the old kernel.
282 */
283static ssize_t read_oldmem(struct file *file, char __user *buf,
284 size_t count, loff_t *ppos)
285{
286 unsigned long pfn, offset;
287 size_t read = 0, csize;
288 int rc = 0;
289
290 while (count) {
291 pfn = *ppos / PAGE_SIZE;
292 if (pfn > saved_max_pfn)
293 return read;
294
295 offset = (unsigned long)(*ppos % PAGE_SIZE);
296 if (count > PAGE_SIZE - offset)
297 csize = PAGE_SIZE - offset;
298 else
299 csize = count;
300
301 rc = copy_oldmem_page(pfn, buf, csize, offset, 1);
302 if (rc < 0)
303 return rc;
304 buf += csize;
305 *ppos += csize;
306 read += csize;
307 count -= csize;
308 }
309 return read;
310}
311#endif
312
276extern long vread(char *buf, char *addr, unsigned long count); 313extern long vread(char *buf, char *addr, unsigned long count);
277extern long vwrite(char *buf, char *addr, unsigned long count); 314extern long vwrite(char *buf, char *addr, unsigned long count);
278 315
@@ -721,6 +758,7 @@ static int open_port(struct inode * inode, struct file * filp)
721#define read_full read_zero 758#define read_full read_zero
722#define open_mem open_port 759#define open_mem open_port
723#define open_kmem open_mem 760#define open_kmem open_mem
761#define open_oldmem open_mem
724 762
725static struct file_operations mem_fops = { 763static struct file_operations mem_fops = {
726 .llseek = memory_lseek, 764 .llseek = memory_lseek,
@@ -770,6 +808,13 @@ static struct file_operations full_fops = {
770 .write = write_full, 808 .write = write_full,
771}; 809};
772 810
811#ifdef CONFIG_CRASH_DUMP
812static struct file_operations oldmem_fops = {
813 .read = read_oldmem,
814 .open = open_oldmem,
815};
816#endif
817
773static ssize_t kmsg_write(struct file * file, const char __user * buf, 818static ssize_t kmsg_write(struct file * file, const char __user * buf,
774 size_t count, loff_t *ppos) 819 size_t count, loff_t *ppos)
775{ 820{
@@ -825,6 +870,11 @@ static int memory_open(struct inode * inode, struct file * filp)
825 case 11: 870 case 11:
826 filp->f_op = &kmsg_fops; 871 filp->f_op = &kmsg_fops;
827 break; 872 break;
873#ifdef CONFIG_CRASH_DUMP
874 case 12:
875 filp->f_op = &oldmem_fops;
876 break;
877#endif
828 default: 878 default:
829 return -ENXIO; 879 return -ENXIO;
830 } 880 }
@@ -854,6 +904,9 @@ static const struct {
854 {8, "random", S_IRUGO | S_IWUSR, &random_fops}, 904 {8, "random", S_IRUGO | S_IWUSR, &random_fops},
855 {9, "urandom", S_IRUGO | S_IWUSR, &urandom_fops}, 905 {9, "urandom", S_IRUGO | S_IWUSR, &urandom_fops},
856 {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops}, 906 {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops},
907#ifdef CONFIG_CRASH_DUMP
908 {12,"oldmem", S_IRUSR | S_IWUSR | S_IRGRP, &oldmem_fops},
909#endif
857}; 910};
858 911
859static struct class *mem_class; 912static struct class *mem_class;
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 3115d318b997..31cf84d69026 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -66,8 +66,6 @@ static unsigned char misc_minors[DYNAMIC_MINORS / 8];
66extern int rtc_DP8570A_init(void); 66extern int rtc_DP8570A_init(void);
67extern int rtc_MK48T08_init(void); 67extern int rtc_MK48T08_init(void);
68extern int pmu_device_init(void); 68extern int pmu_device_init(void);
69extern int tosh_init(void);
70extern int i8k_init(void);
71 69
72#ifdef CONFIG_PROC_FS 70#ifdef CONFIG_PROC_FS
73static void *misc_seq_start(struct seq_file *seq, loff_t *pos) 71static void *misc_seq_start(struct seq_file *seq, loff_t *pos)
@@ -314,12 +312,6 @@ static int __init misc_init(void)
314#ifdef CONFIG_PMAC_PBOOK 312#ifdef CONFIG_PMAC_PBOOK
315 pmu_device_init(); 313 pmu_device_init();
316#endif 314#endif
317#ifdef CONFIG_TOSHIBA
318 tosh_init();
319#endif
320#ifdef CONFIG_I8K
321 i8k_init();
322#endif
323 if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { 315 if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
324 printk("unable to get major %d for misc devices\n", 316 printk("unable to get major %d for misc devices\n",
325 MISC_MAJOR); 317 MISC_MAJOR);
diff --git a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c
index ab00f51475df..613aed9e1840 100644
--- a/drivers/char/mwave/3780i.c
+++ b/drivers/char/mwave/3780i.c
@@ -107,8 +107,8 @@ void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO,
107 spin_unlock_irqrestore(&dsp_lock, flags); 107 spin_unlock_irqrestore(&dsp_lock, flags);
108} 108}
109 109
110void dsp3780I_WriteGenCfg(unsigned short usDspBaseIO, unsigned uIndex, 110static void dsp3780I_WriteGenCfg(unsigned short usDspBaseIO, unsigned uIndex,
111 unsigned char ucValue) 111 unsigned char ucValue)
112{ 112{
113 DSP_ISA_SLAVE_CONTROL rSlaveControl; 113 DSP_ISA_SLAVE_CONTROL rSlaveControl;
114 DSP_ISA_SLAVE_CONTROL rSlaveControl_Save; 114 DSP_ISA_SLAVE_CONTROL rSlaveControl_Save;
@@ -141,6 +141,7 @@ void dsp3780I_WriteGenCfg(unsigned short usDspBaseIO, unsigned uIndex,
141 141
142} 142}
143 143
144#if 0
144unsigned char dsp3780I_ReadGenCfg(unsigned short usDspBaseIO, 145unsigned char dsp3780I_ReadGenCfg(unsigned short usDspBaseIO,
145 unsigned uIndex) 146 unsigned uIndex)
146{ 147{
@@ -167,6 +168,7 @@ unsigned char dsp3780I_ReadGenCfg(unsigned short usDspBaseIO,
167 168
168 return ucValue; 169 return ucValue;
169} 170}
171#endif /* 0 */
170 172
171int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings, 173int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
172 unsigned short *pIrqMap, 174 unsigned short *pIrqMap,
diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h
index 3e7d020d1bf4..270431ca7dae 100644
--- a/drivers/char/mwave/3780i.h
+++ b/drivers/char/mwave/3780i.h
@@ -338,10 +338,6 @@ unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO,
338 unsigned long ulMsaAddr); 338 unsigned long ulMsaAddr);
339void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO, 339void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO,
340 unsigned long ulMsaAddr, unsigned short usValue); 340 unsigned long ulMsaAddr, unsigned short usValue);
341void dsp3780I_WriteGenCfg(unsigned short usDspBaseIO, unsigned uIndex,
342 unsigned char ucValue);
343unsigned char dsp3780I_ReadGenCfg(unsigned short usDspBaseIO,
344 unsigned uIndex);
345int dsp3780I_GetIPCSource(unsigned short usDspBaseIO, 341int dsp3780I_GetIPCSource(unsigned short usDspBaseIO,
346 unsigned short *pusIPCSource); 342 unsigned short *pusIPCSource);
347 343
diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c
index ab650cd6efc0..d6c72e0934e2 100644
--- a/drivers/char/mwave/tp3780i.c
+++ b/drivers/char/mwave/tp3780i.c
@@ -242,20 +242,14 @@ int tp3780I_ClaimResources(THINKPAD_BD_DATA * pBDData)
242{ 242{
243 int retval = 0; 243 int retval = 0;
244 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 244 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
245#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
246 struct resource *pres; 245 struct resource *pres;
247#endif
248 246
249 PRINTK_2(TRACE_TP3780I, 247 PRINTK_2(TRACE_TP3780I,
250 "tp3780i::tp3780I_ClaimResources entry pBDData %p\n", pBDData); 248 "tp3780i::tp3780I_ClaimResources entry pBDData %p\n", pBDData);
251 249
252#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
253 pres = request_region(pSettings->usDspBaseIO, 16, "mwave_3780i"); 250 pres = request_region(pSettings->usDspBaseIO, 16, "mwave_3780i");
254 if ( pres == NULL ) retval = -EIO; 251 if ( pres == NULL ) retval = -EIO;
255#else 252
256 retval = check_region(pSettings->usDspBaseIO, 16);
257 if (!retval) request_region(pSettings->usDspBaseIO, 16, "mwave_3780i");
258#endif
259 if (retval) { 253 if (retval) {
260 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_ClaimResources: Error: Could not claim I/O region starting at %x\n", pSettings->usDspBaseIO); 254 PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_ClaimResources: Error: Could not claim I/O region starting at %x\n", pSettings->usDspBaseIO);
261 retval = -EIO; 255 retval = -EIO;
@@ -292,7 +286,7 @@ int tp3780I_ReleaseResources(THINKPAD_BD_DATA * pBDData)
292int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData) 286int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData)
293{ 287{
294 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings; 288 DSP_3780I_CONFIG_SETTINGS *pSettings = &pBDData->rDspSettings;
295 BOOLEAN bDSPPoweredUp = FALSE, bDSPEnabled = FALSE, bInterruptAllocated = FALSE; 289 BOOLEAN bDSPPoweredUp = FALSE, bInterruptAllocated = FALSE;
296 290
297 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_EnableDSP entry pBDData %p\n", pBDData); 291 PRINTK_2(TRACE_TP3780I, "tp3780i::tp3780I_EnableDSP entry pBDData %p\n", pBDData);
298 292
@@ -397,8 +391,6 @@ int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData)
397 if (dsp3780I_EnableDSP(pSettings, s_ausThinkpadIrqToField, s_ausThinkpadDmaToField)) { 391 if (dsp3780I_EnableDSP(pSettings, s_ausThinkpadIrqToField, s_ausThinkpadDmaToField)) {
398 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: dsp7880I_EnableDSP() failed\n"); 392 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: dsp7880I_EnableDSP() failed\n");
399 goto exit_cleanup; 393 goto exit_cleanup;
400 } else {
401 bDSPEnabled = TRUE;
402 } 394 }
403 395
404 EnableSRAM(pBDData); 396 EnableSRAM(pBDData);
@@ -411,8 +403,6 @@ int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData)
411 403
412exit_cleanup: 404exit_cleanup:
413 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Cleaning up\n"); 405 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Cleaning up\n");
414 if (bDSPEnabled)
415 dsp3780I_DisableDSP(pSettings);
416 if (bDSPPoweredUp) 406 if (bDSPPoweredUp)
417 smapi_set_DSP_power_state(FALSE); 407 smapi_set_DSP_power_state(FALSE);
418 if (bInterruptAllocated) { 408 if (bInterruptAllocated) {
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index f63a3fd7ca6f..1af733d07321 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -211,12 +211,13 @@ nvram_check_checksum(void)
211 return rv; 211 return rv;
212} 212}
213 213
214void 214static void
215__nvram_set_checksum(void) 215__nvram_set_checksum(void)
216{ 216{
217 mach_set_checksum(); 217 mach_set_checksum();
218} 218}
219 219
220#if 0
220void 221void
221nvram_set_checksum(void) 222nvram_set_checksum(void)
222{ 223{
@@ -226,6 +227,7 @@ nvram_set_checksum(void)
226 __nvram_set_checksum(); 227 __nvram_set_checksum();
227 spin_unlock_irqrestore(&rtc_lock, flags); 228 spin_unlock_irqrestore(&rtc_lock, flags);
228} 229}
230#endif /* 0 */
229 231
230/* 232/*
231 * The are the file operation function for user access to /dev/nvram 233 * The are the file operation function for user access to /dev/nvram
@@ -921,6 +923,4 @@ EXPORT_SYMBOL(__nvram_write_byte);
921EXPORT_SYMBOL(nvram_write_byte); 923EXPORT_SYMBOL(nvram_write_byte);
922EXPORT_SYMBOL(__nvram_check_checksum); 924EXPORT_SYMBOL(__nvram_check_checksum);
923EXPORT_SYMBOL(nvram_check_checksum); 925EXPORT_SYMBOL(nvram_check_checksum);
924EXPORT_SYMBOL(__nvram_set_checksum);
925EXPORT_SYMBOL(nvram_set_checksum);
926MODULE_ALIAS_MISCDEV(NVRAM_MINOR); 926MODULE_ALIAS_MISCDEV(NVRAM_MINOR);
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h
index e8f3860f4726..01987c6dc398 100644
--- a/drivers/char/rio/func.h
+++ b/drivers/char/rio/func.h
@@ -147,7 +147,6 @@ struct rio_info * rio_info_store( int cmd, struct rio_info * p);
147extern int rio_pcicopy(char *src, char *dst, int n); 147extern int rio_pcicopy(char *src, char *dst, int n);
148extern int rio_minor (struct tty_struct *tty); 148extern int rio_minor (struct tty_struct *tty);
149extern int rio_ismodem (struct tty_struct *tty); 149extern int rio_ismodem (struct tty_struct *tty);
150extern void rio_udelay (int usecs);
151 150
152extern void rio_start_card_running (struct Host * HostP); 151extern void rio_start_card_running (struct Host * HostP);
153 152
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 763893e289b3..7db3370f4972 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -354,11 +354,6 @@ int rio_ismodem(struct tty_struct *tty)
354} 354}
355 355
356 356
357void rio_udelay (int usecs)
358{
359 udelay (usecs);
360}
361
362static int rio_set_real_termios (void *ptr) 357static int rio_set_real_termios (void *ptr)
363{ 358{
364 int rv, modem; 359 int rv, modem;
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
index dca941ed10cf..898a126ae3e6 100644
--- a/drivers/char/rio/rioinit.c
+++ b/drivers/char/rio/rioinit.c
@@ -37,6 +37,7 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/errno.h> 39#include <linux/errno.h>
40#include <linux/delay.h>
40#include <asm/io.h> 41#include <asm/io.h>
41#include <asm/system.h> 42#include <asm/system.h>
42#include <asm/string.h> 43#include <asm/string.h>
@@ -1560,14 +1561,14 @@ uint Slot;
1560 INTERRUPT_DISABLE | BYTE_OPERATION | 1561 INTERRUPT_DISABLE | BYTE_OPERATION |
1561 SLOW_LINKS | SLOW_AT_BUS); 1562 SLOW_LINKS | SLOW_AT_BUS);
1562 WBYTE(DpRamP->DpResetTpu, 0xFF); 1563 WBYTE(DpRamP->DpResetTpu, 0xFF);
1563 rio_udelay (3); 1564 udelay(3);
1564 1565
1565 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); 1566 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n");
1566 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | 1567 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
1567 INTERRUPT_DISABLE | BYTE_OPERATION | 1568 INTERRUPT_DISABLE | BYTE_OPERATION |
1568 SLOW_LINKS | SLOW_AT_BUS); 1569 SLOW_LINKS | SLOW_AT_BUS);
1569 WBYTE(DpRamP->DpResetTpu, 0xFF); 1570 WBYTE(DpRamP->DpResetTpu, 0xFF);
1570 rio_udelay (3); 1571 udelay(3);
1571 break; 1572 break;
1572#ifdef FUTURE_RELEASE 1573#ifdef FUTURE_RELEASE
1573 case RIO_EISA: 1574 case RIO_EISA:
@@ -1599,7 +1600,7 @@ uint Slot;
1599 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; 1600 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM;
1600 DpRamP->DpResetInt = 0xFF; 1601 DpRamP->DpResetInt = 0xFF;
1601 DpRamP->DpResetTpu = 0xFF; 1602 DpRamP->DpResetTpu = 0xFF;
1602 rio_udelay (100); 1603 udelay(100);
1603 /* for (i=0; i<6000; i++); */ 1604 /* for (i=0; i<6000; i++); */
1604 /* suspend( 3 ); */ 1605 /* suspend( 3 ); */
1605 break; 1606 break;
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index db655002671f..78a321afdf4f 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -524,16 +524,16 @@ riotclose(void *ptr)
524 register uint SysPort = dev; 524 register uint SysPort = dev;
525 struct ttystatics *tp; /* pointer to our ttystruct */ 525 struct ttystatics *tp; /* pointer to our ttystruct */
526#endif 526#endif
527 struct Port *PortP =ptr; /* pointer to the port structure */ 527 struct Port *PortP = ptr; /* pointer to the port structure */
528 int deleted = 0; 528 int deleted = 0;
529 int try = -1; /* Disable the timeouts by setting them to -1 */ 529 int try = -1; /* Disable the timeouts by setting them to -1 */
530 int repeat_this = -1; /* Congrats to those having 15 years of 530 int repeat_this = -1; /* Congrats to those having 15 years of
531 uptime! (You get to break the driver.) */ 531 uptime! (You get to break the driver.) */
532 long end_time; 532 unsigned long end_time;
533 struct tty_struct * tty; 533 struct tty_struct * tty;
534 unsigned long flags; 534 unsigned long flags;
535 int Modem; 535 int Modem;
536 int rv =0; 536 int rv = 0;
537 537
538 rio_dprintk (RIO_DEBUG_TTY, "port close SysPort %d\n",PortP->PortNum); 538 rio_dprintk (RIO_DEBUG_TTY, "port close SysPort %d\n",PortP->PortNum);
539 539
@@ -620,7 +620,7 @@ riotclose(void *ptr)
620 if (repeat_this -- <= 0) { 620 if (repeat_this -- <= 0) {
621 rv = -EINTR; 621 rv = -EINTR;
622 rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); 622 rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
623 RIOPreemptiveCmd(p, PortP, FCLOSE ); 623 RIOPreemptiveCmd(p, PortP, FCLOSE);
624 goto close_end; 624 goto close_end;
625 } 625 }
626 rio_dprintk (RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); 626 rio_dprintk (RIO_DEBUG_TTY, "Calling timeout to flush in closing\n");
@@ -656,14 +656,12 @@ riotclose(void *ptr)
656 goto close_end; 656 goto close_end;
657 } 657 }
658 658
659
660
661 /* Can't call RIOShortCommand with the port locked. */ 659 /* Can't call RIOShortCommand with the port locked. */
662 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 660 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
663 661
664 if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) { 662 if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) {
665 RIOPreemptiveCmd(p, PortP,FCLOSE); 663 RIOPreemptiveCmd(p, PortP, FCLOSE);
666 goto close_end; 664 goto close_end;
667 } 665 }
668 666
669 if (!deleted) 667 if (!deleted)
@@ -698,7 +696,6 @@ riotclose(void *ptr)
698*/ 696*/
699 PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW); 697 PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW);
700 698
701
702#ifdef STATS 699#ifdef STATS
703 PortP->Stat.CloseCnt++; 700 PortP->Stat.CloseCnt++;
704#endif 701#endif
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 5bcbeb0cb9ae..f463d6baa685 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -161,6 +161,64 @@ static Word_t upci_aiop_intr_bits[AIOP_CTL_SIZE] = {
161 UPCI_AIOP_INTR_BIT_3 161 UPCI_AIOP_INTR_BIT_3
162}; 162};
163 163
164static Byte_t RData[RDATASIZE] = {
165 0x00, 0x09, 0xf6, 0x82,
166 0x02, 0x09, 0x86, 0xfb,
167 0x04, 0x09, 0x00, 0x0a,
168 0x06, 0x09, 0x01, 0x0a,
169 0x08, 0x09, 0x8a, 0x13,
170 0x0a, 0x09, 0xc5, 0x11,
171 0x0c, 0x09, 0x86, 0x85,
172 0x0e, 0x09, 0x20, 0x0a,
173 0x10, 0x09, 0x21, 0x0a,
174 0x12, 0x09, 0x41, 0xff,
175 0x14, 0x09, 0x82, 0x00,
176 0x16, 0x09, 0x82, 0x7b,
177 0x18, 0x09, 0x8a, 0x7d,
178 0x1a, 0x09, 0x88, 0x81,
179 0x1c, 0x09, 0x86, 0x7a,
180 0x1e, 0x09, 0x84, 0x81,
181 0x20, 0x09, 0x82, 0x7c,
182 0x22, 0x09, 0x0a, 0x0a
183};
184
185static Byte_t RRegData[RREGDATASIZE] = {
186 0x00, 0x09, 0xf6, 0x82, /* 00: Stop Rx processor */
187 0x08, 0x09, 0x8a, 0x13, /* 04: Tx software flow control */
188 0x0a, 0x09, 0xc5, 0x11, /* 08: XON char */
189 0x0c, 0x09, 0x86, 0x85, /* 0c: XANY */
190 0x12, 0x09, 0x41, 0xff, /* 10: Rx mask char */
191 0x14, 0x09, 0x82, 0x00, /* 14: Compare/Ignore #0 */
192 0x16, 0x09, 0x82, 0x7b, /* 18: Compare #1 */
193 0x18, 0x09, 0x8a, 0x7d, /* 1c: Compare #2 */
194 0x1a, 0x09, 0x88, 0x81, /* 20: Interrupt #1 */
195 0x1c, 0x09, 0x86, 0x7a, /* 24: Ignore/Replace #1 */
196 0x1e, 0x09, 0x84, 0x81, /* 28: Interrupt #2 */
197 0x20, 0x09, 0x82, 0x7c, /* 2c: Ignore/Replace #2 */
198 0x22, 0x09, 0x0a, 0x0a /* 30: Rx FIFO Enable */
199};
200
201static CONTROLLER_T sController[CTL_SIZE] = {
202 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
203 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
204 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
205 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
206 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
207 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
208 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
209 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}
210};
211
212static Byte_t sBitMapClrTbl[8] = {
213 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f
214};
215
216static Byte_t sBitMapSetTbl[8] = {
217 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
218};
219
220static int sClockPrescale = 0x14;
221
164/* 222/*
165 * Line number is the ttySIx number (x), the Minor number. We 223 * Line number is the ttySIx number (x), the Minor number. We
166 * assign them sequentially, starting at zero. The following 224 * assign them sequentially, starting at zero. The following
@@ -177,6 +235,26 @@ static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model);
177static unsigned char GetLineNumber(int ctrl, int aiop, int ch); 235static unsigned char GetLineNumber(int ctrl, int aiop, int ch);
178static unsigned char SetLineNumber(int ctrl, int aiop, int ch); 236static unsigned char SetLineNumber(int ctrl, int aiop, int ch);
179static void rp_start(struct tty_struct *tty); 237static void rp_start(struct tty_struct *tty);
238static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum,
239 int ChanNum);
240static void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode);
241static void sFlushRxFIFO(CHANNEL_T * ChP);
242static void sFlushTxFIFO(CHANNEL_T * ChP);
243static void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags);
244static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags);
245static void sModemReset(CONTROLLER_T * CtlP, int chan, int on);
246static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on);
247static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data);
248static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
249 ByteIO_t * AiopIOList, int AiopIOListSize,
250 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
251 int PeriodicOnly, int altChanRingIndicator,
252 int UPCIRingInd);
253static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO,
254 ByteIO_t * AiopIOList, int AiopIOListSize,
255 int IRQNum, Byte_t Frequency, int PeriodicOnly);
256static int sReadAiopID(ByteIO_t io);
257static int sReadAiopNumChan(WordIO_t io);
180 258
181#ifdef MODULE 259#ifdef MODULE
182MODULE_AUTHOR("Theodore Ts'o"); 260MODULE_AUTHOR("Theodore Ts'o");
@@ -1798,7 +1876,7 @@ static void rp_flush_buffer(struct tty_struct *tty)
1798 * init's aiopic and serial port hardware. 1876 * init's aiopic and serial port hardware.
1799 * Inputs: i is the board number (0-n) 1877 * Inputs: i is the board number (0-n)
1800 */ 1878 */
1801__init int register_PCI(int i, struct pci_dev *dev) 1879static __init int register_PCI(int i, struct pci_dev *dev)
1802{ 1880{
1803 int num_aiops, aiop, max_num_aiops, num_chan, chan; 1881 int num_aiops, aiop, max_num_aiops, num_chan, chan;
1804 unsigned int aiopio[MAX_AIOPS_PER_BOARD]; 1882 unsigned int aiopio[MAX_AIOPS_PER_BOARD];
@@ -2453,72 +2531,6 @@ static void rp_cleanup_module(void)
2453} 2531}
2454#endif 2532#endif
2455 2533
2456#ifndef TRUE
2457#define TRUE 1
2458#endif
2459
2460#ifndef FALSE
2461#define FALSE 0
2462#endif
2463
2464static Byte_t RData[RDATASIZE] = {
2465 0x00, 0x09, 0xf6, 0x82,
2466 0x02, 0x09, 0x86, 0xfb,
2467 0x04, 0x09, 0x00, 0x0a,
2468 0x06, 0x09, 0x01, 0x0a,
2469 0x08, 0x09, 0x8a, 0x13,
2470 0x0a, 0x09, 0xc5, 0x11,
2471 0x0c, 0x09, 0x86, 0x85,
2472 0x0e, 0x09, 0x20, 0x0a,
2473 0x10, 0x09, 0x21, 0x0a,
2474 0x12, 0x09, 0x41, 0xff,
2475 0x14, 0x09, 0x82, 0x00,
2476 0x16, 0x09, 0x82, 0x7b,
2477 0x18, 0x09, 0x8a, 0x7d,
2478 0x1a, 0x09, 0x88, 0x81,
2479 0x1c, 0x09, 0x86, 0x7a,
2480 0x1e, 0x09, 0x84, 0x81,
2481 0x20, 0x09, 0x82, 0x7c,
2482 0x22, 0x09, 0x0a, 0x0a
2483};
2484
2485static Byte_t RRegData[RREGDATASIZE] = {
2486 0x00, 0x09, 0xf6, 0x82, /* 00: Stop Rx processor */
2487 0x08, 0x09, 0x8a, 0x13, /* 04: Tx software flow control */
2488 0x0a, 0x09, 0xc5, 0x11, /* 08: XON char */
2489 0x0c, 0x09, 0x86, 0x85, /* 0c: XANY */
2490 0x12, 0x09, 0x41, 0xff, /* 10: Rx mask char */
2491 0x14, 0x09, 0x82, 0x00, /* 14: Compare/Ignore #0 */
2492 0x16, 0x09, 0x82, 0x7b, /* 18: Compare #1 */
2493 0x18, 0x09, 0x8a, 0x7d, /* 1c: Compare #2 */
2494 0x1a, 0x09, 0x88, 0x81, /* 20: Interrupt #1 */
2495 0x1c, 0x09, 0x86, 0x7a, /* 24: Ignore/Replace #1 */
2496 0x1e, 0x09, 0x84, 0x81, /* 28: Interrupt #2 */
2497 0x20, 0x09, 0x82, 0x7c, /* 2c: Ignore/Replace #2 */
2498 0x22, 0x09, 0x0a, 0x0a /* 30: Rx FIFO Enable */
2499};
2500
2501CONTROLLER_T sController[CTL_SIZE] = {
2502 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
2503 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
2504 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
2505 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
2506 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
2507 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
2508 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
2509 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}
2510};
2511
2512Byte_t sBitMapClrTbl[8] = {
2513 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f
2514};
2515
2516Byte_t sBitMapSetTbl[8] = {
2517 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
2518};
2519
2520int sClockPrescale = 0x14;
2521
2522/*************************************************************************** 2534/***************************************************************************
2523Function: sInitController 2535Function: sInitController
2524Purpose: Initialization of controller global registers and controller 2536Purpose: Initialization of controller global registers and controller
@@ -2554,22 +2566,22 @@ Call: sInitController(CtlP,CtlNum,MudbacIO,AiopIOList,AiopIOListSize,
2554 FREQ_4HZ - 4 Hertz 2566 FREQ_4HZ - 4 Hertz
2555 If IRQNum is set to 0 the Frequency parameter is 2567 If IRQNum is set to 0 the Frequency parameter is
2556 overidden, it is forced to a value of FREQ_DIS. 2568 overidden, it is forced to a value of FREQ_DIS.
2557 int PeriodicOnly: TRUE if all interrupts except the periodic 2569 int PeriodicOnly: 1 if all interrupts except the periodic
2558 interrupt are to be blocked. 2570 interrupt are to be blocked.
2559 FALSE is both the periodic interrupt and 2571 0 is both the periodic interrupt and
2560 other channel interrupts are allowed. 2572 other channel interrupts are allowed.
2561 If IRQNum is set to 0 the PeriodicOnly parameter is 2573 If IRQNum is set to 0 the PeriodicOnly parameter is
2562 overidden, it is forced to a value of FALSE. 2574 overidden, it is forced to a value of 0.
2563Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller 2575Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller
2564 initialization failed. 2576 initialization failed.
2565 2577
2566Comments: 2578Comments:
2567 If periodic interrupts are to be disabled but AIOP interrupts 2579 If periodic interrupts are to be disabled but AIOP interrupts
2568 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to FALSE. 2580 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0.
2569 2581
2570 If interrupts are to be completely disabled set IRQNum to 0. 2582 If interrupts are to be completely disabled set IRQNum to 0.
2571 2583
2572 Setting Frequency to FREQ_DIS and PeriodicOnly to TRUE is an 2584 Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an
2573 invalid combination. 2585 invalid combination.
2574 2586
2575 This function performs initialization of global interrupt modes, 2587 This function performs initialization of global interrupt modes,
@@ -2589,9 +2601,9 @@ Warnings: No range checking on any of the parameters is done.
2589 After this function all AIOPs on the controller are disabled, 2601 After this function all AIOPs on the controller are disabled,
2590 they can be enabled with sEnAiop(). 2602 they can be enabled with sEnAiop().
2591*/ 2603*/
2592int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, 2604static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO,
2593 ByteIO_t * AiopIOList, int AiopIOListSize, int IRQNum, 2605 ByteIO_t * AiopIOList, int AiopIOListSize,
2594 Byte_t Frequency, int PeriodicOnly) 2606 int IRQNum, Byte_t Frequency, int PeriodicOnly)
2595{ 2607{
2596 int i; 2608 int i;
2597 ByteIO_t io; 2609 ByteIO_t io;
@@ -2687,22 +2699,22 @@ Call: sPCIInitController(CtlP,CtlNum,AiopIOList,AiopIOListSize,
2687 FREQ_4HZ - 4 Hertz 2699 FREQ_4HZ - 4 Hertz
2688 If IRQNum is set to 0 the Frequency parameter is 2700 If IRQNum is set to 0 the Frequency parameter is
2689 overidden, it is forced to a value of FREQ_DIS. 2701 overidden, it is forced to a value of FREQ_DIS.
2690 int PeriodicOnly: TRUE if all interrupts except the periodic 2702 int PeriodicOnly: 1 if all interrupts except the periodic
2691 interrupt are to be blocked. 2703 interrupt are to be blocked.
2692 FALSE is both the periodic interrupt and 2704 0 is both the periodic interrupt and
2693 other channel interrupts are allowed. 2705 other channel interrupts are allowed.
2694 If IRQNum is set to 0 the PeriodicOnly parameter is 2706 If IRQNum is set to 0 the PeriodicOnly parameter is
2695 overidden, it is forced to a value of FALSE. 2707 overidden, it is forced to a value of 0.
2696Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller 2708Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller
2697 initialization failed. 2709 initialization failed.
2698 2710
2699Comments: 2711Comments:
2700 If periodic interrupts are to be disabled but AIOP interrupts 2712 If periodic interrupts are to be disabled but AIOP interrupts
2701 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to FALSE. 2713 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0.
2702 2714
2703 If interrupts are to be completely disabled set IRQNum to 0. 2715 If interrupts are to be completely disabled set IRQNum to 0.
2704 2716
2705 Setting Frequency to FREQ_DIS and PeriodicOnly to TRUE is an 2717 Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an
2706 invalid combination. 2718 invalid combination.
2707 2719
2708 This function performs initialization of global interrupt modes, 2720 This function performs initialization of global interrupt modes,
@@ -2722,11 +2734,11 @@ Warnings: No range checking on any of the parameters is done.
2722 After this function all AIOPs on the controller are disabled, 2734 After this function all AIOPs on the controller are disabled,
2723 they can be enabled with sEnAiop(). 2735 they can be enabled with sEnAiop().
2724*/ 2736*/
2725int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum, 2737static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
2726 ByteIO_t * AiopIOList, int AiopIOListSize, 2738 ByteIO_t * AiopIOList, int AiopIOListSize,
2727 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency, 2739 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
2728 int PeriodicOnly, int altChanRingIndicator, 2740 int PeriodicOnly, int altChanRingIndicator,
2729 int UPCIRingInd) 2741 int UPCIRingInd)
2730{ 2742{
2731 int i; 2743 int i;
2732 ByteIO_t io; 2744 ByteIO_t io;
@@ -2784,7 +2796,7 @@ Return: int: Flag AIOPID_XXXX if a valid AIOP is found, where X
2784Warnings: No context switches are allowed while executing this function. 2796Warnings: No context switches are allowed while executing this function.
2785 2797
2786*/ 2798*/
2787int sReadAiopID(ByteIO_t io) 2799static int sReadAiopID(ByteIO_t io)
2788{ 2800{
2789 Byte_t AiopID; /* ID byte from AIOP */ 2801 Byte_t AiopID; /* ID byte from AIOP */
2790 2802
@@ -2810,7 +2822,7 @@ Comments: The number of channels is determined by write/reads from identical
2810 AIOP, otherwise it is an 8 channel. 2822 AIOP, otherwise it is an 8 channel.
2811Warnings: No context switches are allowed while executing this function. 2823Warnings: No context switches are allowed while executing this function.
2812*/ 2824*/
2813int sReadAiopNumChan(WordIO_t io) 2825static int sReadAiopNumChan(WordIO_t io)
2814{ 2826{
2815 Word_t x; 2827 Word_t x;
2816 static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 }; 2828 static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 };
@@ -2834,15 +2846,15 @@ Call: sInitChan(CtlP,ChP,AiopNum,ChanNum)
2834 CHANNEL_T *ChP; Ptr to channel structure 2846 CHANNEL_T *ChP; Ptr to channel structure
2835 int AiopNum; AIOP number within controller 2847 int AiopNum; AIOP number within controller
2836 int ChanNum; Channel number within AIOP 2848 int ChanNum; Channel number within AIOP
2837Return: int: TRUE if initialization succeeded, FALSE if it fails because channel 2849Return: int: 1 if initialization succeeded, 0 if it fails because channel
2838 number exceeds number of channels available in AIOP. 2850 number exceeds number of channels available in AIOP.
2839Comments: This function must be called before a channel can be used. 2851Comments: This function must be called before a channel can be used.
2840Warnings: No range checking on any of the parameters is done. 2852Warnings: No range checking on any of the parameters is done.
2841 2853
2842 No context switches are allowed while executing this function. 2854 No context switches are allowed while executing this function.
2843*/ 2855*/
2844int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, 2856static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum,
2845 int ChanNum) 2857 int ChanNum)
2846{ 2858{
2847 int i; 2859 int i;
2848 WordIO_t AiopIO; 2860 WordIO_t AiopIO;
@@ -2853,7 +2865,7 @@ int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum,
2853 int brd9600; 2865 int brd9600;
2854 2866
2855 if (ChanNum >= CtlP->AiopNumChan[AiopNum]) 2867 if (ChanNum >= CtlP->AiopNumChan[AiopNum])
2856 return (FALSE); /* exceeds num chans in AIOP */ 2868 return 0; /* exceeds num chans in AIOP */
2857 2869
2858 /* Channel, AIOP, and controller identifiers */ 2870 /* Channel, AIOP, and controller identifiers */
2859 ChP->CtlP = CtlP; 2871 ChP->CtlP = CtlP;
@@ -2968,7 +2980,7 @@ int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum,
2968 ChP->TxPrioBuf = ChOff + _TXP_BUF; 2980 ChP->TxPrioBuf = ChOff + _TXP_BUF;
2969 sEnRxProcessor(ChP); /* start the Rx processor */ 2981 sEnRxProcessor(ChP); /* start the Rx processor */
2970 2982
2971 return (TRUE); 2983 return 1;
2972} 2984}
2973 2985
2974/*************************************************************************** 2986/***************************************************************************
@@ -2989,7 +3001,7 @@ Warnings: No context switches are allowed while executing this function.
2989 After calling this function a delay of 4 uS is required to ensure 3001 After calling this function a delay of 4 uS is required to ensure
2990 that the receive processor is no longer processing this channel. 3002 that the receive processor is no longer processing this channel.
2991*/ 3003*/
2992void sStopRxProcessor(CHANNEL_T * ChP) 3004static void sStopRxProcessor(CHANNEL_T * ChP)
2993{ 3005{
2994 Byte_t R[4]; 3006 Byte_t R[4];
2995 3007
@@ -3014,18 +3026,18 @@ Comments: To prevent data from being enqueued or dequeued in the Tx FIFO
3014 this function. 3026 this function.
3015Warnings: No context switches are allowed while executing this function. 3027Warnings: No context switches are allowed while executing this function.
3016*/ 3028*/
3017void sFlushRxFIFO(CHANNEL_T * ChP) 3029static void sFlushRxFIFO(CHANNEL_T * ChP)
3018{ 3030{
3019 int i; 3031 int i;
3020 Byte_t Ch; /* channel number within AIOP */ 3032 Byte_t Ch; /* channel number within AIOP */
3021 int RxFIFOEnabled; /* TRUE if Rx FIFO enabled */ 3033 int RxFIFOEnabled; /* 1 if Rx FIFO enabled */
3022 3034
3023 if (sGetRxCnt(ChP) == 0) /* Rx FIFO empty */ 3035 if (sGetRxCnt(ChP) == 0) /* Rx FIFO empty */
3024 return; /* don't need to flush */ 3036 return; /* don't need to flush */
3025 3037
3026 RxFIFOEnabled = FALSE; 3038 RxFIFOEnabled = 0;
3027 if (ChP->R[0x32] == 0x08) { /* Rx FIFO is enabled */ 3039 if (ChP->R[0x32] == 0x08) { /* Rx FIFO is enabled */
3028 RxFIFOEnabled = TRUE; 3040 RxFIFOEnabled = 1;
3029 sDisRxFIFO(ChP); /* disable it */ 3041 sDisRxFIFO(ChP); /* disable it */
3030 for (i = 0; i < 2000 / 200; i++) /* delay 2 uS to allow proc to disable FIFO */ 3042 for (i = 0; i < 2000 / 200; i++) /* delay 2 uS to allow proc to disable FIFO */
3031 sInB(ChP->IntChan); /* depends on bus i/o timing */ 3043 sInB(ChP->IntChan); /* depends on bus i/o timing */
@@ -3056,18 +3068,18 @@ Comments: To prevent data from being enqueued or dequeued in the Tx FIFO
3056 this function. 3068 this function.
3057Warnings: No context switches are allowed while executing this function. 3069Warnings: No context switches are allowed while executing this function.
3058*/ 3070*/
3059void sFlushTxFIFO(CHANNEL_T * ChP) 3071static void sFlushTxFIFO(CHANNEL_T * ChP)
3060{ 3072{
3061 int i; 3073 int i;
3062 Byte_t Ch; /* channel number within AIOP */ 3074 Byte_t Ch; /* channel number within AIOP */
3063 int TxEnabled; /* TRUE if transmitter enabled */ 3075 int TxEnabled; /* 1 if transmitter enabled */
3064 3076
3065 if (sGetTxCnt(ChP) == 0) /* Tx FIFO empty */ 3077 if (sGetTxCnt(ChP) == 0) /* Tx FIFO empty */
3066 return; /* don't need to flush */ 3078 return; /* don't need to flush */
3067 3079
3068 TxEnabled = FALSE; 3080 TxEnabled = 0;
3069 if (ChP->TxControl[3] & TX_ENABLE) { 3081 if (ChP->TxControl[3] & TX_ENABLE) {
3070 TxEnabled = TRUE; 3082 TxEnabled = 1;
3071 sDisTransmit(ChP); /* disable transmitter */ 3083 sDisTransmit(ChP); /* disable transmitter */
3072 } 3084 }
3073 sStopRxProcessor(ChP); /* stop Rx processor */ 3085 sStopRxProcessor(ChP); /* stop Rx processor */
@@ -3096,7 +3108,7 @@ Comments: The priority byte is transmitted before any data in the Tx FIFO.
3096 3108
3097Warnings: No context switches are allowed while executing this function. 3109Warnings: No context switches are allowed while executing this function.
3098*/ 3110*/
3099int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data) 3111static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data)
3100{ 3112{
3101 Byte_t DWBuf[4]; /* buffer for double word writes */ 3113 Byte_t DWBuf[4]; /* buffer for double word writes */
3102 Word_t *WordPtr; /* must be far because Win SS != DS */ 3114 Word_t *WordPtr; /* must be far because Win SS != DS */
@@ -3158,7 +3170,7 @@ Comments: If an interrupt enable flag is set in Flags, that interrupt will be
3158 enable channel interrupts. This would allow the global interrupt 3170 enable channel interrupts. This would allow the global interrupt
3159 status register to be used to determine which AIOPs need service. 3171 status register to be used to determine which AIOPs need service.
3160*/ 3172*/
3161void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags) 3173static void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags)
3162{ 3174{
3163 Byte_t Mask; /* Interrupt Mask Register */ 3175 Byte_t Mask; /* Interrupt Mask Register */
3164 3176
@@ -3202,7 +3214,7 @@ Comments: If an interrupt flag is set in Flags, that interrupt will be
3202 this channel's bit from being set in the AIOP's Interrupt Channel 3214 this channel's bit from being set in the AIOP's Interrupt Channel
3203 Register. 3215 Register.
3204*/ 3216*/
3205void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags) 3217static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags)
3206{ 3218{
3207 Byte_t Mask; /* Interrupt Mask Register */ 3219 Byte_t Mask; /* Interrupt Mask Register */
3208 3220
@@ -3218,7 +3230,7 @@ void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags)
3218 } 3230 }
3219} 3231}
3220 3232
3221void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode) 3233static void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode)
3222{ 3234{
3223 sOutB(ChP->CtlP->AiopIO[2], (mode & 0x18) | ChP->ChanNum); 3235 sOutB(ChP->CtlP->AiopIO[2], (mode & 0x18) | ChP->ChanNum);
3224} 3236}
@@ -3227,7 +3239,7 @@ void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode)
3227 * Not an official SSCI function, but how to reset RocketModems. 3239 * Not an official SSCI function, but how to reset RocketModems.
3228 * ISA bus version 3240 * ISA bus version
3229 */ 3241 */
3230void sModemReset(CONTROLLER_T * CtlP, int chan, int on) 3242static void sModemReset(CONTROLLER_T * CtlP, int chan, int on)
3231{ 3243{
3232 ByteIO_t addr; 3244 ByteIO_t addr;
3233 Byte_t val; 3245 Byte_t val;
@@ -3252,7 +3264,7 @@ void sModemReset(CONTROLLER_T * CtlP, int chan, int on)
3252 * Not an official SSCI function, but how to reset RocketModems. 3264 * Not an official SSCI function, but how to reset RocketModems.
3253 * PCI bus version 3265 * PCI bus version
3254 */ 3266 */
3255void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on) 3267static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on)
3256{ 3268{
3257 ByteIO_t addr; 3269 ByteIO_t addr;
3258 3270
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index 802687290ee1..3a8bcc85bc14 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1130,46 +1130,6 @@ Warnings: This function writes the data byte without checking to see if
1130*/ 1130*/
1131#define sWriteTxByte(IO,DATA) sOutB(IO,DATA) 1131#define sWriteTxByte(IO,DATA) sOutB(IO,DATA)
1132 1132
1133int sInitController(CONTROLLER_T * CtlP,
1134 int CtlNum,
1135 ByteIO_t MudbacIO,
1136 ByteIO_t * AiopIOList,
1137 int AiopIOListSize,
1138 int IRQNum, Byte_t Frequency, int PeriodicOnly);
1139
1140int sPCIInitController(CONTROLLER_T * CtlP,
1141 int CtlNum,
1142 ByteIO_t * AiopIOList,
1143 int AiopIOListSize,
1144 WordIO_t ConfigIO,
1145 int IRQNum,
1146 Byte_t Frequency,
1147 int PeriodicOnly,
1148 int altChanRingIndicator, int UPCIRingInd);
1149
1150int sReadAiopID(ByteIO_t io);
1151int sReadAiopNumChan(WordIO_t io);
1152int sInitChan(CONTROLLER_T * CtlP,
1153 CHANNEL_T * ChP, int AiopNum, int ChanNum);
1154Byte_t sGetRxErrStatus(CHANNEL_T * ChP);
1155void sStopRxProcessor(CHANNEL_T * ChP);
1156void sStopSWInFlowCtl(CHANNEL_T * ChP);
1157void sFlushRxFIFO(CHANNEL_T * ChP);
1158void sFlushTxFIFO(CHANNEL_T * ChP);
1159int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data);
1160void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags);
1161void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags);
1162void sModemReset(CONTROLLER_T * CtlP, int chan, int on);
1163void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on);
1164void sSetInterfaceMode(CHANNEL_T * ChP, Byte_t mode);
1165
1166extern Byte_t R[RDATASIZE];
1167extern CONTROLLER_T sController[CTL_SIZE];
1168extern Byte_t sIRQMap[16];
1169extern Byte_t sBitMapClrTbl[8];
1170extern Byte_t sBitMapSetTbl[8];
1171extern int sClockPrescale;
1172
1173/* 1133/*
1174 * Begin Linux specific definitions for the Rocketport driver 1134 * Begin Linux specific definitions for the Rocketport driver
1175 * 1135 *
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index f59f7cbd525b..af79805b5576 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -35,6 +35,7 @@
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <linux/vt_kern.h> 36#include <linux/vt_kern.h>
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38#include <linux/kexec.h>
38 39
39#include <asm/ptrace.h> 40#include <asm/ptrace.h>
40 41
@@ -94,6 +95,21 @@ static struct sysrq_key_op sysrq_unraw_op = {
94}; 95};
95#endif /* CONFIG_VT */ 96#endif /* CONFIG_VT */
96 97
98#ifdef CONFIG_KEXEC
99/* crashdump sysrq handler */
100static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs,
101 struct tty_struct *tty)
102{
103 crash_kexec(pt_regs);
104}
105static struct sysrq_key_op sysrq_crashdump_op = {
106 .handler = sysrq_handle_crashdump,
107 .help_msg = "Crashdump",
108 .action_msg = "Trigger a crashdump",
109 .enable_mask = SYSRQ_ENABLE_DUMP,
110};
111#endif
112
97/* reboot sysrq handler */ 113/* reboot sysrq handler */
98static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, 114static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs,
99 struct tty_struct *tty) 115 struct tty_struct *tty)
@@ -273,8 +289,12 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
273 it is handled specially on the sparc 289 it is handled specially on the sparc
274 and will never arrive */ 290 and will never arrive */
275/* b */ &sysrq_reboot_op, 291/* b */ &sysrq_reboot_op,
276/* c */ NULL, 292#ifdef CONFIG_KEXEC
277/* d */ NULL, 293/* c */ &sysrq_crashdump_op,
294#else
295/* c */ NULL,
296#endif
297/* d */ NULL,
278/* e */ &sysrq_term_op, 298/* e */ &sysrq_term_op,
279/* f */ &sysrq_moom_op, 299/* f */ &sysrq_moom_op,
280/* g */ NULL, 300/* g */ NULL,
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 58e21fe44262..0c6f521abd0e 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -73,16 +73,20 @@
73 73
74#define TOSH_MINOR_DEV 181 74#define TOSH_MINOR_DEV 181
75 75
76static int tosh_id = 0x0000; 76MODULE_LICENSE("GPL");
77static int tosh_bios = 0x0000; 77MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
78static int tosh_date = 0x0000; 78MODULE_DESCRIPTION("Toshiba laptop SMM driver");
79static int tosh_sci = 0x0000; 79MODULE_SUPPORTED_DEVICE("toshiba");
80static int tosh_fan = 0;
81
82static int tosh_fn = 0;
83 80
84module_param(tosh_fn, int, 0); 81static int tosh_fn;
82module_param_named(fn, tosh_fn, int, 0);
83MODULE_PARM_DESC(fn, "User specified Fn key detection port");
85 84
85static int tosh_id;
86static int tosh_bios;
87static int tosh_date;
88static int tosh_sci;
89static int tosh_fan;
86 90
87static int tosh_ioctl(struct inode *, struct file *, unsigned int, 91static int tosh_ioctl(struct inode *, struct file *, unsigned int,
88 unsigned long); 92 unsigned long);
@@ -359,7 +363,7 @@ static int tosh_get_machine_id(void)
359 unsigned long address; 363 unsigned long address;
360 364
361 id = (0x100*(int) isa_readb(0xffffe))+((int) isa_readb(0xffffa)); 365 id = (0x100*(int) isa_readb(0xffffe))+((int) isa_readb(0xffffa));
362 366
363 /* do we have a SCTTable machine identication number on our hands */ 367 /* do we have a SCTTable machine identication number on our hands */
364 368
365 if (id==0xfc2f) { 369 if (id==0xfc2f) {
@@ -424,7 +428,7 @@ static int tosh_probe(void)
424 } 428 }
425 429
426 /* call the Toshiba SCI support check routine */ 430 /* call the Toshiba SCI support check routine */
427 431
428 regs.eax = 0xf0f0; 432 regs.eax = 0xf0f0;
429 regs.ebx = 0x0000; 433 regs.ebx = 0x0000;
430 regs.ecx = 0x0000; 434 regs.ecx = 0x0000;
@@ -440,7 +444,7 @@ static int tosh_probe(void)
440 /* if we get this far then we are running on a Toshiba (probably)! */ 444 /* if we get this far then we are running on a Toshiba (probably)! */
441 445
442 tosh_sci = regs.edx & 0xffff; 446 tosh_sci = regs.edx & 0xffff;
443 447
444 /* next get the machine ID of the current laptop */ 448 /* next get the machine ID of the current laptop */
445 449
446 tosh_id = tosh_get_machine_id(); 450 tosh_id = tosh_get_machine_id();
@@ -475,16 +479,15 @@ static int tosh_probe(void)
475 return 0; 479 return 0;
476} 480}
477 481
478int __init tosh_init(void) 482static int __init toshiba_init(void)
479{ 483{
480 int retval; 484 int retval;
481 /* are we running on a Toshiba laptop */ 485 /* are we running on a Toshiba laptop */
482 486
483 if (tosh_probe()!=0) 487 if (tosh_probe())
484 return -EIO; 488 return -ENODEV;
485 489
486 printk(KERN_INFO "Toshiba System Managment Mode driver v" 490 printk(KERN_INFO "Toshiba System Managment Mode driver v" TOSH_VERSION "\n");
487 TOSH_VERSION"\n");
488 491
489 /* set the port to use for Fn status if not specified as a parameter */ 492 /* set the port to use for Fn status if not specified as a parameter */
490 if (tosh_fn==0x00) 493 if (tosh_fn==0x00)
@@ -492,12 +495,12 @@ int __init tosh_init(void)
492 495
493 /* register the device file */ 496 /* register the device file */
494 retval = misc_register(&tosh_device); 497 retval = misc_register(&tosh_device);
495 if(retval < 0) 498 if (retval < 0)
496 return retval; 499 return retval;
497 500
498#ifdef CONFIG_PROC_FS 501#ifdef CONFIG_PROC_FS
499 /* register the proc entry */ 502 /* register the proc entry */
500 if(create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL){ 503 if (create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL) {
501 misc_deregister(&tosh_device); 504 misc_deregister(&tosh_device);
502 return -ENOMEM; 505 return -ENOMEM;
503 } 506 }
@@ -506,27 +509,12 @@ int __init tosh_init(void)
506 return 0; 509 return 0;
507} 510}
508 511
509#ifdef MODULE 512static void __exit toshiba_exit(void)
510int init_module(void)
511{
512 return tosh_init();
513}
514
515void cleanup_module(void)
516{ 513{
517 /* remove the proc entry */
518
519 remove_proc_entry("toshiba", NULL); 514 remove_proc_entry("toshiba", NULL);
520
521 /* unregister the device file */
522
523 misc_deregister(&tosh_device); 515 misc_deregister(&tosh_device);
524} 516}
525#endif
526 517
527MODULE_LICENSE("GPL"); 518module_init(toshiba_init);
528MODULE_PARM_DESC(tosh_fn, "User specified Fn key detection port"); 519module_exit(toshiba_exit);
529MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
530MODULE_DESCRIPTION("Toshiba laptop SMM driver");
531MODULE_SUPPORTED_DEVICE("toshiba");
532 520
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 5c843c9bf819..854475c54f0e 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -233,10 +233,10 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
233 data[15], data[16], data[17], data[22], data[23], 233 data[15], data[16], data[17], data[22], data[23],
234 data[24], data[25], data[26], data[27], data[28], 234 data[24], data[25], data[26], data[27], data[28],
235 data[29], data[30], data[31], data[32], data[33], 235 data[29], data[30], data[31], data[32], data[33],
236 be32_to_cpu(*((__be32 *) (data + 32)))); 236 be32_to_cpu(*((__be32 *) (data + 34))));
237 237
238 for (i = 0; i < 256; i++) { 238 for (i = 0; i < 256; i++) {
239 str += sprintf(str, "%02X ", data[i + 39]); 239 str += sprintf(str, "%02X ", data[i + 38]);
240 if ((i + 1) % 16 == 0) 240 if ((i + 1) % 16 == 0)
241 str += sprintf(str, "\n"); 241 str += sprintf(str, "\n");
242 } 242 }
@@ -464,6 +464,7 @@ void __devexit tpm_remove(struct pci_dev *pci_dev)
464 464
465 pci_set_drvdata(pci_dev, NULL); 465 pci_set_drvdata(pci_dev, NULL);
466 misc_deregister(&chip->vendor->miscdev); 466 misc_deregister(&chip->vendor->miscdev);
467 kfree(&chip->vendor->miscdev.name);
467 468
468 sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); 469 sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group);
469 470
@@ -526,7 +527,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume);
526int tpm_register_hardware(struct pci_dev *pci_dev, 527int tpm_register_hardware(struct pci_dev *pci_dev,
527 struct tpm_vendor_specific *entry) 528 struct tpm_vendor_specific *entry)
528{ 529{
529 char devname[7]; 530#define DEVNAME_SIZE 7
531
532 char *devname;
530 struct tpm_chip *chip; 533 struct tpm_chip *chip;
531 int i, j; 534 int i, j;
532 535
@@ -569,7 +572,8 @@ dev_num_search_complete:
569 else 572 else
570 chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; 573 chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR;
571 574
572 snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num); 575 devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL);
576 scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num);
573 chip->vendor->miscdev.name = devname; 577 chip->vendor->miscdev.name = devname;
574 578
575 chip->vendor->miscdev.dev = &(pci_dev->dev); 579 chip->vendor->miscdev.dev = &(pci_dev->dev);
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 10cb450191a6..373b41f6b460 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -31,8 +31,8 @@ enum tpm_timeout {
31 31
32/* TPM addresses */ 32/* TPM addresses */
33enum tpm_addr { 33enum tpm_addr {
34 TPM_SUPERIO_ADDR = 0x2E,
34 TPM_ADDR = 0x4E, 35 TPM_ADDR = 0x4E,
35 TPM_DATA = 0x4F
36}; 36};
37 37
38extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr, 38extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr,
@@ -79,16 +79,16 @@ struct tpm_chip {
79 struct list_head list; 79 struct list_head list;
80}; 80};
81 81
82static inline int tpm_read_index(int index) 82static inline int tpm_read_index(int base, int index)
83{ 83{
84 outb(index, TPM_ADDR); 84 outb(index, base);
85 return inb(TPM_DATA) & 0xFF; 85 return inb(base+1) & 0xFF;
86} 86}
87 87
88static inline void tpm_write_index(int index, int value) 88static inline void tpm_write_index(int base, int index, int value)
89{ 89{
90 outb(index, TPM_ADDR); 90 outb(index, base);
91 outb(value & 0xFF, TPM_DATA); 91 outb(value & 0xFF, base+1);
92} 92}
93 93
94extern int tpm_register_hardware(struct pci_dev *, 94extern int tpm_register_hardware(struct pci_dev *,
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index 61fe14a77124..cc2cc77fd174 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -163,24 +163,24 @@ static int __devinit tpm_atml_init(struct pci_dev *pci_dev,
163 if (pci_enable_device(pci_dev)) 163 if (pci_enable_device(pci_dev))
164 return -EIO; 164 return -EIO;
165 165
166 lo = tpm_read_index( TPM_ATMEL_BASE_ADDR_LO ); 166 lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO);
167 hi = tpm_read_index( TPM_ATMEL_BASE_ADDR_HI ); 167 hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI);
168 168
169 tpm_atmel.base = (hi<<8)|lo; 169 tpm_atmel.base = (hi<<8)|lo;
170 dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base); 170 dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base);
171 171
172 /* verify that it is an Atmel part */ 172 /* verify that it is an Atmel part */
173 if (tpm_read_index(4) != 'A' || tpm_read_index(5) != 'T' 173 if (tpm_read_index(TPM_ADDR, 4) != 'A' || tpm_read_index(TPM_ADDR, 5) != 'T'
174 || tpm_read_index(6) != 'M' || tpm_read_index(7) != 'L') { 174 || tpm_read_index(TPM_ADDR, 6) != 'M' || tpm_read_index(TPM_ADDR, 7) != 'L') {
175 rc = -ENODEV; 175 rc = -ENODEV;
176 goto out_err; 176 goto out_err;
177 } 177 }
178 178
179 /* query chip for its version number */ 179 /* query chip for its version number */
180 if ((version[0] = tpm_read_index(0x00)) != 0xFF) { 180 if ((version[0] = tpm_read_index(TPM_ADDR, 0x00)) != 0xFF) {
181 version[1] = tpm_read_index(0x01); 181 version[1] = tpm_read_index(TPM_ADDR, 0x01);
182 version[2] = tpm_read_index(0x02); 182 version[2] = tpm_read_index(TPM_ADDR, 0x02);
183 version[3] = tpm_read_index(0x03); 183 version[3] = tpm_read_index(TPM_ADDR, 0x03);
184 } else { 184 } else {
185 dev_info(&pci_dev->dev, "version query failed\n"); 185 dev_info(&pci_dev->dev, "version query failed\n");
186 rc = -ENODEV; 186 rc = -ENODEV;
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
index 1a45e7dfc13b..b4127348c063 100644
--- a/drivers/char/tpm/tpm_nsc.c
+++ b/drivers/char/tpm/tpm_nsc.c
@@ -23,7 +23,6 @@
23 23
24/* National definitions */ 24/* National definitions */
25enum tpm_nsc_addr{ 25enum tpm_nsc_addr{
26 TPM_NSC_BASE = 0x360,
27 TPM_NSC_IRQ = 0x07, 26 TPM_NSC_IRQ = 0x07,
28 TPM_NSC_BASE0_HI = 0x60, 27 TPM_NSC_BASE0_HI = 0x60,
29 TPM_NSC_BASE0_LO = 0x61, 28 TPM_NSC_BASE0_LO = 0x61,
@@ -56,6 +55,7 @@ enum tpm_nsc_status {
56 NSC_STATUS_RDY = 0x10, /* ready to receive command */ 55 NSC_STATUS_RDY = 0x10, /* ready to receive command */
57 NSC_STATUS_IBR = 0x20 /* ready to receive data */ 56 NSC_STATUS_IBR = 0x20 /* ready to receive data */
58}; 57};
58
59/* command bits */ 59/* command bits */
60enum tpm_nsc_cmd_mode { 60enum tpm_nsc_cmd_mode {
61 NSC_COMMAND_NORMAL = 0x01, /* normal mode */ 61 NSC_COMMAND_NORMAL = 0x01, /* normal mode */
@@ -150,7 +150,8 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
150 *p = inb(chip->vendor->base + NSC_DATA); 150 *p = inb(chip->vendor->base + NSC_DATA);
151 } 151 }
152 152
153 if ((data & NSC_STATUS_F0) == 0) { 153 if ((data & NSC_STATUS_F0) == 0 &&
154 (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) {
154 dev_err(&chip->pci_dev->dev, "F0 not set\n"); 155 dev_err(&chip->pci_dev->dev, "F0 not set\n");
155 return -EIO; 156 return -EIO;
156 } 157 }
@@ -259,85 +260,64 @@ static int __devinit tpm_nsc_init(struct pci_dev *pci_dev,
259{ 260{
260 int rc = 0; 261 int rc = 0;
261 int lo, hi; 262 int lo, hi;
263 int nscAddrBase = TPM_ADDR;
262 264
263 hi = tpm_read_index(TPM_NSC_BASE0_HI);
264 lo = tpm_read_index(TPM_NSC_BASE0_LO);
265
266 tpm_nsc.base = (hi<<8) | lo;
267 265
268 if (pci_enable_device(pci_dev)) 266 if (pci_enable_device(pci_dev))
269 return -EIO; 267 return -EIO;
270 268
269 /* select PM channel 1 */
270 tpm_write_index(nscAddrBase,NSC_LDN_INDEX, 0x12);
271
271 /* verify that it is a National part (SID) */ 272 /* verify that it is a National part (SID) */
272 if (tpm_read_index(NSC_SID_INDEX) != 0xEF) { 273 if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) {
273 rc = -ENODEV; 274 nscAddrBase = (tpm_read_index(TPM_SUPERIO_ADDR, 0x2C)<<8)|
274 goto out_err; 275 (tpm_read_index(TPM_SUPERIO_ADDR, 0x2B)&0xFE);
276 if (tpm_read_index(nscAddrBase, NSC_SID_INDEX) != 0xF6) {
277 rc = -ENODEV;
278 goto out_err;
279 }
275 } 280 }
276 281
282 hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI);
283 lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO);
284 tpm_nsc.base = (hi<<8) | lo;
285
277 dev_dbg(&pci_dev->dev, "NSC TPM detected\n"); 286 dev_dbg(&pci_dev->dev, "NSC TPM detected\n");
278 dev_dbg(&pci_dev->dev, 287 dev_dbg(&pci_dev->dev,
279 "NSC LDN 0x%x, SID 0x%x, SRID 0x%x\n", 288 "NSC LDN 0x%x, SID 0x%x, SRID 0x%x\n",
280 tpm_read_index(0x07), tpm_read_index(0x20), 289 tpm_read_index(nscAddrBase,0x07), tpm_read_index(nscAddrBase,0x20),
281 tpm_read_index(0x27)); 290 tpm_read_index(nscAddrBase,0x27));
282 dev_dbg(&pci_dev->dev, 291 dev_dbg(&pci_dev->dev,
283 "NSC SIOCF1 0x%x SIOCF5 0x%x SIOCF6 0x%x SIOCF8 0x%x\n", 292 "NSC SIOCF1 0x%x SIOCF5 0x%x SIOCF6 0x%x SIOCF8 0x%x\n",
284 tpm_read_index(0x21), tpm_read_index(0x25), 293 tpm_read_index(nscAddrBase,0x21), tpm_read_index(nscAddrBase,0x25),
285 tpm_read_index(0x26), tpm_read_index(0x28)); 294 tpm_read_index(nscAddrBase,0x26), tpm_read_index(nscAddrBase,0x28));
286 dev_dbg(&pci_dev->dev, "NSC IO Base0 0x%x\n", 295 dev_dbg(&pci_dev->dev, "NSC IO Base0 0x%x\n",
287 (tpm_read_index(0x60) << 8) | tpm_read_index(0x61)); 296 (tpm_read_index(nscAddrBase,0x60) << 8) | tpm_read_index(nscAddrBase,0x61));
288 dev_dbg(&pci_dev->dev, "NSC IO Base1 0x%x\n", 297 dev_dbg(&pci_dev->dev, "NSC IO Base1 0x%x\n",
289 (tpm_read_index(0x62) << 8) | tpm_read_index(0x63)); 298 (tpm_read_index(nscAddrBase,0x62) << 8) | tpm_read_index(nscAddrBase,0x63));
290 dev_dbg(&pci_dev->dev, "NSC Interrupt number and wakeup 0x%x\n", 299 dev_dbg(&pci_dev->dev, "NSC Interrupt number and wakeup 0x%x\n",
291 tpm_read_index(0x70)); 300 tpm_read_index(nscAddrBase,0x70));
292 dev_dbg(&pci_dev->dev, "NSC IRQ type select 0x%x\n", 301 dev_dbg(&pci_dev->dev, "NSC IRQ type select 0x%x\n",
293 tpm_read_index(0x71)); 302 tpm_read_index(nscAddrBase,0x71));
294 dev_dbg(&pci_dev->dev, 303 dev_dbg(&pci_dev->dev,
295 "NSC DMA channel select0 0x%x, select1 0x%x\n", 304 "NSC DMA channel select0 0x%x, select1 0x%x\n",
296 tpm_read_index(0x74), tpm_read_index(0x75)); 305 tpm_read_index(nscAddrBase,0x74), tpm_read_index(nscAddrBase,0x75));
297 dev_dbg(&pci_dev->dev, 306 dev_dbg(&pci_dev->dev,
298 "NSC Config " 307 "NSC Config "
299 "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", 308 "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
300 tpm_read_index(0xF0), tpm_read_index(0xF1), 309 tpm_read_index(nscAddrBase,0xF0), tpm_read_index(nscAddrBase,0xF1),
301 tpm_read_index(0xF2), tpm_read_index(0xF3), 310 tpm_read_index(nscAddrBase,0xF2), tpm_read_index(nscAddrBase,0xF3),
302 tpm_read_index(0xF4), tpm_read_index(0xF5), 311 tpm_read_index(nscAddrBase,0xF4), tpm_read_index(nscAddrBase,0xF5),
303 tpm_read_index(0xF6), tpm_read_index(0xF7), 312 tpm_read_index(nscAddrBase,0xF6), tpm_read_index(nscAddrBase,0xF7),
304 tpm_read_index(0xF8), tpm_read_index(0xF9)); 313 tpm_read_index(nscAddrBase,0xF8), tpm_read_index(nscAddrBase,0xF9));
305 314
306 dev_info(&pci_dev->dev, 315 dev_info(&pci_dev->dev,
307 "NSC PC21100 TPM revision %d\n", 316 "NSC TPM revision %d\n",
308 tpm_read_index(0x27) & 0x1F); 317 tpm_read_index(nscAddrBase, 0x27) & 0x1F);
309
310 if (tpm_read_index(NSC_LDC_INDEX) == 0)
311 dev_info(&pci_dev->dev, ": NSC TPM not active\n");
312
313 /* select PM channel 1 */
314 tpm_write_index(NSC_LDN_INDEX, 0x12);
315 tpm_read_index(NSC_LDN_INDEX);
316
317 /* disable the DPM module */
318 tpm_write_index(NSC_LDC_INDEX, 0);
319 tpm_read_index(NSC_LDC_INDEX);
320
321 /* set the data register base addresses */
322 tpm_write_index(NSC_DIO_INDEX, TPM_NSC_BASE >> 8);
323 tpm_write_index(NSC_DIO_INDEX + 1, TPM_NSC_BASE);
324 tpm_read_index(NSC_DIO_INDEX);
325 tpm_read_index(NSC_DIO_INDEX + 1);
326
327 /* set the command register base addresses */
328 tpm_write_index(NSC_CIO_INDEX, (TPM_NSC_BASE + 1) >> 8);
329 tpm_write_index(NSC_CIO_INDEX + 1, (TPM_NSC_BASE + 1));
330 tpm_read_index(NSC_DIO_INDEX);
331 tpm_read_index(NSC_DIO_INDEX + 1);
332
333 /* set the interrupt number to be used for the host interface */
334 tpm_write_index(NSC_IRQ_INDEX, TPM_NSC_IRQ);
335 tpm_write_index(NSC_ITS_INDEX, 0x00);
336 tpm_read_index(NSC_IRQ_INDEX);
337 318
338 /* enable the DPM module */ 319 /* enable the DPM module */
339 tpm_write_index(NSC_LDC_INDEX, 0x01); 320 tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01);
340 tpm_read_index(NSC_LDC_INDEX);
341 321
342 if ((rc = tpm_register_hardware(pci_dev, &tpm_nsc)) < 0) 322 if ((rc = tpm_register_hardware(pci_dev, &tpm_nsc)) < 0)
343 goto out_err; 323 goto out_err;
@@ -355,6 +335,9 @@ static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
355 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)}, 335 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)},
356 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)}, 336 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)},
357 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)}, 337 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)},
338 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0)},
339 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1)},
340 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0)},
358 {PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)}, 341 {PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)},
359 {0,} 342 {0,}
360}; 343};
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index cc4b43bad703..6e4be3bb2d89 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -94,6 +94,7 @@
94#include <linux/idr.h> 94#include <linux/idr.h>
95#include <linux/wait.h> 95#include <linux/wait.h>
96#include <linux/bitops.h> 96#include <linux/bitops.h>
97#include <linux/delay.h>
97 98
98#include <asm/uaccess.h> 99#include <asm/uaccess.h>
99#include <asm/system.h> 100#include <asm/system.h>
@@ -2180,12 +2181,11 @@ static int tiocsetd(struct tty_struct *tty, int __user *p)
2180 return tty_set_ldisc(tty, ldisc); 2181 return tty_set_ldisc(tty, ldisc);
2181} 2182}
2182 2183
2183static int send_break(struct tty_struct *tty, int duration) 2184static int send_break(struct tty_struct *tty, unsigned int duration)
2184{ 2185{
2185 tty->driver->break_ctl(tty, -1); 2186 tty->driver->break_ctl(tty, -1);
2186 if (!signal_pending(current)) { 2187 if (!signal_pending(current)) {
2187 set_current_state(TASK_INTERRUPTIBLE); 2188 msleep_interruptible(duration);
2188 schedule_timeout(duration);
2189 } 2189 }
2190 tty->driver->break_ctl(tty, 0); 2190 tty->driver->break_ctl(tty, 0);
2191 if (signal_pending(current)) 2191 if (signal_pending(current))
@@ -2366,10 +2366,10 @@ int tty_ioctl(struct inode * inode, struct file * file,
2366 * all by anyone? 2366 * all by anyone?
2367 */ 2367 */
2368 if (!arg) 2368 if (!arg)
2369 return send_break(tty, HZ/4); 2369 return send_break(tty, 250);
2370 return 0; 2370 return 0;
2371 case TCSBRKP: /* support for POSIX tcsendbreak() */ 2371 case TCSBRKP: /* support for POSIX tcsendbreak() */
2372 return send_break(tty, arg ? arg*(HZ/10) : HZ/4); 2372 return send_break(tty, arg ? arg*100 : 250);
2373 2373
2374 case TIOCMGET: 2374 case TIOCMGET:
2375 return tty_tiocmget(tty, file, p); 2375 return tty_tiocmget(tty, file, p);
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index a3451cb94004..33b17c6a46fb 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -618,8 +618,8 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,
618 new_efivar = kmalloc(sizeof(struct efivar_entry), GFP_KERNEL); 618 new_efivar = kmalloc(sizeof(struct efivar_entry), GFP_KERNEL);
619 619
620 if (!short_name || !new_efivar) { 620 if (!short_name || !new_efivar) {
621 if (short_name) kfree(short_name); 621 kfree(short_name);
622 if (new_efivar) kfree(new_efivar); 622 kfree(new_efivar);
623 return 1; 623 return 1;
624 } 624 }
625 memset(short_name, 0, short_name_size+1); 625 memset(short_name, 0, short_name_size+1);
@@ -644,7 +644,8 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,
644 kobj_set_kset_s(new_efivar, vars_subsys); 644 kobj_set_kset_s(new_efivar, vars_subsys);
645 kobject_register(&new_efivar->kobj); 645 kobject_register(&new_efivar->kobj);
646 646
647 kfree(short_name); short_name = NULL; 647 kfree(short_name);
648 short_name = NULL;
648 649
649 spin_lock(&efivars_lock); 650 spin_lock(&efivars_lock);
650 list_add(&new_efivar->list, &efivar_list); 651 list_add(&new_efivar->list, &efivar_list);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index d41ca31dbcb2..03c23ce98edb 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -20,13 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#ifdef CONFIG_FSL_OCP
24#include <asm/ocp.h>
25#define FSL_I2C_DEV_SEPARATE_DFSRR FS_I2C_SEPARATE_DFSRR
26#define FSL_I2C_DEV_CLOCK_5200 FS_I2C_CLOCK_5200
27#else
28#include <linux/fsl_devices.h> 23#include <linux/fsl_devices.h>
29#endif
30#include <linux/i2c.h> 24#include <linux/i2c.h>
31#include <linux/interrupt.h> 25#include <linux/interrupt.h>
32#include <linux/delay.h> 26#include <linux/delay.h>
@@ -294,204 +288,6 @@ static struct i2c_adapter mpc_ops = {
294 .retries = 1 288 .retries = 1
295}; 289};
296 290
297#ifdef CONFIG_FSL_OCP
298static int __devinit mpc_i2c_probe(struct ocp_device *ocp)
299{
300 int result = 0;
301 struct mpc_i2c *i2c;
302
303 if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) {
304 return -ENOMEM;
305 }
306 memset(i2c, 0, sizeof(*i2c));
307
308 i2c->irq = ocp->def->irq;
309 i2c->flags = ((struct ocp_fs_i2c_data *)ocp->def->additions)->flags;
310 init_waitqueue_head(&i2c->queue);
311
312 if (!request_mem_region(ocp->def->paddr, MPC_I2C_REGION, "i2c-mpc")) {
313 printk(KERN_ERR "i2c-mpc - resource unavailable\n");
314 return -ENODEV;
315 }
316
317 i2c->base = ioremap(ocp->def->paddr, MPC_I2C_REGION);
318
319 if (!i2c->base) {
320 printk(KERN_ERR "i2c-mpc - failed to map controller\n");
321 result = -ENOMEM;
322 goto fail_map;
323 }
324
325 if (i2c->irq != OCP_IRQ_NA)
326 {
327 if ((result = request_irq(ocp->def->irq, mpc_i2c_isr,
328 SA_SHIRQ, "i2c-mpc", i2c)) < 0) {
329 printk(KERN_ERR
330 "i2c-mpc - failed to attach interrupt\n");
331 goto fail_irq;
332 }
333 } else
334 i2c->irq = 0;
335
336 mpc_i2c_setclock(i2c);
337 ocp_set_drvdata(ocp, i2c);
338
339 i2c->adap = mpc_ops;
340 i2c_set_adapdata(&i2c->adap, i2c);
341
342 if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
343 printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
344 goto fail_add;
345 }
346
347 return result;
348
349 fail_add:
350 if (ocp->def->irq != OCP_IRQ_NA)
351 free_irq(ocp->def->irq, 0);
352 fail_irq:
353 iounmap(i2c->base);
354 fail_map:
355 release_mem_region(ocp->def->paddr, MPC_I2C_REGION);
356 kfree(i2c);
357 return result;
358}
359static void __devexit mpc_i2c_remove(struct ocp_device *ocp)
360{
361 struct mpc_i2c *i2c = ocp_get_drvdata(ocp);
362 i2c_del_adapter(&i2c->adap);
363 ocp_set_drvdata(ocp, NULL);
364
365 if (ocp->def->irq != OCP_IRQ_NA)
366 free_irq(i2c->irq, i2c);
367 iounmap(i2c->base);
368 release_mem_region(ocp->def->paddr, MPC_I2C_REGION);
369 kfree(i2c);
370}
371
372static struct ocp_device_id mpc_iic_ids[] __devinitdata = {
373 {.vendor = OCP_VENDOR_FREESCALE,.function = OCP_FUNC_IIC},
374 {.vendor = OCP_VENDOR_INVALID}
375};
376
377MODULE_DEVICE_TABLE(ocp, mpc_iic_ids);
378
379static struct ocp_driver mpc_iic_driver = {
380 .name = "iic",
381 .id_table = mpc_iic_ids,
382 .probe = mpc_i2c_probe,
383 .remove = __devexit_p(mpc_i2c_remove)
384};
385
386static int __init iic_init(void)
387{
388 return ocp_register_driver(&mpc_iic_driver);
389}
390
391static void __exit iic_exit(void)
392{
393 ocp_unregister_driver(&mpc_iic_driver);
394}
395
396module_init(iic_init);
397module_exit(iic_exit);
398#else
399static int fsl_i2c_probe(struct device *device)
400{
401 int result = 0;
402 struct mpc_i2c *i2c;
403 struct platform_device *pdev = to_platform_device(device);
404 struct fsl_i2c_platform_data *pdata;
405 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
406
407 pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;
408
409 if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) {
410 return -ENOMEM;
411 }
412 memset(i2c, 0, sizeof(*i2c));
413
414 i2c->irq = platform_get_irq(pdev, 0);
415 i2c->flags = pdata->device_flags;
416 init_waitqueue_head(&i2c->queue);
417
418 i2c->base = ioremap((phys_addr_t)r->start, MPC_I2C_REGION);
419
420 if (!i2c->base) {
421 printk(KERN_ERR "i2c-mpc - failed to map controller\n");
422 result = -ENOMEM;
423 goto fail_map;
424 }
425
426 if (i2c->irq != 0)
427 if ((result = request_irq(i2c->irq, mpc_i2c_isr,
428 SA_SHIRQ, "i2c-mpc", i2c)) < 0) {
429 printk(KERN_ERR
430 "i2c-mpc - failed to attach interrupt\n");
431 goto fail_irq;
432 }
433
434 mpc_i2c_setclock(i2c);
435 dev_set_drvdata(device, i2c);
436
437 i2c->adap = mpc_ops;
438 i2c_set_adapdata(&i2c->adap, i2c);
439 i2c->adap.dev.parent = &pdev->dev;
440 if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
441 printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
442 goto fail_add;
443 }
444
445 return result;
446
447 fail_add:
448 if (i2c->irq != 0)
449 free_irq(i2c->irq, NULL);
450 fail_irq:
451 iounmap(i2c->base);
452 fail_map:
453 kfree(i2c);
454 return result;
455};
456
457static int fsl_i2c_remove(struct device *device)
458{
459 struct mpc_i2c *i2c = dev_get_drvdata(device);
460
461 i2c_del_adapter(&i2c->adap);
462 dev_set_drvdata(device, NULL);
463
464 if (i2c->irq != 0)
465 free_irq(i2c->irq, i2c);
466
467 iounmap(i2c->base);
468 kfree(i2c);
469 return 0;
470};
471
472/* Structure for a device driver */
473static struct device_driver fsl_i2c_driver = {
474 .name = "fsl-i2c",
475 .bus = &platform_bus_type,
476 .probe = fsl_i2c_probe,
477 .remove = fsl_i2c_remove,
478};
479
480static int __init fsl_i2c_init(void)
481{
482 return driver_register(&fsl_i2c_driver);
483}
484
485static void __exit fsl_i2c_exit(void)
486{
487 driver_unregister(&fsl_i2c_driver);
488}
489
490module_init(fsl_i2c_init);
491module_exit(fsl_i2c_exit);
492
493#endif /* CONFIG_FSL_OCP */
494
495MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>"); 291MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>");
496MODULE_DESCRIPTION 292MODULE_DESCRIPTION
497 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors"); 293 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors");
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index 2d9a9b74e687..629070b83a33 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -1041,10 +1041,8 @@ static int hpsbpkt_thread(void *__hi)
1041 1041
1042 while (1) { 1042 while (1) {
1043 if (down_interruptible(&khpsbpkt_sig)) { 1043 if (down_interruptible(&khpsbpkt_sig)) {
1044 if (current->flags & PF_FREEZE) { 1044 if (try_to_freeze())
1045 refrigerator(0);
1046 continue; 1045 continue;
1047 }
1048 printk("khpsbpkt: received unexpected signal?!\n" ); 1046 printk("khpsbpkt: received unexpected signal?!\n" );
1049 break; 1047 break;
1050 } 1048 }
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 32abb6dda888..9a46c3b44bf8 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -1510,7 +1510,7 @@ static int nodemgr_host_thread(void *__hi)
1510 1510
1511 if (down_interruptible(&hi->reset_sem) || 1511 if (down_interruptible(&hi->reset_sem) ||
1512 down_interruptible(&nodemgr_serialize)) { 1512 down_interruptible(&nodemgr_serialize)) {
1513 if (try_to_freeze(PF_FREEZE)) 1513 if (try_to_freeze())
1514 continue; 1514 continue;
1515 printk("NodeMgr: received unexpected signal?!\n" ); 1515 printk("NodeMgr: received unexpected signal?!\n" );
1516 break; 1516 break;
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index e152d0fa0cdd..c77a82e46055 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -439,7 +439,7 @@ static int gameport_thread(void *nothing)
439 do { 439 do {
440 gameport_handle_events(); 440 gameport_handle_events();
441 wait_event_interruptible(gameport_wait, !list_empty(&gameport_event_list)); 441 wait_event_interruptible(gameport_wait, !list_empty(&gameport_event_list));
442 try_to_freeze(PF_FREEZE); 442 try_to_freeze();
443 } while (!signal_pending(current)); 443 } while (!signal_pending(current));
444 444
445 printk(KERN_DEBUG "gameport: kgameportd exiting\n"); 445 printk(KERN_DEBUG "gameport: kgameportd exiting\n");
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 5900de3c3f4f..a9bf549c8dc5 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -396,7 +396,7 @@ static void i8042_stop(struct serio *serio)
396 struct i8042_port *port = serio->port_data; 396 struct i8042_port *port = serio->port_data;
397 397
398 port->exists = 0; 398 port->exists = 0;
399 synchronize_kernel(); 399 synchronize_sched();
400 port->serio = NULL; 400 port->serio = NULL;
401} 401}
402 402
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index feab4970406e..341824c48529 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -344,7 +344,7 @@ static int serio_thread(void *nothing)
344 do { 344 do {
345 serio_handle_events(); 345 serio_handle_events();
346 wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); 346 wait_event_interruptible(serio_wait, !list_empty(&serio_event_list));
347 try_to_freeze(PF_FREEZE); 347 try_to_freeze();
348 } while (!signal_pending(current)); 348 } while (!signal_pending(current));
349 349
350 printk(KERN_DEBUG "serio: kseriod exiting\n"); 350 printk(KERN_DEBUG "serio: kseriod exiting\n");
diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 40395f567231..afa46681f983 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -224,6 +224,7 @@ actcapi_manufacturer_req_net(act2000_card *card)
224/* 224/*
225 * Switch V.42 on or off 225 * Switch V.42 on or off
226 */ 226 */
227#if 0
227int 228int
228actcapi_manufacturer_req_v42(act2000_card *card, ulong arg) 229actcapi_manufacturer_req_v42(act2000_card *card, ulong arg)
229{ 230{
@@ -242,6 +243,7 @@ actcapi_manufacturer_req_v42(act2000_card *card, ulong arg)
242 ACTCAPI_QUEUE_TX; 243 ACTCAPI_QUEUE_TX;
243 return 0; 244 return 0;
244} 245}
246#endif /* 0 */
245 247
246/* 248/*
247 * Set error-handler 249 * Set error-handler
diff --git a/drivers/isdn/act2000/capi.h b/drivers/isdn/act2000/capi.h
index 04d2bcdd37a7..f6d5f530b86b 100644
--- a/drivers/isdn/act2000/capi.h
+++ b/drivers/isdn/act2000/capi.h
@@ -350,7 +350,6 @@ actcapi_nextsmsg(act2000_card *card)
350extern int actcapi_chkhdr(act2000_card *, actcapi_msghdr *); 350extern int actcapi_chkhdr(act2000_card *, actcapi_msghdr *);
351extern int actcapi_listen_req(act2000_card *); 351extern int actcapi_listen_req(act2000_card *);
352extern int actcapi_manufacturer_req_net(act2000_card *); 352extern int actcapi_manufacturer_req_net(act2000_card *);
353extern int actcapi_manufacturer_req_v42(act2000_card *, ulong);
354extern int actcapi_manufacturer_req_errh(act2000_card *); 353extern int actcapi_manufacturer_req_errh(act2000_card *);
355extern int actcapi_manufacturer_req_msn(act2000_card *); 354extern int actcapi_manufacturer_req_msn(act2000_card *);
356extern int actcapi_connect_req(act2000_card *, act2000_chan *, char *, char, int, int); 355extern int actcapi_connect_req(act2000_card *, act2000_chan *, char *, char, int, int);
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c
index 55bed00ca865..91dd0551fc7c 100644
--- a/drivers/isdn/hardware/avm/b1dma.c
+++ b/drivers/isdn/hardware/avm/b1dma.c
@@ -955,7 +955,7 @@ EXPORT_SYMBOL(b1dma_release_appl);
955EXPORT_SYMBOL(b1dma_send_message); 955EXPORT_SYMBOL(b1dma_send_message);
956EXPORT_SYMBOL(b1dmactl_read_proc); 956EXPORT_SYMBOL(b1dmactl_read_proc);
957 957
958int b1dma_init(void) 958static int __init b1dma_init(void)
959{ 959{
960 char *p; 960 char *p;
961 char rev[32]; 961 char rev[32];
@@ -972,7 +972,7 @@ int b1dma_init(void)
972 return 0; 972 return 0;
973} 973}
974 974
975void b1dma_exit(void) 975static void __exit b1dma_exit(void)
976{ 976{
977} 977}
978 978
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
index fa6b93b1a42d..724aac2c1cca 100644
--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -885,7 +885,7 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
885} 885}
886 886
887 887
888void c4_reset_ctr(struct capi_ctr *ctrl) 888static void c4_reset_ctr(struct capi_ctr *ctrl)
889{ 889{
890 avmcard *card = ((avmctrl_info *)(ctrl->driverdata))->card; 890 avmcard *card = ((avmctrl_info *)(ctrl->driverdata))->card;
891 avmctrl_info *cinfo; 891 avmctrl_info *cinfo;
@@ -933,7 +933,7 @@ static void c4_remove(struct pci_dev *pdev)
933/* ------------------------------------------------------------- */ 933/* ------------------------------------------------------------- */
934 934
935 935
936void c4_register_appl(struct capi_ctr *ctrl, 936static void c4_register_appl(struct capi_ctr *ctrl,
937 u16 appl, 937 u16 appl,
938 capi_register_params *rp) 938 capi_register_params *rp)
939{ 939{
@@ -978,7 +978,7 @@ void c4_register_appl(struct capi_ctr *ctrl,
978 978
979/* ------------------------------------------------------------- */ 979/* ------------------------------------------------------------- */
980 980
981void c4_release_appl(struct capi_ctr *ctrl, u16 appl) 981static void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
982{ 982{
983 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); 983 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
984 avmcard *card = cinfo->card; 984 avmcard *card = cinfo->card;
diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c
index cb9d9cee2a64..3b701d97bdf1 100644
--- a/drivers/isdn/hardware/avm/t1isa.c
+++ b/drivers/isdn/hardware/avm/t1isa.c
@@ -328,7 +328,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
328 return 0; 328 return 0;
329} 329}
330 330
331void t1isa_reset_ctr(struct capi_ctr *ctrl) 331static void t1isa_reset_ctr(struct capi_ctr *ctrl)
332{ 332{
333 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); 333 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
334 avmcard *card = cinfo->card; 334 avmcard *card = cinfo->card;
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 8d6bb56754b8..293e27789d54 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -23,7 +23,7 @@ endif
23# Multipart objects. 23# Multipart objects.
24 24
25hisax_st5481-y := st5481_init.o st5481_usb.o st5481_d.o \ 25hisax_st5481-y := st5481_init.o st5481_usb.o st5481_d.o \
26 st5481_b.o st5481_hdlc.o 26 st5481_b.o
27 27
28hisax-y := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \ 28hisax-y := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \
29 lmgr.o q931.o callc.o fsm.o 29 lmgr.o q931.o callc.o fsm.o
diff --git a/drivers/isdn/hisax/amd7930_fn.c b/drivers/isdn/hisax/amd7930_fn.c
index c4f861a5db25..8ae08c41c853 100644
--- a/drivers/isdn/hisax/amd7930_fn.c
+++ b/drivers/isdn/hisax/amd7930_fn.c
@@ -97,7 +97,7 @@ static WORD initAMD[] = {
97}; 97};
98 98
99 99
100void /* macro wWordAMD */ 100static void /* macro wWordAMD */
101WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val) 101WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val)
102{ 102{
103 wByteAMD(cs, 0x00, reg); 103 wByteAMD(cs, 0x00, reg);
@@ -105,7 +105,7 @@ WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val)
105 wByteAMD(cs, 0x01, HIBYTE(val)); 105 wByteAMD(cs, 0x01, HIBYTE(val));
106} 106}
107 107
108WORD /* macro rWordAMD */ 108static WORD /* macro rWordAMD */
109ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg) 109ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg)
110{ 110{
111 WORD res; 111 WORD res;
@@ -665,7 +665,7 @@ Amd7930_l1hw(struct PStack *st, int pr, void *arg)
665 } 665 }
666} 666}
667 667
668void 668static void
669setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs) 669setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs)
670{ 670{
671 671
@@ -676,7 +676,7 @@ setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs)
676} 676}
677 677
678 678
679void 679static void
680DC_Close_Amd7930(struct IsdnCardState *cs) { 680DC_Close_Amd7930(struct IsdnCardState *cs) {
681 if (cs->debug & L1_DEB_ISAC) 681 if (cs->debug & L1_DEB_ISAC)
682 debugl1(cs, "Amd7930: DC_Close called"); 682 debugl1(cs, "Amd7930: DC_Close called");
diff --git a/drivers/isdn/hisax/asuscom.c b/drivers/isdn/hisax/asuscom.c
index 7546e2e4a94e..a98c5e38bbbc 100644
--- a/drivers/isdn/hisax/asuscom.c
+++ b/drivers/isdn/hisax/asuscom.c
@@ -22,7 +22,7 @@
22 22
23extern const char *CardType[]; 23extern const char *CardType[];
24 24
25const char *Asuscom_revision = "$Revision: 1.14.2.4 $"; 25static const char *Asuscom_revision = "$Revision: 1.14.2.4 $";
26 26
27#define byteout(addr,val) outb(val,addr) 27#define byteout(addr,val) outb(val,addr)
28#define bytein(addr) inb(addr) 28#define bytein(addr) inb(addr)
@@ -239,7 +239,7 @@ Start_IPAC:
239 return IRQ_HANDLED; 239 return IRQ_HANDLED;
240} 240}
241 241
242void 242static void
243release_io_asuscom(struct IsdnCardState *cs) 243release_io_asuscom(struct IsdnCardState *cs)
244{ 244{
245 int bytecnt = 8; 245 int bytecnt = 8;
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index 6fcb2cf7b0b6..625799ab0d14 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -172,7 +172,7 @@ struct BCState *Sel_BCS(struct IsdnCardState *cs, int channel)
172 return(NULL); 172 return(NULL);
173} 173}
174 174
175void 175static void
176write_ctrl(struct BCState *bcs, int which) { 176write_ctrl(struct BCState *bcs, int which) {
177 177
178 if (bcs->cs->debug & L1_DEB_HSCX) 178 if (bcs->cs->debug & L1_DEB_HSCX)
@@ -193,7 +193,7 @@ write_ctrl(struct BCState *bcs, int which) {
193 } 193 }
194} 194}
195 195
196void 196static void
197modehdlc(struct BCState *bcs, int mode, int bc) 197modehdlc(struct BCState *bcs, int mode, int bc)
198{ 198{
199 struct IsdnCardState *cs = bcs->cs; 199 struct IsdnCardState *cs = bcs->cs;
@@ -451,7 +451,7 @@ HDLC_irq(struct BCState *bcs, u_int stat) {
451 } 451 }
452} 452}
453 453
454inline void 454static inline void
455HDLC_irq_main(struct IsdnCardState *cs) 455HDLC_irq_main(struct IsdnCardState *cs)
456{ 456{
457 u_int stat; 457 u_int stat;
@@ -487,7 +487,7 @@ HDLC_irq_main(struct IsdnCardState *cs)
487 } 487 }
488} 488}
489 489
490void 490static void
491hdlc_l2l1(struct PStack *st, int pr, void *arg) 491hdlc_l2l1(struct PStack *st, int pr, void *arg)
492{ 492{
493 struct BCState *bcs = st->l1.bcs; 493 struct BCState *bcs = st->l1.bcs;
@@ -547,7 +547,7 @@ hdlc_l2l1(struct PStack *st, int pr, void *arg)
547 } 547 }
548} 548}
549 549
550void 550static void
551close_hdlcstate(struct BCState *bcs) 551close_hdlcstate(struct BCState *bcs)
552{ 552{
553 modehdlc(bcs, 0, 0); 553 modehdlc(bcs, 0, 0);
@@ -570,7 +570,7 @@ close_hdlcstate(struct BCState *bcs)
570 } 570 }
571} 571}
572 572
573int 573static int
574open_hdlcstate(struct IsdnCardState *cs, struct BCState *bcs) 574open_hdlcstate(struct IsdnCardState *cs, struct BCState *bcs)
575{ 575{
576 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { 576 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
@@ -598,7 +598,7 @@ open_hdlcstate(struct IsdnCardState *cs, struct BCState *bcs)
598 return (0); 598 return (0);
599} 599}
600 600
601int 601static int
602setstack_hdlc(struct PStack *st, struct BCState *bcs) 602setstack_hdlc(struct PStack *st, struct BCState *bcs)
603{ 603{
604 bcs->channel = st->l1.bc; 604 bcs->channel = st->l1.bc;
@@ -612,6 +612,7 @@ setstack_hdlc(struct PStack *st, struct BCState *bcs)
612 return (0); 612 return (0);
613} 613}
614 614
615#if 0
615void __init 616void __init
616clear_pending_hdlc_ints(struct IsdnCardState *cs) 617clear_pending_hdlc_ints(struct IsdnCardState *cs)
617{ 618{
@@ -641,8 +642,9 @@ clear_pending_hdlc_ints(struct IsdnCardState *cs)
641 debugl1(cs, "HDLC 2 VIN %x", val); 642 debugl1(cs, "HDLC 2 VIN %x", val);
642 } 643 }
643} 644}
645#endif /* 0 */
644 646
645void __init 647static void __init
646inithdlc(struct IsdnCardState *cs) 648inithdlc(struct IsdnCardState *cs)
647{ 649{
648 cs->bcs[0].BC_SetStack = setstack_hdlc; 650 cs->bcs[0].BC_SetStack = setstack_hdlc;
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c
index f410f628a3e2..dcb308aeb50c 100644
--- a/drivers/isdn/hisax/bkm_a4t.c
+++ b/drivers/isdn/hisax/bkm_a4t.c
@@ -23,7 +23,7 @@
23 23
24extern const char *CardType[]; 24extern const char *CardType[];
25 25
26const char *bkm_a4t_revision = "$Revision: 1.22.2.4 $"; 26static const char *bkm_a4t_revision = "$Revision: 1.22.2.4 $";
27 27
28 28
29static inline u_char 29static inline u_char
@@ -167,7 +167,7 @@ bkm_interrupt(int intno, void *dev_id, struct pt_regs *regs)
167 } 167 }
168} 168}
169 169
170void 170static void
171release_io_bkm(struct IsdnCardState *cs) 171release_io_bkm(struct IsdnCardState *cs)
172{ 172{
173 if (cs->hw.ax.base) { 173 if (cs->hw.ax.base) {
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c
index 94bb83ce7fd8..5f21b82c8c8d 100644
--- a/drivers/isdn/hisax/bkm_a8.c
+++ b/drivers/isdn/hisax/bkm_a8.c
@@ -27,7 +27,7 @@
27 27
28extern const char *CardType[]; 28extern const char *CardType[];
29 29
30const char sct_quadro_revision[] = "$Revision: 1.22.2.4 $"; 30static const char sct_quadro_revision[] = "$Revision: 1.22.2.4 $";
31 31
32static const char *sct_quadro_subtypes[] = 32static const char *sct_quadro_subtypes[] =
33{ 33{
@@ -193,7 +193,7 @@ bkm_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
193 return IRQ_HANDLED; 193 return IRQ_HANDLED;
194} 194}
195 195
196void 196static void
197release_io_sct_quadro(struct IsdnCardState *cs) 197release_io_sct_quadro(struct IsdnCardState *cs)
198{ 198{
199 release_region(cs->hw.ax.base & 0xffffffc0, 128); 199 release_region(cs->hw.ax.base & 0xffffffc0, 128);
@@ -261,7 +261,7 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
261 return (0); 261 return (0);
262} 262}
263 263
264int __init 264static int __init
265sct_alloc_io(u_int adr, u_int len) 265sct_alloc_io(u_int adr, u_int len)
266{ 266{
267 if (!request_region(adr, len, "scitel")) { 267 if (!request_region(adr, len, "scitel")) {
diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c
index 04065ab2610f..7c56c44f0fd1 100644
--- a/drivers/isdn/hisax/callc.c
+++ b/drivers/isdn/hisax/callc.c
@@ -874,7 +874,7 @@ release_b_st(struct Channel *chanp)
874 } 874 }
875} 875}
876 876
877struct Channel 877static struct Channel
878*selectfreechannel(struct PStack *st, int bch) 878*selectfreechannel(struct PStack *st, int bch)
879{ 879{
880 struct IsdnCardState *cs = st->l1.hardware; 880 struct IsdnCardState *cs = st->l1.hardware;
@@ -1429,7 +1429,7 @@ capi_debug(struct Channel *chanp, capi_msg *cm)
1429 HiSax_putstatus(chanp->cs, "Ch", "%d CAPIMSG %s", chanp->chan, tmpbuf); 1429 HiSax_putstatus(chanp->cs, "Ch", "%d CAPIMSG %s", chanp->chan, tmpbuf);
1430} 1430}
1431 1431
1432void 1432static void
1433lli_got_fac_req(struct Channel *chanp, capi_msg *cm) { 1433lli_got_fac_req(struct Channel *chanp, capi_msg *cm) {
1434 if ((cm->para[0] != 3) || (cm->para[1] != 0)) 1434 if ((cm->para[0] != 3) || (cm->para[1] != 0))
1435 return; 1435 return;
@@ -1454,7 +1454,7 @@ lli_got_fac_req(struct Channel *chanp, capi_msg *cm) {
1454 } 1454 }
1455} 1455}
1456 1456
1457void 1457static void
1458lli_got_manufacturer(struct Channel *chanp, struct IsdnCardState *cs, capi_msg *cm) { 1458lli_got_manufacturer(struct Channel *chanp, struct IsdnCardState *cs, capi_msg *cm) {
1459 if ((cs->typ == ISDN_CTYPE_ELSA) || (cs->typ == ISDN_CTYPE_ELSA_PNP) || 1459 if ((cs->typ == ISDN_CTYPE_ELSA) || (cs->typ == ISDN_CTYPE_ELSA_PNP) ||
1460 (cs->typ == ISDN_CTYPE_ELSA_PCI)) { 1460 (cs->typ == ISDN_CTYPE_ELSA_PCI)) {
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 1663ee69d41d..c542e6fb2bde 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -332,7 +332,7 @@ struct IsdnCard cards[HISAX_MAX_CARDS] = {
332#define HISAX_IDSIZE (HISAX_MAX_CARDS*8) 332#define HISAX_IDSIZE (HISAX_MAX_CARDS*8)
333static char HiSaxID[HISAX_IDSIZE] = { 0, }; 333static char HiSaxID[HISAX_IDSIZE] = { 0, };
334 334
335char *HiSax_id = HiSaxID; 335static char *HiSax_id = HiSaxID;
336#ifdef MODULE 336#ifdef MODULE
337/* Variables for insmod */ 337/* Variables for insmod */
338static int type[HISAX_MAX_CARDS] = { 0, }; 338static int type[HISAX_MAX_CARDS] = { 0, };
@@ -391,7 +391,7 @@ char *HiSax_getrev(const char *revision)
391 return rev; 391 return rev;
392} 392}
393 393
394void __init HiSaxVersion(void) 394static void __init HiSaxVersion(void)
395{ 395{
396 char tmp[64]; 396 char tmp[64];
397 397
@@ -608,6 +608,7 @@ static inline struct IsdnCardState *hisax_findcard(int driverid)
608/* 608/*
609 * Find card with given card number 609 * Find card with given card number
610 */ 610 */
611#if 0
611struct IsdnCardState *hisax_get_card(int cardnr) 612struct IsdnCardState *hisax_get_card(int cardnr)
612{ 613{
613 if ((cardnr <= nrcards) && (cardnr > 0)) 614 if ((cardnr <= nrcards) && (cardnr > 0))
@@ -615,8 +616,9 @@ struct IsdnCardState *hisax_get_card(int cardnr)
615 return cards[cardnr - 1].cs; 616 return cards[cardnr - 1].cs;
616 return NULL; 617 return NULL;
617} 618}
619#endif /* 0 */
618 620
619int HiSax_readstatus(u_char __user *buf, int len, int id, int channel) 621static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
620{ 622{
621 int count, cnt; 623 int count, cnt;
622 u_char __user *p = buf; 624 u_char __user *p = buf;
@@ -768,7 +770,7 @@ int ll_run(struct IsdnCardState *cs, int addfeatures)
768 return 0; 770 return 0;
769} 771}
770 772
771void ll_stop(struct IsdnCardState *cs) 773static void ll_stop(struct IsdnCardState *cs)
772{ 774{
773 isdn_ctrl ic; 775 isdn_ctrl ic;
774 776
@@ -1184,7 +1186,7 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
1184 return ret; 1186 return ret;
1185} 1187}
1186 1188
1187void HiSax_shiftcards(int idx) 1189static void HiSax_shiftcards(int idx)
1188{ 1190{
1189 int i; 1191 int i;
1190 1192
@@ -1192,7 +1194,7 @@ void HiSax_shiftcards(int idx)
1192 memcpy(&cards[i], &cards[i + 1], sizeof(cards[i])); 1194 memcpy(&cards[i], &cards[i + 1], sizeof(cards[i]));
1193} 1195}
1194 1196
1195int HiSax_inithardware(int *busy_flag) 1197static int HiSax_inithardware(int *busy_flag)
1196{ 1198{
1197 int foundcards = 0; 1199 int foundcards = 0;
1198 int i = 0; 1200 int i = 0;
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 394d481e093f..b62d6b30b72b 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -28,7 +28,7 @@
28 28
29extern const char *CardType[]; 29extern const char *CardType[];
30 30
31const char *Diva_revision = "$Revision: 1.33.2.6 $"; 31static const char *Diva_revision = "$Revision: 1.33.2.6 $";
32 32
33#define byteout(addr,val) outb(val,addr) 33#define byteout(addr,val) outb(val,addr)
34#define bytein(addr) inb(addr) 34#define bytein(addr) inb(addr)
@@ -706,7 +706,7 @@ diva_irq_ipacx_pci(int intno, void *dev_id, struct pt_regs *regs)
706 return IRQ_HANDLED; 706 return IRQ_HANDLED;
707} 707}
708 708
709void 709static void
710release_io_diva(struct IsdnCardState *cs) 710release_io_diva(struct IsdnCardState *cs)
711{ 711{
712 int bytecnt; 712 int bytecnt;
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index 4d7a0250d7e2..110e9fd669c5 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -33,13 +33,13 @@
33 33
34extern const char *CardType[]; 34extern const char *CardType[];
35 35
36const char *Elsa_revision = "$Revision: 2.32.2.4 $"; 36static const char *Elsa_revision = "$Revision: 2.32.2.4 $";
37const char *Elsa_Types[] = 37static const char *Elsa_Types[] =
38{"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro", 38{"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
39 "PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI", 39 "PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI",
40 "PCMCIA-IPAC" }; 40 "PCMCIA-IPAC" };
41 41
42const char *ITACVer[] = 42static const char *ITACVer[] =
43{"?0?", "?1?", "?2?", "?3?", "?4?", "V2.2", 43{"?0?", "?1?", "?2?", "?3?", "?4?", "V2.2",
44 "B1", "A1"}; 44 "B1", "A1"};
45 45
@@ -425,7 +425,7 @@ Start_IPAC:
425 return IRQ_HANDLED; 425 return IRQ_HANDLED;
426} 426}
427 427
428void 428static void
429release_io_elsa(struct IsdnCardState *cs) 429release_io_elsa(struct IsdnCardState *cs)
430{ 430{
431 int bytecnt = 8; 431 int bytecnt = 8;
diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c
index 689c83395693..898ec0916195 100644
--- a/drivers/isdn/hisax/elsa_ser.c
+++ b/drivers/isdn/hisax/elsa_ser.c
@@ -237,7 +237,7 @@ static void mshutdown(struct IsdnCardState *cs)
237#endif 237#endif
238} 238}
239 239
240inline int 240static inline int
241write_modem(struct BCState *bcs) { 241write_modem(struct BCState *bcs) {
242 int ret=0; 242 int ret=0;
243 struct IsdnCardState *cs = bcs->cs; 243 struct IsdnCardState *cs = bcs->cs;
@@ -275,7 +275,7 @@ write_modem(struct BCState *bcs) {
275 return(ret); 275 return(ret);
276} 276}
277 277
278inline void 278static inline void
279modem_fill(struct BCState *bcs) { 279modem_fill(struct BCState *bcs) {
280 280
281 if (bcs->tx_skb) { 281 if (bcs->tx_skb) {
@@ -422,7 +422,7 @@ extern int open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs);
422extern void modehscx(struct BCState *bcs, int mode, int bc); 422extern void modehscx(struct BCState *bcs, int mode, int bc);
423extern void hscx_l2l1(struct PStack *st, int pr, void *arg); 423extern void hscx_l2l1(struct PStack *st, int pr, void *arg);
424 424
425void 425static void
426close_elsastate(struct BCState *bcs) 426close_elsastate(struct BCState *bcs)
427{ 427{
428 modehscx(bcs, 0, bcs->channel); 428 modehscx(bcs, 0, bcs->channel);
@@ -442,7 +442,7 @@ close_elsastate(struct BCState *bcs)
442 } 442 }
443} 443}
444 444
445void 445static void
446modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) { 446modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) {
447 int count, fp; 447 int count, fp;
448 u_char *msg = buf; 448 u_char *msg = buf;
@@ -472,7 +472,7 @@ modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) {
472 } 472 }
473} 473}
474 474
475void 475static void
476modem_set_init(struct IsdnCardState *cs) { 476modem_set_init(struct IsdnCardState *cs) {
477 int timeout; 477 int timeout;
478 478
@@ -521,7 +521,7 @@ modem_set_init(struct IsdnCardState *cs) {
521 udelay(RCV_DELAY); 521 udelay(RCV_DELAY);
522} 522}
523 523
524void 524static void
525modem_set_dial(struct IsdnCardState *cs, int outgoing) { 525modem_set_dial(struct IsdnCardState *cs, int outgoing) {
526 int timeout; 526 int timeout;
527#define RCV_DELAY 20000 527#define RCV_DELAY 20000
@@ -543,7 +543,7 @@ modem_set_dial(struct IsdnCardState *cs, int outgoing) {
543 udelay(RCV_DELAY); 543 udelay(RCV_DELAY);
544} 544}
545 545
546void 546static void
547modem_l2l1(struct PStack *st, int pr, void *arg) 547modem_l2l1(struct PStack *st, int pr, void *arg)
548{ 548{
549 struct BCState *bcs = st->l1.bcs; 549 struct BCState *bcs = st->l1.bcs;
@@ -579,7 +579,7 @@ modem_l2l1(struct PStack *st, int pr, void *arg)
579 } 579 }
580} 580}
581 581
582int 582static int
583setstack_elsa(struct PStack *st, struct BCState *bcs) 583setstack_elsa(struct PStack *st, struct BCState *bcs)
584{ 584{
585 585
@@ -614,7 +614,7 @@ setstack_elsa(struct PStack *st, struct BCState *bcs)
614 return (0); 614 return (0);
615} 615}
616 616
617void 617static void
618init_modem(struct IsdnCardState *cs) { 618init_modem(struct IsdnCardState *cs) {
619 619
620 cs->bcs[0].BC_SetStack = setstack_elsa; 620 cs->bcs[0].BC_SetStack = setstack_elsa;
@@ -641,7 +641,7 @@ init_modem(struct IsdnCardState *cs) {
641 modem_set_init(cs); 641 modem_set_init(cs);
642} 642}
643 643
644void 644static void
645release_modem(struct IsdnCardState *cs) { 645release_modem(struct IsdnCardState *cs) {
646 646
647 cs->hw.elsa.MFlag = 0; 647 cs->hw.elsa.MFlag = 0;
diff --git a/drivers/isdn/hisax/enternow.h b/drivers/isdn/hisax/enternow.h
deleted file mode 100644
index ed2eec5874c5..000000000000
--- a/drivers/isdn/hisax/enternow.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/* 2001/10/02
2 *
3 * enternow.h Header-file included by
4 * enternow_pci.c
5 *
6 * Author Christoph Ersfeld <info@formula-n.de>
7 * Formula-n Europe AG (www.formula-n.com)
8 * previously Gerdes AG
9 *
10 *
11 * This file is (c) under GNU PUBLIC LICENSE
12 */
13
14
15/* ***************************************************************************************** *
16 * ****************************** datatypes and macros ************************************* *
17 * ***************************************************************************************** */
18
19#define BYTE unsigned char
20#define WORD unsigned int
21#define HIBYTE(w) ((unsigned char)((w & 0xff00) / 256))
22#define LOBYTE(w) ((unsigned char)(w & 0x00ff))
23#define InByte(addr) inb(addr)
24#define OutByte(addr,val) outb(val,addr)
25
26
27
28/* ***************************************************************************************** *
29 * *********************************** card-specific *************************************** *
30 * ***************************************************************************************** */
31
32/* für PowerISDN PCI */
33#define TJ_AMD_IRQ 0x20
34#define TJ_LED1 0x40
35#define TJ_LED2 0x80
36
37
38/* Das Fenster zum AMD...
39 * Ab Adresse hw.njet.base + TJ_AMD_PORT werden vom AMD jeweils 8 Bit in
40 * den TigerJet i/o-Raum gemappt
41 * -> 0x01 des AMD bei hw.njet.base + 0C4 */
42#define TJ_AMD_PORT 0xC0
43
44
45
46/* ***************************************************************************************** *
47 * *************************************** Prototypen ************************************** *
48 * ***************************************************************************************** */
49
50BYTE ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset);
51void WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value);
diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c
index 1cc4d11e007a..3341cf155531 100644
--- a/drivers/isdn/hisax/enternow_pci.c
+++ b/drivers/isdn/hisax/enternow_pci.c
@@ -65,7 +65,6 @@
65#include "isac.h" 65#include "isac.h"
66#include "isdnl1.h" 66#include "isdnl1.h"
67#include "amd7930_fn.h" 67#include "amd7930_fn.h"
68#include "enternow.h"
69#include <linux/interrupt.h> 68#include <linux/interrupt.h>
70#include <linux/ppp_defs.h> 69#include <linux/ppp_defs.h>
71#include <linux/pci.h> 70#include <linux/pci.h>
@@ -74,58 +73,72 @@
74 73
75 74
76 75
77const char *enternow_pci_rev = "$Revision: 1.1.4.5 $"; 76static const char *enternow_pci_rev = "$Revision: 1.1.4.5 $";
77
78
79/* für PowerISDN PCI */
80#define TJ_AMD_IRQ 0x20
81#define TJ_LED1 0x40
82#define TJ_LED2 0x80
83
84
85/* Das Fenster zum AMD...
86 * Ab Adresse hw.njet.base + TJ_AMD_PORT werden vom AMD jeweils 8 Bit in
87 * den TigerJet i/o-Raum gemappt
88 * -> 0x01 des AMD bei hw.njet.base + 0C4 */
89#define TJ_AMD_PORT 0xC0
90
78 91
79 92
80/* *************************** I/O-Interface functions ************************************* */ 93/* *************************** I/O-Interface functions ************************************* */
81 94
82 95
83/* cs->readisac, macro rByteAMD */ 96/* cs->readisac, macro rByteAMD */
84BYTE 97static unsigned char
85ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset) 98ReadByteAmd7930(struct IsdnCardState *cs, unsigned char offset)
86{ 99{
87 /* direktes Register */ 100 /* direktes Register */
88 if(offset < 8) 101 if(offset < 8)
89 return (InByte(cs->hw.njet.isac + 4*offset)); 102 return (inb(cs->hw.njet.isac + 4*offset));
90 103
91 /* indirektes Register */ 104 /* indirektes Register */
92 else { 105 else {
93 OutByte(cs->hw.njet.isac + 4*AMD_CR, offset); 106 outb(offset, cs->hw.njet.isac + 4*AMD_CR);
94 return(InByte(cs->hw.njet.isac + 4*AMD_DR)); 107 return(inb(cs->hw.njet.isac + 4*AMD_DR));
95 } 108 }
96} 109}
97 110
98/* cs->writeisac, macro wByteAMD */ 111/* cs->writeisac, macro wByteAMD */
99void 112static void
100WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value) 113WriteByteAmd7930(struct IsdnCardState *cs, unsigned char offset, unsigned char value)
101{ 114{
102 /* direktes Register */ 115 /* direktes Register */
103 if(offset < 8) 116 if(offset < 8)
104 OutByte(cs->hw.njet.isac + 4*offset, value); 117 outb(value, cs->hw.njet.isac + 4*offset);
105 118
106 /* indirektes Register */ 119 /* indirektes Register */
107 else { 120 else {
108 OutByte(cs->hw.njet.isac + 4*AMD_CR, offset); 121 outb(offset, cs->hw.njet.isac + 4*AMD_CR);
109 OutByte(cs->hw.njet.isac + 4*AMD_DR, value); 122 outb(value, cs->hw.njet.isac + 4*AMD_DR);
110 } 123 }
111} 124}
112 125
113 126
114void 127static void
115enpci_setIrqMask(struct IsdnCardState *cs, BYTE val) { 128enpci_setIrqMask(struct IsdnCardState *cs, unsigned char val) {
116 if (!val) 129 if (!val)
117 OutByte(cs->hw.njet.base+NETJET_IRQMASK1, 0x00); 130 outb(0x00, cs->hw.njet.base+NETJET_IRQMASK1);
118 else 131 else
119 OutByte(cs->hw.njet.base+NETJET_IRQMASK1, TJ_AMD_IRQ); 132 outb(TJ_AMD_IRQ, cs->hw.njet.base+NETJET_IRQMASK1);
120} 133}
121 134
122 135
123static BYTE dummyrr(struct IsdnCardState *cs, int chan, BYTE off) 136static unsigned char dummyrr(struct IsdnCardState *cs, int chan, unsigned char off)
124{ 137{
125 return(5); 138 return(5);
126} 139}
127 140
128static void dummywr(struct IsdnCardState *cs, int chan, BYTE off, BYTE value) 141static void dummywr(struct IsdnCardState *cs, int chan, unsigned char off, unsigned char value)
129{ 142{
130 143
131} 144}
@@ -142,18 +155,18 @@ reset_enpci(struct IsdnCardState *cs)
142 155
143 /* Reset on, (also for AMD) */ 156 /* Reset on, (also for AMD) */
144 cs->hw.njet.ctrl_reg = 0x07; 157 cs->hw.njet.ctrl_reg = 0x07;
145 OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 158 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
146 mdelay(20); 159 mdelay(20);
147 /* Reset off */ 160 /* Reset off */
148 cs->hw.njet.ctrl_reg = 0x30; 161 cs->hw.njet.ctrl_reg = 0x30;
149 OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 162 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
150 /* 20ms delay */ 163 /* 20ms delay */
151 mdelay(20); 164 mdelay(20);
152 cs->hw.njet.auxd = 0; // LED-status 165 cs->hw.njet.auxd = 0; // LED-status
153 cs->hw.njet.dmactrl = 0; 166 cs->hw.njet.dmactrl = 0;
154 OutByte(cs->hw.njet.base + NETJET_AUXCTRL, ~TJ_AMD_IRQ); 167 outb(~TJ_AMD_IRQ, cs->hw.njet.base + NETJET_AUXCTRL);
155 OutByte(cs->hw.njet.base + NETJET_IRQMASK1, TJ_AMD_IRQ); 168 outb(TJ_AMD_IRQ, cs->hw.njet.base + NETJET_IRQMASK1);
156 OutByte(cs->hw.njet.auxa, cs->hw.njet.auxd); // LED off 169 outb(cs->hw.njet.auxd, cs->hw.njet.auxa); // LED off
157} 170}
158 171
159 172
@@ -161,7 +174,7 @@ static int
161enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) 174enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
162{ 175{
163 u_long flags; 176 u_long flags;
164 BYTE *chan; 177 unsigned char *chan;
165 178
166 if (cs->debug & L1_DEB_ISAC) 179 if (cs->debug & L1_DEB_ISAC)
167 debugl1(cs, "enter:now PCI: card_msg: 0x%04X", mt); 180 debugl1(cs, "enter:now PCI: card_msg: 0x%04X", mt);
@@ -187,16 +200,16 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
187 case MDL_ASSIGN: 200 case MDL_ASSIGN:
188 /* TEI assigned, LED1 on */ 201 /* TEI assigned, LED1 on */
189 cs->hw.njet.auxd = TJ_AMD_IRQ << 1; 202 cs->hw.njet.auxd = TJ_AMD_IRQ << 1;
190 OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd); 203 outb(cs->hw.njet.auxd, cs->hw.njet.base + NETJET_AUXDATA);
191 break; 204 break;
192 case MDL_REMOVE: 205 case MDL_REMOVE:
193 /* TEI removed, LEDs off */ 206 /* TEI removed, LEDs off */
194 cs->hw.njet.auxd = 0; 207 cs->hw.njet.auxd = 0;
195 OutByte(cs->hw.njet.base + NETJET_AUXDATA, 0x00); 208 outb(0x00, cs->hw.njet.base + NETJET_AUXDATA);
196 break; 209 break;
197 case MDL_BC_ASSIGN: 210 case MDL_BC_ASSIGN:
198 /* activate B-channel */ 211 /* activate B-channel */
199 chan = (BYTE *)arg; 212 chan = (unsigned char *)arg;
200 213
201 if (cs->debug & L1_DEB_ISAC) 214 if (cs->debug & L1_DEB_ISAC)
202 debugl1(cs, "enter:now PCI: assign phys. BC %d in AMD LMR1", *chan); 215 debugl1(cs, "enter:now PCI: assign phys. BC %d in AMD LMR1", *chan);
@@ -204,11 +217,11 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
204 cs->dc.amd7930.ph_command(cs, (cs->dc.amd7930.lmr1 | (*chan + 1)), "MDL_BC_ASSIGN"); 217 cs->dc.amd7930.ph_command(cs, (cs->dc.amd7930.lmr1 | (*chan + 1)), "MDL_BC_ASSIGN");
205 /* at least one b-channel in use, LED 2 on */ 218 /* at least one b-channel in use, LED 2 on */
206 cs->hw.njet.auxd |= TJ_AMD_IRQ << 2; 219 cs->hw.njet.auxd |= TJ_AMD_IRQ << 2;
207 OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd); 220 outb(cs->hw.njet.auxd, cs->hw.njet.base + NETJET_AUXDATA);
208 break; 221 break;
209 case MDL_BC_RELEASE: 222 case MDL_BC_RELEASE:
210 /* deactivate B-channel */ 223 /* deactivate B-channel */
211 chan = (BYTE *)arg; 224 chan = (unsigned char *)arg;
212 225
213 if (cs->debug & L1_DEB_ISAC) 226 if (cs->debug & L1_DEB_ISAC)
214 debugl1(cs, "enter:now PCI: release phys. BC %d in Amd LMR1", *chan); 227 debugl1(cs, "enter:now PCI: release phys. BC %d in Amd LMR1", *chan);
@@ -217,7 +230,7 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
217 /* no b-channel active -> LED2 off */ 230 /* no b-channel active -> LED2 off */
218 if (!(cs->dc.amd7930.lmr1 & 3)) { 231 if (!(cs->dc.amd7930.lmr1 & 3)) {
219 cs->hw.njet.auxd &= ~(TJ_AMD_IRQ << 2); 232 cs->hw.njet.auxd &= ~(TJ_AMD_IRQ << 2);
220 OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd); 233 outb(cs->hw.njet.auxd, cs->hw.njet.base + NETJET_AUXDATA);
221 } 234 }
222 break; 235 break;
223 default: 236 default:
@@ -231,11 +244,11 @@ static irqreturn_t
231enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs) 244enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
232{ 245{
233 struct IsdnCardState *cs = dev_id; 246 struct IsdnCardState *cs = dev_id;
234 BYTE s0val, s1val, ir; 247 unsigned char s0val, s1val, ir;
235 u_long flags; 248 u_long flags;
236 249
237 spin_lock_irqsave(&cs->lock, flags); 250 spin_lock_irqsave(&cs->lock, flags);
238 s1val = InByte(cs->hw.njet.base + NETJET_IRQSTAT1); 251 s1val = inb(cs->hw.njet.base + NETJET_IRQSTAT1);
239 252
240 /* AMD threw an interrupt */ 253 /* AMD threw an interrupt */
241 if (!(s1val & TJ_AMD_IRQ)) { 254 if (!(s1val & TJ_AMD_IRQ)) {
@@ -245,13 +258,13 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
245 s1val = 1; 258 s1val = 1;
246 } else 259 } else
247 s1val = 0; 260 s1val = 0;
248 s0val = InByte(cs->hw.njet.base + NETJET_IRQSTAT0); 261 s0val = inb(cs->hw.njet.base + NETJET_IRQSTAT0);
249 if ((s0val | s1val)==0) { // shared IRQ 262 if ((s0val | s1val)==0) { // shared IRQ
250 spin_unlock_irqrestore(&cs->lock, flags); 263 spin_unlock_irqrestore(&cs->lock, flags);
251 return IRQ_NONE; 264 return IRQ_NONE;
252 } 265 }
253 if (s0val) 266 if (s0val)
254 OutByte(cs->hw.njet.base + NETJET_IRQSTAT0, s0val); 267 outb(s0val, cs->hw.njet.base + NETJET_IRQSTAT0);
255 268
256 /* DMA-Interrupt: B-channel-stuff */ 269 /* DMA-Interrupt: B-channel-stuff */
257 /* set bits in sval to indicate which page is free */ 270 /* set bits in sval to indicate which page is free */
@@ -342,20 +355,20 @@ setup_enternow_pci(struct IsdnCard *card)
342 355
343 /* Reset an */ 356 /* Reset an */
344 cs->hw.njet.ctrl_reg = 0x07; // geändert von 0xff 357 cs->hw.njet.ctrl_reg = 0x07; // geändert von 0xff
345 OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 358 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
346 /* 20 ms Pause */ 359 /* 20 ms Pause */
347 mdelay(20); 360 mdelay(20);
348 361
349 cs->hw.njet.ctrl_reg = 0x30; /* Reset Off and status read clear */ 362 cs->hw.njet.ctrl_reg = 0x30; /* Reset Off and status read clear */
350 OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); 363 outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
351 mdelay(10); 364 mdelay(10);
352 365
353 cs->hw.njet.auxd = 0x00; // war 0xc0 366 cs->hw.njet.auxd = 0x00; // war 0xc0
354 cs->hw.njet.dmactrl = 0; 367 cs->hw.njet.dmactrl = 0;
355 368
356 OutByte(cs->hw.njet.base + NETJET_AUXCTRL, ~TJ_AMD_IRQ); 369 outb(~TJ_AMD_IRQ, cs->hw.njet.base + NETJET_AUXCTRL);
357 OutByte(cs->hw.njet.base + NETJET_IRQMASK1, TJ_AMD_IRQ); 370 outb(TJ_AMD_IRQ, cs->hw.njet.base + NETJET_IRQMASK1);
358 OutByte(cs->hw.njet.auxa, cs->hw.njet.auxd); 371 outb(cs->hw.njet.auxd, cs->hw.njet.auxa);
359 372
360 break; 373 break;
361 } 374 }
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index 24a05a43f33e..352b45ac5347 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -21,7 +21,7 @@
21#include <linux/pci.h> 21#include <linux/pci.h>
22 22
23extern const char *CardType[]; 23extern const char *CardType[];
24const char *gazel_revision = "$Revision: 2.19.2.4 $"; 24static const char *gazel_revision = "$Revision: 2.19.2.4 $";
25 25
26#define R647 1 26#define R647 1
27#define R685 2 27#define R685 2
@@ -317,7 +317,8 @@ gazel_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
317 spin_unlock_irqrestore(&cs->lock, flags); 317 spin_unlock_irqrestore(&cs->lock, flags);
318 return IRQ_HANDLED; 318 return IRQ_HANDLED;
319} 319}
320void 320
321static void
321release_io_gazel(struct IsdnCardState *cs) 322release_io_gazel(struct IsdnCardState *cs)
322{ 323{
323 unsigned int i; 324 unsigned int i;
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index ba1d028343ec..6e7e060716b7 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -1358,7 +1358,7 @@ chipreset(hfc4s8s_hw * hw)
1358/********************************************/ 1358/********************************************/
1359/* disable/enable hardware in nt or te mode */ 1359/* disable/enable hardware in nt or te mode */
1360/********************************************/ 1360/********************************************/
1361void 1361static void
1362hfc_hardware_enable(hfc4s8s_hw * hw, int enable, int nt_mode) 1362hfc_hardware_enable(hfc4s8s_hw * hw, int enable, int nt_mode)
1363{ 1363{
1364 u_long flags; 1364 u_long flags;
diff --git a/drivers/isdn/hisax/hfc_2bds0.c b/drivers/isdn/hisax/hfc_2bds0.c
index ebea3feef003..7cf87793e790 100644
--- a/drivers/isdn/hisax/hfc_2bds0.c
+++ b/drivers/isdn/hisax/hfc_2bds0.c
@@ -345,7 +345,7 @@ hfc_send_data(struct BCState *bcs)
345 debugl1(cs,"send_data %d blocked", bcs->channel); 345 debugl1(cs,"send_data %d blocked", bcs->channel);
346} 346}
347 347
348void 348static void
349main_rec_2bds0(struct BCState *bcs) 349main_rec_2bds0(struct BCState *bcs)
350{ 350{
351 struct IsdnCardState *cs = bcs->cs; 351 struct IsdnCardState *cs = bcs->cs;
@@ -399,7 +399,7 @@ main_rec_2bds0(struct BCState *bcs)
399 return; 399 return;
400} 400}
401 401
402void 402static void
403mode_2bs0(struct BCState *bcs, int mode, int bc) 403mode_2bs0(struct BCState *bcs, int mode, int bc)
404{ 404{
405 struct IsdnCardState *cs = bcs->cs; 405 struct IsdnCardState *cs = bcs->cs;
@@ -505,7 +505,7 @@ hfc_l2l1(struct PStack *st, int pr, void *arg)
505 } 505 }
506} 506}
507 507
508void 508static void
509close_2bs0(struct BCState *bcs) 509close_2bs0(struct BCState *bcs)
510{ 510{
511 mode_2bs0(bcs, 0, bcs->channel); 511 mode_2bs0(bcs, 0, bcs->channel);
@@ -534,7 +534,7 @@ open_hfcstate(struct IsdnCardState *cs, struct BCState *bcs)
534 return (0); 534 return (0);
535} 535}
536 536
537int 537static int
538setstack_2b(struct PStack *st, struct BCState *bcs) 538setstack_2b(struct PStack *st, struct BCState *bcs)
539{ 539{
540 bcs->channel = st->l1.bc; 540 bcs->channel = st->l1.bc;
@@ -1004,7 +1004,7 @@ HFCD_l1hw(struct PStack *st, int pr, void *arg)
1004 } 1004 }
1005} 1005}
1006 1006
1007void 1007static void
1008setstack_hfcd(struct PStack *st, struct IsdnCardState *cs) 1008setstack_hfcd(struct PStack *st, struct IsdnCardState *cs)
1009{ 1009{
1010 st->l1.l1hw = HFCD_l1hw; 1010 st->l1.l1hw = HFCD_l1hw;
@@ -1015,7 +1015,7 @@ hfc_dbusy_timer(struct IsdnCardState *cs)
1015{ 1015{
1016} 1016}
1017 1017
1018unsigned int __init 1018static unsigned int __init
1019*init_send_hfcd(int cnt) 1019*init_send_hfcd(int cnt)
1020{ 1020{
1021 int i, *send; 1021 int i, *send;
diff --git a/drivers/isdn/hisax/hfc_2bs0.c b/drivers/isdn/hisax/hfc_2bs0.c
index bb376f39ac89..f978a5af8662 100644
--- a/drivers/isdn/hisax/hfc_2bs0.c
+++ b/drivers/isdn/hisax/hfc_2bs0.c
@@ -52,7 +52,7 @@ WaitNoBusy(struct IsdnCardState *cs)
52 return (to); 52 return (to);
53} 53}
54 54
55int 55static int
56GetFreeFifoBytes(struct BCState *bcs) 56GetFreeFifoBytes(struct BCState *bcs)
57{ 57{
58 int s; 58 int s;
@@ -66,7 +66,7 @@ GetFreeFifoBytes(struct BCState *bcs)
66 return (s); 66 return (s);
67} 67}
68 68
69int 69static int
70ReadZReg(struct BCState *bcs, u_char reg) 70ReadZReg(struct BCState *bcs, u_char reg)
71{ 71{
72 int val; 72 int val;
@@ -394,7 +394,7 @@ main_irq_hfc(struct BCState *bcs)
394 return; 394 return;
395} 395}
396 396
397void 397static void
398mode_hfc(struct BCState *bcs, int mode, int bc) 398mode_hfc(struct BCState *bcs, int mode, int bc)
399{ 399{
400 struct IsdnCardState *cs = bcs->cs; 400 struct IsdnCardState *cs = bcs->cs;
@@ -507,7 +507,7 @@ hfc_l2l1(struct PStack *st, int pr, void *arg)
507} 507}
508 508
509 509
510void 510static void
511close_hfcstate(struct BCState *bcs) 511close_hfcstate(struct BCState *bcs)
512{ 512{
513 mode_hfc(bcs, 0, bcs->channel); 513 mode_hfc(bcs, 0, bcs->channel);
@@ -537,7 +537,7 @@ open_hfcstate(struct IsdnCardState *cs, struct BCState *bcs)
537 return (0); 537 return (0);
538} 538}
539 539
540int 540static int
541setstack_hfc(struct PStack *st, struct BCState *bcs) 541setstack_hfc(struct PStack *st, struct BCState *bcs)
542{ 542{
543 bcs->channel = st->l1.bc; 543 bcs->channel = st->l1.bc;
@@ -551,7 +551,7 @@ setstack_hfc(struct PStack *st, struct BCState *bcs)
551 return (0); 551 return (0);
552} 552}
553 553
554void __init 554static void __init
555init_send(struct BCState *bcs) 555init_send(struct BCState *bcs)
556{ 556{
557 int i; 557 int i;
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index c2db52696a86..8337b0f26cc4 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -70,7 +70,7 @@ static const PCI_ENTRY id_list[] =
70/******************************************/ 70/******************************************/
71/* free hardware resources used by driver */ 71/* free hardware resources used by driver */
72/******************************************/ 72/******************************************/
73void 73static void
74release_io_hfcpci(struct IsdnCardState *cs) 74release_io_hfcpci(struct IsdnCardState *cs)
75{ 75{
76 printk(KERN_INFO "HiSax: release hfcpci at %p\n", 76 printk(KERN_INFO "HiSax: release hfcpci at %p\n",
@@ -394,7 +394,7 @@ receive_dmsg(struct IsdnCardState *cs)
394/*******************************************************************************/ 394/*******************************************************************************/
395/* check for transparent receive data and read max one threshold size if avail */ 395/* check for transparent receive data and read max one threshold size if avail */
396/*******************************************************************************/ 396/*******************************************************************************/
397int 397static int
398hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata) 398hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata)
399{ 399{
400 unsigned short *z1r, *z2r; 400 unsigned short *z1r, *z2r;
@@ -446,7 +446,7 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata)
446/**********************************/ 446/**********************************/
447/* B-channel main receive routine */ 447/* B-channel main receive routine */
448/**********************************/ 448/**********************************/
449void 449static void
450main_rec_hfcpci(struct BCState *bcs) 450main_rec_hfcpci(struct BCState *bcs)
451{ 451{
452 struct IsdnCardState *cs = bcs->cs; 452 struct IsdnCardState *cs = bcs->cs;
@@ -1244,7 +1244,7 @@ HFCPCI_l1hw(struct PStack *st, int pr, void *arg)
1244/***********************************************/ 1244/***********************************************/
1245/* called during init setting l1 stack pointer */ 1245/* called during init setting l1 stack pointer */
1246/***********************************************/ 1246/***********************************************/
1247void 1247static void
1248setstack_hfcpci(struct PStack *st, struct IsdnCardState *cs) 1248setstack_hfcpci(struct PStack *st, struct IsdnCardState *cs)
1249{ 1249{
1250 st->l1.l1hw = HFCPCI_l1hw; 1250 st->l1.l1hw = HFCPCI_l1hw;
@@ -1268,7 +1268,7 @@ hfcpci_send_data(struct BCState *bcs)
1268/***************************************************************/ 1268/***************************************************************/
1269/* activate/deactivate hardware for selected channels and mode */ 1269/* activate/deactivate hardware for selected channels and mode */
1270/***************************************************************/ 1270/***************************************************************/
1271void 1271static void
1272mode_hfcpci(struct BCState *bcs, int mode, int bc) 1272mode_hfcpci(struct BCState *bcs, int mode, int bc)
1273{ 1273{
1274 struct IsdnCardState *cs = bcs->cs; 1274 struct IsdnCardState *cs = bcs->cs;
@@ -1579,7 +1579,7 @@ hfcpci_bh(struct IsdnCardState *cs)
1579/********************************/ 1579/********************************/
1580/* called for card init message */ 1580/* called for card init message */
1581/********************************/ 1581/********************************/
1582void __init 1582static void __init
1583inithfcpci(struct IsdnCardState *cs) 1583inithfcpci(struct IsdnCardState *cs)
1584{ 1584{
1585 cs->bcs[0].BC_SetStack = setstack_2b; 1585 cs->bcs[0].BC_SetStack = setstack_2b;
diff --git a/drivers/isdn/hisax/hfc_pci.h b/drivers/isdn/hisax/hfc_pci.h
index 4df036ed1af0..9ef2981e404e 100644
--- a/drivers/isdn/hisax/hfc_pci.h
+++ b/drivers/isdn/hisax/hfc_pci.h
@@ -232,5 +232,4 @@ typedef union {
232#define Read_hfc(a,b) (*(((u_char *)a->hw.hfcpci.pci_io)+b)) 232#define Read_hfc(a,b) (*(((u_char *)a->hw.hfcpci.pci_io)+b))
233 233
234extern void main_irq_hcpci(struct BCState *bcs); 234extern void main_irq_hcpci(struct BCState *bcs);
235extern void inithfcpci(struct IsdnCardState *cs);
236extern void releasehfcpci(struct IsdnCardState *cs); 235extern void releasehfcpci(struct IsdnCardState *cs);
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index a307fcb6c634..f27c1608a3a7 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -308,7 +308,7 @@ read_fifo(struct IsdnCardState *cs, u_char fifo, int trans_max)
308/******************************************/ 308/******************************************/
309/* free hardware resources used by driver */ 309/* free hardware resources used by driver */
310/******************************************/ 310/******************************************/
311void 311static void
312release_io_hfcsx(struct IsdnCardState *cs) 312release_io_hfcsx(struct IsdnCardState *cs)
313{ 313{
314 cs->hw.hfcsx.int_m2 = 0; /* interrupt output off ! */ 314 cs->hw.hfcsx.int_m2 = 0; /* interrupt output off ! */
@@ -472,7 +472,7 @@ receive_dmsg(struct IsdnCardState *cs)
472/**********************************/ 472/**********************************/
473/* B-channel main receive routine */ 473/* B-channel main receive routine */
474/**********************************/ 474/**********************************/
475void 475static void
476main_rec_hfcsx(struct BCState *bcs) 476main_rec_hfcsx(struct BCState *bcs)
477{ 477{
478 struct IsdnCardState *cs = bcs->cs; 478 struct IsdnCardState *cs = bcs->cs;
@@ -1003,7 +1003,7 @@ HFCSX_l1hw(struct PStack *st, int pr, void *arg)
1003/***********************************************/ 1003/***********************************************/
1004/* called during init setting l1 stack pointer */ 1004/* called during init setting l1 stack pointer */
1005/***********************************************/ 1005/***********************************************/
1006void 1006static void
1007setstack_hfcsx(struct PStack *st, struct IsdnCardState *cs) 1007setstack_hfcsx(struct PStack *st, struct IsdnCardState *cs)
1008{ 1008{
1009 st->l1.l1hw = HFCSX_l1hw; 1009 st->l1.l1hw = HFCSX_l1hw;
@@ -1027,7 +1027,7 @@ hfcsx_send_data(struct BCState *bcs)
1027/***************************************************************/ 1027/***************************************************************/
1028/* activate/deactivate hardware for selected channels and mode */ 1028/* activate/deactivate hardware for selected channels and mode */
1029/***************************************************************/ 1029/***************************************************************/
1030void 1030static void
1031mode_hfcsx(struct BCState *bcs, int mode, int bc) 1031mode_hfcsx(struct BCState *bcs, int mode, int bc)
1032{ 1032{
1033 struct IsdnCardState *cs = bcs->cs; 1033 struct IsdnCardState *cs = bcs->cs;
@@ -1328,7 +1328,7 @@ hfcsx_bh(struct IsdnCardState *cs)
1328/********************************/ 1328/********************************/
1329/* called for card init message */ 1329/* called for card init message */
1330/********************************/ 1330/********************************/
1331void __devinit 1331static void __devinit
1332inithfcsx(struct IsdnCardState *cs) 1332inithfcsx(struct IsdnCardState *cs)
1333{ 1333{
1334 cs->setstack_d = setstack_hfcsx; 1334 cs->setstack_d = setstack_hfcsx;
diff --git a/drivers/isdn/hisax/hfc_sx.h b/drivers/isdn/hisax/hfc_sx.h
index 12f54159344a..6792f13dc220 100644
--- a/drivers/isdn/hisax/hfc_sx.h
+++ b/drivers/isdn/hisax/hfc_sx.h
@@ -193,5 +193,4 @@ struct hfcsx_extra {
193}; 193};
194 194
195extern void main_irq_hfcsx(struct BCState *bcs); 195extern void main_irq_hfcsx(struct BCState *bcs);
196extern void inithfcsx(struct IsdnCardState *cs);
197extern void releasehfcsx(struct IsdnCardState *cs); 196extern void releasehfcsx(struct IsdnCardState *cs);
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index ffd74b84f502..e2c3af49d72b 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -60,7 +60,7 @@ static const char *hfcusb_revision =
60#include "hisax_debug.h" 60#include "hisax_debug.h"
61static u_int debug; 61static u_int debug;
62module_param(debug, uint, 0); 62module_param(debug, uint, 0);
63int hfc_debug; 63static int hfc_debug;
64#endif 64#endif
65 65
66 66
@@ -85,7 +85,7 @@ static struct usb_device_id hfc_usb_idtab[] = {
85* VendorID, ProductID, Devicename, LED_SCHEME, 85* VendorID, ProductID, Devicename, LED_SCHEME,
86* LED's BitMask in HFCUSB_P_DATA Register : LED_USB, LED_S0, LED_B1, LED_B2 86* LED's BitMask in HFCUSB_P_DATA Register : LED_USB, LED_S0, LED_B1, LED_B2
87*/ 87*/
88vendor_data vdata[] = { 88static vendor_data vdata[] = {
89 /* CologneChip Eval TA */ 89 /* CologneChip Eval TA */
90 {0x0959, 0x2bd0, "ISDN USB TA (Cologne Chip HFC-S USB based)", 90 {0x0959, 0x2bd0, "ISDN USB TA (Cologne Chip HFC-S USB based)",
91 LED_OFF, {4, 0, 2, 1} 91 LED_OFF, {4, 0, 2, 1}
@@ -1137,7 +1137,7 @@ set_hfcmode(hfcusb_data * hfc, int channel, int mode)
1137 } 1137 }
1138} 1138}
1139 1139
1140void 1140static void
1141hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg) 1141hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg)
1142{ 1142{
1143 usb_fifo *fifo = my_hisax_if->priv; 1143 usb_fifo *fifo = my_hisax_if->priv;
diff --git a/drivers/isdn/hisax/hfc_usb.h b/drivers/isdn/hisax/hfc_usb.h
index b171600cf641..280dd29b30d6 100644
--- a/drivers/isdn/hisax/hfc_usb.h
+++ b/drivers/isdn/hisax/hfc_usb.h
@@ -168,7 +168,7 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
168* 3 entries are the configuration number, the minimum interval for 168* 3 entries are the configuration number, the minimum interval for
169* Interrupt endpoints & boolean if E-channel logging possible 169* Interrupt endpoints & boolean if E-channel logging possible
170*/ 170*/
171int validconf[][19] = { 171static int validconf[][19] = {
172 // INT in, ISO out config 172 // INT in, ISO out config
173 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT, 173 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT,
174 EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL, 174 EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL,
@@ -187,7 +187,7 @@ int validconf[][19] = {
187}; 187};
188 188
189// string description of chosen config 189// string description of chosen config
190char *conf_str[] = { 190static char *conf_str[] = {
191 "4 Interrupt IN + 3 Isochron OUT", 191 "4 Interrupt IN + 3 Isochron OUT",
192 "3 Interrupt IN + 3 Isochron OUT", 192 "3 Interrupt IN + 3 Isochron OUT",
193 "4 Isochron IN + 3 Isochron OUT", 193 "4 Isochron IN + 3 Isochron OUT",
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c
index 6fc55fea1702..86ab1c13f6b1 100644
--- a/drivers/isdn/hisax/hfcscard.c
+++ b/drivers/isdn/hisax/hfcscard.c
@@ -52,7 +52,7 @@ hfcs_Timer(struct IsdnCardState *cs)
52*/ 52*/
53} 53}
54 54
55void 55static void
56release_io_hfcs(struct IsdnCardState *cs) 56release_io_hfcs(struct IsdnCardState *cs)
57{ 57{
58 release2bds0(cs); 58 release2bds0(cs);
diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h
index dc5791728d53..17cf7663c582 100644
--- a/drivers/isdn/hisax/hisax.h
+++ b/drivers/isdn/hisax/hisax.h
@@ -1271,7 +1271,6 @@ extern void Logl2Frame(struct IsdnCardState *cs, struct sk_buff *skb, char *buf,
1271void init_bcstate(struct IsdnCardState *cs, int bc); 1271void init_bcstate(struct IsdnCardState *cs, int bc);
1272 1272
1273void setstack_HiSax(struct PStack *st, struct IsdnCardState *cs); 1273void setstack_HiSax(struct PStack *st, struct IsdnCardState *cs);
1274unsigned int random_ri(void);
1275void HiSax_addlist(struct IsdnCardState *sp, struct PStack *st); 1274void HiSax_addlist(struct IsdnCardState *sp, struct PStack *st);
1276void HiSax_rmlist(struct IsdnCardState *sp, struct PStack *st); 1275void HiSax_rmlist(struct IsdnCardState *sp, struct PStack *st);
1277 1276
@@ -1315,15 +1314,11 @@ int QuickHex(char *txt, u_char * p, int cnt);
1315void LogFrame(struct IsdnCardState *cs, u_char * p, int size); 1314void LogFrame(struct IsdnCardState *cs, u_char * p, int size);
1316void dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir); 1315void dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir);
1317void iecpy(u_char * dest, u_char * iestart, int ieoffset); 1316void iecpy(u_char * dest, u_char * iestart, int ieoffset);
1318#ifdef ISDN_CHIP_ISAC
1319void setstack_isac(struct PStack *st, struct IsdnCardState *cs);
1320#endif /* ISDN_CHIP_ISAC */
1321#endif /* __KERNEL__ */ 1317#endif /* __KERNEL__ */
1322 1318
1323#define HZDELAY(jiffs) {int tout = jiffs; while (tout--) udelay(1000000/HZ);} 1319#define HZDELAY(jiffs) {int tout = jiffs; while (tout--) udelay(1000000/HZ);}
1324 1320
1325int ll_run(struct IsdnCardState *cs, int addfeatures); 1321int ll_run(struct IsdnCardState *cs, int addfeatures);
1326void ll_stop(struct IsdnCardState *cs);
1327int CallcNew(void); 1322int CallcNew(void);
1328void CallcFree(void); 1323void CallcFree(void);
1329int CallcNewChan(struct IsdnCardState *cs); 1324int CallcNewChan(struct IsdnCardState *cs);
diff --git a/drivers/isdn/hisax/hscx.c b/drivers/isdn/hisax/hscx.c
index 5bbbe3e95125..66dbaee77bfb 100644
--- a/drivers/isdn/hisax/hscx.c
+++ b/drivers/isdn/hisax/hscx.c
@@ -151,7 +151,7 @@ hscx_l2l1(struct PStack *st, int pr, void *arg)
151 } 151 }
152} 152}
153 153
154void 154static void
155close_hscxstate(struct BCState *bcs) 155close_hscxstate(struct BCState *bcs)
156{ 156{
157 modehscx(bcs, 0, bcs->channel); 157 modehscx(bcs, 0, bcs->channel);
@@ -203,7 +203,7 @@ open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs)
203 return (0); 203 return (0);
204} 204}
205 205
206int 206static int
207setstack_hscx(struct PStack *st, struct BCState *bcs) 207setstack_hscx(struct PStack *st, struct BCState *bcs)
208{ 208{
209 bcs->channel = st->l1.bc; 209 bcs->channel = st->l1.bc;
diff --git a/drivers/isdn/hisax/icc.c b/drivers/isdn/hisax/icc.c
index dcf31f83c600..b4ca5859b177 100644
--- a/drivers/isdn/hisax/icc.c
+++ b/drivers/isdn/hisax/icc.c
@@ -108,7 +108,7 @@ icc_bh(struct IsdnCardState *cs)
108#endif 108#endif
109} 109}
110 110
111void 111static void
112icc_empty_fifo(struct IsdnCardState *cs, int count) 112icc_empty_fifo(struct IsdnCardState *cs, int count)
113{ 113{
114 u_char *ptr; 114 u_char *ptr;
@@ -563,13 +563,13 @@ ICC_l1hw(struct PStack *st, int pr, void *arg)
563 } 563 }
564} 564}
565 565
566void 566static void
567setstack_icc(struct PStack *st, struct IsdnCardState *cs) 567setstack_icc(struct PStack *st, struct IsdnCardState *cs)
568{ 568{
569 st->l1.l1hw = ICC_l1hw; 569 st->l1.l1hw = ICC_l1hw;
570} 570}
571 571
572void 572static void
573DC_Close_icc(struct IsdnCardState *cs) { 573DC_Close_icc(struct IsdnCardState *cs) {
574 if (cs->dc.icc.mon_rx) { 574 if (cs->dc.icc.mon_rx) {
575 kfree(cs->dc.icc.mon_rx); 575 kfree(cs->dc.icc.mon_rx);
diff --git a/drivers/isdn/hisax/ipacx.c b/drivers/isdn/hisax/ipacx.c
index 6485e232d869..efba2f448017 100644
--- a/drivers/isdn/hisax/ipacx.c
+++ b/drivers/isdn/hisax/ipacx.c
@@ -36,8 +36,6 @@ static void ph_command(struct IsdnCardState *cs, unsigned int command);
36static inline void cic_int(struct IsdnCardState *cs); 36static inline void cic_int(struct IsdnCardState *cs);
37static void dch_l2l1(struct PStack *st, int pr, void *arg); 37static void dch_l2l1(struct PStack *st, int pr, void *arg);
38static void dbusy_timer_handler(struct IsdnCardState *cs); 38static void dbusy_timer_handler(struct IsdnCardState *cs);
39static void ipacx_new_ph(struct IsdnCardState *cs);
40static void dch_bh(struct IsdnCardState *cs);
41static void dch_empty_fifo(struct IsdnCardState *cs, int count); 39static void dch_empty_fifo(struct IsdnCardState *cs, int count);
42static void dch_fill_fifo(struct IsdnCardState *cs); 40static void dch_fill_fifo(struct IsdnCardState *cs);
43static inline void dch_int(struct IsdnCardState *cs); 41static inline void dch_int(struct IsdnCardState *cs);
@@ -232,81 +230,6 @@ dbusy_timer_handler(struct IsdnCardState *cs)
232} 230}
233 231
234//---------------------------------------------------------- 232//----------------------------------------------------------
235// L1 state machine intermediate layer to isdnl1 module
236//----------------------------------------------------------
237static void
238ipacx_new_ph(struct IsdnCardState *cs)
239{
240 switch (cs->dc.isac.ph_state) {
241 case (IPACX_IND_RES):
242 ph_command(cs, IPACX_CMD_DI);
243 l1_msg(cs, HW_RESET | INDICATION, NULL);
244 break;
245
246 case (IPACX_IND_DC):
247 l1_msg(cs, HW_DEACTIVATE | CONFIRM, NULL);
248 break;
249
250 case (IPACX_IND_DR):
251 l1_msg(cs, HW_DEACTIVATE | INDICATION, NULL);
252 break;
253
254 case (IPACX_IND_PU):
255 l1_msg(cs, HW_POWERUP | CONFIRM, NULL);
256 break;
257
258 case (IPACX_IND_RSY):
259 l1_msg(cs, HW_RSYNC | INDICATION, NULL);
260 break;
261
262 case (IPACX_IND_AR):
263 l1_msg(cs, HW_INFO2 | INDICATION, NULL);
264 break;
265
266 case (IPACX_IND_AI8):
267 l1_msg(cs, HW_INFO4_P8 | INDICATION, NULL);
268 break;
269
270 case (IPACX_IND_AI10):
271 l1_msg(cs, HW_INFO4_P10 | INDICATION, NULL);
272 break;
273
274 default:
275 break;
276 }
277}
278
279//----------------------------------------------------------
280// bottom half handler for D channel
281//----------------------------------------------------------
282static void
283dch_bh(struct IsdnCardState *cs)
284{
285 struct PStack *st;
286
287 if (!cs) return;
288
289 if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) {
290 if (cs->debug) debugl1(cs, "D-Channel Busy cleared");
291 for (st = cs->stlist; st; st = st->next) {
292 st->l1.l1l2(st, PH_PAUSE | CONFIRM, NULL);
293 }
294 }
295
296 if (test_and_clear_bit(D_RCVBUFREADY, &cs->event)) {
297 DChannel_proc_rcv(cs);
298 }
299
300 if (test_and_clear_bit(D_XMTBUFREADY, &cs->event)) {
301 DChannel_proc_xmt(cs);
302 }
303
304 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
305 ipacx_new_ph(cs);
306 }
307}
308
309//----------------------------------------------------------
310// Fill buffer from receive FIFO 233// Fill buffer from receive FIFO
311//---------------------------------------------------------- 234//----------------------------------------------------------
312static void 235static void
@@ -991,14 +914,5 @@ init_ipacx(struct IsdnCardState *cs, int part)
991 } 914 }
992} 915}
993 916
994
995void __devinit
996setup_ipacx(struct IsdnCardState *cs)
997{
998 INIT_WORK(&cs->tqueue, (void *)(void *) dch_bh, cs);
999 cs->dbusytimer.function = (void *) dbusy_timer_handler;
1000 cs->dbusytimer.data = (long) cs;
1001 init_timer(&cs->dbusytimer);
1002}
1003//----------------- end of file ----------------------- 917//----------------- end of file -----------------------
1004 918
diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c
index 20b949952952..85e063a08d23 100644
--- a/drivers/isdn/hisax/isac.c
+++ b/drivers/isdn/hisax/isac.c
@@ -112,7 +112,7 @@ isac_bh(struct IsdnCardState *cs)
112#endif 112#endif
113} 113}
114 114
115void 115static void
116isac_empty_fifo(struct IsdnCardState *cs, int count) 116isac_empty_fifo(struct IsdnCardState *cs, int count)
117{ 117{
118 u_char *ptr; 118 u_char *ptr;
@@ -563,13 +563,13 @@ ISAC_l1hw(struct PStack *st, int pr, void *arg)
563 } 563 }
564} 564}
565 565
566void 566static void
567setstack_isac(struct PStack *st, struct IsdnCardState *cs) 567setstack_isac(struct PStack *st, struct IsdnCardState *cs)
568{ 568{
569 st->l1.l1hw = ISAC_l1hw; 569 st->l1.l1hw = ISAC_l1hw;
570} 570}
571 571
572void 572static void
573DC_Close_isac(struct IsdnCardState *cs) { 573DC_Close_isac(struct IsdnCardState *cs) {
574 if (cs->dc.isac.mon_rx) { 574 if (cs->dc.isac.mon_rx) {
575 kfree(cs->dc.isac.mon_rx); 575 kfree(cs->dc.isac.mon_rx);
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c
index ee081321efb2..642a87c51295 100644
--- a/drivers/isdn/hisax/isar.c
+++ b/drivers/isdn/hisax/isar.c
@@ -21,13 +21,13 @@
21#define ETX 0x03 21#define ETX 0x03
22 22
23#define FAXMODCNT 13 23#define FAXMODCNT 13
24const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146}; 24static const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146};
25static u_int modmask = 0x1fff; 25static u_int modmask = 0x1fff;
26static int frm_extra_delay = 2; 26static int frm_extra_delay = 2;
27static int para_TOA = 6; 27static int para_TOA = 6;
28const u_char *FC1_CMD[] = {"FAE", "FTS", "FRS", "FTM", "FRM", "FTH", "FRH", "CTRL" }; 28static const u_char *FC1_CMD[] = {"FAE", "FTS", "FRS", "FTM", "FRM", "FTH", "FRH", "CTRL" };
29 29
30void isar_setup(struct IsdnCardState *cs); 30static void isar_setup(struct IsdnCardState *cs);
31static void isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para); 31static void isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para);
32static void ll_deliver_faxstat(struct BCState *bcs, u_char status); 32static void ll_deliver_faxstat(struct BCState *bcs, u_char status);
33 33
@@ -45,7 +45,7 @@ waitforHIA(struct IsdnCardState *cs, int timeout)
45} 45}
46 46
47 47
48int 48static int
49sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len, 49sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len,
50 u_char *msg) 50 u_char *msg)
51{ 51{
@@ -85,7 +85,7 @@ sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len,
85} 85}
86 86
87/* Call only with IRQ disabled !!! */ 87/* Call only with IRQ disabled !!! */
88inline void 88static inline void
89rcv_mbox(struct IsdnCardState *cs, struct isar_reg *ireg, u_char *msg) 89rcv_mbox(struct IsdnCardState *cs, struct isar_reg *ireg, u_char *msg)
90{ 90{
91 int i; 91 int i;
@@ -114,7 +114,7 @@ rcv_mbox(struct IsdnCardState *cs, struct isar_reg *ireg, u_char *msg)
114} 114}
115 115
116/* Call only with IRQ disabled !!! */ 116/* Call only with IRQ disabled !!! */
117inline void 117static inline void
118get_irq_infos(struct IsdnCardState *cs, struct isar_reg *ireg) 118get_irq_infos(struct IsdnCardState *cs, struct isar_reg *ireg)
119{ 119{
120 ireg->iis = cs->BC_Read_Reg(cs, 1, ISAR_IIS); 120 ireg->iis = cs->BC_Read_Reg(cs, 1, ISAR_IIS);
@@ -127,7 +127,7 @@ get_irq_infos(struct IsdnCardState *cs, struct isar_reg *ireg)
127#endif 127#endif
128} 128}
129 129
130int 130static int
131waitrecmsg(struct IsdnCardState *cs, u_char *len, 131waitrecmsg(struct IsdnCardState *cs, u_char *len,
132 u_char *msg, int maxdelay) 132 u_char *msg, int maxdelay)
133{ 133{
@@ -185,7 +185,7 @@ ISARVersion(struct IsdnCardState *cs, char *s)
185 return(ver); 185 return(ver);
186} 186}
187 187
188int 188static int
189isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf) 189isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf)
190{ 190{
191 int ret, size, cnt, debug; 191 int ret, size, cnt, debug;
@@ -739,7 +739,7 @@ isar_fill_fifo(struct BCState *bcs)
739 } 739 }
740} 740}
741 741
742inline 742static inline
743struct BCState *sel_bcs_isar(struct IsdnCardState *cs, u_char dpath) 743struct BCState *sel_bcs_isar(struct IsdnCardState *cs, u_char dpath)
744{ 744{
745 if ((!dpath) || (dpath == 3)) 745 if ((!dpath) || (dpath == 3))
@@ -751,7 +751,7 @@ struct BCState *sel_bcs_isar(struct IsdnCardState *cs, u_char dpath)
751 return(NULL); 751 return(NULL);
752} 752}
753 753
754void 754static void
755send_frames(struct BCState *bcs) 755send_frames(struct BCState *bcs)
756{ 756{
757 if (bcs->tx_skb) { 757 if (bcs->tx_skb) {
@@ -806,7 +806,7 @@ send_frames(struct BCState *bcs)
806 } 806 }
807} 807}
808 808
809inline void 809static inline void
810check_send(struct IsdnCardState *cs, u_char rdm) 810check_send(struct IsdnCardState *cs, u_char rdm)
811{ 811{
812 struct BCState *bcs; 812 struct BCState *bcs;
@@ -828,11 +828,13 @@ check_send(struct IsdnCardState *cs, u_char rdm)
828 828
829} 829}
830 830
831const char *dmril[] = {"NO SPEED", "1200/75", "NODEF2", "75/1200", "NODEF4", 831static const char *dmril[] = {"NO SPEED", "1200/75", "NODEF2", "75/1200",
832 "300", "600", "1200", "2400", "4800", "7200", 832 "NODEF4", "300", "600", "1200", "2400",
833 "9600nt", "9600t", "12000", "14400", "WRONG"}; 833 "4800", "7200", "9600nt", "9600t", "12000",
834const char *dmrim[] = {"NO MOD", "NO DEF", "V32/V32b", "V22", "V21", 834 "14400", "WRONG"};
835 "Bell103", "V23", "Bell202", "V17", "V29", "V27ter"}; 835static const char *dmrim[] = {"NO MOD", "NO DEF", "V32/V32b", "V22", "V21",
836 "Bell103", "V23", "Bell202", "V17", "V29",
837 "V27ter"};
836 838
837static void 839static void
838isar_pump_status_rsp(struct BCState *bcs, struct isar_reg *ireg) { 840isar_pump_status_rsp(struct BCState *bcs, struct isar_reg *ireg) {
@@ -1388,7 +1390,7 @@ setup_iom2(struct BCState *bcs) {
1388 udelay(1000); 1390 udelay(1000);
1389} 1391}
1390 1392
1391int 1393static int
1392modeisar(struct BCState *bcs, int mode, int bc) 1394modeisar(struct BCState *bcs, int mode, int bc)
1393{ 1395{
1394 struct IsdnCardState *cs = bcs->cs; 1396 struct IsdnCardState *cs = bcs->cs;
@@ -1562,7 +1564,7 @@ isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para)
1562 sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, ctrl, nom, &p1); 1564 sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, ctrl, nom, &p1);
1563} 1565}
1564 1566
1565void 1567static void
1566isar_setup(struct IsdnCardState *cs) 1568isar_setup(struct IsdnCardState *cs)
1567{ 1569{
1568 u_char msg; 1570 u_char msg;
@@ -1582,7 +1584,7 @@ isar_setup(struct IsdnCardState *cs)
1582 } 1584 }
1583} 1585}
1584 1586
1585void 1587static void
1586isar_l2l1(struct PStack *st, int pr, void *arg) 1588isar_l2l1(struct PStack *st, int pr, void *arg)
1587{ 1589{
1588 struct BCState *bcs = st->l1.bcs; 1590 struct BCState *bcs = st->l1.bcs;
@@ -1681,7 +1683,7 @@ isar_l2l1(struct PStack *st, int pr, void *arg)
1681 } 1683 }
1682} 1684}
1683 1685
1684void 1686static void
1685close_isarstate(struct BCState *bcs) 1687close_isarstate(struct BCState *bcs)
1686{ 1688{
1687 modeisar(bcs, 0, bcs->channel); 1689 modeisar(bcs, 0, bcs->channel);
@@ -1703,7 +1705,7 @@ close_isarstate(struct BCState *bcs)
1703 del_timer(&bcs->hw.isar.ftimer); 1705 del_timer(&bcs->hw.isar.ftimer);
1704} 1706}
1705 1707
1706int 1708static int
1707open_isarstate(struct IsdnCardState *cs, struct BCState *bcs) 1709open_isarstate(struct IsdnCardState *cs, struct BCState *bcs)
1708{ 1710{
1709 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { 1711 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
@@ -1725,7 +1727,7 @@ open_isarstate(struct IsdnCardState *cs, struct BCState *bcs)
1725 return (0); 1727 return (0);
1726} 1728}
1727 1729
1728int 1730static int
1729setstack_isar(struct PStack *st, struct BCState *bcs) 1731setstack_isar(struct PStack *st, struct BCState *bcs)
1730{ 1732{
1731 bcs->channel = st->l1.bc; 1733 bcs->channel = st->l1.bc;
diff --git a/drivers/isdn/hisax/isdnl1.c b/drivers/isdn/hisax/isdnl1.c
index 4d08d27f1499..ac899503a74f 100644
--- a/drivers/isdn/hisax/isdnl1.c
+++ b/drivers/isdn/hisax/isdnl1.c
@@ -151,7 +151,7 @@ l1m_debug(struct FsmInst *fi, char *fmt, ...)
151 va_end(args); 151 va_end(args);
152} 152}
153 153
154void 154static void
155L1activated(struct IsdnCardState *cs) 155L1activated(struct IsdnCardState *cs)
156{ 156{
157 struct PStack *st; 157 struct PStack *st;
@@ -166,7 +166,7 @@ L1activated(struct IsdnCardState *cs)
166 } 166 }
167} 167}
168 168
169void 169static void
170L1deactivated(struct IsdnCardState *cs) 170L1deactivated(struct IsdnCardState *cs)
171{ 171{
172 struct PStack *st; 172 struct PStack *st;
@@ -370,7 +370,7 @@ init_bcstate(struct IsdnCardState *cs, int bc)
370 370
371#ifdef L2FRAME_DEBUG /* psa */ 371#ifdef L2FRAME_DEBUG /* psa */
372 372
373char * 373static char *
374l2cmd(u_char cmd) 374l2cmd(u_char cmd)
375{ 375{
376 switch (cmd & ~0x10) { 376 switch (cmd & ~0x10) {
@@ -404,7 +404,7 @@ l2cmd(u_char cmd)
404 404
405static char tmpdeb[32]; 405static char tmpdeb[32];
406 406
407char * 407static char *
408l2frames(u_char * ptr) 408l2frames(u_char * ptr)
409{ 409{
410 switch (ptr[2] & ~0x10) { 410 switch (ptr[2] & ~0x10) {
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c
index d311b5fbf895..9022583fd6a0 100644
--- a/drivers/isdn/hisax/isdnl2.c
+++ b/drivers/isdn/hisax/isdnl2.c
@@ -142,7 +142,7 @@ freewin1(struct Layer2 *l2)
142 return cnt; 142 return cnt;
143} 143}
144 144
145inline void 145static inline void
146freewin(struct PStack *st) 146freewin(struct PStack *st)
147{ 147{
148 freewin1(&st->l2); 148 freewin1(&st->l2);
@@ -157,7 +157,7 @@ ReleaseWin(struct Layer2 *l2)
157 printk(KERN_WARNING "isdl2 freed %d skbuffs in release\n", cnt); 157 printk(KERN_WARNING "isdl2 freed %d skbuffs in release\n", cnt);
158} 158}
159 159
160inline unsigned int 160static inline unsigned int
161cansend(struct PStack *st) 161cansend(struct PStack *st)
162{ 162{
163 unsigned int p1; 163 unsigned int p1;
@@ -169,7 +169,7 @@ cansend(struct PStack *st)
169 return ((p1 < st->l2.window) && !test_bit(FLG_PEER_BUSY, &st->l2.flag)); 169 return ((p1 < st->l2.window) && !test_bit(FLG_PEER_BUSY, &st->l2.flag));
170} 170}
171 171
172inline void 172static inline void
173clear_exception(struct Layer2 *l2) 173clear_exception(struct Layer2 *l2)
174{ 174{
175 test_and_clear_bit(FLG_ACK_PEND, &l2->flag); 175 test_and_clear_bit(FLG_ACK_PEND, &l2->flag);
@@ -178,7 +178,7 @@ clear_exception(struct Layer2 *l2)
178 clear_peer_busy(l2); 178 clear_peer_busy(l2);
179} 179}
180 180
181inline int 181static inline int
182l2headersize(struct Layer2 *l2, int ui) 182l2headersize(struct Layer2 *l2, int ui)
183{ 183{
184 return (((test_bit(FLG_MOD128, &l2->flag) && (!ui)) ? 2 : 1) + 184 return (((test_bit(FLG_MOD128, &l2->flag) && (!ui)) ? 2 : 1) +
@@ -223,40 +223,31 @@ enqueue_super(struct PStack *st,
223 223
224#define enqueue_ui(a, b) enqueue_super(a, b) 224#define enqueue_ui(a, b) enqueue_super(a, b)
225 225
226inline int 226static inline int
227IsUI(u_char * data) 227IsUI(u_char * data)
228{ 228{
229 return ((data[0] & 0xef) == UI); 229 return ((data[0] & 0xef) == UI);
230} 230}
231 231
232inline int 232static inline int
233IsUA(u_char * data) 233IsUA(u_char * data)
234{ 234{
235 return ((data[0] & 0xef) == UA); 235 return ((data[0] & 0xef) == UA);
236} 236}
237 237
238inline int 238static inline int
239IsDM(u_char * data) 239IsDM(u_char * data)
240{ 240{
241 return ((data[0] & 0xef) == DM); 241 return ((data[0] & 0xef) == DM);
242} 242}
243 243
244inline int 244static inline int
245IsDISC(u_char * data) 245IsDISC(u_char * data)
246{ 246{
247 return ((data[0] & 0xef) == DISC); 247 return ((data[0] & 0xef) == DISC);
248} 248}
249 249
250inline int 250static inline int
251IsRR(u_char * data, struct PStack *st)
252{
253 if (test_bit(FLG_MOD128, &st->l2.flag))
254 return (data[0] == RR);
255 else
256 return ((data[0] & 0xf) == 1);
257}
258
259inline int
260IsSFrame(u_char * data, struct PStack *st) 251IsSFrame(u_char * data, struct PStack *st)
261{ 252{
262 register u_char d = *data; 253 register u_char d = *data;
@@ -266,7 +257,7 @@ IsSFrame(u_char * data, struct PStack *st)
266 return(((d & 0xf3) == 1) && ((d & 0x0c) != 0x0c)); 257 return(((d & 0xf3) == 1) && ((d & 0x0c) != 0x0c));
267} 258}
268 259
269inline int 260static inline int
270IsSABME(u_char * data, struct PStack *st) 261IsSABME(u_char * data, struct PStack *st)
271{ 262{
272 u_char d = data[0] & ~0x10; 263 u_char d = data[0] & ~0x10;
@@ -274,25 +265,25 @@ IsSABME(u_char * data, struct PStack *st)
274 return (test_bit(FLG_MOD128, &st->l2.flag) ? d == SABME : d == SABM); 265 return (test_bit(FLG_MOD128, &st->l2.flag) ? d == SABME : d == SABM);
275} 266}
276 267
277inline int 268static inline int
278IsREJ(u_char * data, struct PStack *st) 269IsREJ(u_char * data, struct PStack *st)
279{ 270{
280 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == REJ : (data[0] & 0xf) == REJ); 271 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == REJ : (data[0] & 0xf) == REJ);
281} 272}
282 273
283inline int 274static inline int
284IsFRMR(u_char * data) 275IsFRMR(u_char * data)
285{ 276{
286 return ((data[0] & 0xef) == FRMR); 277 return ((data[0] & 0xef) == FRMR);
287} 278}
288 279
289inline int 280static inline int
290IsRNR(u_char * data, struct PStack *st) 281IsRNR(u_char * data, struct PStack *st)
291{ 282{
292 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == RNR : (data[0] & 0xf) == RNR); 283 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == RNR : (data[0] & 0xf) == RNR);
293} 284}
294 285
295int 286static int
296iframe_error(struct PStack *st, struct sk_buff *skb) 287iframe_error(struct PStack *st, struct sk_buff *skb)
297{ 288{
298 int i = l2addrsize(&st->l2) + (test_bit(FLG_MOD128, &st->l2.flag) ? 2 : 1); 289 int i = l2addrsize(&st->l2) + (test_bit(FLG_MOD128, &st->l2.flag) ? 2 : 1);
@@ -315,7 +306,7 @@ iframe_error(struct PStack *st, struct sk_buff *skb)
315 return 0; 306 return 0;
316} 307}
317 308
318int 309static int
319super_error(struct PStack *st, struct sk_buff *skb) 310super_error(struct PStack *st, struct sk_buff *skb)
320{ 311{
321 if (skb->len != l2addrsize(&st->l2) + 312 if (skb->len != l2addrsize(&st->l2) +
@@ -325,7 +316,7 @@ super_error(struct PStack *st, struct sk_buff *skb)
325 return 0; 316 return 0;
326} 317}
327 318
328int 319static int
329unnum_error(struct PStack *st, struct sk_buff *skb, int wantrsp) 320unnum_error(struct PStack *st, struct sk_buff *skb, int wantrsp)
330{ 321{
331 int rsp = (*skb->data & 0x2) >> 1; 322 int rsp = (*skb->data & 0x2) >> 1;
@@ -341,7 +332,7 @@ unnum_error(struct PStack *st, struct sk_buff *skb, int wantrsp)
341 return 0; 332 return 0;
342} 333}
343 334
344int 335static int
345UI_error(struct PStack *st, struct sk_buff *skb) 336UI_error(struct PStack *st, struct sk_buff *skb)
346{ 337{
347 int rsp = *skb->data & 0x2; 338 int rsp = *skb->data & 0x2;
@@ -357,7 +348,7 @@ UI_error(struct PStack *st, struct sk_buff *skb)
357 return 0; 348 return 0;
358} 349}
359 350
360int 351static int
361FRMR_error(struct PStack *st, struct sk_buff *skb) 352FRMR_error(struct PStack *st, struct sk_buff *skb)
362{ 353{
363 int headers = l2addrsize(&st->l2) + 1; 354 int headers = l2addrsize(&st->l2) + 1;
@@ -444,51 +435,44 @@ send_uframe(struct PStack *st, u_char cmd, u_char cr)
444 enqueue_super(st, skb); 435 enqueue_super(st, skb);
445} 436}
446 437
447inline u_char 438static inline u_char
448get_PollFlag(struct PStack * st, struct sk_buff * skb) 439get_PollFlag(struct PStack * st, struct sk_buff * skb)
449{ 440{
450 return (skb->data[l2addrsize(&(st->l2))] & 0x10); 441 return (skb->data[l2addrsize(&(st->l2))] & 0x10);
451} 442}
452 443
453inline void 444static inline u_char
454FreeSkb(struct sk_buff *skb)
455{
456 dev_kfree_skb(skb);
457}
458
459
460inline u_char
461get_PollFlagFree(struct PStack *st, struct sk_buff *skb) 445get_PollFlagFree(struct PStack *st, struct sk_buff *skb)
462{ 446{
463 u_char PF; 447 u_char PF;
464 448
465 PF = get_PollFlag(st, skb); 449 PF = get_PollFlag(st, skb);
466 FreeSkb(skb); 450 dev_kfree_skb(skb);
467 return (PF); 451 return (PF);
468} 452}
469 453
470inline void 454static inline void
471start_t200(struct PStack *st, int i) 455start_t200(struct PStack *st, int i)
472{ 456{
473 FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i); 457 FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i);
474 test_and_set_bit(FLG_T200_RUN, &st->l2.flag); 458 test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
475} 459}
476 460
477inline void 461static inline void
478restart_t200(struct PStack *st, int i) 462restart_t200(struct PStack *st, int i)
479{ 463{
480 FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i); 464 FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i);
481 test_and_set_bit(FLG_T200_RUN, &st->l2.flag); 465 test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
482} 466}
483 467
484inline void 468static inline void
485stop_t200(struct PStack *st, int i) 469stop_t200(struct PStack *st, int i)
486{ 470{
487 if(test_and_clear_bit(FLG_T200_RUN, &st->l2.flag)) 471 if(test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
488 FsmDelTimer(&st->l2.t200, i); 472 FsmDelTimer(&st->l2.t200, i);
489} 473}
490 474
491inline void 475static inline void
492st5_dl_release_l2l3(struct PStack *st) 476st5_dl_release_l2l3(struct PStack *st)
493{ 477{
494 int pr; 478 int pr;
@@ -501,7 +485,7 @@ st5_dl_release_l2l3(struct PStack *st)
501 st->l2.l2l3(st, pr, NULL); 485 st->l2.l2l3(st, pr, NULL);
502} 486}
503 487
504inline void 488static inline void
505lapb_dl_release_l2l3(struct PStack *st, int f) 489lapb_dl_release_l2l3(struct PStack *st, int f)
506{ 490{
507 if (test_bit(FLG_LAPB, &st->l2.flag)) 491 if (test_bit(FLG_LAPB, &st->l2.flag))
@@ -802,7 +786,7 @@ l2_connected(struct FsmInst *fi, int event, void *arg)
802 l2_mdl_error_ua(fi, event, arg); 786 l2_mdl_error_ua(fi, event, arg);
803 return; 787 return;
804 } 788 }
805 FreeSkb(skb); 789 dev_kfree_skb(skb);
806 790
807 if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag)) 791 if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag))
808 l2_disconnect(fi, event, arg); 792 l2_disconnect(fi, event, arg);
@@ -840,7 +824,7 @@ l2_released(struct FsmInst *fi, int event, void *arg)
840 l2_mdl_error_ua(fi, event, arg); 824 l2_mdl_error_ua(fi, event, arg);
841 return; 825 return;
842 } 826 }
843 FreeSkb(skb); 827 dev_kfree_skb(skb);
844 828
845 stop_t200(st, 6); 829 stop_t200(st, 6);
846 lapb_dl_release_l2l3(st, CONFIRM); 830 lapb_dl_release_l2l3(st, CONFIRM);
@@ -889,7 +873,7 @@ l2_st6_dm_release(struct FsmInst *fi, int event, void *arg)
889 } 873 }
890} 874}
891 875
892inline void 876static inline void
893enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf) 877enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf)
894{ 878{
895 struct sk_buff *skb; 879 struct sk_buff *skb;
@@ -912,7 +896,7 @@ enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf)
912 enqueue_super(st, skb); 896 enqueue_super(st, skb);
913} 897}
914 898
915inline void 899static inline void
916enquiry_response(struct PStack *st) 900enquiry_response(struct PStack *st)
917{ 901{
918 if (test_bit(FLG_OWN_BUSY, &st->l2.flag)) 902 if (test_bit(FLG_OWN_BUSY, &st->l2.flag))
@@ -922,7 +906,7 @@ enquiry_response(struct PStack *st)
922 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); 906 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
923} 907}
924 908
925inline void 909static inline void
926transmit_enquiry(struct PStack *st) 910transmit_enquiry(struct PStack *st)
927{ 911{
928 if (test_bit(FLG_OWN_BUSY, &st->l2.flag)) 912 if (test_bit(FLG_OWN_BUSY, &st->l2.flag))
@@ -1004,7 +988,7 @@ l2_st7_got_super(struct FsmInst *fi, int event, void *arg)
1004 PollFlag = (skb->data[0] & 0x10); 988 PollFlag = (skb->data[0] & 0x10);
1005 nr = (skb->data[0] >> 5) & 0x7; 989 nr = (skb->data[0] >> 5) & 0x7;
1006 } 990 }
1007 FreeSkb(skb); 991 dev_kfree_skb(skb);
1008 992
1009 if (PollFlag) { 993 if (PollFlag) {
1010 if (rsp) 994 if (rsp)
@@ -1047,7 +1031,7 @@ l2_feed_i_if_reest(struct FsmInst *fi, int event, void *arg)
1047 if (!test_bit(FLG_L3_INIT, &st->l2.flag)) 1031 if (!test_bit(FLG_L3_INIT, &st->l2.flag))
1048 skb_queue_tail(&st->l2.i_queue, skb); 1032 skb_queue_tail(&st->l2.i_queue, skb);
1049 else 1033 else
1050 FreeSkb(skb); 1034 dev_kfree_skb(skb);
1051} 1035}
1052 1036
1053static void 1037static void
@@ -1093,7 +1077,7 @@ l2_got_iframe(struct FsmInst *fi, int event, void *arg)
1093 nr = (skb->data[i] >> 5) & 0x7; 1077 nr = (skb->data[i] >> 5) & 0x7;
1094 } 1078 }
1095 if (test_bit(FLG_OWN_BUSY, &l2->flag)) { 1079 if (test_bit(FLG_OWN_BUSY, &l2->flag)) {
1096 FreeSkb(skb); 1080 dev_kfree_skb(skb);
1097 if(PollFlag) enquiry_response(st); 1081 if(PollFlag) enquiry_response(st);
1098 } else if (l2->vr == ns) { 1082 } else if (l2->vr == ns) {
1099 (l2->vr)++; 1083 (l2->vr)++;
@@ -1111,7 +1095,7 @@ l2_got_iframe(struct FsmInst *fi, int event, void *arg)
1111 st->l2.l2l3(st, DL_DATA | INDICATION, skb); 1095 st->l2.l2l3(st, DL_DATA | INDICATION, skb);
1112 } else { 1096 } else {
1113 /* n(s)!=v(r) */ 1097 /* n(s)!=v(r) */
1114 FreeSkb(skb); 1098 dev_kfree_skb(skb);
1115 if (test_and_set_bit(FLG_REJEXC, &l2->flag)) { 1099 if (test_and_set_bit(FLG_REJEXC, &l2->flag)) {
1116 if (PollFlag) 1100 if (PollFlag)
1117 enquiry_response(st); 1101 enquiry_response(st);
@@ -1309,7 +1293,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
1309 skb = alloc_skb(oskb->len + i, GFP_ATOMIC); 1293 skb = alloc_skb(oskb->len + i, GFP_ATOMIC);
1310 memcpy(skb_put(skb, i), header, i); 1294 memcpy(skb_put(skb, i), header, i);
1311 memcpy(skb_put(skb, oskb->len), oskb->data, oskb->len); 1295 memcpy(skb_put(skb, oskb->len), oskb->data, oskb->len);
1312 FreeSkb(oskb); 1296 dev_kfree_skb(oskb);
1313 } 1297 }
1314 st->l2.l2l1(st, PH_PULL | INDICATION, skb); 1298 st->l2.l2l1(st, PH_PULL | INDICATION, skb);
1315 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); 1299 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
@@ -1349,7 +1333,7 @@ l2_st8_got_super(struct FsmInst *fi, int event, void *arg)
1349 PollFlag = (skb->data[0] & 0x10); 1333 PollFlag = (skb->data[0] & 0x10);
1350 nr = (skb->data[0] >> 5) & 0x7; 1334 nr = (skb->data[0] >> 5) & 0x7;
1351 } 1335 }
1352 FreeSkb(skb); 1336 dev_kfree_skb(skb);
1353 1337
1354 if (rsp && PollFlag) { 1338 if (rsp && PollFlag) {
1355 if (legalnr(st, nr)) { 1339 if (legalnr(st, nr)) {
@@ -1391,7 +1375,7 @@ l2_got_FRMR(struct FsmInst *fi, int event, void *arg)
1391 establishlink(fi); 1375 establishlink(fi);
1392 test_and_clear_bit(FLG_L3_INIT, &st->l2.flag); 1376 test_and_clear_bit(FLG_L3_INIT, &st->l2.flag);
1393 } 1377 }
1394 FreeSkb(skb); 1378 dev_kfree_skb(skb);
1395} 1379}
1396 1380
1397static void 1381static void
@@ -1655,7 +1639,7 @@ isdnl2_l1l2(struct PStack *st, int pr, void *arg)
1655 datap += len; 1639 datap += len;
1656 else { 1640 else {
1657 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'N'); 1641 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'N');
1658 FreeSkb(skb); 1642 dev_kfree_skb(skb);
1659 return; 1643 return;
1660 } 1644 }
1661 if (!(*datap & 1)) { /* I-Frame */ 1645 if (!(*datap & 1)) { /* I-Frame */
@@ -1684,16 +1668,16 @@ isdnl2_l1l2(struct PStack *st, int pr, void *arg)
1684 ret = FsmEvent(&st->l2.l2m, EV_L2_FRMR, skb); 1668 ret = FsmEvent(&st->l2.l2m, EV_L2_FRMR, skb);
1685 } else { 1669 } else {
1686 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'L'); 1670 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'L');
1687 FreeSkb(skb); 1671 dev_kfree_skb(skb);
1688 ret = 0; 1672 ret = 0;
1689 } 1673 }
1690 if(c) { 1674 if(c) {
1691 FreeSkb(skb); 1675 dev_kfree_skb(skb);
1692 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *)(long)c); 1676 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *)(long)c);
1693 ret = 0; 1677 ret = 0;
1694 } 1678 }
1695 if (ret) 1679 if (ret)
1696 FreeSkb(skb); 1680 dev_kfree_skb(skb);
1697 break; 1681 break;
1698 case (PH_PULL | CONFIRM): 1682 case (PH_PULL | CONFIRM):
1699 FsmEvent(&st->l2.l2m, EV_L2_ACK_PULL, arg); 1683 FsmEvent(&st->l2.l2m, EV_L2_ACK_PULL, arg);
diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c
index f571b5d18e91..abcc9530eb34 100644
--- a/drivers/isdn/hisax/isdnl3.c
+++ b/drivers/isdn/hisax/isdnl3.c
@@ -390,7 +390,7 @@ setstack_l3dc(struct PStack *st, struct Channel *chanp)
390 } 390 }
391} 391}
392 392
393void 393static void
394isdnl3_trans(struct PStack *st, int pr, void *arg) { 394isdnl3_trans(struct PStack *st, int pr, void *arg) {
395 st->l3.l3l2(st, pr, arg); 395 st->l3.l3l2(st, pr, arg);
396} 396}
diff --git a/drivers/isdn/hisax/isurf.c b/drivers/isdn/hisax/isurf.c
index af5171da7345..33747afc984d 100644
--- a/drivers/isdn/hisax/isurf.c
+++ b/drivers/isdn/hisax/isurf.c
@@ -122,7 +122,7 @@ isurf_interrupt(int intno, void *dev_id, struct pt_regs *regs)
122 return IRQ_HANDLED; 122 return IRQ_HANDLED;
123} 123}
124 124
125void 125static void
126release_io_isurf(struct IsdnCardState *cs) 126release_io_isurf(struct IsdnCardState *cs)
127{ 127{
128 release_region(cs->hw.isurf.reset, 1); 128 release_region(cs->hw.isurf.reset, 1);
diff --git a/drivers/isdn/hisax/ix1_micro.c b/drivers/isdn/hisax/ix1_micro.c
index b843b7509ae2..908a7e144421 100644
--- a/drivers/isdn/hisax/ix1_micro.c
+++ b/drivers/isdn/hisax/ix1_micro.c
@@ -25,7 +25,7 @@
25#include "isdnl1.h" 25#include "isdnl1.h"
26 26
27extern const char *CardType[]; 27extern const char *CardType[];
28const char *ix1_revision = "$Revision: 2.12.2.4 $"; 28static const char *ix1_revision = "$Revision: 2.12.2.4 $";
29 29
30#define byteout(addr,val) outb(val,addr) 30#define byteout(addr,val) outb(val,addr)
31#define bytein(addr) inb(addr) 31#define bytein(addr) inb(addr)
@@ -162,7 +162,7 @@ ix1micro_interrupt(int intno, void *dev_id, struct pt_regs *regs)
162 return IRQ_HANDLED; 162 return IRQ_HANDLED;
163} 163}
164 164
165void 165static void
166release_io_ix1micro(struct IsdnCardState *cs) 166release_io_ix1micro(struct IsdnCardState *cs)
167{ 167{
168 if (cs->hw.ix1.cfg_reg) 168 if (cs->hw.ix1.cfg_reg)
diff --git a/drivers/isdn/hisax/jade.c b/drivers/isdn/hisax/jade.c
index f05d52757557..363ae3179bbd 100644
--- a/drivers/isdn/hisax/jade.c
+++ b/drivers/isdn/hisax/jade.c
@@ -74,7 +74,7 @@ jade_write_indirect(struct IsdnCardState *cs, u_char reg, u_char value)
74 74
75 75
76 76
77void 77static void
78modejade(struct BCState *bcs, int mode, int bc) 78modejade(struct BCState *bcs, int mode, int bc)
79{ 79{
80 struct IsdnCardState *cs = bcs->cs; 80 struct IsdnCardState *cs = bcs->cs;
@@ -190,7 +190,7 @@ jade_l2l1(struct PStack *st, int pr, void *arg)
190 } 190 }
191} 191}
192 192
193void 193static void
194close_jadestate(struct BCState *bcs) 194close_jadestate(struct BCState *bcs)
195{ 195{
196 modejade(bcs, 0, bcs->channel); 196 modejade(bcs, 0, bcs->channel);
@@ -243,7 +243,7 @@ open_jadestate(struct IsdnCardState *cs, struct BCState *bcs)
243} 243}
244 244
245 245
246int 246static int
247setstack_jade(struct PStack *st, struct BCState *bcs) 247setstack_jade(struct PStack *st, struct BCState *bcs)
248{ 248{
249 bcs->channel = st->l1.bc; 249 bcs->channel = st->l1.bc;
diff --git a/drivers/isdn/hisax/jade.h b/drivers/isdn/hisax/jade.h
index fa2944485994..29055e1ee381 100644
--- a/drivers/isdn/hisax/jade.h
+++ b/drivers/isdn/hisax/jade.h
@@ -128,7 +128,6 @@
128#define jade_TXAUDIOCH2CFG 0x1A 128#define jade_TXAUDIOCH2CFG 0x1A
129 129
130extern int JadeVersion(struct IsdnCardState *cs, char *s); 130extern int JadeVersion(struct IsdnCardState *cs, char *s);
131extern void modejade(struct BCState *bcs, int mode, int bc);
132extern void clear_pending_jade_ints(struct IsdnCardState *cs); 131extern void clear_pending_jade_ints(struct IsdnCardState *cs);
133extern void initjade(struct IsdnCardState *cs); 132extern void initjade(struct IsdnCardState *cs);
134 133
diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c
index d6c1c8f8329d..c5c36eeff261 100644
--- a/drivers/isdn/hisax/l3_1tr6.c
+++ b/drivers/isdn/hisax/l3_1tr6.c
@@ -19,7 +19,7 @@
19#include <linux/ctype.h> 19#include <linux/ctype.h>
20 20
21extern char *HiSax_getrev(const char *revision); 21extern char *HiSax_getrev(const char *revision);
22const char *l3_1tr6_revision = "$Revision: 2.15.2.3 $"; 22static const char *l3_1tr6_revision = "$Revision: 2.15.2.3 $";
23 23
24#define MsgHead(ptr, cref, mty, dis) \ 24#define MsgHead(ptr, cref, mty, dis) \
25 *ptr++ = dis; \ 25 *ptr++ = dis; \
diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c
index ec92308c1efc..a6d2abdb478a 100644
--- a/drivers/isdn/hisax/l3dss1.c
+++ b/drivers/isdn/hisax/l3dss1.c
@@ -26,7 +26,7 @@
26#include <linux/config.h> 26#include <linux/config.h>
27 27
28extern char *HiSax_getrev(const char *revision); 28extern char *HiSax_getrev(const char *revision);
29const char *dss1_revision = "$Revision: 2.32.2.3 $"; 29static const char *dss1_revision = "$Revision: 2.32.2.3 $";
30 30
31#define EXT_BEARER_CAPS 1 31#define EXT_BEARER_CAPS 1
32 32
diff --git a/drivers/isdn/hisax/l3ni1.c b/drivers/isdn/hisax/l3ni1.c
index 3ab3a54daac1..f7041d5ba64e 100644
--- a/drivers/isdn/hisax/l3ni1.c
+++ b/drivers/isdn/hisax/l3ni1.c
@@ -24,7 +24,7 @@
24#include <linux/ctype.h> 24#include <linux/ctype.h>
25 25
26extern char *HiSax_getrev(const char *revision); 26extern char *HiSax_getrev(const char *revision);
27const char *ni1_revision = "$Revision: 2.8.2.3 $"; 27static const char *ni1_revision = "$Revision: 2.8.2.3 $";
28 28
29#define EXT_BEARER_CAPS 1 29#define EXT_BEARER_CAPS 1
30 30
@@ -2665,7 +2665,7 @@ static void l3ni1_spid_send( struct l3_process *pc, u_char pr, void *arg )
2665 l3ni1_SendSpid( pc, pr, arg, 20 ); 2665 l3ni1_SendSpid( pc, pr, arg, 20 );
2666} 2666}
2667 2667
2668void l3ni1_spid_epid( struct l3_process *pc, u_char pr, void *arg ) 2668static void l3ni1_spid_epid( struct l3_process *pc, u_char pr, void *arg )
2669{ 2669{
2670 struct sk_buff *skb = arg; 2670 struct sk_buff *skb = arg;
2671 2671
diff --git a/drivers/isdn/hisax/mic.c b/drivers/isdn/hisax/mic.c
index 3ac4484a4886..fe11f226b285 100644
--- a/drivers/isdn/hisax/mic.c
+++ b/drivers/isdn/hisax/mic.c
@@ -18,7 +18,7 @@
18 18
19extern const char *CardType[]; 19extern const char *CardType[];
20 20
21const char *mic_revision = "$Revision: 1.12.2.4 $"; 21static const char *mic_revision = "$Revision: 1.12.2.4 $";
22 22
23#define byteout(addr,val) outb(val,addr) 23#define byteout(addr,val) outb(val,addr)
24#define bytein(addr) inb(addr) 24#define bytein(addr) inb(addr)
@@ -157,7 +157,7 @@ mic_interrupt(int intno, void *dev_id, struct pt_regs *regs)
157 return IRQ_HANDLED; 157 return IRQ_HANDLED;
158} 158}
159 159
160void 160static void
161release_io_mic(struct IsdnCardState *cs) 161release_io_mic(struct IsdnCardState *cs)
162{ 162{
163 int bytecnt = 8; 163 int bytecnt = 8;
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c
index fe61d26365d3..94da03c30c51 100644
--- a/drivers/isdn/hisax/netjet.c
+++ b/drivers/isdn/hisax/netjet.c
@@ -25,8 +25,6 @@
25#include <asm/io.h> 25#include <asm/io.h>
26#include "netjet.h" 26#include "netjet.h"
27 27
28const char *NETjet_revision = "$Revision: 1.29.2.4 $";
29
30/* Interface functions */ 28/* Interface functions */
31 29
32u_char 30u_char
@@ -66,7 +64,7 @@ NETjet_WriteICfifo(struct IsdnCardState *cs, u_char *data, int size)
66 outsb(cs->hw.njet.isac, data, size); 64 outsb(cs->hw.njet.isac, data, size);
67} 65}
68 66
69void fill_mem(struct BCState *bcs, u_int *pos, u_int cnt, int chan, u_char fill) 67static void fill_mem(struct BCState *bcs, u_int *pos, u_int cnt, int chan, u_char fill)
70{ 68{
71 u_int mask=0x000000ff, val = 0, *p=pos; 69 u_int mask=0x000000ff, val = 0, *p=pos;
72 u_int i; 70 u_int i;
@@ -85,7 +83,7 @@ void fill_mem(struct BCState *bcs, u_int *pos, u_int cnt, int chan, u_char fill)
85 } 83 }
86} 84}
87 85
88void 86static void
89mode_tiger(struct BCState *bcs, int mode, int bc) 87mode_tiger(struct BCState *bcs, int mode, int bc)
90{ 88{
91 struct IsdnCardState *cs = bcs->cs; 89 struct IsdnCardState *cs = bcs->cs;
@@ -852,7 +850,7 @@ tiger_l2l1(struct PStack *st, int pr, void *arg)
852} 850}
853 851
854 852
855void 853static void
856close_tigerstate(struct BCState *bcs) 854close_tigerstate(struct BCState *bcs)
857{ 855{
858 mode_tiger(bcs, 0, bcs->channel); 856 mode_tiger(bcs, 0, bcs->channel);
@@ -900,7 +898,7 @@ open_tigerstate(struct IsdnCardState *cs, struct BCState *bcs)
900 return (0); 898 return (0);
901} 899}
902 900
903int 901static int
904setstack_tiger(struct PStack *st, struct BCState *bcs) 902setstack_tiger(struct PStack *st, struct BCState *bcs)
905{ 903{
906 bcs->channel = st->l1.bc; 904 bcs->channel = st->l1.bc;
@@ -966,7 +964,7 @@ inittiger(struct IsdnCardState *cs)
966 cs->bcs[1].BC_Close = close_tigerstate; 964 cs->bcs[1].BC_Close = close_tigerstate;
967} 965}
968 966
969void 967static void
970releasetiger(struct IsdnCardState *cs) 968releasetiger(struct IsdnCardState *cs)
971{ 969{
972 if (cs->bcs[0].hw.tiger.send) { 970 if (cs->bcs[0].hw.tiger.send) {
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index cf77d8360975..68a2159cbd11 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -24,7 +24,7 @@
24#include <linux/isapnp.h> 24#include <linux/isapnp.h>
25 25
26extern const char *CardType[]; 26extern const char *CardType[];
27const char *niccy_revision = "$Revision: 1.21.2.4 $"; 27static const char *niccy_revision = "$Revision: 1.21.2.4 $";
28 28
29#define byteout(addr,val) outb(val,addr) 29#define byteout(addr,val) outb(val,addr)
30#define bytein(addr) inb(addr) 30#define bytein(addr) inb(addr)
@@ -178,7 +178,7 @@ niccy_interrupt(int intno, void *dev_id, struct pt_regs *regs)
178 return IRQ_HANDLED; 178 return IRQ_HANDLED;
179} 179}
180 180
181void 181static void
182release_io_niccy(struct IsdnCardState *cs) 182release_io_niccy(struct IsdnCardState *cs)
183{ 183{
184 if (cs->subtyp == NICCY_PCI) { 184 if (cs->subtyp == NICCY_PCI) {
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
index fd664697f821..a7d3cd3f36fd 100644
--- a/drivers/isdn/hisax/nj_s.c
+++ b/drivers/isdn/hisax/nj_s.c
@@ -15,7 +15,7 @@
15#include <linux/ppp_defs.h> 15#include <linux/ppp_defs.h>
16#include "netjet.h" 16#include "netjet.h"
17 17
18const char *NETjet_S_revision = "$Revision: 2.13.2.4 $"; 18static const char *NETjet_S_revision = "$Revision: 2.13.2.4 $";
19 19
20static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off) 20static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
21{ 21{
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c
index 3d6441e9633c..1ae7cac98a87 100644
--- a/drivers/isdn/hisax/nj_u.c
+++ b/drivers/isdn/hisax/nj_u.c
@@ -15,7 +15,7 @@
15#include <linux/ppp_defs.h> 15#include <linux/ppp_defs.h>
16#include "netjet.h" 16#include "netjet.h"
17 17
18const char *NETjet_U_revision = "$Revision: 2.14.2.3 $"; 18static const char *NETjet_U_revision = "$Revision: 2.14.2.3 $";
19 19
20static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off) 20static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
21{ 21{
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c
index 170fcd4a3984..abecabf8c271 100644
--- a/drivers/isdn/hisax/q931.c
+++ b/drivers/isdn/hisax/q931.c
@@ -516,7 +516,7 @@ struct MessageType cause_1tr6[] =
516 {CAUSE_UserInfoDiscarded, "User Info Discarded"} 516 {CAUSE_UserInfoDiscarded, "User Info Discarded"}
517}; 517};
518 518
519int cause_1tr6_len = (sizeof(cause_1tr6) / sizeof(struct MessageType)); 519static int cause_1tr6_len = (sizeof(cause_1tr6) / sizeof(struct MessageType));
520 520
521static int 521static int
522prcause_1tr6(char *dest, u_char * p) 522prcause_1tr6(char *dest, u_char * p)
@@ -935,7 +935,7 @@ display(char *dest, u_char * p)
935 return (dp - dest); 935 return (dp - dest);
936} 936}
937 937
938int 938static int
939prfacility(char *dest, u_char * p) 939prfacility(char *dest, u_char * p)
940{ 940{
941 char *dp = dest; 941 char *dp = dest;
diff --git a/drivers/isdn/hisax/s0box.c b/drivers/isdn/hisax/s0box.c
index f3c481384a4e..7b63085ea6e5 100644
--- a/drivers/isdn/hisax/s0box.c
+++ b/drivers/isdn/hisax/s0box.c
@@ -17,7 +17,7 @@
17#include "isdnl1.h" 17#include "isdnl1.h"
18 18
19extern const char *CardType[]; 19extern const char *CardType[];
20const char *s0box_revision = "$Revision: 2.6.2.4 $"; 20static const char *s0box_revision = "$Revision: 2.6.2.4 $";
21 21
22static inline void 22static inline void
23writereg(unsigned int padr, signed int addr, u_char off, u_char val) { 23writereg(unsigned int padr, signed int addr, u_char off, u_char val) {
@@ -183,7 +183,7 @@ s0box_interrupt(int intno, void *dev_id, struct pt_regs *regs)
183 return IRQ_HANDLED; 183 return IRQ_HANDLED;
184} 184}
185 185
186void 186static void
187release_io_s0box(struct IsdnCardState *cs) 187release_io_s0box(struct IsdnCardState *cs)
188{ 188{
189 release_region(cs->hw.teles3.cfg_reg, 8); 189 release_region(cs->hw.teles3.cfg_reg, 8);
diff --git a/drivers/isdn/hisax/saphir.c b/drivers/isdn/hisax/saphir.c
index 9e6d3d686cce..821776e1561a 100644
--- a/drivers/isdn/hisax/saphir.c
+++ b/drivers/isdn/hisax/saphir.c
@@ -171,7 +171,7 @@ SaphirWatchDog(struct IsdnCardState *cs)
171 mod_timer(&cs->hw.saphir.timer, jiffies+1*HZ); 171 mod_timer(&cs->hw.saphir.timer, jiffies+1*HZ);
172} 172}
173 173
174void 174static void
175release_io_saphir(struct IsdnCardState *cs) 175release_io_saphir(struct IsdnCardState *cs)
176{ 176{
177 byteout(cs->hw.saphir.cfg_reg + IRQ_REG, 0xff); 177 byteout(cs->hw.saphir.cfg_reg + IRQ_REG, 0xff);
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c
index 8390f1606853..8c044a6a7fe3 100644
--- a/drivers/isdn/hisax/sedlbauer.c
+++ b/drivers/isdn/hisax/sedlbauer.c
@@ -51,9 +51,9 @@
51 51
52extern const char *CardType[]; 52extern const char *CardType[];
53 53
54const char *Sedlbauer_revision = "$Revision: 1.34.2.6 $"; 54static const char *Sedlbauer_revision = "$Revision: 1.34.2.6 $";
55 55
56const char *Sedlbauer_Types[] = 56static const char *Sedlbauer_Types[] =
57 {"None", "speed card/win", "speed star", "speed fax+", 57 {"None", "speed card/win", "speed star", "speed fax+",
58 "speed win II / ISDN PC/104", "speed star II", "speed pci", 58 "speed win II / ISDN PC/104", "speed star II", "speed pci",
59 "speed fax+ pyramid", "speed fax+ pci", "HST Saphir III"}; 59 "speed fax+ pyramid", "speed fax+ pci", "HST Saphir III"};
@@ -394,7 +394,7 @@ sedlbauer_interrupt_isar(int intno, void *dev_id, struct pt_regs *regs)
394 return IRQ_HANDLED; 394 return IRQ_HANDLED;
395} 395}
396 396
397void 397static void
398release_io_sedlbauer(struct IsdnCardState *cs) 398release_io_sedlbauer(struct IsdnCardState *cs)
399{ 399{
400 int bytecnt = 8; 400 int bytecnt = 8;
diff --git a/drivers/isdn/hisax/sportster.c b/drivers/isdn/hisax/sportster.c
index 132840b750ce..cdf35dc564c4 100644
--- a/drivers/isdn/hisax/sportster.c
+++ b/drivers/isdn/hisax/sportster.c
@@ -19,7 +19,7 @@
19#include "isdnl1.h" 19#include "isdnl1.h"
20 20
21extern const char *CardType[]; 21extern const char *CardType[];
22const char *sportster_revision = "$Revision: 1.16.2.4 $"; 22static const char *sportster_revision = "$Revision: 1.16.2.4 $";
23 23
24#define byteout(addr,val) outb(val,addr) 24#define byteout(addr,val) outb(val,addr)
25#define bytein(addr) inb(addr) 25#define bytein(addr) inb(addr)
@@ -132,7 +132,7 @@ sportster_interrupt(int intno, void *dev_id, struct pt_regs *regs)
132 return IRQ_HANDLED; 132 return IRQ_HANDLED;
133} 133}
134 134
135void 135static void
136release_io_sportster(struct IsdnCardState *cs) 136release_io_sportster(struct IsdnCardState *cs)
137{ 137{
138 int i, adr; 138 int i, adr;
@@ -144,7 +144,7 @@ release_io_sportster(struct IsdnCardState *cs)
144 } 144 }
145} 145}
146 146
147void 147static void
148reset_sportster(struct IsdnCardState *cs) 148reset_sportster(struct IsdnCardState *cs)
149{ 149{
150 cs->hw.spt.res_irq |= SPORTSTER_RESET; /* Reset On */ 150 cs->hw.spt.res_irq |= SPORTSTER_RESET; /* Reset On */
diff --git a/drivers/isdn/hisax/st5481.h b/drivers/isdn/hisax/st5481.h
index e8177b017b1d..0fda5c89429b 100644
--- a/drivers/isdn/hisax/st5481.h
+++ b/drivers/isdn/hisax/st5481.h
@@ -450,12 +450,8 @@ int st5481_setup_isocpipes(struct urb* urb[2], struct usb_device *dev,
450 usb_complete_t complete, void *context); 450 usb_complete_t complete, void *context);
451void st5481_release_isocpipes(struct urb* urb[2]); 451void st5481_release_isocpipes(struct urb* urb[2]);
452 452
453int st5481_isoc_flatten(struct urb *urb);
454void st5481_usb_pipe_reset(struct st5481_adapter *adapter, 453void st5481_usb_pipe_reset(struct st5481_adapter *adapter,
455 u_char pipe, ctrl_complete_t complete, void *context); 454 u_char pipe, ctrl_complete_t complete, void *context);
456void st5481_usb_ctrl_msg(struct st5481_adapter *adapter,
457 u8 request, u8 requesttype, u16 value, u16 index,
458 ctrl_complete_t complete, void *context);
459void st5481_usb_device_ctrl_msg(struct st5481_adapter *adapter, 455void st5481_usb_device_ctrl_msg(struct st5481_adapter *adapter,
460 u8 request, u16 value, 456 u8 request, u16 value,
461 ctrl_complete_t complete, void *context); 457 ctrl_complete_t complete, void *context);
diff --git a/drivers/isdn/hisax/st5481_hdlc.c b/drivers/isdn/hisax/st5481_hdlc.c
deleted file mode 100644
index 680f42e9a993..000000000000
--- a/drivers/isdn/hisax/st5481_hdlc.c
+++ /dev/null
@@ -1,580 +0,0 @@
1/*
2 * Driver for ST5481 USB ISDN modem
3 *
4 * Author Frode Isaksen
5 * Copyright 2001 by Frode Isaksen <fisaksen@bewan.com>
6 * 2001 by Kai Germaschewski <kai.germaschewski@gmx.de>
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 */
12
13#include <linux/crc-ccitt.h>
14#include "st5481_hdlc.h"
15
16
17enum {
18 HDLC_FAST_IDLE,HDLC_GET_FLAG_B0,HDLC_GETFLAG_B1A6,HDLC_GETFLAG_B7,
19 HDLC_GET_DATA,HDLC_FAST_FLAG
20};
21
22enum {
23 HDLC_SEND_DATA,HDLC_SEND_CRC1,HDLC_SEND_FAST_FLAG,
24 HDLC_SEND_FIRST_FLAG,HDLC_SEND_CRC2,HDLC_SEND_CLOSING_FLAG,
25 HDLC_SEND_IDLE1,HDLC_SEND_FAST_IDLE,HDLC_SENDFLAG_B0,
26 HDLC_SENDFLAG_B1A6,HDLC_SENDFLAG_B7,STOPPED
27};
28
29void
30hdlc_rcv_init(struct hdlc_vars *hdlc, int do_adapt56)
31{
32 hdlc->bit_shift = 0;
33 hdlc->hdlc_bits1 = 0;
34 hdlc->data_bits = 0;
35 hdlc->ffbit_shift = 0;
36 hdlc->data_received = 0;
37 hdlc->state = HDLC_GET_DATA;
38 hdlc->do_adapt56 = do_adapt56;
39 hdlc->dchannel = 0;
40 hdlc->crc = 0;
41 hdlc->cbin = 0;
42 hdlc->shift_reg = 0;
43 hdlc->ffvalue = 0;
44 hdlc->dstpos = 0;
45}
46
47void
48hdlc_out_init(struct hdlc_vars *hdlc, int is_d_channel, int do_adapt56)
49{
50 hdlc->bit_shift = 0;
51 hdlc->hdlc_bits1 = 0;
52 hdlc->data_bits = 0;
53 hdlc->ffbit_shift = 0;
54 hdlc->data_received = 0;
55 hdlc->do_closing = 0;
56 hdlc->ffvalue = 0;
57 if (is_d_channel) {
58 hdlc->dchannel = 1;
59 hdlc->state = HDLC_SEND_FIRST_FLAG;
60 } else {
61 hdlc->dchannel = 0;
62 hdlc->state = HDLC_SEND_FAST_FLAG;
63 hdlc->ffvalue = 0x7e;
64 }
65 hdlc->cbin = 0x7e;
66 hdlc->bit_shift = 0;
67 if(do_adapt56){
68 hdlc->do_adapt56 = 1;
69 hdlc->data_bits = 0;
70 hdlc->state = HDLC_SENDFLAG_B0;
71 } else {
72 hdlc->do_adapt56 = 0;
73 hdlc->data_bits = 8;
74 }
75 hdlc->shift_reg = 0;
76}
77
78/*
79 hdlc_decode - decodes HDLC frames from a transparent bit stream.
80
81 The source buffer is scanned for valid HDLC frames looking for
82 flags (01111110) to indicate the start of a frame. If the start of
83 the frame is found, the bit stuffing is removed (0 after 5 1's).
84 When a new flag is found, the complete frame has been received
85 and the CRC is checked.
86 If a valid frame is found, the function returns the frame length
87 excluding the CRC with the bit HDLC_END_OF_FRAME set.
88 If the beginning of a valid frame is found, the function returns
89 the length.
90 If a framing error is found (too many 1s and not a flag) the function
91 returns the length with the bit HDLC_FRAMING_ERROR set.
92 If a CRC error is found the function returns the length with the
93 bit HDLC_CRC_ERROR set.
94 If the frame length exceeds the destination buffer size, the function
95 returns the length with the bit HDLC_LENGTH_ERROR set.
96
97 src - source buffer
98 slen - source buffer length
99 count - number of bytes removed (decoded) from the source buffer
100 dst _ destination buffer
101 dsize - destination buffer size
102 returns - number of decoded bytes in the destination buffer and status
103 flag.
104 */
105int hdlc_decode(struct hdlc_vars *hdlc, const unsigned char *src,
106 int slen, int *count, unsigned char *dst, int dsize)
107{
108 int status=0;
109
110 static const unsigned char fast_flag[]={
111 0x00,0x00,0x00,0x20,0x30,0x38,0x3c,0x3e,0x3f
112 };
113
114 static const unsigned char fast_flag_value[]={
115 0x00,0x7e,0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f
116 };
117
118 static const unsigned char fast_abort[]={
119 0x00,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff
120 };
121
122 *count = slen;
123
124 while(slen > 0){
125 if(hdlc->bit_shift==0){
126 hdlc->cbin = *src++;
127 slen--;
128 hdlc->bit_shift = 8;
129 if(hdlc->do_adapt56){
130 hdlc->bit_shift --;
131 }
132 }
133
134 switch(hdlc->state){
135 case STOPPED:
136 return 0;
137 case HDLC_FAST_IDLE:
138 if(hdlc->cbin == 0xff){
139 hdlc->bit_shift = 0;
140 break;
141 }
142 hdlc->state = HDLC_GET_FLAG_B0;
143 hdlc->hdlc_bits1 = 0;
144 hdlc->bit_shift = 8;
145 break;
146 case HDLC_GET_FLAG_B0:
147 if(!(hdlc->cbin & 0x80)) {
148 hdlc->state = HDLC_GETFLAG_B1A6;
149 hdlc->hdlc_bits1 = 0;
150 } else {
151 if(!hdlc->do_adapt56){
152 if(++hdlc->hdlc_bits1 >=8 ) if(hdlc->bit_shift==1)
153 hdlc->state = HDLC_FAST_IDLE;
154 }
155 }
156 hdlc->cbin<<=1;
157 hdlc->bit_shift --;
158 break;
159 case HDLC_GETFLAG_B1A6:
160 if(hdlc->cbin & 0x80){
161 hdlc->hdlc_bits1++;
162 if(hdlc->hdlc_bits1==6){
163 hdlc->state = HDLC_GETFLAG_B7;
164 }
165 } else {
166 hdlc->hdlc_bits1 = 0;
167 }
168 hdlc->cbin<<=1;
169 hdlc->bit_shift --;
170 break;
171 case HDLC_GETFLAG_B7:
172 if(hdlc->cbin & 0x80) {
173 hdlc->state = HDLC_GET_FLAG_B0;
174 } else {
175 hdlc->state = HDLC_GET_DATA;
176 hdlc->crc = 0xffff;
177 hdlc->shift_reg = 0;
178 hdlc->hdlc_bits1 = 0;
179 hdlc->data_bits = 0;
180 hdlc->data_received = 0;
181 }
182 hdlc->cbin<<=1;
183 hdlc->bit_shift --;
184 break;
185 case HDLC_GET_DATA:
186 if(hdlc->cbin & 0x80){
187 hdlc->hdlc_bits1++;
188 switch(hdlc->hdlc_bits1){
189 case 6:
190 break;
191 case 7:
192 if(hdlc->data_received) {
193 // bad frame
194 status = -HDLC_FRAMING_ERROR;
195 }
196 if(!hdlc->do_adapt56){
197 if(hdlc->cbin==fast_abort[hdlc->bit_shift+1]){
198 hdlc->state = HDLC_FAST_IDLE;
199 hdlc->bit_shift=1;
200 break;
201 }
202 } else {
203 hdlc->state = HDLC_GET_FLAG_B0;
204 }
205 break;
206 default:
207 hdlc->shift_reg>>=1;
208 hdlc->shift_reg |= 0x80;
209 hdlc->data_bits++;
210 break;
211 }
212 } else {
213 switch(hdlc->hdlc_bits1){
214 case 5:
215 break;
216 case 6:
217 if(hdlc->data_received){
218 if (hdlc->dstpos < 2) {
219 status = -HDLC_FRAMING_ERROR;
220 } else if (hdlc->crc != 0xf0b8){
221 // crc error
222 status = -HDLC_CRC_ERROR;
223 } else {
224 // remove CRC
225 hdlc->dstpos -= 2;
226 // good frame
227 status = hdlc->dstpos;
228 }
229 }
230 hdlc->crc = 0xffff;
231 hdlc->shift_reg = 0;
232 hdlc->data_bits = 0;
233 if(!hdlc->do_adapt56){
234 if(hdlc->cbin==fast_flag[hdlc->bit_shift]){
235 hdlc->ffvalue = fast_flag_value[hdlc->bit_shift];
236 hdlc->state = HDLC_FAST_FLAG;
237 hdlc->ffbit_shift = hdlc->bit_shift;
238 hdlc->bit_shift = 1;
239 } else {
240 hdlc->state = HDLC_GET_DATA;
241 hdlc->data_received = 0;
242 }
243 } else {
244 hdlc->state = HDLC_GET_DATA;
245 hdlc->data_received = 0;
246 }
247 break;
248 default:
249 hdlc->shift_reg>>=1;
250 hdlc->data_bits++;
251 break;
252 }
253 hdlc->hdlc_bits1 = 0;
254 }
255 if (status) {
256 hdlc->dstpos = 0;
257 *count -= slen;
258 hdlc->cbin <<= 1;
259 hdlc->bit_shift--;
260 return status;
261 }
262 if(hdlc->data_bits==8){
263 hdlc->data_bits = 0;
264 hdlc->data_received = 1;
265 hdlc->crc = crc_ccitt_byte(hdlc->crc, hdlc->shift_reg);
266
267 // good byte received
268 if (dsize--) {
269 dst[hdlc->dstpos++] = hdlc->shift_reg;
270 } else {
271 // frame too long
272 status = -HDLC_LENGTH_ERROR;
273 hdlc->dstpos = 0;
274 }
275 }
276 hdlc->cbin <<= 1;
277 hdlc->bit_shift--;
278 break;
279 case HDLC_FAST_FLAG:
280 if(hdlc->cbin==hdlc->ffvalue){
281 hdlc->bit_shift = 0;
282 break;
283 } else {
284 if(hdlc->cbin == 0xff){
285 hdlc->state = HDLC_FAST_IDLE;
286 hdlc->bit_shift=0;
287 } else if(hdlc->ffbit_shift==8){
288 hdlc->state = HDLC_GETFLAG_B7;
289 break;
290 } else {
291 hdlc->shift_reg = fast_abort[hdlc->ffbit_shift-1];
292 hdlc->hdlc_bits1 = hdlc->ffbit_shift-2;
293 if(hdlc->hdlc_bits1<0)hdlc->hdlc_bits1 = 0;
294 hdlc->data_bits = hdlc->ffbit_shift-1;
295 hdlc->state = HDLC_GET_DATA;
296 hdlc->data_received = 0;
297 }
298 }
299 break;
300 default:
301 break;
302 }
303 }
304 *count -= slen;
305 return 0;
306}
307
308/*
309 hdlc_encode - encodes HDLC frames to a transparent bit stream.
310
311 The bit stream starts with a beginning flag (01111110). After
312 that each byte is added to the bit stream with bit stuffing added
313 (0 after 5 1's).
314 When the last byte has been removed from the source buffer, the
315 CRC (2 bytes is added) and the frame terminates with the ending flag.
316 For the dchannel, the idle character (all 1's) is also added at the end.
317 If this function is called with empty source buffer (slen=0), flags or
318 idle character will be generated.
319
320 src - source buffer
321 slen - source buffer length
322 count - number of bytes removed (encoded) from source buffer
323 dst _ destination buffer
324 dsize - destination buffer size
325 returns - number of encoded bytes in the destination buffer
326*/
327int hdlc_encode(struct hdlc_vars *hdlc, const unsigned char *src,
328 unsigned short slen, int *count,
329 unsigned char *dst, int dsize)
330{
331 static const unsigned char xfast_flag_value[] = {
332 0x7e,0x3f,0x9f,0xcf,0xe7,0xf3,0xf9,0xfc,0x7e
333 };
334
335 int len = 0;
336
337 *count = slen;
338
339 while (dsize > 0) {
340 if(hdlc->bit_shift==0){
341 if(slen && !hdlc->do_closing){
342 hdlc->shift_reg = *src++;
343 slen--;
344 if (slen == 0)
345 hdlc->do_closing = 1; /* closing sequence, CRC + flag(s) */
346 hdlc->bit_shift = 8;
347 } else {
348 if(hdlc->state == HDLC_SEND_DATA){
349 if(hdlc->data_received){
350 hdlc->state = HDLC_SEND_CRC1;
351 hdlc->crc ^= 0xffff;
352 hdlc->bit_shift = 8;
353 hdlc->shift_reg = hdlc->crc & 0xff;
354 } else if(!hdlc->do_adapt56){
355 hdlc->state = HDLC_SEND_FAST_FLAG;
356 } else {
357 hdlc->state = HDLC_SENDFLAG_B0;
358 }
359 }
360
361 }
362 }
363
364 switch(hdlc->state){
365 case STOPPED:
366 while (dsize--)
367 *dst++ = 0xff;
368
369 return dsize;
370 case HDLC_SEND_FAST_FLAG:
371 hdlc->do_closing = 0;
372 if(slen == 0){
373 *dst++ = hdlc->ffvalue;
374 len++;
375 dsize--;
376 break;
377 }
378 if(hdlc->bit_shift==8){
379 hdlc->cbin = hdlc->ffvalue>>(8-hdlc->data_bits);
380 hdlc->state = HDLC_SEND_DATA;
381 hdlc->crc = 0xffff;
382 hdlc->hdlc_bits1 = 0;
383 hdlc->data_received = 1;
384 }
385 break;
386 case HDLC_SENDFLAG_B0:
387 hdlc->do_closing = 0;
388 hdlc->cbin <<= 1;
389 hdlc->data_bits++;
390 hdlc->hdlc_bits1 = 0;
391 hdlc->state = HDLC_SENDFLAG_B1A6;
392 break;
393 case HDLC_SENDFLAG_B1A6:
394 hdlc->cbin <<= 1;
395 hdlc->data_bits++;
396 hdlc->cbin++;
397 if(++hdlc->hdlc_bits1 == 6)
398 hdlc->state = HDLC_SENDFLAG_B7;
399 break;
400 case HDLC_SENDFLAG_B7:
401 hdlc->cbin <<= 1;
402 hdlc->data_bits++;
403 if(slen == 0){
404 hdlc->state = HDLC_SENDFLAG_B0;
405 break;
406 }
407 if(hdlc->bit_shift==8){
408 hdlc->state = HDLC_SEND_DATA;
409 hdlc->crc = 0xffff;
410 hdlc->hdlc_bits1 = 0;
411 hdlc->data_received = 1;
412 }
413 break;
414 case HDLC_SEND_FIRST_FLAG:
415 hdlc->data_received = 1;
416 if(hdlc->data_bits==8){
417 hdlc->state = HDLC_SEND_DATA;
418 hdlc->crc = 0xffff;
419 hdlc->hdlc_bits1 = 0;
420 break;
421 }
422 hdlc->cbin <<= 1;
423 hdlc->data_bits++;
424 if(hdlc->shift_reg & 0x01)
425 hdlc->cbin++;
426 hdlc->shift_reg >>= 1;
427 hdlc->bit_shift--;
428 if(hdlc->bit_shift==0){
429 hdlc->state = HDLC_SEND_DATA;
430 hdlc->crc = 0xffff;
431 hdlc->hdlc_bits1 = 0;
432 }
433 break;
434 case HDLC_SEND_DATA:
435 hdlc->cbin <<= 1;
436 hdlc->data_bits++;
437 if(hdlc->hdlc_bits1 == 5){
438 hdlc->hdlc_bits1 = 0;
439 break;
440 }
441 if(hdlc->bit_shift==8){
442 hdlc->crc = crc_ccitt_byte(hdlc->crc, hdlc->shift_reg);
443 }
444 if(hdlc->shift_reg & 0x01){
445 hdlc->hdlc_bits1++;
446 hdlc->cbin++;
447 hdlc->shift_reg >>= 1;
448 hdlc->bit_shift--;
449 } else {
450 hdlc->hdlc_bits1 = 0;
451 hdlc->shift_reg >>= 1;
452 hdlc->bit_shift--;
453 }
454 break;
455 case HDLC_SEND_CRC1:
456 hdlc->cbin <<= 1;
457 hdlc->data_bits++;
458 if(hdlc->hdlc_bits1 == 5){
459 hdlc->hdlc_bits1 = 0;
460 break;
461 }
462 if(hdlc->shift_reg & 0x01){
463 hdlc->hdlc_bits1++;
464 hdlc->cbin++;
465 hdlc->shift_reg >>= 1;
466 hdlc->bit_shift--;
467 } else {
468 hdlc->hdlc_bits1 = 0;
469 hdlc->shift_reg >>= 1;
470 hdlc->bit_shift--;
471 }
472 if(hdlc->bit_shift==0){
473 hdlc->shift_reg = (hdlc->crc >> 8);
474 hdlc->state = HDLC_SEND_CRC2;
475 hdlc->bit_shift = 8;
476 }
477 break;
478 case HDLC_SEND_CRC2:
479 hdlc->cbin <<= 1;
480 hdlc->data_bits++;
481 if(hdlc->hdlc_bits1 == 5){
482 hdlc->hdlc_bits1 = 0;
483 break;
484 }
485 if(hdlc->shift_reg & 0x01){
486 hdlc->hdlc_bits1++;
487 hdlc->cbin++;
488 hdlc->shift_reg >>= 1;
489 hdlc->bit_shift--;
490 } else {
491 hdlc->hdlc_bits1 = 0;
492 hdlc->shift_reg >>= 1;
493 hdlc->bit_shift--;
494 }
495 if(hdlc->bit_shift==0){
496 hdlc->shift_reg = 0x7e;
497 hdlc->state = HDLC_SEND_CLOSING_FLAG;
498 hdlc->bit_shift = 8;
499 }
500 break;
501 case HDLC_SEND_CLOSING_FLAG:
502 hdlc->cbin <<= 1;
503 hdlc->data_bits++;
504 if(hdlc->hdlc_bits1 == 5){
505 hdlc->hdlc_bits1 = 0;
506 break;
507 }
508 if(hdlc->shift_reg & 0x01){
509 hdlc->cbin++;
510 }
511 hdlc->shift_reg >>= 1;
512 hdlc->bit_shift--;
513 if(hdlc->bit_shift==0){
514 hdlc->ffvalue = xfast_flag_value[hdlc->data_bits];
515 if(hdlc->dchannel){
516 hdlc->ffvalue = 0x7e;
517 hdlc->state = HDLC_SEND_IDLE1;
518 hdlc->bit_shift = 8-hdlc->data_bits;
519 if(hdlc->bit_shift==0)
520 hdlc->state = HDLC_SEND_FAST_IDLE;
521 } else {
522 if(!hdlc->do_adapt56){
523 hdlc->state = HDLC_SEND_FAST_FLAG;
524 hdlc->data_received = 0;
525 } else {
526 hdlc->state = HDLC_SENDFLAG_B0;
527 hdlc->data_received = 0;
528 }
529 // Finished with this frame, send flags
530 if (dsize > 1) dsize = 1;
531 }
532 }
533 break;
534 case HDLC_SEND_IDLE1:
535 hdlc->do_closing = 0;
536 hdlc->cbin <<= 1;
537 hdlc->cbin++;
538 hdlc->data_bits++;
539 hdlc->bit_shift--;
540 if(hdlc->bit_shift==0){
541 hdlc->state = HDLC_SEND_FAST_IDLE;
542 hdlc->bit_shift = 0;
543 }
544 break;
545 case HDLC_SEND_FAST_IDLE:
546 hdlc->do_closing = 0;
547 hdlc->cbin = 0xff;
548 hdlc->data_bits = 8;
549 if(hdlc->bit_shift == 8){
550 hdlc->cbin = 0x7e;
551 hdlc->state = HDLC_SEND_FIRST_FLAG;
552 } else {
553 *dst++ = hdlc->cbin;
554 hdlc->bit_shift = hdlc->data_bits = 0;
555 len++;
556 dsize = 0;
557 }
558 break;
559 default:
560 break;
561 }
562 if(hdlc->do_adapt56){
563 if(hdlc->data_bits==7){
564 hdlc->cbin <<= 1;
565 hdlc->cbin++;
566 hdlc->data_bits++;
567 }
568 }
569 if(hdlc->data_bits==8){
570 *dst++ = hdlc->cbin;
571 hdlc->data_bits = 0;
572 len++;
573 dsize--;
574 }
575 }
576 *count -= slen;
577
578 return len;
579}
580
diff --git a/drivers/isdn/hisax/st5481_hdlc.h b/drivers/isdn/hisax/st5481_hdlc.h
deleted file mode 100644
index 495432f0f6ba..000000000000
--- a/drivers/isdn/hisax/st5481_hdlc.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Driver for ST5481 USB ISDN modem
3 *
4 * Author Frode Isaksen
5 * Copyright 2001 by Frode Isaksen <fisaksen@bewan.com>
6 * 2001 by Kai Germaschewski <kai.germaschewski@gmx.de>
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 */
12
13#ifndef __ST5481_HDLC_H__
14#define __ST5481_HDLC_H__
15
16struct hdlc_vars {
17 int bit_shift;
18 int hdlc_bits1;
19 int data_bits;
20 int ffbit_shift; // encoding only
21 int state;
22 int dstpos;
23
24 int data_received:1; // set if transferring data
25 int dchannel:1; // set if D channel (send idle instead of flags)
26 int do_adapt56:1; // set if 56K adaptation
27 int do_closing:1; // set if in closing phase (need to send CRC + flag
28
29 unsigned short crc;
30
31 unsigned char cbin;
32 unsigned char shift_reg;
33 unsigned char ffvalue;
34
35};
36
37
38/*
39 The return value from hdlc_decode is
40 the frame length, 0 if no complete frame was decoded,
41 or a negative error number
42*/
43
44#define HDLC_FRAMING_ERROR 1
45#define HDLC_CRC_ERROR 2
46#define HDLC_LENGTH_ERROR 3
47
48void
49hdlc_rcv_init(struct hdlc_vars *hdlc, int do_adapt56);
50
51int
52hdlc_decode(struct hdlc_vars *hdlc, const unsigned char *src, int slen,int *count,
53 unsigned char *dst, int dsize);
54
55void
56hdlc_out_init(struct hdlc_vars *hdlc,int is_d_channel,int do_adapt56);
57
58int
59hdlc_encode(struct hdlc_vars *hdlc,const unsigned char *src,unsigned short slen,int *count,
60 unsigned char *dst,int dsize);
61
62#endif
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
index 2369180b1cb1..ab62223297a5 100644
--- a/drivers/isdn/hisax/st5481_usb.c
+++ b/drivers/isdn/hisax/st5481_usb.c
@@ -15,6 +15,8 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include "st5481.h" 16#include "st5481.h"
17 17
18static int st5481_isoc_flatten(struct urb *urb);
19
18/* ====================================================================== 20/* ======================================================================
19 * control pipe 21 * control pipe
20 */ 22 */
@@ -55,9 +57,9 @@ static void usb_next_ctrl_msg(struct urb *urb,
55 * Asynchronous endpoint 0 request (async version of usb_control_msg). 57 * Asynchronous endpoint 0 request (async version of usb_control_msg).
56 * The request will be queued up in a FIFO if the endpoint is busy. 58 * The request will be queued up in a FIFO if the endpoint is busy.
57 */ 59 */
58void usb_ctrl_msg(struct st5481_adapter *adapter, 60static void usb_ctrl_msg(struct st5481_adapter *adapter,
59 u8 request, u8 requesttype, u16 value, u16 index, 61 u8 request, u8 requesttype, u16 value, u16 index,
60 ctrl_complete_t complete, void *context) 62 ctrl_complete_t complete, void *context)
61{ 63{
62 struct st5481_ctrl *ctrl = &adapter->ctrl; 64 struct st5481_ctrl *ctrl = &adapter->ctrl;
63 int w_index; 65 int w_index;
@@ -571,7 +573,7 @@ void st5481_release_in(struct st5481_in *in)
571 * Make the transfer_buffer contiguous by 573 * Make the transfer_buffer contiguous by
572 * copying from the iso descriptors if necessary. 574 * copying from the iso descriptors if necessary.
573 */ 575 */
574int st5481_isoc_flatten(struct urb *urb) 576static int st5481_isoc_flatten(struct urb *urb)
575{ 577{
576 struct usb_iso_packet_descriptor *pipd,*pend; 578 struct usb_iso_packet_descriptor *pipd,*pend;
577 unsigned char *src,*dst; 579 unsigned char *src,*dst;
diff --git a/drivers/isdn/hisax/tei.c b/drivers/isdn/hisax/tei.c
index 082726db3985..ceb0df92fd3e 100644
--- a/drivers/isdn/hisax/tei.c
+++ b/drivers/isdn/hisax/tei.c
@@ -74,7 +74,7 @@ static char *strTeiEvent[] =
74 "EV_T202", 74 "EV_T202",
75}; 75};
76 76
77unsigned int 77static unsigned int
78random_ri(void) 78random_ri(void)
79{ 79{
80 unsigned int x; 80 unsigned int x;
diff --git a/drivers/isdn/hisax/teleint.c b/drivers/isdn/hisax/teleint.c
index ef8984c5f1f7..a2b1816af37a 100644
--- a/drivers/isdn/hisax/teleint.c
+++ b/drivers/isdn/hisax/teleint.c
@@ -18,7 +18,7 @@
18 18
19extern const char *CardType[]; 19extern const char *CardType[];
20 20
21const char *TeleInt_revision = "$Revision: 1.16.2.5 $"; 21static const char *TeleInt_revision = "$Revision: 1.16.2.5 $";
22 22
23#define byteout(addr,val) outb(val,addr) 23#define byteout(addr,val) outb(val,addr)
24#define bytein(addr) inb(addr) 24#define bytein(addr) inb(addr)
@@ -203,7 +203,7 @@ TeleInt_Timer(struct IsdnCardState *cs)
203 add_timer(&cs->hw.hfc.timer); 203 add_timer(&cs->hw.hfc.timer);
204} 204}
205 205
206void 206static void
207release_io_TeleInt(struct IsdnCardState *cs) 207release_io_TeleInt(struct IsdnCardState *cs)
208{ 208{
209 del_timer(&cs->hw.hfc.timer); 209 del_timer(&cs->hw.hfc.timer);
diff --git a/drivers/isdn/hisax/teles0.c b/drivers/isdn/hisax/teles0.c
index 5ec5ec3e1eab..2b7df8f98233 100644
--- a/drivers/isdn/hisax/teles0.c
+++ b/drivers/isdn/hisax/teles0.c
@@ -23,7 +23,7 @@
23 23
24extern const char *CardType[]; 24extern const char *CardType[];
25 25
26const char *teles0_revision = "$Revision: 2.15.2.4 $"; 26static const char *teles0_revision = "$Revision: 2.15.2.4 $";
27 27
28#define TELES_IOMEM_SIZE 0x400 28#define TELES_IOMEM_SIZE 0x400
29#define byteout(addr,val) outb(val,addr) 29#define byteout(addr,val) outb(val,addr)
@@ -183,7 +183,7 @@ teles0_interrupt(int intno, void *dev_id, struct pt_regs *regs)
183 return IRQ_HANDLED; 183 return IRQ_HANDLED;
184} 184}
185 185
186void 186static void
187release_io_teles0(struct IsdnCardState *cs) 187release_io_teles0(struct IsdnCardState *cs)
188{ 188{
189 if (cs->hw.teles0.cfg_reg) 189 if (cs->hw.teles0.cfg_reg)
diff --git a/drivers/isdn/hisax/teles3.c b/drivers/isdn/hisax/teles3.c
index c5b1f65f7275..adeaad62d35c 100644
--- a/drivers/isdn/hisax/teles3.c
+++ b/drivers/isdn/hisax/teles3.c
@@ -21,7 +21,7 @@
21#include "isdnl1.h" 21#include "isdnl1.h"
22 22
23extern const char *CardType[]; 23extern const char *CardType[];
24const char *teles3_revision = "$Revision: 2.19.2.4 $"; 24static const char *teles3_revision = "$Revision: 2.19.2.4 $";
25 25
26#define byteout(addr,val) outb(val,addr) 26#define byteout(addr,val) outb(val,addr)
27#define bytein(addr) inb(addr) 27#define bytein(addr) inb(addr)
@@ -154,7 +154,7 @@ release_ioregs(struct IsdnCardState *cs, int mask)
154 release_region(cs->hw.teles3.hscx[1] + 32, 32); 154 release_region(cs->hw.teles3.hscx[1] + 32, 32);
155} 155}
156 156
157void 157static void
158release_io_teles3(struct IsdnCardState *cs) 158release_io_teles3(struct IsdnCardState *cs)
159{ 159{
160 if (cs->typ == ISDN_CTYPE_TELESPCMCIA) { 160 if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c
index 0661c6c31ad0..e2bb4fd8e25e 100644
--- a/drivers/isdn/hisax/telespci.c
+++ b/drivers/isdn/hisax/telespci.c
@@ -21,7 +21,7 @@
21#include <linux/pci.h> 21#include <linux/pci.h>
22 22
23extern const char *CardType[]; 23extern const char *CardType[];
24const char *telespci_revision = "$Revision: 2.23.2.3 $"; 24static const char *telespci_revision = "$Revision: 2.23.2.3 $";
25 25
26#define ZORAN_PO_RQ_PEN 0x02000000 26#define ZORAN_PO_RQ_PEN 0x02000000
27#define ZORAN_PO_WR 0x00800000 27#define ZORAN_PO_WR 0x00800000
@@ -257,7 +257,7 @@ telespci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
257 return IRQ_HANDLED; 257 return IRQ_HANDLED;
258} 258}
259 259
260void 260static void
261release_io_telespci(struct IsdnCardState *cs) 261release_io_telespci(struct IsdnCardState *cs)
262{ 262{
263 iounmap(cs->hw.teles0.membase); 263 iounmap(cs->hw.teles0.membase);
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c
index d2b6b8e72980..7baf8e488471 100644
--- a/drivers/isdn/hisax/w6692.c
+++ b/drivers/isdn/hisax/w6692.c
@@ -41,7 +41,7 @@ static const PCI_ENTRY id_list[] =
41 41
42extern const char *CardType[]; 42extern const char *CardType[];
43 43
44const char *w6692_revision = "$Revision: 1.18.2.4 $"; 44static const char *w6692_revision = "$Revision: 1.18.2.4 $";
45 45
46#define DBUSY_TIMER_VALUE 80 46#define DBUSY_TIMER_VALUE 80
47 47
@@ -880,7 +880,7 @@ setstack_w6692(struct PStack *st, struct BCState *bcs)
880 return (0); 880 return (0);
881} 881}
882 882
883void resetW6692(struct IsdnCardState *cs) 883static void resetW6692(struct IsdnCardState *cs)
884{ 884{
885 cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST); 885 cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST);
886 mdelay(10); 886 mdelay(10);
@@ -902,7 +902,7 @@ void resetW6692(struct IsdnCardState *cs)
902 } 902 }
903} 903}
904 904
905void __init initW6692(struct IsdnCardState *cs, int part) 905static void __init initW6692(struct IsdnCardState *cs, int part)
906{ 906{
907 if (part & 1) { 907 if (part & 1) {
908 cs->setstack_d = setstack_W6692; 908 cs->setstack_d = setstack_W6692;
diff --git a/drivers/isdn/i4l/isdn_audio.c b/drivers/isdn/i4l/isdn_audio.c
index 5350836a4f98..2cc56d6a9fae 100644
--- a/drivers/isdn/i4l/isdn_audio.c
+++ b/drivers/isdn/i4l/isdn_audio.c
@@ -392,16 +392,6 @@ isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in,
392} 392}
393 393
394int 394int
395isdn_audio_2adpcm_flush(adpcm_state * s, unsigned char *out)
396{
397 int olen = 0;
398
399 if (s->nleft)
400 isdn_audio_put_bits(0, 8 - s->nleft, s, &out, &olen);
401 return olen;
402}
403
404int
405isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in, 395isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in,
406 unsigned char *out, int len) 396 unsigned char *out, int len)
407{ 397{
diff --git a/drivers/isdn/i4l/isdn_audio.h b/drivers/isdn/i4l/isdn_audio.h
index 5a977b21dcfa..013c3582e0d1 100644
--- a/drivers/isdn/i4l/isdn_audio.h
+++ b/drivers/isdn/i4l/isdn_audio.h
@@ -35,7 +35,6 @@ extern void isdn_audio_alaw2ulaw(unsigned char *, unsigned long);
35extern adpcm_state *isdn_audio_adpcm_init(adpcm_state *, int); 35extern adpcm_state *isdn_audio_adpcm_init(adpcm_state *, int);
36extern int isdn_audio_adpcm2xlaw(adpcm_state *, int, unsigned char *, unsigned char *, int); 36extern int isdn_audio_adpcm2xlaw(adpcm_state *, int, unsigned char *, unsigned char *, int);
37extern int isdn_audio_xlaw2adpcm(adpcm_state *, int, unsigned char *, unsigned char *, int); 37extern int isdn_audio_xlaw2adpcm(adpcm_state *, int, unsigned char *, unsigned char *, int);
38extern int isdn_audio_2adpcm_flush(adpcm_state * s, unsigned char *out);
39extern void isdn_audio_calc_dtmf(modem_info *, unsigned char *, int, int); 38extern void isdn_audio_calc_dtmf(modem_info *, unsigned char *, int, int);
40extern void isdn_audio_eval_dtmf(modem_info *); 39extern void isdn_audio_eval_dtmf(modem_info *);
41dtmf_state *isdn_audio_dtmf_init(dtmf_state *); 40dtmf_state *isdn_audio_dtmf_init(dtmf_state *);
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index c406df6f268a..eebcb0b97f0e 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -67,7 +67,7 @@ static isdn_divert_if *divert_if; /* = NULL */
67static int isdn_writebuf_stub(int, int, const u_char __user *, int); 67static int isdn_writebuf_stub(int, int, const u_char __user *, int);
68static void set_global_features(void); 68static void set_global_features(void);
69static int isdn_wildmat(char *s, char *p); 69static int isdn_wildmat(char *s, char *p);
70 70static int isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding);
71 71
72static inline void 72static inline void
73isdn_lock_driver(isdn_driver_t *drv) 73isdn_lock_driver(isdn_driver_t *drv)
@@ -388,7 +388,7 @@ isdn_all_eaz(int di, int ch)
388 */ 388 */
389#include <linux/isdn/capicmd.h> 389#include <linux/isdn/capicmd.h>
390 390
391int 391static int
392isdn_capi_rec_hl_msg(capi_msg *cm) { 392isdn_capi_rec_hl_msg(capi_msg *cm) {
393 393
394 int di; 394 int di;
@@ -1923,7 +1923,7 @@ isdn_writebuf_skb_stub(int drvidx, int chan, int ack, struct sk_buff *skb)
1923 return ret; 1923 return ret;
1924} 1924}
1925 1925
1926int 1926static int
1927isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding) 1927isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
1928{ 1928{
1929 int j, k, m; 1929 int j, k, m;
diff --git a/drivers/isdn/i4l/isdn_common.h b/drivers/isdn/i4l/isdn_common.h
index 808135c427ad..e27e9c3a81ed 100644
--- a/drivers/isdn/i4l/isdn_common.h
+++ b/drivers/isdn/i4l/isdn_common.h
@@ -41,7 +41,6 @@ extern int isdn_get_free_channel(int, int, int, int, int, char *);
41extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *); 41extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
42extern int register_isdn(isdn_if * i); 42extern int register_isdn(isdn_if * i);
43extern int isdn_msncmp( const char *, const char *); 43extern int isdn_msncmp( const char *, const char *);
44extern int isdn_add_channels(isdn_driver_t *, int, int, int);
45#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP) 44#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
46extern void isdn_dumppkt(char *, u_char *, int, int); 45extern void isdn_dumppkt(char *, u_char *, int, int);
47#endif 46#endif
diff --git a/drivers/isdn/i4l/isdn_concap.c b/drivers/isdn/i4l/isdn_concap.c
index 83a4f5382bc2..0193b6f7c70c 100644
--- a/drivers/isdn/i4l/isdn_concap.c
+++ b/drivers/isdn/i4l/isdn_concap.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41 41
42int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *skb) 42static int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *skb)
43{ 43{
44 struct net_device *ndev = concap -> net_dev; 44 struct net_device *ndev = concap -> net_dev;
45 isdn_net_dev *nd = ((isdn_net_local *) ndev->priv)->netdev; 45 isdn_net_dev *nd = ((isdn_net_local *) ndev->priv)->netdev;
@@ -58,7 +58,7 @@ int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *skb)
58} 58}
59 59
60 60
61int isdn_concap_dl_connect_req(struct concap_proto *concap) 61static int isdn_concap_dl_connect_req(struct concap_proto *concap)
62{ 62{
63 struct net_device *ndev = concap -> net_dev; 63 struct net_device *ndev = concap -> net_dev;
64 isdn_net_local *lp = (isdn_net_local *) ndev->priv; 64 isdn_net_local *lp = (isdn_net_local *) ndev->priv;
@@ -71,7 +71,7 @@ int isdn_concap_dl_connect_req(struct concap_proto *concap)
71 return ret; 71 return ret;
72} 72}
73 73
74int isdn_concap_dl_disconn_req(struct concap_proto *concap) 74static int isdn_concap_dl_disconn_req(struct concap_proto *concap)
75{ 75{
76 IX25DEBUG( "isdn_concap_dl_disconn_req: %s \n", concap -> net_dev -> name); 76 IX25DEBUG( "isdn_concap_dl_disconn_req: %s \n", concap -> net_dev -> name);
77 77
@@ -85,15 +85,6 @@ struct concap_device_ops isdn_concap_reliable_dl_dops = {
85 &isdn_concap_dl_disconn_req 85 &isdn_concap_dl_disconn_req
86}; 86};
87 87
88struct concap_device_ops isdn_concap_demand_dial_dops = {
89 NULL, /* set this first entry to something like &isdn_net_start_xmit,
90 but the entry part of the current isdn_net_start_xmit must be
91 separated first. */
92 /* no connection control for demand dial semantics */
93 NULL,
94 NULL,
95};
96
97/* The following should better go into a dedicated source file such that 88/* The following should better go into a dedicated source file such that
98 this sourcefile does not need to include any protocol specific header 89 this sourcefile does not need to include any protocol specific header
99 files. For now: 90 files. For now:
diff --git a/drivers/isdn/i4l/isdn_concap.h b/drivers/isdn/i4l/isdn_concap.h
index 306eb180438f..6ac7e0445ea5 100644
--- a/drivers/isdn/i4l/isdn_concap.h
+++ b/drivers/isdn/i4l/isdn_concap.h
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10extern struct concap_device_ops isdn_concap_reliable_dl_dops; 10extern struct concap_device_ops isdn_concap_reliable_dl_dops;
11extern struct concap_device_ops isdn_concap_demand_dial_dops;
12extern struct concap_proto * isdn_concap_new( int ); 11extern struct concap_proto * isdn_concap_new( int );
13 12
14 13
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index e2b790e34510..f30e8e63ae0d 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -176,7 +176,7 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
176 176
177/* Prototypes */ 177/* Prototypes */
178 178
179int isdn_net_force_dial_lp(isdn_net_local *); 179static int isdn_net_force_dial_lp(isdn_net_local *);
180static int isdn_net_start_xmit(struct sk_buff *, struct net_device *); 180static int isdn_net_start_xmit(struct sk_buff *, struct net_device *);
181 181
182static void isdn_net_ciscohdlck_connected(isdn_net_local *lp); 182static void isdn_net_ciscohdlck_connected(isdn_net_local *lp);
@@ -312,7 +312,7 @@ isdn_net_unbind_channel(isdn_net_local * lp)
312 * Since this function is called every second, simply reset the 312 * Since this function is called every second, simply reset the
313 * byte-counter of the interface after copying it to the cps-variable. 313 * byte-counter of the interface after copying it to the cps-variable.
314 */ 314 */
315unsigned long last_jiffies = -HZ; 315static unsigned long last_jiffies = -HZ;
316 316
317void 317void
318isdn_net_autohup(void) 318isdn_net_autohup(void)
@@ -1131,7 +1131,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
1131} 1131}
1132 1132
1133 1133
1134void isdn_net_tx_timeout(struct net_device * ndev) 1134static void isdn_net_tx_timeout(struct net_device * ndev)
1135{ 1135{
1136 isdn_net_local *lp = (isdn_net_local *) ndev->priv; 1136 isdn_net_local *lp = (isdn_net_local *) ndev->priv;
1137 1137
@@ -1424,7 +1424,7 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
1424} 1424}
1425 1425
1426/* cisco hdlck device private ioctls */ 1426/* cisco hdlck device private ioctls */
1427int 1427static int
1428isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 1428isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1429{ 1429{
1430 isdn_net_local *lp = (isdn_net_local *) dev->priv; 1430 isdn_net_local *lp = (isdn_net_local *) dev->priv;
@@ -2461,7 +2461,7 @@ isdn_net_findif(char *name)
2461 * This is called from the userlevel-routine below or 2461 * This is called from the userlevel-routine below or
2462 * from isdn_net_start_xmit(). 2462 * from isdn_net_start_xmit().
2463 */ 2463 */
2464int 2464static int
2465isdn_net_force_dial_lp(isdn_net_local * lp) 2465isdn_net_force_dial_lp(isdn_net_local * lp)
2466{ 2466{
2467 if ((!(lp->flags & ISDN_NET_CONNECTED)) && !lp->dialstate) { 2467 if ((!(lp->flags & ISDN_NET_CONNECTED)) && !lp->dialstate) {
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index e21007eca0f0..ad5aa38fb5a6 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -273,7 +273,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb)
273 return 1; 273 return 1;
274} 274}
275 275
276void 276static void
277isdn_tty_cleanup_xmit(modem_info * info) 277isdn_tty_cleanup_xmit(modem_info * info)
278{ 278{
279 skb_queue_purge(&info->xmit_queue); 279 skb_queue_purge(&info->xmit_queue);
@@ -560,7 +560,7 @@ isdn_tty_modem_ncarrier(modem_info * info)
560/* 560/*
561 * return the usage calculated by si and layer 2 protocol 561 * return the usage calculated by si and layer 2 protocol
562 */ 562 */
563int 563static int
564isdn_calc_usage(int si, int l2) 564isdn_calc_usage(int si, int l2)
565{ 565{
566 int usg = ISDN_USAGE_MODEM; 566 int usg = ISDN_USAGE_MODEM;
diff --git a/drivers/isdn/i4l/isdn_tty.h b/drivers/isdn/i4l/isdn_tty.h
index 2423a7ff0cc3..9f0fa9501f4d 100644
--- a/drivers/isdn/i4l/isdn_tty.h
+++ b/drivers/isdn/i4l/isdn_tty.h
@@ -109,7 +109,6 @@ extern int isdn_tty_modem_init(void);
109extern void isdn_tty_exit(void); 109extern void isdn_tty_exit(void);
110extern void isdn_tty_readmodem(void); 110extern void isdn_tty_readmodem(void);
111extern int isdn_tty_find_icall(int, int, setup_parm *); 111extern int isdn_tty_find_icall(int, int, setup_parm *);
112extern void isdn_tty_cleanup_xmit(modem_info *);
113extern int isdn_tty_stat_callback(int, isdn_ctrl *); 112extern int isdn_tty_stat_callback(int, isdn_ctrl *);
114extern int isdn_tty_rcv_skb(int, int, int, struct sk_buff *); 113extern int isdn_tty_rcv_skb(int, int, int, struct sk_buff *);
115extern int isdn_tty_capi_facility(capi_msg *cm); 114extern int isdn_tty_capi_facility(capi_msg *cm);
diff --git a/drivers/isdn/i4l/isdn_ttyfax.c b/drivers/isdn/i4l/isdn_ttyfax.c
index ce2c3ef92e46..a943d078bacc 100644
--- a/drivers/isdn/i4l/isdn_ttyfax.c
+++ b/drivers/isdn/i4l/isdn_ttyfax.c
@@ -148,7 +148,7 @@ isdn_tty_fax_modem_result(int code, modem_info * info)
148 } 148 }
149} 149}
150 150
151int 151static int
152isdn_tty_fax_command1(modem_info * info, isdn_ctrl * c) 152isdn_tty_fax_command1(modem_info * info, isdn_ctrl * c)
153{ 153{
154 static char *msg[] = 154 static char *msg[] =
@@ -316,7 +316,7 @@ isdn_tty_fax_bitorder(modem_info * info, struct sk_buff *skb)
316 * Parse AT+F.. FAX class 1 commands 316 * Parse AT+F.. FAX class 1 commands
317 */ 317 */
318 318
319int 319static int
320isdn_tty_cmd_FCLASS1(char **p, modem_info * info) 320isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
321{ 321{
322 static char *cmd[] = 322 static char *cmd[] =
@@ -408,7 +408,7 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
408 * Parse AT+F.. FAX class 2 commands 408 * Parse AT+F.. FAX class 2 commands
409 */ 409 */
410 410
411int 411static int
412isdn_tty_cmd_FCLASS2(char **p, modem_info * info) 412isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
413{ 413{
414 atemu *m = &info->emu; 414 atemu *m = &info->emu;
diff --git a/drivers/isdn/i4l/isdn_x25iface.c b/drivers/isdn/i4l/isdn_x25iface.c
index 4ab7600cf9c1..edf14a2aa3c8 100644
--- a/drivers/isdn/i4l/isdn_x25iface.c
+++ b/drivers/isdn/i4l/isdn_x25iface.c
@@ -40,15 +40,15 @@ typedef struct isdn_x25iface_proto_data {
40 40
41 41
42/* is now in header file (extern): struct concap_proto * isdn_x25iface_proto_new(void); */ 42/* is now in header file (extern): struct concap_proto * isdn_x25iface_proto_new(void); */
43void isdn_x25iface_proto_del( struct concap_proto * ); 43static void isdn_x25iface_proto_del( struct concap_proto * );
44int isdn_x25iface_proto_close( struct concap_proto * ); 44static int isdn_x25iface_proto_close( struct concap_proto * );
45int isdn_x25iface_proto_restart( struct concap_proto *, 45static int isdn_x25iface_proto_restart( struct concap_proto *,
46 struct net_device *, 46 struct net_device *,
47 struct concap_device_ops *); 47 struct concap_device_ops *);
48int isdn_x25iface_xmit( struct concap_proto *, struct sk_buff * ); 48static int isdn_x25iface_xmit( struct concap_proto *, struct sk_buff * );
49int isdn_x25iface_receive( struct concap_proto *, struct sk_buff * ); 49static int isdn_x25iface_receive( struct concap_proto *, struct sk_buff * );
50int isdn_x25iface_connect_ind( struct concap_proto * ); 50static int isdn_x25iface_connect_ind( struct concap_proto * );
51int isdn_x25iface_disconn_ind( struct concap_proto * ); 51static int isdn_x25iface_disconn_ind( struct concap_proto * );
52 52
53 53
54static struct concap_proto_ops ix25_pops = { 54static struct concap_proto_ops ix25_pops = {
@@ -102,7 +102,7 @@ struct concap_proto * isdn_x25iface_proto_new(void)
102 102
103/* close the x25iface encapsulation protocol 103/* close the x25iface encapsulation protocol
104 */ 104 */
105int isdn_x25iface_proto_close(struct concap_proto *cprot){ 105static int isdn_x25iface_proto_close(struct concap_proto *cprot){
106 106
107 ix25_pdata_t *tmp; 107 ix25_pdata_t *tmp;
108 int ret = 0; 108 int ret = 0;
@@ -129,7 +129,7 @@ int isdn_x25iface_proto_close(struct concap_proto *cprot){
129 129
130/* Delete the x25iface encapsulation protocol instance 130/* Delete the x25iface encapsulation protocol instance
131 */ 131 */
132void isdn_x25iface_proto_del(struct concap_proto *cprot){ 132static void isdn_x25iface_proto_del(struct concap_proto *cprot){
133 133
134 ix25_pdata_t * tmp; 134 ix25_pdata_t * tmp;
135 135
@@ -158,9 +158,9 @@ void isdn_x25iface_proto_del(struct concap_proto *cprot){
158 158
159/* (re-)initialize the data structures for x25iface encapsulation 159/* (re-)initialize the data structures for x25iface encapsulation
160 */ 160 */
161int isdn_x25iface_proto_restart(struct concap_proto *cprot, 161static int isdn_x25iface_proto_restart(struct concap_proto *cprot,
162 struct net_device *ndev, 162 struct net_device *ndev,
163 struct concap_device_ops *dops) 163 struct concap_device_ops *dops)
164{ 164{
165 ix25_pdata_t * pda = cprot -> proto_data ; 165 ix25_pdata_t * pda = cprot -> proto_data ;
166 ulong flags; 166 ulong flags;
@@ -187,7 +187,7 @@ int isdn_x25iface_proto_restart(struct concap_proto *cprot,
187 187
188/* deliver a dl_data frame received from i4l HL driver to the network layer 188/* deliver a dl_data frame received from i4l HL driver to the network layer
189 */ 189 */
190int isdn_x25iface_receive(struct concap_proto *cprot, struct sk_buff *skb) 190static int isdn_x25iface_receive(struct concap_proto *cprot, struct sk_buff *skb)
191{ 191{
192 IX25DEBUG( "isdn_x25iface_receive %s \n", MY_DEVNAME(cprot->net_dev) ); 192 IX25DEBUG( "isdn_x25iface_receive %s \n", MY_DEVNAME(cprot->net_dev) );
193 if ( ( (ix25_pdata_t*) (cprot->proto_data) ) 193 if ( ( (ix25_pdata_t*) (cprot->proto_data) )
@@ -206,7 +206,7 @@ int isdn_x25iface_receive(struct concap_proto *cprot, struct sk_buff *skb)
206 206
207/* a connection set up is indicated by lower layer 207/* a connection set up is indicated by lower layer
208 */ 208 */
209int isdn_x25iface_connect_ind(struct concap_proto *cprot) 209static int isdn_x25iface_connect_ind(struct concap_proto *cprot)
210{ 210{
211 struct sk_buff * skb = dev_alloc_skb(1); 211 struct sk_buff * skb = dev_alloc_skb(1);
212 enum wan_states *state_p 212 enum wan_states *state_p
@@ -235,7 +235,7 @@ int isdn_x25iface_connect_ind(struct concap_proto *cprot)
235 235
236/* a disconnect is indicated by lower layer 236/* a disconnect is indicated by lower layer
237 */ 237 */
238int isdn_x25iface_disconn_ind(struct concap_proto *cprot) 238static int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
239{ 239{
240 struct sk_buff *skb; 240 struct sk_buff *skb;
241 enum wan_states *state_p 241 enum wan_states *state_p
@@ -264,7 +264,7 @@ int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
264/* process a frame handed over to us from linux network layer. First byte 264/* process a frame handed over to us from linux network layer. First byte
265 semantics as defined in Documentation/networking/x25-iface.txt 265 semantics as defined in Documentation/networking/x25-iface.txt
266 */ 266 */
267int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb) 267static int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb)
268{ 268{
269 unsigned char firstbyte = skb->data[0]; 269 unsigned char firstbyte = skb->data[0];
270 enum wan_states *state = &((ix25_pdata_t*)cprot->proto_data)->state; 270 enum wan_states *state = &((ix25_pdata_t*)cprot->proto_data)->state;
diff --git a/drivers/isdn/pcbit/callbacks.c b/drivers/isdn/pcbit/callbacks.c
index 692ec72d1ee8..f151f36c8255 100644
--- a/drivers/isdn/pcbit/callbacks.c
+++ b/drivers/isdn/pcbit/callbacks.c
@@ -125,23 +125,6 @@ void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
125 125
126 126
127/* 127/*
128 * Disconnect received (actually RELEASE COMPLETE)
129 * This means we were not able to establish connection with remote
130 * Inform the big boss above
131 */
132void cb_out_3(struct pcbit_dev * dev, struct pcbit_chan* chan,
133 struct callb_data *data)
134{
135 isdn_ctrl ictl;
136
137 ictl.command = ISDN_STAT_DHUP;
138 ictl.driver=dev->id;
139 ictl.arg=chan->id;
140 dev->dev_if->statcallb(&ictl);
141}
142
143
144/*
145 * Incoming call received 128 * Incoming call received
146 * inform user 129 * inform user
147 */ 130 */
diff --git a/drivers/isdn/pcbit/callbacks.h b/drivers/isdn/pcbit/callbacks.h
index f510dc56b57e..17aa0f54bfc3 100644
--- a/drivers/isdn/pcbit/callbacks.h
+++ b/drivers/isdn/pcbit/callbacks.h
@@ -19,9 +19,6 @@ extern void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan,
19extern void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, 19extern void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
20 struct callb_data *data); 20 struct callb_data *data);
21 21
22extern void cb_out_3(struct pcbit_dev * dev, struct pcbit_chan* chan,
23 struct callb_data *data);
24
25extern void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, 22extern void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan,
26 struct callb_data *data); 23 struct callb_data *data);
27extern void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, 24extern void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
diff --git a/drivers/isdn/pcbit/capi.c b/drivers/isdn/pcbit/capi.c
index 29eb03a8c29d..bef321d0e51d 100644
--- a/drivers/isdn/pcbit/capi.c
+++ b/drivers/isdn/pcbit/capi.c
@@ -627,16 +627,6 @@ int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb)
627 return 0; 627 return 0;
628} 628}
629 629
630int capi_decode_disc_conf(struct pcbit_chan *chan, struct sk_buff *skb)
631{
632 ushort errcode;
633
634 errcode = *((ushort*) skb->data);
635 skb_pull(skb, 2);
636
637 return errcode;
638}
639
640#ifdef DEBUG 630#ifdef DEBUG
641int capi_decode_debug_188(u_char *hdr, ushort hdrlen) 631int capi_decode_debug_188(u_char *hdr, ushort hdrlen)
642{ 632{
diff --git a/drivers/isdn/pcbit/capi.h b/drivers/isdn/pcbit/capi.h
index 18e6aa360a8f..df8e73c04d7f 100644
--- a/drivers/isdn/pcbit/capi.h
+++ b/drivers/isdn/pcbit/capi.h
@@ -54,7 +54,6 @@ extern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff ** skb);
54 54
55/* Connection Termination */ 55/* Connection Termination */
56extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause); 56extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause);
57extern int capi_decode_disc_conf(struct pcbit_chan *chan, struct sk_buff *skb);
58 57
59extern int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb); 58extern int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb);
60extern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb); 59extern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb);
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
index e98f9c48c184..5de861f40816 100644
--- a/drivers/isdn/pcbit/drv.c
+++ b/drivers/isdn/pcbit/drv.c
@@ -56,10 +56,10 @@ static char* pcbit_devname[MAX_PCBIT_CARDS] = {
56 * prototypes 56 * prototypes
57 */ 57 */
58 58
59int pcbit_command(isdn_ctrl* ctl); 59static int pcbit_command(isdn_ctrl* ctl);
60int pcbit_stat(u_char __user * buf, int len, int, int); 60static int pcbit_stat(u_char __user * buf, int len, int, int);
61int pcbit_xmit(int driver, int chan, int ack, struct sk_buff *skb); 61static int pcbit_xmit(int driver, int chan, int ack, struct sk_buff *skb);
62int pcbit_writecmd(const u_char __user *, int, int, int); 62static int pcbit_writecmd(const u_char __user *, int, int, int);
63 63
64static int set_protocol_running(struct pcbit_dev * dev); 64static int set_protocol_running(struct pcbit_dev * dev);
65 65
@@ -238,7 +238,7 @@ void pcbit_terminate(int board)
238} 238}
239#endif 239#endif
240 240
241int pcbit_command(isdn_ctrl* ctl) 241static int pcbit_command(isdn_ctrl* ctl)
242{ 242{
243 struct pcbit_dev *dev; 243 struct pcbit_dev *dev;
244 struct pcbit_chan *chan; 244 struct pcbit_chan *chan;
@@ -330,7 +330,7 @@ static void pcbit_block_timer(unsigned long data)
330} 330}
331#endif 331#endif
332 332
333int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb) 333static int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb)
334{ 334{
335 ushort hdrlen; 335 ushort hdrlen;
336 int refnum, len; 336 int refnum, len;
@@ -389,7 +389,7 @@ int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb)
389 return len; 389 return len;
390} 390}
391 391
392int pcbit_writecmd(const u_char __user *buf, int len, int driver, int channel) 392static int pcbit_writecmd(const u_char __user *buf, int len, int driver, int channel)
393{ 393{
394 struct pcbit_dev * dev; 394 struct pcbit_dev * dev;
395 int i, j; 395 int i, j;
@@ -713,7 +713,7 @@ static char statbuf[STATBUF_LEN];
713static int stat_st = 0; 713static int stat_st = 0;
714static int stat_end = 0; 714static int stat_end = 0;
715 715
716int pcbit_stat(u_char __user *buf, int len, int driver, int channel) 716static int pcbit_stat(u_char __user *buf, int len, int driver, int channel)
717{ 717{
718 int stat_count; 718 int stat_count;
719 stat_count = stat_end - stat_st; 719 stat_count = stat_end - stat_st;
diff --git a/drivers/isdn/sc/Makefile b/drivers/isdn/sc/Makefile
index 9cc474cd0c44..0f2b7d602ac0 100644
--- a/drivers/isdn/sc/Makefile
+++ b/drivers/isdn/sc/Makefile
@@ -6,5 +6,5 @@ obj-$(CONFIG_ISDN_DRV_SC) += sc.o
6 6
7# Multipart objects. 7# Multipart objects.
8 8
9sc-y := shmem.o init.o debug.o packet.o command.o event.o \ 9sc-y := shmem.o init.o packet.o command.o event.o \
10 ioctl.o interrupt.o message.o timer.o 10 ioctl.o interrupt.o message.o timer.o
diff --git a/drivers/isdn/sc/command.c b/drivers/isdn/sc/command.c
index b2c4eac7cef5..19f2fcf0ae4a 100644
--- a/drivers/isdn/sc/command.c
+++ b/drivers/isdn/sc/command.c
@@ -22,14 +22,14 @@
22#include "card.h" 22#include "card.h"
23#include "scioc.h" 23#include "scioc.h"
24 24
25int dial(int card, unsigned long channel, setup_parm setup); 25static int dial(int card, unsigned long channel, setup_parm setup);
26int hangup(int card, unsigned long channel); 26static int hangup(int card, unsigned long channel);
27int answer(int card, unsigned long channel); 27static int answer(int card, unsigned long channel);
28int clreaz(int card, unsigned long channel); 28static int clreaz(int card, unsigned long channel);
29int seteaz(int card, unsigned long channel, char *); 29static int seteaz(int card, unsigned long channel, char *);
30int setl2(int card, unsigned long arg); 30static int setl2(int card, unsigned long arg);
31int setl3(int card, unsigned long arg); 31static int setl3(int card, unsigned long arg);
32int acceptb(int card, unsigned long channel); 32static int acceptb(int card, unsigned long channel);
33 33
34extern int cinst; 34extern int cinst;
35extern board *sc_adapter[]; 35extern board *sc_adapter[];
@@ -148,56 +148,6 @@ int command(isdn_ctrl *cmd)
148} 148}
149 149
150/* 150/*
151 * Confirm our ability to communicate with the board. This test assumes no
152 * other message activity is present
153 */
154int loopback(int card)
155{
156
157 int status;
158 static char testmsg[] = "Test Message";
159 RspMessage rspmsg;
160
161 if(!IS_VALID_CARD(card)) {
162 pr_debug("Invalid param: %d is not a valid card id\n", card);
163 return -ENODEV;
164 }
165
166 pr_debug("%s: Sending loopback message\n",
167 sc_adapter[card]->devicename);
168
169 /*
170 * Send the loopback message to confirm that memory transfer is
171 * operational
172 */
173 status = send_and_receive(card, CMPID, cmReqType1,
174 cmReqClass0,
175 cmReqMsgLpbk,
176 0,
177 (unsigned char) strlen(testmsg),
178 (unsigned char *)testmsg,
179 &rspmsg, SAR_TIMEOUT);
180
181
182 if (!status) {
183 pr_debug("%s: Loopback message successfully sent\n",
184 sc_adapter[card]->devicename);
185 if(strcmp(rspmsg.msg_data.byte_array, testmsg)) {
186 pr_debug("%s: Loopback return != sent\n",
187 sc_adapter[card]->devicename);
188 return -EIO;
189 }
190 return 0;
191 }
192 else {
193 pr_debug("%s: Send loopback message failed\n",
194 sc_adapter[card]->devicename);
195 return -EIO;
196 }
197
198}
199
200/*
201 * start the onboard firmware 151 * start the onboard firmware
202 */ 152 */
203int startproc(int card) 153int startproc(int card)
@@ -222,16 +172,10 @@ int startproc(int card)
222} 172}
223 173
224 174
225int loadproc(int card, char *data)
226{
227 return -1;
228}
229
230
231/* 175/*
232 * Dials the number passed in 176 * Dials the number passed in
233 */ 177 */
234int dial(int card, unsigned long channel, setup_parm setup) 178static int dial(int card, unsigned long channel, setup_parm setup)
235{ 179{
236 int status; 180 int status;
237 char Phone[48]; 181 char Phone[48];
@@ -261,7 +205,7 @@ int dial(int card, unsigned long channel, setup_parm setup)
261/* 205/*
262 * Answer an incoming call 206 * Answer an incoming call
263 */ 207 */
264int answer(int card, unsigned long channel) 208static int answer(int card, unsigned long channel)
265{ 209{
266 if(!IS_VALID_CARD(card)) { 210 if(!IS_VALID_CARD(card)) {
267 pr_debug("Invalid param: %d is not a valid card id\n", card); 211 pr_debug("Invalid param: %d is not a valid card id\n", card);
@@ -282,7 +226,7 @@ int answer(int card, unsigned long channel)
282/* 226/*
283 * Hangup up the call on specified channel 227 * Hangup up the call on specified channel
284 */ 228 */
285int hangup(int card, unsigned long channel) 229static int hangup(int card, unsigned long channel)
286{ 230{
287 int status; 231 int status;
288 232
@@ -305,7 +249,7 @@ int hangup(int card, unsigned long channel)
305/* 249/*
306 * Set the layer 2 protocol (X.25, HDLC, Raw) 250 * Set the layer 2 protocol (X.25, HDLC, Raw)
307 */ 251 */
308int setl2(int card, unsigned long arg) 252static int setl2(int card, unsigned long arg)
309{ 253{
310 int status =0; 254 int status =0;
311 int protocol,channel; 255 int protocol,channel;
@@ -340,7 +284,7 @@ int setl2(int card, unsigned long arg)
340/* 284/*
341 * Set the layer 3 protocol 285 * Set the layer 3 protocol
342 */ 286 */
343int setl3(int card, unsigned long channel) 287static int setl3(int card, unsigned long channel)
344{ 288{
345 int protocol = channel >> 8; 289 int protocol = channel >> 8;
346 290
@@ -355,7 +299,7 @@ int setl3(int card, unsigned long channel)
355 return 0; 299 return 0;
356} 300}
357 301
358int acceptb(int card, unsigned long channel) 302static int acceptb(int card, unsigned long channel)
359{ 303{
360 if(!IS_VALID_CARD(card)) { 304 if(!IS_VALID_CARD(card)) {
361 pr_debug("Invalid param: %d is not a valid card id\n", card); 305 pr_debug("Invalid param: %d is not a valid card id\n", card);
@@ -374,7 +318,7 @@ int acceptb(int card, unsigned long channel)
374 return 0; 318 return 0;
375} 319}
376 320
377int clreaz(int card, unsigned long arg) 321static int clreaz(int card, unsigned long arg)
378{ 322{
379 if(!IS_VALID_CARD(card)) { 323 if(!IS_VALID_CARD(card)) {
380 pr_debug("Invalid param: %d is not a valid card id\n", card); 324 pr_debug("Invalid param: %d is not a valid card id\n", card);
@@ -388,7 +332,7 @@ int clreaz(int card, unsigned long arg)
388 return 0; 332 return 0;
389} 333}
390 334
391int seteaz(int card, unsigned long arg, char *num) 335static int seteaz(int card, unsigned long arg, char *num)
392{ 336{
393 if(!IS_VALID_CARD(card)) { 337 if(!IS_VALID_CARD(card)) {
394 pr_debug("Invalid param: %d is not a valid card id\n", card); 338 pr_debug("Invalid param: %d is not a valid card id\n", card);
diff --git a/drivers/isdn/sc/debug.c b/drivers/isdn/sc/debug.c
deleted file mode 100644
index 1a992a75868b..000000000000
--- a/drivers/isdn/sc/debug.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/* $Id: debug.c,v 1.5.6.1 2001/09/23 22:24:59 kai Exp $
2 *
3 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
4 *
5 * This software may be used and distributed according to the terms
6 * of the GNU General Public License, incorporated herein by reference.
7 *
8 * For more information, please contact gpl-info@spellcast.com or write:
9 *
10 * SpellCaster Telecommunications Inc.
11 * 5621 Finch Avenue East, Unit #3
12 * Scarborough, Ontario Canada
13 * M1B 2T9
14 * +1 (416) 297-8565
15 * +1 (416) 297-6433 Facsimile
16 */
17
18#include <linux/kernel.h>
19#include <linux/string.h>
20
21int dbg_level = 0;
22static char dbg_funcname[255];
23
24void dbg_endfunc(void)
25{
26 if (dbg_level) {
27 printk("<-- Leaving function %s\n", dbg_funcname);
28 strcpy(dbg_funcname, "");
29 }
30}
31
32void dbg_func(char *func)
33{
34 strcpy(dbg_funcname, func);
35 if(dbg_level)
36 printk("--> Entering function %s\n", dbg_funcname);
37}
38
39inline void pullphone(char *dn, char *str)
40{
41 int i = 0;
42
43 while(dn[i] != ',')
44 str[i] = dn[i], i++;
45 str[i] = 0x0;
46}
diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c
index efefedea37b9..40b0df04ed9f 100644
--- a/drivers/isdn/sc/init.c
+++ b/drivers/isdn/sc/init.c
@@ -20,9 +20,9 @@ board *sc_adapter[MAX_CARDS];
20int cinst; 20int cinst;
21 21
22static char devname[] = "scX"; 22static char devname[] = "scX";
23const char version[] = "2.0b1"; 23static const char version[] = "2.0b1";
24 24
25const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; 25static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" };
26 26
27/* insmod set parameters */ 27/* insmod set parameters */
28static unsigned int io[] = {0,0,0,0}; 28static unsigned int io[] = {0,0,0,0};
@@ -35,26 +35,13 @@ module_param_array(irq, int, NULL, 0);
35module_param_array(ram, int, NULL, 0); 35module_param_array(ram, int, NULL, 0);
36module_param(do_reset, bool, 0); 36module_param(do_reset, bool, 0);
37 37
38static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 };
39#define MAX_IRQS 10
40
41extern irqreturn_t interrupt_handler(int, void *, struct pt_regs *); 38extern irqreturn_t interrupt_handler(int, void *, struct pt_regs *);
42extern int sndpkt(int, int, int, struct sk_buff *); 39extern int sndpkt(int, int, int, struct sk_buff *);
43extern int command(isdn_ctrl *); 40extern int command(isdn_ctrl *);
44extern int indicate_status(int, int, ulong, char*); 41extern int indicate_status(int, int, ulong, char*);
45extern int reset(int); 42extern int reset(int);
46 43
47int identify_board(unsigned long, unsigned int); 44static int identify_board(unsigned long, unsigned int);
48
49int irq_supported(int irq_x)
50{
51 int i;
52 for(i=0 ; i < MAX_IRQS ; i++) {
53 if(sup_irq[i] == irq_x)
54 return 1;
55 }
56 return 0;
57}
58 45
59static int __init sc_init(void) 46static int __init sc_init(void)
60{ 47{
@@ -454,7 +441,7 @@ static void __exit sc_exit(void)
454 pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n"); 441 pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n");
455} 442}
456 443
457int identify_board(unsigned long rambase, unsigned int iobase) 444static int identify_board(unsigned long rambase, unsigned int iobase)
458{ 445{
459 unsigned int pgport; 446 unsigned int pgport;
460 unsigned long sig; 447 unsigned long sig;
diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c
index e5e164aca7fa..8631d338d69a 100644
--- a/drivers/isdn/sc/interrupt.c
+++ b/drivers/isdn/sc/interrupt.c
@@ -31,7 +31,7 @@ extern void rcvpkt(int, RspMessage *);
31extern int cinst; 31extern int cinst;
32extern board *sc_adapter[]; 32extern board *sc_adapter[];
33 33
34int get_card_from_irq(int irq) 34static int get_card_from_irq(int irq)
35{ 35{
36 int i; 36 int i;
37 37
diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c
index 1371a990416a..3314a5a19854 100644
--- a/drivers/isdn/sc/ioctl.c
+++ b/drivers/isdn/sc/ioctl.c
@@ -14,7 +14,6 @@
14 14
15extern int indicate_status(int, int, unsigned long, char *); 15extern int indicate_status(int, int, unsigned long, char *);
16extern int startproc(int); 16extern int startproc(int);
17extern int loadproc(int, char *record);
18extern int reset(int); 17extern int reset(int);
19extern int send_and_receive(int, unsigned int, unsigned char,unsigned char, 18extern int send_and_receive(int, unsigned int, unsigned char,unsigned char,
20 unsigned char,unsigned char, 19 unsigned char,unsigned char,
@@ -23,7 +22,7 @@ extern int send_and_receive(int, unsigned int, unsigned char,unsigned char,
23extern board *sc_adapter[]; 22extern board *sc_adapter[];
24 23
25 24
26int GetStatus(int card, boardInfo *); 25static int GetStatus(int card, boardInfo *);
27 26
28/* 27/*
29 * Process private IOCTL messages (typically from scctrl) 28 * Process private IOCTL messages (typically from scctrl)
@@ -428,7 +427,7 @@ int sc_ioctl(int card, scs_ioctl *data)
428 return 0; 427 return 0;
429} 428}
430 429
431int GetStatus(int card, boardInfo *bi) 430static int GetStatus(int card, boardInfo *bi)
432{ 431{
433 RspMessage rcvmsg; 432 RspMessage rcvmsg;
434 int i, status; 433 int i, status;
diff --git a/drivers/isdn/sc/packet.c b/drivers/isdn/sc/packet.c
index 8e3fac3ba1a1..f50defc38ae5 100644
--- a/drivers/isdn/sc/packet.c
+++ b/drivers/isdn/sc/packet.c
@@ -213,19 +213,3 @@ int setup_buffers(int card, int c)
213 return 0; 213 return 0;
214} 214}
215 215
216int print_skb(int card,char *skb_p, int len){
217 int i,data;
218 pr_debug("%s: data at 0x%x len: 0x%x\n", sc_adapter[card]->devicename,
219 skb_p,len);
220 for(i=1;i<=len;i++,skb_p++){
221 data = (int) (0xff & (*skb_p));
222 pr_debug("%s: data = 0x%x", sc_adapter[card]->devicename,data);
223 if(!(i%4))
224 pr_debug(" ");
225 if(!(i%32))
226 pr_debug("\n");
227 }
228 pr_debug("\n");
229 return 0;
230}
231
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c
index 7bc2dfad0775..24854826ca45 100644
--- a/drivers/isdn/sc/shmem.c
+++ b/drivers/isdn/sc/shmem.c
@@ -108,6 +108,7 @@ void memcpy_fromshmem(int card, void *dest, const void *src, size_t n)
108 sc_adapter[card]->rambase + ((unsigned long) src %0x4000), (unsigned long) dest); */ 108 sc_adapter[card]->rambase + ((unsigned long) src %0x4000), (unsigned long) dest); */
109} 109}
110 110
111#if 0
111void memset_shmem(int card, void *dest, int c, size_t n) 112void memset_shmem(int card, void *dest, int c, size_t n)
112{ 113{
113 unsigned long flags; 114 unsigned long flags;
@@ -141,3 +142,4 @@ void memset_shmem(int card, void *dest, int c, size_t n)
141 ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); 142 ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80);
142 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); 143 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags);
143} 144}
145#endif /* 0 */
diff --git a/drivers/isdn/sc/timer.c b/drivers/isdn/sc/timer.c
index 710d0f47ca35..aced19aac5a2 100644
--- a/drivers/isdn/sc/timer.c
+++ b/drivers/isdn/sc/timer.c
@@ -32,7 +32,7 @@ extern int sendmessage(int, unsigned int, unsigned int, unsigned int,
32/* 32/*
33 * Write the proper values into the I/O ports following a reset 33 * Write the proper values into the I/O ports following a reset
34 */ 34 */
35void setup_ports(int card) 35static void setup_ports(int card)
36{ 36{
37 37
38 outb((sc_adapter[card]->rambase >> 12), sc_adapter[card]->ioport[EXP_BASE]); 38 outb((sc_adapter[card]->rambase >> 12), sc_adapter[card]->ioport[EXP_BASE]);
@@ -129,19 +129,3 @@ void check_phystat(unsigned long data)
129 ceReqPhyStatus,0,0,NULL); 129 ceReqPhyStatus,0,0,NULL);
130} 130}
131 131
132/*
133 * When in trace mode, this callback is used to swap the working shared
134 * RAM page to the trace page(s) and process all received messages. It
135 * must be called often enough to get all of the messages out of RAM before
136 * it loops around.
137 * Trace messages are \n terminated strings.
138 * We output the messages in 64 byte chunks through readstat. Each chunk
139 * is scanned for a \n followed by a time stamp. If the timerstamp is older
140 * than the current time, scanning stops and the page and offset are recorded
141 * as the starting point the next time the trace timer is called. The final
142 * step is to restore the working page and reset the timer.
143 */
144void trace_timer(unsigned long data)
145{
146 /* not implemented */
147}
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index 5ba190ce14a0..c9ca1118e449 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -328,9 +328,7 @@ static int monitor_task(void *arg)
328 struct thermostat* th = arg; 328 struct thermostat* th = arg;
329 329
330 while(!kthread_should_stop()) { 330 while(!kthread_should_stop()) {
331 if (current->flags & PF_FREEZE) 331 try_to_freeze();
332 refrigerator(PF_FREEZE);
333
334 msleep_interruptible(2000); 332 msleep_interruptible(2000);
335 333
336#ifndef DEBUG 334#ifndef DEBUG
diff --git a/drivers/mca/mca-legacy.c b/drivers/mca/mca-legacy.c
index af56313ba0af..0c7bfa74c8ef 100644
--- a/drivers/mca/mca-legacy.c
+++ b/drivers/mca/mca-legacy.c
@@ -180,7 +180,6 @@ struct mca_device *mca_find_device_by_slot(int slot)
180 180
181 return info.mca_dev; 181 return info.mca_dev;
182} 182}
183EXPORT_SYMBOL(mca_find_device_by_slot);
184 183
185/** 184/**
186 * mca_read_stored_pos - read POS register from boot data 185 * mca_read_stored_pos - read POS register from boot data
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0c6b5b6baff6..3802f7a17f16 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2976,8 +2976,7 @@ static int md_thread(void * arg)
2976 wait_event_interruptible_timeout(thread->wqueue, 2976 wait_event_interruptible_timeout(thread->wqueue,
2977 test_bit(THREAD_WAKEUP, &thread->flags), 2977 test_bit(THREAD_WAKEUP, &thread->flags),
2978 thread->timeout); 2978 thread->timeout);
2979 if (current->flags & PF_FREEZE) 2979 try_to_freeze();
2980 refrigerator(PF_FREEZE);
2981 2980
2982 clear_bit(THREAD_WAKEUP, &thread->flags); 2981 clear_bit(THREAD_WAKEUP, &thread->flags);
2983 2982
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index d6b7a9de471e..f11daae91cd4 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -391,8 +391,7 @@ static int dvb_frontend_thread(void *data)
391 break; 391 break;
392 } 392 }
393 393
394 if (current->flags & PF_FREEZE) 394 try_to_freeze();
395 refrigerator(PF_FREEZE);
396 395
397 if (down_interruptible(&fepriv->sem)) 396 if (down_interruptible(&fepriv->sem))
398 break; 397 break;
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index ac0dc27bb38f..867e988a5a93 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -435,7 +435,6 @@ struct cx8802_dev {
435/* ----------------------------------------------------------- */ 435/* ----------------------------------------------------------- */
436/* cx88-core.c */ 436/* cx88-core.c */
437 437
438extern char *cx88_pci_irqs[32];
439extern char *cx88_vid_irqs[32]; 438extern char *cx88_vid_irqs[32];
440extern char *cx88_mpeg_irqs[32]; 439extern char *cx88_mpeg_irqs[32];
441extern void cx88_print_irqbits(char *name, char *tag, char **strings, 440extern void cx88_print_irqbits(char *name, char *tag, char **strings,
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index 1b7d38e96f14..b4ee9dfe6d42 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -750,8 +750,7 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout)
750#endif 750#endif
751 } 751 }
752 } 752 }
753 if (current->flags & PF_FREEZE) 753 try_to_freeze();
754 refrigerator(PF_FREEZE);
755 remove_wait_queue(&msp->wq, &wait); 754 remove_wait_queue(&msp->wq, &wait);
756 return msp->restart; 755 return msp->restart;
757} 756}
diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c
index 5f870075b55e..15f5bb486963 100644
--- a/drivers/media/video/video-buf-dvb.c
+++ b/drivers/media/video/video-buf-dvb.c
@@ -62,8 +62,7 @@ static int videobuf_dvb_thread(void *data)
62 break; 62 break;
63 if (kthread_should_stop()) 63 if (kthread_should_stop())
64 break; 64 break;
65 if (current->flags & PF_FREEZE) 65 try_to_freeze();
66 refrigerator(PF_FREEZE);
67 66
68 /* feed buffer data to demux */ 67 /* feed buffer data to demux */
69 if (buf->state == STATE_DONE) 68 if (buf->state == STATE_DONE)
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 047202c4d9a8..5a4a08a7c951 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1606,7 +1606,7 @@ static int rtl8139_thread (void *data)
1606 do { 1606 do {
1607 timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout); 1607 timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout);
1608 /* make swsusp happy with our thread */ 1608 /* make swsusp happy with our thread */
1609 try_to_freeze(PF_FREEZE); 1609 try_to_freeze();
1610 } while (!signal_pending (current) && (timeout > 0)); 1610 } while (!signal_pending (current) && (timeout > 0));
1611 1611
1612 if (signal_pending (current)) { 1612 if (signal_pending (current)) {
diff --git a/drivers/net/irda/sir_kthread.c b/drivers/net/irda/sir_kthread.c
index 18cea1099530..c65054364bca 100644
--- a/drivers/net/irda/sir_kthread.c
+++ b/drivers/net/irda/sir_kthread.c
@@ -135,8 +135,7 @@ static int irda_thread(void *startup)
135 remove_wait_queue(&irda_rq_queue.kick, &wait); 135 remove_wait_queue(&irda_rq_queue.kick, &wait);
136 136
137 /* make swsusp happy with our thread */ 137 /* make swsusp happy with our thread */
138 if (current->flags & PF_FREEZE) 138 try_to_freeze();
139 refrigerator(PF_FREEZE);
140 139
141 run_irda_queue(); 140 run_irda_queue();
142 } 141 }
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 66f488c13717..15f207323d97 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -763,7 +763,7 @@ static int stir_transmit_thread(void *arg)
763 { 763 {
764#ifdef CONFIG_PM 764#ifdef CONFIG_PM
765 /* if suspending, then power off and wait */ 765 /* if suspending, then power off and wait */
766 if (unlikely(current->flags & PF_FREEZE)) { 766 if (unlikely(freezing(current))) {
767 if (stir->receiving) 767 if (stir->receiving)
768 receive_stop(stir); 768 receive_stop(stir);
769 else 769 else
@@ -771,7 +771,7 @@ static int stir_transmit_thread(void *arg)
771 771
772 write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD); 772 write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
773 773
774 refrigerator(PF_FREEZE); 774 refrigerator();
775 775
776 if (change_speed(stir, stir->speed)) 776 if (change_speed(stir, stir->speed))
777 break; 777 break;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index a0b8848049c9..7e371b1209a1 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -66,8 +66,8 @@
66 66
67#define DRV_MODULE_NAME "tg3" 67#define DRV_MODULE_NAME "tg3"
68#define PFX DRV_MODULE_NAME ": " 68#define PFX DRV_MODULE_NAME ": "
69#define DRV_MODULE_VERSION "3.31" 69#define DRV_MODULE_VERSION "3.32"
70#define DRV_MODULE_RELDATE "June 8, 2005" 70#define DRV_MODULE_RELDATE "June 24, 2005"
71 71
72#define TG3_DEF_MAC_MODE 0 72#define TG3_DEF_MAC_MODE 0
73#define TG3_DEF_RX_MODE 0 73#define TG3_DEF_RX_MODE 0
@@ -337,12 +337,10 @@ static struct {
337static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) 337static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
338{ 338{
339 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { 339 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) {
340 unsigned long flags; 340 spin_lock_bh(&tp->indirect_lock);
341
342 spin_lock_irqsave(&tp->indirect_lock, flags);
343 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); 341 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off);
344 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); 342 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val);
345 spin_unlock_irqrestore(&tp->indirect_lock, flags); 343 spin_unlock_bh(&tp->indirect_lock);
346 } else { 344 } else {
347 writel(val, tp->regs + off); 345 writel(val, tp->regs + off);
348 if ((tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) != 0) 346 if ((tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) != 0)
@@ -353,12 +351,10 @@ static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
353static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) 351static void _tw32_flush(struct tg3 *tp, u32 off, u32 val)
354{ 352{
355 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { 353 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) {
356 unsigned long flags; 354 spin_lock_bh(&tp->indirect_lock);
357
358 spin_lock_irqsave(&tp->indirect_lock, flags);
359 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); 355 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off);
360 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); 356 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val);
361 spin_unlock_irqrestore(&tp->indirect_lock, flags); 357 spin_unlock_bh(&tp->indirect_lock);
362 } else { 358 } else {
363 void __iomem *dest = tp->regs + off; 359 void __iomem *dest = tp->regs + off;
364 writel(val, dest); 360 writel(val, dest);
@@ -398,28 +394,24 @@ static inline void _tw32_tx_mbox(struct tg3 *tp, u32 off, u32 val)
398 394
399static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) 395static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
400{ 396{
401 unsigned long flags; 397 spin_lock_bh(&tp->indirect_lock);
402
403 spin_lock_irqsave(&tp->indirect_lock, flags);
404 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 398 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
405 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 399 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
406 400
407 /* Always leave this as zero. */ 401 /* Always leave this as zero. */
408 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 402 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
409 spin_unlock_irqrestore(&tp->indirect_lock, flags); 403 spin_unlock_bh(&tp->indirect_lock);
410} 404}
411 405
412static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) 406static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
413{ 407{
414 unsigned long flags; 408 spin_lock_bh(&tp->indirect_lock);
415
416 spin_lock_irqsave(&tp->indirect_lock, flags);
417 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 409 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
418 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 410 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
419 411
420 /* Always leave this as zero. */ 412 /* Always leave this as zero. */
421 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 413 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
422 spin_unlock_irqrestore(&tp->indirect_lock, flags); 414 spin_unlock_bh(&tp->indirect_lock);
423} 415}
424 416
425static void tg3_disable_ints(struct tg3 *tp) 417static void tg3_disable_ints(struct tg3 *tp)
@@ -438,12 +430,14 @@ static inline void tg3_cond_int(struct tg3 *tp)
438 430
439static void tg3_enable_ints(struct tg3 *tp) 431static void tg3_enable_ints(struct tg3 *tp)
440{ 432{
433 tp->irq_sync = 0;
434 wmb();
435
441 tw32(TG3PCI_MISC_HOST_CTRL, 436 tw32(TG3PCI_MISC_HOST_CTRL,
442 (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); 437 (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT));
443 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 438 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
444 (tp->last_tag << 24)); 439 (tp->last_tag << 24));
445 tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); 440 tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
446
447 tg3_cond_int(tp); 441 tg3_cond_int(tp);
448} 442}
449 443
@@ -492,6 +486,7 @@ static void tg3_restart_ints(struct tg3 *tp)
492 486
493static inline void tg3_netif_stop(struct tg3 *tp) 487static inline void tg3_netif_stop(struct tg3 *tp)
494{ 488{
489 tp->dev->trans_start = jiffies; /* prevent tx timeout */
495 netif_poll_disable(tp->dev); 490 netif_poll_disable(tp->dev);
496 netif_tx_disable(tp->dev); 491 netif_tx_disable(tp->dev);
497} 492}
@@ -504,7 +499,8 @@ static inline void tg3_netif_start(struct tg3 *tp)
504 * (such as after tg3_init_hw) 499 * (such as after tg3_init_hw)
505 */ 500 */
506 netif_poll_enable(tp->dev); 501 netif_poll_enable(tp->dev);
507 tg3_cond_int(tp); 502 tp->hw_status->status |= SD_STATUS_UPDATED;
503 tg3_enable_ints(tp);
508} 504}
509 505
510static void tg3_switch_clocks(struct tg3 *tp) 506static void tg3_switch_clocks(struct tg3 *tp)
@@ -2578,7 +2574,7 @@ static void tg3_tx(struct tg3 *tp)
2578 sw_idx = NEXT_TX(sw_idx); 2574 sw_idx = NEXT_TX(sw_idx);
2579 } 2575 }
2580 2576
2581 dev_kfree_skb_irq(skb); 2577 dev_kfree_skb(skb);
2582 } 2578 }
2583 2579
2584 tp->tx_cons = sw_idx; 2580 tp->tx_cons = sw_idx;
@@ -2884,11 +2880,8 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2884{ 2880{
2885 struct tg3 *tp = netdev_priv(netdev); 2881 struct tg3 *tp = netdev_priv(netdev);
2886 struct tg3_hw_status *sblk = tp->hw_status; 2882 struct tg3_hw_status *sblk = tp->hw_status;
2887 unsigned long flags;
2888 int done; 2883 int done;
2889 2884
2890 spin_lock_irqsave(&tp->lock, flags);
2891
2892 /* handle link change and other phy events */ 2885 /* handle link change and other phy events */
2893 if (!(tp->tg3_flags & 2886 if (!(tp->tg3_flags &
2894 (TG3_FLAG_USE_LINKCHG_REG | 2887 (TG3_FLAG_USE_LINKCHG_REG |
@@ -2896,7 +2889,9 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2896 if (sblk->status & SD_STATUS_LINK_CHG) { 2889 if (sblk->status & SD_STATUS_LINK_CHG) {
2897 sblk->status = SD_STATUS_UPDATED | 2890 sblk->status = SD_STATUS_UPDATED |
2898 (sblk->status & ~SD_STATUS_LINK_CHG); 2891 (sblk->status & ~SD_STATUS_LINK_CHG);
2892 spin_lock(&tp->lock);
2899 tg3_setup_phy(tp, 0); 2893 tg3_setup_phy(tp, 0);
2894 spin_unlock(&tp->lock);
2900 } 2895 }
2901 } 2896 }
2902 2897
@@ -2907,8 +2902,6 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2907 spin_unlock(&tp->tx_lock); 2902 spin_unlock(&tp->tx_lock);
2908 } 2903 }
2909 2904
2910 spin_unlock_irqrestore(&tp->lock, flags);
2911
2912 /* run RX thread, within the bounds set by NAPI. 2905 /* run RX thread, within the bounds set by NAPI.
2913 * All RX "locking" is done by ensuring outside 2906 * All RX "locking" is done by ensuring outside
2914 * code synchronizes with dev->poll() 2907 * code synchronizes with dev->poll()
@@ -2929,19 +2922,54 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2929 if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) 2922 if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)
2930 tp->last_tag = sblk->status_tag; 2923 tp->last_tag = sblk->status_tag;
2931 rmb(); 2924 rmb();
2925 sblk->status &= ~SD_STATUS_UPDATED;
2932 2926
2933 /* if no more work, tell net stack and NIC we're done */ 2927 /* if no more work, tell net stack and NIC we're done */
2934 done = !tg3_has_work(tp); 2928 done = !tg3_has_work(tp);
2935 if (done) { 2929 if (done) {
2936 spin_lock_irqsave(&tp->lock, flags); 2930 spin_lock(&tp->lock);
2937 __netif_rx_complete(netdev); 2931 netif_rx_complete(netdev);
2938 tg3_restart_ints(tp); 2932 tg3_restart_ints(tp);
2939 spin_unlock_irqrestore(&tp->lock, flags); 2933 spin_unlock(&tp->lock);
2940 } 2934 }
2941 2935
2942 return (done ? 0 : 1); 2936 return (done ? 0 : 1);
2943} 2937}
2944 2938
2939static void tg3_irq_quiesce(struct tg3 *tp)
2940{
2941 BUG_ON(tp->irq_sync);
2942
2943 tp->irq_sync = 1;
2944 smp_mb();
2945
2946 synchronize_irq(tp->pdev->irq);
2947}
2948
2949static inline int tg3_irq_sync(struct tg3 *tp)
2950{
2951 return tp->irq_sync;
2952}
2953
2954/* Fully shutdown all tg3 driver activity elsewhere in the system.
2955 * If irq_sync is non-zero, then the IRQ handler must be synchronized
2956 * with as well. Most of the time, this is not necessary except when
2957 * shutting down the device.
2958 */
2959static inline void tg3_full_lock(struct tg3 *tp, int irq_sync)
2960{
2961 if (irq_sync)
2962 tg3_irq_quiesce(tp);
2963 spin_lock_bh(&tp->lock);
2964 spin_lock(&tp->tx_lock);
2965}
2966
2967static inline void tg3_full_unlock(struct tg3 *tp)
2968{
2969 spin_unlock(&tp->tx_lock);
2970 spin_unlock_bh(&tp->lock);
2971}
2972
2945/* MSI ISR - No need to check for interrupt sharing and no need to 2973/* MSI ISR - No need to check for interrupt sharing and no need to
2946 * flush status block and interrupt mailbox. PCI ordering rules 2974 * flush status block and interrupt mailbox. PCI ordering rules
2947 * guarantee that MSI will arrive after the status block. 2975 * guarantee that MSI will arrive after the status block.
@@ -2951,9 +2979,6 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs)
2951 struct net_device *dev = dev_id; 2979 struct net_device *dev = dev_id;
2952 struct tg3 *tp = netdev_priv(dev); 2980 struct tg3 *tp = netdev_priv(dev);
2953 struct tg3_hw_status *sblk = tp->hw_status; 2981 struct tg3_hw_status *sblk = tp->hw_status;
2954 unsigned long flags;
2955
2956 spin_lock_irqsave(&tp->lock, flags);
2957 2982
2958 /* 2983 /*
2959 * Writing any value to intr-mbox-0 clears PCI INTA# and 2984 * Writing any value to intr-mbox-0 clears PCI INTA# and
@@ -2964,6 +2989,9 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs)
2964 */ 2989 */
2965 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); 2990 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
2966 tp->last_tag = sblk->status_tag; 2991 tp->last_tag = sblk->status_tag;
2992 rmb();
2993 if (tg3_irq_sync(tp))
2994 goto out;
2967 sblk->status &= ~SD_STATUS_UPDATED; 2995 sblk->status &= ~SD_STATUS_UPDATED;
2968 if (likely(tg3_has_work(tp))) 2996 if (likely(tg3_has_work(tp)))
2969 netif_rx_schedule(dev); /* schedule NAPI poll */ 2997 netif_rx_schedule(dev); /* schedule NAPI poll */
@@ -2972,9 +3000,7 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs)
2972 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 3000 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
2973 tp->last_tag << 24); 3001 tp->last_tag << 24);
2974 } 3002 }
2975 3003out:
2976 spin_unlock_irqrestore(&tp->lock, flags);
2977
2978 return IRQ_RETVAL(1); 3004 return IRQ_RETVAL(1);
2979} 3005}
2980 3006
@@ -2983,11 +3009,8 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2983 struct net_device *dev = dev_id; 3009 struct net_device *dev = dev_id;
2984 struct tg3 *tp = netdev_priv(dev); 3010 struct tg3 *tp = netdev_priv(dev);
2985 struct tg3_hw_status *sblk = tp->hw_status; 3011 struct tg3_hw_status *sblk = tp->hw_status;
2986 unsigned long flags;
2987 unsigned int handled = 1; 3012 unsigned int handled = 1;
2988 3013
2989 spin_lock_irqsave(&tp->lock, flags);
2990
2991 /* In INTx mode, it is possible for the interrupt to arrive at 3014 /* In INTx mode, it is possible for the interrupt to arrive at
2992 * the CPU before the status block posted prior to the interrupt. 3015 * the CPU before the status block posted prior to the interrupt.
2993 * Reading the PCI State register will confirm whether the 3016 * Reading the PCI State register will confirm whether the
@@ -3004,6 +3027,8 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3004 */ 3027 */
3005 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 3028 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3006 0x00000001); 3029 0x00000001);
3030 if (tg3_irq_sync(tp))
3031 goto out;
3007 sblk->status &= ~SD_STATUS_UPDATED; 3032 sblk->status &= ~SD_STATUS_UPDATED;
3008 if (likely(tg3_has_work(tp))) 3033 if (likely(tg3_has_work(tp)))
3009 netif_rx_schedule(dev); /* schedule NAPI poll */ 3034 netif_rx_schedule(dev); /* schedule NAPI poll */
@@ -3018,9 +3043,7 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3018 } else { /* shared interrupt */ 3043 } else { /* shared interrupt */
3019 handled = 0; 3044 handled = 0;
3020 } 3045 }
3021 3046out:
3022 spin_unlock_irqrestore(&tp->lock, flags);
3023
3024 return IRQ_RETVAL(handled); 3047 return IRQ_RETVAL(handled);
3025} 3048}
3026 3049
@@ -3029,11 +3052,8 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *r
3029 struct net_device *dev = dev_id; 3052 struct net_device *dev = dev_id;
3030 struct tg3 *tp = netdev_priv(dev); 3053 struct tg3 *tp = netdev_priv(dev);
3031 struct tg3_hw_status *sblk = tp->hw_status; 3054 struct tg3_hw_status *sblk = tp->hw_status;
3032 unsigned long flags;
3033 unsigned int handled = 1; 3055 unsigned int handled = 1;
3034 3056
3035 spin_lock_irqsave(&tp->lock, flags);
3036
3037 /* In INTx mode, it is possible for the interrupt to arrive at 3057 /* In INTx mode, it is possible for the interrupt to arrive at
3038 * the CPU before the status block posted prior to the interrupt. 3058 * the CPU before the status block posted prior to the interrupt.
3039 * Reading the PCI State register will confirm whether the 3059 * Reading the PCI State register will confirm whether the
@@ -3051,6 +3071,9 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *r
3051 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 3071 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3052 0x00000001); 3072 0x00000001);
3053 tp->last_tag = sblk->status_tag; 3073 tp->last_tag = sblk->status_tag;
3074 rmb();
3075 if (tg3_irq_sync(tp))
3076 goto out;
3054 sblk->status &= ~SD_STATUS_UPDATED; 3077 sblk->status &= ~SD_STATUS_UPDATED;
3055 if (likely(tg3_has_work(tp))) 3078 if (likely(tg3_has_work(tp)))
3056 netif_rx_schedule(dev); /* schedule NAPI poll */ 3079 netif_rx_schedule(dev); /* schedule NAPI poll */
@@ -3065,9 +3088,7 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *r
3065 } else { /* shared interrupt */ 3088 } else { /* shared interrupt */
3066 handled = 0; 3089 handled = 0;
3067 } 3090 }
3068 3091out:
3069 spin_unlock_irqrestore(&tp->lock, flags);
3070
3071 return IRQ_RETVAL(handled); 3092 return IRQ_RETVAL(handled);
3072} 3093}
3073 3094
@@ -3106,8 +3127,7 @@ static void tg3_reset_task(void *_data)
3106 3127
3107 tg3_netif_stop(tp); 3128 tg3_netif_stop(tp);
3108 3129
3109 spin_lock_irq(&tp->lock); 3130 tg3_full_lock(tp, 1);
3110 spin_lock(&tp->tx_lock);
3111 3131
3112 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; 3132 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER;
3113 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; 3133 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER;
@@ -3117,8 +3137,7 @@ static void tg3_reset_task(void *_data)
3117 3137
3118 tg3_netif_start(tp); 3138 tg3_netif_start(tp);
3119 3139
3120 spin_unlock(&tp->tx_lock); 3140 tg3_full_unlock(tp);
3121 spin_unlock_irq(&tp->lock);
3122 3141
3123 if (restart_timer) 3142 if (restart_timer)
3124 mod_timer(&tp->timer, jiffies + 1); 3143 mod_timer(&tp->timer, jiffies + 1);
@@ -3224,39 +3243,21 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3224 unsigned int i; 3243 unsigned int i;
3225 u32 len, entry, base_flags, mss; 3244 u32 len, entry, base_flags, mss;
3226 int would_hit_hwbug; 3245 int would_hit_hwbug;
3227 unsigned long flags;
3228 3246
3229 len = skb_headlen(skb); 3247 len = skb_headlen(skb);
3230 3248
3231 /* No BH disabling for tx_lock here. We are running in BH disabled 3249 /* No BH disabling for tx_lock here. We are running in BH disabled
3232 * context and TX reclaim runs via tp->poll inside of a software 3250 * context and TX reclaim runs via tp->poll inside of a software
3233 * interrupt. Rejoice! 3251 * interrupt. Furthermore, IRQ processing runs lockless so we have
3234 * 3252 * no IRQ context deadlocks to worry about either. Rejoice!
3235 * Actually, things are not so simple. If we are to take a hw
3236 * IRQ here, we can deadlock, consider:
3237 *
3238 * CPU1 CPU2
3239 * tg3_start_xmit
3240 * take tp->tx_lock
3241 * tg3_timer
3242 * take tp->lock
3243 * tg3_interrupt
3244 * spin on tp->lock
3245 * spin on tp->tx_lock
3246 *
3247 * So we really do need to disable interrupts when taking
3248 * tx_lock here.
3249 */ 3253 */
3250 local_irq_save(flags); 3254 if (!spin_trylock(&tp->tx_lock))
3251 if (!spin_trylock(&tp->tx_lock)) {
3252 local_irq_restore(flags);
3253 return NETDEV_TX_LOCKED; 3255 return NETDEV_TX_LOCKED;
3254 }
3255 3256
3256 /* This is a hard error, log it. */ 3257 /* This is a hard error, log it. */
3257 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { 3258 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
3258 netif_stop_queue(dev); 3259 netif_stop_queue(dev);
3259 spin_unlock_irqrestore(&tp->tx_lock, flags); 3260 spin_unlock(&tp->tx_lock);
3260 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", 3261 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
3261 dev->name); 3262 dev->name);
3262 return NETDEV_TX_BUSY; 3263 return NETDEV_TX_BUSY;
@@ -3421,7 +3422,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3421 3422
3422out_unlock: 3423out_unlock:
3423 mmiowb(); 3424 mmiowb();
3424 spin_unlock_irqrestore(&tp->tx_lock, flags); 3425 spin_unlock(&tp->tx_lock);
3425 3426
3426 dev->trans_start = jiffies; 3427 dev->trans_start = jiffies;
3427 3428
@@ -3455,8 +3456,8 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
3455 } 3456 }
3456 3457
3457 tg3_netif_stop(tp); 3458 tg3_netif_stop(tp);
3458 spin_lock_irq(&tp->lock); 3459
3459 spin_lock(&tp->tx_lock); 3460 tg3_full_lock(tp, 1);
3460 3461
3461 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 3462 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
3462 3463
@@ -3466,8 +3467,7 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
3466 3467
3467 tg3_netif_start(tp); 3468 tg3_netif_start(tp);
3468 3469
3469 spin_unlock(&tp->tx_lock); 3470 tg3_full_unlock(tp);
3470 spin_unlock_irq(&tp->lock);
3471 3471
3472 return 0; 3472 return 0;
3473} 3473}
@@ -5088,9 +5088,9 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
5088 5088
5089 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 5089 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
5090 5090
5091 spin_lock_irq(&tp->lock); 5091 spin_lock_bh(&tp->lock);
5092 __tg3_set_mac_addr(tp); 5092 __tg3_set_mac_addr(tp);
5093 spin_unlock_irq(&tp->lock); 5093 spin_unlock_bh(&tp->lock);
5094 5094
5095 return 0; 5095 return 0;
5096} 5096}
@@ -5727,9 +5727,6 @@ static int tg3_reset_hw(struct tg3 *tp)
5727 5727
5728 tg3_write_sig_post_reset(tp, RESET_KIND_INIT); 5728 tg3_write_sig_post_reset(tp, RESET_KIND_INIT);
5729 5729
5730 if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE)
5731 tg3_enable_ints(tp);
5732
5733 return 0; 5730 return 0;
5734} 5731}
5735 5732
@@ -5802,10 +5799,8 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp)
5802static void tg3_timer(unsigned long __opaque) 5799static void tg3_timer(unsigned long __opaque)
5803{ 5800{
5804 struct tg3 *tp = (struct tg3 *) __opaque; 5801 struct tg3 *tp = (struct tg3 *) __opaque;
5805 unsigned long flags;
5806 5802
5807 spin_lock_irqsave(&tp->lock, flags); 5803 spin_lock(&tp->lock);
5808 spin_lock(&tp->tx_lock);
5809 5804
5810 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) { 5805 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) {
5811 /* All of this garbage is because when using non-tagged 5806 /* All of this garbage is because when using non-tagged
@@ -5822,8 +5817,7 @@ static void tg3_timer(unsigned long __opaque)
5822 5817
5823 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 5818 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
5824 tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER; 5819 tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER;
5825 spin_unlock(&tp->tx_lock); 5820 spin_unlock(&tp->lock);
5826 spin_unlock_irqrestore(&tp->lock, flags);
5827 schedule_work(&tp->reset_task); 5821 schedule_work(&tp->reset_task);
5828 return; 5822 return;
5829 } 5823 }
@@ -5891,8 +5885,7 @@ static void tg3_timer(unsigned long __opaque)
5891 tp->asf_counter = tp->asf_multiplier; 5885 tp->asf_counter = tp->asf_multiplier;
5892 } 5886 }
5893 5887
5894 spin_unlock(&tp->tx_lock); 5888 spin_unlock(&tp->lock);
5895 spin_unlock_irqrestore(&tp->lock, flags);
5896 5889
5897 tp->timer.expires = jiffies + tp->timer_offset; 5890 tp->timer.expires = jiffies + tp->timer_offset;
5898 add_timer(&tp->timer); 5891 add_timer(&tp->timer);
@@ -6007,14 +6000,12 @@ static int tg3_test_msi(struct tg3 *tp)
6007 /* Need to reset the chip because the MSI cycle may have terminated 6000 /* Need to reset the chip because the MSI cycle may have terminated
6008 * with Master Abort. 6001 * with Master Abort.
6009 */ 6002 */
6010 spin_lock_irq(&tp->lock); 6003 tg3_full_lock(tp, 1);
6011 spin_lock(&tp->tx_lock);
6012 6004
6013 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 6005 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
6014 err = tg3_init_hw(tp); 6006 err = tg3_init_hw(tp);
6015 6007
6016 spin_unlock(&tp->tx_lock); 6008 tg3_full_unlock(tp);
6017 spin_unlock_irq(&tp->lock);
6018 6009
6019 if (err) 6010 if (err)
6020 free_irq(tp->pdev->irq, dev); 6011 free_irq(tp->pdev->irq, dev);
@@ -6027,14 +6018,12 @@ static int tg3_open(struct net_device *dev)
6027 struct tg3 *tp = netdev_priv(dev); 6018 struct tg3 *tp = netdev_priv(dev);
6028 int err; 6019 int err;
6029 6020
6030 spin_lock_irq(&tp->lock); 6021 tg3_full_lock(tp, 0);
6031 spin_lock(&tp->tx_lock);
6032 6022
6033 tg3_disable_ints(tp); 6023 tg3_disable_ints(tp);
6034 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; 6024 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
6035 6025
6036 spin_unlock(&tp->tx_lock); 6026 tg3_full_unlock(tp);
6037 spin_unlock_irq(&tp->lock);
6038 6027
6039 /* The placement of this call is tied 6028 /* The placement of this call is tied
6040 * to the setup and use of Host TX descriptors. 6029 * to the setup and use of Host TX descriptors.
@@ -6081,8 +6070,7 @@ static int tg3_open(struct net_device *dev)
6081 return err; 6070 return err;
6082 } 6071 }
6083 6072
6084 spin_lock_irq(&tp->lock); 6073 tg3_full_lock(tp, 0);
6085 spin_lock(&tp->tx_lock);
6086 6074
6087 err = tg3_init_hw(tp); 6075 err = tg3_init_hw(tp);
6088 if (err) { 6076 if (err) {
@@ -6106,8 +6094,7 @@ static int tg3_open(struct net_device *dev)
6106 tp->timer.function = tg3_timer; 6094 tp->timer.function = tg3_timer;
6107 } 6095 }
6108 6096
6109 spin_unlock(&tp->tx_lock); 6097 tg3_full_unlock(tp);
6110 spin_unlock_irq(&tp->lock);
6111 6098
6112 if (err) { 6099 if (err) {
6113 free_irq(tp->pdev->irq, dev); 6100 free_irq(tp->pdev->irq, dev);
@@ -6123,8 +6110,7 @@ static int tg3_open(struct net_device *dev)
6123 err = tg3_test_msi(tp); 6110 err = tg3_test_msi(tp);
6124 6111
6125 if (err) { 6112 if (err) {
6126 spin_lock_irq(&tp->lock); 6113 tg3_full_lock(tp, 0);
6127 spin_lock(&tp->tx_lock);
6128 6114
6129 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 6115 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
6130 pci_disable_msi(tp->pdev); 6116 pci_disable_msi(tp->pdev);
@@ -6134,22 +6120,19 @@ static int tg3_open(struct net_device *dev)
6134 tg3_free_rings(tp); 6120 tg3_free_rings(tp);
6135 tg3_free_consistent(tp); 6121 tg3_free_consistent(tp);
6136 6122
6137 spin_unlock(&tp->tx_lock); 6123 tg3_full_unlock(tp);
6138 spin_unlock_irq(&tp->lock);
6139 6124
6140 return err; 6125 return err;
6141 } 6126 }
6142 } 6127 }
6143 6128
6144 spin_lock_irq(&tp->lock); 6129 tg3_full_lock(tp, 0);
6145 spin_lock(&tp->tx_lock);
6146 6130
6147 add_timer(&tp->timer); 6131 add_timer(&tp->timer);
6148 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; 6132 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
6149 tg3_enable_ints(tp); 6133 tg3_enable_ints(tp);
6150 6134
6151 spin_unlock(&tp->tx_lock); 6135 tg3_full_unlock(tp);
6152 spin_unlock_irq(&tp->lock);
6153 6136
6154 netif_start_queue(dev); 6137 netif_start_queue(dev);
6155 6138
@@ -6395,8 +6378,7 @@ static int tg3_close(struct net_device *dev)
6395 6378
6396 del_timer_sync(&tp->timer); 6379 del_timer_sync(&tp->timer);
6397 6380
6398 spin_lock_irq(&tp->lock); 6381 tg3_full_lock(tp, 1);
6399 spin_lock(&tp->tx_lock);
6400#if 0 6382#if 0
6401 tg3_dump_state(tp); 6383 tg3_dump_state(tp);
6402#endif 6384#endif
@@ -6410,8 +6392,7 @@ static int tg3_close(struct net_device *dev)
6410 TG3_FLAG_GOT_SERDES_FLOWCTL); 6392 TG3_FLAG_GOT_SERDES_FLOWCTL);
6411 netif_carrier_off(tp->dev); 6393 netif_carrier_off(tp->dev);
6412 6394
6413 spin_unlock(&tp->tx_lock); 6395 tg3_full_unlock(tp);
6414 spin_unlock_irq(&tp->lock);
6415 6396
6416 free_irq(tp->pdev->irq, dev); 6397 free_irq(tp->pdev->irq, dev);
6417 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 6398 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
@@ -6448,16 +6429,15 @@ static unsigned long calc_crc_errors(struct tg3 *tp)
6448 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 6429 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) &&
6449 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 6430 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
6450 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) { 6431 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) {
6451 unsigned long flags;
6452 u32 val; 6432 u32 val;
6453 6433
6454 spin_lock_irqsave(&tp->lock, flags); 6434 spin_lock_bh(&tp->lock);
6455 if (!tg3_readphy(tp, 0x1e, &val)) { 6435 if (!tg3_readphy(tp, 0x1e, &val)) {
6456 tg3_writephy(tp, 0x1e, val | 0x8000); 6436 tg3_writephy(tp, 0x1e, val | 0x8000);
6457 tg3_readphy(tp, 0x14, &val); 6437 tg3_readphy(tp, 0x14, &val);
6458 } else 6438 } else
6459 val = 0; 6439 val = 0;
6460 spin_unlock_irqrestore(&tp->lock, flags); 6440 spin_unlock_bh(&tp->lock);
6461 6441
6462 tp->phy_crc_errors += val; 6442 tp->phy_crc_errors += val;
6463 6443
@@ -6719,11 +6699,9 @@ static void tg3_set_rx_mode(struct net_device *dev)
6719{ 6699{
6720 struct tg3 *tp = netdev_priv(dev); 6700 struct tg3 *tp = netdev_priv(dev);
6721 6701
6722 spin_lock_irq(&tp->lock); 6702 tg3_full_lock(tp, 0);
6723 spin_lock(&tp->tx_lock);
6724 __tg3_set_rx_mode(dev); 6703 __tg3_set_rx_mode(dev);
6725 spin_unlock(&tp->tx_lock); 6704 tg3_full_unlock(tp);
6726 spin_unlock_irq(&tp->lock);
6727} 6705}
6728 6706
6729#define TG3_REGDUMP_LEN (32 * 1024) 6707#define TG3_REGDUMP_LEN (32 * 1024)
@@ -6745,8 +6723,7 @@ static void tg3_get_regs(struct net_device *dev,
6745 6723
6746 memset(p, 0, TG3_REGDUMP_LEN); 6724 memset(p, 0, TG3_REGDUMP_LEN);
6747 6725
6748 spin_lock_irq(&tp->lock); 6726 tg3_full_lock(tp, 0);
6749 spin_lock(&tp->tx_lock);
6750 6727
6751#define __GET_REG32(reg) (*(p)++ = tr32(reg)) 6728#define __GET_REG32(reg) (*(p)++ = tr32(reg))
6752#define GET_REG32_LOOP(base,len) \ 6729#define GET_REG32_LOOP(base,len) \
@@ -6796,8 +6773,7 @@ do { p = (u32 *)(orig_p + (reg)); \
6796#undef GET_REG32_LOOP 6773#undef GET_REG32_LOOP
6797#undef GET_REG32_1 6774#undef GET_REG32_1
6798 6775
6799 spin_unlock(&tp->tx_lock); 6776 tg3_full_unlock(tp);
6800 spin_unlock_irq(&tp->lock);
6801} 6777}
6802 6778
6803static int tg3_get_eeprom_len(struct net_device *dev) 6779static int tg3_get_eeprom_len(struct net_device *dev)
@@ -6973,8 +6949,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
6973 return -EINVAL; 6949 return -EINVAL;
6974 } 6950 }
6975 6951
6976 spin_lock_irq(&tp->lock); 6952 tg3_full_lock(tp, 0);
6977 spin_lock(&tp->tx_lock);
6978 6953
6979 tp->link_config.autoneg = cmd->autoneg; 6954 tp->link_config.autoneg = cmd->autoneg;
6980 if (cmd->autoneg == AUTONEG_ENABLE) { 6955 if (cmd->autoneg == AUTONEG_ENABLE) {
@@ -6990,8 +6965,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
6990 if (netif_running(dev)) 6965 if (netif_running(dev))
6991 tg3_setup_phy(tp, 1); 6966 tg3_setup_phy(tp, 1);
6992 6967
6993 spin_unlock(&tp->tx_lock); 6968 tg3_full_unlock(tp);
6994 spin_unlock_irq(&tp->lock);
6995 6969
6996 return 0; 6970 return 0;
6997} 6971}
@@ -7027,12 +7001,12 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
7027 !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP)) 7001 !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP))
7028 return -EINVAL; 7002 return -EINVAL;
7029 7003
7030 spin_lock_irq(&tp->lock); 7004 spin_lock_bh(&tp->lock);
7031 if (wol->wolopts & WAKE_MAGIC) 7005 if (wol->wolopts & WAKE_MAGIC)
7032 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 7006 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
7033 else 7007 else
7034 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE; 7008 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
7035 spin_unlock_irq(&tp->lock); 7009 spin_unlock_bh(&tp->lock);
7036 7010
7037 return 0; 7011 return 0;
7038} 7012}
@@ -7072,7 +7046,7 @@ static int tg3_nway_reset(struct net_device *dev)
7072 if (!netif_running(dev)) 7046 if (!netif_running(dev))
7073 return -EAGAIN; 7047 return -EAGAIN;
7074 7048
7075 spin_lock_irq(&tp->lock); 7049 spin_lock_bh(&tp->lock);
7076 r = -EINVAL; 7050 r = -EINVAL;
7077 tg3_readphy(tp, MII_BMCR, &bmcr); 7051 tg3_readphy(tp, MII_BMCR, &bmcr);
7078 if (!tg3_readphy(tp, MII_BMCR, &bmcr) && 7052 if (!tg3_readphy(tp, MII_BMCR, &bmcr) &&
@@ -7080,7 +7054,7 @@ static int tg3_nway_reset(struct net_device *dev)
7080 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART); 7054 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART);
7081 r = 0; 7055 r = 0;
7082 } 7056 }
7083 spin_unlock_irq(&tp->lock); 7057 spin_unlock_bh(&tp->lock);
7084 7058
7085 return r; 7059 return r;
7086} 7060}
@@ -7102,17 +7076,19 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *
7102static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) 7076static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
7103{ 7077{
7104 struct tg3 *tp = netdev_priv(dev); 7078 struct tg3 *tp = netdev_priv(dev);
7079 int irq_sync = 0;
7105 7080
7106 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || 7081 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
7107 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || 7082 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
7108 (ering->tx_pending > TG3_TX_RING_SIZE - 1)) 7083 (ering->tx_pending > TG3_TX_RING_SIZE - 1))
7109 return -EINVAL; 7084 return -EINVAL;
7110 7085
7111 if (netif_running(dev)) 7086 if (netif_running(dev)) {
7112 tg3_netif_stop(tp); 7087 tg3_netif_stop(tp);
7088 irq_sync = 1;
7089 }
7113 7090
7114 spin_lock_irq(&tp->lock); 7091 tg3_full_lock(tp, irq_sync);
7115 spin_lock(&tp->tx_lock);
7116 7092
7117 tp->rx_pending = ering->rx_pending; 7093 tp->rx_pending = ering->rx_pending;
7118 7094
@@ -7128,8 +7104,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
7128 tg3_netif_start(tp); 7104 tg3_netif_start(tp);
7129 } 7105 }
7130 7106
7131 spin_unlock(&tp->tx_lock); 7107 tg3_full_unlock(tp);
7132 spin_unlock_irq(&tp->lock);
7133 7108
7134 return 0; 7109 return 0;
7135} 7110}
@@ -7146,12 +7121,15 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam
7146static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) 7121static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
7147{ 7122{
7148 struct tg3 *tp = netdev_priv(dev); 7123 struct tg3 *tp = netdev_priv(dev);
7124 int irq_sync = 0;
7149 7125
7150 if (netif_running(dev)) 7126 if (netif_running(dev)) {
7151 tg3_netif_stop(tp); 7127 tg3_netif_stop(tp);
7128 irq_sync = 1;
7129 }
7130
7131 tg3_full_lock(tp, irq_sync);
7152 7132
7153 spin_lock_irq(&tp->lock);
7154 spin_lock(&tp->tx_lock);
7155 if (epause->autoneg) 7133 if (epause->autoneg)
7156 tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; 7134 tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG;
7157 else 7135 else
@@ -7170,8 +7148,8 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
7170 tg3_init_hw(tp); 7148 tg3_init_hw(tp);
7171 tg3_netif_start(tp); 7149 tg3_netif_start(tp);
7172 } 7150 }
7173 spin_unlock(&tp->tx_lock); 7151
7174 spin_unlock_irq(&tp->lock); 7152 tg3_full_unlock(tp);
7175 7153
7176 return 0; 7154 return 0;
7177} 7155}
@@ -7192,12 +7170,12 @@ static int tg3_set_rx_csum(struct net_device *dev, u32 data)
7192 return 0; 7170 return 0;
7193 } 7171 }
7194 7172
7195 spin_lock_irq(&tp->lock); 7173 spin_lock_bh(&tp->lock);
7196 if (data) 7174 if (data)
7197 tp->tg3_flags |= TG3_FLAG_RX_CHECKSUMS; 7175 tp->tg3_flags |= TG3_FLAG_RX_CHECKSUMS;
7198 else 7176 else
7199 tp->tg3_flags &= ~TG3_FLAG_RX_CHECKSUMS; 7177 tp->tg3_flags &= ~TG3_FLAG_RX_CHECKSUMS;
7200 spin_unlock_irq(&tp->lock); 7178 spin_unlock_bh(&tp->lock);
7201 7179
7202 return 0; 7180 return 0;
7203} 7181}
@@ -7606,8 +7584,6 @@ static int tg3_test_loopback(struct tg3 *tp)
7606 7584
7607 tg3_abort_hw(tp, 1); 7585 tg3_abort_hw(tp, 1);
7608 7586
7609 /* Clearing this flag to keep interrupts disabled */
7610 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
7611 tg3_reset_hw(tp); 7587 tg3_reset_hw(tp);
7612 7588
7613 mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | 7589 mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) |
@@ -7716,11 +7692,14 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
7716 data[1] = 1; 7692 data[1] = 1;
7717 } 7693 }
7718 if (etest->flags & ETH_TEST_FL_OFFLINE) { 7694 if (etest->flags & ETH_TEST_FL_OFFLINE) {
7719 if (netif_running(dev)) 7695 int irq_sync = 0;
7696
7697 if (netif_running(dev)) {
7720 tg3_netif_stop(tp); 7698 tg3_netif_stop(tp);
7699 irq_sync = 1;
7700 }
7721 7701
7722 spin_lock_irq(&tp->lock); 7702 tg3_full_lock(tp, irq_sync);
7723 spin_lock(&tp->tx_lock);
7724 7703
7725 tg3_halt(tp, RESET_KIND_SUSPEND, 1); 7704 tg3_halt(tp, RESET_KIND_SUSPEND, 1);
7726 tg3_nvram_lock(tp); 7705 tg3_nvram_lock(tp);
@@ -7742,14 +7721,14 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
7742 data[4] = 1; 7721 data[4] = 1;
7743 } 7722 }
7744 7723
7745 spin_unlock(&tp->tx_lock); 7724 tg3_full_unlock(tp);
7746 spin_unlock_irq(&tp->lock); 7725
7747 if (tg3_test_interrupt(tp) != 0) { 7726 if (tg3_test_interrupt(tp) != 0) {
7748 etest->flags |= ETH_TEST_FL_FAILED; 7727 etest->flags |= ETH_TEST_FL_FAILED;
7749 data[5] = 1; 7728 data[5] = 1;
7750 } 7729 }
7751 spin_lock_irq(&tp->lock); 7730
7752 spin_lock(&tp->tx_lock); 7731 tg3_full_lock(tp, 0);
7753 7732
7754 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 7733 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
7755 if (netif_running(dev)) { 7734 if (netif_running(dev)) {
@@ -7757,8 +7736,8 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
7757 tg3_init_hw(tp); 7736 tg3_init_hw(tp);
7758 tg3_netif_start(tp); 7737 tg3_netif_start(tp);
7759 } 7738 }
7760 spin_unlock(&tp->tx_lock); 7739
7761 spin_unlock_irq(&tp->lock); 7740 tg3_full_unlock(tp);
7762 } 7741 }
7763} 7742}
7764 7743
@@ -7779,9 +7758,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
7779 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 7758 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)
7780 break; /* We have no PHY */ 7759 break; /* We have no PHY */
7781 7760
7782 spin_lock_irq(&tp->lock); 7761 spin_lock_bh(&tp->lock);
7783 err = tg3_readphy(tp, data->reg_num & 0x1f, &mii_regval); 7762 err = tg3_readphy(tp, data->reg_num & 0x1f, &mii_regval);
7784 spin_unlock_irq(&tp->lock); 7763 spin_unlock_bh(&tp->lock);
7785 7764
7786 data->val_out = mii_regval; 7765 data->val_out = mii_regval;
7787 7766
@@ -7795,9 +7774,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
7795 if (!capable(CAP_NET_ADMIN)) 7774 if (!capable(CAP_NET_ADMIN))
7796 return -EPERM; 7775 return -EPERM;
7797 7776
7798 spin_lock_irq(&tp->lock); 7777 spin_lock_bh(&tp->lock);
7799 err = tg3_writephy(tp, data->reg_num & 0x1f, data->val_in); 7778 err = tg3_writephy(tp, data->reg_num & 0x1f, data->val_in);
7800 spin_unlock_irq(&tp->lock); 7779 spin_unlock_bh(&tp->lock);
7801 7780
7802 return err; 7781 return err;
7803 7782
@@ -7813,28 +7792,24 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
7813{ 7792{
7814 struct tg3 *tp = netdev_priv(dev); 7793 struct tg3 *tp = netdev_priv(dev);
7815 7794
7816 spin_lock_irq(&tp->lock); 7795 tg3_full_lock(tp, 0);
7817 spin_lock(&tp->tx_lock);
7818 7796
7819 tp->vlgrp = grp; 7797 tp->vlgrp = grp;
7820 7798
7821 /* Update RX_MODE_KEEP_VLAN_TAG bit in RX_MODE register. */ 7799 /* Update RX_MODE_KEEP_VLAN_TAG bit in RX_MODE register. */
7822 __tg3_set_rx_mode(dev); 7800 __tg3_set_rx_mode(dev);
7823 7801
7824 spin_unlock(&tp->tx_lock); 7802 tg3_full_unlock(tp);
7825 spin_unlock_irq(&tp->lock);
7826} 7803}
7827 7804
7828static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 7805static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
7829{ 7806{
7830 struct tg3 *tp = netdev_priv(dev); 7807 struct tg3 *tp = netdev_priv(dev);
7831 7808
7832 spin_lock_irq(&tp->lock); 7809 tg3_full_lock(tp, 0);
7833 spin_lock(&tp->tx_lock);
7834 if (tp->vlgrp) 7810 if (tp->vlgrp)
7835 tp->vlgrp->vlan_devices[vid] = NULL; 7811 tp->vlgrp->vlan_devices[vid] = NULL;
7836 spin_unlock(&tp->tx_lock); 7812 tg3_full_unlock(tp);
7837 spin_unlock_irq(&tp->lock);
7838} 7813}
7839#endif 7814#endif
7840 7815
@@ -10165,24 +10140,19 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
10165 10140
10166 del_timer_sync(&tp->timer); 10141 del_timer_sync(&tp->timer);
10167 10142
10168 spin_lock_irq(&tp->lock); 10143 tg3_full_lock(tp, 1);
10169 spin_lock(&tp->tx_lock);
10170 tg3_disable_ints(tp); 10144 tg3_disable_ints(tp);
10171 spin_unlock(&tp->tx_lock); 10145 tg3_full_unlock(tp);
10172 spin_unlock_irq(&tp->lock);
10173 10146
10174 netif_device_detach(dev); 10147 netif_device_detach(dev);
10175 10148
10176 spin_lock_irq(&tp->lock); 10149 tg3_full_lock(tp, 0);
10177 spin_lock(&tp->tx_lock);
10178 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 10150 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
10179 spin_unlock(&tp->tx_lock); 10151 tg3_full_unlock(tp);
10180 spin_unlock_irq(&tp->lock);
10181 10152
10182 err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); 10153 err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
10183 if (err) { 10154 if (err) {
10184 spin_lock_irq(&tp->lock); 10155 tg3_full_lock(tp, 0);
10185 spin_lock(&tp->tx_lock);
10186 10156
10187 tg3_init_hw(tp); 10157 tg3_init_hw(tp);
10188 10158
@@ -10192,8 +10162,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
10192 netif_device_attach(dev); 10162 netif_device_attach(dev);
10193 tg3_netif_start(tp); 10163 tg3_netif_start(tp);
10194 10164
10195 spin_unlock(&tp->tx_lock); 10165 tg3_full_unlock(tp);
10196 spin_unlock_irq(&tp->lock);
10197 } 10166 }
10198 10167
10199 return err; 10168 return err;
@@ -10216,20 +10185,16 @@ static int tg3_resume(struct pci_dev *pdev)
10216 10185
10217 netif_device_attach(dev); 10186 netif_device_attach(dev);
10218 10187
10219 spin_lock_irq(&tp->lock); 10188 tg3_full_lock(tp, 0);
10220 spin_lock(&tp->tx_lock);
10221 10189
10222 tg3_init_hw(tp); 10190 tg3_init_hw(tp);
10223 10191
10224 tp->timer.expires = jiffies + tp->timer_offset; 10192 tp->timer.expires = jiffies + tp->timer_offset;
10225 add_timer(&tp->timer); 10193 add_timer(&tp->timer);
10226 10194
10227 tg3_enable_ints(tp);
10228
10229 tg3_netif_start(tp); 10195 tg3_netif_start(tp);
10230 10196
10231 spin_unlock(&tp->tx_lock); 10197 tg3_full_unlock(tp);
10232 spin_unlock_irq(&tp->lock);
10233 10198
10234 return 0; 10199 return 0;
10235} 10200}
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 993f84c93dc4..99c5f9675a56 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2006,17 +2006,31 @@ struct tg3_ethtool_stats {
2006struct tg3 { 2006struct tg3 {
2007 /* begin "general, frequently-used members" cacheline section */ 2007 /* begin "general, frequently-used members" cacheline section */
2008 2008
2009 /* If the IRQ handler (which runs lockless) needs to be
2010 * quiesced, the following bitmask state is used. The
2011 * SYNC flag is set by non-IRQ context code to initiate
2012 * the quiescence.
2013 *
2014 * When the IRQ handler notices that SYNC is set, it
2015 * disables interrupts and returns.
2016 *
2017 * When all outstanding IRQ handlers have returned after
2018 * the SYNC flag has been set, the setter can be assured
2019 * that interrupts will no longer get run.
2020 *
2021 * In this way all SMP driver locks are never acquired
2022 * in hw IRQ context, only sw IRQ context or lower.
2023 */
2024 unsigned int irq_sync;
2025
2009 /* SMP locking strategy: 2026 /* SMP locking strategy:
2010 * 2027 *
2011 * lock: Held during all operations except TX packet 2028 * lock: Held during all operations except TX packet
2012 * processing. 2029 * processing.
2013 * 2030 *
2014 * tx_lock: Held during tg3_start_xmit{,_4gbug} and tg3_tx 2031 * tx_lock: Held during tg3_start_xmit and tg3_tx
2015 * 2032 *
2016 * If you want to shut up all asynchronous processing you must 2033 * Both of these locks are to be held with BH safety.
2017 * acquire both locks, 'lock' taken before 'tx_lock'. IRQs must
2018 * be disabled to take 'lock' but only softirq disabling is
2019 * necessary for acquisition of 'tx_lock'.
2020 */ 2034 */
2021 spinlock_t lock; 2035 spinlock_t lock;
2022 spinlock_t indirect_lock; 2036 spinlock_t indirect_lock;
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 66b94668ddd8..18c27e1e7884 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -435,7 +435,7 @@ config VENDOR_SANGOMA
435 the driver to support. 435 the driver to support.
436 436
437 If you have one or more of these cards, say M to this option; 437 If you have one or more of these cards, say M to this option;
438 and read <file:Documentation/networking/wanpipe.txt>. 438 and read <file:Documentation/networking/wan-router.txt>.
439 439
440 To compile this driver as a module, choose M here: the 440 To compile this driver as a module, choose M here: the
441 module will be called wanpipe. 441 module will be called wanpipe.
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index fb10a2db63ad..d72e0385e4f2 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2918,7 +2918,7 @@ static int airo_thread(void *data) {
2918 flush_signals(current); 2918 flush_signals(current);
2919 2919
2920 /* make swsusp happy with our thread */ 2920 /* make swsusp happy with our thread */
2921 try_to_freeze(PF_FREEZE); 2921 try_to_freeze();
2922 2922
2923 if (test_bit(JOB_DIE, &ai->flags)) 2923 if (test_bit(JOB_DIE, &ai->flags))
2924 break; 2924 break;
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index d136b3c8fac9..48e4f04530d8 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -718,7 +718,7 @@ static int pccardd(void *__skt)
718 } 718 }
719 719
720 schedule(); 720 schedule();
721 try_to_freeze(PF_FREEZE); 721 try_to_freeze();
722 722
723 if (!skt->thread) 723 if (!skt->thread)
724 break; 724 break;
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index e939c93a931c..778a324028f4 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -182,7 +182,7 @@ static int pnp_dock_thread(void * unused)
182 msleep_interruptible(2000); 182 msleep_interruptible(2000);
183 183
184 if(signal_pending(current)) { 184 if(signal_pending(current)) {
185 if (try_to_freeze(PF_FREEZE)) 185 if (try_to_freeze())
186 continue; 186 continue;
187 break; 187 break;
188 } 188 }
diff --git a/drivers/s390/Kconfig b/drivers/s390/Kconfig
index 96413c2cd1ad..a86a650f3d6d 100644
--- a/drivers/s390/Kconfig
+++ b/drivers/s390/Kconfig
@@ -187,6 +187,13 @@ config VMLOGRDR
187 *SYMPTOM. 187 *SYMPTOM.
188 This driver depends on the IUCV support driver. 188 This driver depends on the IUCV support driver.
189 189
190config VMCP
191 tristate "Support for the z/VM CP interface (VM only)"
192 help
193 Select this option if you want to be able to interact with the control
194 program on z/VM
195
196
190config MONREADER 197config MONREADER
191 tristate "API for reading z/VM monitor service records" 198 tristate "API for reading z/VM monitor service records"
192 depends on IUCV 199 depends on IUCV
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index ceeb3cf64a16..6527ff6f4706 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -176,7 +176,7 @@ dasd_state_known_to_basic(struct dasd_device * device)
176 return rc; 176 return rc;
177 177
178 /* register 'device' debug area, used for all DBF_DEV_XXX calls */ 178 /* register 'device' debug area, used for all DBF_DEV_XXX calls */
179 device->debug_area = debug_register(device->cdev->dev.bus_id, 0, 2, 179 device->debug_area = debug_register(device->cdev->dev.bus_id, 1, 2,
180 8 * sizeof (long)); 180 8 * sizeof (long));
181 debug_register_view(device->debug_area, &debug_sprintf_view); 181 debug_register_view(device->debug_area, &debug_sprintf_view);
182 debug_set_level(device->debug_area, DBF_EMERG); 182 debug_set_level(device->debug_area, DBF_EMERG);
@@ -1952,26 +1952,24 @@ dasd_generic_notify(struct ccw_device *cdev, int event)
1952 * Automatically online either all dasd devices (dasd_autodetect) or 1952 * Automatically online either all dasd devices (dasd_autodetect) or
1953 * all devices specified with dasd= parameters. 1953 * all devices specified with dasd= parameters.
1954 */ 1954 */
1955static int
1956__dasd_auto_online(struct device *dev, void *data)
1957{
1958 struct ccw_device *cdev;
1959
1960 cdev = to_ccwdev(dev);
1961 if (dasd_autodetect || dasd_busid_known(cdev->dev.bus_id) == 0)
1962 ccw_device_set_online(cdev);
1963 return 0;
1964}
1965
1955void 1966void
1956dasd_generic_auto_online (struct ccw_driver *dasd_discipline_driver) 1967dasd_generic_auto_online (struct ccw_driver *dasd_discipline_driver)
1957{ 1968{
1958 struct device_driver *drv; 1969 struct device_driver *drv;
1959 struct device *d, *dev;
1960 struct ccw_device *cdev;
1961 1970
1962 drv = get_driver(&dasd_discipline_driver->driver); 1971 drv = get_driver(&dasd_discipline_driver->driver);
1963 down_read(&drv->bus->subsys.rwsem); 1972 driver_for_each_device(drv, NULL, NULL, __dasd_auto_online);
1964 dev = NULL;
1965 list_for_each_entry(d, &drv->devices, driver_list) {
1966 dev = get_device(d);
1967 if (!dev)
1968 continue;
1969 cdev = to_ccwdev(dev);
1970 if (dasd_autodetect || dasd_busid_known(cdev->dev.bus_id) == 0)
1971 ccw_device_set_online(cdev);
1972 put_device(dev);
1973 }
1974 up_read(&drv->bus->subsys.rwsem);
1975 put_driver(drv); 1973 put_driver(drv);
1976} 1974}
1977 1975
@@ -1983,7 +1981,7 @@ dasd_init(void)
1983 init_waitqueue_head(&dasd_init_waitq); 1981 init_waitqueue_head(&dasd_init_waitq);
1984 1982
1985 /* register 'common' DASD debug area, used for all DBF_XXX calls */ 1983 /* register 'common' DASD debug area, used for all DBF_XXX calls */
1986 dasd_debug_area = debug_register("dasd", 0, 2, 8 * sizeof (long)); 1984 dasd_debug_area = debug_register("dasd", 1, 2, 8 * sizeof (long));
1987 if (dasd_debug_area == NULL) { 1985 if (dasd_debug_area == NULL) {
1988 rc = -ENOMEM; 1986 rc = -ENOMEM;
1989 goto failed; 1987 goto failed;
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
index d7f19745911f..43c34f8c5e68 100644
--- a/drivers/s390/block/dasd_proc.c
+++ b/drivers/s390/block/dasd_proc.c
@@ -9,13 +9,14 @@
9 * 9 *
10 * /proc interface for the dasd driver. 10 * /proc interface for the dasd driver.
11 * 11 *
12 * $Revision: 1.31 $ 12 * $Revision: 1.32 $
13 */ 13 */
14 14
15#include <linux/config.h> 15#include <linux/config.h>
16#include <linux/ctype.h> 16#include <linux/ctype.h>
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/vmalloc.h> 18#include <linux/vmalloc.h>
19#include <linux/proc_fs.h>
19 20
20#include <asm/debug.h> 21#include <asm/debug.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 6bc27d52326f..4fde41188996 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -718,7 +718,7 @@ dcssblk_check_params(void)
718 buf[j-i] = dcssblk_segments[j]; 718 buf[j-i] = dcssblk_segments[j];
719 } 719 }
720 buf[j-i] = '\0'; 720 buf[j-i] = '\0';
721 rc = dcssblk_add_store(dcssblk_root_dev, buf, j-i); 721 rc = dcssblk_add_store(dcssblk_root_dev, NULL, buf, j-i);
722 if ((rc >= 0) && (dcssblk_segments[j] == '(')) { 722 if ((rc >= 0) && (dcssblk_segments[j] == '(')) {
723 for (k = 0; buf[k] != '\0'; k++) 723 for (k = 0; buf[k] != '\0'; k++)
724 buf[k] = toupper(buf[k]); 724 buf[k] = toupper(buf[k]);
@@ -728,7 +728,7 @@ dcssblk_check_params(void)
728 up_read(&dcssblk_devices_sem); 728 up_read(&dcssblk_devices_sem);
729 if (dev_info) 729 if (dev_info)
730 dcssblk_shared_store(&dev_info->dev, 730 dcssblk_shared_store(&dev_info->dev,
731 "0\n", 2); 731 NULL, "0\n", 2);
732 } 732 }
733 } 733 }
734 while ((dcssblk_segments[j] != ',') && 734 while ((dcssblk_segments[j] != ',') &&
diff --git a/drivers/s390/char/Makefile b/drivers/s390/char/Makefile
index 14e8cce9f862..6377a96735df 100644
--- a/drivers/s390/char/Makefile
+++ b/drivers/s390/char/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_SCLP_CPI) += sclp_cpi.o
19 19
20obj-$(CONFIG_ZVM_WATCHDOG) += vmwatchdog.o 20obj-$(CONFIG_ZVM_WATCHDOG) += vmwatchdog.o
21obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o 21obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o
22obj-$(CONFIG_VMCP) += vmcp.o
22 23
23tape-$(CONFIG_S390_TAPE_BLOCK) += tape_block.o 24tape-$(CONFIG_S390_TAPE_BLOCK) += tape_block.o
24tape-$(CONFIG_PROC_FS) += tape_proc.o 25tape-$(CONFIG_PROC_FS) += tape_proc.o
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 022f17bff731..f11a67fda40e 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -860,8 +860,8 @@ con3215_init(void)
860 860
861 /* Set the console mode for VM */ 861 /* Set the console mode for VM */
862 if (MACHINE_IS_VM) { 862 if (MACHINE_IS_VM) {
863 cpcmd("TERM CONMODE 3215", NULL, 0); 863 cpcmd("TERM CONMODE 3215", NULL, 0, NULL);
864 cpcmd("TERM AUTOCR OFF", NULL, 0); 864 cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
865 } 865 }
866 866
867 /* allocate 3215 request structures */ 867 /* allocate 3215 request structures */
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
index d52fb57a6b19..fc7a213e591f 100644
--- a/drivers/s390/char/con3270.c
+++ b/drivers/s390/char/con3270.c
@@ -591,8 +591,8 @@ con3270_init(void)
591 591
592 /* Set the console mode for VM */ 592 /* Set the console mode for VM */
593 if (MACHINE_IS_VM) { 593 if (MACHINE_IS_VM) {
594 cpcmd("TERM CONMODE 3270", 0, 0); 594 cpcmd("TERM CONMODE 3270", NULL, 0, NULL);
595 cpcmd("TERM AUTOCR OFF", 0, 0); 595 cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
596 } 596 }
597 597
598 cdev = ccw_device_probe_console(); 598 cdev = ccw_device_probe_console();
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
index 480ec87976fb..20be88e91fa1 100644
--- a/drivers/s390/char/tape_34xx.c
+++ b/drivers/s390/char/tape_34xx.c
@@ -1351,13 +1351,13 @@ tape_34xx_init (void)
1351{ 1351{
1352 int rc; 1352 int rc;
1353 1353
1354 TAPE_DBF_AREA = debug_register ( "tape_34xx", 1, 2, 4*sizeof(long)); 1354 TAPE_DBF_AREA = debug_register ( "tape_34xx", 2, 2, 4*sizeof(long));
1355 debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view); 1355 debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
1356#ifdef DBF_LIKE_HELL 1356#ifdef DBF_LIKE_HELL
1357 debug_set_level(TAPE_DBF_AREA, 6); 1357 debug_set_level(TAPE_DBF_AREA, 6);
1358#endif 1358#endif
1359 1359
1360 DBF_EVENT(3, "34xx init: $Revision: 1.21 $\n"); 1360 DBF_EVENT(3, "34xx init: $Revision: 1.23 $\n");
1361 /* Register driver for 3480/3490 tapes. */ 1361 /* Register driver for 3480/3490 tapes. */
1362 rc = ccw_driver_register(&tape_34xx_driver); 1362 rc = ccw_driver_register(&tape_34xx_driver);
1363 if (rc) 1363 if (rc)
@@ -1378,7 +1378,7 @@ tape_34xx_exit(void)
1378MODULE_DEVICE_TABLE(ccw, tape_34xx_ids); 1378MODULE_DEVICE_TABLE(ccw, tape_34xx_ids);
1379MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH"); 1379MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH");
1380MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape " 1380MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape "
1381 "device driver ($Revision: 1.21 $)"); 1381 "device driver ($Revision: 1.23 $)");
1382MODULE_LICENSE("GPL"); 1382MODULE_LICENSE("GPL");
1383 1383
1384module_init(tape_34xx_init); 1384module_init(tape_34xx_init);
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index b4df4a515b12..0597aa0e27ee 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -1186,7 +1186,7 @@ tape_mtop(struct tape_device *device, int mt_op, int mt_count)
1186static int 1186static int
1187tape_init (void) 1187tape_init (void)
1188{ 1188{
1189 TAPE_DBF_AREA = debug_register ( "tape", 1, 2, 4*sizeof(long)); 1189 TAPE_DBF_AREA = debug_register ( "tape", 2, 2, 4*sizeof(long));
1190 debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view); 1190 debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
1191#ifdef DBF_LIKE_HELL 1191#ifdef DBF_LIKE_HELL
1192 debug_set_level(TAPE_DBF_AREA, 6); 1192 debug_set_level(TAPE_DBF_AREA, 6);
diff --git a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c
index 801d17cca34e..5fec0a10cc3d 100644
--- a/drivers/s390/char/tape_proc.c
+++ b/drivers/s390/char/tape_proc.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/vmalloc.h> 16#include <linux/vmalloc.h>
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/proc_fs.h>
18 19
19#define TAPE_DBF_AREA tape_core_dbf 20#define TAPE_DBF_AREA tape_core_dbf
20 21
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
new file mode 100644
index 000000000000..7f11a608a633
--- /dev/null
+++ b/drivers/s390/char/vmcp.c
@@ -0,0 +1,219 @@
1/*
2 * Copyright (C) 2004,2005 IBM Corporation
3 * Interface implementation for communication with the v/VM control program
4 * Author(s): Christian Borntraeger <cborntra@de.ibm.com>
5 *
6 *
7 * z/VMs CP offers the possibility to issue commands via the diagnose code 8
8 * this driver implements a character device that issues these commands and
9 * returns the answer of CP.
10
11 * The idea of this driver is based on cpint from Neale Ferguson and #CP in CMS
12 */
13
14#include <linux/fs.h>
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/miscdevice.h>
18#include <linux/module.h>
19#include <asm/cpcmd.h>
20#include <asm/debug.h>
21#include <asm/uaccess.h>
22#include "vmcp.h"
23
24MODULE_LICENSE("GPL");
25MODULE_AUTHOR("Christian Borntraeger <cborntra@de.ibm.com>");
26MODULE_DESCRIPTION("z/VM CP interface");
27
28static debug_info_t *vmcp_debug;
29
30static int vmcp_open(struct inode *inode, struct file *file)
31{
32 struct vmcp_session *session;
33
34 if (!capable(CAP_SYS_ADMIN))
35 return -EPERM;
36
37 session = kmalloc(sizeof(*session), GFP_KERNEL);
38 if (!session)
39 return -ENOMEM;
40 session->bufsize = PAGE_SIZE;
41 session->response = NULL;
42 session->resp_size = 0;
43 init_MUTEX(&session->mutex);
44 file->private_data = session;
45 return nonseekable_open(inode, file);
46}
47
48static int vmcp_release(struct inode *inode, struct file *file)
49{
50 struct vmcp_session *session;
51
52 session = (struct vmcp_session *)file->private_data;
53 file->private_data = NULL;
54 free_pages((unsigned long)session->response, get_order(session->bufsize));
55 kfree(session);
56 return 0;
57}
58
59static ssize_t
60vmcp_read(struct file *file, char __user * buff, size_t count, loff_t * ppos)
61{
62 size_t tocopy;
63 struct vmcp_session *session;
64
65 session = (struct vmcp_session *)file->private_data;
66 if (down_interruptible(&session->mutex))
67 return -ERESTARTSYS;
68 if (!session->response) {
69 up(&session->mutex);
70 return 0;
71 }
72 if (*ppos > session->resp_size) {
73 up(&session->mutex);
74 return 0;
75 }
76 tocopy = min(session->resp_size - (size_t) (*ppos), count);
77 tocopy = min(tocopy,session->bufsize - (size_t) (*ppos));
78
79 if (copy_to_user(buff, session->response + (*ppos), tocopy)) {
80 up(&session->mutex);
81 return -EFAULT;
82 }
83 up(&session->mutex);
84 *ppos += tocopy;
85 return tocopy;
86}
87
88static ssize_t
89vmcp_write(struct file *file, const char __user * buff, size_t count,
90 loff_t * ppos)
91{
92 char *cmd;
93 struct vmcp_session *session;
94
95 if (count > 240)
96 return -EINVAL;
97 cmd = kmalloc(count + 1, GFP_KERNEL);
98 if (!cmd)
99 return -ENOMEM;
100 if (copy_from_user(cmd, buff, count)) {
101 kfree(cmd);
102 return -EFAULT;
103 }
104 cmd[count] = '\0';
105 session = (struct vmcp_session *)file->private_data;
106 if (down_interruptible(&session->mutex))
107 return -ERESTARTSYS;
108 if (!session->response)
109 session->response = (char *)__get_free_pages(GFP_KERNEL
110 | __GFP_REPEAT | GFP_DMA,
111 get_order(session->bufsize));
112 if (!session->response) {
113 up(&session->mutex);
114 kfree(cmd);
115 return -ENOMEM;
116 }
117 debug_text_event(vmcp_debug, 1, cmd);
118 session->resp_size = cpcmd(cmd, session->response,
119 session->bufsize,
120 &session->resp_code);
121 up(&session->mutex);
122 kfree(cmd);
123 *ppos = 0; /* reset the file pointer after a command */
124 return count;
125}
126
127
128/*
129 * These ioctls are available, as the semantics of the diagnose 8 call
130 * does not fit very well into a Linux call. Diagnose X'08' is described in
131 * CP Programming Services SC24-6084-00
132 *
133 * VMCP_GETCODE: gives the CP return code back to user space
134 * VMCP_SETBUF: sets the response buffer for the next write call. diagnose 8
135 * expects adjacent pages in real storage and to make matters worse, we
136 * dont know the size of the response. Therefore we default to PAGESIZE and
137 * let userspace to change the response size, if userspace expects a bigger
138 * response
139 */
140static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
141{
142 struct vmcp_session *session;
143 int temp;
144
145 session = (struct vmcp_session *)file->private_data;
146 if (down_interruptible(&session->mutex))
147 return -ERESTARTSYS;
148 switch (cmd) {
149 case VMCP_GETCODE:
150 temp = session->resp_code;
151 up(&session->mutex);
152 return put_user(temp, (int __user *)arg);
153 case VMCP_SETBUF:
154 free_pages((unsigned long)session->response,
155 get_order(session->bufsize));
156 session->response=NULL;
157 temp = get_user(session->bufsize, (int __user *)arg);
158 if (get_order(session->bufsize) > 8) {
159 session->bufsize = PAGE_SIZE;
160 temp = -EINVAL;
161 }
162 up(&session->mutex);
163 return temp;
164 case VMCP_GETSIZE:
165 temp = session->resp_size;
166 up(&session->mutex);
167 return put_user(temp, (int __user *)arg);
168 default:
169 up(&session->mutex);
170 return -ENOIOCTLCMD;
171 }
172}
173
174static struct file_operations vmcp_fops = {
175 .owner = THIS_MODULE,
176 .open = &vmcp_open,
177 .release = &vmcp_release,
178 .read = &vmcp_read,
179 .llseek = &no_llseek,
180 .write = &vmcp_write,
181 .unlocked_ioctl = &vmcp_ioctl,
182 .compat_ioctl = &vmcp_ioctl
183};
184
185static struct miscdevice vmcp_dev = {
186 .name = "vmcp",
187 .minor = MISC_DYNAMIC_MINOR,
188 .fops = &vmcp_fops,
189};
190
191static int __init vmcp_init(void)
192{
193 int ret;
194
195 if (!MACHINE_IS_VM) {
196 printk(KERN_WARNING
197 "z/VM CP interface is only available under z/VM\n");
198 return -ENODEV;
199 }
200 ret = misc_register(&vmcp_dev);
201 if (!ret)
202 printk(KERN_INFO "z/VM CP interface loaded\n");
203 else
204 printk(KERN_WARNING
205 "z/VM CP interface not loaded. Could not register misc device.\n");
206 vmcp_debug = debug_register("vmcp", 1, 1, 240);
207 debug_register_view(vmcp_debug, &debug_hex_ascii_view);
208 return ret;
209}
210
211static void __exit vmcp_exit(void)
212{
213 WARN_ON(misc_deregister(&vmcp_dev) != 0);
214 debug_unregister(vmcp_debug);
215 printk(KERN_INFO "z/VM CP interface unloaded.\n");
216}
217
218module_init(vmcp_init);
219module_exit(vmcp_exit);
diff --git a/drivers/s390/char/vmcp.h b/drivers/s390/char/vmcp.h
new file mode 100644
index 000000000000..87389e730465
--- /dev/null
+++ b/drivers/s390/char/vmcp.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2004, 2005 IBM Corporation
3 * Interface implementation for communication with the v/VM control program
4 * Version 1.0
5 * Author(s): Christian Borntraeger <cborntra@de.ibm.com>
6 *
7 *
8 * z/VMs CP offers the possibility to issue commands via the diagnose code 8
9 * this driver implements a character device that issues these commands and
10 * returns the answer of CP.
11 *
12 * The idea of this driver is based on cpint from Neale Ferguson
13 */
14
15#include <asm/semaphore.h>
16#include <linux/ioctl.h>
17
18#define VMCP_GETCODE _IOR(0x10, 1, int)
19#define VMCP_SETBUF _IOW(0x10, 2, int)
20#define VMCP_GETSIZE _IOR(0x10, 3, int)
21
22struct vmcp_session {
23 unsigned int bufsize;
24 char *response;
25 int resp_size;
26 int resp_code;
27 /* As we use copy_from/to_user, which might *
28 * sleep and cannot use a spinlock */
29 struct semaphore mutex;
30};
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index f7717327d15e..491f00c032e8 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -236,7 +236,7 @@ vmlogrdr_get_recording_class_AB(void) {
236 int len,i; 236 int len,i;
237 237
238 printk (KERN_DEBUG "vmlogrdr: query command: %s\n", cp_command); 238 printk (KERN_DEBUG "vmlogrdr: query command: %s\n", cp_command);
239 cpcmd(cp_command, cp_response, sizeof(cp_response)); 239 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
240 printk (KERN_DEBUG "vmlogrdr: response: %s", cp_response); 240 printk (KERN_DEBUG "vmlogrdr: response: %s", cp_response);
241 len = strnlen(cp_response,sizeof(cp_response)); 241 len = strnlen(cp_response,sizeof(cp_response));
242 // now the parsing 242 // now the parsing
@@ -288,7 +288,7 @@ vmlogrdr_recording(struct vmlogrdr_priv_t * logptr, int action, int purge) {
288 288
289 printk (KERN_DEBUG "vmlogrdr: recording command: %s\n", 289 printk (KERN_DEBUG "vmlogrdr: recording command: %s\n",
290 cp_command); 290 cp_command);
291 cpcmd(cp_command, cp_response, sizeof(cp_response)); 291 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
292 printk (KERN_DEBUG "vmlogrdr: recording response: %s", 292 printk (KERN_DEBUG "vmlogrdr: recording response: %s",
293 cp_response); 293 cp_response);
294 } 294 }
@@ -301,7 +301,7 @@ vmlogrdr_recording(struct vmlogrdr_priv_t * logptr, int action, int purge) {
301 qid_string); 301 qid_string);
302 302
303 printk (KERN_DEBUG "vmlogrdr: recording command: %s\n", cp_command); 303 printk (KERN_DEBUG "vmlogrdr: recording command: %s\n", cp_command);
304 cpcmd(cp_command, cp_response, sizeof(cp_response)); 304 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
305 printk (KERN_DEBUG "vmlogrdr: recording response: %s", 305 printk (KERN_DEBUG "vmlogrdr: recording response: %s",
306 cp_response); 306 cp_response);
307 /* The recording command will usually answer with 'Command complete' 307 /* The recording command will usually answer with 'Command complete'
@@ -607,7 +607,7 @@ vmlogrdr_purge_store(struct device * dev, struct device_attribute *attr, const c
607 priv->recording_name); 607 priv->recording_name);
608 608
609 printk (KERN_DEBUG "vmlogrdr: recording command: %s\n", cp_command); 609 printk (KERN_DEBUG "vmlogrdr: recording command: %s\n", cp_command);
610 cpcmd(cp_command, cp_response, sizeof(cp_response)); 610 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
611 printk (KERN_DEBUG "vmlogrdr: recording response: %s", 611 printk (KERN_DEBUG "vmlogrdr: recording response: %s",
612 cp_response); 612 cp_response);
613 613
@@ -682,7 +682,7 @@ vmlogrdr_recording_status_show(struct device_driver *driver, char *buf) {
682 char cp_command[] = "QUERY RECORDING "; 682 char cp_command[] = "QUERY RECORDING ";
683 int len; 683 int len;
684 684
685 cpcmd(cp_command, buf, 4096); 685 cpcmd(cp_command, buf, 4096, NULL);
686 len = strlen(buf); 686 len = strlen(buf);
687 return len; 687 return len;
688} 688}
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 306525acb9f8..91ea8e4777f3 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -403,34 +403,22 @@ ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
403 return driver_register(&cdriver->driver); 403 return driver_register(&cdriver->driver);
404} 404}
405 405
406static inline struct device * 406static int
407__get_next_ccwgroup_device(struct device_driver *drv) 407__ccwgroup_driver_unregister_device(struct device *dev, void *data)
408{ 408{
409 struct device *dev, *d; 409 __ccwgroup_remove_symlinks(to_ccwgroupdev(dev));
410 410 device_unregister(dev);
411 down_read(&drv->bus->subsys.rwsem); 411 put_device(dev);
412 dev = NULL; 412 return 0;
413 list_for_each_entry(d, &drv->devices, driver_list) {
414 dev = get_device(d);
415 if (dev)
416 break;
417 }
418 up_read(&drv->bus->subsys.rwsem);
419 return dev;
420} 413}
421 414
422void 415void
423ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver) 416ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver)
424{ 417{
425 struct device *dev;
426
427 /* We don't want ccwgroup devices to live longer than their driver. */ 418 /* We don't want ccwgroup devices to live longer than their driver. */
428 get_driver(&cdriver->driver); 419 get_driver(&cdriver->driver);
429 while ((dev = __get_next_ccwgroup_device(&cdriver->driver))) { 420 driver_for_each_device(&cdriver->driver, NULL, NULL,
430 __ccwgroup_remove_symlinks(to_ccwgroupdev(dev)); 421 __ccwgroup_driver_unregister_device);
431 device_unregister(dev);
432 put_device(dev);
433 };
434 put_driver(&cdriver->driver); 422 put_driver(&cdriver->driver);
435 driver_unregister(&cdriver->driver); 423 driver_unregister(&cdriver->driver);
436} 424}
@@ -449,7 +437,7 @@ __ccwgroup_get_gdev_by_cdev(struct ccw_device *cdev)
449 if (cdev->dev.driver_data) { 437 if (cdev->dev.driver_data) {
450 gdev = (struct ccwgroup_device *)cdev->dev.driver_data; 438 gdev = (struct ccwgroup_device *)cdev->dev.driver_data;
451 if (get_device(&gdev->dev)) { 439 if (get_device(&gdev->dev)) {
452 if (!list_empty(&gdev->dev.node)) 440 if (klist_node_attached(&gdev->dev.knode_bus))
453 return gdev; 441 return gdev;
454 put_device(&gdev->dev); 442 put_device(&gdev->dev);
455 } 443 }
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 1d9b3f18d8de..ea813bdce1d6 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/s390/cio/cio.c 2 * drivers/s390/cio/cio.c
3 * S/390 common I/O routines -- low level i/o calls 3 * S/390 common I/O routines -- low level i/o calls
4 * $Revision: 1.133 $ 4 * $Revision: 1.134 $
5 * 5 *
6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, 6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
7 * IBM Corporation 7 * IBM Corporation
@@ -63,17 +63,17 @@ __setup ("cio_msg=", cio_setup);
63static int __init 63static int __init
64cio_debug_init (void) 64cio_debug_init (void)
65{ 65{
66 cio_debug_msg_id = debug_register ("cio_msg", 4, 4, 16*sizeof (long)); 66 cio_debug_msg_id = debug_register ("cio_msg", 16, 4, 16*sizeof (long));
67 if (!cio_debug_msg_id) 67 if (!cio_debug_msg_id)
68 goto out_unregister; 68 goto out_unregister;
69 debug_register_view (cio_debug_msg_id, &debug_sprintf_view); 69 debug_register_view (cio_debug_msg_id, &debug_sprintf_view);
70 debug_set_level (cio_debug_msg_id, 2); 70 debug_set_level (cio_debug_msg_id, 2);
71 cio_debug_trace_id = debug_register ("cio_trace", 4, 4, 8); 71 cio_debug_trace_id = debug_register ("cio_trace", 16, 4, 8);
72 if (!cio_debug_trace_id) 72 if (!cio_debug_trace_id)
73 goto out_unregister; 73 goto out_unregister;
74 debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view); 74 debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view);
75 debug_set_level (cio_debug_trace_id, 2); 75 debug_set_level (cio_debug_trace_id, 2);
76 cio_debug_crw_id = debug_register ("cio_crw", 2, 4, 16*sizeof (long)); 76 cio_debug_crw_id = debug_register ("cio_crw", 4, 4, 16*sizeof (long));
77 if (!cio_debug_crw_id) 77 if (!cio_debug_crw_id)
78 goto out_unregister; 78 goto out_unregister;
79 debug_register_view (cio_debug_crw_id, &debug_sprintf_view); 79 debug_register_view (cio_debug_crw_id, &debug_sprintf_view);
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 87bd70eeabed..555119cacc27 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -128,34 +128,28 @@ css_probe_device(int irq)
128 return ret; 128 return ret;
129} 129}
130 130
131static int
132check_subchannel(struct device * dev, void * data)
133{
134 struct subchannel *sch;
135 int irq = (unsigned long)data;
136
137 sch = to_subchannel(dev);
138 return (sch->irq == irq);
139}
140
131struct subchannel * 141struct subchannel *
132get_subchannel_by_schid(int irq) 142get_subchannel_by_schid(int irq)
133{ 143{
134 struct subchannel *sch;
135 struct list_head *entry;
136 struct device *dev; 144 struct device *dev;
137 145
138 if (!get_bus(&css_bus_type)) 146 dev = bus_find_device(&css_bus_type, NULL,
139 return NULL; 147 (void *)(unsigned long)irq, check_subchannel);
140 down_read(&css_bus_type.subsys.rwsem);
141 sch = NULL;
142 list_for_each(entry, &css_bus_type.devices.list) {
143 dev = get_device(container_of(entry,
144 struct device, bus_list));
145 if (!dev)
146 continue;
147 sch = to_subchannel(dev);
148 if (sch->irq == irq)
149 break;
150 put_device(dev);
151 sch = NULL;
152 }
153 up_read(&css_bus_type.subsys.rwsem);
154 put_bus(&css_bus_type);
155 148
156 return sch; 149 return dev ? to_subchannel(dev) : NULL;
157} 150}
158 151
152
159static inline int 153static inline int
160css_get_subchannel_status(struct subchannel *sch, int schid) 154css_get_subchannel_status(struct subchannel *sch, int schid)
161{ 155{
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 809e1108a06e..14c76f5e4177 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -514,36 +514,39 @@ ccw_device_register(struct ccw_device *cdev)
514 return ret; 514 return ret;
515} 515}
516 516
517struct match_data {
518 unsigned int devno;
519 struct ccw_device * sibling;
520};
521
522static int
523match_devno(struct device * dev, void * data)
524{
525 struct match_data * d = (struct match_data *)data;
526 struct ccw_device * cdev;
527
528 cdev = to_ccwdev(dev);
529 if ((cdev->private->state == DEV_STATE_DISCONNECTED) &&
530 (cdev->private->devno == d->devno) &&
531 (cdev != d->sibling)) {
532 cdev->private->state = DEV_STATE_NOT_OPER;
533 return 1;
534 }
535 return 0;
536}
537
517static struct ccw_device * 538static struct ccw_device *
518get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling) 539get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling)
519{ 540{
520 struct ccw_device *cdev;
521 struct list_head *entry;
522 struct device *dev; 541 struct device *dev;
542 struct match_data data = {
543 .devno = devno,
544 .sibling = sibling,
545 };
523 546
524 if (!get_bus(&ccw_bus_type)) 547 dev = bus_find_device(&css_bus_type, NULL, &data, match_devno);
525 return NULL;
526 down_read(&ccw_bus_type.subsys.rwsem);
527 cdev = NULL;
528 list_for_each(entry, &ccw_bus_type.devices.list) {
529 dev = get_device(container_of(entry,
530 struct device, bus_list));
531 if (!dev)
532 continue;
533 cdev = to_ccwdev(dev);
534 if ((cdev->private->state == DEV_STATE_DISCONNECTED) &&
535 (cdev->private->devno == devno) &&
536 (cdev != sibling)) {
537 cdev->private->state = DEV_STATE_NOT_OPER;
538 break;
539 }
540 put_device(dev);
541 cdev = NULL;
542 }
543 up_read(&ccw_bus_type.subsys.rwsem);
544 put_bus(&ccw_bus_type);
545 548
546 return cdev; 549 return dev ? to_ccwdev(dev) : NULL;
547} 550}
548 551
549static void 552static void
@@ -647,7 +650,7 @@ io_subchannel_register(void *data)
647 cdev = (struct ccw_device *) data; 650 cdev = (struct ccw_device *) data;
648 sch = to_subchannel(cdev->dev.parent); 651 sch = to_subchannel(cdev->dev.parent);
649 652
650 if (!list_empty(&sch->dev.children)) { 653 if (klist_node_attached(&cdev->dev.knode_parent)) {
651 bus_rescan_devices(&ccw_bus_type); 654 bus_rescan_devices(&ccw_bus_type);
652 goto out; 655 goto out;
653 } 656 }
@@ -1019,30 +1022,29 @@ ccw_device_probe_console(void)
1019/* 1022/*
1020 * get ccw_device matching the busid, but only if owned by cdrv 1023 * get ccw_device matching the busid, but only if owned by cdrv
1021 */ 1024 */
1025static int
1026__ccwdev_check_busid(struct device *dev, void *id)
1027{
1028 char *bus_id;
1029
1030 bus_id = (char *)id;
1031
1032 return (strncmp(bus_id, dev->bus_id, BUS_ID_SIZE) == 0);
1033}
1034
1035
1022struct ccw_device * 1036struct ccw_device *
1023get_ccwdev_by_busid(struct ccw_driver *cdrv, const char *bus_id) 1037get_ccwdev_by_busid(struct ccw_driver *cdrv, const char *bus_id)
1024{ 1038{
1025 struct device *d, *dev; 1039 struct device *dev;
1026 struct device_driver *drv; 1040 struct device_driver *drv;
1027 1041
1028 drv = get_driver(&cdrv->driver); 1042 drv = get_driver(&cdrv->driver);
1029 if (!drv) 1043 if (!drv)
1030 return 0; 1044 return NULL;
1031
1032 down_read(&drv->bus->subsys.rwsem);
1033
1034 dev = NULL;
1035 list_for_each_entry(d, &drv->devices, driver_list) {
1036 dev = get_device(d);
1037 1045
1038 if (dev && !strncmp(bus_id, dev->bus_id, BUS_ID_SIZE)) 1046 dev = driver_find_device(drv, NULL, (void *)bus_id,
1039 break; 1047 __ccwdev_check_busid);
1040 else if (dev) {
1041 put_device(dev);
1042 dev = NULL;
1043 }
1044 }
1045 up_read(&drv->bus->subsys.rwsem);
1046 put_driver(drv); 1048 put_driver(drv);
1047 1049
1048 return dev ? to_ccwdev(dev) : 0; 1050 return dev ? to_ccwdev(dev) : 0;
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index bbe9f45d1438..82194c4eadfb 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -56,7 +56,7 @@
56#include "ioasm.h" 56#include "ioasm.h"
57#include "chsc.h" 57#include "chsc.h"
58 58
59#define VERSION_QDIO_C "$Revision: 1.98 $" 59#define VERSION_QDIO_C "$Revision: 1.101 $"
60 60
61/****************** MODULE PARAMETER VARIABLES ********************/ 61/****************** MODULE PARAMETER VARIABLES ********************/
62MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>"); 62MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>");
@@ -3342,7 +3342,7 @@ static int
3342qdio_register_dbf_views(void) 3342qdio_register_dbf_views(void)
3343{ 3343{
3344 qdio_dbf_setup=debug_register(QDIO_DBF_SETUP_NAME, 3344 qdio_dbf_setup=debug_register(QDIO_DBF_SETUP_NAME,
3345 QDIO_DBF_SETUP_INDEX, 3345 QDIO_DBF_SETUP_PAGES,
3346 QDIO_DBF_SETUP_NR_AREAS, 3346 QDIO_DBF_SETUP_NR_AREAS,
3347 QDIO_DBF_SETUP_LEN); 3347 QDIO_DBF_SETUP_LEN);
3348 if (!qdio_dbf_setup) 3348 if (!qdio_dbf_setup)
@@ -3351,7 +3351,7 @@ qdio_register_dbf_views(void)
3351 debug_set_level(qdio_dbf_setup,QDIO_DBF_SETUP_LEVEL); 3351 debug_set_level(qdio_dbf_setup,QDIO_DBF_SETUP_LEVEL);
3352 3352
3353 qdio_dbf_sbal=debug_register(QDIO_DBF_SBAL_NAME, 3353 qdio_dbf_sbal=debug_register(QDIO_DBF_SBAL_NAME,
3354 QDIO_DBF_SBAL_INDEX, 3354 QDIO_DBF_SBAL_PAGES,
3355 QDIO_DBF_SBAL_NR_AREAS, 3355 QDIO_DBF_SBAL_NR_AREAS,
3356 QDIO_DBF_SBAL_LEN); 3356 QDIO_DBF_SBAL_LEN);
3357 if (!qdio_dbf_sbal) 3357 if (!qdio_dbf_sbal)
@@ -3361,7 +3361,7 @@ qdio_register_dbf_views(void)
3361 debug_set_level(qdio_dbf_sbal,QDIO_DBF_SBAL_LEVEL); 3361 debug_set_level(qdio_dbf_sbal,QDIO_DBF_SBAL_LEVEL);
3362 3362
3363 qdio_dbf_sense=debug_register(QDIO_DBF_SENSE_NAME, 3363 qdio_dbf_sense=debug_register(QDIO_DBF_SENSE_NAME,
3364 QDIO_DBF_SENSE_INDEX, 3364 QDIO_DBF_SENSE_PAGES,
3365 QDIO_DBF_SENSE_NR_AREAS, 3365 QDIO_DBF_SENSE_NR_AREAS,
3366 QDIO_DBF_SENSE_LEN); 3366 QDIO_DBF_SENSE_LEN);
3367 if (!qdio_dbf_sense) 3367 if (!qdio_dbf_sense)
@@ -3371,7 +3371,7 @@ qdio_register_dbf_views(void)
3371 debug_set_level(qdio_dbf_sense,QDIO_DBF_SENSE_LEVEL); 3371 debug_set_level(qdio_dbf_sense,QDIO_DBF_SENSE_LEVEL);
3372 3372
3373 qdio_dbf_trace=debug_register(QDIO_DBF_TRACE_NAME, 3373 qdio_dbf_trace=debug_register(QDIO_DBF_TRACE_NAME,
3374 QDIO_DBF_TRACE_INDEX, 3374 QDIO_DBF_TRACE_PAGES,
3375 QDIO_DBF_TRACE_NR_AREAS, 3375 QDIO_DBF_TRACE_NR_AREAS,
3376 QDIO_DBF_TRACE_LEN); 3376 QDIO_DBF_TRACE_LEN);
3377 if (!qdio_dbf_trace) 3377 if (!qdio_dbf_trace)
@@ -3382,7 +3382,7 @@ qdio_register_dbf_views(void)
3382 3382
3383#ifdef CONFIG_QDIO_DEBUG 3383#ifdef CONFIG_QDIO_DEBUG
3384 qdio_dbf_slsb_out=debug_register(QDIO_DBF_SLSB_OUT_NAME, 3384 qdio_dbf_slsb_out=debug_register(QDIO_DBF_SLSB_OUT_NAME,
3385 QDIO_DBF_SLSB_OUT_INDEX, 3385 QDIO_DBF_SLSB_OUT_PAGES,
3386 QDIO_DBF_SLSB_OUT_NR_AREAS, 3386 QDIO_DBF_SLSB_OUT_NR_AREAS,
3387 QDIO_DBF_SLSB_OUT_LEN); 3387 QDIO_DBF_SLSB_OUT_LEN);
3388 if (!qdio_dbf_slsb_out) 3388 if (!qdio_dbf_slsb_out)
@@ -3391,7 +3391,7 @@ qdio_register_dbf_views(void)
3391 debug_set_level(qdio_dbf_slsb_out,QDIO_DBF_SLSB_OUT_LEVEL); 3391 debug_set_level(qdio_dbf_slsb_out,QDIO_DBF_SLSB_OUT_LEVEL);
3392 3392
3393 qdio_dbf_slsb_in=debug_register(QDIO_DBF_SLSB_IN_NAME, 3393 qdio_dbf_slsb_in=debug_register(QDIO_DBF_SLSB_IN_NAME,
3394 QDIO_DBF_SLSB_IN_INDEX, 3394 QDIO_DBF_SLSB_IN_PAGES,
3395 QDIO_DBF_SLSB_IN_NR_AREAS, 3395 QDIO_DBF_SLSB_IN_NR_AREAS,
3396 QDIO_DBF_SLSB_IN_LEN); 3396 QDIO_DBF_SLSB_IN_LEN);
3397 if (!qdio_dbf_slsb_in) 3397 if (!qdio_dbf_slsb_in)
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index b6daadac4e8b..6b8aa6a852be 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -3,7 +3,7 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5 5
6#define VERSION_CIO_QDIO_H "$Revision: 1.32 $" 6#define VERSION_CIO_QDIO_H "$Revision: 1.33 $"
7 7
8#ifdef CONFIG_QDIO_DEBUG 8#ifdef CONFIG_QDIO_DEBUG
9#define QDIO_VERBOSE_LEVEL 9 9#define QDIO_VERBOSE_LEVEL 9
@@ -132,7 +132,7 @@ enum qdio_irq_states {
132 132
133#define QDIO_DBF_SETUP_NAME "qdio_setup" 133#define QDIO_DBF_SETUP_NAME "qdio_setup"
134#define QDIO_DBF_SETUP_LEN 8 134#define QDIO_DBF_SETUP_LEN 8
135#define QDIO_DBF_SETUP_INDEX 2 135#define QDIO_DBF_SETUP_PAGES 4
136#define QDIO_DBF_SETUP_NR_AREAS 1 136#define QDIO_DBF_SETUP_NR_AREAS 1
137#ifdef CONFIG_QDIO_DEBUG 137#ifdef CONFIG_QDIO_DEBUG
138#define QDIO_DBF_SETUP_LEVEL 6 138#define QDIO_DBF_SETUP_LEVEL 6
@@ -142,7 +142,7 @@ enum qdio_irq_states {
142 142
143#define QDIO_DBF_SBAL_NAME "qdio_labs" /* sbal */ 143#define QDIO_DBF_SBAL_NAME "qdio_labs" /* sbal */
144#define QDIO_DBF_SBAL_LEN 256 144#define QDIO_DBF_SBAL_LEN 256
145#define QDIO_DBF_SBAL_INDEX 2 145#define QDIO_DBF_SBAL_PAGES 4
146#define QDIO_DBF_SBAL_NR_AREAS 2 146#define QDIO_DBF_SBAL_NR_AREAS 2
147#ifdef CONFIG_QDIO_DEBUG 147#ifdef CONFIG_QDIO_DEBUG
148#define QDIO_DBF_SBAL_LEVEL 6 148#define QDIO_DBF_SBAL_LEVEL 6
@@ -154,16 +154,16 @@ enum qdio_irq_states {
154#define QDIO_DBF_TRACE_LEN 8 154#define QDIO_DBF_TRACE_LEN 8
155#define QDIO_DBF_TRACE_NR_AREAS 2 155#define QDIO_DBF_TRACE_NR_AREAS 2
156#ifdef CONFIG_QDIO_DEBUG 156#ifdef CONFIG_QDIO_DEBUG
157#define QDIO_DBF_TRACE_INDEX 4 157#define QDIO_DBF_TRACE_PAGES 16
158#define QDIO_DBF_TRACE_LEVEL 4 /* -------- could be even more verbose here */ 158#define QDIO_DBF_TRACE_LEVEL 4 /* -------- could be even more verbose here */
159#else /* CONFIG_QDIO_DEBUG */ 159#else /* CONFIG_QDIO_DEBUG */
160#define QDIO_DBF_TRACE_INDEX 2 160#define QDIO_DBF_TRACE_PAGES 4
161#define QDIO_DBF_TRACE_LEVEL 2 161#define QDIO_DBF_TRACE_LEVEL 2
162#endif /* CONFIG_QDIO_DEBUG */ 162#endif /* CONFIG_QDIO_DEBUG */
163 163
164#define QDIO_DBF_SENSE_NAME "qdio_sense" 164#define QDIO_DBF_SENSE_NAME "qdio_sense"
165#define QDIO_DBF_SENSE_LEN 64 165#define QDIO_DBF_SENSE_LEN 64
166#define QDIO_DBF_SENSE_INDEX 1 166#define QDIO_DBF_SENSE_PAGES 2
167#define QDIO_DBF_SENSE_NR_AREAS 1 167#define QDIO_DBF_SENSE_NR_AREAS 1
168#ifdef CONFIG_QDIO_DEBUG 168#ifdef CONFIG_QDIO_DEBUG
169#define QDIO_DBF_SENSE_LEVEL 6 169#define QDIO_DBF_SENSE_LEVEL 6
@@ -176,13 +176,13 @@ enum qdio_irq_states {
176 176
177#define QDIO_DBF_SLSB_OUT_NAME "qdio_slsb_out" 177#define QDIO_DBF_SLSB_OUT_NAME "qdio_slsb_out"
178#define QDIO_DBF_SLSB_OUT_LEN QDIO_MAX_BUFFERS_PER_Q 178#define QDIO_DBF_SLSB_OUT_LEN QDIO_MAX_BUFFERS_PER_Q
179#define QDIO_DBF_SLSB_OUT_INDEX 8 179#define QDIO_DBF_SLSB_OUT_PAGES 256
180#define QDIO_DBF_SLSB_OUT_NR_AREAS 1 180#define QDIO_DBF_SLSB_OUT_NR_AREAS 1
181#define QDIO_DBF_SLSB_OUT_LEVEL 6 181#define QDIO_DBF_SLSB_OUT_LEVEL 6
182 182
183#define QDIO_DBF_SLSB_IN_NAME "qdio_slsb_in" 183#define QDIO_DBF_SLSB_IN_NAME "qdio_slsb_in"
184#define QDIO_DBF_SLSB_IN_LEN QDIO_MAX_BUFFERS_PER_Q 184#define QDIO_DBF_SLSB_IN_LEN QDIO_MAX_BUFFERS_PER_Q
185#define QDIO_DBF_SLSB_IN_INDEX 8 185#define QDIO_DBF_SLSB_IN_PAGES 256
186#define QDIO_DBF_SLSB_IN_NR_AREAS 1 186#define QDIO_DBF_SLSB_IN_NR_AREAS 1
187#define QDIO_DBF_SLSB_IN_LEVEL 6 187#define QDIO_DBF_SLSB_IN_LEVEL 6
188#endif /* CONFIG_QDIO_DEBUG */ 188#endif /* CONFIG_QDIO_DEBUG */
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index a99927d54ebb..60440dbe3a27 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -146,8 +146,8 @@ claw_unregister_debug_facility(void)
146static int 146static int
147claw_register_debug_facility(void) 147claw_register_debug_facility(void)
148{ 148{
149 claw_dbf_setup = debug_register("claw_setup", 1, 1, 8); 149 claw_dbf_setup = debug_register("claw_setup", 2, 1, 8);
150 claw_dbf_trace = debug_register("claw_trace", 1, 2, 8); 150 claw_dbf_trace = debug_register("claw_trace", 2, 2, 8);
151 if (claw_dbf_setup == NULL || claw_dbf_trace == NULL) { 151 if (claw_dbf_setup == NULL || claw_dbf_trace == NULL) {
152 printk(KERN_WARNING "Not enough memory for debug facility.\n"); 152 printk(KERN_WARNING "Not enough memory for debug facility.\n");
153 claw_unregister_debug_facility(); 153 claw_unregister_debug_facility();
diff --git a/drivers/s390/net/ctcdbug.c b/drivers/s390/net/ctcdbug.c
index 2c86bfa11b2f..0e2a8bb93032 100644
--- a/drivers/s390/net/ctcdbug.c
+++ b/drivers/s390/net/ctcdbug.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * linux/drivers/s390/net/ctcdbug.c ($Revision: 1.4 $) 3 * linux/drivers/s390/net/ctcdbug.c ($Revision: 1.6 $)
4 * 4 *
5 * CTC / ESCON network driver - s390 dbf exploit. 5 * CTC / ESCON network driver - s390 dbf exploit.
6 * 6 *
@@ -9,7 +9,7 @@
9 * Author(s): Original Code written by 9 * Author(s): Original Code written by
10 * Peter Tiedemann (ptiedem@de.ibm.com) 10 * Peter Tiedemann (ptiedem@de.ibm.com)
11 * 11 *
12 * $Revision: 1.4 $ $Date: 2004/08/04 10:11:59 $ 12 * $Revision: 1.6 $ $Date: 2005/05/11 08:10:17 $
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
@@ -51,15 +51,15 @@ int
51ctc_register_dbf_views(void) 51ctc_register_dbf_views(void)
52{ 52{
53 ctc_dbf_setup = debug_register(CTC_DBF_SETUP_NAME, 53 ctc_dbf_setup = debug_register(CTC_DBF_SETUP_NAME,
54 CTC_DBF_SETUP_INDEX, 54 CTC_DBF_SETUP_PAGES,
55 CTC_DBF_SETUP_NR_AREAS, 55 CTC_DBF_SETUP_NR_AREAS,
56 CTC_DBF_SETUP_LEN); 56 CTC_DBF_SETUP_LEN);
57 ctc_dbf_data = debug_register(CTC_DBF_DATA_NAME, 57 ctc_dbf_data = debug_register(CTC_DBF_DATA_NAME,
58 CTC_DBF_DATA_INDEX, 58 CTC_DBF_DATA_PAGES,
59 CTC_DBF_DATA_NR_AREAS, 59 CTC_DBF_DATA_NR_AREAS,
60 CTC_DBF_DATA_LEN); 60 CTC_DBF_DATA_LEN);
61 ctc_dbf_trace = debug_register(CTC_DBF_TRACE_NAME, 61 ctc_dbf_trace = debug_register(CTC_DBF_TRACE_NAME,
62 CTC_DBF_TRACE_INDEX, 62 CTC_DBF_TRACE_PAGES,
63 CTC_DBF_TRACE_NR_AREAS, 63 CTC_DBF_TRACE_NR_AREAS,
64 CTC_DBF_TRACE_LEN); 64 CTC_DBF_TRACE_LEN);
65 65
diff --git a/drivers/s390/net/ctcdbug.h b/drivers/s390/net/ctcdbug.h
index 7fe2ebd1792d..7d6afa1627c3 100644
--- a/drivers/s390/net/ctcdbug.h
+++ b/drivers/s390/net/ctcdbug.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * linux/drivers/s390/net/ctcdbug.h ($Revision: 1.5 $) 3 * linux/drivers/s390/net/ctcdbug.h ($Revision: 1.6 $)
4 * 4 *
5 * CTC / ESCON network driver - s390 dbf exploit. 5 * CTC / ESCON network driver - s390 dbf exploit.
6 * 6 *
@@ -9,7 +9,7 @@
9 * Author(s): Original Code written by 9 * Author(s): Original Code written by
10 * Peter Tiedemann (ptiedem@de.ibm.com) 10 * Peter Tiedemann (ptiedem@de.ibm.com)
11 * 11 *
12 * $Revision: 1.5 $ $Date: 2005/02/27 19:46:44 $ 12 * $Revision: 1.6 $ $Date: 2005/05/11 08:10:17 $
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
@@ -35,19 +35,19 @@
35 */ 35 */
36#define CTC_DBF_SETUP_NAME "ctc_setup" 36#define CTC_DBF_SETUP_NAME "ctc_setup"
37#define CTC_DBF_SETUP_LEN 16 37#define CTC_DBF_SETUP_LEN 16
38#define CTC_DBF_SETUP_INDEX 3 38#define CTC_DBF_SETUP_PAGES 8
39#define CTC_DBF_SETUP_NR_AREAS 1 39#define CTC_DBF_SETUP_NR_AREAS 1
40#define CTC_DBF_SETUP_LEVEL 3 40#define CTC_DBF_SETUP_LEVEL 3
41 41
42#define CTC_DBF_DATA_NAME "ctc_data" 42#define CTC_DBF_DATA_NAME "ctc_data"
43#define CTC_DBF_DATA_LEN 128 43#define CTC_DBF_DATA_LEN 128
44#define CTC_DBF_DATA_INDEX 3 44#define CTC_DBF_DATA_PAGES 8
45#define CTC_DBF_DATA_NR_AREAS 1 45#define CTC_DBF_DATA_NR_AREAS 1
46#define CTC_DBF_DATA_LEVEL 3 46#define CTC_DBF_DATA_LEVEL 3
47 47
48#define CTC_DBF_TRACE_NAME "ctc_trace" 48#define CTC_DBF_TRACE_NAME "ctc_trace"
49#define CTC_DBF_TRACE_LEN 16 49#define CTC_DBF_TRACE_LEN 16
50#define CTC_DBF_TRACE_INDEX 2 50#define CTC_DBF_TRACE_PAGES 4
51#define CTC_DBF_TRACE_NR_AREAS 2 51#define CTC_DBF_TRACE_NR_AREAS 2
52#define CTC_DBF_TRACE_LEVEL 3 52#define CTC_DBF_TRACE_LEVEL 3
53 53
diff --git a/drivers/s390/net/iucv.h b/drivers/s390/net/iucv.h
index 198330217eff..0c4644d3d2f3 100644
--- a/drivers/s390/net/iucv.h
+++ b/drivers/s390/net/iucv.h
@@ -37,19 +37,19 @@
37 */ 37 */
38#define IUCV_DBF_SETUP_NAME "iucv_setup" 38#define IUCV_DBF_SETUP_NAME "iucv_setup"
39#define IUCV_DBF_SETUP_LEN 32 39#define IUCV_DBF_SETUP_LEN 32
40#define IUCV_DBF_SETUP_INDEX 1 40#define IUCV_DBF_SETUP_PAGES 2
41#define IUCV_DBF_SETUP_NR_AREAS 1 41#define IUCV_DBF_SETUP_NR_AREAS 1
42#define IUCV_DBF_SETUP_LEVEL 3 42#define IUCV_DBF_SETUP_LEVEL 3
43 43
44#define IUCV_DBF_DATA_NAME "iucv_data" 44#define IUCV_DBF_DATA_NAME "iucv_data"
45#define IUCV_DBF_DATA_LEN 128 45#define IUCV_DBF_DATA_LEN 128
46#define IUCV_DBF_DATA_INDEX 1 46#define IUCV_DBF_DATA_PAGES 2
47#define IUCV_DBF_DATA_NR_AREAS 1 47#define IUCV_DBF_DATA_NR_AREAS 1
48#define IUCV_DBF_DATA_LEVEL 2 48#define IUCV_DBF_DATA_LEVEL 2
49 49
50#define IUCV_DBF_TRACE_NAME "iucv_trace" 50#define IUCV_DBF_TRACE_NAME "iucv_trace"
51#define IUCV_DBF_TRACE_LEN 16 51#define IUCV_DBF_TRACE_LEN 16
52#define IUCV_DBF_TRACE_INDEX 2 52#define IUCV_DBF_TRACE_PAGES 4
53#define IUCV_DBF_TRACE_NR_AREAS 1 53#define IUCV_DBF_TRACE_NR_AREAS 1
54#define IUCV_DBF_TRACE_LEVEL 3 54#define IUCV_DBF_TRACE_LEVEL 3
55 55
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index ab086242d305..46f34ba93ac5 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -11,7 +11,7 @@
11 * Frank Pavlic (pavlic@de.ibm.com) and 11 * Frank Pavlic (pavlic@de.ibm.com) and
12 * Martin Schwidefsky <schwidefsky@de.ibm.com> 12 * Martin Schwidefsky <schwidefsky@de.ibm.com>
13 * 13 *
14 * $Revision: 1.98 $ $Date: 2005/04/18 13:41:29 $ 14 * $Revision: 1.99 $ $Date: 2005/05/11 08:10:17 $
15 * 15 *
16 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@
59/** 59/**
60 * initialization string for output 60 * initialization string for output
61 */ 61 */
62#define VERSION_LCS_C "$Revision: 1.98 $" 62#define VERSION_LCS_C "$Revision: 1.99 $"
63 63
64static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")"; 64static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")";
65static char debug_buffer[255]; 65static char debug_buffer[255];
@@ -93,8 +93,8 @@ lcs_unregister_debug_facility(void)
93static int 93static int
94lcs_register_debug_facility(void) 94lcs_register_debug_facility(void)
95{ 95{
96 lcs_dbf_setup = debug_register("lcs_setup", 1, 1, 8); 96 lcs_dbf_setup = debug_register("lcs_setup", 2, 1, 8);
97 lcs_dbf_trace = debug_register("lcs_trace", 1, 2, 8); 97 lcs_dbf_trace = debug_register("lcs_trace", 2, 2, 8);
98 if (lcs_dbf_setup == NULL || lcs_dbf_trace == NULL) { 98 if (lcs_dbf_setup == NULL || lcs_dbf_trace == NULL) {
99 PRINT_ERR("Not enough memory for debug facility.\n"); 99 PRINT_ERR("Not enough memory for debug facility.\n");
100 lcs_unregister_debug_facility(); 100 lcs_unregister_debug_facility();
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 3fd4fb754b2d..69425a7a6e98 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: netiucv.c,v 1.63 2004/07/27 13:36:05 mschwide Exp $ 2 * $Id: netiucv.c,v 1.66 2005/05/11 08:10:17 holzheu Exp $
3 * 3 *
4 * IUCV network driver 4 * IUCV network driver
5 * 5 *
@@ -30,7 +30,7 @@
30 * along with this program; if not, write to the Free Software 30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 * 32 *
33 * RELEASE-TAG: IUCV network driver $Revision: 1.63 $ 33 * RELEASE-TAG: IUCV network driver $Revision: 1.66 $
34 * 34 *
35 */ 35 */
36 36
@@ -391,15 +391,15 @@ static int
391iucv_register_dbf_views(void) 391iucv_register_dbf_views(void)
392{ 392{
393 iucv_dbf_setup = debug_register(IUCV_DBF_SETUP_NAME, 393 iucv_dbf_setup = debug_register(IUCV_DBF_SETUP_NAME,
394 IUCV_DBF_SETUP_INDEX, 394 IUCV_DBF_SETUP_PAGES,
395 IUCV_DBF_SETUP_NR_AREAS, 395 IUCV_DBF_SETUP_NR_AREAS,
396 IUCV_DBF_SETUP_LEN); 396 IUCV_DBF_SETUP_LEN);
397 iucv_dbf_data = debug_register(IUCV_DBF_DATA_NAME, 397 iucv_dbf_data = debug_register(IUCV_DBF_DATA_NAME,
398 IUCV_DBF_DATA_INDEX, 398 IUCV_DBF_DATA_PAGES,
399 IUCV_DBF_DATA_NR_AREAS, 399 IUCV_DBF_DATA_NR_AREAS,
400 IUCV_DBF_DATA_LEN); 400 IUCV_DBF_DATA_LEN);
401 iucv_dbf_trace = debug_register(IUCV_DBF_TRACE_NAME, 401 iucv_dbf_trace = debug_register(IUCV_DBF_TRACE_NAME,
402 IUCV_DBF_TRACE_INDEX, 402 IUCV_DBF_TRACE_PAGES,
403 IUCV_DBF_TRACE_NR_AREAS, 403 IUCV_DBF_TRACE_NR_AREAS,
404 IUCV_DBF_TRACE_LEN); 404 IUCV_DBF_TRACE_LEN);
405 405
@@ -2076,7 +2076,7 @@ DRIVER_ATTR(remove, 0200, NULL, remove_write);
2076static void 2076static void
2077netiucv_banner(void) 2077netiucv_banner(void)
2078{ 2078{
2079 char vbuf[] = "$Revision: 1.63 $"; 2079 char vbuf[] = "$Revision: 1.66 $";
2080 char *version = vbuf; 2080 char *version = vbuf;
2081 2081
2082 if ((version = strchr(version, ':'))) { 2082 if ((version = strchr(version, ':'))) {
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index a755b57db46b..008e0a5d2eb3 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -42,44 +42,44 @@
42 */ 42 */
43#define QETH_DBF_SETUP_NAME "qeth_setup" 43#define QETH_DBF_SETUP_NAME "qeth_setup"
44#define QETH_DBF_SETUP_LEN 8 44#define QETH_DBF_SETUP_LEN 8
45#define QETH_DBF_SETUP_INDEX 3 45#define QETH_DBF_SETUP_PAGES 8
46#define QETH_DBF_SETUP_NR_AREAS 1 46#define QETH_DBF_SETUP_NR_AREAS 1
47#define QETH_DBF_SETUP_LEVEL 5 47#define QETH_DBF_SETUP_LEVEL 5
48 48
49#define QETH_DBF_MISC_NAME "qeth_misc" 49#define QETH_DBF_MISC_NAME "qeth_misc"
50#define QETH_DBF_MISC_LEN 128 50#define QETH_DBF_MISC_LEN 128
51#define QETH_DBF_MISC_INDEX 1 51#define QETH_DBF_MISC_PAGES 2
52#define QETH_DBF_MISC_NR_AREAS 1 52#define QETH_DBF_MISC_NR_AREAS 1
53#define QETH_DBF_MISC_LEVEL 2 53#define QETH_DBF_MISC_LEVEL 2
54 54
55#define QETH_DBF_DATA_NAME "qeth_data" 55#define QETH_DBF_DATA_NAME "qeth_data"
56#define QETH_DBF_DATA_LEN 96 56#define QETH_DBF_DATA_LEN 96
57#define QETH_DBF_DATA_INDEX 3 57#define QETH_DBF_DATA_PAGES 8
58#define QETH_DBF_DATA_NR_AREAS 1 58#define QETH_DBF_DATA_NR_AREAS 1
59#define QETH_DBF_DATA_LEVEL 2 59#define QETH_DBF_DATA_LEVEL 2
60 60
61#define QETH_DBF_CONTROL_NAME "qeth_control" 61#define QETH_DBF_CONTROL_NAME "qeth_control"
62#define QETH_DBF_CONTROL_LEN 256 62#define QETH_DBF_CONTROL_LEN 256
63#define QETH_DBF_CONTROL_INDEX 3 63#define QETH_DBF_CONTROL_PAGES 8
64#define QETH_DBF_CONTROL_NR_AREAS 2 64#define QETH_DBF_CONTROL_NR_AREAS 2
65#define QETH_DBF_CONTROL_LEVEL 5 65#define QETH_DBF_CONTROL_LEVEL 5
66 66
67#define QETH_DBF_TRACE_NAME "qeth_trace" 67#define QETH_DBF_TRACE_NAME "qeth_trace"
68#define QETH_DBF_TRACE_LEN 8 68#define QETH_DBF_TRACE_LEN 8
69#define QETH_DBF_TRACE_INDEX 2 69#define QETH_DBF_TRACE_PAGES 4
70#define QETH_DBF_TRACE_NR_AREAS 2 70#define QETH_DBF_TRACE_NR_AREAS 2
71#define QETH_DBF_TRACE_LEVEL 3 71#define QETH_DBF_TRACE_LEVEL 3
72extern debug_info_t *qeth_dbf_trace; 72extern debug_info_t *qeth_dbf_trace;
73 73
74#define QETH_DBF_SENSE_NAME "qeth_sense" 74#define QETH_DBF_SENSE_NAME "qeth_sense"
75#define QETH_DBF_SENSE_LEN 64 75#define QETH_DBF_SENSE_LEN 64
76#define QETH_DBF_SENSE_INDEX 1 76#define QETH_DBF_SENSE_PAGES 2
77#define QETH_DBF_SENSE_NR_AREAS 1 77#define QETH_DBF_SENSE_NR_AREAS 1
78#define QETH_DBF_SENSE_LEVEL 2 78#define QETH_DBF_SENSE_LEVEL 2
79 79
80#define QETH_DBF_QERR_NAME "qeth_qerr" 80#define QETH_DBF_QERR_NAME "qeth_qerr"
81#define QETH_DBF_QERR_LEN 8 81#define QETH_DBF_QERR_LEN 8
82#define QETH_DBF_QERR_INDEX 1 82#define QETH_DBF_QERR_PAGES 2
83#define QETH_DBF_QERR_NR_AREAS 2 83#define QETH_DBF_QERR_NR_AREAS 2
84#define QETH_DBF_QERR_LEVEL 2 84#define QETH_DBF_QERR_LEVEL 2
85 85
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 208127a5033a..3cb88c770037 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -7639,31 +7639,31 @@ static int
7639qeth_register_dbf_views(void) 7639qeth_register_dbf_views(void)
7640{ 7640{
7641 qeth_dbf_setup = debug_register(QETH_DBF_SETUP_NAME, 7641 qeth_dbf_setup = debug_register(QETH_DBF_SETUP_NAME,
7642 QETH_DBF_SETUP_INDEX, 7642 QETH_DBF_SETUP_PAGES,
7643 QETH_DBF_SETUP_NR_AREAS, 7643 QETH_DBF_SETUP_NR_AREAS,
7644 QETH_DBF_SETUP_LEN); 7644 QETH_DBF_SETUP_LEN);
7645 qeth_dbf_misc = debug_register(QETH_DBF_MISC_NAME, 7645 qeth_dbf_misc = debug_register(QETH_DBF_MISC_NAME,
7646 QETH_DBF_MISC_INDEX, 7646 QETH_DBF_MISC_PAGES,
7647 QETH_DBF_MISC_NR_AREAS, 7647 QETH_DBF_MISC_NR_AREAS,
7648 QETH_DBF_MISC_LEN); 7648 QETH_DBF_MISC_LEN);
7649 qeth_dbf_data = debug_register(QETH_DBF_DATA_NAME, 7649 qeth_dbf_data = debug_register(QETH_DBF_DATA_NAME,
7650 QETH_DBF_DATA_INDEX, 7650 QETH_DBF_DATA_PAGES,
7651 QETH_DBF_DATA_NR_AREAS, 7651 QETH_DBF_DATA_NR_AREAS,
7652 QETH_DBF_DATA_LEN); 7652 QETH_DBF_DATA_LEN);
7653 qeth_dbf_control = debug_register(QETH_DBF_CONTROL_NAME, 7653 qeth_dbf_control = debug_register(QETH_DBF_CONTROL_NAME,
7654 QETH_DBF_CONTROL_INDEX, 7654 QETH_DBF_CONTROL_PAGES,
7655 QETH_DBF_CONTROL_NR_AREAS, 7655 QETH_DBF_CONTROL_NR_AREAS,
7656 QETH_DBF_CONTROL_LEN); 7656 QETH_DBF_CONTROL_LEN);
7657 qeth_dbf_sense = debug_register(QETH_DBF_SENSE_NAME, 7657 qeth_dbf_sense = debug_register(QETH_DBF_SENSE_NAME,
7658 QETH_DBF_SENSE_INDEX, 7658 QETH_DBF_SENSE_PAGES,
7659 QETH_DBF_SENSE_NR_AREAS, 7659 QETH_DBF_SENSE_NR_AREAS,
7660 QETH_DBF_SENSE_LEN); 7660 QETH_DBF_SENSE_LEN);
7661 qeth_dbf_qerr = debug_register(QETH_DBF_QERR_NAME, 7661 qeth_dbf_qerr = debug_register(QETH_DBF_QERR_NAME,
7662 QETH_DBF_QERR_INDEX, 7662 QETH_DBF_QERR_PAGES,
7663 QETH_DBF_QERR_NR_AREAS, 7663 QETH_DBF_QERR_NR_AREAS,
7664 QETH_DBF_QERR_LEN); 7664 QETH_DBF_QERR_LEN);
7665 qeth_dbf_trace = debug_register(QETH_DBF_TRACE_NAME, 7665 qeth_dbf_trace = debug_register(QETH_DBF_TRACE_NAME,
7666 QETH_DBF_TRACE_INDEX, 7666 QETH_DBF_TRACE_PAGES,
7667 QETH_DBF_TRACE_NR_AREAS, 7667 QETH_DBF_TRACE_NR_AREAS,
7668 QETH_DBF_TRACE_LEN); 7668 QETH_DBF_TRACE_LEN);
7669 7669
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c
index 1e3f7f3c662f..d6469baa7e16 100644
--- a/drivers/s390/net/smsgiucv.c
+++ b/drivers/s390/net/smsgiucv.c
@@ -138,7 +138,7 @@ static void __exit
138smsg_exit(void) 138smsg_exit(void)
139{ 139{
140 if (smsg_handle > 0) { 140 if (smsg_handle > 0) {
141 cpcmd("SET SMSG OFF", 0, 0); 141 cpcmd("SET SMSG OFF", NULL, 0, NULL);
142 iucv_sever(smsg_pathid, 0); 142 iucv_sever(smsg_pathid, 0);
143 iucv_unregister_program(smsg_handle); 143 iucv_unregister_program(smsg_handle);
144 driver_unregister(&smsg_driver); 144 driver_unregister(&smsg_driver);
@@ -177,7 +177,7 @@ smsg_init(void)
177 smsg_handle = 0; 177 smsg_handle = 0;
178 return -EIO; 178 return -EIO;
179 } 179 }
180 cpcmd("SET SMSG IUCV", 0, 0); 180 cpcmd("SET SMSG IUCV", NULL, 0, NULL);
181 return 0; 181 return 0;
182} 182}
183 183
diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c
index ffa996c8a908..5bb255e02acc 100644
--- a/drivers/s390/s390mach.c
+++ b/drivers/s390/s390mach.c
@@ -31,14 +31,14 @@ extern void css_reiterate_subchannels(void);
31extern struct workqueue_struct *slow_path_wq; 31extern struct workqueue_struct *slow_path_wq;
32extern struct work_struct slow_path_work; 32extern struct work_struct slow_path_work;
33 33
34static void 34static NORET_TYPE void
35s390_handle_damage(char *msg) 35s390_handle_damage(char *msg)
36{ 36{
37 printk(KERN_EMERG "%s\n", msg);
38#ifdef CONFIG_SMP 37#ifdef CONFIG_SMP
39 smp_send_stop(); 38 smp_send_stop();
40#endif 39#endif
41 disabled_wait((unsigned long) __builtin_return_address(0)); 40 disabled_wait((unsigned long) __builtin_return_address(0));
41 for(;;);
42} 42}
43 43
44/* 44/*
@@ -122,40 +122,39 @@ repeat:
122 return 0; 122 return 0;
123} 123}
124 124
125struct mcck_struct {
126 int kill_task;
127 int channel_report;
128 int warning;
129 unsigned long long mcck_code;
130};
131
132static DEFINE_PER_CPU(struct mcck_struct, cpu_mcck);
133
125/* 134/*
126 * machine check handler. 135 * Main machine check handler function. Will be called with interrupts enabled
136 * or disabled and machine checks enabled or disabled.
127 */ 137 */
128void 138void
129s390_do_machine_check(void) 139s390_handle_mcck(void)
130{ 140{
131 struct mci *mci; 141 unsigned long flags;
132 142 struct mcck_struct mcck;
133 mci = (struct mci *) &S390_lowcore.mcck_interruption_code;
134 143
135 if (mci->sd) /* system damage */ 144 /*
136 s390_handle_damage("received system damage machine check\n"); 145 * Disable machine checks and get the current state of accumulated
146 * machine checks. Afterwards delete the old state and enable machine
147 * checks again.
148 */
149 local_irq_save(flags);
150 local_mcck_disable();
151 mcck = __get_cpu_var(cpu_mcck);
152 memset(&__get_cpu_var(cpu_mcck), 0, sizeof(struct mcck_struct));
153 clear_thread_flag(TIF_MCCK_PENDING);
154 local_mcck_enable();
155 local_irq_restore(flags);
137 156
138 if (mci->pd) /* instruction processing damage */ 157 if (mcck.channel_report)
139 s390_handle_damage("received instruction processing "
140 "damage machine check\n");
141
142 if (mci->se) /* storage error uncorrected */
143 s390_handle_damage("received storage error uncorrected "
144 "machine check\n");
145
146 if (mci->sc) /* storage error corrected */
147 printk(KERN_WARNING
148 "received storage error corrected machine check\n");
149
150 if (mci->ke) /* storage key-error uncorrected */
151 s390_handle_damage("received storage key-error uncorrected "
152 "machine check\n");
153
154 if (mci->ds && mci->fa) /* storage degradation */
155 s390_handle_damage("received storage degradation machine "
156 "check\n");
157
158 if (mci->cp) /* channel report word pending */
159 up(&m_sem); 158 up(&m_sem);
160 159
161#ifdef CONFIG_MACHCHK_WARNING 160#ifdef CONFIG_MACHCHK_WARNING
@@ -168,7 +167,7 @@ s390_do_machine_check(void)
168 * On VM we only get one interrupt per virtally presented machinecheck. 167 * On VM we only get one interrupt per virtally presented machinecheck.
169 * Though one suffices, we may get one interrupt per (virtual) processor. 168 * Though one suffices, we may get one interrupt per (virtual) processor.
170 */ 169 */
171 if (mci->w) { /* WARNING pending ? */ 170 if (mcck.warning) { /* WARNING pending ? */
172 static int mchchk_wng_posted = 0; 171 static int mchchk_wng_posted = 0;
173 /* 172 /*
174 * Use single machine clear, as we cannot handle smp right now 173 * Use single machine clear, as we cannot handle smp right now
@@ -178,6 +177,261 @@ s390_do_machine_check(void)
178 kill_proc(1, SIGPWR, 1); 177 kill_proc(1, SIGPWR, 1);
179 } 178 }
180#endif 179#endif
180
181 if (mcck.kill_task) {
182 local_irq_enable();
183 printk(KERN_EMERG "mcck: Terminating task because of machine "
184 "malfunction (code 0x%016llx).\n", mcck.mcck_code);
185 printk(KERN_EMERG "mcck: task: %s, pid: %d.\n",
186 current->comm, current->pid);
187 do_exit(SIGSEGV);
188 }
189}
190
191/*
192 * returns 0 if all registers could be validated
193 * returns 1 otherwise
194 */
195static int
196s390_revalidate_registers(struct mci *mci)
197{
198 int kill_task;
199 u64 tmpclock;
200 u64 zero;
201 void *fpt_save_area, *fpt_creg_save_area;
202
203 kill_task = 0;
204 zero = 0;
205 /* General purpose registers */
206 if (!mci->gr)
207 /*
208 * General purpose registers couldn't be restored and have
209 * unknown contents. Process needs to be terminated.
210 */
211 kill_task = 1;
212
213 /* Revalidate floating point registers */
214 if (!mci->fp)
215 /*
216 * Floating point registers can't be restored and
217 * therefore the process needs to be terminated.
218 */
219 kill_task = 1;
220
221#ifndef __s390x__
222 asm volatile("ld 0,0(%0)\n"
223 "ld 2,8(%0)\n"
224 "ld 4,16(%0)\n"
225 "ld 6,24(%0)"
226 : : "a" (&S390_lowcore.floating_pt_save_area));
227#endif
228
229 if (MACHINE_HAS_IEEE) {
230#ifdef __s390x__
231 fpt_save_area = &S390_lowcore.floating_pt_save_area;
232 fpt_creg_save_area = &S390_lowcore.fpt_creg_save_area;
233#else
234 fpt_save_area = (void *) S390_lowcore.extended_save_area_addr;
235 fpt_creg_save_area = fpt_save_area+128;
236#endif
237 /* Floating point control register */
238 if (!mci->fc) {
239 /*
240 * Floating point control register can't be restored.
241 * Task will be terminated.
242 */
243 asm volatile ("lfpc 0(%0)" : : "a" (&zero));
244 kill_task = 1;
245
246 }
247 else
248 asm volatile (
249 "lfpc 0(%0)"
250 : : "a" (fpt_creg_save_area));
251
252 asm volatile("ld 0,0(%0)\n"
253 "ld 1,8(%0)\n"
254 "ld 2,16(%0)\n"
255 "ld 3,24(%0)\n"
256 "ld 4,32(%0)\n"
257 "ld 5,40(%0)\n"
258 "ld 6,48(%0)\n"
259 "ld 7,56(%0)\n"
260 "ld 8,64(%0)\n"
261 "ld 9,72(%0)\n"
262 "ld 10,80(%0)\n"
263 "ld 11,88(%0)\n"
264 "ld 12,96(%0)\n"
265 "ld 13,104(%0)\n"
266 "ld 14,112(%0)\n"
267 "ld 15,120(%0)\n"
268 : : "a" (fpt_save_area));
269 }
270
271 /* Revalidate access registers */
272 asm volatile("lam 0,15,0(%0)"
273 : : "a" (&S390_lowcore.access_regs_save_area));
274 if (!mci->ar)
275 /*
276 * Access registers have unknown contents.
277 * Terminating task.
278 */
279 kill_task = 1;
280
281 /* Revalidate control registers */
282 if (!mci->cr)
283 /*
284 * Control registers have unknown contents.
285 * Can't recover and therefore stopping machine.
286 */
287 s390_handle_damage("invalid control registers.");
288 else
289#ifdef __s390x__
290 asm volatile("lctlg 0,15,0(%0)"
291 : : "a" (&S390_lowcore.cregs_save_area));
292#else
293 asm volatile("lctl 0,15,0(%0)"
294 : : "a" (&S390_lowcore.cregs_save_area));
295#endif
296
297 /*
298 * We don't even try to revalidate the TOD register, since we simply
299 * can't write something sensible into that register.
300 */
301
302#ifdef __s390x__
303 /*
304 * See if we can revalidate the TOD programmable register with its
305 * old contents (should be zero) otherwise set it to zero.
306 */
307 if (!mci->pr)
308 asm volatile("sr 0,0\n"
309 "sckpf"
310 : : : "0", "cc");
311 else
312 asm volatile(
313 "l 0,0(%0)\n"
314 "sckpf"
315 : : "a" (&S390_lowcore.tod_progreg_save_area) : "0", "cc");
316#endif
317
318 /* Revalidate clock comparator register */
319 asm volatile ("stck 0(%1)\n"
320 "sckc 0(%1)"
321 : "=m" (tmpclock) : "a" (&(tmpclock)) : "cc", "memory");
322
323 /* Check if old PSW is valid */
324 if (!mci->wp)
325 /*
326 * Can't tell if we come from user or kernel mode
327 * -> stopping machine.
328 */
329 s390_handle_damage("old psw invalid.");
330
331 if (!mci->ms || !mci->pm || !mci->ia)
332 kill_task = 1;
333
334 return kill_task;
335}
336
337/*
338 * machine check handler.
339 */
340void
341s390_do_machine_check(struct pt_regs *regs)
342{
343 struct mci *mci;
344 struct mcck_struct *mcck;
345 int umode;
346
347 mci = (struct mci *) &S390_lowcore.mcck_interruption_code;
348 mcck = &__get_cpu_var(cpu_mcck);
349 umode = user_mode(regs);
350
351 if (mci->sd)
352 /* System damage -> stopping machine */
353 s390_handle_damage("received system damage machine check.");
354
355 if (mci->pd) {
356 if (mci->b) {
357 /* Processing backup -> verify if we can survive this */
358 u64 z_mcic, o_mcic, t_mcic;
359#ifdef __s390x__
360 z_mcic = (1ULL<<63 | 1ULL<<59 | 1ULL<<29);
361 o_mcic = (1ULL<<43 | 1ULL<<42 | 1ULL<<41 | 1ULL<<40 |
362 1ULL<<36 | 1ULL<<35 | 1ULL<<34 | 1ULL<<32 |
363 1ULL<<30 | 1ULL<<21 | 1ULL<<20 | 1ULL<<17 |
364 1ULL<<16);
365#else
366 z_mcic = (1ULL<<63 | 1ULL<<59 | 1ULL<<57 | 1ULL<<50 |
367 1ULL<<29);
368 o_mcic = (1ULL<<43 | 1ULL<<42 | 1ULL<<41 | 1ULL<<40 |
369 1ULL<<36 | 1ULL<<35 | 1ULL<<34 | 1ULL<<32 |
370 1ULL<<30 | 1ULL<<20 | 1ULL<<17 | 1ULL<<16);
371#endif
372 t_mcic = *(u64 *)mci;
373
374 if (((t_mcic & z_mcic) != 0) ||
375 ((t_mcic & o_mcic) != o_mcic)) {
376 s390_handle_damage("processing backup machine "
377 "check with damage.");
378 }
379 if (!umode)
380 s390_handle_damage("processing backup machine "
381 "check in kernel mode.");
382 mcck->kill_task = 1;
383 mcck->mcck_code = *(unsigned long long *) mci;
384 }
385 else {
386 /* Processing damage -> stopping machine */
387 s390_handle_damage("received instruction processing "
388 "damage machine check.");
389 }
390 }
391 if (s390_revalidate_registers(mci)) {
392 if (umode) {
393 /*
394 * Couldn't restore all register contents while in
395 * user mode -> mark task for termination.
396 */
397 mcck->kill_task = 1;
398 mcck->mcck_code = *(unsigned long long *) mci;
399 set_thread_flag(TIF_MCCK_PENDING);
400 }
401 else
402 /*
403 * Couldn't restore all register contents while in
404 * kernel mode -> stopping machine.
405 */
406 s390_handle_damage("unable to revalidate registers.");
407 }
408
409 if (mci->se)
410 /* Storage error uncorrected */
411 s390_handle_damage("received storage error uncorrected "
412 "machine check.");
413
414 if (mci->ke)
415 /* Storage key-error uncorrected */
416 s390_handle_damage("received storage key-error uncorrected "
417 "machine check.");
418
419 if (mci->ds && mci->fa)
420 /* Storage degradation */
421 s390_handle_damage("received storage degradation machine "
422 "check.");
423
424 if (mci->cp) {
425 /* Channel report word pending */
426 mcck->channel_report = 1;
427 set_thread_flag(TIF_MCCK_PENDING);
428 }
429
430 if (mci->w) {
431 /* Warning pending */
432 mcck->warning = 1;
433 set_thread_flag(TIF_MCCK_PENDING);
434 }
181} 435}
182 436
183/* 437/*
@@ -189,9 +443,8 @@ static int
189machine_check_init(void) 443machine_check_init(void)
190{ 444{
191 init_MUTEX_LOCKED(&m_sem); 445 init_MUTEX_LOCKED(&m_sem);
192 ctl_clear_bit(14, 25); /* disable damage MCH */ 446 ctl_clear_bit(14, 25); /* disable external damage MCH */
193 ctl_set_bit(14, 26); /* enable degradation MCH */ 447 ctl_set_bit(14, 27); /* enable system recovery MCH */
194 ctl_set_bit(14, 27); /* enable system recovery MCH */
195#ifdef CONFIG_MACHCHK_WARNING 448#ifdef CONFIG_MACHCHK_WARNING
196 ctl_set_bit(14, 24); /* enable warning MCH */ 449 ctl_set_bit(14, 24); /* enable warning MCH */
197#endif 450#endif
diff --git a/drivers/s390/s390mach.h b/drivers/s390/s390mach.h
index 7e26f0f1b0dc..4eaa70179182 100644
--- a/drivers/s390/s390mach.h
+++ b/drivers/s390/s390mach.h
@@ -16,20 +16,45 @@ struct mci {
16 __u32 sd : 1; /* 00 system damage */ 16 __u32 sd : 1; /* 00 system damage */
17 __u32 pd : 1; /* 01 instruction-processing damage */ 17 __u32 pd : 1; /* 01 instruction-processing damage */
18 __u32 sr : 1; /* 02 system recovery */ 18 __u32 sr : 1; /* 02 system recovery */
19 __u32 to_be_defined_1 : 4; /* 03-06 */ 19 __u32 to_be_defined_1 : 1; /* 03 */
20 __u32 cd : 1; /* 04 timing-facility damage */
21 __u32 ed : 1; /* 05 external damage */
22 __u32 to_be_defined_2 : 1; /* 06 */
20 __u32 dg : 1; /* 07 degradation */ 23 __u32 dg : 1; /* 07 degradation */
21 __u32 w : 1; /* 08 warning pending */ 24 __u32 w : 1; /* 08 warning pending */
22 __u32 cp : 1; /* 09 channel-report pending */ 25 __u32 cp : 1; /* 09 channel-report pending */
23 __u32 to_be_defined_2 : 6; /* 10-15 */ 26 __u32 sp : 1; /* 10 service-processor damage */
27 __u32 ck : 1; /* 11 channel-subsystem damage */
28 __u32 to_be_defined_3 : 2; /* 12-13 */
29 __u32 b : 1; /* 14 backed up */
30 __u32 to_be_defined_4 : 1; /* 15 */
24 __u32 se : 1; /* 16 storage error uncorrected */ 31 __u32 se : 1; /* 16 storage error uncorrected */
25 __u32 sc : 1; /* 17 storage error corrected */ 32 __u32 sc : 1; /* 17 storage error corrected */
26 __u32 ke : 1; /* 18 storage-key error uncorrected */ 33 __u32 ke : 1; /* 18 storage-key error uncorrected */
27 __u32 ds : 1; /* 19 storage degradation */ 34 __u32 ds : 1; /* 19 storage degradation */
28 __u32 to_be_defined_3 : 4; /* 20-23 */ 35 __u32 wp : 1; /* 20 psw mwp validity */
36 __u32 ms : 1; /* 21 psw mask and key validity */
37 __u32 pm : 1; /* 22 psw program mask and cc validity */
38 __u32 ia : 1; /* 23 psw instruction address validity */
29 __u32 fa : 1; /* 24 failing storage address validity */ 39 __u32 fa : 1; /* 24 failing storage address validity */
30 __u32 to_be_defined_4 : 7; /* 25-31 */ 40 __u32 to_be_defined_5 : 1; /* 25 */
41 __u32 ec : 1; /* 26 external damage code validity */
42 __u32 fp : 1; /* 27 floating point register validity */
43 __u32 gr : 1; /* 28 general register validity */
44 __u32 cr : 1; /* 29 control register validity */
45 __u32 to_be_defined_6 : 1; /* 30 */
46 __u32 st : 1; /* 31 storage logical validity */
31 __u32 ie : 1; /* 32 indirect storage error */ 47 __u32 ie : 1; /* 32 indirect storage error */
32 __u32 to_be_defined_5 : 31; /* 33-63 */ 48 __u32 ar : 1; /* 33 access register validity */
49 __u32 da : 1; /* 34 delayed access exception */
50 __u32 to_be_defined_7 : 7; /* 35-41 */
51 __u32 pr : 1; /* 42 tod programmable register validity */
52 __u32 fc : 1; /* 43 fp control register validity */
53 __u32 ap : 1; /* 44 ancillary report */
54 __u32 to_be_defined_8 : 1; /* 45 */
55 __u32 ct : 1; /* 46 cpu timer validity */
56 __u32 cc : 1; /* 47 clock comparator validity */
57 __u32 to_be_defined_9 : 16; /* 47-63 */
33}; 58};
34 59
35/* 60/*
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index a699c30b2662..bbe346bd3cb8 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -34,7 +34,6 @@
34 34
35#define ADDR32 (0) 35#define ADDR32 (0)
36 36
37#include <linux/version.h>
38#include <linux/module.h> 37#include <linux/module.h>
39 38
40MODULE_AUTHOR("Deanna Bonds, with _lots_ of help from Mark Salyzyn"); 39MODULE_AUTHOR("Deanna Bonds, with _lots_ of help from Mark Salyzyn");
@@ -1811,9 +1810,9 @@ static int adpt_system_info(void __user *buffer)
1811 memset(&si, 0, sizeof(si)); 1810 memset(&si, 0, sizeof(si));
1812 1811
1813 si.osType = OS_LINUX; 1812 si.osType = OS_LINUX;
1814 si.osMajorVersion = (u8) (LINUX_VERSION_CODE >> 16); 1813 si.osMajorVersion = 0;
1815 si.osMinorVersion = (u8) (LINUX_VERSION_CODE >> 8 & 0x0ff); 1814 si.osMinorVersion = 0;
1816 si.osRevision = (u8) (LINUX_VERSION_CODE & 0x0ff); 1815 si.osRevision = 0;
1817 si.busType = SI_PCI_BUS; 1816 si.busType = SI_PCI_BUS;
1818 si.processorFamily = DPTI_sig.dsProcessorFamily; 1817 si.processorFamily = DPTI_sig.dsProcessorFamily;
1819 1818
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index 9821783c0164..489194af43d0 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -20,15 +20,7 @@
20#ifndef _DPT_H 20#ifndef _DPT_H
21#define _DPT_H 21#define _DPT_H
22 22
23#ifndef LINUX_VERSION_CODE
24#include <linux/version.h>
25#endif
26
27#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,00)
28#define MAX_TO_IOP_MESSAGES (210)
29#else
30#define MAX_TO_IOP_MESSAGES (255) 23#define MAX_TO_IOP_MESSAGES (255)
31#endif
32#define MAX_FROM_IOP_MESSAGES (255) 24#define MAX_FROM_IOP_MESSAGES (255)
33 25
34 26
@@ -321,10 +313,6 @@ static int adpt_close(struct inode *inode, struct file *file);
321static void adpt_delay(int millisec); 313static void adpt_delay(int millisec);
322#endif 314#endif
323 315
324#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
325static struct pci_dev* adpt_pci_find_device(uint vendor, struct pci_dev* from);
326#endif
327
328#if defined __ia64__ 316#if defined __ia64__
329static void adpt_ia64_info(sysInfo_S* si); 317static void adpt_ia64_info(sysInfo_S* si);
330#endif 318#endif
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index f7ddc9f1ba41..2094d4811d61 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -223,7 +223,7 @@ static void tul_select_atn(HCS * pCurHcb, SCB * pCurScb);
223static void tul_select_atn3(HCS * pCurHcb, SCB * pCurScb); 223static void tul_select_atn3(HCS * pCurHcb, SCB * pCurScb);
224static void tul_select_atn_stop(HCS * pCurHcb, SCB * pCurScb); 224static void tul_select_atn_stop(HCS * pCurHcb, SCB * pCurScb);
225static int int_tul_busfree(HCS * pCurHcb); 225static int int_tul_busfree(HCS * pCurHcb);
226int int_tul_scsi_rst(HCS * pCurHcb); 226static int int_tul_scsi_rst(HCS * pCurHcb);
227static int int_tul_bad_seq(HCS * pCurHcb); 227static int int_tul_bad_seq(HCS * pCurHcb);
228static int int_tul_resel(HCS * pCurHcb); 228static int int_tul_resel(HCS * pCurHcb);
229static int tul_sync_done(HCS * pCurHcb); 229static int tul_sync_done(HCS * pCurHcb);
@@ -240,9 +240,8 @@ static int tul_se2_rd_all(WORD CurBase);
240static void tul_se2_update_all(WORD CurBase); /* setup default pattern */ 240static void tul_se2_update_all(WORD CurBase); /* setup default pattern */
241static void tul_read_eeprom(WORD CurBase); 241static void tul_read_eeprom(WORD CurBase);
242 242
243 /* ---- EXTERNAL VARIABLES ---- */
244HCS tul_hcs[MAX_SUPPORTED_ADAPTERS];
245 /* ---- INTERNAL VARIABLES ---- */ 243 /* ---- INTERNAL VARIABLES ---- */
244static HCS tul_hcs[MAX_SUPPORTED_ADAPTERS];
246static INI_ADPT_STRUCT i91u_adpt[MAX_SUPPORTED_ADAPTERS]; 245static INI_ADPT_STRUCT i91u_adpt[MAX_SUPPORTED_ADAPTERS];
247 246
248/*NVRAM nvram, *nvramp = &nvram; */ 247/*NVRAM nvram, *nvramp = &nvram; */
@@ -381,7 +380,7 @@ void tul_se2_wait(void)
381 380
382 381
383******************************************************************/ 382******************************************************************/
384void tul_se2_instr(WORD CurBase, UCHAR instr) 383static void tul_se2_instr(WORD CurBase, UCHAR instr)
385{ 384{
386 int i; 385 int i;
387 UCHAR b; 386 UCHAR b;
@@ -437,7 +436,7 @@ void tul_se2_ew_ds(WORD CurBase)
437 Input :address of Serial E2PROM 436 Input :address of Serial E2PROM
438 Output :value stored in Serial E2PROM 437 Output :value stored in Serial E2PROM
439*******************************************************************/ 438*******************************************************************/
440USHORT tul_se2_rd(WORD CurBase, ULONG adr) 439static USHORT tul_se2_rd(WORD CurBase, ULONG adr)
441{ 440{
442 UCHAR instr, readByte; 441 UCHAR instr, readByte;
443 USHORT readWord; 442 USHORT readWord;
@@ -468,7 +467,7 @@ USHORT tul_se2_rd(WORD CurBase, ULONG adr)
468/****************************************************************** 467/******************************************************************
469 Input: new value in Serial E2PROM, address of Serial E2PROM 468 Input: new value in Serial E2PROM, address of Serial E2PROM
470*******************************************************************/ 469*******************************************************************/
471void tul_se2_wr(WORD CurBase, UCHAR adr, USHORT writeWord) 470static void tul_se2_wr(WORD CurBase, UCHAR adr, USHORT writeWord)
472{ 471{
473 UCHAR readByte; 472 UCHAR readByte;
474 UCHAR instr; 473 UCHAR instr;
@@ -584,8 +583,8 @@ void tul_read_eeprom(WORD CurBase)
584 TUL_WR(CurBase + TUL_GCTRL, gctrl & ~TUL_GCTRL_EEPROM_BIT); 583 TUL_WR(CurBase + TUL_GCTRL, gctrl & ~TUL_GCTRL_EEPROM_BIT);
585} /* read_eeprom */ 584} /* read_eeprom */
586 585
587int Addi91u_into_Adapter_table(WORD wBIOS, WORD wBASE, BYTE bInterrupt, 586static int Addi91u_into_Adapter_table(WORD wBIOS, WORD wBASE, BYTE bInterrupt,
588 BYTE bBus, BYTE bDevice) 587 BYTE bBus, BYTE bDevice)
589{ 588{
590 int i, j; 589 int i, j;
591 590
@@ -616,7 +615,7 @@ int Addi91u_into_Adapter_table(WORD wBIOS, WORD wBASE, BYTE bInterrupt,
616 return 1; 615 return 1;
617} 616}
618 617
619void init_i91uAdapter_table(void) 618static void init_i91uAdapter_table(void)
620{ 619{
621 int i; 620 int i;
622 621
@@ -630,7 +629,7 @@ void init_i91uAdapter_table(void)
630 return; 629 return;
631} 630}
632 631
633void tul_stop_bm(HCS * pCurHcb) 632static void tul_stop_bm(HCS * pCurHcb)
634{ 633{
635 634
636 if (TUL_RD(pCurHcb->HCS_Base, TUL_XStatus) & XPEND) { /* if DMA xfer is pending, abort DMA xfer */ 635 if (TUL_RD(pCurHcb->HCS_Base, TUL_XStatus) & XPEND) { /* if DMA xfer is pending, abort DMA xfer */
@@ -642,7 +641,7 @@ void tul_stop_bm(HCS * pCurHcb)
642} 641}
643 642
644/***************************************************************************/ 643/***************************************************************************/
645void get_tulipPCIConfig(HCS * pCurHcb, int ch_idx) 644static void get_tulipPCIConfig(HCS * pCurHcb, int ch_idx)
646{ 645{
647 pCurHcb->HCS_Base = i91u_adpt[ch_idx].ADPT_BASE; /* Supply base address */ 646 pCurHcb->HCS_Base = i91u_adpt[ch_idx].ADPT_BASE; /* Supply base address */
648 pCurHcb->HCS_BIOS = i91u_adpt[ch_idx].ADPT_BIOS; /* Supply BIOS address */ 647 pCurHcb->HCS_BIOS = i91u_adpt[ch_idx].ADPT_BIOS; /* Supply BIOS address */
@@ -651,7 +650,7 @@ void get_tulipPCIConfig(HCS * pCurHcb, int ch_idx)
651} 650}
652 651
653/***************************************************************************/ 652/***************************************************************************/
654int tul_reset_scsi(HCS * pCurHcb, int seconds) 653static int tul_reset_scsi(HCS * pCurHcb, int seconds)
655{ 654{
656 TUL_WR(pCurHcb->HCS_Base + TUL_SCtrl0, TSC_RST_BUS); 655 TUL_WR(pCurHcb->HCS_Base + TUL_SCtrl0, TSC_RST_BUS);
657 656
@@ -670,7 +669,8 @@ int tul_reset_scsi(HCS * pCurHcb, int seconds)
670} 669}
671 670
672/***************************************************************************/ 671/***************************************************************************/
673int init_tulip(HCS * pCurHcb, SCB * scbp, int tul_num_scb, BYTE * pbBiosAdr, int seconds) 672static int init_tulip(HCS * pCurHcb, SCB * scbp, int tul_num_scb,
673 BYTE * pbBiosAdr, int seconds)
674{ 674{
675 int i; 675 int i;
676 BYTE *pwFlags; 676 BYTE *pwFlags;
@@ -788,7 +788,7 @@ int init_tulip(HCS * pCurHcb, SCB * scbp, int tul_num_scb, BYTE * pbBiosAdr, int
788} 788}
789 789
790/***************************************************************************/ 790/***************************************************************************/
791SCB *tul_alloc_scb(HCS * hcsp) 791static SCB *tul_alloc_scb(HCS * hcsp)
792{ 792{
793 SCB *pTmpScb; 793 SCB *pTmpScb;
794 ULONG flags; 794 ULONG flags;
@@ -807,7 +807,7 @@ SCB *tul_alloc_scb(HCS * hcsp)
807} 807}
808 808
809/***************************************************************************/ 809/***************************************************************************/
810void tul_release_scb(HCS * hcsp, SCB * scbp) 810static void tul_release_scb(HCS * hcsp, SCB * scbp)
811{ 811{
812 ULONG flags; 812 ULONG flags;
813 813
@@ -829,7 +829,7 @@ void tul_release_scb(HCS * hcsp, SCB * scbp)
829} 829}
830 830
831/***************************************************************************/ 831/***************************************************************************/
832void tul_append_pend_scb(HCS * pCurHcb, SCB * scbp) 832static void tul_append_pend_scb(HCS * pCurHcb, SCB * scbp)
833{ 833{
834 834
835#if DEBUG_QUEUE 835#if DEBUG_QUEUE
@@ -847,7 +847,7 @@ void tul_append_pend_scb(HCS * pCurHcb, SCB * scbp)
847} 847}
848 848
849/***************************************************************************/ 849/***************************************************************************/
850void tul_push_pend_scb(HCS * pCurHcb, SCB * scbp) 850static void tul_push_pend_scb(HCS * pCurHcb, SCB * scbp)
851{ 851{
852 852
853#if DEBUG_QUEUE 853#if DEBUG_QUEUE
@@ -863,7 +863,7 @@ void tul_push_pend_scb(HCS * pCurHcb, SCB * scbp)
863} 863}
864 864
865/***************************************************************************/ 865/***************************************************************************/
866SCB *tul_find_first_pend_scb(HCS * pCurHcb) 866static SCB *tul_find_first_pend_scb(HCS * pCurHcb)
867{ 867{
868 SCB *pFirstPend; 868 SCB *pFirstPend;
869 869
@@ -894,24 +894,7 @@ SCB *tul_find_first_pend_scb(HCS * pCurHcb)
894 return (pFirstPend); 894 return (pFirstPend);
895} 895}
896/***************************************************************************/ 896/***************************************************************************/
897SCB *tul_pop_pend_scb(HCS * pCurHcb) 897static void tul_unlink_pend_scb(HCS * pCurHcb, SCB * pCurScb)
898{
899 SCB *pTmpScb;
900
901 if ((pTmpScb = pCurHcb->HCS_FirstPend) != NULL) {
902 if ((pCurHcb->HCS_FirstPend = pTmpScb->SCB_NxtScb) == NULL)
903 pCurHcb->HCS_LastPend = NULL;
904 pTmpScb->SCB_NxtScb = NULL;
905 }
906#if DEBUG_QUEUE
907 printk("Pop pend SCB %lx; ", (ULONG) pTmpScb);
908#endif
909 return (pTmpScb);
910}
911
912
913/***************************************************************************/
914void tul_unlink_pend_scb(HCS * pCurHcb, SCB * pCurScb)
915{ 898{
916 SCB *pTmpScb, *pPrevScb; 899 SCB *pTmpScb, *pPrevScb;
917 900
@@ -939,7 +922,7 @@ void tul_unlink_pend_scb(HCS * pCurHcb, SCB * pCurScb)
939 return; 922 return;
940} 923}
941/***************************************************************************/ 924/***************************************************************************/
942void tul_append_busy_scb(HCS * pCurHcb, SCB * scbp) 925static void tul_append_busy_scb(HCS * pCurHcb, SCB * scbp)
943{ 926{
944 927
945#if DEBUG_QUEUE 928#if DEBUG_QUEUE
@@ -961,7 +944,7 @@ void tul_append_busy_scb(HCS * pCurHcb, SCB * scbp)
961} 944}
962 945
963/***************************************************************************/ 946/***************************************************************************/
964SCB *tul_pop_busy_scb(HCS * pCurHcb) 947static SCB *tul_pop_busy_scb(HCS * pCurHcb)
965{ 948{
966 SCB *pTmpScb; 949 SCB *pTmpScb;
967 950
@@ -982,7 +965,7 @@ SCB *tul_pop_busy_scb(HCS * pCurHcb)
982} 965}
983 966
984/***************************************************************************/ 967/***************************************************************************/
985void tul_unlink_busy_scb(HCS * pCurHcb, SCB * pCurScb) 968static void tul_unlink_busy_scb(HCS * pCurHcb, SCB * pCurScb)
986{ 969{
987 SCB *pTmpScb, *pPrevScb; 970 SCB *pTmpScb, *pPrevScb;
988 971
@@ -1037,7 +1020,7 @@ SCB *tul_find_busy_scb(HCS * pCurHcb, WORD tarlun)
1037} 1020}
1038 1021
1039/***************************************************************************/ 1022/***************************************************************************/
1040void tul_append_done_scb(HCS * pCurHcb, SCB * scbp) 1023static void tul_append_done_scb(HCS * pCurHcb, SCB * scbp)
1041{ 1024{
1042 1025
1043#if DEBUG_QUEUE 1026#if DEBUG_QUEUE
@@ -1073,7 +1056,7 @@ SCB *tul_find_done_scb(HCS * pCurHcb)
1073} 1056}
1074 1057
1075/***************************************************************************/ 1058/***************************************************************************/
1076int tul_abort_srb(HCS * pCurHcb, struct scsi_cmnd *srbp) 1059static int tul_abort_srb(HCS * pCurHcb, struct scsi_cmnd *srbp)
1077{ 1060{
1078 ULONG flags; 1061 ULONG flags;
1079 SCB *pTmpScb, *pPrevScb; 1062 SCB *pTmpScb, *pPrevScb;
@@ -1163,7 +1146,7 @@ int tul_abort_srb(HCS * pCurHcb, struct scsi_cmnd *srbp)
1163} 1146}
1164 1147
1165/***************************************************************************/ 1148/***************************************************************************/
1166int tul_bad_seq(HCS * pCurHcb) 1149static int tul_bad_seq(HCS * pCurHcb)
1167{ 1150{
1168 SCB *pCurScb; 1151 SCB *pCurScb;
1169 1152
@@ -1182,9 +1165,11 @@ int tul_bad_seq(HCS * pCurHcb)
1182 return (tul_post_scsi_rst(pCurHcb)); 1165 return (tul_post_scsi_rst(pCurHcb));
1183} 1166}
1184 1167
1168#if 0
1169
1185/************************************************************************/ 1170/************************************************************************/
1186int tul_device_reset(HCS * pCurHcb, struct scsi_cmnd *pSrb, 1171static int tul_device_reset(HCS * pCurHcb, struct scsi_cmnd *pSrb,
1187 unsigned int target, unsigned int ResetFlags) 1172 unsigned int target, unsigned int ResetFlags)
1188{ 1173{
1189 ULONG flags; 1174 ULONG flags;
1190 SCB *pScb; 1175 SCB *pScb;
@@ -1255,7 +1240,7 @@ int tul_device_reset(HCS * pCurHcb, struct scsi_cmnd *pSrb,
1255 return SCSI_RESET_PENDING; 1240 return SCSI_RESET_PENDING;
1256} 1241}
1257 1242
1258int tul_reset_scsi_bus(HCS * pCurHcb) 1243static int tul_reset_scsi_bus(HCS * pCurHcb)
1259{ 1244{
1260 ULONG flags; 1245 ULONG flags;
1261 1246
@@ -1284,8 +1269,10 @@ int tul_reset_scsi_bus(HCS * pCurHcb)
1284 return (SCSI_RESET_SUCCESS | SCSI_RESET_HOST_RESET); 1269 return (SCSI_RESET_SUCCESS | SCSI_RESET_HOST_RESET);
1285} 1270}
1286 1271
1272#endif /* 0 */
1273
1287/************************************************************************/ 1274/************************************************************************/
1288void tul_exec_scb(HCS * pCurHcb, SCB * pCurScb) 1275static void tul_exec_scb(HCS * pCurHcb, SCB * pCurScb)
1289{ 1276{
1290 ULONG flags; 1277 ULONG flags;
1291 1278
@@ -1318,7 +1305,7 @@ void tul_exec_scb(HCS * pCurHcb, SCB * pCurScb)
1318} 1305}
1319 1306
1320/***************************************************************************/ 1307/***************************************************************************/
1321int tul_isr(HCS * pCurHcb) 1308static int tul_isr(HCS * pCurHcb)
1322{ 1309{
1323 /* Enter critical section */ 1310 /* Enter critical section */
1324 1311
@@ -2108,7 +2095,7 @@ int int_tul_busfree(HCS * pCurHcb)
2108 2095
2109/***************************************************************************/ 2096/***************************************************************************/
2110/* scsi bus reset */ 2097/* scsi bus reset */
2111int int_tul_scsi_rst(HCS * pCurHcb) 2098static int int_tul_scsi_rst(HCS * pCurHcb)
2112{ 2099{
2113 SCB *pCurScb; 2100 SCB *pCurScb;
2114 int i; 2101 int i;
@@ -2214,7 +2201,7 @@ int int_tul_resel(HCS * pCurHcb)
2214 2201
2215 2202
2216/***************************************************************************/ 2203/***************************************************************************/
2217int int_tul_bad_seq(HCS * pCurHcb) 2204static int int_tul_bad_seq(HCS * pCurHcb)
2218{ /* target wrong phase */ 2205{ /* target wrong phase */
2219 SCB *pCurScb; 2206 SCB *pCurScb;
2220 int i; 2207 int i;
diff --git a/drivers/scsi/initio.h b/drivers/scsi/initio.h
index df3ed7c1cee3..3efb1184fc39 100644
--- a/drivers/scsi/initio.h
+++ b/drivers/scsi/initio.h
@@ -719,21 +719,3 @@ typedef struct _HCSinfo {
719#define SCSI_RESET_HOST_RESET 0x200 719#define SCSI_RESET_HOST_RESET 0x200
720#define SCSI_RESET_ACTION 0xff 720#define SCSI_RESET_ACTION 0xff
721 721
722extern void init_i91uAdapter_table(void);
723extern int Addi91u_into_Adapter_table(WORD, WORD, BYTE, BYTE, BYTE);
724extern int tul_ReturnNumberOfAdapters(void);
725extern void get_tulipPCIConfig(HCS * pHCB, int iChannel_index);
726extern int init_tulip(HCS * pHCB, SCB * pSCB, int tul_num_scb, BYTE * pbBiosAdr, int reset_time);
727extern SCB *tul_alloc_scb(HCS * pHCB);
728extern int tul_abort_srb(HCS * pHCB, struct scsi_cmnd * pSRB);
729extern void tul_exec_scb(HCS * pHCB, SCB * pSCB);
730extern void tul_release_scb(HCS * pHCB, SCB * pSCB);
731extern void tul_stop_bm(HCS * pHCB);
732extern int tul_reset_scsi(HCS * pCurHcb, int seconds);
733extern int tul_isr(HCS * pHCB);
734extern int tul_reset(HCS * pHCB, struct scsi_cmnd * pSRB, unsigned char target);
735extern int tul_reset_scsi_bus(HCS * pCurHcb);
736extern int tul_device_reset(HCS * pCurHcb, struct scsi_cmnd *pSrb,
737 unsigned int target, unsigned int ResetFlags);
738 /* ---- EXTERNAL VARIABLES ---- */
739extern HCS tul_hcs[];
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index db92a0ceda79..feb8e73fc1c9 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -992,18 +992,17 @@ static int get_lsr_info(struct m68k_serial * info, unsigned int *value)
992/* 992/*
993 * This routine sends a break character out the serial port. 993 * This routine sends a break character out the serial port.
994 */ 994 */
995static void send_break( struct m68k_serial * info, int duration) 995static void send_break(struct m68k_serial * info, unsigned int duration)
996{ 996{
997 m68328_uart *uart = &uart_addr[info->line]; 997 m68328_uart *uart = &uart_addr[info->line];
998 unsigned long flags; 998 unsigned long flags;
999 if (!info->port) 999 if (!info->port)
1000 return; 1000 return;
1001 set_current_state(TASK_INTERRUPTIBLE);
1002 save_flags(flags); 1001 save_flags(flags);
1003 cli(); 1002 cli();
1004#ifdef USE_INTS 1003#ifdef USE_INTS
1005 uart->utx.w |= UTX_SEND_BREAK; 1004 uart->utx.w |= UTX_SEND_BREAK;
1006 schedule_timeout(duration); 1005 msleep_interruptible(duration);
1007 uart->utx.w &= ~UTX_SEND_BREAK; 1006 uart->utx.w &= ~UTX_SEND_BREAK;
1008#endif 1007#endif
1009 restore_flags(flags); 1008 restore_flags(flags);
@@ -1033,14 +1032,14 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
1033 return retval; 1032 return retval;
1034 tty_wait_until_sent(tty, 0); 1033 tty_wait_until_sent(tty, 0);
1035 if (!arg) 1034 if (!arg)
1036 send_break(info, HZ/4); /* 1/4 second */ 1035 send_break(info, 250); /* 1/4 second */
1037 return 0; 1036 return 0;
1038 case TCSBRKP: /* support for POSIX tcsendbreak() */ 1037 case TCSBRKP: /* support for POSIX tcsendbreak() */
1039 retval = tty_check_change(tty); 1038 retval = tty_check_change(tty);
1040 if (retval) 1039 if (retval)
1041 return retval; 1040 return retval;
1042 tty_wait_until_sent(tty, 0); 1041 tty_wait_until_sent(tty, 0);
1043 send_break(info, arg ? arg*(HZ/10) : HZ/4); 1042 send_break(info, arg ? arg*(100) : 250);
1044 return 0; 1043 return 0;
1045 case TIOCGSOFTCAR: 1044 case TIOCGSOFTCAR:
1046 error = put_user(C_CLOCAL(tty) ? 1 : 0, 1045 error = put_user(C_CLOCAL(tty) ? 1 : 0,
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index f148022b6b4e..b116122e569a 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -1394,14 +1394,13 @@ static void end_break(ser_info_t *info)
1394/* 1394/*
1395 * This routine sends a break character out the serial port. 1395 * This routine sends a break character out the serial port.
1396 */ 1396 */
1397static void send_break(ser_info_t *info, int duration) 1397static void send_break(ser_info_t *info, unsigned int duration)
1398{ 1398{
1399 set_current_state(TASK_INTERRUPTIBLE);
1400#ifdef SERIAL_DEBUG_SEND_BREAK 1399#ifdef SERIAL_DEBUG_SEND_BREAK
1401 printk("rs_send_break(%d) jiff=%lu...", duration, jiffies); 1400 printk("rs_send_break(%d) jiff=%lu...", duration, jiffies);
1402#endif 1401#endif
1403 begin_break(info); 1402 begin_break(info);
1404 schedule_timeout(duration); 1403 msleep_interruptible(duration);
1405 end_break(info); 1404 end_break(info);
1406#ifdef SERIAL_DEBUG_SEND_BREAK 1405#ifdef SERIAL_DEBUG_SEND_BREAK
1407 printk("done jiffies=%lu\n", jiffies); 1406 printk("done jiffies=%lu\n", jiffies);
@@ -1436,7 +1435,7 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1436 if (signal_pending(current)) 1435 if (signal_pending(current))
1437 return -EINTR; 1436 return -EINTR;
1438 if (!arg) { 1437 if (!arg) {
1439 send_break(info, HZ/4); /* 1/4 second */ 1438 send_break(info, 250); /* 1/4 second */
1440 if (signal_pending(current)) 1439 if (signal_pending(current))
1441 return -EINTR; 1440 return -EINTR;
1442 } 1441 }
@@ -1448,7 +1447,7 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1448 tty_wait_until_sent(tty, 0); 1447 tty_wait_until_sent(tty, 0);
1449 if (signal_pending(current)) 1448 if (signal_pending(current))
1450 return -EINTR; 1449 return -EINTR;
1451 send_break(info, arg ? arg*(HZ/10) : HZ/4); 1450 send_break(info, arg ? arg*100 : 250);
1452 if (signal_pending(current)) 1451 if (signal_pending(current))
1453 return -EINTR; 1452 return -EINTR;
1454 return 0; 1453 return 0;
diff --git a/drivers/serial/icom.h b/drivers/serial/icom.h
index 23dc0f7ddf8b..798f1ef23712 100644
--- a/drivers/serial/icom.h
+++ b/drivers/serial/icom.h
@@ -286,5 +286,3 @@ struct lookup_int_table {
286 u32 __iomem *global_int_mask; 286 u32 __iomem *global_int_mask;
287 unsigned long processor_id; 287 unsigned long processor_id;
288}; 288};
289
290#define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index a8314aee2ab8..a2a643318002 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -67,7 +67,11 @@
67 67
68static struct mpsc_port_info mpsc_ports[MPSC_NUM_CTLRS]; 68static struct mpsc_port_info mpsc_ports[MPSC_NUM_CTLRS];
69static struct mpsc_shared_regs mpsc_shared_regs; 69static struct mpsc_shared_regs mpsc_shared_regs;
70static struct uart_driver mpsc_reg;
70 71
72static void mpsc_start_rx(struct mpsc_port_info *pi);
73static void mpsc_free_ring_mem(struct mpsc_port_info *pi);
74static void mpsc_release_port(struct uart_port *port);
71/* 75/*
72 ****************************************************************************** 76 ******************************************************************************
73 * 77 *
@@ -546,7 +550,6 @@ static int
546mpsc_alloc_ring_mem(struct mpsc_port_info *pi) 550mpsc_alloc_ring_mem(struct mpsc_port_info *pi)
547{ 551{
548 int rc = 0; 552 int rc = 0;
549 static void mpsc_free_ring_mem(struct mpsc_port_info *pi);
550 553
551 pr_debug("mpsc_alloc_ring_mem[%d]: Allocating ring mem\n", 554 pr_debug("mpsc_alloc_ring_mem[%d]: Allocating ring mem\n",
552 pi->port.line); 555 pi->port.line);
@@ -745,7 +748,6 @@ mpsc_rx_intr(struct mpsc_port_info *pi, struct pt_regs *regs)
745 int rc = 0; 748 int rc = 0;
746 u8 *bp; 749 u8 *bp;
747 char flag = TTY_NORMAL; 750 char flag = TTY_NORMAL;
748 static void mpsc_start_rx(struct mpsc_port_info *pi);
749 751
750 pr_debug("mpsc_rx_intr[%d]: Handling Rx intr\n", pi->port.line); 752 pr_debug("mpsc_rx_intr[%d]: Handling Rx intr\n", pi->port.line);
751 753
@@ -1178,7 +1180,6 @@ static void
1178mpsc_shutdown(struct uart_port *port) 1180mpsc_shutdown(struct uart_port *port)
1179{ 1181{
1180 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1182 struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
1181 static void mpsc_release_port(struct uart_port *port);
1182 1183
1183 pr_debug("mpsc_shutdown[%d]: Shutting down MPSC\n", port->line); 1184 pr_debug("mpsc_shutdown[%d]: Shutting down MPSC\n", port->line);
1184 1185
@@ -1448,7 +1449,6 @@ mpsc_console_setup(struct console *co, char *options)
1448 return uart_set_options(&pi->port, co, baud, parity, bits, flow); 1449 return uart_set_options(&pi->port, co, baud, parity, bits, flow);
1449} 1450}
1450 1451
1451extern struct uart_driver mpsc_reg;
1452static struct console mpsc_console = { 1452static struct console mpsc_console = {
1453 .name = MPSC_DEV_NAME, 1453 .name = MPSC_DEV_NAME,
1454 .write = mpsc_console_write, 1454 .write = mpsc_console_write,
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 5c4231ae295b..8e65206d3d76 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1071,7 +1071,7 @@ static void __init sunzilog_alloc_tables(void)
1071 */ 1071 */
1072static struct zilog_layout __iomem * __init get_zs_sun4u(int chip, int zsnode) 1072static struct zilog_layout __iomem * __init get_zs_sun4u(int chip, int zsnode)
1073{ 1073{
1074 unsigned long mapped_addr; 1074 void __iomem *mapped_addr;
1075 unsigned int sun4u_ino; 1075 unsigned int sun4u_ino;
1076 struct sbus_bus *sbus = NULL; 1076 struct sbus_bus *sbus = NULL;
1077 struct sbus_dev *sdev = NULL; 1077 struct sbus_dev *sdev = NULL;
@@ -1111,9 +1111,9 @@ static struct zilog_layout __iomem * __init get_zs_sun4u(int chip, int zsnode)
1111 apply_fhc_ranges(central_bus->child, 1111 apply_fhc_ranges(central_bus->child,
1112 &zsregs[0], 1); 1112 &zsregs[0], 1);
1113 apply_central_ranges(central_bus, &zsregs[0], 1); 1113 apply_central_ranges(central_bus, &zsregs[0], 1);
1114 mapped_addr = 1114 mapped_addr = (void __iomem *)
1115 (((u64)zsregs[0].which_io)<<32UL) | 1115 ((((u64)zsregs[0].which_io)<<32UL) |
1116 ((u64)zsregs[0].phys_addr); 1116 ((u64)zsregs[0].phys_addr));
1117 } 1117 }
1118 1118
1119 if (zilog_irq == -1) { 1119 if (zilog_irq == -1) {
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index d5863b8b56ee..f2c9fa423d40 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -329,10 +329,8 @@ static IXJ *ixj_alloc()
329 329
330static void ixj_fsk_free(IXJ *j) 330static void ixj_fsk_free(IXJ *j)
331{ 331{
332 if(j->fskdata != NULL) { 332 kfree(j->fskdata);
333 kfree(j->fskdata); 333 j->fskdata = NULL;
334 j->fskdata = NULL;
335 }
336} 334}
337 335
338static void ixj_fsk_alloc(IXJ *j) 336static void ixj_fsk_alloc(IXJ *j)
@@ -3867,13 +3865,11 @@ static int set_rec_codec(IXJ *j, int rate)
3867 j->rec_mode = 7; 3865 j->rec_mode = 7;
3868 break; 3866 break;
3869 default: 3867 default:
3868 kfree(j->read_buffer);
3870 j->rec_frame_size = 0; 3869 j->rec_frame_size = 0;
3871 j->rec_mode = -1; 3870 j->rec_mode = -1;
3872 if (j->read_buffer) { 3871 j->read_buffer = NULL;
3873 kfree(j->read_buffer); 3872 j->read_buffer_size = 0;
3874 j->read_buffer = NULL;
3875 j->read_buffer_size = 0;
3876 }
3877 retval = 1; 3873 retval = 1;
3878 break; 3874 break;
3879 } 3875 }
@@ -3991,14 +3987,12 @@ static int ixj_record_start(IXJ *j)
3991 3987
3992static void ixj_record_stop(IXJ *j) 3988static void ixj_record_stop(IXJ *j)
3993{ 3989{
3994 if(ixjdebug & 0x0002) 3990 if (ixjdebug & 0x0002)
3995 printk("IXJ %d Stopping Record Codec %d at %ld\n", j->board, j->rec_codec, jiffies); 3991 printk("IXJ %d Stopping Record Codec %d at %ld\n", j->board, j->rec_codec, jiffies);
3996 3992
3997 if (j->read_buffer) { 3993 kfree(j->read_buffer);
3998 kfree(j->read_buffer); 3994 j->read_buffer = NULL;
3999 j->read_buffer = NULL; 3995 j->read_buffer_size = 0;
4000 j->read_buffer_size = 0;
4001 }
4002 if (j->rec_mode > -1) { 3996 if (j->rec_mode > -1) {
4003 ixj_WriteDSPCommand(0x5120, j); 3997 ixj_WriteDSPCommand(0x5120, j);
4004 j->rec_mode = -1; 3998 j->rec_mode = -1;
@@ -4449,13 +4443,11 @@ static int set_play_codec(IXJ *j, int rate)
4449 j->play_mode = 5; 4443 j->play_mode = 5;
4450 break; 4444 break;
4451 default: 4445 default:
4446 kfree(j->write_buffer);
4452 j->play_frame_size = 0; 4447 j->play_frame_size = 0;
4453 j->play_mode = -1; 4448 j->play_mode = -1;
4454 if (j->write_buffer) { 4449 j->write_buffer = NULL;
4455 kfree(j->write_buffer); 4450 j->write_buffer_size = 0;
4456 j->write_buffer = NULL;
4457 j->write_buffer_size = 0;
4458 }
4459 retval = 1; 4451 retval = 1;
4460 break; 4452 break;
4461 } 4453 }
@@ -4578,14 +4570,12 @@ static int ixj_play_start(IXJ *j)
4578 4570
4579static void ixj_play_stop(IXJ *j) 4571static void ixj_play_stop(IXJ *j)
4580{ 4572{
4581 if(ixjdebug & 0x0002) 4573 if (ixjdebug & 0x0002)
4582 printk("IXJ %d Stopping Play Codec %d at %ld\n", j->board, j->play_codec, jiffies); 4574 printk("IXJ %d Stopping Play Codec %d at %ld\n", j->board, j->play_codec, jiffies);
4583 4575
4584 if (j->write_buffer) { 4576 kfree(j->write_buffer);
4585 kfree(j->write_buffer); 4577 j->write_buffer = NULL;
4586 j->write_buffer = NULL; 4578 j->write_buffer_size = 0;
4587 j->write_buffer_size = 0;
4588 }
4589 if (j->play_mode > -1) { 4579 if (j->play_mode > -1) {
4590 ixj_WriteDSPCommand(0x5221, j); /* Stop playback and flush buffers. 8022 reference page 9-40 */ 4580 ixj_WriteDSPCommand(0x5221, j); /* Stop playback and flush buffers. 8022 reference page 9-40 */
4591 4581
@@ -5810,9 +5800,7 @@ static void ixj_cpt_stop(IXJ *j)
5810 ixj_play_tone(j, 0); 5800 ixj_play_tone(j, 0);
5811 j->tone_state = j->tone_cadence_state = 0; 5801 j->tone_state = j->tone_cadence_state = 0;
5812 if (j->cadence_t) { 5802 if (j->cadence_t) {
5813 if (j->cadence_t->ce) { 5803 kfree(j->cadence_t->ce);
5814 kfree(j->cadence_t->ce);
5815 }
5816 kfree(j->cadence_t); 5804 kfree(j->cadence_t);
5817 j->cadence_t = NULL; 5805 j->cadence_t = NULL;
5818 } 5806 }
@@ -7497,10 +7485,8 @@ static void cleanup(void)
7497 printk(KERN_INFO "IXJ: Releasing XILINX address for /dev/phone%d\n", cnt); 7485 printk(KERN_INFO "IXJ: Releasing XILINX address for /dev/phone%d\n", cnt);
7498 release_region(j->XILINXbase, 4); 7486 release_region(j->XILINXbase, 4);
7499 } 7487 }
7500 if (j->read_buffer) 7488 kfree(j->read_buffer);
7501 kfree(j->read_buffer); 7489 kfree(j->write_buffer);
7502 if (j->write_buffer)
7503 kfree(j->write_buffer);
7504 if (j->dev) 7490 if (j->dev)
7505 pnp_device_detach(j->dev); 7491 pnp_device_detach(j->dev);
7506 if (ixjdebug & 0x0002) 7492 if (ixjdebug & 0x0002)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index d2d648ee8640..a8d879a85d04 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2808,7 +2808,7 @@ static int hub_thread(void *__unused)
2808 do { 2808 do {
2809 hub_events(); 2809 hub_events();
2810 wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); 2810 wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list));
2811 try_to_freeze(PF_FREEZE); 2811 try_to_freeze();
2812 } while (!signal_pending(current)); 2812 } while (!signal_pending(current));
2813 2813
2814 pr_debug ("%s: khubd exiting\n", usbcore_name); 2814 pr_debug ("%s: khubd exiting\n", usbcore_name);
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 037a7f163822..a9be85103d23 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -1554,8 +1554,7 @@ static int sleep_thread(struct fsg_dev *fsg)
1554 rc = wait_event_interruptible(fsg->thread_wqh, 1554 rc = wait_event_interruptible(fsg->thread_wqh,
1555 fsg->thread_wakeup_needed); 1555 fsg->thread_wakeup_needed);
1556 fsg->thread_wakeup_needed = 0; 1556 fsg->thread_wakeup_needed = 0;
1557 if (current->flags & PF_FREEZE) 1557 try_to_freeze();
1558 refrigerator(PF_FREEZE);
1559 return (rc ? -EINTR : 0); 1558 return (rc ? -EINTR : 0);
1560} 1559}
1561 1560
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 35c1ca6b5a8e..77e7fc258aa2 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -847,10 +847,8 @@ retry:
847 wait_event_interruptible_timeout(us->delay_wait, 847 wait_event_interruptible_timeout(us->delay_wait,
848 test_bit(US_FLIDX_DISCONNECTING, &us->flags), 848 test_bit(US_FLIDX_DISCONNECTING, &us->flags),
849 delay_use * HZ); 849 delay_use * HZ);
850 if (current->flags & PF_FREEZE) { 850 if (try_to_freeze())
851 refrigerator(PF_FREEZE);
852 goto retry; 851 goto retry;
853 }
854 } 852 }
855 853
856 /* If the device is still connected, perform the scanning */ 854 /* If the device is still connected, perform the scanning */
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index cacd88cc84ab..b6fe30c3ad62 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -111,15 +111,15 @@ static int au1100fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
111void au1100_nocursor(struct display *p, int mode, int xx, int yy){}; 111void au1100_nocursor(struct display *p, int mode, int xx, int yy){};
112 112
113static struct fb_ops au1100fb_ops = { 113static struct fb_ops au1100fb_ops = {
114 owner: THIS_MODULE, 114 .owner = THIS_MODULE,
115 fb_get_fix: fbgen_get_fix, 115 .fb_get_fix = fbgen_get_fix,
116 fb_get_var: fbgen_get_var, 116 .fb_get_var = fbgen_get_var,
117 fb_set_var: fbgen_set_var, 117 .fb_set_var = fbgen_set_var,
118 fb_get_cmap: fbgen_get_cmap, 118 .fb_get_cmap = fbgen_get_cmap,
119 fb_set_cmap: fbgen_set_cmap, 119 .fb_set_cmap = fbgen_set_cmap,
120 fb_pan_display: fbgen_pan_display, 120 .fb_pan_display = fbgen_pan_display,
121 fb_ioctl: au1100fb_ioctl, 121 .fb_ioctl = au1100fb_ioctl,
122 fb_mmap: au1100fb_mmap, 122 .fb_mmap = au1100fb_mmap,
123}; 123};
124 124
125static void au1100_detect(void) 125static void au1100_detect(void)
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index e4b91a4b936c..cbff98337aa6 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -156,7 +156,6 @@ config FONT_6x11
156config FONT_7x14 156config FONT_7x14
157 bool "console 7x14 font (not supported by all drivers)" if FONTS 157 bool "console 7x14 font (not supported by all drivers)" if FONTS
158 depends on FRAMEBUFFER_CONSOLE 158 depends on FRAMEBUFFER_CONSOLE
159 default y if !SPARC32 && !SPARC64 && !FONTS
160 help 159 help
161 Console font with characters just a bit smaller than the default. 160 Console font with characters just a bit smaller than the default.
162 If the standard 8x16 font is a little too big for you, say Y. 161 If the standard 8x16 font is a little too big for you, say Y.
@@ -197,8 +196,8 @@ config FONT_SUN12x22
197 standard font is unreadable for you, say Y, otherwise say N. 196 standard font is unreadable for you, say Y, otherwise say N.
198 197
199config FONT_10x18 198config FONT_10x18
200 bool "console 10x18 font (not supported by all drivers)" 199 bool "console 10x18 font (not supported by all drivers)" if FONTS
201 depends on FONTS 200 depends on FRAMEBUFFER_CONSOLE
202 help 201 help
203 This is a high resolution console font for machines with very 202 This is a high resolution console font for machines with very
204 big letters. It fits between the sun 12x22 and the normal 8x16 font. 203 big letters. It fits between the sun 12x22 and the normal 8x16 font.
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 277d733c6d00..7dfbf39b4ed3 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -228,8 +228,6 @@ static ssize_t store_virtual(struct class_device *class_device,
228 if (last - buf >= count) 228 if (last - buf >= count)
229 return -EINVAL; 229 return -EINVAL;
230 var.yres_virtual = simple_strtoul(last, &last, 0); 230 var.yres_virtual = simple_strtoul(last, &last, 0);
231 printk(KERN_ERR "fb: xres %d yres %d\n", var.xres_virtual,
232 var.yres_virtual);
233 231
234 if ((err = activate(fb_info, &var))) 232 if ((err = activate(fb_info, &var)))
235 return err; 233 return err;
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c
index 76fd3a519b8a..a18dd024fc86 100644
--- a/drivers/video/matrox/matroxfb_misc.c
+++ b/drivers/video/matrox/matroxfb_misc.c
@@ -197,10 +197,7 @@ int matroxfb_vgaHWinit(WPMINFO struct my_timming* m) {
197 DBG(__FUNCTION__) 197 DBG(__FUNCTION__)
198 198
199 hw->SEQ[0] = 0x00; 199 hw->SEQ[0] = 0x00;
200 if (fwidth == 9) 200 hw->SEQ[1] = 0x01; /* or 0x09 */
201 hw->SEQ[1] = 0x00;
202 else
203 hw->SEQ[1] = 0x01; /* or 0x09 */
204 hw->SEQ[2] = 0x0F; /* bitplanes */ 201 hw->SEQ[2] = 0x0F; /* bitplanes */
205 hw->SEQ[3] = 0x00; 202 hw->SEQ[3] = 0x00;
206 hw->SEQ[4] = 0x0E; 203 hw->SEQ[4] = 0x0E;
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index f3069b01e248..9ed1a931dd31 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -389,10 +389,11 @@ static int __init vesafb_probe(struct device *device)
389 unsigned int temp_size = size_total; 389 unsigned int temp_size = size_total;
390 /* Find the largest power-of-two */ 390 /* Find the largest power-of-two */
391 while (temp_size & (temp_size - 1)) 391 while (temp_size & (temp_size - 1))
392 temp_size &= (temp_size - 1); 392 temp_size &= (temp_size - 1);
393 393
394 /* Try and find a power of two to add */ 394 /* Try and find a power of two to add */
395 while (temp_size && mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { 395 while (temp_size > PAGE_SIZE &&
396 mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) {
396 temp_size >>= 1; 397 temp_size >>= 1;
397 } 398 }
398 } 399 }
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index b460927ec32a..312cf3220f12 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -646,7 +646,7 @@ static int w1_control(void *data)
646 while (!control_needs_exit || have_to_wait) { 646 while (!control_needs_exit || have_to_wait) {
647 have_to_wait = 0; 647 have_to_wait = 0;
648 648
649 try_to_freeze(PF_FREEZE); 649 try_to_freeze();
650 msleep_interruptible(w1_timeout * 1000); 650 msleep_interruptible(w1_timeout * 1000);
651 651
652 if (signal_pending(current)) 652 if (signal_pending(current))
@@ -725,7 +725,7 @@ int w1_process(void *data)
725 allow_signal(SIGTERM); 725 allow_signal(SIGTERM);
726 726
727 while (!test_bit(W1_MASTER_NEED_EXIT, &dev->flags)) { 727 while (!test_bit(W1_MASTER_NEED_EXIT, &dev->flags)) {
728 try_to_freeze(PF_FREEZE); 728 try_to_freeze();
729 msleep_interruptible(w1_timeout * 1000); 729 msleep_interruptible(w1_timeout * 1000);
730 730
731 if (signal_pending(current)) 731 if (signal_pending(current))