aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libahci.c21
-rw-r--r--drivers/ata/libata-eh.c2
-rw-r--r--drivers/atm/fore200e.c7
-rw-r--r--drivers/block/DAC960.c1
-rw-r--r--drivers/block/amiflop.c1
-rw-r--r--drivers/block/ataflop.c1
-rw-r--r--drivers/block/floppy.c1
-rw-r--r--drivers/block/paride/pcd.c1
-rw-r--r--drivers/block/paride/pd.c1
-rw-r--r--drivers/block/paride/pf.c1
-rw-r--r--drivers/block/rbd.c177
-rw-r--r--drivers/block/swim.c1
-rw-r--r--drivers/block/swim3.c1
-rw-r--r--drivers/block/ub.c1
-rw-r--r--drivers/block/xsysace.c1
-rw-r--r--drivers/cdrom/cdrom.c6
-rw-r--r--drivers/cdrom/gdrom.c1
-rw-r--r--drivers/cdrom/viocd.c1
-rw-r--r--drivers/char/hw_random/n2-drv.c7
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c7
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c14
-rw-r--r--drivers/edac/ppc4xx_edac.c2
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c26
-rw-r--r--drivers/gpu/drm/drm_mm.c6
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c8
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c17
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sgdma.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c5
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c5
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h1
-rw-r--r--drivers/gpu/drm/radeon/ni.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c29
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c6
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/cayman1
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/evergreen1
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c6
-rw-r--r--drivers/i2c/busses/i2c-mpc.c9
-rw-r--r--drivers/i2c/busses/i2c-pnx.c2
-rw-r--r--drivers/input/touchscreen/ads7846.c13
-rw-r--r--drivers/leds/leds-lm3530.c1
-rw-r--r--drivers/media/video/cx88/cx88-input.c2
-rw-r--r--drivers/media/video/soc_camera.c48
-rw-r--r--drivers/media/video/v4l2-device.c5
-rw-r--r--drivers/media/video/v4l2-subdev.c14
-rw-r--r--drivers/message/i2o/i2o_block.c1
-rw-r--r--drivers/mfd/asic3.c2
-rw-r--r--drivers/mfd/omap-usb-host.c8
-rw-r--r--drivers/mfd/twl4030-power.c3
-rw-r--r--drivers/mmc/core/host.c9
-rw-r--r--drivers/mmc/host/sdhci-of-core.c7
-rw-r--r--drivers/mtd/maps/physmap_of.c7
-rw-r--r--drivers/net/Kconfig8
-rw-r--r--drivers/net/Makefile6
-rw-r--r--drivers/net/arm/etherh.c4
-rw-r--r--drivers/net/benet/be.h2
-rw-r--r--drivers/net/benet/be_cmds.c2
-rw-r--r--drivers/net/benet/be_main.c18
-rw-r--r--drivers/net/bonding/bond_3ad.h10
-rw-r--r--drivers/net/can/mscan/mpc5xxx_can.c7
-rw-r--r--drivers/net/can/sja1000/sja1000.c2
-rw-r--r--drivers/net/can/slcan.c4
-rw-r--r--drivers/net/ehea/ehea_ethtool.c21
-rw-r--r--drivers/net/ehea/ehea_main.c6
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c9
-rw-r--r--drivers/net/fs_enet/mii-fec.c7
-rw-r--r--drivers/net/hydra.c14
-rw-r--r--drivers/net/ne-h8300.c16
-rw-r--r--drivers/net/pch_gbe/pch_gbe_main.c23
-rw-r--r--drivers/net/sfc/mcdi.c49
-rw-r--r--drivers/net/sfc/nic.c7
-rw-r--r--drivers/net/sfc/nic.h2
-rw-r--r--drivers/net/sfc/siena.c25
-rw-r--r--drivers/net/slip.c4
-rw-r--r--drivers/net/sunhme.c7
-rw-r--r--drivers/net/usb/cdc_ether.c2
-rw-r--r--drivers/net/usb/ipheth.c14
-rw-r--r--drivers/net/usb/usbnet.c10
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c10
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c8
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c7
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-dev.h6
-rw-r--r--drivers/net/wireless/libertas/cmd.c6
-rw-r--r--drivers/net/zorro8390.c12
-rw-r--r--drivers/pci/setup-bus.c4
-rw-r--r--drivers/platform/x86/eeepc-laptop.c57
-rw-r--r--drivers/platform/x86/sony-laptop.c130
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c6
-rw-r--r--drivers/rapidio/switches/idt_gen2.c9
-rw-r--r--drivers/rapidio/switches/idtcps.c6
-rw-r--r--drivers/rapidio/switches/tsi57x.c6
-rw-r--r--drivers/rtc/rtc-davinci.c5
-rw-r--r--drivers/rtc/rtc-ds1286.c2
-rw-r--r--drivers/rtc/rtc-ep93xx.c5
-rw-r--r--drivers/rtc/rtc-m41t80.c5
-rw-r--r--drivers/rtc/rtc-max8925.c5
-rw-r--r--drivers/rtc/rtc-max8998.c5
-rw-r--r--drivers/rtc/rtc-mc13xxx.c8
-rw-r--r--drivers/rtc/rtc-msm6242.c3
-rw-r--r--drivers/rtc/rtc-mxc.c19
-rw-r--r--drivers/rtc/rtc-pcap.c4
-rw-r--r--drivers/rtc/rtc-rp5c01.c5
-rw-r--r--drivers/rtc/rtc-s3c.c13
-rw-r--r--drivers/s390/block/dasd.c11
-rw-r--r--drivers/s390/char/sclp_cmd.c2
-rw-r--r--drivers/s390/char/tape_block.c1
-rw-r--r--drivers/scsi/qlogicpti.c7
-rw-r--r--drivers/scsi/scsi_lib.c27
-rw-r--r--drivers/scsi/scsi_scan.c2
-rw-r--r--drivers/tty/serial/of_serial.c7
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c7
-rw-r--r--drivers/video/acornfb.c26
-rw-r--r--drivers/video/fbmem.c223
-rw-r--r--drivers/watchdog/mpc8xxx_wdt.c7
119 files changed, 1060 insertions, 438 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index ff9d832a163d..d38c40fe4ddb 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -561,27 +561,6 @@ void ahci_start_engine(struct ata_port *ap)
561{ 561{
562 void __iomem *port_mmio = ahci_port_base(ap); 562 void __iomem *port_mmio = ahci_port_base(ap);
563 u32 tmp; 563 u32 tmp;
564 u8 status;
565
566 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
567
568 /*
569 * At end of section 10.1 of AHCI spec (rev 1.3), it states
570 * Software shall not set PxCMD.ST to 1 until it is determined
571 * that a functoinal device is present on the port as determined by
572 * PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h
573 *
574 * Even though most AHCI host controllers work without this check,
575 * specific controller will fail under this condition
576 */
577 if (status & (ATA_BUSY | ATA_DRQ))
578 return;
579 else {
580 ahci_scr_read(&ap->link, SCR_STATUS, &tmp);
581
582 if ((tmp & 0xf) != 0x3)
583 return;
584 }
585 564
586 /* start DMA */ 565 /* start DMA */
587 tmp = readl(port_mmio + PORT_CMD); 566 tmp = readl(port_mmio + PORT_CMD);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f26f2fe3480a..dad9fd660f37 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3316,7 +3316,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3316 struct ata_eh_context *ehc = &link->eh_context; 3316 struct ata_eh_context *ehc = &link->eh_context;
3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
3318 enum ata_lpm_policy old_policy = link->lpm_policy; 3318 enum ata_lpm_policy old_policy = link->lpm_policy;
3319 bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM; 3319 bool no_dipm = link->ap->flags & ATA_FLAG_NO_DIPM;
3320 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3320 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
3321 unsigned int err_mask; 3321 unsigned int err_mask;
3322 int rc; 3322 int rc;
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index bdd2719f3f68..bc9e702186dd 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2643,16 +2643,19 @@ fore200e_init(struct fore200e* fore200e, struct device *parent)
2643} 2643}
2644 2644
2645#ifdef CONFIG_SBUS 2645#ifdef CONFIG_SBUS
2646static const struct of_device_id fore200e_sba_match[];
2646static int __devinit fore200e_sba_probe(struct platform_device *op) 2647static int __devinit fore200e_sba_probe(struct platform_device *op)
2647{ 2648{
2649 const struct of_device_id *match;
2648 const struct fore200e_bus *bus; 2650 const struct fore200e_bus *bus;
2649 struct fore200e *fore200e; 2651 struct fore200e *fore200e;
2650 static int index = 0; 2652 static int index = 0;
2651 int err; 2653 int err;
2652 2654
2653 if (!op->dev.of_match) 2655 match = of_match_device(fore200e_sba_match, &op->dev);
2656 if (!match)
2654 return -EINVAL; 2657 return -EINVAL;
2655 bus = op->dev.of_match->data; 2658 bus = match->data;
2656 2659
2657 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL); 2660 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL);
2658 if (!fore200e) 2661 if (!fore200e)
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 8066d086578a..e086fbbbe853 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -2547,7 +2547,6 @@ static bool DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller)
2547 disk->major = MajorNumber; 2547 disk->major = MajorNumber;
2548 disk->first_minor = n << DAC960_MaxPartitionsBits; 2548 disk->first_minor = n << DAC960_MaxPartitionsBits;
2549 disk->fops = &DAC960_BlockDeviceOperations; 2549 disk->fops = &DAC960_BlockDeviceOperations;
2550 disk->events = DISK_EVENT_MEDIA_CHANGE;
2551 } 2550 }
2552 /* 2551 /*
2553 Indicate the Block Device Registration completed successfully, 2552 Indicate the Block Device Registration completed successfully,
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 456c0cc90dcf..8eba86bba599 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1736,7 +1736,6 @@ static int __init fd_probe_drives(void)
1736 disk->major = FLOPPY_MAJOR; 1736 disk->major = FLOPPY_MAJOR;
1737 disk->first_minor = drive; 1737 disk->first_minor = drive;
1738 disk->fops = &floppy_fops; 1738 disk->fops = &floppy_fops;
1739 disk->events = DISK_EVENT_MEDIA_CHANGE;
1740 sprintf(disk->disk_name, "fd%d", drive); 1739 sprintf(disk->disk_name, "fd%d", drive);
1741 disk->private_data = &unit[drive]; 1740 disk->private_data = &unit[drive];
1742 set_capacity(disk, 880*2); 1741 set_capacity(disk, 880*2);
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index c871eae14120..ede16c64ff07 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1964,7 +1964,6 @@ static int __init atari_floppy_init (void)
1964 unit[i].disk->first_minor = i; 1964 unit[i].disk->first_minor = i;
1965 sprintf(unit[i].disk->disk_name, "fd%d", i); 1965 sprintf(unit[i].disk->disk_name, "fd%d", i);
1966 unit[i].disk->fops = &floppy_fops; 1966 unit[i].disk->fops = &floppy_fops;
1967 unit[i].disk->events = DISK_EVENT_MEDIA_CHANGE;
1968 unit[i].disk->private_data = &unit[i]; 1967 unit[i].disk->private_data = &unit[i];
1969 unit[i].disk->queue = blk_init_queue(do_fd_request, 1968 unit[i].disk->queue = blk_init_queue(do_fd_request,
1970 &ataflop_lock); 1969 &ataflop_lock);
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 301d7a9a41a6..db8f88586c8d 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4205,7 +4205,6 @@ static int __init floppy_init(void)
4205 disks[dr]->major = FLOPPY_MAJOR; 4205 disks[dr]->major = FLOPPY_MAJOR;
4206 disks[dr]->first_minor = TOMINOR(dr); 4206 disks[dr]->first_minor = TOMINOR(dr);
4207 disks[dr]->fops = &floppy_fops; 4207 disks[dr]->fops = &floppy_fops;
4208 disks[dr]->events = DISK_EVENT_MEDIA_CHANGE;
4209 sprintf(disks[dr]->disk_name, "fd%d", dr); 4208 sprintf(disks[dr]->disk_name, "fd%d", dr);
4210 4209
4211 init_timer(&motor_off_timer[dr]); 4210 init_timer(&motor_off_timer[dr]);
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 2f2ccf686251..8690e31d9932 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -320,7 +320,6 @@ static void pcd_init_units(void)
320 disk->first_minor = unit; 320 disk->first_minor = unit;
321 strcpy(disk->disk_name, cd->name); /* umm... */ 321 strcpy(disk->disk_name, cd->name); /* umm... */
322 disk->fops = &pcd_bdops; 322 disk->fops = &pcd_bdops;
323 disk->events = DISK_EVENT_MEDIA_CHANGE;
324 } 323 }
325} 324}
326 325
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 21dfdb776869..869e7676d46f 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -837,7 +837,6 @@ static void pd_probe_drive(struct pd_unit *disk)
837 p->fops = &pd_fops; 837 p->fops = &pd_fops;
838 p->major = major; 838 p->major = major;
839 p->first_minor = (disk - pd) << PD_BITS; 839 p->first_minor = (disk - pd) << PD_BITS;
840 p->events = DISK_EVENT_MEDIA_CHANGE;
841 disk->gd = p; 840 disk->gd = p;
842 p->private_data = disk; 841 p->private_data = disk;
843 p->queue = pd_queue; 842 p->queue = pd_queue;
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 7adeb1edbf43..f21b520ef419 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -294,7 +294,6 @@ static void __init pf_init_units(void)
294 disk->first_minor = unit; 294 disk->first_minor = unit;
295 strcpy(disk->disk_name, pf->name); 295 strcpy(disk->disk_name, pf->name);
296 disk->fops = &pf_fops; 296 disk->fops = &pf_fops;
297 disk->events = DISK_EVENT_MEDIA_CHANGE;
298 if (!(*drives[unit])[D_PRT]) 297 if (!(*drives[unit])[D_PRT])
299 pf_drive_count++; 298 pf_drive_count++;
300 } 299 }
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 3e904717c1c0..9712fad82bc6 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -92,6 +92,8 @@ struct rbd_client {
92 struct list_head node; 92 struct list_head node;
93}; 93};
94 94
95struct rbd_req_coll;
96
95/* 97/*
96 * a single io request 98 * a single io request
97 */ 99 */
@@ -100,6 +102,24 @@ struct rbd_request {
100 struct bio *bio; /* cloned bio */ 102 struct bio *bio; /* cloned bio */
101 struct page **pages; /* list of used pages */ 103 struct page **pages; /* list of used pages */
102 u64 len; 104 u64 len;
105 int coll_index;
106 struct rbd_req_coll *coll;
107};
108
109struct rbd_req_status {
110 int done;
111 int rc;
112 u64 bytes;
113};
114
115/*
116 * a collection of requests
117 */
118struct rbd_req_coll {
119 int total;
120 int num_done;
121 struct kref kref;
122 struct rbd_req_status status[0];
103}; 123};
104 124
105struct rbd_snap { 125struct rbd_snap {
@@ -416,6 +436,17 @@ static void rbd_put_client(struct rbd_device *rbd_dev)
416 rbd_dev->client = NULL; 436 rbd_dev->client = NULL;
417} 437}
418 438
439/*
440 * Destroy requests collection
441 */
442static void rbd_coll_release(struct kref *kref)
443{
444 struct rbd_req_coll *coll =
445 container_of(kref, struct rbd_req_coll, kref);
446
447 dout("rbd_coll_release %p\n", coll);
448 kfree(coll);
449}
419 450
420/* 451/*
421 * Create a new header structure, translate header format from the on-disk 452 * Create a new header structure, translate header format from the on-disk
@@ -590,6 +621,14 @@ static u64 rbd_get_segment(struct rbd_image_header *header,
590 return len; 621 return len;
591} 622}
592 623
624static int rbd_get_num_segments(struct rbd_image_header *header,
625 u64 ofs, u64 len)
626{
627 u64 start_seg = ofs >> header->obj_order;
628 u64 end_seg = (ofs + len - 1) >> header->obj_order;
629 return end_seg - start_seg + 1;
630}
631
593/* 632/*
594 * bio helpers 633 * bio helpers
595 */ 634 */
@@ -735,6 +774,50 @@ static void rbd_destroy_ops(struct ceph_osd_req_op *ops)
735 kfree(ops); 774 kfree(ops);
736} 775}
737 776
777static void rbd_coll_end_req_index(struct request *rq,
778 struct rbd_req_coll *coll,
779 int index,
780 int ret, u64 len)
781{
782 struct request_queue *q;
783 int min, max, i;
784
785 dout("rbd_coll_end_req_index %p index %d ret %d len %lld\n",
786 coll, index, ret, len);
787
788 if (!rq)
789 return;
790
791 if (!coll) {
792 blk_end_request(rq, ret, len);
793 return;
794 }
795
796 q = rq->q;
797
798 spin_lock_irq(q->queue_lock);
799 coll->status[index].done = 1;
800 coll->status[index].rc = ret;
801 coll->status[index].bytes = len;
802 max = min = coll->num_done;
803 while (max < coll->total && coll->status[max].done)
804 max++;
805
806 for (i = min; i<max; i++) {
807 __blk_end_request(rq, coll->status[i].rc,
808 coll->status[i].bytes);
809 coll->num_done++;
810 kref_put(&coll->kref, rbd_coll_release);
811 }
812 spin_unlock_irq(q->queue_lock);
813}
814
815static void rbd_coll_end_req(struct rbd_request *req,
816 int ret, u64 len)
817{
818 rbd_coll_end_req_index(req->rq, req->coll, req->coll_index, ret, len);
819}
820
738/* 821/*
739 * Send ceph osd request 822 * Send ceph osd request
740 */ 823 */
@@ -749,6 +832,8 @@ static int rbd_do_request(struct request *rq,
749 int flags, 832 int flags,
750 struct ceph_osd_req_op *ops, 833 struct ceph_osd_req_op *ops,
751 int num_reply, 834 int num_reply,
835 struct rbd_req_coll *coll,
836 int coll_index,
752 void (*rbd_cb)(struct ceph_osd_request *req, 837 void (*rbd_cb)(struct ceph_osd_request *req,
753 struct ceph_msg *msg), 838 struct ceph_msg *msg),
754 struct ceph_osd_request **linger_req, 839 struct ceph_osd_request **linger_req,
@@ -763,12 +848,20 @@ static int rbd_do_request(struct request *rq,
763 struct ceph_osd_request_head *reqhead; 848 struct ceph_osd_request_head *reqhead;
764 struct rbd_image_header *header = &dev->header; 849 struct rbd_image_header *header = &dev->header;
765 850
766 ret = -ENOMEM;
767 req_data = kzalloc(sizeof(*req_data), GFP_NOIO); 851 req_data = kzalloc(sizeof(*req_data), GFP_NOIO);
768 if (!req_data) 852 if (!req_data) {
769 goto done; 853 if (coll)
854 rbd_coll_end_req_index(rq, coll, coll_index,
855 -ENOMEM, len);
856 return -ENOMEM;
857 }
770 858
771 dout("rbd_do_request len=%lld ofs=%lld\n", len, ofs); 859 if (coll) {
860 req_data->coll = coll;
861 req_data->coll_index = coll_index;
862 }
863
864 dout("rbd_do_request obj=%s ofs=%lld len=%lld\n", obj, len, ofs);
772 865
773 down_read(&header->snap_rwsem); 866 down_read(&header->snap_rwsem);
774 867
@@ -828,7 +921,8 @@ static int rbd_do_request(struct request *rq,
828 ret = ceph_osdc_wait_request(&dev->client->osdc, req); 921 ret = ceph_osdc_wait_request(&dev->client->osdc, req);
829 if (ver) 922 if (ver)
830 *ver = le64_to_cpu(req->r_reassert_version.version); 923 *ver = le64_to_cpu(req->r_reassert_version.version);
831 dout("reassert_ver=%lld\n", le64_to_cpu(req->r_reassert_version.version)); 924 dout("reassert_ver=%lld\n",
925 le64_to_cpu(req->r_reassert_version.version));
832 ceph_osdc_put_request(req); 926 ceph_osdc_put_request(req);
833 } 927 }
834 return ret; 928 return ret;
@@ -837,10 +931,8 @@ done_err:
837 bio_chain_put(req_data->bio); 931 bio_chain_put(req_data->bio);
838 ceph_osdc_put_request(req); 932 ceph_osdc_put_request(req);
839done_pages: 933done_pages:
934 rbd_coll_end_req(req_data, ret, len);
840 kfree(req_data); 935 kfree(req_data);
841done:
842 if (rq)
843 blk_end_request(rq, ret, len);
844 return ret; 936 return ret;
845} 937}
846 938
@@ -874,7 +966,7 @@ static void rbd_req_cb(struct ceph_osd_request *req, struct ceph_msg *msg)
874 bytes = req_data->len; 966 bytes = req_data->len;
875 } 967 }
876 968
877 blk_end_request(req_data->rq, rc, bytes); 969 rbd_coll_end_req(req_data, rc, bytes);
878 970
879 if (req_data->bio) 971 if (req_data->bio)
880 bio_chain_put(req_data->bio); 972 bio_chain_put(req_data->bio);
@@ -934,6 +1026,7 @@ static int rbd_req_sync_op(struct rbd_device *dev,
934 flags, 1026 flags,
935 ops, 1027 ops,
936 2, 1028 2,
1029 NULL, 0,
937 NULL, 1030 NULL,
938 linger_req, ver); 1031 linger_req, ver);
939 if (ret < 0) 1032 if (ret < 0)
@@ -959,7 +1052,9 @@ static int rbd_do_op(struct request *rq,
959 u64 snapid, 1052 u64 snapid,
960 int opcode, int flags, int num_reply, 1053 int opcode, int flags, int num_reply,
961 u64 ofs, u64 len, 1054 u64 ofs, u64 len,
962 struct bio *bio) 1055 struct bio *bio,
1056 struct rbd_req_coll *coll,
1057 int coll_index)
963{ 1058{
964 char *seg_name; 1059 char *seg_name;
965 u64 seg_ofs; 1060 u64 seg_ofs;
@@ -995,7 +1090,10 @@ static int rbd_do_op(struct request *rq,
995 flags, 1090 flags,
996 ops, 1091 ops,
997 num_reply, 1092 num_reply,
1093 coll, coll_index,
998 rbd_req_cb, 0, NULL); 1094 rbd_req_cb, 0, NULL);
1095
1096 rbd_destroy_ops(ops);
999done: 1097done:
1000 kfree(seg_name); 1098 kfree(seg_name);
1001 return ret; 1099 return ret;
@@ -1008,13 +1106,15 @@ static int rbd_req_write(struct request *rq,
1008 struct rbd_device *rbd_dev, 1106 struct rbd_device *rbd_dev,
1009 struct ceph_snap_context *snapc, 1107 struct ceph_snap_context *snapc,
1010 u64 ofs, u64 len, 1108 u64 ofs, u64 len,
1011 struct bio *bio) 1109 struct bio *bio,
1110 struct rbd_req_coll *coll,
1111 int coll_index)
1012{ 1112{
1013 return rbd_do_op(rq, rbd_dev, snapc, CEPH_NOSNAP, 1113 return rbd_do_op(rq, rbd_dev, snapc, CEPH_NOSNAP,
1014 CEPH_OSD_OP_WRITE, 1114 CEPH_OSD_OP_WRITE,
1015 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, 1115 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
1016 2, 1116 2,
1017 ofs, len, bio); 1117 ofs, len, bio, coll, coll_index);
1018} 1118}
1019 1119
1020/* 1120/*
@@ -1024,14 +1124,16 @@ static int rbd_req_read(struct request *rq,
1024 struct rbd_device *rbd_dev, 1124 struct rbd_device *rbd_dev,
1025 u64 snapid, 1125 u64 snapid,
1026 u64 ofs, u64 len, 1126 u64 ofs, u64 len,
1027 struct bio *bio) 1127 struct bio *bio,
1128 struct rbd_req_coll *coll,
1129 int coll_index)
1028{ 1130{
1029 return rbd_do_op(rq, rbd_dev, NULL, 1131 return rbd_do_op(rq, rbd_dev, NULL,
1030 (snapid ? snapid : CEPH_NOSNAP), 1132 (snapid ? snapid : CEPH_NOSNAP),
1031 CEPH_OSD_OP_READ, 1133 CEPH_OSD_OP_READ,
1032 CEPH_OSD_FLAG_READ, 1134 CEPH_OSD_FLAG_READ,
1033 2, 1135 2,
1034 ofs, len, bio); 1136 ofs, len, bio, coll, coll_index);
1035} 1137}
1036 1138
1037/* 1139/*
@@ -1063,7 +1165,9 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev,
1063{ 1165{
1064 struct ceph_osd_req_op *ops; 1166 struct ceph_osd_req_op *ops;
1065 struct page **pages = NULL; 1167 struct page **pages = NULL;
1066 int ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_NOTIFY_ACK, 0); 1168 int ret;
1169
1170 ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_NOTIFY_ACK, 0);
1067 if (ret < 0) 1171 if (ret < 0)
1068 return ret; 1172 return ret;
1069 1173
@@ -1077,6 +1181,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev,
1077 CEPH_OSD_FLAG_READ, 1181 CEPH_OSD_FLAG_READ,
1078 ops, 1182 ops,
1079 1, 1183 1,
1184 NULL, 0,
1080 rbd_simple_req_cb, 0, NULL); 1185 rbd_simple_req_cb, 0, NULL);
1081 1186
1082 rbd_destroy_ops(ops); 1187 rbd_destroy_ops(ops);
@@ -1274,6 +1379,20 @@ static int rbd_req_sync_exec(struct rbd_device *dev,
1274 return ret; 1379 return ret;
1275} 1380}
1276 1381
1382static struct rbd_req_coll *rbd_alloc_coll(int num_reqs)
1383{
1384 struct rbd_req_coll *coll =
1385 kzalloc(sizeof(struct rbd_req_coll) +
1386 sizeof(struct rbd_req_status) * num_reqs,
1387 GFP_ATOMIC);
1388
1389 if (!coll)
1390 return NULL;
1391 coll->total = num_reqs;
1392 kref_init(&coll->kref);
1393 return coll;
1394}
1395
1277/* 1396/*
1278 * block device queue callback 1397 * block device queue callback
1279 */ 1398 */
@@ -1291,6 +1410,8 @@ static void rbd_rq_fn(struct request_queue *q)
1291 bool do_write; 1410 bool do_write;
1292 int size, op_size = 0; 1411 int size, op_size = 0;
1293 u64 ofs; 1412 u64 ofs;
1413 int num_segs, cur_seg = 0;
1414 struct rbd_req_coll *coll;
1294 1415
1295 /* peek at request from block layer */ 1416 /* peek at request from block layer */
1296 if (!rq) 1417 if (!rq)
@@ -1321,6 +1442,14 @@ static void rbd_rq_fn(struct request_queue *q)
1321 do_write ? "write" : "read", 1442 do_write ? "write" : "read",
1322 size, blk_rq_pos(rq) * 512ULL); 1443 size, blk_rq_pos(rq) * 512ULL);
1323 1444
1445 num_segs = rbd_get_num_segments(&rbd_dev->header, ofs, size);
1446 coll = rbd_alloc_coll(num_segs);
1447 if (!coll) {
1448 spin_lock_irq(q->queue_lock);
1449 __blk_end_request_all(rq, -ENOMEM);
1450 goto next;
1451 }
1452
1324 do { 1453 do {
1325 /* a bio clone to be passed down to OSD req */ 1454 /* a bio clone to be passed down to OSD req */
1326 dout("rq->bio->bi_vcnt=%d\n", rq->bio->bi_vcnt); 1455 dout("rq->bio->bi_vcnt=%d\n", rq->bio->bi_vcnt);
@@ -1328,35 +1457,41 @@ static void rbd_rq_fn(struct request_queue *q)
1328 rbd_dev->header.block_name, 1457 rbd_dev->header.block_name,
1329 ofs, size, 1458 ofs, size,
1330 NULL, NULL); 1459 NULL, NULL);
1460 kref_get(&coll->kref);
1331 bio = bio_chain_clone(&rq_bio, &next_bio, &bp, 1461 bio = bio_chain_clone(&rq_bio, &next_bio, &bp,
1332 op_size, GFP_ATOMIC); 1462 op_size, GFP_ATOMIC);
1333 if (!bio) { 1463 if (!bio) {
1334 spin_lock_irq(q->queue_lock); 1464 rbd_coll_end_req_index(rq, coll, cur_seg,
1335 __blk_end_request_all(rq, -ENOMEM); 1465 -ENOMEM, op_size);
1336 goto next; 1466 goto next_seg;
1337 } 1467 }
1338 1468
1469
1339 /* init OSD command: write or read */ 1470 /* init OSD command: write or read */
1340 if (do_write) 1471 if (do_write)
1341 rbd_req_write(rq, rbd_dev, 1472 rbd_req_write(rq, rbd_dev,
1342 rbd_dev->header.snapc, 1473 rbd_dev->header.snapc,
1343 ofs, 1474 ofs,
1344 op_size, bio); 1475 op_size, bio,
1476 coll, cur_seg);
1345 else 1477 else
1346 rbd_req_read(rq, rbd_dev, 1478 rbd_req_read(rq, rbd_dev,
1347 cur_snap_id(rbd_dev), 1479 cur_snap_id(rbd_dev),
1348 ofs, 1480 ofs,
1349 op_size, bio); 1481 op_size, bio,
1482 coll, cur_seg);
1350 1483
1484next_seg:
1351 size -= op_size; 1485 size -= op_size;
1352 ofs += op_size; 1486 ofs += op_size;
1353 1487
1488 cur_seg++;
1354 rq_bio = next_bio; 1489 rq_bio = next_bio;
1355 } while (size > 0); 1490 } while (size > 0);
1491 kref_put(&coll->kref, rbd_coll_release);
1356 1492
1357 if (bp) 1493 if (bp)
1358 bio_pair_release(bp); 1494 bio_pair_release(bp);
1359
1360 spin_lock_irq(q->queue_lock); 1495 spin_lock_irq(q->queue_lock);
1361next: 1496next:
1362 rq = blk_fetch_request(q); 1497 rq = blk_fetch_request(q);
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 24a482f2fbd6..fd5adcd55944 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -858,7 +858,6 @@ static int __devinit swim_floppy_init(struct swim_priv *swd)
858 swd->unit[drive].disk->first_minor = drive; 858 swd->unit[drive].disk->first_minor = drive;
859 sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); 859 sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive);
860 swd->unit[drive].disk->fops = &floppy_fops; 860 swd->unit[drive].disk->fops = &floppy_fops;
861 swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE;
862 swd->unit[drive].disk->private_data = &swd->unit[drive]; 861 swd->unit[drive].disk->private_data = &swd->unit[drive];
863 swd->unit[drive].disk->queue = swd->queue; 862 swd->unit[drive].disk->queue = swd->queue;
864 set_capacity(swd->unit[drive].disk, 2880); 863 set_capacity(swd->unit[drive].disk, 2880);
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 4c10f56facbf..773bfa792777 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -1163,7 +1163,6 @@ static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device
1163 disk->major = FLOPPY_MAJOR; 1163 disk->major = FLOPPY_MAJOR;
1164 disk->first_minor = i; 1164 disk->first_minor = i;
1165 disk->fops = &floppy_fops; 1165 disk->fops = &floppy_fops;
1166 disk->events = DISK_EVENT_MEDIA_CHANGE;
1167 disk->private_data = &floppy_states[i]; 1166 disk->private_data = &floppy_states[i];
1168 disk->queue = swim3_queue; 1167 disk->queue = swim3_queue;
1169 disk->flags |= GENHD_FL_REMOVABLE; 1168 disk->flags |= GENHD_FL_REMOVABLE;
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 68b9430c7cfe..0e376d46bdd1 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -2334,7 +2334,6 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum)
2334 disk->major = UB_MAJOR; 2334 disk->major = UB_MAJOR;
2335 disk->first_minor = lun->id * UB_PARTS_PER_LUN; 2335 disk->first_minor = lun->id * UB_PARTS_PER_LUN;
2336 disk->fops = &ub_bd_fops; 2336 disk->fops = &ub_bd_fops;
2337 disk->events = DISK_EVENT_MEDIA_CHANGE;
2338 disk->private_data = lun; 2337 disk->private_data = lun;
2339 disk->driverfs_dev = &sc->intf->dev; 2338 disk->driverfs_dev = &sc->intf->dev;
2340 2339
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 645ff765cd12..6c7fd7db6dff 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1005,7 +1005,6 @@ static int __devinit ace_setup(struct ace_device *ace)
1005 ace->gd->major = ace_major; 1005 ace->gd->major = ace_major;
1006 ace->gd->first_minor = ace->id * ACE_NUM_MINORS; 1006 ace->gd->first_minor = ace->id * ACE_NUM_MINORS;
1007 ace->gd->fops = &ace_fops; 1007 ace->gd->fops = &ace_fops;
1008 ace->gd->events = DISK_EVENT_MEDIA_CHANGE;
1009 ace->gd->queue = ace->queue; 1008 ace->gd->queue = ace->queue;
1010 ace->gd->private_data = ace; 1009 ace->gd->private_data = ace;
1011 snprintf(ace->gd->disk_name, 32, "xs%c", ace->id + 'a'); 1010 snprintf(ace->gd->disk_name, 32, "xs%c", ace->id + 'a');
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 514dd8efaf73..75fb965b8f72 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -986,6 +986,9 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t
986 986
987 cdinfo(CD_OPEN, "entering cdrom_open\n"); 987 cdinfo(CD_OPEN, "entering cdrom_open\n");
988 988
989 /* open is event synchronization point, check events first */
990 check_disk_change(bdev);
991
989 /* if this was a O_NONBLOCK open and we should honor the flags, 992 /* if this was a O_NONBLOCK open and we should honor the flags,
990 * do a quick open without drive/disc integrity checks. */ 993 * do a quick open without drive/disc integrity checks. */
991 cdi->use_count++; 994 cdi->use_count++;
@@ -1012,9 +1015,6 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t
1012 1015
1013 cdinfo(CD_OPEN, "Use count for \"/dev/%s\" now %d\n", 1016 cdinfo(CD_OPEN, "Use count for \"/dev/%s\" now %d\n",
1014 cdi->name, cdi->use_count); 1017 cdi->name, cdi->use_count);
1015 /* Do this on open. Don't wait for mount, because they might
1016 not be mounting, but opening with O_NONBLOCK */
1017 check_disk_change(bdev);
1018 return 0; 1018 return 0;
1019err_release: 1019err_release:
1020 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) { 1020 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index b2b034fea34e..3ceaf006e7f0 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -803,7 +803,6 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
803 goto probe_fail_cdrom_register; 803 goto probe_fail_cdrom_register;
804 } 804 }
805 gd.disk->fops = &gdrom_bdops; 805 gd.disk->fops = &gdrom_bdops;
806 gd.disk->events = DISK_EVENT_MEDIA_CHANGE;
807 /* latch on to the interrupt */ 806 /* latch on to the interrupt */
808 err = gdrom_set_interrupt_handlers(); 807 err = gdrom_set_interrupt_handlers();
809 if (err) 808 if (err)
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 4e874c5fa605..e427fbe45999 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -626,7 +626,6 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
626 gendisk->queue = q; 626 gendisk->queue = q;
627 gendisk->fops = &viocd_fops; 627 gendisk->fops = &viocd_fops;
628 gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; 628 gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE;
629 gendisk->events = DISK_EVENT_MEDIA_CHANGE;
630 set_capacity(gendisk, 0); 629 set_capacity(gendisk, 0);
631 gendisk->private_data = d; 630 gendisk->private_data = d;
632 d->viocd_disk = gendisk; 631 d->viocd_disk = gendisk;
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index 43ac61978d8b..ac6739e085e3 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -619,15 +619,18 @@ static void __devinit n2rng_driver_version(void)
619 pr_info("%s", version); 619 pr_info("%s", version);
620} 620}
621 621
622static const struct of_device_id n2rng_match[];
622static int __devinit n2rng_probe(struct platform_device *op) 623static int __devinit n2rng_probe(struct platform_device *op)
623{ 624{
625 const struct of_device_id *match;
624 int victoria_falls; 626 int victoria_falls;
625 int err = -ENOMEM; 627 int err = -ENOMEM;
626 struct n2rng *np; 628 struct n2rng *np;
627 629
628 if (!op->dev.of_match) 630 match = of_match_device(n2rng_match, &op->dev);
631 if (!match)
629 return -EINVAL; 632 return -EINVAL;
630 victoria_falls = (op->dev.of_match->data != NULL); 633 victoria_falls = (match->data != NULL);
631 634
632 n2rng_driver_version(); 635 n2rng_driver_version();
633 np = kzalloc(sizeof(*np), GFP_KERNEL); 636 np = kzalloc(sizeof(*np), GFP_KERNEL);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index cc6c9b2546a3..64c6b8530615 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2554,9 +2554,11 @@ static struct pci_driver ipmi_pci_driver = {
2554}; 2554};
2555#endif /* CONFIG_PCI */ 2555#endif /* CONFIG_PCI */
2556 2556
2557static struct of_device_id ipmi_match[];
2557static int __devinit ipmi_probe(struct platform_device *dev) 2558static int __devinit ipmi_probe(struct platform_device *dev)
2558{ 2559{
2559#ifdef CONFIG_OF 2560#ifdef CONFIG_OF
2561 const struct of_device_id *match;
2560 struct smi_info *info; 2562 struct smi_info *info;
2561 struct resource resource; 2563 struct resource resource;
2562 const __be32 *regsize, *regspacing, *regshift; 2564 const __be32 *regsize, *regspacing, *regshift;
@@ -2566,7 +2568,8 @@ static int __devinit ipmi_probe(struct platform_device *dev)
2566 2568
2567 dev_info(&dev->dev, "probing via device tree\n"); 2569 dev_info(&dev->dev, "probing via device tree\n");
2568 2570
2569 if (!dev->dev.of_match) 2571 match = of_match_device(ipmi_match, &dev->dev);
2572 if (!match)
2570 return -EINVAL; 2573 return -EINVAL;
2571 2574
2572 ret = of_address_to_resource(np, 0, &resource); 2575 ret = of_address_to_resource(np, 0, &resource);
@@ -2601,7 +2604,7 @@ static int __devinit ipmi_probe(struct platform_device *dev)
2601 return -ENOMEM; 2604 return -ENOMEM;
2602 } 2605 }
2603 2606
2604 info->si_type = (enum si_type) dev->dev.of_match->data; 2607 info->si_type = (enum si_type) match->data;
2605 info->addr_source = SI_DEVICETREE; 2608 info->addr_source = SI_DEVICETREE;
2606 info->irq_setup = std_irq_setup; 2609 info->irq_setup = std_irq_setup;
2607 2610
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index d6412c16385f..39ccdeada791 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -715,13 +715,13 @@ static int __devexit hwicap_remove(struct device *dev)
715} 715}
716 716
717#ifdef CONFIG_OF 717#ifdef CONFIG_OF
718static int __devinit hwicap_of_probe(struct platform_device *op) 718static int __devinit hwicap_of_probe(struct platform_device *op,
719 const struct hwicap_driver_config *config)
719{ 720{
720 struct resource res; 721 struct resource res;
721 const unsigned int *id; 722 const unsigned int *id;
722 const char *family; 723 const char *family;
723 int rc; 724 int rc;
724 const struct hwicap_driver_config *config = op->dev.of_match->data;
725 const struct config_registers *regs; 725 const struct config_registers *regs;
726 726
727 727
@@ -751,20 +751,24 @@ static int __devinit hwicap_of_probe(struct platform_device *op)
751 regs); 751 regs);
752} 752}
753#else 753#else
754static inline int hwicap_of_probe(struct platform_device *op) 754static inline int hwicap_of_probe(struct platform_device *op,
755 const struct hwicap_driver_config *config)
755{ 756{
756 return -EINVAL; 757 return -EINVAL;
757} 758}
758#endif /* CONFIG_OF */ 759#endif /* CONFIG_OF */
759 760
761static const struct of_device_id __devinitconst hwicap_of_match[];
760static int __devinit hwicap_drv_probe(struct platform_device *pdev) 762static int __devinit hwicap_drv_probe(struct platform_device *pdev)
761{ 763{
764 const struct of_device_id *match;
762 struct resource *res; 765 struct resource *res;
763 const struct config_registers *regs; 766 const struct config_registers *regs;
764 const char *family; 767 const char *family;
765 768
766 if (pdev->dev.of_match) 769 match = of_match_device(hwicap_of_match, &pdev->dev);
767 return hwicap_of_probe(pdev); 770 if (match)
771 return hwicap_of_probe(pdev, match->data);
768 772
769 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 773 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
770 if (!res) 774 if (!res)
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index c1f0045ceb8e..af8e7b1aa290 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -1019,7 +1019,7 @@ ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
1019 struct ppc4xx_edac_pdata *pdata = NULL; 1019 struct ppc4xx_edac_pdata *pdata = NULL;
1020 const struct device_node *np = op->dev.of_node; 1020 const struct device_node *np = op->dev.of_node;
1021 1021
1022 if (op->dev.of_match == NULL) 1022 if (of_match_device(ppc4xx_edac_match, &op->dev) == NULL)
1023 return -EINVAL; 1023 return -EINVAL;
1024 1024
1025 /* Initial driver pointers and private data */ 1025 /* Initial driver pointers and private data */
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 11d7a72c22d9..140b9525b48a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1516,17 +1516,33 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
1516} 1516}
1517EXPORT_SYMBOL(drm_fb_helper_initial_config); 1517EXPORT_SYMBOL(drm_fb_helper_initial_config);
1518 1518
1519bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) 1519/**
1520 * drm_fb_helper_hotplug_event - respond to a hotplug notification by
1521 * probing all the outputs attached to the fb.
1522 * @fb_helper: the drm_fb_helper
1523 *
1524 * LOCKING:
1525 * Called at runtime, must take mode config lock.
1526 *
1527 * Scan the connectors attached to the fb_helper and try to put together a
1528 * setup after *notification of a change in output configuration.
1529 *
1530 * RETURNS:
1531 * 0 on success and a non-zero error code otherwise.
1532 */
1533int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1520{ 1534{
1535 struct drm_device *dev = fb_helper->dev;
1521 int count = 0; 1536 int count = 0;
1522 u32 max_width, max_height, bpp_sel; 1537 u32 max_width, max_height, bpp_sel;
1523 bool bound = false, crtcs_bound = false; 1538 bool bound = false, crtcs_bound = false;
1524 struct drm_crtc *crtc; 1539 struct drm_crtc *crtc;
1525 1540
1526 if (!fb_helper->fb) 1541 if (!fb_helper->fb)
1527 return false; 1542 return 0;
1528 1543
1529 list_for_each_entry(crtc, &fb_helper->dev->mode_config.crtc_list, head) { 1544 mutex_lock(&dev->mode_config.mutex);
1545 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1530 if (crtc->fb) 1546 if (crtc->fb)
1531 crtcs_bound = true; 1547 crtcs_bound = true;
1532 if (crtc->fb == fb_helper->fb) 1548 if (crtc->fb == fb_helper->fb)
@@ -1535,7 +1551,8 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1535 1551
1536 if (!bound && crtcs_bound) { 1552 if (!bound && crtcs_bound) {
1537 fb_helper->delayed_hotplug = true; 1553 fb_helper->delayed_hotplug = true;
1538 return false; 1554 mutex_unlock(&dev->mode_config.mutex);
1555 return 0;
1539 } 1556 }
1540 DRM_DEBUG_KMS("\n"); 1557 DRM_DEBUG_KMS("\n");
1541 1558
@@ -1546,6 +1563,7 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1546 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, 1563 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width,
1547 max_height); 1564 max_height);
1548 drm_setup_crtcs(fb_helper); 1565 drm_setup_crtcs(fb_helper);
1566 mutex_unlock(&dev->mode_config.mutex);
1549 1567
1550 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel); 1568 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
1551} 1569}
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 5d00b0fc0d91..959186cbf328 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -431,7 +431,7 @@ EXPORT_SYMBOL(drm_mm_search_free_in_range);
431void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new) 431void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new)
432{ 432{
433 list_replace(&old->node_list, &new->node_list); 433 list_replace(&old->node_list, &new->node_list);
434 list_replace(&old->node_list, &new->hole_stack); 434 list_replace(&old->hole_stack, &new->hole_stack);
435 new->hole_follows = old->hole_follows; 435 new->hole_follows = old->hole_follows;
436 new->mm = old->mm; 436 new->mm = old->mm;
437 new->start = old->start; 437 new->start = old->start;
@@ -699,8 +699,8 @@ int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm)
699 entry->size); 699 entry->size);
700 total_used += entry->size; 700 total_used += entry->size;
701 if (entry->hole_follows) { 701 if (entry->hole_follows) {
702 hole_start = drm_mm_hole_node_start(&mm->head_node); 702 hole_start = drm_mm_hole_node_start(entry);
703 hole_end = drm_mm_hole_node_end(&mm->head_node); 703 hole_end = drm_mm_hole_node_end(entry);
704 hole_size = hole_end - hole_start; 704 hole_size = hole_end - hole_start;
705 seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", 705 seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n",
706 hole_start, hole_end, hole_size); 706 hole_start, hole_end, hole_size);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index c34a8dd31d02..32d1b3e829c8 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -49,7 +49,7 @@ module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600);
49unsigned int i915_powersave = 1; 49unsigned int i915_powersave = 1;
50module_param_named(powersave, i915_powersave, int, 0600); 50module_param_named(powersave, i915_powersave, int, 0600);
51 51
52unsigned int i915_semaphores = 1; 52unsigned int i915_semaphores = 0;
53module_param_named(semaphores, i915_semaphores, int, 0600); 53module_param_named(semaphores, i915_semaphores, int, 0600);
54 54
55unsigned int i915_enable_rc6 = 0; 55unsigned int i915_enable_rc6 = 0;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e522c702b04e..2166ee071ddb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5605,9 +5605,9 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
5605 intel_clock_t clock; 5605 intel_clock_t clock;
5606 5606
5607 if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0) 5607 if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0)
5608 fp = FP0(pipe); 5608 fp = I915_READ(FP0(pipe));
5609 else 5609 else
5610 fp = FP1(pipe); 5610 fp = I915_READ(FP1(pipe));
5611 5611
5612 clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT; 5612 clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT;
5613 if (IS_PINEVIEW(dev)) { 5613 if (IS_PINEVIEW(dev)) {
@@ -6579,8 +6579,10 @@ intel_user_framebuffer_create(struct drm_device *dev,
6579 return ERR_PTR(-ENOENT); 6579 return ERR_PTR(-ENOENT);
6580 6580
6581 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); 6581 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
6582 if (!intel_fb) 6582 if (!intel_fb) {
6583 drm_gem_object_unreference_unlocked(&obj->base);
6583 return ERR_PTR(-ENOMEM); 6584 return ERR_PTR(-ENOMEM);
6585 }
6584 6586
6585 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj); 6587 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj);
6586 if (ret) { 6588 if (ret) {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index cb8578b7e443..a4d80314e7f8 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1470,7 +1470,8 @@ intel_dp_link_down(struct intel_dp *intel_dp)
1470 1470
1471 if (!HAS_PCH_CPT(dev) && 1471 if (!HAS_PCH_CPT(dev) &&
1472 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { 1472 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {
1473 struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc); 1473 struct drm_crtc *crtc = intel_dp->base.base.crtc;
1474
1474 /* Hardware workaround: leaving our transcoder select 1475 /* Hardware workaround: leaving our transcoder select
1475 * set to transcoder B while it's off will prevent the 1476 * set to transcoder B while it's off will prevent the
1476 * corresponding HDMI output on transcoder A. 1477 * corresponding HDMI output on transcoder A.
@@ -1485,7 +1486,19 @@ intel_dp_link_down(struct intel_dp *intel_dp)
1485 /* Changes to enable or select take place the vblank 1486 /* Changes to enable or select take place the vblank
1486 * after being written. 1487 * after being written.
1487 */ 1488 */
1488 intel_wait_for_vblank(dev, intel_crtc->pipe); 1489 if (crtc == NULL) {
1490 /* We can arrive here never having been attached
1491 * to a CRTC, for instance, due to inheriting
1492 * random state from the BIOS.
1493 *
1494 * If the pipe is not running, play safe and
1495 * wait for the clocks to stabilise before
1496 * continuing.
1497 */
1498 POSTING_READ(intel_dp->output_reg);
1499 msleep(50);
1500 } else
1501 intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe);
1489 } 1502 }
1490 1503
1491 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); 1504 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index a562bd2648c7..67cb076d271b 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -539,6 +539,9 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
539 struct drm_device *dev = dev_priv->dev; 539 struct drm_device *dev = dev_priv->dev;
540 struct drm_connector *connector = dev_priv->int_lvds_connector; 540 struct drm_connector *connector = dev_priv->int_lvds_connector;
541 541
542 if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
543 return NOTIFY_OK;
544
542 /* 545 /*
543 * check and update the status of LVDS connector after receiving 546 * check and update the status of LVDS connector after receiving
544 * the LID nofication event. 547 * the LID nofication event.
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 5045f8b921d6..c3e953b08992 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -152,8 +152,6 @@ nouveau_mem_vram_fini(struct drm_device *dev)
152{ 152{
153 struct drm_nouveau_private *dev_priv = dev->dev_private; 153 struct drm_nouveau_private *dev_priv = dev->dev_private;
154 154
155 nouveau_bo_ref(NULL, &dev_priv->vga_ram);
156
157 ttm_bo_device_release(&dev_priv->ttm.bdev); 155 ttm_bo_device_release(&dev_priv->ttm.bdev);
158 156
159 nouveau_ttm_global_release(dev_priv); 157 nouveau_ttm_global_release(dev_priv);
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
index 4bce801bc588..c77111eca6ac 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
@@ -42,7 +42,8 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
42 42
43 nvbe->nr_pages = 0; 43 nvbe->nr_pages = 0;
44 while (num_pages--) { 44 while (num_pages--) {
45 if (dma_addrs[nvbe->nr_pages] != DMA_ERROR_CODE) { 45 /* this code path isn't called and is incorrect anyways */
46 if (0) { /*dma_addrs[nvbe->nr_pages] != DMA_ERROR_CODE)*/
46 nvbe->pages[nvbe->nr_pages] = 47 nvbe->pages[nvbe->nr_pages] =
47 dma_addrs[nvbe->nr_pages]; 48 dma_addrs[nvbe->nr_pages];
48 nvbe->ttm_alloced[nvbe->nr_pages] = true; 49 nvbe->ttm_alloced[nvbe->nr_pages] = true;
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index a30adec5beaa..915fbce89595 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -768,6 +768,11 @@ static void nouveau_card_takedown(struct drm_device *dev)
768 engine->mc.takedown(dev); 768 engine->mc.takedown(dev);
769 engine->display.late_takedown(dev); 769 engine->display.late_takedown(dev);
770 770
771 if (dev_priv->vga_ram) {
772 nouveau_bo_unpin(dev_priv->vga_ram);
773 nouveau_bo_ref(NULL, &dev_priv->vga_ram);
774 }
775
771 mutex_lock(&dev->struct_mutex); 776 mutex_lock(&dev->struct_mutex);
772 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); 777 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
773 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT); 778 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index c20eac3379e6..9073e3bfb08c 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1780,7 +1780,10 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1780 1780
1781 1781
1782 mc_shared_chmap = RREG32(MC_SHARED_CHMAP); 1782 mc_shared_chmap = RREG32(MC_SHARED_CHMAP);
1783 mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); 1783 if (rdev->flags & RADEON_IS_IGP)
1784 mc_arb_ramcfg = RREG32(FUS_MC_ARB_RAMCFG);
1785 else
1786 mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG);
1784 1787
1785 switch (rdev->config.evergreen.max_tile_pipes) { 1788 switch (rdev->config.evergreen.max_tile_pipes) {
1786 case 1: 1789 case 1:
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 94533849927e..fc40e0cc3451 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -200,6 +200,7 @@
200#define BURSTLENGTH_SHIFT 9 200#define BURSTLENGTH_SHIFT 9
201#define BURSTLENGTH_MASK 0x00000200 201#define BURSTLENGTH_MASK 0x00000200
202#define CHANSIZE_OVERRIDE (1 << 11) 202#define CHANSIZE_OVERRIDE (1 << 11)
203#define FUS_MC_ARB_RAMCFG 0x2768
203#define MC_VM_AGP_TOP 0x2028 204#define MC_VM_AGP_TOP 0x2028
204#define MC_VM_AGP_BOT 0x202C 205#define MC_VM_AGP_BOT 0x202C
205#define MC_VM_AGP_BASE 0x2030 206#define MC_VM_AGP_BASE 0x2030
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 7aade20f63a8..3d8a7634bbe9 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -674,7 +674,7 @@ static void cayman_gpu_init(struct radeon_device *rdev)
674 674
675 cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE); 675 cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE);
676 cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG); 676 cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG);
677 cgts_tcc_disable = RREG32(CGTS_TCC_DISABLE); 677 cgts_tcc_disable = 0xff000000;
678 gc_user_rb_backend_disable = RREG32(GC_USER_RB_BACKEND_DISABLE); 678 gc_user_rb_backend_disable = RREG32(GC_USER_RB_BACKEND_DISABLE);
679 gc_user_shader_pipe_config = RREG32(GC_USER_SHADER_PIPE_CONFIG); 679 gc_user_shader_pipe_config = RREG32(GC_USER_SHADER_PIPE_CONFIG);
680 cgts_user_tcc_disable = RREG32(CGTS_USER_TCC_DISABLE); 680 cgts_user_tcc_disable = RREG32(CGTS_USER_TCC_DISABLE);
@@ -871,7 +871,7 @@ static void cayman_gpu_init(struct radeon_device *rdev)
871 871
872 smx_dc_ctl0 = RREG32(SMX_DC_CTL0); 872 smx_dc_ctl0 = RREG32(SMX_DC_CTL0);
873 smx_dc_ctl0 &= ~NUMBER_OF_SETS(0x1ff); 873 smx_dc_ctl0 &= ~NUMBER_OF_SETS(0x1ff);
874 smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets); 874 smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.cayman.sx_num_of_sets);
875 WREG32(SMX_DC_CTL0, smx_dc_ctl0); 875 WREG32(SMX_DC_CTL0, smx_dc_ctl0);
876 876
877 WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4) | CRC_SIMD_ID_WADDR_DISABLE); 877 WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4) | CRC_SIMD_ID_WADDR_DISABLE);
@@ -887,20 +887,20 @@ static void cayman_gpu_init(struct radeon_device *rdev)
887 887
888 WREG32(TA_CNTL_AUX, DISABLE_CUBE_ANISO); 888 WREG32(TA_CNTL_AUX, DISABLE_CUBE_ANISO);
889 889
890 WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) | 890 WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.cayman.sx_max_export_size / 4) - 1) |
891 POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) | 891 POSITION_BUFFER_SIZE((rdev->config.cayman.sx_max_export_pos_size / 4) - 1) |
892 SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1))); 892 SMX_BUFFER_SIZE((rdev->config.cayman.sx_max_export_smx_size / 4) - 1)));
893 893
894 WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.evergreen.sc_prim_fifo_size) | 894 WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.cayman.sc_prim_fifo_size) |
895 SC_HIZ_TILE_FIFO_SIZE(rdev->config.evergreen.sc_hiz_tile_fifo_size) | 895 SC_HIZ_TILE_FIFO_SIZE(rdev->config.cayman.sc_hiz_tile_fifo_size) |
896 SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.evergreen.sc_earlyz_tile_fifo_size))); 896 SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.cayman.sc_earlyz_tile_fifo_size)));
897 897
898 898
899 WREG32(VGT_NUM_INSTANCES, 1); 899 WREG32(VGT_NUM_INSTANCES, 1);
900 900
901 WREG32(CP_PERFMON_CNTL, 0); 901 WREG32(CP_PERFMON_CNTL, 0);
902 902
903 WREG32(SQ_MS_FIFO_SIZES, (CACHE_FIFO_SIZE(16 * rdev->config.evergreen.sq_num_cf_insts) | 903 WREG32(SQ_MS_FIFO_SIZES, (CACHE_FIFO_SIZE(16 * rdev->config.cayman.sq_num_cf_insts) |
904 FETCH_FIFO_HIWATER(0x4) | 904 FETCH_FIFO_HIWATER(0x4) |
905 DONE_FIFO_HIWATER(0xe0) | 905 DONE_FIFO_HIWATER(0xe0) |
906 ALU_UPDATE_FIFO_HIWATER(0x8))); 906 ALU_UPDATE_FIFO_HIWATER(0x8)));
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index f116516bfef7..90dfb2b8cf03 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -431,7 +431,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
431 } 431 }
432 } 432 }
433 433
434 /* Acer laptop (Acer TravelMate 5730G) has an HDMI port 434 /* Acer laptop (Acer TravelMate 5730/5730G) has an HDMI port
435 * on the laptop and a DVI port on the docking station and 435 * on the laptop and a DVI port on the docking station and
436 * both share the same encoder, hpd pin, and ddc line. 436 * both share the same encoder, hpd pin, and ddc line.
437 * So while the bios table is technically correct, 437 * So while the bios table is technically correct,
@@ -440,7 +440,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
440 * with different crtcs which isn't possible on the hardware 440 * with different crtcs which isn't possible on the hardware
441 * side and leaves no crtcs for LVDS or VGA. 441 * side and leaves no crtcs for LVDS or VGA.
442 */ 442 */
443 if ((dev->pdev->device == 0x95c4) && 443 if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) &&
444 (dev->pdev->subsystem_vendor == 0x1025) && 444 (dev->pdev->subsystem_vendor == 0x1025) &&
445 (dev->pdev->subsystem_device == 0x013c)) { 445 (dev->pdev->subsystem_device == 0x013c)) {
446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && 446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
@@ -1574,9 +1574,17 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
1574 ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record; 1574 ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record;
1575 ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record; 1575 ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record;
1576 bool bad_record = false; 1576 bool bad_record = false;
1577 u8 *record = (u8 *)(mode_info->atom_context->bios + 1577 u8 *record;
1578 data_offset + 1578
1579 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); 1579 if ((frev == 1) && (crev < 2))
1580 /* absolute */
1581 record = (u8 *)(mode_info->atom_context->bios +
1582 le16_to_cpu(lvds_info->info.usModePatchTableOffset));
1583 else
1584 /* relative */
1585 record = (u8 *)(mode_info->atom_context->bios +
1586 data_offset +
1587 le16_to_cpu(lvds_info->info.usModePatchTableOffset));
1580 while (*record != ATOM_RECORD_END_TYPE) { 1588 while (*record != ATOM_RECORD_END_TYPE) {
1581 switch (*record) { 1589 switch (*record) {
1582 case LCD_MODE_PATCH_RECORD_MODE_TYPE: 1590 case LCD_MODE_PATCH_RECORD_MODE_TYPE:
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index ed5dfe58f29c..9d95792bea3e 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -15,6 +15,9 @@
15#define ATPX_VERSION 0 15#define ATPX_VERSION 0
16#define ATPX_GPU_PWR 2 16#define ATPX_GPU_PWR 2
17#define ATPX_MUX_SELECT 3 17#define ATPX_MUX_SELECT 3
18#define ATPX_I2C_MUX_SELECT 4
19#define ATPX_SWITCH_START 5
20#define ATPX_SWITCH_END 6
18 21
19#define ATPX_INTEGRATED 0 22#define ATPX_INTEGRATED 0
20#define ATPX_DISCRETE 1 23#define ATPX_DISCRETE 1
@@ -149,13 +152,35 @@ static int radeon_atpx_switch_mux(acpi_handle handle, int mux_id)
149 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id); 152 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id);
150} 153}
151 154
155static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id)
156{
157 return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id);
158}
159
160static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id)
161{
162 return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id);
163}
164
165static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id)
166{
167 return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id);
168}
152 169
153static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) 170static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)
154{ 171{
172 int gpu_id;
173
155 if (id == VGA_SWITCHEROO_IGD) 174 if (id == VGA_SWITCHEROO_IGD)
156 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 0); 175 gpu_id = ATPX_INTEGRATED;
157 else 176 else
158 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 1); 177 gpu_id = ATPX_DISCRETE;
178
179 radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id);
180 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id);
181 radeon_atpx_switch_i2c_mux(radeon_atpx_priv.atpx_handle, gpu_id);
182 radeon_atpx_switch_end(radeon_atpx_priv.atpx_handle, gpu_id);
183
159 return 0; 184 return 0;
160} 185}
161 186
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index bdf2fa1189ae..3189a7efb2e9 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -167,9 +167,6 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
167 return -EINVAL; 167 return -EINVAL;
168 } 168 }
169 169
170 radeon_crtc->cursor_width = width;
171 radeon_crtc->cursor_height = height;
172
173 obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); 170 obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
174 if (!obj) { 171 if (!obj) {
175 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); 172 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id);
@@ -180,6 +177,9 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
180 if (ret) 177 if (ret)
181 goto fail; 178 goto fail;
182 179
180 radeon_crtc->cursor_width = width;
181 radeon_crtc->cursor_height = height;
182
183 radeon_lock_cursor(crtc, true); 183 radeon_lock_cursor(crtc, true);
184 /* XXX only 27 bit offset for legacy cursor */ 184 /* XXX only 27 bit offset for legacy cursor */
185 radeon_set_cursor(crtc, obj, gpu_addr); 185 radeon_set_cursor(crtc, obj, gpu_addr);
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 8a955bbdb608..a533f52fd163 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -181,9 +181,9 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
181 p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); 181 p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
182 182
183 for (i = 0; i < pages; i++, p++) { 183 for (i = 0; i < pages; i++, p++) {
184 /* On TTM path, we only use the DMA API if TTM_PAGE_FLAG_DMA32 184 /* we reverted the patch using dma_addr in TTM for now but this
185 * is requested. */ 185 * code stops building on alpha so just comment it out for now */
186 if (dma_addr[i] != DMA_ERROR_CODE) { 186 if (0) { /*dma_addr[i] != DMA_ERROR_CODE) */
187 rdev->gart.ttm_alloced[p] = true; 187 rdev->gart.ttm_alloced[p] = true;
188 rdev->gart.pages_addr[p] = dma_addr[i]; 188 rdev->gart.pages_addr[p] = dma_addr[i];
189 } else { 189 } else {
diff --git a/drivers/gpu/drm/radeon/reg_srcs/cayman b/drivers/gpu/drm/radeon/reg_srcs/cayman
index 6334f8ac1209..0aa8e85a9457 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/cayman
+++ b/drivers/gpu/drm/radeon/reg_srcs/cayman
@@ -33,6 +33,7 @@ cayman 0x9400
330x00008E48 SQ_EX_ALLOC_TABLE_SLOTS 330x00008E48 SQ_EX_ALLOC_TABLE_SLOTS
340x00009100 SPI_CONFIG_CNTL 340x00009100 SPI_CONFIG_CNTL
350x0000913C SPI_CONFIG_CNTL_1 350x0000913C SPI_CONFIG_CNTL_1
360x00009508 TA_CNTL_AUX
360x00009830 DB_DEBUG 370x00009830 DB_DEBUG
370x00009834 DB_DEBUG2 380x00009834 DB_DEBUG2
380x00009838 DB_DEBUG3 390x00009838 DB_DEBUG3
diff --git a/drivers/gpu/drm/radeon/reg_srcs/evergreen b/drivers/gpu/drm/radeon/reg_srcs/evergreen
index 7e1637176e08..0e28cae7ea43 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/evergreen
+++ b/drivers/gpu/drm/radeon/reg_srcs/evergreen
@@ -46,6 +46,7 @@ evergreen 0x9400
460x00008E48 SQ_EX_ALLOC_TABLE_SLOTS 460x00008E48 SQ_EX_ALLOC_TABLE_SLOTS
470x00009100 SPI_CONFIG_CNTL 470x00009100 SPI_CONFIG_CNTL
480x0000913C SPI_CONFIG_CNTL_1 480x0000913C SPI_CONFIG_CNTL_1
490x00009508 TA_CNTL_AUX
490x00009700 VC_CNTL 500x00009700 VC_CNTL
500x00009714 VC_ENHANCE 510x00009714 VC_ENHANCE
510x00009830 DB_DEBUG 520x00009830 DB_DEBUG
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index e01cacba685f..498b284e5ef9 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -219,9 +219,6 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client)
219 int i; 219 int i;
220 struct vga_switcheroo_client *active = NULL; 220 struct vga_switcheroo_client *active = NULL;
221 221
222 if (new_client->active == true)
223 return 0;
224
225 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { 222 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {
226 if (vgasr_priv.clients[i].active == true) { 223 if (vgasr_priv.clients[i].active == true) {
227 active = &vgasr_priv.clients[i]; 224 active = &vgasr_priv.clients[i];
@@ -372,6 +369,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
372 goto out; 369 goto out;
373 } 370 }
374 371
372 if (client->active == true)
373 goto out;
374
375 /* okay we want a switch - test if devices are willing to switch */ 375 /* okay we want a switch - test if devices are willing to switch */
376 can_switch = true; 376 can_switch = true;
377 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { 377 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 75b984c519ac..107397a606b4 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -560,15 +560,18 @@ static struct i2c_adapter mpc_ops = {
560 .timeout = HZ, 560 .timeout = HZ,
561}; 561};
562 562
563static const struct of_device_id mpc_i2c_of_match[];
563static int __devinit fsl_i2c_probe(struct platform_device *op) 564static int __devinit fsl_i2c_probe(struct platform_device *op)
564{ 565{
566 const struct of_device_id *match;
565 struct mpc_i2c *i2c; 567 struct mpc_i2c *i2c;
566 const u32 *prop; 568 const u32 *prop;
567 u32 clock = MPC_I2C_CLOCK_LEGACY; 569 u32 clock = MPC_I2C_CLOCK_LEGACY;
568 int result = 0; 570 int result = 0;
569 int plen; 571 int plen;
570 572
571 if (!op->dev.of_match) 573 match = of_match_device(mpc_i2c_of_match, &op->dev);
574 if (!match)
572 return -EINVAL; 575 return -EINVAL;
573 576
574 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); 577 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
@@ -605,8 +608,8 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
605 clock = *prop; 608 clock = *prop;
606 } 609 }
607 610
608 if (op->dev.of_match->data) { 611 if (match->data) {
609 struct mpc_i2c_data *data = op->dev.of_match->data; 612 struct mpc_i2c_data *data = match->data;
610 data->setup(op->dev.of_node, i2c, clock, data->prescaler); 613 data->setup(op->dev.of_node, i2c, clock, data->prescaler);
611 } else { 614 } else {
612 /* Backwards compatibility */ 615 /* Backwards compatibility */
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index a97e3fec8148..04be9f82e14b 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -65,7 +65,7 @@ static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data)
65 jiffies, expires); 65 jiffies, expires);
66 66
67 timer->expires = jiffies + expires; 67 timer->expires = jiffies + expires;
68 timer->data = (unsigned long)&alg_data; 68 timer->data = (unsigned long)alg_data;
69 69
70 add_timer(timer); 70 add_timer(timer);
71} 71}
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index c24946f51256..1de1c19dad30 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -281,17 +281,24 @@ struct ser_req {
281 u8 command; 281 u8 command;
282 u8 ref_off; 282 u8 ref_off;
283 u16 scratch; 283 u16 scratch;
284 __be16 sample;
285 struct spi_message msg; 284 struct spi_message msg;
286 struct spi_transfer xfer[6]; 285 struct spi_transfer xfer[6];
286 /*
287 * DMA (thus cache coherency maintenance) requires the
288 * transfer buffers to live in their own cache lines.
289 */
290 __be16 sample ____cacheline_aligned;
287}; 291};
288 292
289struct ads7845_ser_req { 293struct ads7845_ser_req {
290 u8 command[3]; 294 u8 command[3];
291 u8 pwrdown[3];
292 u8 sample[3];
293 struct spi_message msg; 295 struct spi_message msg;
294 struct spi_transfer xfer[2]; 296 struct spi_transfer xfer[2];
297 /*
298 * DMA (thus cache coherency maintenance) requires the
299 * transfer buffers to live in their own cache lines.
300 */
301 u8 sample[3] ____cacheline_aligned;
295}; 302};
296 303
297static int ads7846_read12_ser(struct device *dev, unsigned command) 304static int ads7846_read12_ser(struct device *dev, unsigned command)
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c
index e7089a1f6cb6..b37e6186d0fa 100644
--- a/drivers/leds/leds-lm3530.c
+++ b/drivers/leds/leds-lm3530.c
@@ -349,6 +349,7 @@ static const struct i2c_device_id lm3530_id[] = {
349 {LM3530_NAME, 0}, 349 {LM3530_NAME, 0},
350 {} 350 {}
351}; 351};
352MODULE_DEVICE_TABLE(i2c, lm3530_id);
352 353
353static struct i2c_driver lm3530_i2c_driver = { 354static struct i2c_driver lm3530_i2c_driver = {
354 .probe = lm3530_probe, 355 .probe = lm3530_probe,
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index c820e2f53527..3f442003623d 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -524,7 +524,7 @@ void cx88_ir_irq(struct cx88_core *core)
524 for (todo = 32; todo > 0; todo -= bits) { 524 for (todo = 32; todo > 0; todo -= bits) {
525 ev.pulse = samples & 0x80000000 ? false : true; 525 ev.pulse = samples & 0x80000000 ? false : true;
526 bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); 526 bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples));
527 ev.duration = (bits * NSEC_PER_SEC) / (1000 * ir_samplerate); 527 ev.duration = (bits * (NSEC_PER_SEC / 1000)) / ir_samplerate;
528 ir_raw_event_store_with_filter(ir->dev, &ev); 528 ir_raw_event_store_with_filter(ir->dev, &ev);
529 samples <<= bits; 529 samples <<= bits;
530 } 530 }
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 3973f9a94753..ddb4c091dedc 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -136,11 +136,50 @@ unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
136} 136}
137EXPORT_SYMBOL(soc_camera_apply_sensor_flags); 137EXPORT_SYMBOL(soc_camera_apply_sensor_flags);
138 138
139#define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \
140 ((x) >> 24) & 0xff
141
142static int soc_camera_try_fmt(struct soc_camera_device *icd,
143 struct v4l2_format *f)
144{
145 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
146 struct v4l2_pix_format *pix = &f->fmt.pix;
147 int ret;
148
149 dev_dbg(&icd->dev, "TRY_FMT(%c%c%c%c, %ux%u)\n",
150 pixfmtstr(pix->pixelformat), pix->width, pix->height);
151
152 pix->bytesperline = 0;
153 pix->sizeimage = 0;
154
155 ret = ici->ops->try_fmt(icd, f);
156 if (ret < 0)
157 return ret;
158
159 if (!pix->sizeimage) {
160 if (!pix->bytesperline) {
161 const struct soc_camera_format_xlate *xlate;
162
163 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
164 if (!xlate)
165 return -EINVAL;
166
167 ret = soc_mbus_bytes_per_line(pix->width,
168 xlate->host_fmt);
169 if (ret > 0)
170 pix->bytesperline = ret;
171 }
172 if (pix->bytesperline)
173 pix->sizeimage = pix->bytesperline * pix->height;
174 }
175
176 return 0;
177}
178
139static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, 179static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv,
140 struct v4l2_format *f) 180 struct v4l2_format *f)
141{ 181{
142 struct soc_camera_device *icd = file->private_data; 182 struct soc_camera_device *icd = file->private_data;
143 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
144 183
145 WARN_ON(priv != file->private_data); 184 WARN_ON(priv != file->private_data);
146 185
@@ -149,7 +188,7 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv,
149 return -EINVAL; 188 return -EINVAL;
150 189
151 /* limit format to hardware capabilities */ 190 /* limit format to hardware capabilities */
152 return ici->ops->try_fmt(icd, f); 191 return soc_camera_try_fmt(icd, f);
153} 192}
154 193
155static int soc_camera_enum_input(struct file *file, void *priv, 194static int soc_camera_enum_input(struct file *file, void *priv,
@@ -362,9 +401,6 @@ static void soc_camera_free_user_formats(struct soc_camera_device *icd)
362 icd->user_formats = NULL; 401 icd->user_formats = NULL;
363} 402}
364 403
365#define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \
366 ((x) >> 24) & 0xff
367
368/* Called with .vb_lock held, or from the first open(2), see comment there */ 404/* Called with .vb_lock held, or from the first open(2), see comment there */
369static int soc_camera_set_fmt(struct soc_camera_device *icd, 405static int soc_camera_set_fmt(struct soc_camera_device *icd,
370 struct v4l2_format *f) 406 struct v4l2_format *f)
@@ -377,7 +413,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd,
377 pixfmtstr(pix->pixelformat), pix->width, pix->height); 413 pixfmtstr(pix->pixelformat), pix->width, pix->height);
378 414
379 /* We always call try_fmt() before set_fmt() or set_crop() */ 415 /* We always call try_fmt() before set_fmt() or set_crop() */
380 ret = ici->ops->try_fmt(icd, f); 416 ret = soc_camera_try_fmt(icd, f);
381 if (ret < 0) 417 if (ret < 0)
382 return ret; 418 return ret;
383 419
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c
index 5aeaf876ba9b..4aae501f02d0 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -155,8 +155,10 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
155 sd->v4l2_dev = v4l2_dev; 155 sd->v4l2_dev = v4l2_dev;
156 if (sd->internal_ops && sd->internal_ops->registered) { 156 if (sd->internal_ops && sd->internal_ops->registered) {
157 err = sd->internal_ops->registered(sd); 157 err = sd->internal_ops->registered(sd);
158 if (err) 158 if (err) {
159 module_put(sd->owner);
159 return err; 160 return err;
161 }
160 } 162 }
161 163
162 /* This just returns 0 if either of the two args is NULL */ 164 /* This just returns 0 if either of the two args is NULL */
@@ -164,6 +166,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
164 if (err) { 166 if (err) {
165 if (sd->internal_ops && sd->internal_ops->unregistered) 167 if (sd->internal_ops && sd->internal_ops->unregistered)
166 sd->internal_ops->unregistered(sd); 168 sd->internal_ops->unregistered(sd);
169 module_put(sd->owner);
167 return err; 170 return err;
168 } 171 }
169 172
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index 0b8064490676..812729ebf09e 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -155,25 +155,25 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
155 155
156 switch (cmd) { 156 switch (cmd) {
157 case VIDIOC_QUERYCTRL: 157 case VIDIOC_QUERYCTRL:
158 return v4l2_subdev_queryctrl(sd, arg); 158 return v4l2_queryctrl(sd->ctrl_handler, arg);
159 159
160 case VIDIOC_QUERYMENU: 160 case VIDIOC_QUERYMENU:
161 return v4l2_subdev_querymenu(sd, arg); 161 return v4l2_querymenu(sd->ctrl_handler, arg);
162 162
163 case VIDIOC_G_CTRL: 163 case VIDIOC_G_CTRL:
164 return v4l2_subdev_g_ctrl(sd, arg); 164 return v4l2_g_ctrl(sd->ctrl_handler, arg);
165 165
166 case VIDIOC_S_CTRL: 166 case VIDIOC_S_CTRL:
167 return v4l2_subdev_s_ctrl(sd, arg); 167 return v4l2_s_ctrl(sd->ctrl_handler, arg);
168 168
169 case VIDIOC_G_EXT_CTRLS: 169 case VIDIOC_G_EXT_CTRLS:
170 return v4l2_subdev_g_ext_ctrls(sd, arg); 170 return v4l2_g_ext_ctrls(sd->ctrl_handler, arg);
171 171
172 case VIDIOC_S_EXT_CTRLS: 172 case VIDIOC_S_EXT_CTRLS:
173 return v4l2_subdev_s_ext_ctrls(sd, arg); 173 return v4l2_s_ext_ctrls(sd->ctrl_handler, arg);
174 174
175 case VIDIOC_TRY_EXT_CTRLS: 175 case VIDIOC_TRY_EXT_CTRLS:
176 return v4l2_subdev_try_ext_ctrls(sd, arg); 176 return v4l2_try_ext_ctrls(sd->ctrl_handler, arg);
177 177
178 case VIDIOC_DQEVENT: 178 case VIDIOC_DQEVENT:
179 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) 179 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 643ad52e3ca2..4796bbf0ae4e 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -1000,7 +1000,6 @@ static struct i2o_block_device *i2o_block_device_alloc(void)
1000 gd->major = I2O_MAJOR; 1000 gd->major = I2O_MAJOR;
1001 gd->queue = queue; 1001 gd->queue = queue;
1002 gd->fops = &i2o_block_fops; 1002 gd->fops = &i2o_block_fops;
1003 gd->events = DISK_EVENT_MEDIA_CHANGE;
1004 gd->private_data = dev; 1003 gd->private_data = dev;
1005 1004
1006 dev->gd = gd; 1005 dev->gd = gd;
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index d4a851c6b5bf..0b4d5b23bec9 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -144,7 +144,7 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc)
144 int iter, i; 144 int iter, i;
145 unsigned long flags; 145 unsigned long flags;
146 146
147 data->chip->irq_ack(irq_data); 147 data->chip->irq_ack(data);
148 148
149 for (iter = 0 ; iter < MAX_ASIC_ISR_LOOPS; iter++) { 149 for (iter = 0 ; iter < MAX_ASIC_ISR_LOOPS; iter++) {
150 u32 status; 150 u32 status;
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 2e165117457b..3ab9ffa00aad 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -717,14 +717,14 @@ static int usbhs_enable(struct device *dev)
717 gpio_request(pdata->ehci_data->reset_gpio_port[0], 717 gpio_request(pdata->ehci_data->reset_gpio_port[0],
718 "USB1 PHY reset"); 718 "USB1 PHY reset");
719 gpio_direction_output 719 gpio_direction_output
720 (pdata->ehci_data->reset_gpio_port[0], 1); 720 (pdata->ehci_data->reset_gpio_port[0], 0);
721 } 721 }
722 722
723 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) { 723 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) {
724 gpio_request(pdata->ehci_data->reset_gpio_port[1], 724 gpio_request(pdata->ehci_data->reset_gpio_port[1],
725 "USB2 PHY reset"); 725 "USB2 PHY reset");
726 gpio_direction_output 726 gpio_direction_output
727 (pdata->ehci_data->reset_gpio_port[1], 1); 727 (pdata->ehci_data->reset_gpio_port[1], 0);
728 } 728 }
729 729
730 /* Hold the PHY in RESET for enough time till DIR is high */ 730 /* Hold the PHY in RESET for enough time till DIR is high */
@@ -904,11 +904,11 @@ static int usbhs_enable(struct device *dev)
904 904
905 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 905 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
906 gpio_set_value 906 gpio_set_value
907 (pdata->ehci_data->reset_gpio_port[0], 0); 907 (pdata->ehci_data->reset_gpio_port[0], 1);
908 908
909 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 909 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
910 gpio_set_value 910 gpio_set_value
911 (pdata->ehci_data->reset_gpio_port[1], 0); 911 (pdata->ehci_data->reset_gpio_port[1], 1);
912 } 912 }
913 913
914end_count: 914end_count:
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 16422de0823a..2c0d4d16491a 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -447,12 +447,13 @@ static int __init load_twl4030_script(struct twl4030_script *tscript,
447 if (err) 447 if (err)
448 goto out; 448 goto out;
449 } 449 }
450 if (tscript->flags & TWL4030_SLEEP_SCRIPT) 450 if (tscript->flags & TWL4030_SLEEP_SCRIPT) {
451 if (order) 451 if (order)
452 pr_warning("TWL4030: Bad order of scripts (sleep "\ 452 pr_warning("TWL4030: Bad order of scripts (sleep "\
453 "script before wakeup) Leads to boot"\ 453 "script before wakeup) Leads to boot"\
454 "failure on some boards\n"); 454 "failure on some boards\n");
455 err = twl4030_config_sleep_sequence(address); 455 err = twl4030_config_sleep_sequence(address);
456 }
456out: 457out:
457 return err; 458 return err;
458} 459}
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 2b200c1cfbba..461e6a17fb90 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -94,7 +94,7 @@ static void mmc_host_clk_gate_delayed(struct mmc_host *host)
94 spin_unlock_irqrestore(&host->clk_lock, flags); 94 spin_unlock_irqrestore(&host->clk_lock, flags);
95 return; 95 return;
96 } 96 }
97 mmc_claim_host(host); 97 mutex_lock(&host->clk_gate_mutex);
98 spin_lock_irqsave(&host->clk_lock, flags); 98 spin_lock_irqsave(&host->clk_lock, flags);
99 if (!host->clk_requests) { 99 if (!host->clk_requests) {
100 spin_unlock_irqrestore(&host->clk_lock, flags); 100 spin_unlock_irqrestore(&host->clk_lock, flags);
@@ -104,7 +104,7 @@ static void mmc_host_clk_gate_delayed(struct mmc_host *host)
104 pr_debug("%s: gated MCI clock\n", mmc_hostname(host)); 104 pr_debug("%s: gated MCI clock\n", mmc_hostname(host));
105 } 105 }
106 spin_unlock_irqrestore(&host->clk_lock, flags); 106 spin_unlock_irqrestore(&host->clk_lock, flags);
107 mmc_release_host(host); 107 mutex_unlock(&host->clk_gate_mutex);
108} 108}
109 109
110/* 110/*
@@ -130,7 +130,7 @@ void mmc_host_clk_ungate(struct mmc_host *host)
130{ 130{
131 unsigned long flags; 131 unsigned long flags;
132 132
133 mmc_claim_host(host); 133 mutex_lock(&host->clk_gate_mutex);
134 spin_lock_irqsave(&host->clk_lock, flags); 134 spin_lock_irqsave(&host->clk_lock, flags);
135 if (host->clk_gated) { 135 if (host->clk_gated) {
136 spin_unlock_irqrestore(&host->clk_lock, flags); 136 spin_unlock_irqrestore(&host->clk_lock, flags);
@@ -140,7 +140,7 @@ void mmc_host_clk_ungate(struct mmc_host *host)
140 } 140 }
141 host->clk_requests++; 141 host->clk_requests++;
142 spin_unlock_irqrestore(&host->clk_lock, flags); 142 spin_unlock_irqrestore(&host->clk_lock, flags);
143 mmc_release_host(host); 143 mutex_unlock(&host->clk_gate_mutex);
144} 144}
145 145
146/** 146/**
@@ -215,6 +215,7 @@ static inline void mmc_host_clk_init(struct mmc_host *host)
215 host->clk_gated = false; 215 host->clk_gated = false;
216 INIT_WORK(&host->clk_gate_work, mmc_host_clk_gate_work); 216 INIT_WORK(&host->clk_gate_work, mmc_host_clk_gate_work);
217 spin_lock_init(&host->clk_lock); 217 spin_lock_init(&host->clk_lock);
218 mutex_init(&host->clk_gate_mutex);
218} 219}
219 220
220/** 221/**
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index f9b611fc773e..60e4186a4345 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -124,8 +124,10 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np)
124#endif 124#endif
125} 125}
126 126
127static const struct of_device_id sdhci_of_match[];
127static int __devinit sdhci_of_probe(struct platform_device *ofdev) 128static int __devinit sdhci_of_probe(struct platform_device *ofdev)
128{ 129{
130 const struct of_device_id *match;
129 struct device_node *np = ofdev->dev.of_node; 131 struct device_node *np = ofdev->dev.of_node;
130 struct sdhci_of_data *sdhci_of_data; 132 struct sdhci_of_data *sdhci_of_data;
131 struct sdhci_host *host; 133 struct sdhci_host *host;
@@ -134,9 +136,10 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev)
134 int size; 136 int size;
135 int ret; 137 int ret;
136 138
137 if (!ofdev->dev.of_match) 139 match = of_match_device(sdhci_of_match, &ofdev->dev);
140 if (!match)
138 return -EINVAL; 141 return -EINVAL;
139 sdhci_of_data = ofdev->dev.of_match->data; 142 sdhci_of_data = match->data;
140 143
141 if (!of_device_is_available(np)) 144 if (!of_device_is_available(np))
142 return -ENODEV; 145 return -ENODEV;
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index bd483f0c57e1..c1d33464aee8 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -214,11 +214,13 @@ static void __devinit of_free_probes(const char **probes)
214} 214}
215#endif 215#endif
216 216
217static struct of_device_id of_flash_match[];
217static int __devinit of_flash_probe(struct platform_device *dev) 218static int __devinit of_flash_probe(struct platform_device *dev)
218{ 219{
219#ifdef CONFIG_MTD_PARTITIONS 220#ifdef CONFIG_MTD_PARTITIONS
220 const char **part_probe_types; 221 const char **part_probe_types;
221#endif 222#endif
223 const struct of_device_id *match;
222 struct device_node *dp = dev->dev.of_node; 224 struct device_node *dp = dev->dev.of_node;
223 struct resource res; 225 struct resource res;
224 struct of_flash *info; 226 struct of_flash *info;
@@ -232,9 +234,10 @@ static int __devinit of_flash_probe(struct platform_device *dev)
232 struct mtd_info **mtd_list = NULL; 234 struct mtd_info **mtd_list = NULL;
233 resource_size_t res_size; 235 resource_size_t res_size;
234 236
235 if (!dev->dev.of_match) 237 match = of_match_device(of_flash_match, &dev->dev);
238 if (!match)
236 return -EINVAL; 239 return -EINVAL;
237 probe_type = dev->dev.of_match->data; 240 probe_type = match->data;
238 241
239 reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32); 242 reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32);
240 243
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index dc280bc8eba2..6c884ef1b069 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2536,7 +2536,7 @@ config S6GMAC
2536source "drivers/net/stmmac/Kconfig" 2536source "drivers/net/stmmac/Kconfig"
2537 2537
2538config PCH_GBE 2538config PCH_GBE
2539 tristate "PCH Gigabit Ethernet" 2539 tristate "Intel EG20T PCH / OKI SEMICONDUCTOR ML7223 IOH GbE"
2540 depends on PCI 2540 depends on PCI
2541 select MII 2541 select MII
2542 ---help--- 2542 ---help---
@@ -2548,6 +2548,12 @@ config PCH_GBE
2548 to Gigabit Ethernet. 2548 to Gigabit Ethernet.
2549 This driver enables Gigabit Ethernet function. 2549 This driver enables Gigabit Ethernet function.
2550 2550
2551 This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
2552 Output Hub), ML7223.
2553 ML7223 IOH is for MP(Media Phone) use.
2554 ML7223 is companion chip for Intel Atom E6xx series.
2555 ML7223 is completely compatible for Intel EG20T PCH.
2556
2551endif # NETDEV_1000 2557endif # NETDEV_1000
2552 2558
2553# 2559#
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 01b604ad155e..e5a7375685ad 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -144,7 +144,7 @@ obj-$(CONFIG_NE3210) += ne3210.o 8390.o
144obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o 144obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
145obj-$(CONFIG_B44) += b44.o 145obj-$(CONFIG_B44) += b44.o
146obj-$(CONFIG_FORCEDETH) += forcedeth.o 146obj-$(CONFIG_FORCEDETH) += forcedeth.o
147obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o 147obj-$(CONFIG_NE_H8300) += ne-h8300.o
148obj-$(CONFIG_AX88796) += ax88796.o 148obj-$(CONFIG_AX88796) += ax88796.o
149obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o 149obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
150obj-$(CONFIG_FTMAC100) += ftmac100.o 150obj-$(CONFIG_FTMAC100) += ftmac100.o
@@ -219,7 +219,7 @@ obj-$(CONFIG_SC92031) += sc92031.o
219obj-$(CONFIG_LP486E) += lp486e.o 219obj-$(CONFIG_LP486E) += lp486e.o
220 220
221obj-$(CONFIG_ETH16I) += eth16i.o 221obj-$(CONFIG_ETH16I) += eth16i.o
222obj-$(CONFIG_ZORRO8390) += zorro8390.o 8390.o 222obj-$(CONFIG_ZORRO8390) += zorro8390.o
223obj-$(CONFIG_HPLANCE) += hplance.o 7990.o 223obj-$(CONFIG_HPLANCE) += hplance.o 7990.o
224obj-$(CONFIG_MVME147_NET) += mvme147.o 7990.o 224obj-$(CONFIG_MVME147_NET) += mvme147.o 7990.o
225obj-$(CONFIG_EQUALIZER) += eql.o 225obj-$(CONFIG_EQUALIZER) += eql.o
@@ -231,7 +231,7 @@ obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o
231obj-$(CONFIG_DECLANCE) += declance.o 231obj-$(CONFIG_DECLANCE) += declance.o
232obj-$(CONFIG_ATARILANCE) += atarilance.o 232obj-$(CONFIG_ATARILANCE) += atarilance.o
233obj-$(CONFIG_A2065) += a2065.o 233obj-$(CONFIG_A2065) += a2065.o
234obj-$(CONFIG_HYDRA) += hydra.o 8390.o 234obj-$(CONFIG_HYDRA) += hydra.o
235obj-$(CONFIG_ARIADNE) += ariadne.o 235obj-$(CONFIG_ARIADNE) += ariadne.o
236obj-$(CONFIG_CS89x0) += cs89x0.o 236obj-$(CONFIG_CS89x0) += cs89x0.o
237obj-$(CONFIG_MACSONIC) += macsonic.o 237obj-$(CONFIG_MACSONIC) += macsonic.o
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 4af235d41fda..fbfb5b47c506 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -527,7 +527,7 @@ static void __init etherh_banner(void)
527 * Read the ethernet address string from the on board rom. 527 * Read the ethernet address string from the on board rom.
528 * This is an ascii string... 528 * This is an ascii string...
529 */ 529 */
530static int __init etherh_addr(char *addr, struct expansion_card *ec) 530static int __devinit etherh_addr(char *addr, struct expansion_card *ec)
531{ 531{
532 struct in_chunk_dir cd; 532 struct in_chunk_dir cd;
533 char *s; 533 char *s;
@@ -655,7 +655,7 @@ static const struct net_device_ops etherh_netdev_ops = {
655static u32 etherh_regoffsets[16]; 655static u32 etherh_regoffsets[16];
656static u32 etherm_regoffsets[16]; 656static u32 etherm_regoffsets[16];
657 657
658static int __init 658static int __devinit
659etherh_probe(struct expansion_card *ec, const struct ecard_id *id) 659etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
660{ 660{
661 const struct etherh_data *data = id->data; 661 const struct etherh_data *data = id->data;
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 66823eded7a3..2353eca32593 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -213,7 +213,7 @@ struct be_rx_stats {
213 213
214struct be_rx_compl_info { 214struct be_rx_compl_info {
215 u32 rss_hash; 215 u32 rss_hash;
216 u16 vid; 216 u16 vlan_tag;
217 u16 pkt_size; 217 u16 pkt_size;
218 u16 rxq_idx; 218 u16 rxq_idx;
219 u16 mac_id; 219 u16 mac_id;
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 1e2d825bb94a..9dc9394fd4ca 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -132,7 +132,7 @@ static void be_async_grp5_pvid_state_process(struct be_adapter *adapter,
132 struct be_async_event_grp5_pvid_state *evt) 132 struct be_async_event_grp5_pvid_state *evt)
133{ 133{
134 if (evt->enabled) 134 if (evt->enabled)
135 adapter->pvid = evt->tag; 135 adapter->pvid = le16_to_cpu(evt->tag);
136 else 136 else
137 adapter->pvid = 0; 137 adapter->pvid = 0;
138} 138}
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 02a0443d1821..9187fb4e08f1 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1018,7 +1018,8 @@ static void be_rx_compl_process(struct be_adapter *adapter,
1018 kfree_skb(skb); 1018 kfree_skb(skb);
1019 return; 1019 return;
1020 } 1020 }
1021 vlan_hwaccel_receive_skb(skb, adapter->vlan_grp, rxcp->vid); 1021 vlan_hwaccel_receive_skb(skb, adapter->vlan_grp,
1022 rxcp->vlan_tag);
1022 } else { 1023 } else {
1023 netif_receive_skb(skb); 1024 netif_receive_skb(skb);
1024 } 1025 }
@@ -1076,7 +1077,8 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1076 if (likely(!rxcp->vlanf)) 1077 if (likely(!rxcp->vlanf))
1077 napi_gro_frags(&eq_obj->napi); 1078 napi_gro_frags(&eq_obj->napi);
1078 else 1079 else
1079 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, rxcp->vid); 1080 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp,
1081 rxcp->vlan_tag);
1080} 1082}
1081 1083
1082static void be_parse_rx_compl_v1(struct be_adapter *adapter, 1084static void be_parse_rx_compl_v1(struct be_adapter *adapter,
@@ -1102,7 +1104,8 @@ static void be_parse_rx_compl_v1(struct be_adapter *adapter,
1102 rxcp->pkt_type = 1104 rxcp->pkt_type =
1103 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, cast_enc, compl); 1105 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, cast_enc, compl);
1104 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtm, compl); 1106 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtm, compl);
1105 rxcp->vid = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag, compl); 1107 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag,
1108 compl);
1106} 1109}
1107 1110
1108static void be_parse_rx_compl_v0(struct be_adapter *adapter, 1111static void be_parse_rx_compl_v0(struct be_adapter *adapter,
@@ -1128,7 +1131,8 @@ static void be_parse_rx_compl_v0(struct be_adapter *adapter,
1128 rxcp->pkt_type = 1131 rxcp->pkt_type =
1129 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, cast_enc, compl); 1132 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, cast_enc, compl);
1130 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtm, compl); 1133 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtm, compl);
1131 rxcp->vid = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag, compl); 1134 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag,
1135 compl);
1132} 1136}
1133 1137
1134static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) 1138static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
@@ -1155,9 +1159,11 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
1155 rxcp->vlanf = 0; 1159 rxcp->vlanf = 0;
1156 1160
1157 if (!lancer_chip(adapter)) 1161 if (!lancer_chip(adapter))
1158 rxcp->vid = swab16(rxcp->vid); 1162 rxcp->vlan_tag = swab16(rxcp->vlan_tag);
1159 1163
1160 if ((adapter->pvid == rxcp->vid) && !adapter->vlan_tag[rxcp->vid]) 1164 if (((adapter->pvid & VLAN_VID_MASK) ==
1165 (rxcp->vlan_tag & VLAN_VID_MASK)) &&
1166 !adapter->vlan_tag[rxcp->vlan_tag])
1161 rxcp->vlanf = 0; 1167 rxcp->vlanf = 0;
1162 1168
1163 /* As the compl has been parsed, reset it; we wont touch it again */ 1169 /* As the compl has been parsed, reset it; we wont touch it again */
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
index b28baff70864..01b8a6af275b 100644
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -39,7 +39,7 @@
39 39
40typedef struct mac_addr { 40typedef struct mac_addr {
41 u8 mac_addr_value[ETH_ALEN]; 41 u8 mac_addr_value[ETH_ALEN];
42} mac_addr_t; 42} __packed mac_addr_t;
43 43
44enum { 44enum {
45 BOND_AD_STABLE = 0, 45 BOND_AD_STABLE = 0,
@@ -134,12 +134,12 @@ typedef struct lacpdu {
134 u8 tlv_type_terminator; // = terminator 134 u8 tlv_type_terminator; // = terminator
135 u8 terminator_length; // = 0 135 u8 terminator_length; // = 0
136 u8 reserved_50[50]; // = 0 136 u8 reserved_50[50]; // = 0
137} lacpdu_t; 137} __packed lacpdu_t;
138 138
139typedef struct lacpdu_header { 139typedef struct lacpdu_header {
140 struct ethhdr hdr; 140 struct ethhdr hdr;
141 struct lacpdu lacpdu; 141 struct lacpdu lacpdu;
142} lacpdu_header_t; 142} __packed lacpdu_header_t;
143 143
144// Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard) 144// Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard)
145typedef struct bond_marker { 145typedef struct bond_marker {
@@ -155,12 +155,12 @@ typedef struct bond_marker {
155 u8 tlv_type_terminator; // = 0x00 155 u8 tlv_type_terminator; // = 0x00
156 u8 terminator_length; // = 0x00 156 u8 terminator_length; // = 0x00
157 u8 reserved_90[90]; // = 0 157 u8 reserved_90[90]; // = 0
158} bond_marker_t; 158} __packed bond_marker_t;
159 159
160typedef struct bond_marker_header { 160typedef struct bond_marker_header {
161 struct ethhdr hdr; 161 struct ethhdr hdr;
162 struct bond_marker marker; 162 struct bond_marker marker;
163} bond_marker_header_t; 163} __packed bond_marker_header_t;
164 164
165#pragma pack() 165#pragma pack()
166 166
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index bd1d811c204f..5fedc3375562 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -247,8 +247,10 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
247} 247}
248#endif /* CONFIG_PPC_MPC512x */ 248#endif /* CONFIG_PPC_MPC512x */
249 249
250static struct of_device_id mpc5xxx_can_table[];
250static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) 251static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
251{ 252{
253 const struct of_device_id *match;
252 struct mpc5xxx_can_data *data; 254 struct mpc5xxx_can_data *data;
253 struct device_node *np = ofdev->dev.of_node; 255 struct device_node *np = ofdev->dev.of_node;
254 struct net_device *dev; 256 struct net_device *dev;
@@ -258,9 +260,10 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
258 int irq, mscan_clksrc = 0; 260 int irq, mscan_clksrc = 0;
259 int err = -ENOMEM; 261 int err = -ENOMEM;
260 262
261 if (!ofdev->dev.of_match) 263 match = of_match_device(mpc5xxx_can_table, &ofdev->dev);
264 if (!match)
262 return -EINVAL; 265 return -EINVAL;
263 data = (struct mpc5xxx_can_data *)ofdev->dev.of_match->data; 266 data = match->data;
264 267
265 base = of_iomap(np, 0); 268 base = of_iomap(np, 0);
266 if (!base) { 269 if (!base) {
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index a358ea9445a2..f501bba1fc6f 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -346,10 +346,10 @@ static void sja1000_rx(struct net_device *dev)
346 | (priv->read_reg(priv, REG_ID2) >> 5); 346 | (priv->read_reg(priv, REG_ID2) >> 5);
347 } 347 }
348 348
349 cf->can_dlc = get_can_dlc(fi & 0x0F);
349 if (fi & FI_RTR) { 350 if (fi & FI_RTR) {
350 id |= CAN_RTR_FLAG; 351 id |= CAN_RTR_FLAG;
351 } else { 352 } else {
352 cf->can_dlc = get_can_dlc(fi & 0x0F);
353 for (i = 0; i < cf->can_dlc; i++) 353 for (i = 0; i < cf->can_dlc; i++)
354 cf->data[i] = priv->read_reg(priv, dreg++); 354 cf->data[i] = priv->read_reg(priv, dreg++);
355 } 355 }
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index b423965a78d1..1b49df6b2470 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -583,7 +583,9 @@ static int slcan_open(struct tty_struct *tty)
583 /* Done. We have linked the TTY line to a channel. */ 583 /* Done. We have linked the TTY line to a channel. */
584 rtnl_unlock(); 584 rtnl_unlock();
585 tty->receive_room = 65536; /* We don't flow control */ 585 tty->receive_room = 65536; /* We don't flow control */
586 return sl->dev->base_addr; 586
587 /* TTY layer expects 0 on success */
588 return 0;
587 589
588err_free_chan: 590err_free_chan:
589 sl->tty = NULL; 591 sl->tty = NULL;
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 3e2e734fecb7..f3bbdcef338c 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -55,15 +55,20 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
55 cmd->duplex = -1; 55 cmd->duplex = -1;
56 } 56 }
57 57
58 cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full 58 if (cmd->speed == SPEED_10000) {
59 | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half 59 cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
60 | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half 60 cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
61 | SUPPORTED_Autoneg | SUPPORTED_FIBRE); 61 cmd->port = PORT_FIBRE;
62 62 } else {
63 cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_Autoneg 63 cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full
64 | ADVERTISED_FIBRE); 64 | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full
65 | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg
66 | SUPPORTED_TP);
67 cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg
68 | ADVERTISED_TP);
69 cmd->port = PORT_TP;
70 }
65 71
66 cmd->port = PORT_FIBRE;
67 cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE; 72 cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE;
68 73
69 return 0; 74 return 0;
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 53c0f04b1b23..cf79cf759e13 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2688,9 +2688,6 @@ static int ehea_open(struct net_device *dev)
2688 netif_start_queue(dev); 2688 netif_start_queue(dev);
2689 } 2689 }
2690 2690
2691 init_waitqueue_head(&port->swqe_avail_wq);
2692 init_waitqueue_head(&port->restart_wq);
2693
2694 mutex_unlock(&port->port_lock); 2691 mutex_unlock(&port->port_lock);
2695 2692
2696 return ret; 2693 return ret;
@@ -3276,6 +3273,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3276 3273
3277 INIT_WORK(&port->reset_task, ehea_reset_port); 3274 INIT_WORK(&port->reset_task, ehea_reset_port);
3278 3275
3276 init_waitqueue_head(&port->swqe_avail_wq);
3277 init_waitqueue_head(&port->restart_wq);
3278
3279 ret = register_netdev(dev); 3279 ret = register_netdev(dev);
3280 if (ret) { 3280 if (ret) {
3281 pr_err("register_netdev failed. ret=%d\n", ret); 3281 pr_err("register_netdev failed. ret=%d\n", ret);
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 24cb953900dd..5131e61c358c 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -998,8 +998,10 @@ static const struct net_device_ops fs_enet_netdev_ops = {
998#endif 998#endif
999}; 999};
1000 1000
1001static struct of_device_id fs_enet_match[];
1001static int __devinit fs_enet_probe(struct platform_device *ofdev) 1002static int __devinit fs_enet_probe(struct platform_device *ofdev)
1002{ 1003{
1004 const struct of_device_id *match;
1003 struct net_device *ndev; 1005 struct net_device *ndev;
1004 struct fs_enet_private *fep; 1006 struct fs_enet_private *fep;
1005 struct fs_platform_info *fpi; 1007 struct fs_platform_info *fpi;
@@ -1007,14 +1009,15 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1007 const u8 *mac_addr; 1009 const u8 *mac_addr;
1008 int privsize, len, ret = -ENODEV; 1010 int privsize, len, ret = -ENODEV;
1009 1011
1010 if (!ofdev->dev.of_match) 1012 match = of_match_device(fs_enet_match, &ofdev->dev);
1013 if (!match)
1011 return -EINVAL; 1014 return -EINVAL;
1012 1015
1013 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL); 1016 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL);
1014 if (!fpi) 1017 if (!fpi)
1015 return -ENOMEM; 1018 return -ENOMEM;
1016 1019
1017 if (!IS_FEC(ofdev->dev.of_match)) { 1020 if (!IS_FEC(match)) {
1018 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len); 1021 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
1019 if (!data || len != 4) 1022 if (!data || len != 4)
1020 goto out_free_fpi; 1023 goto out_free_fpi;
@@ -1049,7 +1052,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1049 fep->dev = &ofdev->dev; 1052 fep->dev = &ofdev->dev;
1050 fep->ndev = ndev; 1053 fep->ndev = ndev;
1051 fep->fpi = fpi; 1054 fep->fpi = fpi;
1052 fep->ops = ofdev->dev.of_match->data; 1055 fep->ops = match->data;
1053 1056
1054 ret = fep->ops->setup_data(ndev); 1057 ret = fep->ops->setup_data(ndev);
1055 if (ret) 1058 if (ret)
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 7e840d373ab3..6a2e150e75bb 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -101,17 +101,20 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus)
101 return 0; 101 return 0;
102} 102}
103 103
104static struct of_device_id fs_enet_mdio_fec_match[];
104static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) 105static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
105{ 106{
107 const struct of_device_id *match;
106 struct resource res; 108 struct resource res;
107 struct mii_bus *new_bus; 109 struct mii_bus *new_bus;
108 struct fec_info *fec; 110 struct fec_info *fec;
109 int (*get_bus_freq)(struct device_node *); 111 int (*get_bus_freq)(struct device_node *);
110 int ret = -ENOMEM, clock, speed; 112 int ret = -ENOMEM, clock, speed;
111 113
112 if (!ofdev->dev.of_match) 114 match = of_match_device(fs_enet_mdio_fec_match, &ofdev->dev);
115 if (!match)
113 return -EINVAL; 116 return -EINVAL;
114 get_bus_freq = ofdev->dev.of_match->data; 117 get_bus_freq = match->data;
115 118
116 new_bus = mdiobus_alloc(); 119 new_bus = mdiobus_alloc();
117 if (!new_bus) 120 if (!new_bus)
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c
index c5ef62ceb840..1cd481c04202 100644
--- a/drivers/net/hydra.c
+++ b/drivers/net/hydra.c
@@ -98,15 +98,15 @@ static const struct net_device_ops hydra_netdev_ops = {
98 .ndo_open = hydra_open, 98 .ndo_open = hydra_open,
99 .ndo_stop = hydra_close, 99 .ndo_stop = hydra_close,
100 100
101 .ndo_start_xmit = ei_start_xmit, 101 .ndo_start_xmit = __ei_start_xmit,
102 .ndo_tx_timeout = ei_tx_timeout, 102 .ndo_tx_timeout = __ei_tx_timeout,
103 .ndo_get_stats = ei_get_stats, 103 .ndo_get_stats = __ei_get_stats,
104 .ndo_set_multicast_list = ei_set_multicast_list, 104 .ndo_set_multicast_list = __ei_set_multicast_list,
105 .ndo_validate_addr = eth_validate_addr, 105 .ndo_validate_addr = eth_validate_addr,
106 .ndo_set_mac_address = eth_mac_addr, 106 .ndo_set_mac_address = eth_mac_addr,
107 .ndo_change_mtu = eth_change_mtu, 107 .ndo_change_mtu = eth_change_mtu,
108#ifdef CONFIG_NET_POLL_CONTROLLER 108#ifdef CONFIG_NET_POLL_CONTROLLER
109 .ndo_poll_controller = ei_poll, 109 .ndo_poll_controller = __ei_poll,
110#endif 110#endif
111}; 111};
112 112
@@ -125,7 +125,7 @@ static int __devinit hydra_init(struct zorro_dev *z)
125 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 125 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
126 }; 126 };
127 127
128 dev = alloc_ei_netdev(); 128 dev = ____alloc_ei_netdev(0);
129 if (!dev) 129 if (!dev)
130 return -ENOMEM; 130 return -ENOMEM;
131 131
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c
index 30be8c634ebd..7298a34bc795 100644
--- a/drivers/net/ne-h8300.c
+++ b/drivers/net/ne-h8300.c
@@ -167,7 +167,7 @@ static void cleanup_card(struct net_device *dev)
167#ifndef MODULE 167#ifndef MODULE
168struct net_device * __init ne_probe(int unit) 168struct net_device * __init ne_probe(int unit)
169{ 169{
170 struct net_device *dev = alloc_ei_netdev(); 170 struct net_device *dev = ____alloc_ei_netdev(0);
171 int err; 171 int err;
172 172
173 if (!dev) 173 if (!dev)
@@ -197,15 +197,15 @@ static const struct net_device_ops ne_netdev_ops = {
197 .ndo_open = ne_open, 197 .ndo_open = ne_open,
198 .ndo_stop = ne_close, 198 .ndo_stop = ne_close,
199 199
200 .ndo_start_xmit = ei_start_xmit, 200 .ndo_start_xmit = __ei_start_xmit,
201 .ndo_tx_timeout = ei_tx_timeout, 201 .ndo_tx_timeout = __ei_tx_timeout,
202 .ndo_get_stats = ei_get_stats, 202 .ndo_get_stats = __ei_get_stats,
203 .ndo_set_multicast_list = ei_set_multicast_list, 203 .ndo_set_multicast_list = __ei_set_multicast_list,
204 .ndo_validate_addr = eth_validate_addr, 204 .ndo_validate_addr = eth_validate_addr,
205 .ndo_set_mac_address = eth_mac_addr, 205 .ndo_set_mac_address = eth_mac_addr,
206 .ndo_change_mtu = eth_change_mtu, 206 .ndo_change_mtu = eth_change_mtu,
207#ifdef CONFIG_NET_POLL_CONTROLLER 207#ifdef CONFIG_NET_POLL_CONTROLLER
208 .ndo_poll_controller = ei_poll, 208 .ndo_poll_controller = __ei_poll,
209#endif 209#endif
210}; 210};
211 211
@@ -637,7 +637,7 @@ int init_module(void)
637 int err; 637 int err;
638 638
639 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { 639 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
640 struct net_device *dev = alloc_ei_netdev(); 640 struct net_device *dev = ____alloc_ei_netdev(0);
641 if (!dev) 641 if (!dev)
642 break; 642 break;
643 if (io[this_dev]) { 643 if (io[this_dev]) {
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index 2ef2f9cdefa6..56d049a472da 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -34,6 +34,10 @@ const char pch_driver_version[] = DRV_VERSION;
34#define PCH_GBE_COPYBREAK_DEFAULT 256 34#define PCH_GBE_COPYBREAK_DEFAULT 256
35#define PCH_GBE_PCI_BAR 1 35#define PCH_GBE_PCI_BAR 1
36 36
37/* Macros for ML7223 */
38#define PCI_VENDOR_ID_ROHM 0x10db
39#define PCI_DEVICE_ID_ROHM_ML7223_GBE 0x8013
40
37#define PCH_GBE_TX_WEIGHT 64 41#define PCH_GBE_TX_WEIGHT 64
38#define PCH_GBE_RX_WEIGHT 64 42#define PCH_GBE_RX_WEIGHT 64
39#define PCH_GBE_RX_BUFFER_WRITE 16 43#define PCH_GBE_RX_BUFFER_WRITE 16
@@ -43,8 +47,7 @@ const char pch_driver_version[] = DRV_VERSION;
43 47
44#define PCH_GBE_MAC_RGMII_CTRL_SETTING ( \ 48#define PCH_GBE_MAC_RGMII_CTRL_SETTING ( \
45 PCH_GBE_CHIP_TYPE_INTERNAL | \ 49 PCH_GBE_CHIP_TYPE_INTERNAL | \
46 PCH_GBE_RGMII_MODE_RGMII | \ 50 PCH_GBE_RGMII_MODE_RGMII \
47 PCH_GBE_CRS_SEL \
48 ) 51 )
49 52
50/* Ethertype field values */ 53/* Ethertype field values */
@@ -1494,12 +1497,11 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter,
1494 /* Write meta date of skb */ 1497 /* Write meta date of skb */
1495 skb_put(skb, length); 1498 skb_put(skb, length);
1496 skb->protocol = eth_type_trans(skb, netdev); 1499 skb->protocol = eth_type_trans(skb, netdev);
1497 if ((tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) == 1500 if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK)
1498 PCH_GBE_RXD_ACC_STAT_TCPIPOK) {
1499 skb->ip_summed = CHECKSUM_UNNECESSARY;
1500 } else {
1501 skb->ip_summed = CHECKSUM_NONE; 1501 skb->ip_summed = CHECKSUM_NONE;
1502 } 1502 else
1503 skb->ip_summed = CHECKSUM_UNNECESSARY;
1504
1503 napi_gro_receive(&adapter->napi, skb); 1505 napi_gro_receive(&adapter->napi, skb);
1504 (*work_done)++; 1506 (*work_done)++;
1505 pr_debug("Receive skb->ip_summed: %d length: %d\n", 1507 pr_debug("Receive skb->ip_summed: %d length: %d\n",
@@ -2420,6 +2422,13 @@ static DEFINE_PCI_DEVICE_TABLE(pch_gbe_pcidev_id) = {
2420 .class = (PCI_CLASS_NETWORK_ETHERNET << 8), 2422 .class = (PCI_CLASS_NETWORK_ETHERNET << 8),
2421 .class_mask = (0xFFFF00) 2423 .class_mask = (0xFFFF00)
2422 }, 2424 },
2425 {.vendor = PCI_VENDOR_ID_ROHM,
2426 .device = PCI_DEVICE_ID_ROHM_ML7223_GBE,
2427 .subvendor = PCI_ANY_ID,
2428 .subdevice = PCI_ANY_ID,
2429 .class = (PCI_CLASS_NETWORK_ETHERNET << 8),
2430 .class_mask = (0xFFFF00)
2431 },
2423 /* required last entry */ 2432 /* required last entry */
2424 {0} 2433 {0}
2425}; 2434};
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c
index d98479030ef2..3dd45ed61f0a 100644
--- a/drivers/net/sfc/mcdi.c
+++ b/drivers/net/sfc/mcdi.c
@@ -50,6 +50,20 @@ static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx)
50 return &nic_data->mcdi; 50 return &nic_data->mcdi;
51} 51}
52 52
53static inline void
54efx_mcdi_readd(struct efx_nic *efx, efx_dword_t *value, unsigned reg)
55{
56 struct siena_nic_data *nic_data = efx->nic_data;
57 value->u32[0] = (__force __le32)__raw_readl(nic_data->mcdi_smem + reg);
58}
59
60static inline void
61efx_mcdi_writed(struct efx_nic *efx, const efx_dword_t *value, unsigned reg)
62{
63 struct siena_nic_data *nic_data = efx->nic_data;
64 __raw_writel((__force u32)value->u32[0], nic_data->mcdi_smem + reg);
65}
66
53void efx_mcdi_init(struct efx_nic *efx) 67void efx_mcdi_init(struct efx_nic *efx)
54{ 68{
55 struct efx_mcdi_iface *mcdi; 69 struct efx_mcdi_iface *mcdi;
@@ -70,8 +84,8 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd,
70 const u8 *inbuf, size_t inlen) 84 const u8 *inbuf, size_t inlen)
71{ 85{
72 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 86 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
73 unsigned pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 87 unsigned pdu = MCDI_PDU(efx);
74 unsigned doorbell = FR_CZ_MC_TREG_SMEM + MCDI_DOORBELL(efx); 88 unsigned doorbell = MCDI_DOORBELL(efx);
75 unsigned int i; 89 unsigned int i;
76 efx_dword_t hdr; 90 efx_dword_t hdr;
77 u32 xflags, seqno; 91 u32 xflags, seqno;
@@ -92,30 +106,28 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd,
92 MCDI_HEADER_SEQ, seqno, 106 MCDI_HEADER_SEQ, seqno,
93 MCDI_HEADER_XFLAGS, xflags); 107 MCDI_HEADER_XFLAGS, xflags);
94 108
95 efx_writed(efx, &hdr, pdu); 109 efx_mcdi_writed(efx, &hdr, pdu);
96 110
97 for (i = 0; i < inlen; i += 4) { 111 for (i = 0; i < inlen; i += 4)
98 _efx_writed(efx, *((__le32 *)(inbuf + i)), pdu + 4 + i); 112 efx_mcdi_writed(efx, (const efx_dword_t *)(inbuf + i),
99 /* use wmb() within loop to inhibit write combining */ 113 pdu + 4 + i);
100 wmb();
101 }
102 114
103 /* ring the doorbell with a distinctive value */ 115 /* ring the doorbell with a distinctive value */
104 _efx_writed(efx, (__force __le32) 0x45789abc, doorbell); 116 EFX_POPULATE_DWORD_1(hdr, EFX_DWORD_0, 0x45789abc);
105 wmb(); 117 efx_mcdi_writed(efx, &hdr, doorbell);
106} 118}
107 119
108static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) 120static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen)
109{ 121{
110 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 122 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
111 unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 123 unsigned int pdu = MCDI_PDU(efx);
112 int i; 124 int i;
113 125
114 BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT); 126 BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT);
115 BUG_ON(outlen & 3 || outlen >= 0x100); 127 BUG_ON(outlen & 3 || outlen >= 0x100);
116 128
117 for (i = 0; i < outlen; i += 4) 129 for (i = 0; i < outlen; i += 4)
118 *((__le32 *)(outbuf + i)) = _efx_readd(efx, pdu + 4 + i); 130 efx_mcdi_readd(efx, (efx_dword_t *)(outbuf + i), pdu + 4 + i);
119} 131}
120 132
121static int efx_mcdi_poll(struct efx_nic *efx) 133static int efx_mcdi_poll(struct efx_nic *efx)
@@ -123,7 +135,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
123 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 135 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
124 unsigned int time, finish; 136 unsigned int time, finish;
125 unsigned int respseq, respcmd, error; 137 unsigned int respseq, respcmd, error;
126 unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 138 unsigned int pdu = MCDI_PDU(efx);
127 unsigned int rc, spins; 139 unsigned int rc, spins;
128 efx_dword_t reg; 140 efx_dword_t reg;
129 141
@@ -149,8 +161,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
149 161
150 time = get_seconds(); 162 time = get_seconds();
151 163
152 rmb(); 164 efx_mcdi_readd(efx, &reg, pdu);
153 efx_readd(efx, &reg, pdu);
154 165
155 /* All 1's indicates that shared memory is in reset (and is 166 /* All 1's indicates that shared memory is in reset (and is
156 * not a valid header). Wait for it to come out reset before 167 * not a valid header). Wait for it to come out reset before
@@ -177,7 +188,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
177 respseq, mcdi->seqno); 188 respseq, mcdi->seqno);
178 rc = EIO; 189 rc = EIO;
179 } else if (error) { 190 } else if (error) {
180 efx_readd(efx, &reg, pdu + 4); 191 efx_mcdi_readd(efx, &reg, pdu + 4);
181 switch (EFX_DWORD_FIELD(reg, EFX_DWORD_0)) { 192 switch (EFX_DWORD_FIELD(reg, EFX_DWORD_0)) {
182#define TRANSLATE_ERROR(name) \ 193#define TRANSLATE_ERROR(name) \
183 case MC_CMD_ERR_ ## name: \ 194 case MC_CMD_ERR_ ## name: \
@@ -211,21 +222,21 @@ out:
211/* Test and clear MC-rebooted flag for this port/function */ 222/* Test and clear MC-rebooted flag for this port/function */
212int efx_mcdi_poll_reboot(struct efx_nic *efx) 223int efx_mcdi_poll_reboot(struct efx_nic *efx)
213{ 224{
214 unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_REBOOT_FLAG(efx); 225 unsigned int addr = MCDI_REBOOT_FLAG(efx);
215 efx_dword_t reg; 226 efx_dword_t reg;
216 uint32_t value; 227 uint32_t value;
217 228
218 if (efx_nic_rev(efx) < EFX_REV_SIENA_A0) 229 if (efx_nic_rev(efx) < EFX_REV_SIENA_A0)
219 return false; 230 return false;
220 231
221 efx_readd(efx, &reg, addr); 232 efx_mcdi_readd(efx, &reg, addr);
222 value = EFX_DWORD_FIELD(reg, EFX_DWORD_0); 233 value = EFX_DWORD_FIELD(reg, EFX_DWORD_0);
223 234
224 if (value == 0) 235 if (value == 0)
225 return 0; 236 return 0;
226 237
227 EFX_ZERO_DWORD(reg); 238 EFX_ZERO_DWORD(reg);
228 efx_writed(efx, &reg, addr); 239 efx_mcdi_writed(efx, &reg, addr);
229 240
230 if (value == MC_STATUS_DWORD_ASSERT) 241 if (value == MC_STATUS_DWORD_ASSERT)
231 return -EINTR; 242 return -EINTR;
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c
index 10f1cb79c147..9b29a8d7c449 100644
--- a/drivers/net/sfc/nic.c
+++ b/drivers/net/sfc/nic.c
@@ -1937,6 +1937,13 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
1937 1937
1938 size = min_t(size_t, table->step, 16); 1938 size = min_t(size_t, table->step, 16);
1939 1939
1940 if (table->offset >= efx->type->mem_map_size) {
1941 /* No longer mapped; return dummy data */
1942 memcpy(buf, "\xde\xc0\xad\xde", 4);
1943 buf += table->rows * size;
1944 continue;
1945 }
1946
1940 for (i = 0; i < table->rows; i++) { 1947 for (i = 0; i < table->rows; i++) {
1941 switch (table->step) { 1948 switch (table->step) {
1942 case 4: /* 32-bit register or SRAM */ 1949 case 4: /* 32-bit register or SRAM */
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h
index a42db6e35be3..d91701abd331 100644
--- a/drivers/net/sfc/nic.h
+++ b/drivers/net/sfc/nic.h
@@ -143,10 +143,12 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx)
143/** 143/**
144 * struct siena_nic_data - Siena NIC state 144 * struct siena_nic_data - Siena NIC state
145 * @mcdi: Management-Controller-to-Driver Interface 145 * @mcdi: Management-Controller-to-Driver Interface
146 * @mcdi_smem: MCDI shared memory mapping. The mapping is always uncacheable.
146 * @wol_filter_id: Wake-on-LAN packet filter id 147 * @wol_filter_id: Wake-on-LAN packet filter id
147 */ 148 */
148struct siena_nic_data { 149struct siena_nic_data {
149 struct efx_mcdi_iface mcdi; 150 struct efx_mcdi_iface mcdi;
151 void __iomem *mcdi_smem;
150 int wol_filter_id; 152 int wol_filter_id;
151}; 153};
152 154
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
index e4dd8986b1fe..837869b71db9 100644
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -220,12 +220,26 @@ static int siena_probe_nic(struct efx_nic *efx)
220 efx_reado(efx, &reg, FR_AZ_CS_DEBUG); 220 efx_reado(efx, &reg, FR_AZ_CS_DEBUG);
221 efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; 221 efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1;
222 222
223 /* Initialise MCDI */
224 nic_data->mcdi_smem = ioremap_nocache(efx->membase_phys +
225 FR_CZ_MC_TREG_SMEM,
226 FR_CZ_MC_TREG_SMEM_STEP *
227 FR_CZ_MC_TREG_SMEM_ROWS);
228 if (!nic_data->mcdi_smem) {
229 netif_err(efx, probe, efx->net_dev,
230 "could not map MCDI at %llx+%x\n",
231 (unsigned long long)efx->membase_phys +
232 FR_CZ_MC_TREG_SMEM,
233 FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS);
234 rc = -ENOMEM;
235 goto fail1;
236 }
223 efx_mcdi_init(efx); 237 efx_mcdi_init(efx);
224 238
225 /* Recover from a failed assertion before probing */ 239 /* Recover from a failed assertion before probing */
226 rc = efx_mcdi_handle_assertion(efx); 240 rc = efx_mcdi_handle_assertion(efx);
227 if (rc) 241 if (rc)
228 goto fail1; 242 goto fail2;
229 243
230 /* Let the BMC know that the driver is now in charge of link and 244 /* Let the BMC know that the driver is now in charge of link and
231 * filter settings. We must do this before we reset the NIC */ 245 * filter settings. We must do this before we reset the NIC */
@@ -280,6 +294,7 @@ fail4:
280fail3: 294fail3:
281 efx_mcdi_drv_attach(efx, false, NULL); 295 efx_mcdi_drv_attach(efx, false, NULL);
282fail2: 296fail2:
297 iounmap(nic_data->mcdi_smem);
283fail1: 298fail1:
284 kfree(efx->nic_data); 299 kfree(efx->nic_data);
285 return rc; 300 return rc;
@@ -359,6 +374,8 @@ static int siena_init_nic(struct efx_nic *efx)
359 374
360static void siena_remove_nic(struct efx_nic *efx) 375static void siena_remove_nic(struct efx_nic *efx)
361{ 376{
377 struct siena_nic_data *nic_data = efx->nic_data;
378
362 efx_nic_free_buffer(efx, &efx->irq_status); 379 efx_nic_free_buffer(efx, &efx->irq_status);
363 380
364 siena_reset_hw(efx, RESET_TYPE_ALL); 381 siena_reset_hw(efx, RESET_TYPE_ALL);
@@ -368,7 +385,8 @@ static void siena_remove_nic(struct efx_nic *efx)
368 efx_mcdi_drv_attach(efx, false, NULL); 385 efx_mcdi_drv_attach(efx, false, NULL);
369 386
370 /* Tear down the private nic state */ 387 /* Tear down the private nic state */
371 kfree(efx->nic_data); 388 iounmap(nic_data->mcdi_smem);
389 kfree(nic_data);
372 efx->nic_data = NULL; 390 efx->nic_data = NULL;
373} 391}
374 392
@@ -606,8 +624,7 @@ struct efx_nic_type siena_a0_nic_type = {
606 .default_mac_ops = &efx_mcdi_mac_operations, 624 .default_mac_ops = &efx_mcdi_mac_operations,
607 625
608 .revision = EFX_REV_SIENA_A0, 626 .revision = EFX_REV_SIENA_A0,
609 .mem_map_size = (FR_CZ_MC_TREG_SMEM + 627 .mem_map_size = FR_CZ_MC_TREG_SMEM, /* MC_TREG_SMEM mapped separately */
610 FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS),
611 .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL, 628 .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL,
612 .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL, 629 .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL,
613 .buf_tbl_base = FR_BZ_BUF_FULL_TBL, 630 .buf_tbl_base = FR_BZ_BUF_FULL_TBL,
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 86cbb9ea2f26..8ec1a9a0bb9a 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -853,7 +853,9 @@ static int slip_open(struct tty_struct *tty)
853 /* Done. We have linked the TTY line to a channel. */ 853 /* Done. We have linked the TTY line to a channel. */
854 rtnl_unlock(); 854 rtnl_unlock();
855 tty->receive_room = 65536; /* We don't flow control */ 855 tty->receive_room = 65536; /* We don't flow control */
856 return sl->dev->base_addr; 856
857 /* TTY layer expects 0 on success */
858 return 0;
857 859
858err_free_bufs: 860err_free_bufs:
859 sl_free_bufs(sl); 861 sl_free_bufs(sl);
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index eb4f59fb01e9..bff2f7999ff0 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3237,15 +3237,18 @@ static void happy_meal_pci_exit(void)
3237#endif 3237#endif
3238 3238
3239#ifdef CONFIG_SBUS 3239#ifdef CONFIG_SBUS
3240static const struct of_device_id hme_sbus_match[];
3240static int __devinit hme_sbus_probe(struct platform_device *op) 3241static int __devinit hme_sbus_probe(struct platform_device *op)
3241{ 3242{
3243 const struct of_device_id *match;
3242 struct device_node *dp = op->dev.of_node; 3244 struct device_node *dp = op->dev.of_node;
3243 const char *model = of_get_property(dp, "model", NULL); 3245 const char *model = of_get_property(dp, "model", NULL);
3244 int is_qfe; 3246 int is_qfe;
3245 3247
3246 if (!op->dev.of_match) 3248 match = of_match_device(hme_sbus_match, &op->dev);
3249 if (!match)
3247 return -EINVAL; 3250 return -EINVAL;
3248 is_qfe = (op->dev.of_match->data != NULL); 3251 is_qfe = (match->data != NULL);
3249 3252
3250 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe")) 3253 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe"))
3251 is_qfe = 1; 3254 is_qfe = 1;
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index a301479ecc60..c924ea2bce07 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -567,7 +567,7 @@ static const struct usb_device_id products [] = {
567{ 567{
568 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, 568 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
569 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), 569 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
570 .driver_info = 0, 570 .driver_info = (unsigned long)&wwan_info,
571}, 571},
572 572
573/* 573/*
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 7d42f9a2c068..81126ff85e05 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -65,6 +65,7 @@
65#define IPHETH_USBINTF_PROTO 1 65#define IPHETH_USBINTF_PROTO 1
66 66
67#define IPHETH_BUF_SIZE 1516 67#define IPHETH_BUF_SIZE 1516
68#define IPHETH_IP_ALIGN 2 /* padding at front of URB */
68#define IPHETH_TX_TIMEOUT (5 * HZ) 69#define IPHETH_TX_TIMEOUT (5 * HZ)
69 70
70#define IPHETH_INTFNUM 2 71#define IPHETH_INTFNUM 2
@@ -202,18 +203,21 @@ static void ipheth_rcvbulk_callback(struct urb *urb)
202 return; 203 return;
203 } 204 }
204 205
205 len = urb->actual_length; 206 if (urb->actual_length <= IPHETH_IP_ALIGN) {
206 buf = urb->transfer_buffer; 207 dev->net->stats.rx_length_errors++;
208 return;
209 }
210 len = urb->actual_length - IPHETH_IP_ALIGN;
211 buf = urb->transfer_buffer + IPHETH_IP_ALIGN;
207 212
208 skb = dev_alloc_skb(NET_IP_ALIGN + len); 213 skb = dev_alloc_skb(len);
209 if (!skb) { 214 if (!skb) {
210 err("%s: dev_alloc_skb: -ENOMEM", __func__); 215 err("%s: dev_alloc_skb: -ENOMEM", __func__);
211 dev->net->stats.rx_dropped++; 216 dev->net->stats.rx_dropped++;
212 return; 217 return;
213 } 218 }
214 219
215 skb_reserve(skb, NET_IP_ALIGN); 220 memcpy(skb_put(skb, len), buf, len);
216 memcpy(skb_put(skb, len), buf + NET_IP_ALIGN, len - NET_IP_ALIGN);
217 skb->dev = dev->net; 221 skb->dev = dev->net;
218 skb->protocol = eth_type_trans(skb, dev->net); 222 skb->protocol = eth_type_trans(skb, dev->net);
219 223
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 009bba3d753e..9ab439d144ed 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -645,6 +645,7 @@ int usbnet_stop (struct net_device *net)
645 struct driver_info *info = dev->driver_info; 645 struct driver_info *info = dev->driver_info;
646 int retval; 646 int retval;
647 647
648 clear_bit(EVENT_DEV_OPEN, &dev->flags);
648 netif_stop_queue (net); 649 netif_stop_queue (net);
649 650
650 netif_info(dev, ifdown, dev->net, 651 netif_info(dev, ifdown, dev->net,
@@ -1524,9 +1525,12 @@ int usbnet_resume (struct usb_interface *intf)
1524 smp_mb(); 1525 smp_mb();
1525 clear_bit(EVENT_DEV_ASLEEP, &dev->flags); 1526 clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
1526 spin_unlock_irq(&dev->txq.lock); 1527 spin_unlock_irq(&dev->txq.lock);
1527 if (!(dev->txq.qlen >= TX_QLEN(dev))) 1528
1528 netif_start_queue(dev->net); 1529 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
1529 tasklet_schedule (&dev->bh); 1530 if (!(dev->txq.qlen >= TX_QLEN(dev)))
1531 netif_start_queue(dev->net);
1532 tasklet_schedule (&dev->bh);
1533 }
1530 } 1534 }
1531 return 0; 1535 return 0;
1532} 1536}
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 0d47c3a05307..c16ed961153a 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -178,6 +178,7 @@ static void
178vmxnet3_process_events(struct vmxnet3_adapter *adapter) 178vmxnet3_process_events(struct vmxnet3_adapter *adapter)
179{ 179{
180 int i; 180 int i;
181 unsigned long flags;
181 u32 events = le32_to_cpu(adapter->shared->ecr); 182 u32 events = le32_to_cpu(adapter->shared->ecr);
182 if (!events) 183 if (!events)
183 return; 184 return;
@@ -190,10 +191,10 @@ vmxnet3_process_events(struct vmxnet3_adapter *adapter)
190 191
191 /* Check if there is an error on xmit/recv queues */ 192 /* Check if there is an error on xmit/recv queues */
192 if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) { 193 if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) {
193 spin_lock(&adapter->cmd_lock); 194 spin_lock_irqsave(&adapter->cmd_lock, flags);
194 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 195 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
195 VMXNET3_CMD_GET_QUEUE_STATUS); 196 VMXNET3_CMD_GET_QUEUE_STATUS);
196 spin_unlock(&adapter->cmd_lock); 197 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
197 198
198 for (i = 0; i < adapter->num_tx_queues; i++) 199 for (i = 0; i < adapter->num_tx_queues; i++)
199 if (adapter->tqd_start[i].status.stopped) 200 if (adapter->tqd_start[i].status.stopped)
@@ -2733,13 +2734,14 @@ static void
2733vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter) 2734vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
2734{ 2735{
2735 u32 cfg; 2736 u32 cfg;
2737 unsigned long flags;
2736 2738
2737 /* intr settings */ 2739 /* intr settings */
2738 spin_lock(&adapter->cmd_lock); 2740 spin_lock_irqsave(&adapter->cmd_lock, flags);
2739 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 2741 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2740 VMXNET3_CMD_GET_CONF_INTR); 2742 VMXNET3_CMD_GET_CONF_INTR);
2741 cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); 2743 cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
2742 spin_unlock(&adapter->cmd_lock); 2744 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
2743 adapter->intr.type = cfg & 0x3; 2745 adapter->intr.type = cfg & 0x3;
2744 adapter->intr.mask_mode = (cfg >> 2) & 0x3; 2746 adapter->intr.mask_mode = (cfg >> 2) & 0x3;
2745 2747
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 51f2ef142a5b..976467253d20 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -311,6 +311,9 @@ vmxnet3_set_flags(struct net_device *netdev, u32 data)
311 /* toggle the LRO feature*/ 311 /* toggle the LRO feature*/
312 netdev->features ^= NETIF_F_LRO; 312 netdev->features ^= NETIF_F_LRO;
313 313
314 /* Update private LRO flag */
315 adapter->lro = lro_requested;
316
314 /* update harware LRO capability accordingly */ 317 /* update harware LRO capability accordingly */
315 if (lro_requested) 318 if (lro_requested)
316 adapter->shared->devRead.misc.uptFeatures |= 319 adapter->shared->devRead.misc.uptFeatures |=
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 17d04ff8d678..1482fa650833 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2141,6 +2141,8 @@ static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
2141static void ath9k_flush(struct ieee80211_hw *hw, bool drop) 2141static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
2142{ 2142{
2143 struct ath_softc *sc = hw->priv; 2143 struct ath_softc *sc = hw->priv;
2144 struct ath_hw *ah = sc->sc_ah;
2145 struct ath_common *common = ath9k_hw_common(ah);
2144 int timeout = 200; /* ms */ 2146 int timeout = 200; /* ms */
2145 int i, j; 2147 int i, j;
2146 2148
@@ -2149,6 +2151,12 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
2149 2151
2150 cancel_delayed_work_sync(&sc->tx_complete_work); 2152 cancel_delayed_work_sync(&sc->tx_complete_work);
2151 2153
2154 if (sc->sc_flags & SC_OP_INVALID) {
2155 ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
2156 mutex_unlock(&sc->mutex);
2157 return;
2158 }
2159
2152 if (drop) 2160 if (drop)
2153 timeout = 1; 2161 timeout = 1;
2154 2162
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index c1511b14b239..42db0fc8b921 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -2155,6 +2155,13 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
2155 goto set_ch_out; 2155 goto set_ch_out;
2156 } 2156 }
2157 2157
2158 if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
2159 !iwl_legacy_is_channel_ibss(ch_info)) {
2160 IWL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n");
2161 ret = -EINVAL;
2162 goto set_ch_out;
2163 }
2164
2158 spin_lock_irqsave(&priv->lock, flags); 2165 spin_lock_irqsave(&priv->lock, flags);
2159 2166
2160 for_each_context(priv, ctx) { 2167 for_each_context(priv, ctx) {
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 9ee849d669f3..f43ac1eb9014 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -1411,6 +1411,12 @@ iwl_legacy_is_channel_passive(const struct iwl_channel_info *ch)
1411 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; 1411 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
1412} 1412}
1413 1413
1414static inline int
1415iwl_legacy_is_channel_ibss(const struct iwl_channel_info *ch)
1416{
1417 return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0;
1418}
1419
1414static inline void 1420static inline void
1415__iwl_legacy_free_pages(struct iwl_priv *priv, struct page *page) 1421__iwl_legacy_free_pages(struct iwl_priv *priv, struct page *page)
1416{ 1422{
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 7e8a658b7670..f3ac62431a30 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1339,8 +1339,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
1339 cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { 1339 cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) {
1340 lbs_deb_host( 1340 lbs_deb_host(
1341 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); 1341 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n");
1342 list_del(&cmdnode->list);
1343 spin_lock_irqsave(&priv->driver_lock, flags); 1342 spin_lock_irqsave(&priv->driver_lock, flags);
1343 list_del(&cmdnode->list);
1344 lbs_complete_command(priv, cmdnode, 0); 1344 lbs_complete_command(priv, cmdnode, 0);
1345 spin_unlock_irqrestore(&priv->driver_lock, flags); 1345 spin_unlock_irqrestore(&priv->driver_lock, flags);
1346 1346
@@ -1352,8 +1352,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
1352 (priv->psstate == PS_STATE_PRE_SLEEP)) { 1352 (priv->psstate == PS_STATE_PRE_SLEEP)) {
1353 lbs_deb_host( 1353 lbs_deb_host(
1354 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); 1354 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n");
1355 list_del(&cmdnode->list);
1356 spin_lock_irqsave(&priv->driver_lock, flags); 1355 spin_lock_irqsave(&priv->driver_lock, flags);
1356 list_del(&cmdnode->list);
1357 lbs_complete_command(priv, cmdnode, 0); 1357 lbs_complete_command(priv, cmdnode, 0);
1358 spin_unlock_irqrestore(&priv->driver_lock, flags); 1358 spin_unlock_irqrestore(&priv->driver_lock, flags);
1359 priv->needtowakeup = 1; 1359 priv->needtowakeup = 1;
@@ -1366,7 +1366,9 @@ int lbs_execute_next_command(struct lbs_private *priv)
1366 "EXEC_NEXT_CMD: sending EXIT_PS\n"); 1366 "EXEC_NEXT_CMD: sending EXIT_PS\n");
1367 } 1367 }
1368 } 1368 }
1369 spin_lock_irqsave(&priv->driver_lock, flags);
1369 list_del(&cmdnode->list); 1370 list_del(&cmdnode->list);
1371 spin_unlock_irqrestore(&priv->driver_lock, flags);
1370 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", 1372 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
1371 le16_to_cpu(cmd->command)); 1373 le16_to_cpu(cmd->command));
1372 lbs_submit_command(priv, cmdnode); 1374 lbs_submit_command(priv, cmdnode);
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index b78a38d9172a..8c7c522a056a 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -126,7 +126,7 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z,
126 126
127 board = z->resource.start; 127 board = z->resource.start;
128 ioaddr = board+cards[i].offset; 128 ioaddr = board+cards[i].offset;
129 dev = alloc_ei_netdev(); 129 dev = ____alloc_ei_netdev(0);
130 if (!dev) 130 if (!dev)
131 return -ENOMEM; 131 return -ENOMEM;
132 if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, DRV_NAME)) { 132 if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, DRV_NAME)) {
@@ -146,15 +146,15 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z,
146static const struct net_device_ops zorro8390_netdev_ops = { 146static const struct net_device_ops zorro8390_netdev_ops = {
147 .ndo_open = zorro8390_open, 147 .ndo_open = zorro8390_open,
148 .ndo_stop = zorro8390_close, 148 .ndo_stop = zorro8390_close,
149 .ndo_start_xmit = ei_start_xmit, 149 .ndo_start_xmit = __ei_start_xmit,
150 .ndo_tx_timeout = ei_tx_timeout, 150 .ndo_tx_timeout = __ei_tx_timeout,
151 .ndo_get_stats = ei_get_stats, 151 .ndo_get_stats = __ei_get_stats,
152 .ndo_set_multicast_list = ei_set_multicast_list, 152 .ndo_set_multicast_list = __ei_set_multicast_list,
153 .ndo_validate_addr = eth_validate_addr, 153 .ndo_validate_addr = eth_validate_addr,
154 .ndo_set_mac_address = eth_mac_addr, 154 .ndo_set_mac_address = eth_mac_addr,
155 .ndo_change_mtu = eth_change_mtu, 155 .ndo_change_mtu = eth_change_mtu,
156#ifdef CONFIG_NET_POLL_CONTROLLER 156#ifdef CONFIG_NET_POLL_CONTROLLER
157 .ndo_poll_controller = ei_poll, 157 .ndo_poll_controller = __ei_poll,
158#endif 158#endif
159}; 159};
160 160
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index ebf51ad1b714..a806cb321d2e 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -579,7 +579,7 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
579 } 579 }
580 size0 = calculate_iosize(size, min_size, size1, 580 size0 = calculate_iosize(size, min_size, size1,
581 resource_size(b_res), 4096); 581 resource_size(b_res), 4096);
582 size1 = !add_size? size0: 582 size1 = (!add_head || (add_head && !add_size)) ? size0 :
583 calculate_iosize(size, min_size+add_size, size1, 583 calculate_iosize(size, min_size+add_size, size1,
584 resource_size(b_res), 4096); 584 resource_size(b_res), 4096);
585 if (!size0 && !size1) { 585 if (!size0 && !size1) {
@@ -677,7 +677,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
677 align += aligns[order]; 677 align += aligns[order];
678 } 678 }
679 size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align); 679 size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align);
680 size1 = !add_size ? size : 680 size1 = (!add_head || (add_head && !add_size)) ? size0 :
681 calculate_memsize(size, min_size+add_size, 0, 681 calculate_memsize(size, min_size+add_size, 0,
682 resource_size(b_res), min_align); 682 resource_size(b_res), min_align);
683 if (!size0 && !size1) { 683 if (!size0 && !size1) {
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 5f2dd386152b..2c1abf63957f 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -585,8 +585,9 @@ static bool eeepc_wlan_rfkill_blocked(struct eeepc_laptop *eeepc)
585 return true; 585 return true;
586} 586}
587 587
588static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc) 588static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
589{ 589{
590 struct pci_dev *port;
590 struct pci_dev *dev; 591 struct pci_dev *dev;
591 struct pci_bus *bus; 592 struct pci_bus *bus;
592 bool blocked = eeepc_wlan_rfkill_blocked(eeepc); 593 bool blocked = eeepc_wlan_rfkill_blocked(eeepc);
@@ -599,9 +600,16 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
599 mutex_lock(&eeepc->hotplug_lock); 600 mutex_lock(&eeepc->hotplug_lock);
600 601
601 if (eeepc->hotplug_slot) { 602 if (eeepc->hotplug_slot) {
602 bus = pci_find_bus(0, 1); 603 port = acpi_get_pci_dev(handle);
604 if (!port) {
605 pr_warning("Unable to find port\n");
606 goto out_unlock;
607 }
608
609 bus = port->subordinate;
610
603 if (!bus) { 611 if (!bus) {
604 pr_warning("Unable to find PCI bus 1?\n"); 612 pr_warning("Unable to find PCI bus?\n");
605 goto out_unlock; 613 goto out_unlock;
606 } 614 }
607 615
@@ -609,6 +617,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
609 pr_err("Unable to read PCI config space?\n"); 617 pr_err("Unable to read PCI config space?\n");
610 goto out_unlock; 618 goto out_unlock;
611 } 619 }
620
612 absent = (l == 0xffffffff); 621 absent = (l == 0xffffffff);
613 622
614 if (blocked != absent) { 623 if (blocked != absent) {
@@ -647,6 +656,17 @@ out_unlock:
647 mutex_unlock(&eeepc->hotplug_lock); 656 mutex_unlock(&eeepc->hotplug_lock);
648} 657}
649 658
659static void eeepc_rfkill_hotplug_update(struct eeepc_laptop *eeepc, char *node)
660{
661 acpi_status status = AE_OK;
662 acpi_handle handle;
663
664 status = acpi_get_handle(NULL, node, &handle);
665
666 if (ACPI_SUCCESS(status))
667 eeepc_rfkill_hotplug(eeepc, handle);
668}
669
650static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) 670static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
651{ 671{
652 struct eeepc_laptop *eeepc = data; 672 struct eeepc_laptop *eeepc = data;
@@ -654,7 +674,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
654 if (event != ACPI_NOTIFY_BUS_CHECK) 674 if (event != ACPI_NOTIFY_BUS_CHECK)
655 return; 675 return;
656 676
657 eeepc_rfkill_hotplug(eeepc); 677 eeepc_rfkill_hotplug(eeepc, handle);
658} 678}
659 679
660static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, 680static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
@@ -672,6 +692,11 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
672 eeepc); 692 eeepc);
673 if (ACPI_FAILURE(status)) 693 if (ACPI_FAILURE(status))
674 pr_warning("Failed to register notify on %s\n", node); 694 pr_warning("Failed to register notify on %s\n", node);
695 /*
696 * Refresh pci hotplug in case the rfkill state was
697 * changed during setup.
698 */
699 eeepc_rfkill_hotplug(eeepc, handle);
675 } else 700 } else
676 return -ENODEV; 701 return -ENODEV;
677 702
@@ -693,6 +718,12 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc,
693 if (ACPI_FAILURE(status)) 718 if (ACPI_FAILURE(status))
694 pr_err("Error removing rfkill notify handler %s\n", 719 pr_err("Error removing rfkill notify handler %s\n",
695 node); 720 node);
721 /*
722 * Refresh pci hotplug in case the rfkill
723 * state was changed after
724 * eeepc_unregister_rfkill_notifier()
725 */
726 eeepc_rfkill_hotplug(eeepc, handle);
696 } 727 }
697} 728}
698 729
@@ -816,11 +847,7 @@ static void eeepc_rfkill_exit(struct eeepc_laptop *eeepc)
816 rfkill_destroy(eeepc->wlan_rfkill); 847 rfkill_destroy(eeepc->wlan_rfkill);
817 eeepc->wlan_rfkill = NULL; 848 eeepc->wlan_rfkill = NULL;
818 } 849 }
819 /* 850
820 * Refresh pci hotplug in case the rfkill state was changed after
821 * eeepc_unregister_rfkill_notifier()
822 */
823 eeepc_rfkill_hotplug(eeepc);
824 if (eeepc->hotplug_slot) 851 if (eeepc->hotplug_slot)
825 pci_hp_deregister(eeepc->hotplug_slot); 852 pci_hp_deregister(eeepc->hotplug_slot);
826 853
@@ -889,11 +916,6 @@ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc)
889 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5"); 916 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
890 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6"); 917 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
891 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7"); 918 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
892 /*
893 * Refresh pci hotplug in case the rfkill state was changed during
894 * setup.
895 */
896 eeepc_rfkill_hotplug(eeepc);
897 919
898exit: 920exit:
899 if (result && result != -ENODEV) 921 if (result && result != -ENODEV)
@@ -928,8 +950,11 @@ static int eeepc_hotk_restore(struct device *device)
928 struct eeepc_laptop *eeepc = dev_get_drvdata(device); 950 struct eeepc_laptop *eeepc = dev_get_drvdata(device);
929 951
930 /* Refresh both wlan rfkill state and pci hotplug */ 952 /* Refresh both wlan rfkill state and pci hotplug */
931 if (eeepc->wlan_rfkill) 953 if (eeepc->wlan_rfkill) {
932 eeepc_rfkill_hotplug(eeepc); 954 eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P5");
955 eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P6");
956 eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P7");
957 }
933 958
934 if (eeepc->bluetooth_rfkill) 959 if (eeepc->bluetooth_rfkill)
935 rfkill_set_sw_state(eeepc->bluetooth_rfkill, 960 rfkill_set_sw_state(eeepc->bluetooth_rfkill,
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 8f709aec4da0..6fe8cd6e23b5 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -934,6 +934,14 @@ static ssize_t sony_nc_sysfs_store(struct device *dev,
934/* 934/*
935 * Backlight device 935 * Backlight device
936 */ 936 */
937struct sony_backlight_props {
938 struct backlight_device *dev;
939 int handle;
940 u8 offset;
941 u8 maxlvl;
942};
943struct sony_backlight_props sony_bl_props;
944
937static int sony_backlight_update_status(struct backlight_device *bd) 945static int sony_backlight_update_status(struct backlight_device *bd)
938{ 946{
939 return acpi_callsetfunc(sony_nc_acpi_handle, "SBRT", 947 return acpi_callsetfunc(sony_nc_acpi_handle, "SBRT",
@@ -954,21 +962,26 @@ static int sony_nc_get_brightness_ng(struct backlight_device *bd)
954{ 962{
955 int result; 963 int result;
956 int *handle = (int *)bl_get_data(bd); 964 int *handle = (int *)bl_get_data(bd);
965 struct sony_backlight_props *sdev =
966 (struct sony_backlight_props *)bl_get_data(bd);
957 967
958 sony_call_snc_handle(*handle, 0x0200, &result); 968 sony_call_snc_handle(sdev->handle, 0x0200, &result);
959 969
960 return result & 0xff; 970 return (result & 0xff) - sdev->offset;
961} 971}
962 972
963static int sony_nc_update_status_ng(struct backlight_device *bd) 973static int sony_nc_update_status_ng(struct backlight_device *bd)
964{ 974{
965 int value, result; 975 int value, result;
966 int *handle = (int *)bl_get_data(bd); 976 int *handle = (int *)bl_get_data(bd);
977 struct sony_backlight_props *sdev =
978 (struct sony_backlight_props *)bl_get_data(bd);
967 979
968 value = bd->props.brightness; 980 value = bd->props.brightness + sdev->offset;
969 sony_call_snc_handle(*handle, 0x0100 | (value << 16), &result); 981 if (sony_call_snc_handle(sdev->handle, 0x0100 | (value << 16), &result))
982 return -EIO;
970 983
971 return sony_nc_get_brightness_ng(bd); 984 return value;
972} 985}
973 986
974static const struct backlight_ops sony_backlight_ops = { 987static const struct backlight_ops sony_backlight_ops = {
@@ -981,8 +994,6 @@ static const struct backlight_ops sony_backlight_ng_ops = {
981 .update_status = sony_nc_update_status_ng, 994 .update_status = sony_nc_update_status_ng,
982 .get_brightness = sony_nc_get_brightness_ng, 995 .get_brightness = sony_nc_get_brightness_ng,
983}; 996};
984static int backlight_ng_handle;
985static struct backlight_device *sony_backlight_device;
986 997
987/* 998/*
988 * New SNC-only Vaios event mapping to driver known keys 999 * New SNC-only Vaios event mapping to driver known keys
@@ -1549,6 +1560,75 @@ static void sony_nc_kbd_backlight_resume(void)
1549 &ignore); 1560 &ignore);
1550} 1561}
1551 1562
1563static void sony_nc_backlight_ng_read_limits(int handle,
1564 struct sony_backlight_props *props)
1565{
1566 int offset;
1567 acpi_status status;
1568 u8 brlvl, i;
1569 u8 min = 0xff, max = 0x00;
1570 struct acpi_object_list params;
1571 union acpi_object in_obj;
1572 union acpi_object *lvl_enum;
1573 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
1574
1575 props->handle = handle;
1576 props->offset = 0;
1577 props->maxlvl = 0xff;
1578
1579 offset = sony_find_snc_handle(handle);
1580 if (offset < 0)
1581 return;
1582
1583 /* try to read the boundaries from ACPI tables, if we fail the above
1584 * defaults should be reasonable
1585 */
1586 params.count = 1;
1587 params.pointer = &in_obj;
1588 in_obj.type = ACPI_TYPE_INTEGER;
1589 in_obj.integer.value = offset;
1590 status = acpi_evaluate_object(sony_nc_acpi_handle, "SN06", &params,
1591 &buffer);
1592 if (ACPI_FAILURE(status))
1593 return;
1594
1595 lvl_enum = (union acpi_object *) buffer.pointer;
1596 if (!lvl_enum) {
1597 pr_err("No SN06 return object.");
1598 return;
1599 }
1600 if (lvl_enum->type != ACPI_TYPE_BUFFER) {
1601 pr_err("Invalid SN06 return object 0x%.2x\n",
1602 lvl_enum->type);
1603 goto out_invalid;
1604 }
1605
1606 /* the buffer lists brightness levels available, brightness levels are
1607 * from 0 to 8 in the array, other values are used by ALS control.
1608 */
1609 for (i = 0; i < 9 && i < lvl_enum->buffer.length; i++) {
1610
1611 brlvl = *(lvl_enum->buffer.pointer + i);
1612 dprintk("Brightness level: %d\n", brlvl);
1613
1614 if (!brlvl)
1615 break;
1616
1617 if (brlvl > max)
1618 max = brlvl;
1619 if (brlvl < min)
1620 min = brlvl;
1621 }
1622 props->offset = min;
1623 props->maxlvl = max;
1624 dprintk("Brightness levels: min=%d max=%d\n", props->offset,
1625 props->maxlvl);
1626
1627out_invalid:
1628 kfree(buffer.pointer);
1629 return;
1630}
1631
1552static void sony_nc_backlight_setup(void) 1632static void sony_nc_backlight_setup(void)
1553{ 1633{
1554 acpi_handle unused; 1634 acpi_handle unused;
@@ -1557,14 +1637,14 @@ static void sony_nc_backlight_setup(void)
1557 struct backlight_properties props; 1637 struct backlight_properties props;
1558 1638
1559 if (sony_find_snc_handle(0x12f) != -1) { 1639 if (sony_find_snc_handle(0x12f) != -1) {
1560 backlight_ng_handle = 0x12f;
1561 ops = &sony_backlight_ng_ops; 1640 ops = &sony_backlight_ng_ops;
1562 max_brightness = 0xff; 1641 sony_nc_backlight_ng_read_limits(0x12f, &sony_bl_props);
1642 max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset;
1563 1643
1564 } else if (sony_find_snc_handle(0x137) != -1) { 1644 } else if (sony_find_snc_handle(0x137) != -1) {
1565 backlight_ng_handle = 0x137;
1566 ops = &sony_backlight_ng_ops; 1645 ops = &sony_backlight_ng_ops;
1567 max_brightness = 0xff; 1646 sony_nc_backlight_ng_read_limits(0x137, &sony_bl_props);
1647 max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset;
1568 1648
1569 } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", 1649 } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT",
1570 &unused))) { 1650 &unused))) {
@@ -1577,22 +1657,22 @@ static void sony_nc_backlight_setup(void)
1577 memset(&props, 0, sizeof(struct backlight_properties)); 1657 memset(&props, 0, sizeof(struct backlight_properties));
1578 props.type = BACKLIGHT_PLATFORM; 1658 props.type = BACKLIGHT_PLATFORM;
1579 props.max_brightness = max_brightness; 1659 props.max_brightness = max_brightness;
1580 sony_backlight_device = backlight_device_register("sony", NULL, 1660 sony_bl_props.dev = backlight_device_register("sony", NULL,
1581 &backlight_ng_handle, 1661 &sony_bl_props,
1582 ops, &props); 1662 ops, &props);
1583 1663
1584 if (IS_ERR(sony_backlight_device)) { 1664 if (IS_ERR(sony_bl_props.dev)) {
1585 pr_warning(DRV_PFX "unable to register backlight device\n"); 1665 pr_warn(DRV_PFX "unable to register backlight device\n");
1586 sony_backlight_device = NULL; 1666 sony_bl_props.dev = NULL;
1587 } else 1667 } else
1588 sony_backlight_device->props.brightness = 1668 sony_bl_props.dev->props.brightness =
1589 ops->get_brightness(sony_backlight_device); 1669 ops->get_brightness(sony_bl_props.dev);
1590} 1670}
1591 1671
1592static void sony_nc_backlight_cleanup(void) 1672static void sony_nc_backlight_cleanup(void)
1593{ 1673{
1594 if (sony_backlight_device) 1674 if (sony_bl_props.dev)
1595 backlight_device_unregister(sony_backlight_device); 1675 backlight_device_unregister(sony_bl_props.dev);
1596} 1676}
1597 1677
1598static int sony_nc_add(struct acpi_device *device) 1678static int sony_nc_add(struct acpi_device *device)
@@ -2590,7 +2670,7 @@ static long sonypi_misc_ioctl(struct file *fp, unsigned int cmd,
2590 mutex_lock(&spic_dev.lock); 2670 mutex_lock(&spic_dev.lock);
2591 switch (cmd) { 2671 switch (cmd) {
2592 case SONYPI_IOCGBRT: 2672 case SONYPI_IOCGBRT:
2593 if (sony_backlight_device == NULL) { 2673 if (sony_bl_props.dev == NULL) {
2594 ret = -EIO; 2674 ret = -EIO;
2595 break; 2675 break;
2596 } 2676 }
@@ -2603,7 +2683,7 @@ static long sonypi_misc_ioctl(struct file *fp, unsigned int cmd,
2603 ret = -EFAULT; 2683 ret = -EFAULT;
2604 break; 2684 break;
2605 case SONYPI_IOCSBRT: 2685 case SONYPI_IOCSBRT:
2606 if (sony_backlight_device == NULL) { 2686 if (sony_bl_props.dev == NULL) {
2607 ret = -EIO; 2687 ret = -EIO;
2608 break; 2688 break;
2609 } 2689 }
@@ -2617,8 +2697,8 @@ static long sonypi_misc_ioctl(struct file *fp, unsigned int cmd,
2617 break; 2697 break;
2618 } 2698 }
2619 /* sync the backlight device status */ 2699 /* sync the backlight device status */
2620 sony_backlight_device->props.brightness = 2700 sony_bl_props.dev->props.brightness =
2621 sony_backlight_get_brightness(sony_backlight_device); 2701 sony_backlight_get_brightness(sony_bl_props.dev);
2622 break; 2702 break;
2623 case SONYPI_IOCGBAT1CAP: 2703 case SONYPI_IOCGBAT1CAP:
2624 if (ec_read16(SONYPI_BAT1_FULL, &val16)) { 2704 if (ec_read16(SONYPI_BAT1_FULL, &val16)) {
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index efb3b6b9bcdb..562fcf0dd2b5 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -128,7 +128,8 @@ enum {
128}; 128};
129 129
130/* ACPI HIDs */ 130/* ACPI HIDs */
131#define TPACPI_ACPI_HKEY_HID "IBM0068" 131#define TPACPI_ACPI_IBM_HKEY_HID "IBM0068"
132#define TPACPI_ACPI_LENOVO_HKEY_HID "LEN0068"
132#define TPACPI_ACPI_EC_HID "PNP0C09" 133#define TPACPI_ACPI_EC_HID "PNP0C09"
133 134
134/* Input IDs */ 135/* Input IDs */
@@ -3879,7 +3880,8 @@ errexit:
3879} 3880}
3880 3881
3881static const struct acpi_device_id ibm_htk_device_ids[] = { 3882static const struct acpi_device_id ibm_htk_device_ids[] = {
3882 {TPACPI_ACPI_HKEY_HID, 0}, 3883 {TPACPI_ACPI_IBM_HKEY_HID, 0},
3884 {TPACPI_ACPI_LENOVO_HKEY_HID, 0},
3883 {"", 0}, 3885 {"", 0},
3884}; 3886};
3885 3887
diff --git a/drivers/rapidio/switches/idt_gen2.c b/drivers/rapidio/switches/idt_gen2.c
index ac2701b22e71..043ee3136e40 100644
--- a/drivers/rapidio/switches/idt_gen2.c
+++ b/drivers/rapidio/switches/idt_gen2.c
@@ -95,6 +95,9 @@ idtg2_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
95 else 95 else
96 table++; 96 table++;
97 97
98 if (route_port == RIO_INVALID_ROUTE)
99 route_port = IDT_DEFAULT_ROUTE;
100
98 rio_mport_write_config_32(mport, destid, hopcount, 101 rio_mport_write_config_32(mport, destid, hopcount,
99 LOCAL_RTE_CONF_DESTID_SEL, table); 102 LOCAL_RTE_CONF_DESTID_SEL, table);
100 103
@@ -411,6 +414,12 @@ static int idtg2_switch_init(struct rio_dev *rdev, int do_enum)
411 rdev->rswitch->em_handle = idtg2_em_handler; 414 rdev->rswitch->em_handle = idtg2_em_handler;
412 rdev->rswitch->sw_sysfs = idtg2_sysfs; 415 rdev->rswitch->sw_sysfs = idtg2_sysfs;
413 416
417 if (do_enum) {
418 /* Ensure that default routing is disabled on startup */
419 rio_write_config_32(rdev,
420 RIO_STD_RTE_DEFAULT_PORT, IDT_NO_ROUTE);
421 }
422
414 return 0; 423 return 0;
415} 424}
416 425
diff --git a/drivers/rapidio/switches/idtcps.c b/drivers/rapidio/switches/idtcps.c
index 3a971077e7bf..d06ee2d44b44 100644
--- a/drivers/rapidio/switches/idtcps.c
+++ b/drivers/rapidio/switches/idtcps.c
@@ -26,6 +26,9 @@ idtcps_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
26{ 26{
27 u32 result; 27 u32 result;
28 28
29 if (route_port == RIO_INVALID_ROUTE)
30 route_port = CPS_DEFAULT_ROUTE;
31
29 if (table == RIO_GLOBAL_TABLE) { 32 if (table == RIO_GLOBAL_TABLE) {
30 rio_mport_write_config_32(mport, destid, hopcount, 33 rio_mport_write_config_32(mport, destid, hopcount,
31 RIO_STD_RTE_CONF_DESTID_SEL_CSR, route_destid); 34 RIO_STD_RTE_CONF_DESTID_SEL_CSR, route_destid);
@@ -130,6 +133,9 @@ static int idtcps_switch_init(struct rio_dev *rdev, int do_enum)
130 /* set TVAL = ~50us */ 133 /* set TVAL = ~50us */
131 rio_write_config_32(rdev, 134 rio_write_config_32(rdev,
132 rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8); 135 rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8);
136 /* Ensure that default routing is disabled on startup */
137 rio_write_config_32(rdev,
138 RIO_STD_RTE_DEFAULT_PORT, CPS_NO_ROUTE);
133 } 139 }
134 140
135 return 0; 141 return 0;
diff --git a/drivers/rapidio/switches/tsi57x.c b/drivers/rapidio/switches/tsi57x.c
index 1a62934bfebc..db8b8028988d 100644
--- a/drivers/rapidio/switches/tsi57x.c
+++ b/drivers/rapidio/switches/tsi57x.c
@@ -303,6 +303,12 @@ static int tsi57x_switch_init(struct rio_dev *rdev, int do_enum)
303 rdev->rswitch->em_init = tsi57x_em_init; 303 rdev->rswitch->em_init = tsi57x_em_init;
304 rdev->rswitch->em_handle = tsi57x_em_handler; 304 rdev->rswitch->em_handle = tsi57x_em_handler;
305 305
306 if (do_enum) {
307 /* Ensure that default routing is disabled on startup */
308 rio_write_config_32(rdev, RIO_STD_RTE_DEFAULT_PORT,
309 RIO_INVALID_ROUTE);
310 }
311
306 return 0; 312 return 0;
307} 313}
308 314
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c
index 8d46838dff8a..755e1fe914af 100644
--- a/drivers/rtc/rtc-davinci.c
+++ b/drivers/rtc/rtc-davinci.c
@@ -524,6 +524,8 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
524 goto fail2; 524 goto fail2;
525 } 525 }
526 526
527 platform_set_drvdata(pdev, davinci_rtc);
528
527 davinci_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 529 davinci_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
528 &davinci_rtc_ops, THIS_MODULE); 530 &davinci_rtc_ops, THIS_MODULE);
529 if (IS_ERR(davinci_rtc->rtc)) { 531 if (IS_ERR(davinci_rtc->rtc)) {
@@ -553,8 +555,6 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
553 555
554 rtcss_write(davinci_rtc, PRTCSS_RTC_CCTRL_CAEN, PRTCSS_RTC_CCTRL); 556 rtcss_write(davinci_rtc, PRTCSS_RTC_CCTRL_CAEN, PRTCSS_RTC_CCTRL);
555 557
556 platform_set_drvdata(pdev, davinci_rtc);
557
558 device_init_wakeup(&pdev->dev, 0); 558 device_init_wakeup(&pdev->dev, 0);
559 559
560 return 0; 560 return 0;
@@ -562,6 +562,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
562fail4: 562fail4:
563 rtc_device_unregister(davinci_rtc->rtc); 563 rtc_device_unregister(davinci_rtc->rtc);
564fail3: 564fail3:
565 platform_set_drvdata(pdev, NULL);
565 iounmap(davinci_rtc->base); 566 iounmap(davinci_rtc->base);
566fail2: 567fail2:
567 release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size); 568 release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size);
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index 60ce69600828..47e681df31e2 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -355,6 +355,7 @@ static int __devinit ds1286_probe(struct platform_device *pdev)
355 goto out; 355 goto out;
356 } 356 }
357 spin_lock_init(&priv->lock); 357 spin_lock_init(&priv->lock);
358 platform_set_drvdata(pdev, priv);
358 rtc = rtc_device_register("ds1286", &pdev->dev, 359 rtc = rtc_device_register("ds1286", &pdev->dev,
359 &ds1286_ops, THIS_MODULE); 360 &ds1286_ops, THIS_MODULE);
360 if (IS_ERR(rtc)) { 361 if (IS_ERR(rtc)) {
@@ -362,7 +363,6 @@ static int __devinit ds1286_probe(struct platform_device *pdev)
362 goto out; 363 goto out;
363 } 364 }
364 priv->rtc = rtc; 365 priv->rtc = rtc;
365 platform_set_drvdata(pdev, priv);
366 return 0; 366 return 0;
367 367
368out: 368out:
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 11ae64dcbf3c..335551d333b2 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -151,6 +151,7 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
151 return -ENXIO; 151 return -ENXIO;
152 152
153 pdev->dev.platform_data = ep93xx_rtc; 153 pdev->dev.platform_data = ep93xx_rtc;
154 platform_set_drvdata(pdev, rtc);
154 155
155 rtc = rtc_device_register(pdev->name, 156 rtc = rtc_device_register(pdev->name,
156 &pdev->dev, &ep93xx_rtc_ops, THIS_MODULE); 157 &pdev->dev, &ep93xx_rtc_ops, THIS_MODULE);
@@ -159,8 +160,6 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
159 goto exit; 160 goto exit;
160 } 161 }
161 162
162 platform_set_drvdata(pdev, rtc);
163
164 err = sysfs_create_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files); 163 err = sysfs_create_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
165 if (err) 164 if (err)
166 goto fail; 165 goto fail;
@@ -168,9 +167,9 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
168 return 0; 167 return 0;
169 168
170fail: 169fail:
171 platform_set_drvdata(pdev, NULL);
172 rtc_device_unregister(rtc); 170 rtc_device_unregister(rtc);
173exit: 171exit:
172 platform_set_drvdata(pdev, NULL);
174 pdev->dev.platform_data = NULL; 173 pdev->dev.platform_data = NULL;
175 return err; 174 return err;
176} 175}
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 69fe664a2228..eda128fc1d38 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -783,6 +783,9 @@ static int m41t80_probe(struct i2c_client *client,
783 goto exit; 783 goto exit;
784 } 784 }
785 785
786 clientdata->features = id->driver_data;
787 i2c_set_clientdata(client, clientdata);
788
786 rtc = rtc_device_register(client->name, &client->dev, 789 rtc = rtc_device_register(client->name, &client->dev,
787 &m41t80_rtc_ops, THIS_MODULE); 790 &m41t80_rtc_ops, THIS_MODULE);
788 if (IS_ERR(rtc)) { 791 if (IS_ERR(rtc)) {
@@ -792,8 +795,6 @@ static int m41t80_probe(struct i2c_client *client,
792 } 795 }
793 796
794 clientdata->rtc = rtc; 797 clientdata->rtc = rtc;
795 clientdata->features = id->driver_data;
796 i2c_set_clientdata(client, clientdata);
797 798
798 /* Make sure HT (Halt Update) bit is cleared */ 799 /* Make sure HT (Halt Update) bit is cleared */
799 rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_HOUR); 800 rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_HOUR);
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c
index 20494b5edc3c..3bc046f427e0 100644
--- a/drivers/rtc/rtc-max8925.c
+++ b/drivers/rtc/rtc-max8925.c
@@ -258,6 +258,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
258 } 258 }
259 259
260 dev_set_drvdata(&pdev->dev, info); 260 dev_set_drvdata(&pdev->dev, info);
261 /* XXX - isn't this redundant? */
262 platform_set_drvdata(pdev, info);
261 263
262 info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, 264 info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev,
263 &max8925_rtc_ops, THIS_MODULE); 265 &max8925_rtc_ops, THIS_MODULE);
@@ -267,10 +269,9 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
267 goto out_rtc; 269 goto out_rtc;
268 } 270 }
269 271
270 platform_set_drvdata(pdev, info);
271
272 return 0; 272 return 0;
273out_rtc: 273out_rtc:
274 platform_set_drvdata(pdev, NULL);
274 free_irq(chip->irq_base + MAX8925_IRQ_RTC_ALARM0, info); 275 free_irq(chip->irq_base + MAX8925_IRQ_RTC_ALARM0, info);
275out_irq: 276out_irq:
276 kfree(info); 277 kfree(info);
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c
index 3f7bc6b9fefa..2e48aa604273 100644
--- a/drivers/rtc/rtc-max8998.c
+++ b/drivers/rtc/rtc-max8998.c
@@ -265,6 +265,8 @@ static int __devinit max8998_rtc_probe(struct platform_device *pdev)
265 info->rtc = max8998->rtc; 265 info->rtc = max8998->rtc;
266 info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0; 266 info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0;
267 267
268 platform_set_drvdata(pdev, info);
269
268 info->rtc_dev = rtc_device_register("max8998-rtc", &pdev->dev, 270 info->rtc_dev = rtc_device_register("max8998-rtc", &pdev->dev,
269 &max8998_rtc_ops, THIS_MODULE); 271 &max8998_rtc_ops, THIS_MODULE);
270 272
@@ -274,8 +276,6 @@ static int __devinit max8998_rtc_probe(struct platform_device *pdev)
274 goto out_rtc; 276 goto out_rtc;
275 } 277 }
276 278
277 platform_set_drvdata(pdev, info);
278
279 ret = request_threaded_irq(info->irq, NULL, max8998_rtc_alarm_irq, 0, 279 ret = request_threaded_irq(info->irq, NULL, max8998_rtc_alarm_irq, 0,
280 "rtc-alarm0", info); 280 "rtc-alarm0", info);
281 281
@@ -293,6 +293,7 @@ static int __devinit max8998_rtc_probe(struct platform_device *pdev)
293 return 0; 293 return 0;
294 294
295out_rtc: 295out_rtc:
296 platform_set_drvdata(pdev, NULL);
296 kfree(info); 297 kfree(info);
297 return ret; 298 return ret;
298} 299}
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index c5ac03793e79..a1a278bc340d 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -349,11 +349,15 @@ static int __devinit mc13xxx_rtc_probe(struct platform_device *pdev)
349 if (ret) 349 if (ret)
350 goto err_alarm_irq_request; 350 goto err_alarm_irq_request;
351 351
352 mc13xxx_unlock(mc13xxx);
353
352 priv->rtc = rtc_device_register(pdev->name, 354 priv->rtc = rtc_device_register(pdev->name,
353 &pdev->dev, &mc13xxx_rtc_ops, THIS_MODULE); 355 &pdev->dev, &mc13xxx_rtc_ops, THIS_MODULE);
354 if (IS_ERR(priv->rtc)) { 356 if (IS_ERR(priv->rtc)) {
355 ret = PTR_ERR(priv->rtc); 357 ret = PTR_ERR(priv->rtc);
356 358
359 mc13xxx_lock(mc13xxx);
360
357 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_TODA, priv); 361 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_TODA, priv);
358err_alarm_irq_request: 362err_alarm_irq_request:
359 363
@@ -365,12 +369,12 @@ err_reset_irq_status:
365 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv); 369 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv);
366err_reset_irq_request: 370err_reset_irq_request:
367 371
372 mc13xxx_unlock(mc13xxx);
373
368 platform_set_drvdata(pdev, NULL); 374 platform_set_drvdata(pdev, NULL);
369 kfree(priv); 375 kfree(priv);
370 } 376 }
371 377
372 mc13xxx_unlock(mc13xxx);
373
374 return ret; 378 return ret;
375} 379}
376 380
diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c
index 67820626e18f..fcb113c11122 100644
--- a/drivers/rtc/rtc-msm6242.c
+++ b/drivers/rtc/rtc-msm6242.c
@@ -214,6 +214,7 @@ static int __init msm6242_rtc_probe(struct platform_device *dev)
214 error = -ENOMEM; 214 error = -ENOMEM;
215 goto out_free_priv; 215 goto out_free_priv;
216 } 216 }
217 platform_set_drvdata(dev, priv);
217 218
218 rtc = rtc_device_register("rtc-msm6242", &dev->dev, &msm6242_rtc_ops, 219 rtc = rtc_device_register("rtc-msm6242", &dev->dev, &msm6242_rtc_ops,
219 THIS_MODULE); 220 THIS_MODULE);
@@ -223,10 +224,10 @@ static int __init msm6242_rtc_probe(struct platform_device *dev)
223 } 224 }
224 225
225 priv->rtc = rtc; 226 priv->rtc = rtc;
226 platform_set_drvdata(dev, priv);
227 return 0; 227 return 0;
228 228
229out_unmap: 229out_unmap:
230 platform_set_drvdata(dev, NULL);
230 iounmap(priv->regs); 231 iounmap(priv->regs);
231out_free_priv: 232out_free_priv:
232 kfree(priv); 233 kfree(priv);
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index 826ab64a8fa9..d814417bee8c 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -418,14 +418,6 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
418 goto exit_put_clk; 418 goto exit_put_clk;
419 } 419 }
420 420
421 rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops,
422 THIS_MODULE);
423 if (IS_ERR(rtc)) {
424 ret = PTR_ERR(rtc);
425 goto exit_put_clk;
426 }
427
428 pdata->rtc = rtc;
429 platform_set_drvdata(pdev, pdata); 421 platform_set_drvdata(pdev, pdata);
430 422
431 /* Configure and enable the RTC */ 423 /* Configure and enable the RTC */
@@ -438,8 +430,19 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
438 pdata->irq = -1; 430 pdata->irq = -1;
439 } 431 }
440 432
433 rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops,
434 THIS_MODULE);
435 if (IS_ERR(rtc)) {
436 ret = PTR_ERR(rtc);
437 goto exit_clr_drvdata;
438 }
439
440 pdata->rtc = rtc;
441
441 return 0; 442 return 0;
442 443
444exit_clr_drvdata:
445 platform_set_drvdata(pdev, NULL);
443exit_put_clk: 446exit_put_clk:
444 clk_disable(pdata->clk); 447 clk_disable(pdata->clk);
445 clk_put(pdata->clk); 448 clk_put(pdata->clk);
diff --git a/drivers/rtc/rtc-pcap.c b/drivers/rtc/rtc-pcap.c
index a633abc42896..cd4f198cc2ef 100644
--- a/drivers/rtc/rtc-pcap.c
+++ b/drivers/rtc/rtc-pcap.c
@@ -151,6 +151,8 @@ static int __devinit pcap_rtc_probe(struct platform_device *pdev)
151 151
152 pcap_rtc->pcap = dev_get_drvdata(pdev->dev.parent); 152 pcap_rtc->pcap = dev_get_drvdata(pdev->dev.parent);
153 153
154 platform_set_drvdata(pdev, pcap_rtc);
155
154 pcap_rtc->rtc = rtc_device_register("pcap", &pdev->dev, 156 pcap_rtc->rtc = rtc_device_register("pcap", &pdev->dev,
155 &pcap_rtc_ops, THIS_MODULE); 157 &pcap_rtc_ops, THIS_MODULE);
156 if (IS_ERR(pcap_rtc->rtc)) { 158 if (IS_ERR(pcap_rtc->rtc)) {
@@ -158,7 +160,6 @@ static int __devinit pcap_rtc_probe(struct platform_device *pdev)
158 goto fail_rtc; 160 goto fail_rtc;
159 } 161 }
160 162
161 platform_set_drvdata(pdev, pcap_rtc);
162 163
163 timer_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_1HZ); 164 timer_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_1HZ);
164 alarm_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_TODA); 165 alarm_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_TODA);
@@ -177,6 +178,7 @@ fail_alarm:
177fail_timer: 178fail_timer:
178 rtc_device_unregister(pcap_rtc->rtc); 179 rtc_device_unregister(pcap_rtc->rtc);
179fail_rtc: 180fail_rtc:
181 platform_set_drvdata(pdev, NULL);
180 kfree(pcap_rtc); 182 kfree(pcap_rtc);
181 return err; 183 return err;
182} 184}
diff --git a/drivers/rtc/rtc-rp5c01.c b/drivers/rtc/rtc-rp5c01.c
index 694da39b6dd2..359da6d020b9 100644
--- a/drivers/rtc/rtc-rp5c01.c
+++ b/drivers/rtc/rtc-rp5c01.c
@@ -249,15 +249,15 @@ static int __init rp5c01_rtc_probe(struct platform_device *dev)
249 249
250 spin_lock_init(&priv->lock); 250 spin_lock_init(&priv->lock);
251 251
252 platform_set_drvdata(dev, priv);
253
252 rtc = rtc_device_register("rtc-rp5c01", &dev->dev, &rp5c01_rtc_ops, 254 rtc = rtc_device_register("rtc-rp5c01", &dev->dev, &rp5c01_rtc_ops,
253 THIS_MODULE); 255 THIS_MODULE);
254 if (IS_ERR(rtc)) { 256 if (IS_ERR(rtc)) {
255 error = PTR_ERR(rtc); 257 error = PTR_ERR(rtc);
256 goto out_unmap; 258 goto out_unmap;
257 } 259 }
258
259 priv->rtc = rtc; 260 priv->rtc = rtc;
260 platform_set_drvdata(dev, priv);
261 261
262 error = sysfs_create_bin_file(&dev->dev.kobj, &priv->nvram_attr); 262 error = sysfs_create_bin_file(&dev->dev.kobj, &priv->nvram_attr);
263 if (error) 263 if (error)
@@ -268,6 +268,7 @@ static int __init rp5c01_rtc_probe(struct platform_device *dev)
268out_unregister: 268out_unregister:
269 rtc_device_unregister(rtc); 269 rtc_device_unregister(rtc);
270out_unmap: 270out_unmap:
271 platform_set_drvdata(dev, NULL);
271 iounmap(priv->regs); 272 iounmap(priv->regs);
272out_free_priv: 273out_free_priv:
273 kfree(priv); 274 kfree(priv);
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index b3466c491cd3..16512ecae31a 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -46,6 +46,7 @@ static struct clk *rtc_clk;
46static void __iomem *s3c_rtc_base; 46static void __iomem *s3c_rtc_base;
47static int s3c_rtc_alarmno = NO_IRQ; 47static int s3c_rtc_alarmno = NO_IRQ;
48static int s3c_rtc_tickno = NO_IRQ; 48static int s3c_rtc_tickno = NO_IRQ;
49static bool wake_en;
49static enum s3c_cpu_type s3c_rtc_cpu_type; 50static enum s3c_cpu_type s3c_rtc_cpu_type;
50 51
51static DEFINE_SPINLOCK(s3c_rtc_pie_lock); 52static DEFINE_SPINLOCK(s3c_rtc_pie_lock);
@@ -562,8 +563,12 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state)
562 } 563 }
563 s3c_rtc_enable(pdev, 0); 564 s3c_rtc_enable(pdev, 0);
564 565
565 if (device_may_wakeup(&pdev->dev)) 566 if (device_may_wakeup(&pdev->dev) && !wake_en) {
566 enable_irq_wake(s3c_rtc_alarmno); 567 if (enable_irq_wake(s3c_rtc_alarmno) == 0)
568 wake_en = true;
569 else
570 dev_err(&pdev->dev, "enable_irq_wake failed\n");
571 }
567 572
568 return 0; 573 return 0;
569} 574}
@@ -579,8 +584,10 @@ static int s3c_rtc_resume(struct platform_device *pdev)
579 writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); 584 writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON);
580 } 585 }
581 586
582 if (device_may_wakeup(&pdev->dev)) 587 if (device_may_wakeup(&pdev->dev) && wake_en) {
583 disable_irq_wake(s3c_rtc_alarmno); 588 disable_irq_wake(s3c_rtc_alarmno);
589 wake_en = false;
590 }
584 591
585 return 0; 592 return 0;
586} 593}
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 475e603fc584..86b6f1cc1b10 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1742,11 +1742,20 @@ int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr)
1742static inline int _dasd_term_running_cqr(struct dasd_device *device) 1742static inline int _dasd_term_running_cqr(struct dasd_device *device)
1743{ 1743{
1744 struct dasd_ccw_req *cqr; 1744 struct dasd_ccw_req *cqr;
1745 int rc;
1745 1746
1746 if (list_empty(&device->ccw_queue)) 1747 if (list_empty(&device->ccw_queue))
1747 return 0; 1748 return 0;
1748 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); 1749 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist);
1749 return device->discipline->term_IO(cqr); 1750 rc = device->discipline->term_IO(cqr);
1751 if (!rc)
1752 /*
1753 * CQR terminated because a more important request is pending.
1754 * Undo decreasing of retry counter because this is
1755 * not an error case.
1756 */
1757 cqr->retries++;
1758 return rc;
1750} 1759}
1751 1760
1752int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) 1761int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 4b60ede07f0e..be55fb2b1b1c 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -518,6 +518,8 @@ static void __init insert_increment(u16 rn, int standby, int assigned)
518 return; 518 return;
519 new_incr->rn = rn; 519 new_incr->rn = rn;
520 new_incr->standby = standby; 520 new_incr->standby = standby;
521 if (!standby)
522 new_incr->usecount = 1;
521 last_rn = 0; 523 last_rn = 0;
522 prev = &sclp_mem_list; 524 prev = &sclp_mem_list;
523 list_for_each_entry(incr, &sclp_mem_list, list) { 525 list_for_each_entry(incr, &sclp_mem_list, list) {
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 83cea9a55e2f..1b3924c2fffd 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -236,7 +236,6 @@ tapeblock_setup_device(struct tape_device * device)
236 disk->major = tapeblock_major; 236 disk->major = tapeblock_major;
237 disk->first_minor = device->first_minor; 237 disk->first_minor = device->first_minor;
238 disk->fops = &tapeblock_fops; 238 disk->fops = &tapeblock_fops;
239 disk->events = DISK_EVENT_MEDIA_CHANGE;
240 disk->private_data = tape_get_device(device); 239 disk->private_data = tape_get_device(device);
241 disk->queue = blkdat->request_queue; 240 disk->queue = blkdat->request_queue;
242 set_capacity(disk, 0); 241 set_capacity(disk, 0);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index e2d45c91b8e8..9689d41c7888 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1292,8 +1292,10 @@ static struct scsi_host_template qpti_template = {
1292 .use_clustering = ENABLE_CLUSTERING, 1292 .use_clustering = ENABLE_CLUSTERING,
1293}; 1293};
1294 1294
1295static const struct of_device_id qpti_match[];
1295static int __devinit qpti_sbus_probe(struct platform_device *op) 1296static int __devinit qpti_sbus_probe(struct platform_device *op)
1296{ 1297{
1298 const struct of_device_id *match;
1297 struct scsi_host_template *tpnt; 1299 struct scsi_host_template *tpnt;
1298 struct device_node *dp = op->dev.of_node; 1300 struct device_node *dp = op->dev.of_node;
1299 struct Scsi_Host *host; 1301 struct Scsi_Host *host;
@@ -1301,9 +1303,10 @@ static int __devinit qpti_sbus_probe(struct platform_device *op)
1301 static int nqptis; 1303 static int nqptis;
1302 const char *fcode; 1304 const char *fcode;
1303 1305
1304 if (!op->dev.of_match) 1306 match = of_match_device(qpti_match, &op->dev);
1307 if (!match)
1305 return -EINVAL; 1308 return -EINVAL;
1306 tpnt = op->dev.of_match->data; 1309 tpnt = match->data;
1307 1310
1308 /* Sometimes Antares cards come up not completely 1311 /* Sometimes Antares cards come up not completely
1309 * setup, and we get a report of a zero IRQ. 1312 * setup, and we get a report of a zero IRQ.
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e9901b8f8443..ec1803a48723 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -74,8 +74,6 @@ struct kmem_cache *scsi_sdb_cache;
74 */ 74 */
75#define SCSI_QUEUE_DELAY 3 75#define SCSI_QUEUE_DELAY 3
76 76
77static void scsi_run_queue(struct request_queue *q);
78
79/* 77/*
80 * Function: scsi_unprep_request() 78 * Function: scsi_unprep_request()
81 * 79 *
@@ -161,7 +159,7 @@ static int __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy)
161 blk_requeue_request(q, cmd->request); 159 blk_requeue_request(q, cmd->request);
162 spin_unlock_irqrestore(q->queue_lock, flags); 160 spin_unlock_irqrestore(q->queue_lock, flags);
163 161
164 scsi_run_queue(q); 162 kblockd_schedule_work(q, &device->requeue_work);
165 163
166 return 0; 164 return 0;
167} 165}
@@ -400,10 +398,15 @@ static inline int scsi_host_is_busy(struct Scsi_Host *shost)
400static void scsi_run_queue(struct request_queue *q) 398static void scsi_run_queue(struct request_queue *q)
401{ 399{
402 struct scsi_device *sdev = q->queuedata; 400 struct scsi_device *sdev = q->queuedata;
403 struct Scsi_Host *shost = sdev->host; 401 struct Scsi_Host *shost;
404 LIST_HEAD(starved_list); 402 LIST_HEAD(starved_list);
405 unsigned long flags; 403 unsigned long flags;
406 404
405 /* if the device is dead, sdev will be NULL, so no queue to run */
406 if (!sdev)
407 return;
408
409 shost = sdev->host;
407 if (scsi_target(sdev)->single_lun) 410 if (scsi_target(sdev)->single_lun)
408 scsi_single_lun_run(sdev); 411 scsi_single_lun_run(sdev);
409 412
@@ -433,7 +436,11 @@ static void scsi_run_queue(struct request_queue *q)
433 continue; 436 continue;
434 } 437 }
435 438
436 blk_run_queue_async(sdev->request_queue); 439 spin_unlock(shost->host_lock);
440 spin_lock(sdev->request_queue->queue_lock);
441 __blk_run_queue(sdev->request_queue);
442 spin_unlock(sdev->request_queue->queue_lock);
443 spin_lock(shost->host_lock);
437 } 444 }
438 /* put any unprocessed entries back */ 445 /* put any unprocessed entries back */
439 list_splice(&starved_list, &shost->starved_list); 446 list_splice(&starved_list, &shost->starved_list);
@@ -442,6 +449,16 @@ static void scsi_run_queue(struct request_queue *q)
442 blk_run_queue(q); 449 blk_run_queue(q);
443} 450}
444 451
452void scsi_requeue_run_queue(struct work_struct *work)
453{
454 struct scsi_device *sdev;
455 struct request_queue *q;
456
457 sdev = container_of(work, struct scsi_device, requeue_work);
458 q = sdev->request_queue;
459 scsi_run_queue(q);
460}
461
445/* 462/*
446 * Function: scsi_requeue_command() 463 * Function: scsi_requeue_command()
447 * 464 *
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 087821fac8fe..58584dc0724a 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -242,6 +242,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
242 int display_failure_msg = 1, ret; 242 int display_failure_msg = 1, ret;
243 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 243 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
244 extern void scsi_evt_thread(struct work_struct *work); 244 extern void scsi_evt_thread(struct work_struct *work);
245 extern void scsi_requeue_run_queue(struct work_struct *work);
245 246
246 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, 247 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size,
247 GFP_ATOMIC); 248 GFP_ATOMIC);
@@ -264,6 +265,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
264 INIT_LIST_HEAD(&sdev->event_list); 265 INIT_LIST_HEAD(&sdev->event_list);
265 spin_lock_init(&sdev->list_lock); 266 spin_lock_init(&sdev->list_lock);
266 INIT_WORK(&sdev->event_work, scsi_evt_thread); 267 INIT_WORK(&sdev->event_work, scsi_evt_thread);
268 INIT_WORK(&sdev->requeue_work, scsi_requeue_run_queue);
267 269
268 sdev->sdev_gendev.parent = get_device(&starget->dev); 270 sdev->sdev_gendev.parent = get_device(&starget->dev);
269 sdev->sdev_target = starget; 271 sdev->sdev_target = starget;
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 0e8eec516df4..c911b2419abb 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -80,14 +80,17 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
80/* 80/*
81 * Try to register a serial port 81 * Try to register a serial port
82 */ 82 */
83static struct of_device_id of_platform_serial_table[];
83static int __devinit of_platform_serial_probe(struct platform_device *ofdev) 84static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
84{ 85{
86 const struct of_device_id *match;
85 struct of_serial_info *info; 87 struct of_serial_info *info;
86 struct uart_port port; 88 struct uart_port port;
87 int port_type; 89 int port_type;
88 int ret; 90 int ret;
89 91
90 if (!ofdev->dev.of_match) 92 match = of_match_device(of_platform_serial_table, &ofdev->dev);
93 if (!match)
91 return -EINVAL; 94 return -EINVAL;
92 95
93 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) 96 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
@@ -97,7 +100,7 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
97 if (info == NULL) 100 if (info == NULL)
98 return -ENOMEM; 101 return -ENOMEM;
99 102
100 port_type = (unsigned long)ofdev->dev.of_match->data; 103 port_type = (unsigned long)match->data;
101 ret = of_platform_serial_setup(ofdev, port_type, &port); 104 ret = of_platform_serial_setup(ofdev, port_type, &port);
102 if (ret) 105 if (ret)
103 goto out; 106 goto out;
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 36613b37c504..3a68e09309f7 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -2539,15 +2539,18 @@ static void qe_udc_release(struct device *dev)
2539} 2539}
2540 2540
2541/* Driver probe functions */ 2541/* Driver probe functions */
2542static const struct of_device_id qe_udc_match[];
2542static int __devinit qe_udc_probe(struct platform_device *ofdev) 2543static int __devinit qe_udc_probe(struct platform_device *ofdev)
2543{ 2544{
2545 const struct of_device_id *match;
2544 struct device_node *np = ofdev->dev.of_node; 2546 struct device_node *np = ofdev->dev.of_node;
2545 struct qe_ep *ep; 2547 struct qe_ep *ep;
2546 unsigned int ret = 0; 2548 unsigned int ret = 0;
2547 unsigned int i; 2549 unsigned int i;
2548 const void *prop; 2550 const void *prop;
2549 2551
2550 if (!ofdev->dev.of_match) 2552 match = of_match_device(qe_udc_match, &ofdev->dev);
2553 if (!match)
2551 return -EINVAL; 2554 return -EINVAL;
2552 2555
2553 prop = of_get_property(np, "mode", NULL); 2556 prop = of_get_property(np, "mode", NULL);
@@ -2561,7 +2564,7 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev)
2561 return -ENOMEM; 2564 return -ENOMEM;
2562 } 2565 }
2563 2566
2564 udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data; 2567 udc_controller->soc_type = (unsigned long)match->data;
2565 udc_controller->usb_regs = of_iomap(np, 0); 2568 udc_controller->usb_regs = of_iomap(np, 0);
2566 if (!udc_controller->usb_regs) { 2569 if (!udc_controller->usb_regs) {
2567 ret = -ENOMEM; 2570 ret = -ENOMEM;
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c
index 82acb8dc4aa1..6183a57eb69d 100644
--- a/drivers/video/acornfb.c
+++ b/drivers/video/acornfb.c
@@ -66,7 +66,7 @@
66 * have. Allow 1% either way on the nominal for TVs. 66 * have. Allow 1% either way on the nominal for TVs.
67 */ 67 */
68#define NR_MONTYPES 6 68#define NR_MONTYPES 6
69static struct fb_monspecs monspecs[NR_MONTYPES] __initdata = { 69static struct fb_monspecs monspecs[NR_MONTYPES] __devinitdata = {
70 { /* TV */ 70 { /* TV */
71 .hfmin = 15469, 71 .hfmin = 15469,
72 .hfmax = 15781, 72 .hfmax = 15781,
@@ -873,7 +873,7 @@ static struct fb_ops acornfb_ops = {
873/* 873/*
874 * Everything after here is initialisation!!! 874 * Everything after here is initialisation!!!
875 */ 875 */
876static struct fb_videomode modedb[] __initdata = { 876static struct fb_videomode modedb[] __devinitdata = {
877 { /* 320x256 @ 50Hz */ 877 { /* 320x256 @ 50Hz */
878 NULL, 50, 320, 256, 125000, 92, 62, 35, 19, 38, 2, 878 NULL, 50, 320, 256, 125000, 92, 62, 35, 19, 38, 2,
879 FB_SYNC_COMP_HIGH_ACT, 879 FB_SYNC_COMP_HIGH_ACT,
@@ -925,8 +925,7 @@ static struct fb_videomode modedb[] __initdata = {
925 } 925 }
926}; 926};
927 927
928static struct fb_videomode __initdata 928static struct fb_videomode acornfb_default_mode __devinitdata = {
929acornfb_default_mode = {
930 .name = NULL, 929 .name = NULL,
931 .refresh = 60, 930 .refresh = 60,
932 .xres = 640, 931 .xres = 640,
@@ -942,7 +941,7 @@ acornfb_default_mode = {
942 .vmode = FB_VMODE_NONINTERLACED 941 .vmode = FB_VMODE_NONINTERLACED
943}; 942};
944 943
945static void __init acornfb_init_fbinfo(void) 944static void __devinit acornfb_init_fbinfo(void)
946{ 945{
947 static int first = 1; 946 static int first = 1;
948 947
@@ -1018,8 +1017,7 @@ static void __init acornfb_init_fbinfo(void)
1018 * size can optionally be followed by 'M' or 'K' for 1017 * size can optionally be followed by 'M' or 'K' for
1019 * MB or KB respectively. 1018 * MB or KB respectively.
1020 */ 1019 */
1021static void __init 1020static void __devinit acornfb_parse_mon(char *opt)
1022acornfb_parse_mon(char *opt)
1023{ 1021{
1024 char *p = opt; 1022 char *p = opt;
1025 1023
@@ -1066,8 +1064,7 @@ bad:
1066 current_par.montype = -1; 1064 current_par.montype = -1;
1067} 1065}
1068 1066
1069static void __init 1067static void __devinit acornfb_parse_montype(char *opt)
1070acornfb_parse_montype(char *opt)
1071{ 1068{
1072 current_par.montype = -2; 1069 current_par.montype = -2;
1073 1070
@@ -1108,8 +1105,7 @@ acornfb_parse_montype(char *opt)
1108 } 1105 }
1109} 1106}
1110 1107
1111static void __init 1108static void __devinit acornfb_parse_dram(char *opt)
1112acornfb_parse_dram(char *opt)
1113{ 1109{
1114 unsigned int size; 1110 unsigned int size;
1115 1111
@@ -1134,15 +1130,14 @@ acornfb_parse_dram(char *opt)
1134static struct options { 1130static struct options {
1135 char *name; 1131 char *name;
1136 void (*parse)(char *opt); 1132 void (*parse)(char *opt);
1137} opt_table[] __initdata = { 1133} opt_table[] __devinitdata = {
1138 { "mon", acornfb_parse_mon }, 1134 { "mon", acornfb_parse_mon },
1139 { "montype", acornfb_parse_montype }, 1135 { "montype", acornfb_parse_montype },
1140 { "dram", acornfb_parse_dram }, 1136 { "dram", acornfb_parse_dram },
1141 { NULL, NULL } 1137 { NULL, NULL }
1142}; 1138};
1143 1139
1144int __init 1140static int __devinit acornfb_setup(char *options)
1145acornfb_setup(char *options)
1146{ 1141{
1147 struct options *optp; 1142 struct options *optp;
1148 char *opt; 1143 char *opt;
@@ -1179,8 +1174,7 @@ acornfb_setup(char *options)
1179 * Detect type of monitor connected 1174 * Detect type of monitor connected
1180 * For now, we just assume SVGA 1175 * For now, we just assume SVGA
1181 */ 1176 */
1182static int __init 1177static int __devinit acornfb_detect_monitortype(void)
1183acornfb_detect_monitortype(void)
1184{ 1178{
1185 return 4; 1179 return 4;
1186} 1180}
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index e0c2284924b6..5aac00eb1830 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -42,9 +42,34 @@
42 42
43#define FBPIXMAPSIZE (1024 * 8) 43#define FBPIXMAPSIZE (1024 * 8)
44 44
45static DEFINE_MUTEX(registration_lock);
45struct fb_info *registered_fb[FB_MAX] __read_mostly; 46struct fb_info *registered_fb[FB_MAX] __read_mostly;
46int num_registered_fb __read_mostly; 47int num_registered_fb __read_mostly;
47 48
49static struct fb_info *get_fb_info(unsigned int idx)
50{
51 struct fb_info *fb_info;
52
53 if (idx >= FB_MAX)
54 return ERR_PTR(-ENODEV);
55
56 mutex_lock(&registration_lock);
57 fb_info = registered_fb[idx];
58 if (fb_info)
59 atomic_inc(&fb_info->count);
60 mutex_unlock(&registration_lock);
61
62 return fb_info;
63}
64
65static void put_fb_info(struct fb_info *fb_info)
66{
67 if (!atomic_dec_and_test(&fb_info->count))
68 return;
69 if (fb_info->fbops->fb_destroy)
70 fb_info->fbops->fb_destroy(fb_info);
71}
72
48int lock_fb_info(struct fb_info *info) 73int lock_fb_info(struct fb_info *info)
49{ 74{
50 mutex_lock(&info->lock); 75 mutex_lock(&info->lock);
@@ -647,6 +672,7 @@ int fb_show_logo(struct fb_info *info, int rotate) { return 0; }
647 672
648static void *fb_seq_start(struct seq_file *m, loff_t *pos) 673static void *fb_seq_start(struct seq_file *m, loff_t *pos)
649{ 674{
675 mutex_lock(&registration_lock);
650 return (*pos < FB_MAX) ? pos : NULL; 676 return (*pos < FB_MAX) ? pos : NULL;
651} 677}
652 678
@@ -658,6 +684,7 @@ static void *fb_seq_next(struct seq_file *m, void *v, loff_t *pos)
658 684
659static void fb_seq_stop(struct seq_file *m, void *v) 685static void fb_seq_stop(struct seq_file *m, void *v)
660{ 686{
687 mutex_unlock(&registration_lock);
661} 688}
662 689
663static int fb_seq_show(struct seq_file *m, void *v) 690static int fb_seq_show(struct seq_file *m, void *v)
@@ -690,13 +717,30 @@ static const struct file_operations fb_proc_fops = {
690 .release = seq_release, 717 .release = seq_release,
691}; 718};
692 719
693static ssize_t 720/*
694fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 721 * We hold a reference to the fb_info in file->private_data,
722 * but if the current registered fb has changed, we don't
723 * actually want to use it.
724 *
725 * So look up the fb_info using the inode minor number,
726 * and just verify it against the reference we have.
727 */
728static struct fb_info *file_fb_info(struct file *file)
695{ 729{
696 unsigned long p = *ppos;
697 struct inode *inode = file->f_path.dentry->d_inode; 730 struct inode *inode = file->f_path.dentry->d_inode;
698 int fbidx = iminor(inode); 731 int fbidx = iminor(inode);
699 struct fb_info *info = registered_fb[fbidx]; 732 struct fb_info *info = registered_fb[fbidx];
733
734 if (info != file->private_data)
735 info = NULL;
736 return info;
737}
738
739static ssize_t
740fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
741{
742 unsigned long p = *ppos;
743 struct fb_info *info = file_fb_info(file);
700 u8 *buffer, *dst; 744 u8 *buffer, *dst;
701 u8 __iomem *src; 745 u8 __iomem *src;
702 int c, cnt = 0, err = 0; 746 int c, cnt = 0, err = 0;
@@ -761,9 +805,7 @@ static ssize_t
761fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 805fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
762{ 806{
763 unsigned long p = *ppos; 807 unsigned long p = *ppos;
764 struct inode *inode = file->f_path.dentry->d_inode; 808 struct fb_info *info = file_fb_info(file);
765 int fbidx = iminor(inode);
766 struct fb_info *info = registered_fb[fbidx];
767 u8 *buffer, *src; 809 u8 *buffer, *src;
768 u8 __iomem *dst; 810 u8 __iomem *dst;
769 int c, cnt = 0, err = 0; 811 int c, cnt = 0, err = 0;
@@ -1141,10 +1183,10 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
1141 1183
1142static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1184static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1143{ 1185{
1144 struct inode *inode = file->f_path.dentry->d_inode; 1186 struct fb_info *info = file_fb_info(file);
1145 int fbidx = iminor(inode);
1146 struct fb_info *info = registered_fb[fbidx];
1147 1187
1188 if (!info)
1189 return -ENODEV;
1148 return do_fb_ioctl(info, cmd, arg); 1190 return do_fb_ioctl(info, cmd, arg);
1149} 1191}
1150 1192
@@ -1265,12 +1307,13 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
1265static long fb_compat_ioctl(struct file *file, unsigned int cmd, 1307static long fb_compat_ioctl(struct file *file, unsigned int cmd,
1266 unsigned long arg) 1308 unsigned long arg)
1267{ 1309{
1268 struct inode *inode = file->f_path.dentry->d_inode; 1310 struct fb_info *info = file_fb_info(file);
1269 int fbidx = iminor(inode); 1311 struct fb_ops *fb;
1270 struct fb_info *info = registered_fb[fbidx];
1271 struct fb_ops *fb = info->fbops;
1272 long ret = -ENOIOCTLCMD; 1312 long ret = -ENOIOCTLCMD;
1273 1313
1314 if (!info)
1315 return -ENODEV;
1316 fb = info->fbops;
1274 switch(cmd) { 1317 switch(cmd) {
1275 case FBIOGET_VSCREENINFO: 1318 case FBIOGET_VSCREENINFO:
1276 case FBIOPUT_VSCREENINFO: 1319 case FBIOPUT_VSCREENINFO:
@@ -1303,16 +1346,18 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd,
1303static int 1346static int
1304fb_mmap(struct file *file, struct vm_area_struct * vma) 1347fb_mmap(struct file *file, struct vm_area_struct * vma)
1305{ 1348{
1306 int fbidx = iminor(file->f_path.dentry->d_inode); 1349 struct fb_info *info = file_fb_info(file);
1307 struct fb_info *info = registered_fb[fbidx]; 1350 struct fb_ops *fb;
1308 struct fb_ops *fb = info->fbops;
1309 unsigned long off; 1351 unsigned long off;
1310 unsigned long start; 1352 unsigned long start;
1311 u32 len; 1353 u32 len;
1312 1354
1355 if (!info)
1356 return -ENODEV;
1313 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) 1357 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
1314 return -EINVAL; 1358 return -EINVAL;
1315 off = vma->vm_pgoff << PAGE_SHIFT; 1359 off = vma->vm_pgoff << PAGE_SHIFT;
1360 fb = info->fbops;
1316 if (!fb) 1361 if (!fb)
1317 return -ENODEV; 1362 return -ENODEV;
1318 mutex_lock(&info->mm_lock); 1363 mutex_lock(&info->mm_lock);
@@ -1361,14 +1406,16 @@ __releases(&info->lock)
1361 struct fb_info *info; 1406 struct fb_info *info;
1362 int res = 0; 1407 int res = 0;
1363 1408
1364 if (fbidx >= FB_MAX) 1409 info = get_fb_info(fbidx);
1365 return -ENODEV; 1410 if (!info) {
1366 info = registered_fb[fbidx];
1367 if (!info)
1368 request_module("fb%d", fbidx); 1411 request_module("fb%d", fbidx);
1369 info = registered_fb[fbidx]; 1412 info = get_fb_info(fbidx);
1370 if (!info) 1413 if (!info)
1371 return -ENODEV; 1414 return -ENODEV;
1415 }
1416 if (IS_ERR(info))
1417 return PTR_ERR(info);
1418
1372 mutex_lock(&info->lock); 1419 mutex_lock(&info->lock);
1373 if (!try_module_get(info->fbops->owner)) { 1420 if (!try_module_get(info->fbops->owner)) {
1374 res = -ENODEV; 1421 res = -ENODEV;
@@ -1386,6 +1433,8 @@ __releases(&info->lock)
1386#endif 1433#endif
1387out: 1434out:
1388 mutex_unlock(&info->lock); 1435 mutex_unlock(&info->lock);
1436 if (res)
1437 put_fb_info(info);
1389 return res; 1438 return res;
1390} 1439}
1391 1440
@@ -1401,6 +1450,7 @@ __releases(&info->lock)
1401 info->fbops->fb_release(info,1); 1450 info->fbops->fb_release(info,1);
1402 module_put(info->fbops->owner); 1451 module_put(info->fbops->owner);
1403 mutex_unlock(&info->lock); 1452 mutex_unlock(&info->lock);
1453 put_fb_info(info);
1404 return 0; 1454 return 0;
1405} 1455}
1406 1456
@@ -1487,8 +1537,10 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena,
1487 return false; 1537 return false;
1488} 1538}
1489 1539
1540static int do_unregister_framebuffer(struct fb_info *fb_info);
1541
1490#define VGA_FB_PHYS 0xA0000 1542#define VGA_FB_PHYS 0xA0000
1491void remove_conflicting_framebuffers(struct apertures_struct *a, 1543static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
1492 const char *name, bool primary) 1544 const char *name, bool primary)
1493{ 1545{
1494 int i; 1546 int i;
@@ -1510,43 +1562,32 @@ void remove_conflicting_framebuffers(struct apertures_struct *a,
1510 printk(KERN_INFO "fb: conflicting fb hw usage " 1562 printk(KERN_INFO "fb: conflicting fb hw usage "
1511 "%s vs %s - removing generic driver\n", 1563 "%s vs %s - removing generic driver\n",
1512 name, registered_fb[i]->fix.id); 1564 name, registered_fb[i]->fix.id);
1513 unregister_framebuffer(registered_fb[i]); 1565 do_unregister_framebuffer(registered_fb[i]);
1514 } 1566 }
1515 } 1567 }
1516} 1568}
1517EXPORT_SYMBOL(remove_conflicting_framebuffers);
1518 1569
1519/** 1570static int do_register_framebuffer(struct fb_info *fb_info)
1520 * register_framebuffer - registers a frame buffer device
1521 * @fb_info: frame buffer info structure
1522 *
1523 * Registers a frame buffer device @fb_info.
1524 *
1525 * Returns negative errno on error, or zero for success.
1526 *
1527 */
1528
1529int
1530register_framebuffer(struct fb_info *fb_info)
1531{ 1571{
1532 int i; 1572 int i;
1533 struct fb_event event; 1573 struct fb_event event;
1534 struct fb_videomode mode; 1574 struct fb_videomode mode;
1535 1575
1536 if (num_registered_fb == FB_MAX)
1537 return -ENXIO;
1538
1539 if (fb_check_foreignness(fb_info)) 1576 if (fb_check_foreignness(fb_info))
1540 return -ENOSYS; 1577 return -ENOSYS;
1541 1578
1542 remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id, 1579 do_remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id,
1543 fb_is_primary_device(fb_info)); 1580 fb_is_primary_device(fb_info));
1544 1581
1582 if (num_registered_fb == FB_MAX)
1583 return -ENXIO;
1584
1545 num_registered_fb++; 1585 num_registered_fb++;
1546 for (i = 0 ; i < FB_MAX; i++) 1586 for (i = 0 ; i < FB_MAX; i++)
1547 if (!registered_fb[i]) 1587 if (!registered_fb[i])
1548 break; 1588 break;
1549 fb_info->node = i; 1589 fb_info->node = i;
1590 atomic_set(&fb_info->count, 1);
1550 mutex_init(&fb_info->lock); 1591 mutex_init(&fb_info->lock);
1551 mutex_init(&fb_info->mm_lock); 1592 mutex_init(&fb_info->mm_lock);
1552 1593
@@ -1592,36 +1633,14 @@ register_framebuffer(struct fb_info *fb_info)
1592 return 0; 1633 return 0;
1593} 1634}
1594 1635
1595 1636static int do_unregister_framebuffer(struct fb_info *fb_info)
1596/**
1597 * unregister_framebuffer - releases a frame buffer device
1598 * @fb_info: frame buffer info structure
1599 *
1600 * Unregisters a frame buffer device @fb_info.
1601 *
1602 * Returns negative errno on error, or zero for success.
1603 *
1604 * This function will also notify the framebuffer console
1605 * to release the driver.
1606 *
1607 * This is meant to be called within a driver's module_exit()
1608 * function. If this is called outside module_exit(), ensure
1609 * that the driver implements fb_open() and fb_release() to
1610 * check that no processes are using the device.
1611 */
1612
1613int
1614unregister_framebuffer(struct fb_info *fb_info)
1615{ 1637{
1616 struct fb_event event; 1638 struct fb_event event;
1617 int i, ret = 0; 1639 int i, ret = 0;
1618 1640
1619 i = fb_info->node; 1641 i = fb_info->node;
1620 if (!registered_fb[i]) { 1642 if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
1621 ret = -EINVAL; 1643 return -EINVAL;
1622 goto done;
1623 }
1624
1625 1644
1626 if (!lock_fb_info(fb_info)) 1645 if (!lock_fb_info(fb_info))
1627 return -ENODEV; 1646 return -ENODEV;
@@ -1629,16 +1648,14 @@ unregister_framebuffer(struct fb_info *fb_info)
1629 ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); 1648 ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
1630 unlock_fb_info(fb_info); 1649 unlock_fb_info(fb_info);
1631 1650
1632 if (ret) { 1651 if (ret)
1633 ret = -EINVAL; 1652 return -EINVAL;
1634 goto done;
1635 }
1636 1653
1637 if (fb_info->pixmap.addr && 1654 if (fb_info->pixmap.addr &&
1638 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) 1655 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
1639 kfree(fb_info->pixmap.addr); 1656 kfree(fb_info->pixmap.addr);
1640 fb_destroy_modelist(&fb_info->modelist); 1657 fb_destroy_modelist(&fb_info->modelist);
1641 registered_fb[i]=NULL; 1658 registered_fb[i] = NULL;
1642 num_registered_fb--; 1659 num_registered_fb--;
1643 fb_cleanup_device(fb_info); 1660 fb_cleanup_device(fb_info);
1644 device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1661 device_destroy(fb_class, MKDEV(FB_MAJOR, i));
@@ -1646,9 +1663,65 @@ unregister_framebuffer(struct fb_info *fb_info)
1646 fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); 1663 fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
1647 1664
1648 /* this may free fb info */ 1665 /* this may free fb info */
1649 if (fb_info->fbops->fb_destroy) 1666 put_fb_info(fb_info);
1650 fb_info->fbops->fb_destroy(fb_info); 1667 return 0;
1651done: 1668}
1669
1670void remove_conflicting_framebuffers(struct apertures_struct *a,
1671 const char *name, bool primary)
1672{
1673 mutex_lock(&registration_lock);
1674 do_remove_conflicting_framebuffers(a, name, primary);
1675 mutex_unlock(&registration_lock);
1676}
1677EXPORT_SYMBOL(remove_conflicting_framebuffers);
1678
1679/**
1680 * register_framebuffer - registers a frame buffer device
1681 * @fb_info: frame buffer info structure
1682 *
1683 * Registers a frame buffer device @fb_info.
1684 *
1685 * Returns negative errno on error, or zero for success.
1686 *
1687 */
1688int
1689register_framebuffer(struct fb_info *fb_info)
1690{
1691 int ret;
1692
1693 mutex_lock(&registration_lock);
1694 ret = do_register_framebuffer(fb_info);
1695 mutex_unlock(&registration_lock);
1696
1697 return ret;
1698}
1699
1700/**
1701 * unregister_framebuffer - releases a frame buffer device
1702 * @fb_info: frame buffer info structure
1703 *
1704 * Unregisters a frame buffer device @fb_info.
1705 *
1706 * Returns negative errno on error, or zero for success.
1707 *
1708 * This function will also notify the framebuffer console
1709 * to release the driver.
1710 *
1711 * This is meant to be called within a driver's module_exit()
1712 * function. If this is called outside module_exit(), ensure
1713 * that the driver implements fb_open() and fb_release() to
1714 * check that no processes are using the device.
1715 */
1716int
1717unregister_framebuffer(struct fb_info *fb_info)
1718{
1719 int ret;
1720
1721 mutex_lock(&registration_lock);
1722 ret = do_unregister_framebuffer(fb_info);
1723 mutex_unlock(&registration_lock);
1724
1652 return ret; 1725 return ret;
1653} 1726}
1654 1727
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 528bceb220fd..eed5436ffb51 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -185,17 +185,20 @@ static struct miscdevice mpc8xxx_wdt_miscdev = {
185 .fops = &mpc8xxx_wdt_fops, 185 .fops = &mpc8xxx_wdt_fops,
186}; 186};
187 187
188static const struct of_device_id mpc8xxx_wdt_match[];
188static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev) 189static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev)
189{ 190{
190 int ret; 191 int ret;
192 const struct of_device_id *match;
191 struct device_node *np = ofdev->dev.of_node; 193 struct device_node *np = ofdev->dev.of_node;
192 struct mpc8xxx_wdt_type *wdt_type; 194 struct mpc8xxx_wdt_type *wdt_type;
193 u32 freq = fsl_get_sys_freq(); 195 u32 freq = fsl_get_sys_freq();
194 bool enabled; 196 bool enabled;
195 197
196 if (!ofdev->dev.of_match) 198 match = of_match_device(mpc8xxx_wdt_match, &ofdev->dev);
199 if (!match)
197 return -EINVAL; 200 return -EINVAL;
198 wdt_type = ofdev->dev.of_match->data; 201 wdt_type = match->data;
199 202
200 if (!freq || freq == -1) 203 if (!freq || freq == -1)
201 return -EINVAL; 204 return -EINVAL;