aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/pcmcia/driver-changes.txt9
-rw-r--r--arch/i386/pci/irq.c7
-rw-r--r--drivers/block/cciss.c49
-rw-r--r--drivers/block/cciss.h4
-rw-r--r--drivers/firmware/pcdp.c14
-rw-r--r--drivers/ide/legacy/ide-cs.c3
-rw-r--r--drivers/infiniband/core/ucm.c88
-rw-r--r--drivers/infiniband/core/uverbs.h1
-rw-r--r--drivers/infiniband/core/uverbs_main.c14
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c6
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c6
-rw-r--r--drivers/net/cs89x0.c1
-rw-r--r--drivers/net/e1000/e1000_main.c29
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c7
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c8
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/wireless/orinoco_cs.c2
-rw-r--r--drivers/pcmcia/au1000_generic.c1
-rw-r--r--drivers/pcmcia/cistpl.c51
-rw-r--r--drivers/pcmcia/ds.c4
-rw-r--r--drivers/pcmcia/o2micro.h34
-rw-r--r--drivers/pcmcia/pcmcia_resource.c2
-rw-r--r--drivers/pcmcia/yenta_socket.c9
-rw-r--r--drivers/scsi/qla2xxx/Kconfig14
-rw-r--r--drivers/scsi/qla2xxx/Makefile1
-rw-r--r--drivers/serial/serial_cs.c10
-rw-r--r--fs/bio.c1
-rw-r--r--include/asm-alpha/smp.h9
-rw-r--r--include/asm-i386/bitops.h54
-rw-r--r--include/linux/smp.h20
-rw-r--r--security/selinux/hooks.c3
-rw-r--r--security/selinux/include/security.h2
-rw-r--r--security/selinux/ss/mls.c71
-rw-r--r--security/selinux/ss/mls.h4
-rw-r--r--security/selinux/ss/services.c55
37 files changed, 368 insertions, 235 deletions
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt
index 59ccc63838c1..403e7b4dcdd4 100644
--- a/Documentation/pcmcia/driver-changes.txt
+++ b/Documentation/pcmcia/driver-changes.txt
@@ -56,3 +56,12 @@ This file details changes in 2.6 which affect PCMCIA card driver authors:
56 memory regions in-use. The name argument should be a pointer to 56 memory regions in-use. The name argument should be a pointer to
57 your driver name. Eg, for pcnet_cs, name should point to the 57 your driver name. Eg, for pcnet_cs, name should point to the
58 string "pcnet_cs". 58 string "pcnet_cs".
59
60* CardServices is gone
61 CardServices() in 2.4 is just a big switch statement to call various
62 services. In 2.6, all of those entry points are exported and called
63 directly (except for pcmcia_report_error(), just use cs_error() instead).
64
65* struct pcmcia_driver
66 You need to use struct pcmcia_driver and pcmcia_{un,}register_driver
67 instead of {un,}register_pccard_driver
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 766b104ac1a1..d291fb7f1357 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -550,6 +550,13 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
550static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 550static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
551{ 551{
552 /* FIXME: We should move some of the quirk fixup stuff here */ 552 /* FIXME: We should move some of the quirk fixup stuff here */
553
554 if (router->device == PCI_DEVICE_ID_VIA_82C686 &&
555 device == PCI_DEVICE_ID_VIA_82C586_0) {
556 /* Asus k7m bios wrongly reports 82C686A as 586-compatible */
557 device = PCI_DEVICE_ID_VIA_82C686;
558 }
559
553 switch(device) 560 switch(device)
554 { 561 {
555 case PCI_DEVICE_ID_VIA_82C586_0: 562 case PCI_DEVICE_ID_VIA_82C586_0:
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 3e9fb6e4a52a..418b1469d75d 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1135,7 +1135,7 @@ static int revalidate_allvol(ctlr_info_t *host)
1135 /* this is for the online array utilities */ 1135 /* this is for the online array utilities */
1136 if (!drv->heads && i) 1136 if (!drv->heads && i)
1137 continue; 1137 continue;
1138 blk_queue_hardsect_size(host->queue, drv->block_size); 1138 blk_queue_hardsect_size(drv->queue, drv->block_size);
1139 set_capacity(disk, drv->nr_blocks); 1139 set_capacity(disk, drv->nr_blocks);
1140 add_disk(disk); 1140 add_disk(disk);
1141 } 1141 }
@@ -1691,7 +1691,7 @@ static int cciss_revalidate(struct gendisk *disk)
1691 cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size); 1691 cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size);
1692 cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv); 1692 cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv);
1693 1693
1694 blk_queue_hardsect_size(h->queue, drv->block_size); 1694 blk_queue_hardsect_size(drv->queue, drv->block_size);
1695 set_capacity(disk, drv->nr_blocks); 1695 set_capacity(disk, drv->nr_blocks);
1696 1696
1697 kfree(size_buff); 1697 kfree(size_buff);
@@ -2248,12 +2248,12 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2248 * them up. We will also keep track of the next queue to run so 2248 * them up. We will also keep track of the next queue to run so
2249 * that every queue gets a chance to be started first. 2249 * that every queue gets a chance to be started first.
2250 */ 2250 */
2251 for (j=0; j < NWD; j++){ 2251 for (j=0; j < h->highest_lun + 1; j++){
2252 int curr_queue = (start_queue + j) % NWD; 2252 int curr_queue = (start_queue + j) % (h->highest_lun + 1);
2253 /* make sure the disk has been added and the drive is real 2253 /* make sure the disk has been added and the drive is real
2254 * because this can be called from the middle of init_one. 2254 * because this can be called from the middle of init_one.
2255 */ 2255 */
2256 if(!(h->gendisk[curr_queue]->queue) || 2256 if(!(h->drv[curr_queue].queue) ||
2257 !(h->drv[curr_queue].heads)) 2257 !(h->drv[curr_queue].heads))
2258 continue; 2258 continue;
2259 blk_start_queue(h->gendisk[curr_queue]->queue); 2259 blk_start_queue(h->gendisk[curr_queue]->queue);
@@ -2264,14 +2264,14 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2264 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) 2264 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS)
2265 { 2265 {
2266 if (curr_queue == start_queue){ 2266 if (curr_queue == start_queue){
2267 h->next_to_run = (start_queue + 1) % NWD; 2267 h->next_to_run = (start_queue + 1) % (h->highest_lun + 1);
2268 goto cleanup; 2268 goto cleanup;
2269 } else { 2269 } else {
2270 h->next_to_run = curr_queue; 2270 h->next_to_run = curr_queue;
2271 goto cleanup; 2271 goto cleanup;
2272 } 2272 }
2273 } else { 2273 } else {
2274 curr_queue = (curr_queue + 1) % NWD; 2274 curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
2275 } 2275 }
2276 } 2276 }
2277 2277
@@ -2279,7 +2279,6 @@ cleanup:
2279 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 2279 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
2280 return IRQ_HANDLED; 2280 return IRQ_HANDLED;
2281} 2281}
2282
2283/* 2282/*
2284 * We cannot read the structure directly, for portablity we must use 2283 * We cannot read the structure directly, for portablity we must use
2285 * the io functions. 2284 * the io functions.
@@ -2789,13 +2788,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2789 } 2788 }
2790 2789
2791 spin_lock_init(&hba[i]->lock); 2790 spin_lock_init(&hba[i]->lock);
2792 q = blk_init_queue(do_cciss_request, &hba[i]->lock);
2793 if (!q)
2794 goto clean4;
2795
2796 q->backing_dev_info.ra_pages = READ_AHEAD;
2797 hba[i]->queue = q;
2798 q->queuedata = hba[i];
2799 2791
2800 /* Initialize the pdev driver private data. 2792 /* Initialize the pdev driver private data.
2801 have it point to hba[i]. */ 2793 have it point to hba[i]. */
@@ -2817,6 +2809,20 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2817 2809
2818 cciss_procinit(i); 2810 cciss_procinit(i);
2819 2811
2812 for(j=0; j < NWD; j++) { /* mfm */
2813 drive_info_struct *drv = &(hba[i]->drv[j]);
2814 struct gendisk *disk = hba[i]->gendisk[j];
2815
2816 q = blk_init_queue(do_cciss_request, &hba[i]->lock);
2817 if (!q) {
2818 printk(KERN_ERR
2819 "cciss: unable to allocate queue for disk %d\n",
2820 j);
2821 break;
2822 }
2823 drv->queue = q;
2824
2825 q->backing_dev_info.ra_pages = READ_AHEAD;
2820 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); 2826 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
2821 2827
2822 /* This is a hardware imposed limit. */ 2828 /* This is a hardware imposed limit. */
@@ -2827,26 +2833,23 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2827 2833
2828 blk_queue_max_sectors(q, 512); 2834 blk_queue_max_sectors(q, 512);
2829 2835
2830 2836 q->queuedata = hba[i];
2831 for(j=0; j<NWD; j++) {
2832 drive_info_struct *drv = &(hba[i]->drv[j]);
2833 struct gendisk *disk = hba[i]->gendisk[j];
2834
2835 sprintf(disk->disk_name, "cciss/c%dd%d", i, j); 2837 sprintf(disk->disk_name, "cciss/c%dd%d", i, j);
2836 sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); 2838 sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j);
2837 disk->major = hba[i]->major; 2839 disk->major = hba[i]->major;
2838 disk->first_minor = j << NWD_SHIFT; 2840 disk->first_minor = j << NWD_SHIFT;
2839 disk->fops = &cciss_fops; 2841 disk->fops = &cciss_fops;
2840 disk->queue = hba[i]->queue; 2842 disk->queue = q;
2841 disk->private_data = drv; 2843 disk->private_data = drv;
2842 /* we must register the controller even if no disks exist */ 2844 /* we must register the controller even if no disks exist */
2843 /* this is for the online array utilities */ 2845 /* this is for the online array utilities */
2844 if(!drv->heads && j) 2846 if(!drv->heads && j)
2845 continue; 2847 continue;
2846 blk_queue_hardsect_size(hba[i]->queue, drv->block_size); 2848 blk_queue_hardsect_size(q, drv->block_size);
2847 set_capacity(disk, drv->nr_blocks); 2849 set_capacity(disk, drv->nr_blocks);
2848 add_disk(disk); 2850 add_disk(disk);
2849 } 2851 }
2852
2850 return(1); 2853 return(1);
2851 2854
2852clean4: 2855clean4:
@@ -2912,10 +2915,10 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev)
2912 for (j = 0; j < NWD; j++) { 2915 for (j = 0; j < NWD; j++) {
2913 struct gendisk *disk = hba[i]->gendisk[j]; 2916 struct gendisk *disk = hba[i]->gendisk[j];
2914 if (disk->flags & GENHD_FL_UP) 2917 if (disk->flags & GENHD_FL_UP)
2918 blk_cleanup_queue(disk->queue);
2915 del_gendisk(disk); 2919 del_gendisk(disk);
2916 } 2920 }
2917 2921
2918 blk_cleanup_queue(hba[i]->queue);
2919 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), 2922 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct),
2920 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); 2923 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle);
2921 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct), 2924 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct),
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h
index 8fb19206eddb..566587d0a500 100644
--- a/drivers/block/cciss.h
+++ b/drivers/block/cciss.h
@@ -29,6 +29,7 @@ typedef struct _drive_info_struct
29{ 29{
30 __u32 LunID; 30 __u32 LunID;
31 int usage_count; 31 int usage_count;
32 struct request_queue *queue;
32 sector_t nr_blocks; 33 sector_t nr_blocks;
33 int block_size; 34 int block_size;
34 int heads; 35 int heads;
@@ -72,7 +73,6 @@ struct ctlr_info
72 unsigned int maxQsinceinit; 73 unsigned int maxQsinceinit;
73 unsigned int maxSG; 74 unsigned int maxSG;
74 spinlock_t lock; 75 spinlock_t lock;
75 struct request_queue *queue;
76 76
77 //* pointers to command and error info pool */ 77 //* pointers to command and error info pool */
78 CommandList_struct *cmd_pool; 78 CommandList_struct *cmd_pool;
@@ -260,7 +260,7 @@ struct board_type {
260 struct access_method *access; 260 struct access_method *access;
261}; 261};
262 262
263#define CCISS_LOCK(i) (hba[i]->queue->queue_lock) 263#define CCISS_LOCK(i) (&hba[i]->lock)
264 264
265#endif /* CCISS_H */ 265#endif /* CCISS_H */
266 266
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c
index 53c95c0bbf46..ae1fb45dbb40 100644
--- a/drivers/firmware/pcdp.c
+++ b/drivers/firmware/pcdp.c
@@ -25,14 +25,22 @@ setup_serial_console(struct pcdp_uart *uart)
25#ifdef CONFIG_SERIAL_8250_CONSOLE 25#ifdef CONFIG_SERIAL_8250_CONSOLE
26 int mmio; 26 int mmio;
27 static char options[64], *p = options; 27 static char options[64], *p = options;
28 char parity;
28 29
29 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY); 30 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
30 p += sprintf(p, "console=uart,%s,0x%lx", 31 p += sprintf(p, "console=uart,%s,0x%lx",
31 mmio ? "mmio" : "io", uart->addr.address); 32 mmio ? "mmio" : "io", uart->addr.address);
32 if (uart->baud) 33 if (uart->baud) {
33 p += sprintf(p, ",%lu", uart->baud); 34 p += sprintf(p, ",%lu", uart->baud);
34 if (uart->bits) 35 if (uart->bits) {
35 p += sprintf(p, "n%d", uart->bits); 36 switch (uart->parity) {
37 case 0x2: parity = 'e'; break;
38 case 0x3: parity = 'o'; break;
39 default: parity = 'n';
40 }
41 p += sprintf(p, "%c%d", parity, uart->bits);
42 }
43 }
36 44
37 return early_serial_console_init(options); 45 return early_serial_console_init(options);
38#else 46#else
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index aac59751e1b4..03747439ac9c 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -465,7 +465,7 @@ static struct pcmcia_device_id ide_ids[] = {
465 PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591), 465 PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591),
466 PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4), 466 PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4),
467 PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde), 467 PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde),
468 PCMCIA_DEVICE_PROD_ID12("EXP", "CD", 0x6f58c983, 0xaae5994f), 468 PCMCIA_DEVICE_PROD_ID12("EXP", "CD+GAME", 0x6f58c983, 0x63c13aaf),
469 PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591), 469 PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591),
470 PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728), 470 PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728),
471 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), 471 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e),
@@ -481,6 +481,7 @@ static struct pcmcia_device_id ide_ids[] = {
481 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), 481 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
482 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 482 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
483 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 483 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
484 PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
484 PCMCIA_DEVICE_NULL, 485 PCMCIA_DEVICE_NULL,
485}; 486};
486MODULE_DEVICE_TABLE(pcmcia, ide_ids); 487MODULE_DEVICE_TABLE(pcmcia, ide_ids);
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index 546ec61c407f..61d07c732f49 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -49,6 +49,11 @@ MODULE_AUTHOR("Libor Michalek");
49MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access"); 49MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access");
50MODULE_LICENSE("Dual BSD/GPL"); 50MODULE_LICENSE("Dual BSD/GPL");
51 51
52static int ucm_debug_level;
53
54module_param_named(debug_level, ucm_debug_level, int, 0644);
55MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
56
52enum { 57enum {
53 IB_UCM_MAJOR = 231, 58 IB_UCM_MAJOR = 231,
54 IB_UCM_MINOR = 255 59 IB_UCM_MINOR = 255
@@ -56,6 +61,14 @@ enum {
56 61
57#define IB_UCM_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_MINOR) 62#define IB_UCM_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_MINOR)
58 63
64#define PFX "UCM: "
65
66#define ucm_dbg(format, arg...) \
67 do { \
68 if (ucm_debug_level > 0) \
69 printk(KERN_DEBUG PFX format, ## arg); \
70 } while (0)
71
59static struct semaphore ctx_id_mutex; 72static struct semaphore ctx_id_mutex;
60static struct idr ctx_id_table; 73static struct idr ctx_id_table;
61static int ctx_id_rover = 0; 74static int ctx_id_rover = 0;
@@ -107,7 +120,7 @@ static void ib_ucm_ctx_put(struct ib_ucm_context *ctx)
107 120
108 up(&ctx->file->mutex); 121 up(&ctx->file->mutex);
109 122
110 printk(KERN_ERR "UCM: Destroyed CM ID <%d>\n", ctx->id); 123 ucm_dbg("Destroyed CM ID <%d>\n", ctx->id);
111 124
112 ib_destroy_cm_id(ctx->cm_id); 125 ib_destroy_cm_id(ctx->cm_id);
113 kfree(ctx); 126 kfree(ctx);
@@ -145,7 +158,7 @@ retry:
145 if (result) 158 if (result)
146 goto error; 159 goto error;
147 160
148 printk(KERN_ERR "UCM: Allocated CM ID <%d>\n", ctx->id); 161 ucm_dbg("Allocated CM ID <%d>\n", ctx->id);
149 162
150 return ctx; 163 return ctx;
151error: 164error:
@@ -378,10 +391,8 @@ static int ib_ucm_event_process(struct ib_cm_event *evt,
378 391
379 return 0; 392 return 0;
380error: 393error:
381 if (uvt->info) 394 kfree(uvt->info);
382 kfree(uvt->info); 395 kfree(uvt->data);
383 if (uvt->data)
384 kfree(uvt->data);
385 return result; 396 return result;
386} 397}
387 398
@@ -407,8 +418,7 @@ static int ib_ucm_event_handler(struct ib_cm_id *cm_id,
407 break; 418 break;
408 } 419 }
409 420
410 printk(KERN_ERR "UCM: Event. CM ID <%d> event <%d>\n", 421 ucm_dbg("Event. CM ID <%d> event <%d>\n", id, event->event);
411 id, event->event);
412 422
413 ctx = ib_ucm_ctx_get(id); 423 ctx = ib_ucm_ctx_get(id);
414 if (!ctx) 424 if (!ctx)
@@ -551,10 +561,8 @@ user:
551 list_del(&uevent->file_list); 561 list_del(&uevent->file_list);
552 list_del(&uevent->ctx_list); 562 list_del(&uevent->ctx_list);
553 563
554 if (uevent->data) 564 kfree(uevent->data);
555 kfree(uevent->data); 565 kfree(uevent->info);
556 if (uevent->info)
557 kfree(uevent->info);
558 kfree(uevent); 566 kfree(uevent);
559done: 567done:
560 up(&file->mutex); 568 up(&file->mutex);
@@ -846,12 +854,9 @@ static ssize_t ib_ucm_send_req(struct ib_ucm_file *file,
846 up(&ctx->file->mutex); 854 up(&ctx->file->mutex);
847 ib_ucm_ctx_put(ctx); /* func reference */ 855 ib_ucm_ctx_put(ctx); /* func reference */
848done: 856done:
849 if (param.private_data) 857 kfree(param.private_data);
850 kfree(param.private_data); 858 kfree(param.primary_path);
851 if (param.primary_path) 859 kfree(param.alternate_path);
852 kfree(param.primary_path);
853 if (param.alternate_path)
854 kfree(param.alternate_path);
855 860
856 return result; 861 return result;
857} 862}
@@ -900,8 +905,7 @@ static ssize_t ib_ucm_send_rep(struct ib_ucm_file *file,
900 up(&ctx->file->mutex); 905 up(&ctx->file->mutex);
901 ib_ucm_ctx_put(ctx); /* func reference */ 906 ib_ucm_ctx_put(ctx); /* func reference */
902done: 907done:
903 if (param.private_data) 908 kfree(param.private_data);
904 kfree(param.private_data);
905 909
906 return result; 910 return result;
907} 911}
@@ -939,8 +943,7 @@ static ssize_t ib_ucm_send_private_data(struct ib_ucm_file *file,
939 up(&ctx->file->mutex); 943 up(&ctx->file->mutex);
940 ib_ucm_ctx_put(ctx); /* func reference */ 944 ib_ucm_ctx_put(ctx); /* func reference */
941done: 945done:
942 if (private_data) 946 kfree(private_data);
943 kfree(private_data);
944 947
945 return result; 948 return result;
946} 949}
@@ -1009,10 +1012,8 @@ static ssize_t ib_ucm_send_info(struct ib_ucm_file *file,
1009 up(&ctx->file->mutex); 1012 up(&ctx->file->mutex);
1010 ib_ucm_ctx_put(ctx); /* func reference */ 1013 ib_ucm_ctx_put(ctx); /* func reference */
1011done: 1014done:
1012 if (data) 1015 kfree(data);
1013 kfree(data); 1016 kfree(info);
1014 if (info)
1015 kfree(info);
1016 1017
1017 return result; 1018 return result;
1018} 1019}
@@ -1063,8 +1064,7 @@ static ssize_t ib_ucm_send_mra(struct ib_ucm_file *file,
1063 up(&ctx->file->mutex); 1064 up(&ctx->file->mutex);
1064 ib_ucm_ctx_put(ctx); /* func reference */ 1065 ib_ucm_ctx_put(ctx); /* func reference */
1065done: 1066done:
1066 if (data) 1067 kfree(data);
1067 kfree(data);
1068 1068
1069 return result; 1069 return result;
1070} 1070}
@@ -1105,10 +1105,8 @@ static ssize_t ib_ucm_send_lap(struct ib_ucm_file *file,
1105 up(&ctx->file->mutex); 1105 up(&ctx->file->mutex);
1106 ib_ucm_ctx_put(ctx); /* func reference */ 1106 ib_ucm_ctx_put(ctx); /* func reference */
1107done: 1107done:
1108 if (data) 1108 kfree(data);
1109 kfree(data); 1109 kfree(path);
1110 if (path)
1111 kfree(path);
1112 1110
1113 return result; 1111 return result;
1114} 1112}
@@ -1157,10 +1155,8 @@ static ssize_t ib_ucm_send_sidr_req(struct ib_ucm_file *file,
1157 up(&ctx->file->mutex); 1155 up(&ctx->file->mutex);
1158 ib_ucm_ctx_put(ctx); /* func reference */ 1156 ib_ucm_ctx_put(ctx); /* func reference */
1159done: 1157done:
1160 if (param.private_data) 1158 kfree(param.private_data);
1161 kfree(param.private_data); 1159 kfree(param.path);
1162 if (param.path)
1163 kfree(param.path);
1164 1160
1165 return result; 1161 return result;
1166} 1162}
@@ -1209,10 +1205,8 @@ static ssize_t ib_ucm_send_sidr_rep(struct ib_ucm_file *file,
1209 up(&ctx->file->mutex); 1205 up(&ctx->file->mutex);
1210 ib_ucm_ctx_put(ctx); /* func reference */ 1206 ib_ucm_ctx_put(ctx); /* func reference */
1211done: 1207done:
1212 if (param.private_data) 1208 kfree(param.private_data);
1213 kfree(param.private_data); 1209 kfree(param.info);
1214 if (param.info)
1215 kfree(param.info);
1216 1210
1217 return result; 1211 return result;
1218} 1212}
@@ -1252,8 +1246,8 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf,
1252 if (copy_from_user(&hdr, buf, sizeof(hdr))) 1246 if (copy_from_user(&hdr, buf, sizeof(hdr)))
1253 return -EFAULT; 1247 return -EFAULT;
1254 1248
1255 printk(KERN_ERR "UCM: Write. cmd <%d> in <%d> out <%d> len <%Zu>\n", 1249 ucm_dbg("Write. cmd <%d> in <%d> out <%d> len <%Zu>\n",
1256 hdr.cmd, hdr.in, hdr.out, len); 1250 hdr.cmd, hdr.in, hdr.out, len);
1257 1251
1258 if (hdr.cmd < 0 || hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) 1252 if (hdr.cmd < 0 || hdr.cmd >= ARRAY_SIZE(ucm_cmd_table))
1259 return -EINVAL; 1253 return -EINVAL;
@@ -1300,7 +1294,7 @@ static int ib_ucm_open(struct inode *inode, struct file *filp)
1300 filp->private_data = file; 1294 filp->private_data = file;
1301 file->filp = filp; 1295 file->filp = filp;
1302 1296
1303 printk(KERN_ERR "UCM: Created struct\n"); 1297 ucm_dbg("Created struct\n");
1304 1298
1305 return 0; 1299 return 0;
1306} 1300}
@@ -1326,7 +1320,7 @@ static int ib_ucm_close(struct inode *inode, struct file *filp)
1326 1320
1327 kfree(file); 1321 kfree(file);
1328 1322
1329 printk(KERN_ERR "UCM: Deleted struct\n"); 1323 ucm_dbg("Deleted struct\n");
1330 return 0; 1324 return 0;
1331} 1325}
1332 1326
@@ -1348,7 +1342,7 @@ static int __init ib_ucm_init(void)
1348 1342
1349 result = register_chrdev_region(IB_UCM_DEV, 1, "infiniband_cm"); 1343 result = register_chrdev_region(IB_UCM_DEV, 1, "infiniband_cm");
1350 if (result) { 1344 if (result) {
1351 printk(KERN_ERR "UCM: Error <%d> registering dev\n", result); 1345 ucm_dbg("Error <%d> registering dev\n", result);
1352 goto err_chr; 1346 goto err_chr;
1353 } 1347 }
1354 1348
@@ -1356,14 +1350,14 @@ static int __init ib_ucm_init(void)
1356 1350
1357 result = cdev_add(&ib_ucm_cdev, IB_UCM_DEV, 1); 1351 result = cdev_add(&ib_ucm_cdev, IB_UCM_DEV, 1);
1358 if (result) { 1352 if (result) {
1359 printk(KERN_ERR "UCM: Error <%d> adding cdev\n", result); 1353 ucm_dbg("Error <%d> adding cdev\n", result);
1360 goto err_cdev; 1354 goto err_cdev;
1361 } 1355 }
1362 1356
1363 ib_ucm_class = class_create(THIS_MODULE, "infiniband_cm"); 1357 ib_ucm_class = class_create(THIS_MODULE, "infiniband_cm");
1364 if (IS_ERR(ib_ucm_class)) { 1358 if (IS_ERR(ib_ucm_class)) {
1365 result = PTR_ERR(ib_ucm_class); 1359 result = PTR_ERR(ib_ucm_class);
1366 printk(KERN_ERR "UCM: Error <%d> creating class\n", result); 1360 ucm_dbg("Error <%d> creating class\n", result);
1367 goto err_class; 1361 goto err_class;
1368 } 1362 }
1369 1363
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 57347f1e82c1..7696022f9a4e 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -61,6 +61,7 @@ struct ib_uverbs_event_file {
61 int fd; 61 int fd;
62 int is_async; 62 int is_async;
63 wait_queue_head_t poll_wait; 63 wait_queue_head_t poll_wait;
64 struct fasync_struct *async_queue;
64 struct list_head event_list; 65 struct list_head event_list;
65}; 66};
66 67
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index fbbe03d8c901..eb99e693dec2 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -257,11 +257,19 @@ static void ib_uverbs_event_release(struct ib_uverbs_event_file *file)
257 spin_unlock_irq(&file->lock); 257 spin_unlock_irq(&file->lock);
258} 258}
259 259
260static int ib_uverbs_event_fasync(int fd, struct file *filp, int on)
261{
262 struct ib_uverbs_event_file *file = filp->private_data;
263
264 return fasync_helper(fd, filp, on, &file->async_queue);
265}
266
260static int ib_uverbs_event_close(struct inode *inode, struct file *filp) 267static int ib_uverbs_event_close(struct inode *inode, struct file *filp)
261{ 268{
262 struct ib_uverbs_event_file *file = filp->private_data; 269 struct ib_uverbs_event_file *file = filp->private_data;
263 270
264 ib_uverbs_event_release(file); 271 ib_uverbs_event_release(file);
272 ib_uverbs_event_fasync(-1, filp, 0);
265 kref_put(&file->uverbs_file->ref, ib_uverbs_release_file); 273 kref_put(&file->uverbs_file->ref, ib_uverbs_release_file);
266 274
267 return 0; 275 return 0;
@@ -276,7 +284,8 @@ static struct file_operations uverbs_event_fops = {
276 */ 284 */
277 .read = ib_uverbs_event_read, 285 .read = ib_uverbs_event_read,
278 .poll = ib_uverbs_event_poll, 286 .poll = ib_uverbs_event_poll,
279 .release = ib_uverbs_event_close 287 .release = ib_uverbs_event_close,
288 .fasync = ib_uverbs_event_fasync
280}; 289};
281 290
282void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) 291void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)
@@ -296,6 +305,7 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)
296 spin_unlock_irqrestore(&file->comp_file[0].lock, flags); 305 spin_unlock_irqrestore(&file->comp_file[0].lock, flags);
297 306
298 wake_up_interruptible(&file->comp_file[0].poll_wait); 307 wake_up_interruptible(&file->comp_file[0].poll_wait);
308 kill_fasync(&file->comp_file[0].async_queue, SIGIO, POLL_IN);
299} 309}
300 310
301static void ib_uverbs_async_handler(struct ib_uverbs_file *file, 311static void ib_uverbs_async_handler(struct ib_uverbs_file *file,
@@ -316,6 +326,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file,
316 spin_unlock_irqrestore(&file->async_file.lock, flags); 326 spin_unlock_irqrestore(&file->async_file.lock, flags);
317 327
318 wake_up_interruptible(&file->async_file.poll_wait); 328 wake_up_interruptible(&file->async_file.poll_wait);
329 kill_fasync(&file->async_file.async_queue, SIGIO, POLL_IN);
319} 330}
320 331
321void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr) 332void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr)
@@ -350,6 +361,7 @@ static int ib_uverbs_event_init(struct ib_uverbs_event_file *file,
350 INIT_LIST_HEAD(&file->event_list); 361 INIT_LIST_HEAD(&file->event_list);
351 init_waitqueue_head(&file->poll_wait); 362 init_waitqueue_head(&file->poll_wait);
352 file->uverbs_file = uverbs_file; 363 file->uverbs_file = uverbs_file;
364 file->async_queue = NULL;
353 365
354 file->fd = get_unused_fd(); 366 file->fd = get_unused_fd();
355 if (file->fd < 0) 367 if (file->fd < 0)
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index b5aea7b869f6..5687c3014522 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -373,8 +373,12 @@ static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
373 * If we're at the end of the WQE chain, or we've used up our 373 * If we're at the end of the WQE chain, or we've used up our
374 * doorbell count, free the CQE. Otherwise just update it for 374 * doorbell count, free the CQE. Otherwise just update it for
375 * the next poll operation. 375 * the next poll operation.
376 *
377 * This does not apply to mem-free HCAs: they don't use the
378 * doorbell count field, and so we should always free the CQE.
376 */ 379 */
377 if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) 380 if (mthca_is_memfree(dev) ||
381 !(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd))
378 return 0; 382 return 0;
379 383
380 cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd); 384 cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd);
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 7a58ce90e179..81919a7b4935 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -349,9 +349,9 @@ static int mthca_mmap_uar(struct ib_ucontext *context,
349 349
350 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 350 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
351 351
352 if (remap_pfn_range(vma, vma->vm_start, 352 if (io_remap_pfn_range(vma, vma->vm_start,
353 to_mucontext(context)->uar.pfn, 353 to_mucontext(context)->uar.pfn,
354 PAGE_SIZE, vma->vm_page_prot)) 354 PAGE_SIZE, vma->vm_page_prot))
355 return -EAGAIN; 355 return -EAGAIN;
356 356
357 return 0; 357 return 0;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8238766746b2..eee82363167d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -81,7 +81,7 @@ void ipoib_free_ah(struct kref *kref)
81 81
82 unsigned long flags; 82 unsigned long flags;
83 83
84 if (ah->last_send <= priv->tx_tail) { 84 if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
85 ipoib_dbg(priv, "Freeing ah %p\n", ah->ah); 85 ipoib_dbg(priv, "Freeing ah %p\n", ah->ah);
86 ib_destroy_ah(ah->ah); 86 ib_destroy_ah(ah->ah);
87 kfree(ah); 87 kfree(ah);
@@ -355,7 +355,7 @@ static void __ipoib_reap_ah(struct net_device *dev)
355 355
356 spin_lock_irq(&priv->lock); 356 spin_lock_irq(&priv->lock);
357 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list) 357 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list)
358 if (ah->last_send <= priv->tx_tail) { 358 if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
359 list_del(&ah->list); 359 list_del(&ah->list);
360 list_add_tail(&ah->list, &remove_list); 360 list_add_tail(&ah->list, &remove_list);
361 } 361 }
@@ -486,7 +486,7 @@ int ipoib_ib_dev_stop(struct net_device *dev)
486 * assume the HW is wedged and just free up 486 * assume the HW is wedged and just free up
487 * all our pending work requests. 487 * all our pending work requests.
488 */ 488 */
489 while (priv->tx_tail < priv->tx_head) { 489 while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
490 tx_req = &priv->tx_ring[priv->tx_tail & 490 tx_req = &priv->tx_ring[priv->tx_tail &
491 (IPOIB_TX_RING_SIZE - 1)]; 491 (IPOIB_TX_RING_SIZE - 1)];
492 dma_unmap_single(priv->ca->dma_device, 492 dma_unmap_single(priv->ca->dma_device,
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index b96d6fb1929e..2c6dc24c3728 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1450,6 +1450,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1450 /* Write the contents of the packet */ 1450 /* Write the contents of the packet */
1451 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); 1451 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
1452 spin_unlock_irq(&lp->lock); 1452 spin_unlock_irq(&lp->lock);
1453 lp->stats.tx_bytes += skb->len;
1453 dev->trans_start = jiffies; 1454 dev->trans_start = jiffies;
1454 dev_kfree_skb (skb); 1455 dev_kfree_skb (skb);
1455 1456
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cb7f051a60ad..5e5d2c3c7ce4 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -162,7 +162,6 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
162static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); 162static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
163static void e1000_restore_vlan(struct e1000_adapter *adapter); 163static void e1000_restore_vlan(struct e1000_adapter *adapter);
164 164
165static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
166static int e1000_suspend(struct pci_dev *pdev, uint32_t state); 165static int e1000_suspend(struct pci_dev *pdev, uint32_t state);
167#ifdef CONFIG_PM 166#ifdef CONFIG_PM
168static int e1000_resume(struct pci_dev *pdev); 167static int e1000_resume(struct pci_dev *pdev);
@@ -173,12 +172,6 @@ static int e1000_resume(struct pci_dev *pdev);
173static void e1000_netpoll (struct net_device *netdev); 172static void e1000_netpoll (struct net_device *netdev);
174#endif 173#endif
175 174
176struct notifier_block e1000_notifier_reboot = {
177 .notifier_call = e1000_notify_reboot,
178 .next = NULL,
179 .priority = 0
180};
181
182/* Exported from other modules */ 175/* Exported from other modules */
183 176
184extern void e1000_check_options(struct e1000_adapter *adapter); 177extern void e1000_check_options(struct e1000_adapter *adapter);
@@ -221,9 +214,7 @@ e1000_init_module(void)
221 printk(KERN_INFO "%s\n", e1000_copyright); 214 printk(KERN_INFO "%s\n", e1000_copyright);
222 215
223 ret = pci_module_init(&e1000_driver); 216 ret = pci_module_init(&e1000_driver);
224 if(ret >= 0) { 217
225 register_reboot_notifier(&e1000_notifier_reboot);
226 }
227 return ret; 218 return ret;
228} 219}
229 220
@@ -239,7 +230,6 @@ module_init(e1000_init_module);
239static void __exit 230static void __exit
240e1000_exit_module(void) 231e1000_exit_module(void)
241{ 232{
242 unregister_reboot_notifier(&e1000_notifier_reboot);
243 pci_unregister_driver(&e1000_driver); 233 pci_unregister_driver(&e1000_driver);
244} 234}
245 235
@@ -3652,23 +3642,6 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
3652} 3642}
3653 3643
3654static int 3644static int
3655e1000_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
3656{
3657 struct pci_dev *pdev = NULL;
3658
3659 switch(event) {
3660 case SYS_DOWN:
3661 case SYS_HALT:
3662 case SYS_POWER_OFF:
3663 while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
3664 if(pci_dev_driver(pdev) == &e1000_driver)
3665 e1000_suspend(pdev, 3);
3666 }
3667 }
3668 return NOTIFY_DONE;
3669}
3670
3671static int
3672e1000_suspend(struct pci_dev *pdev, uint32_t state) 3645e1000_suspend(struct pci_dev *pdev, uint32_t state)
3673{ 3646{
3674 struct net_device *netdev = pci_get_drvdata(pdev); 3647 struct net_device *netdev = pci_get_drvdata(pdev);
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index dbb941004ae9..980d7e5d66cb 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -1671,7 +1671,7 @@ static void set_multicast_list(struct net_device *dev)
1671 1671
1672static struct pcmcia_device_id nmclan_ids[] = { 1672static struct pcmcia_device_id nmclan_ids[] = {
1673 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941), 1673 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941),
1674 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet", 0x0ebf1d60, 0x00b2e941), 1674 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf),
1675 PCMCIA_DEVICE_NULL, 1675 PCMCIA_DEVICE_NULL,
1676}; 1676};
1677MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); 1677MODULE_DEVICE_TABLE(pcmcia, nmclan_ids);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index e1664aef3dfd..9f22d138e3ad 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1639,7 +1639,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1639 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab), 1639 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab),
1640 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101), 1640 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101),
1641 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), 1641 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab),
1642 PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 1642 PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
1643 PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 1643 PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
1644 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 1644 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
1645 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 1645 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
@@ -1683,7 +1683,6 @@ static struct pcmcia_device_id pcnet_ids[] = {
1683 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11), 1683 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11),
1684 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff), 1684 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff),
1685 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), 1685 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68),
1686 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM", 0xbb7fbdd7, 0x5ba10d49),
1687 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), 1686 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997),
1688 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), 1687 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8),
1689 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), 1688 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96),
@@ -1719,6 +1718,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1719 PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e), 1718 PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e),
1720 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398), 1719 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398),
1721 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b), 1720 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b),
1721 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660+", 0x1a424a1c, 0x50dcd0ec),
1722 PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), 1722 PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9),
1723 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), 1723 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84),
1724 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), 1724 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9),
@@ -1737,6 +1737,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1737 PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), 1737 PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947),
1738 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), 1738 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941),
1739 PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), 1739 PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6),
1740 PCMCIA_DEVICE_PROD_ID12("IC-CARD+", "IC-CARD+", 0x93693494, 0x93693494),
1740 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), 1741 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b),
1741 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), 1742 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0),
1742 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), 1743 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956),
@@ -1753,7 +1754,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1753 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), 1754 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d),
1754 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), 1755 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389),
1755 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), 1756 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9),
1756 PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline ", 0x0733cc81, 0x5e07cfa0), 1757 PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline + 10/100 Network PC Card (PCM100H1)", 0x733cc81, 0x7a3e5c3a),
1757 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), 1758 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737),
1758 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), 1759 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922),
1759 PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), 1760 PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0),
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 0d8bb4cccbb7..d652e1eddb45 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -2332,8 +2332,8 @@ static struct pcmcia_device_id smc91c92_ids[] = {
2332 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef), 2332 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef),
2333 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 2333 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
2334 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 2334 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
2335 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2335 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
2336 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2336 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
2337 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020), 2337 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020),
2338 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023), 2338 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023),
2339 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb), 2339 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb),
@@ -2343,8 +2343,8 @@ static struct pcmcia_device_id smc91c92_ids[] = {
2343 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9), 2343 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9),
2344 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953), 2344 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953),
2345 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a), 2345 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a),
2346 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2346 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Four of Diamonds Ethernet", 0xc2f80cd, 0xb3466314),
2347 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2347 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Seven of Diamonds Ethernet", 0xc2f80cd, 0x194b650a),
2348 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc), 2348 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc),
2349 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9), 2349 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9),
2350 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d), 2350 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d),
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 9f33bad174e9..ce143f08638a 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1985,7 +1985,7 @@ static struct pcmcia_device_id xirc2ps_ids[] = {
1985 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 1985 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
1986 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 1986 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
1987 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 1987 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
1988 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 1988 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
1989 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a), 1989 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a),
1990 PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2), 1990 PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2),
1991 PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37), 1991 PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37),
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 368d2f962f67..1cc1492083c9 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -621,8 +621,6 @@ static struct pcmcia_device_id orinoco_cs_ids[] = {
621 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), 621 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021),
622 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), 622 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
624 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
625 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
626 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 624 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
627 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), 625 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
628 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), 626 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 0a5c95807cf2..470ef756252e 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -388,6 +388,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
388 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 388 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
389 memset(skt, 0, sizeof(*skt)); 389 memset(skt, 0, sizeof(*skt));
390 390
391 skt->socket.resource_ops = &pccard_static_ops;
391 skt->socket.ops = &au1x00_pcmcia_operations; 392 skt->socket.ops = &au1x00_pcmcia_operations;
392 skt->socket.owner = ops->owner; 393 skt->socket.owner = ops->owner;
393 skt->socket.dev.dev = dev; 394 skt->socket.dev.dev = dev;
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index dd7651ff5b43..3afb682255a0 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -88,31 +88,38 @@ EXPORT_SYMBOL(release_cis_mem);
88static void __iomem * 88static void __iomem *
89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) 89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
90{ 90{
91 pccard_mem_map *mem = &s->cis_mem; 91 pccard_mem_map *mem = &s->cis_mem;
92 int ret; 92 int ret;
93
94 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s);
96 if (mem->res == NULL) {
97 printk(KERN_NOTICE "cs: unable to map card memory!\n");
98 return NULL;
99 }
100 s->cis_virt = NULL;
101 }
93 102
94 if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { 103 if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt))
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 104 s->cis_virt = ioremap(mem->res->start, s->map_size);
96 if (mem->res == NULL) { 105
97 printk(KERN_NOTICE "cs: unable to map card memory!\n"); 106 mem->card_start = card_offset;
98 return NULL; 107 mem->flags = flags;
108
109 ret = s->ops->set_mem_map(s, mem);
110 if (ret) {
111 iounmap(s->cis_virt);
112 s->cis_virt = NULL;
113 return NULL;
99 } 114 }
100 s->cis_virt = ioremap(mem->res->start, s->map_size);
101 }
102 mem->card_start = card_offset;
103 mem->flags = flags;
104 ret = s->ops->set_mem_map(s, mem);
105 if (ret) {
106 iounmap(s->cis_virt);
107 return NULL;
108 }
109 115
110 if (s->features & SS_CAP_STATIC_MAP) { 116 if (s->features & SS_CAP_STATIC_MAP) {
111 if (s->cis_virt) 117 if (s->cis_virt)
112 iounmap(s->cis_virt); 118 iounmap(s->cis_virt);
113 s->cis_virt = ioremap(mem->static_start, s->map_size); 119 s->cis_virt = ioremap(mem->static_start, s->map_size);
114 } 120 }
115 return s->cis_virt; 121
122 return s->cis_virt;
116} 123}
117 124
118/*====================================================================== 125/*======================================================================
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 3e3c6f12bbe6..d63f22a5bf7e 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -206,8 +206,8 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
206 u32 hash; 206 u32 hash;
207 207
208 if (!p_drv->attach || !p_drv->event || !p_drv->detach) 208 if (!p_drv->attach || !p_drv->event || !p_drv->detach)
209 printk(KERN_DEBUG "pcmcia: %s does misses a callback function", 209 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback "
210 p_drv->drv.name); 210 "function\n", p_drv->drv.name);
211 211
212 while (did && did->match_flags) { 212 while (did && did->match_flags) {
213 for (i=0; i<4; i++) { 213 for (i=0; i<4; i++) {
diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h
index b1f6e3d9ee06..a234ce1967a3 100644
--- a/drivers/pcmcia/o2micro.h
+++ b/drivers/pcmcia/o2micro.h
@@ -120,11 +120,16 @@
120#define O2_MODE_E_LED_OUT 0x08 120#define O2_MODE_E_LED_OUT 0x08
121#define O2_MODE_E_SKTA_ACTV 0x10 121#define O2_MODE_E_SKTA_ACTV 0x10
122 122
123#define O2_RESERVED1 0x94
124#define O2_RESERVED2 0xD4
125#define O2_RES_READ_PREFETCH 0x02
126#define O2_RES_WRITE_BURST 0x08
127
123static int o2micro_override(struct yenta_socket *socket) 128static int o2micro_override(struct yenta_socket *socket)
124{ 129{
125 /* 130 /*
126 * 'reserved' register at 0x94/D4. chaning it to 0xCA (8 bit) enables 131 * 'reserved' register at 0x94/D4. allows setting read prefetch and write
127 * read prefetching which for example makes the RME Hammerfall DSP 132 * bursting. read prefetching for example makes the RME Hammerfall DSP
128 * working. for some bridges it is at 0x94, for others at 0xD4. it's 133 * working. for some bridges it is at 0x94, for others at 0xD4. it's
129 * ok to write to both registers on all O2 bridges. 134 * ok to write to both registers on all O2 bridges.
130 * from Eric Still, 02Micro. 135 * from Eric Still, 02Micro.
@@ -132,20 +137,35 @@ static int o2micro_override(struct yenta_socket *socket)
132 u8 a, b; 137 u8 a, b;
133 138
134 if (PCI_FUNC(socket->dev->devfn) == 0) { 139 if (PCI_FUNC(socket->dev->devfn) == 0) {
135 a = config_readb(socket, 0x94); 140 a = config_readb(socket, O2_RESERVED1);
136 b = config_readb(socket, 0xD4); 141 b = config_readb(socket, O2_RESERVED2);
137 142
138 printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b); 143 printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b);
139 144
140 switch (socket->dev->device) { 145 switch (socket->dev->device) {
146 /*
147 * older bridges have problems with both read prefetch and write
148 * bursting depending on the combination of the chipset, bridge
149 * and the cardbus card. so disable them to be on the safe side.
150 */
151 case PCI_DEVICE_ID_O2_6729:
152 case PCI_DEVICE_ID_O2_6730:
153 case PCI_DEVICE_ID_O2_6812:
141 case PCI_DEVICE_ID_O2_6832: 154 case PCI_DEVICE_ID_O2_6832:
142 printk(KERN_INFO "Yenta O2: old bridge, not enabling read prefetch / write burst\n"); 155 case PCI_DEVICE_ID_O2_6836:
156 printk(KERN_INFO "Yenta O2: old bridge, disabling read prefetch/write burst\n");
157 config_writeb(socket, O2_RESERVED1,
158 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
159 config_writeb(socket, O2_RESERVED2,
160 b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
143 break; 161 break;
144 162
145 default: 163 default:
146 printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n"); 164 printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n");
147 config_writeb(socket, 0x94, a | 0x0a); 165 config_writeb(socket, O2_RESERVED1,
148 config_writeb(socket, 0xD4, b | 0x0a); 166 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
167 config_writeb(socket, O2_RESERVED2,
168 b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
149 } 169 }
150 } 170 }
151 171
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 184f4f88b2a0..6f9fdb276402 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -800,7 +800,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
800 } else { 800 } else {
801 int try; 801 int try;
802 u32 mask = s->irq_mask; 802 u32 mask = s->irq_mask;
803 void *data = NULL; 803 void *data = &p_dev->dev.driver; /* something unique to this device */
804 804
805 for (try = 0; try < 64; try++) { 805 for (try = 0; try < 64; try++) {
806 irq = try % 32; 806 irq = try % 32;
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 6837491f021c..744e469a9eda 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1107,6 +1107,8 @@ static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
1107 pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); 1107 pci_read_config_dword(dev, 17*4, &socket->saved_state[1]);
1108 pci_disable_device(dev); 1108 pci_disable_device(dev);
1109 1109
1110 free_irq(dev->irq, socket);
1111
1110 /* 1112 /*
1111 * Some laptops (IBM T22) do not like us putting the Cardbus 1113 * Some laptops (IBM T22) do not like us putting the Cardbus
1112 * bridge into D3. At a guess, some other laptop will 1114 * bridge into D3. At a guess, some other laptop will
@@ -1132,6 +1134,13 @@ static int yenta_dev_resume (struct pci_dev *dev)
1132 pci_enable_device(dev); 1134 pci_enable_device(dev);
1133 pci_set_master(dev); 1135 pci_set_master(dev);
1134 1136
1137 if (socket->cb_irq)
1138 if (request_irq(socket->cb_irq, yenta_interrupt,
1139 SA_SHIRQ, "yenta", socket)) {
1140 printk(KERN_WARNING "Yenta: request_irq() failed on resume!\n");
1141 socket->cb_irq = 0;
1142 }
1143
1135 if (socket->type && socket->type->restore_state) 1144 if (socket->type && socket->type->restore_state)
1136 socket->type->restore_state(socket); 1145 socket->type->restore_state(socket);
1137 } 1146 }
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
index 6c73b84c6e64..c1c1c687bcbd 100644
--- a/drivers/scsi/qla2xxx/Kconfig
+++ b/drivers/scsi/qla2xxx/Kconfig
@@ -7,6 +7,7 @@ config SCSI_QLA21XX
7 tristate "QLogic ISP2100 host adapter family support" 7 tristate "QLogic ISP2100 host adapter family support"
8 depends on SCSI_QLA2XXX 8 depends on SCSI_QLA2XXX
9 select SCSI_FC_ATTRS 9 select SCSI_FC_ATTRS
10 select FW_LOADER
10 ---help--- 11 ---help---
11 This driver supports the QLogic 21xx (ISP2100) host adapter family. 12 This driver supports the QLogic 21xx (ISP2100) host adapter family.
12 13
@@ -14,6 +15,7 @@ config SCSI_QLA22XX
14 tristate "QLogic ISP2200 host adapter family support" 15 tristate "QLogic ISP2200 host adapter family support"
15 depends on SCSI_QLA2XXX 16 depends on SCSI_QLA2XXX
16 select SCSI_FC_ATTRS 17 select SCSI_FC_ATTRS
18 select FW_LOADER
17 ---help--- 19 ---help---
18 This driver supports the QLogic 22xx (ISP2200) host adapter family. 20 This driver supports the QLogic 22xx (ISP2200) host adapter family.
19 21
@@ -21,6 +23,7 @@ config SCSI_QLA2300
21 tristate "QLogic ISP2300 host adapter family support" 23 tristate "QLogic ISP2300 host adapter family support"
22 depends on SCSI_QLA2XXX 24 depends on SCSI_QLA2XXX
23 select SCSI_FC_ATTRS 25 select SCSI_FC_ATTRS
26 select FW_LOADER
24 ---help--- 27 ---help---
25 This driver supports the QLogic 2300 (ISP2300 and ISP2312) host 28 This driver supports the QLogic 2300 (ISP2300 and ISP2312) host
26 adapter family. 29 adapter family.
@@ -29,6 +32,7 @@ config SCSI_QLA2322
29 tristate "QLogic ISP2322 host adapter family support" 32 tristate "QLogic ISP2322 host adapter family support"
30 depends on SCSI_QLA2XXX 33 depends on SCSI_QLA2XXX
31 select SCSI_FC_ATTRS 34 select SCSI_FC_ATTRS
35 select FW_LOADER
32 ---help--- 36 ---help---
33 This driver supports the QLogic 2322 (ISP2322) host adapter family. 37 This driver supports the QLogic 2322 (ISP2322) host adapter family.
34 38
@@ -36,6 +40,16 @@ config SCSI_QLA6312
36 tristate "QLogic ISP63xx host adapter family support" 40 tristate "QLogic ISP63xx host adapter family support"
37 depends on SCSI_QLA2XXX 41 depends on SCSI_QLA2XXX
38 select SCSI_FC_ATTRS 42 select SCSI_FC_ATTRS
43 select FW_LOADER
39 ---help--- 44 ---help---
40 This driver supports the QLogic 63xx (ISP6312 and ISP6322) host 45 This driver supports the QLogic 63xx (ISP6312 and ISP6322) host
41 adapter family. 46 adapter family.
47
48config SCSI_QLA24XX
49 tristate "QLogic ISP24xx host adapter family support"
50 depends on SCSI_QLA2XXX
51 select SCSI_FC_ATTRS
52 select FW_LOADER
53 ---help---
54 This driver supports the QLogic 24xx (ISP2422 and ISP2432) host
55 adapter family.
diff --git a/drivers/scsi/qla2xxx/Makefile b/drivers/scsi/qla2xxx/Makefile
index 00d2e3c21ef6..b169687d08ff 100644
--- a/drivers/scsi/qla2xxx/Makefile
+++ b/drivers/scsi/qla2xxx/Makefile
@@ -1,5 +1,4 @@
1EXTRA_CFLAGS += -DUNIQUE_FW_NAME 1EXTRA_CFLAGS += -DUNIQUE_FW_NAME
2EXTRA_CFLAGS += -DCONFIG_SCSI_QLA24XX -DCONFIG_SCSI_QLA24XX_MODULE
3 2
4qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ 3qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
5 qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o 4 qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index de0136cc5938..1ae0b381c162 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -790,19 +790,19 @@ static struct pcmcia_device_id serial_ids[] = {
790 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 790 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
791 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 791 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
792 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 792 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
793 PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 793 PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
794 PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 794 PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
795 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 795 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
796 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 796 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
797 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 797 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
798 PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), 798 PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58),
799 PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 799 PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
800 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 800 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
801 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 801 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
802 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), 802 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc),
803 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), 803 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f),
804 PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed), 804 PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed),
805 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 805 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
806 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), 806 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070),
807 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), 807 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562),
808 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070), 808 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070),
@@ -840,7 +840,7 @@ static struct pcmcia_device_id serial_ids[] = {
840 PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed), 840 PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed),
841 PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65), 841 PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65),
842 PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6), 842 PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6),
843 PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400", 0x816cc815, 0x23539b80), 843 PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400+", 0x816cc815, 0x412729fb),
844 PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f), 844 PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f),
845 PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f), 845 PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f),
846 PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383), 846 PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383),
diff --git a/fs/bio.c b/fs/bio.c
index ca8f7a850fe3..249dd6bb66c8 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -261,6 +261,7 @@ inline void __bio_clone(struct bio *bio, struct bio *bio_src)
261 */ 261 */
262 bio->bi_vcnt = bio_src->bi_vcnt; 262 bio->bi_vcnt = bio_src->bi_vcnt;
263 bio->bi_size = bio_src->bi_size; 263 bio->bi_size = bio_src->bi_size;
264 bio->bi_idx = bio_src->bi_idx;
264 bio_phys_segments(q, bio); 265 bio_phys_segments(q, bio);
265 bio_hw_segments(q, bio); 266 bio_hw_segments(q, bio);
266} 267}
diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h
index 9950706abdf8..a3d09d14fee2 100644
--- a/include/asm-alpha/smp.h
+++ b/include/asm-alpha/smp.h
@@ -50,11 +50,16 @@ extern cpumask_t cpu_online_map;
50extern int smp_num_cpus; 50extern int smp_num_cpus;
51#define cpu_possible_map cpu_present_mask 51#define cpu_possible_map cpu_present_mask
52 52
53int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, cpumask_t cpu); 53int smp_call_function_on_cpu(void (*) (void *), void *, int, int, cpumask_t);
54 54
55#else /* CONFIG_SMP */ 55#else /* CONFIG_SMP */
56 56
57#define smp_call_function_on_cpu(func,info,retry,wait,cpu) ({ 0; }) 57static inline int
58smp_call_function_on_cpu (void (*func) (void *), void *info, int retry,
59 int wait, cpumask_t cpu)
60{
61 return 0;
62}
58 63
59#endif /* CONFIG_SMP */ 64#endif /* CONFIG_SMP */
60 65
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 9db0b712d57a..1caee1039363 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -311,6 +311,20 @@ static inline int find_first_zero_bit(const unsigned long *addr, unsigned size)
311int find_next_zero_bit(const unsigned long *addr, int size, int offset); 311int find_next_zero_bit(const unsigned long *addr, int size, int offset);
312 312
313/** 313/**
314 * __ffs - find first bit in word.
315 * @word: The word to search
316 *
317 * Undefined if no bit exists, so code should check against 0 first.
318 */
319static inline unsigned long __ffs(unsigned long word)
320{
321 __asm__("bsfl %1,%0"
322 :"=r" (word)
323 :"rm" (word));
324 return word;
325}
326
327/**
314 * find_first_bit - find the first set bit in a memory region 328 * find_first_bit - find the first set bit in a memory region
315 * @addr: The address to start the search at 329 * @addr: The address to start the search at
316 * @size: The maximum size to search 330 * @size: The maximum size to search
@@ -320,22 +334,16 @@ int find_next_zero_bit(const unsigned long *addr, int size, int offset);
320 */ 334 */
321static inline int find_first_bit(const unsigned long *addr, unsigned size) 335static inline int find_first_bit(const unsigned long *addr, unsigned size)
322{ 336{
323 int d0, d1; 337 int x = 0;
324 int res; 338 do {
325 339 if (*addr)
326 /* This looks at memory. Mark it volatile to tell gcc not to move it around */ 340 return __ffs(*addr) + x;
327 __asm__ __volatile__( 341 addr++;
328 "xorl %%eax,%%eax\n\t" 342 if (x >= size)
329 "repe; scasl\n\t" 343 break;
330 "jz 1f\n\t" 344 x += (sizeof(*addr)<<3);
331 "leal -4(%%edi),%%edi\n\t" 345 } while (1);
332 "bsfl (%%edi),%%eax\n" 346 return x;
333 "1:\tsubl %%ebx,%%edi\n\t"
334 "shll $3,%%edi\n\t"
335 "addl %%edi,%%eax"
336 :"=a" (res), "=&c" (d0), "=&D" (d1)
337 :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
338 return res;
339} 347}
340 348
341/** 349/**
@@ -360,20 +368,6 @@ static inline unsigned long ffz(unsigned long word)
360 return word; 368 return word;
361} 369}
362 370
363/**
364 * __ffs - find first bit in word.
365 * @word: The word to search
366 *
367 * Undefined if no bit exists, so code should check against 0 first.
368 */
369static inline unsigned long __ffs(unsigned long word)
370{
371 __asm__("bsfl %1,%0"
372 :"=r" (word)
373 :"rm" (word));
374 return word;
375}
376
377/* 371/*
378 * fls: find last bit set. 372 * fls: find last bit set.
379 */ 373 */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 9dfa3ee769ae..22b451d1b93f 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -94,11 +94,23 @@ void smp_prepare_boot_cpu(void);
94 */ 94 */
95#define raw_smp_processor_id() 0 95#define raw_smp_processor_id() 0
96#define hard_smp_processor_id() 0 96#define hard_smp_processor_id() 0
97#define smp_call_function(func,info,retry,wait) ({ 0; })
98#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; })
99static inline void smp_send_reschedule(int cpu) { }
100#define num_booting_cpus() 1 97#define num_booting_cpus() 1
101#define smp_prepare_boot_cpu() do {} while (0) 98
99static inline int smp_call_function(void (*func) (void *), void *info,
100 int retry, int wait)
101{
102 return 0;
103}
104
105static inline int on_each_cpu(void (*func) (void *), void *info,
106 int retry, int wait)
107{
108 func(info);
109 return 0;
110}
111
112static inline void smp_send_reschedule(int cpu) { }
113static inline void smp_prepare_boot_cpu(void) { }
102 114
103#endif /* !SMP */ 115#endif /* !SMP */
104 116
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 6be273851144..10fd51c9056d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -826,7 +826,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
826 sid = sbsec->def_sid; 826 sid = sbsec->def_sid;
827 rc = 0; 827 rc = 0;
828 } else { 828 } else {
829 rc = security_context_to_sid(context, rc, &sid); 829 rc = security_context_to_sid_default(context, rc, &sid,
830 sbsec->def_sid);
830 if (rc) { 831 if (rc) {
831 printk(KERN_WARNING "%s: context_to_sid(%s) " 832 printk(KERN_WARNING "%s: context_to_sid(%s) "
832 "returned %d for dev=%s ino=%ld\n", 833 "returned %d for dev=%s ino=%ld\n",
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index fa187c9a351d..71c0a19c9753 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -65,6 +65,8 @@ int security_sid_to_context(u32 sid, char **scontext,
65int security_context_to_sid(char *scontext, u32 scontext_len, 65int security_context_to_sid(char *scontext, u32 scontext_len,
66 u32 *out_sid); 66 u32 *out_sid);
67 67
68int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *out_sid, u32 def_sid);
69
68int security_get_user_sids(u32 callsid, char *username, 70int security_get_user_sids(u32 callsid, char *username,
69 u32 **sids, u32 *nel); 71 u32 **sids, u32 *nel);
70 72
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index 756036bcc243..d4c32c39ccc9 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -15,6 +15,7 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include "sidtab.h"
18#include "mls.h" 19#include "mls.h"
19#include "policydb.h" 20#include "policydb.h"
20#include "services.h" 21#include "services.h"
@@ -208,6 +209,26 @@ int mls_context_isvalid(struct policydb *p, struct context *c)
208} 209}
209 210
210/* 211/*
212 * Copies the MLS range from `src' into `dst'.
213 */
214static inline int mls_copy_context(struct context *dst,
215 struct context *src)
216{
217 int l, rc = 0;
218
219 /* Copy the MLS range from the source context */
220 for (l = 0; l < 2; l++) {
221 dst->range.level[l].sens = src->range.level[l].sens;
222 rc = ebitmap_cpy(&dst->range.level[l].cat,
223 &src->range.level[l].cat);
224 if (rc)
225 break;
226 }
227
228 return rc;
229}
230
231/*
211 * Set the MLS fields in the security context structure 232 * Set the MLS fields in the security context structure
212 * `context' based on the string representation in 233 * `context' based on the string representation in
213 * the string `*scontext'. Update `*scontext' to 234 * the string `*scontext'. Update `*scontext' to
@@ -216,10 +237,20 @@ int mls_context_isvalid(struct policydb *p, struct context *c)
216 * 237 *
217 * This function modifies the string in place, inserting 238 * This function modifies the string in place, inserting
218 * NULL characters to terminate the MLS fields. 239 * NULL characters to terminate the MLS fields.
240 *
241 * If a def_sid is provided and no MLS field is present,
242 * copy the MLS field of the associated default context.
243 * Used for upgraded to MLS systems where objects may lack
244 * MLS fields.
245 *
246 * Policy read-lock must be held for sidtab lookup.
247 *
219 */ 248 */
220int mls_context_to_sid(char oldc, 249int mls_context_to_sid(char oldc,
221 char **scontext, 250 char **scontext,
222 struct context *context) 251 struct context *context,
252 struct sidtab *s,
253 u32 def_sid)
223{ 254{
224 255
225 char delim; 256 char delim;
@@ -231,9 +262,23 @@ int mls_context_to_sid(char oldc,
231 if (!selinux_mls_enabled) 262 if (!selinux_mls_enabled)
232 return 0; 263 return 0;
233 264
234 /* No MLS component to the security context. */ 265 /*
235 if (!oldc) 266 * No MLS component to the security context, try and map to
267 * default if provided.
268 */
269 if (!oldc) {
270 struct context *defcon;
271
272 if (def_sid == SECSID_NULL)
273 goto out;
274
275 defcon = sidtab_search(s, def_sid);
276 if (!defcon)
277 goto out;
278
279 rc = mls_copy_context(context, defcon);
236 goto out; 280 goto out;
281 }
237 282
238 /* Extract low sensitivity. */ 283 /* Extract low sensitivity. */
239 scontextp = p = *scontext; 284 scontextp = p = *scontext;
@@ -334,26 +379,6 @@ out:
334} 379}
335 380
336/* 381/*
337 * Copies the MLS range from `src' into `dst'.
338 */
339static inline int mls_copy_context(struct context *dst,
340 struct context *src)
341{
342 int l, rc = 0;
343
344 /* Copy the MLS range from the source context */
345 for (l = 0; l < 2; l++) {
346 dst->range.level[l].sens = src->range.level[l].sens;
347 rc = ebitmap_cpy(&dst->range.level[l].cat,
348 &src->range.level[l].cat);
349 if (rc)
350 break;
351 }
352
353 return rc;
354}
355
356/*
357 * Copies the effective MLS range from `src' into `dst'. 382 * Copies the effective MLS range from `src' into `dst'.
358 */ 383 */
359static inline int mls_scopy_context(struct context *dst, 384static inline int mls_scopy_context(struct context *dst,
diff --git a/security/selinux/ss/mls.h b/security/selinux/ss/mls.h
index 0d37beaa85e2..03de697c8058 100644
--- a/security/selinux/ss/mls.h
+++ b/security/selinux/ss/mls.h
@@ -23,7 +23,9 @@ int mls_context_isvalid(struct policydb *p, struct context *c);
23 23
24int mls_context_to_sid(char oldc, 24int mls_context_to_sid(char oldc,
25 char **scontext, 25 char **scontext,
26 struct context *context); 26 struct context *context,
27 struct sidtab *s,
28 u32 def_sid);
27 29
28int mls_convert_context(struct policydb *oldp, 30int mls_convert_context(struct policydb *oldp,
29 struct policydb *newp, 31 struct policydb *newp,
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 922bb45054aa..014120474e69 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -601,18 +601,7 @@ out:
601 601
602} 602}
603 603
604/** 604static int security_context_to_sid_core(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid)
605 * security_context_to_sid - Obtain a SID for a given security context.
606 * @scontext: security context
607 * @scontext_len: length in bytes
608 * @sid: security identifier, SID
609 *
610 * Obtains a SID associated with the security context that
611 * has the string representation specified by @scontext.
612 * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
613 * memory is available, or 0 on success.
614 */
615int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
616{ 605{
617 char *scontext2; 606 char *scontext2;
618 struct context context; 607 struct context context;
@@ -703,7 +692,7 @@ int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
703 692
704 context.type = typdatum->value; 693 context.type = typdatum->value;
705 694
706 rc = mls_context_to_sid(oldc, &p, &context); 695 rc = mls_context_to_sid(oldc, &p, &context, &sidtab, def_sid);
707 if (rc) 696 if (rc)
708 goto out_unlock; 697 goto out_unlock;
709 698
@@ -727,6 +716,46 @@ out:
727 return rc; 716 return rc;
728} 717}
729 718
719/**
720 * security_context_to_sid - Obtain a SID for a given security context.
721 * @scontext: security context
722 * @scontext_len: length in bytes
723 * @sid: security identifier, SID
724 *
725 * Obtains a SID associated with the security context that
726 * has the string representation specified by @scontext.
727 * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
728 * memory is available, or 0 on success.
729 */
730int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
731{
732 return security_context_to_sid_core(scontext, scontext_len,
733 sid, SECSID_NULL);
734}
735
736/**
737 * security_context_to_sid_default - Obtain a SID for a given security context,
738 * falling back to specified default if needed.
739 *
740 * @scontext: security context
741 * @scontext_len: length in bytes
742 * @sid: security identifier, SID
743 * @def_sid: default SID to assign on errror
744 *
745 * Obtains a SID associated with the security context that
746 * has the string representation specified by @scontext.
747 * The default SID is passed to the MLS layer to be used to allow
748 * kernel labeling of the MLS field if the MLS field is not present
749 * (for upgrading to MLS without full relabel).
750 * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
751 * memory is available, or 0 on success.
752 */
753int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid)
754{
755 return security_context_to_sid_core(scontext, scontext_len,
756 sid, def_sid);
757}
758
730static int compute_sid_handle_invalid_context( 759static int compute_sid_handle_invalid_context(
731 struct context *scontext, 760 struct context *scontext,
732 struct context *tcontext, 761 struct context *tcontext,