diff options
Diffstat (limited to 'drivers')
269 files changed, 3116 insertions, 2867 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 15a23031833f..336eb1ed73cc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -513,6 +513,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
513 | { PCI_VDEVICE(INTEL, 0x502a), board_ahci }, /* Tolapai */ | 513 | { PCI_VDEVICE(INTEL, 0x502a), board_ahci }, /* Tolapai */ |
514 | { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ | 514 | { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ |
515 | { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ | 515 | { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ |
516 | { PCI_VDEVICE(INTEL, 0x3a22), board_ahci }, /* ICH10 */ | ||
516 | { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ | 517 | { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ |
517 | { PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */ | 518 | { PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */ |
518 | { PCI_VDEVICE(INTEL, 0x3b25), board_ahci }, /* PCH RAID */ | 519 | { PCI_VDEVICE(INTEL, 0x3b25), board_ahci }, /* PCH RAID */ |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 045a486a09ea..2c6aedaef718 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3392,17 +3392,27 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel) | |||
3392 | 3392 | ||
3393 | static int ata_dev_set_mode(struct ata_device *dev) | 3393 | static int ata_dev_set_mode(struct ata_device *dev) |
3394 | { | 3394 | { |
3395 | struct ata_port *ap = dev->link->ap; | ||
3395 | struct ata_eh_context *ehc = &dev->link->eh_context; | 3396 | struct ata_eh_context *ehc = &dev->link->eh_context; |
3397 | const bool nosetxfer = dev->horkage & ATA_HORKAGE_NOSETXFER; | ||
3396 | const char *dev_err_whine = ""; | 3398 | const char *dev_err_whine = ""; |
3397 | int ign_dev_err = 0; | 3399 | int ign_dev_err = 0; |
3398 | unsigned int err_mask; | 3400 | unsigned int err_mask = 0; |
3399 | int rc; | 3401 | int rc; |
3400 | 3402 | ||
3401 | dev->flags &= ~ATA_DFLAG_PIO; | 3403 | dev->flags &= ~ATA_DFLAG_PIO; |
3402 | if (dev->xfer_shift == ATA_SHIFT_PIO) | 3404 | if (dev->xfer_shift == ATA_SHIFT_PIO) |
3403 | dev->flags |= ATA_DFLAG_PIO; | 3405 | dev->flags |= ATA_DFLAG_PIO; |
3404 | 3406 | ||
3405 | err_mask = ata_dev_set_xfermode(dev); | 3407 | if (nosetxfer && ap->flags & ATA_FLAG_SATA && ata_id_is_sata(dev->id)) |
3408 | dev_err_whine = " (SET_XFERMODE skipped)"; | ||
3409 | else { | ||
3410 | if (nosetxfer) | ||
3411 | ata_dev_printk(dev, KERN_WARNING, | ||
3412 | "NOSETXFER but PATA detected - can't " | ||
3413 | "skip SETXFER, might malfunction\n"); | ||
3414 | err_mask = ata_dev_set_xfermode(dev); | ||
3415 | } | ||
3406 | 3416 | ||
3407 | if (err_mask & ~AC_ERR_DEV) | 3417 | if (err_mask & ~AC_ERR_DEV) |
3408 | goto fail; | 3418 | goto fail; |
@@ -4297,6 +4307,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4297 | /* Devices which aren't very happy with higher link speeds */ | 4307 | /* Devices which aren't very happy with higher link speeds */ |
4298 | { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, | 4308 | { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, |
4299 | 4309 | ||
4310 | /* | ||
4311 | * Devices which choke on SETXFER. Applies only if both the | ||
4312 | * device and controller are SATA. | ||
4313 | */ | ||
4314 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, | ||
4315 | |||
4300 | /* End Marker */ | 4316 | /* End Marker */ |
4301 | { } | 4317 | { } |
4302 | }; | 4318 | }; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index fa22f94ca415..1a07c061f644 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2517,6 +2517,10 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2517 | 2517 | ||
2518 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2518 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2519 | rc = ata_do_reset(link, reset, classes, deadline, true); | 2519 | rc = ata_do_reset(link, reset, classes, deadline, true); |
2520 | if (rc) { | ||
2521 | failed_link = link; | ||
2522 | goto fail; | ||
2523 | } | ||
2520 | } | 2524 | } |
2521 | } else { | 2525 | } else { |
2522 | if (verbose) | 2526 | if (verbose) |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 4b27617be26d..8561a9f195c1 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -312,11 +312,12 @@ err_ide_ioremap: | |||
312 | static int __devexit pata_at91_remove(struct platform_device *pdev) | 312 | static int __devexit pata_at91_remove(struct platform_device *pdev) |
313 | { | 313 | { |
314 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 314 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
315 | struct at91_ide_info *info = host->private_data; | 315 | struct at91_ide_info *info; |
316 | struct device *dev = &pdev->dev; | 316 | struct device *dev = &pdev->dev; |
317 | 317 | ||
318 | if (!host) | 318 | if (!host) |
319 | return 0; | 319 | return 0; |
320 | info = host->private_data; | ||
320 | 321 | ||
321 | ata_host_detach(host); | 322 | ata_host_detach(host); |
322 | 323 | ||
diff --git a/drivers/base/devres.c b/drivers/base/devres.c index e8beb8e5b626..05dd307e8f02 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c | |||
@@ -428,6 +428,9 @@ int devres_release_all(struct device *dev) | |||
428 | { | 428 | { |
429 | unsigned long flags; | 429 | unsigned long flags; |
430 | 430 | ||
431 | /* Looks like an uninitialized device structure */ | ||
432 | if (WARN_ON(dev->devres_head.next == NULL)) | ||
433 | return -ENODEV; | ||
431 | spin_lock_irqsave(&dev->devres_lock, flags); | 434 | spin_lock_irqsave(&dev->devres_lock, flags); |
432 | return release_nodes(dev, dev->devres_head.next, &dev->devres_head, | 435 | return release_nodes(dev, dev->devres_head.next, &dev->devres_head, |
433 | flags); | 436 | flags); |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index fc466531260e..f285f441fab9 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -217,8 +217,10 @@ firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
217 | ret_count = -ENODEV; | 217 | ret_count = -ENODEV; |
218 | goto out; | 218 | goto out; |
219 | } | 219 | } |
220 | if (offset > fw->size) | 220 | if (offset > fw->size) { |
221 | return 0; | 221 | ret_count = 0; |
222 | goto out; | ||
223 | } | ||
222 | if (count > fw->size - offset) | 224 | if (count > fw->size - offset) |
223 | count = fw->size - offset; | 225 | count = fw->size - offset; |
224 | 226 | ||
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 668dc234b8e2..1e6b7c14f697 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/ioport.h> | 36 | #include <linux/ioport.h> |
37 | #include <linux/mm.h> | 37 | #include <linux/mm.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> | ||
39 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
40 | #include <linux/reboot.h> | 41 | #include <linux/reboot.h> |
41 | #include <linux/spinlock.h> | 42 | #include <linux/spinlock.h> |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index bb72ada9f074..1d886e079c58 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -298,6 +298,22 @@ config BLK_DEV_NBD | |||
298 | 298 | ||
299 | If unsure, say N. | 299 | If unsure, say N. |
300 | 300 | ||
301 | config BLK_DEV_OSD | ||
302 | tristate "OSD object-as-blkdev support" | ||
303 | depends on SCSI_OSD_ULD | ||
304 | ---help--- | ||
305 | Saying Y or M here will allow the exporting of a single SCSI | ||
306 | OSD (object-based storage) object as a Linux block device. | ||
307 | |||
308 | For example, if you create a 2G object on an OSD device, | ||
309 | you can then use this module to present that 2G object as | ||
310 | a Linux block device. | ||
311 | |||
312 | To compile this driver as a module, choose M here: the | ||
313 | module will be called osdblk. | ||
314 | |||
315 | If unsure, say N. | ||
316 | |||
301 | config BLK_DEV_SX8 | 317 | config BLK_DEV_SX8 |
302 | tristate "Promise SATA SX8 support" | 318 | tristate "Promise SATA SX8 support" |
303 | depends on PCI | 319 | depends on PCI |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 7755a5e2a85e..cdaa3f8fddf0 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_XILINX_SYSACE) += xsysace.o | |||
23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o | 23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o |
24 | obj-$(CONFIG_MG_DISK) += mg_disk.o | 24 | obj-$(CONFIG_MG_DISK) += mg_disk.o |
25 | obj-$(CONFIG_SUNVDC) += sunvdc.o | 25 | obj-$(CONFIG_SUNVDC) += sunvdc.o |
26 | obj-$(CONFIG_BLK_DEV_OSD) += osdblk.o | ||
26 | 27 | ||
27 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o | 28 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o |
28 | obj-$(CONFIG_BLK_DEV_NBD) += nbd.o | 29 | obj-$(CONFIG_BLK_DEV_NBD) += nbd.o |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 65a0655e7fc8..a52cc7fe45ea 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
30 | #include <linux/major.h> | 31 | #include <linux/major.h> |
31 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 801f4ab83302..5757188cd1fb 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -61,7 +61,6 @@ | |||
61 | #include <linux/blkdev.h> | 61 | #include <linux/blkdev.h> |
62 | #include <linux/blkpg.h> | 62 | #include <linux/blkpg.h> |
63 | #include <linux/init.h> | 63 | #include <linux/init.h> |
64 | #include <linux/smp_lock.h> | ||
65 | #include <linux/swap.h> | 64 | #include <linux/swap.h> |
66 | #include <linux/slab.h> | 65 | #include <linux/slab.h> |
67 | #include <linux/loop.h> | 66 | #include <linux/loop.h> |
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c new file mode 100644 index 000000000000..13c1aee6aa3f --- /dev/null +++ b/drivers/block/osdblk.c | |||
@@ -0,0 +1,701 @@ | |||
1 | |||
2 | /* | ||
3 | osdblk.c -- Export a single SCSI OSD object as a Linux block device | ||
4 | |||
5 | |||
6 | Copyright 2009 Red Hat, Inc. | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; see the file COPYING. If not, write to | ||
19 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | |||
21 | |||
22 | Instructions for use | ||
23 | -------------------- | ||
24 | |||
25 | 1) Map a Linux block device to an existing OSD object. | ||
26 | |||
27 | In this example, we will use partition id 1234, object id 5678, | ||
28 | OSD device /dev/osd1. | ||
29 | |||
30 | $ echo "1234 5678 /dev/osd1" > /sys/class/osdblk/add | ||
31 | |||
32 | |||
33 | 2) List all active blkdev<->object mappings. | ||
34 | |||
35 | In this example, we have performed step #1 twice, creating two blkdevs, | ||
36 | mapped to two separate OSD objects. | ||
37 | |||
38 | $ cat /sys/class/osdblk/list | ||
39 | 0 174 1234 5678 /dev/osd1 | ||
40 | 1 179 1994 897123 /dev/osd0 | ||
41 | |||
42 | The columns, in order, are: | ||
43 | - blkdev unique id | ||
44 | - blkdev assigned major | ||
45 | - OSD object partition id | ||
46 | - OSD object id | ||
47 | - OSD device | ||
48 | |||
49 | |||
50 | 3) Remove an active blkdev<->object mapping. | ||
51 | |||
52 | In this example, we remove the mapping with blkdev unique id 1. | ||
53 | |||
54 | $ echo 1 > /sys/class/osdblk/remove | ||
55 | |||
56 | |||
57 | NOTE: The actual creation and deletion of OSD objects is outside the scope | ||
58 | of this driver. | ||
59 | |||
60 | */ | ||
61 | |||
62 | #include <linux/kernel.h> | ||
63 | #include <linux/device.h> | ||
64 | #include <linux/module.h> | ||
65 | #include <linux/fs.h> | ||
66 | #include <scsi/osd_initiator.h> | ||
67 | #include <scsi/osd_attributes.h> | ||
68 | #include <scsi/osd_sec.h> | ||
69 | #include <scsi/scsi_device.h> | ||
70 | |||
71 | #define DRV_NAME "osdblk" | ||
72 | #define PFX DRV_NAME ": " | ||
73 | |||
74 | /* #define _OSDBLK_DEBUG */ | ||
75 | #ifdef _OSDBLK_DEBUG | ||
76 | #define OSDBLK_DEBUG(fmt, a...) \ | ||
77 | printk(KERN_NOTICE "osdblk @%s:%d: " fmt, __func__, __LINE__, ##a) | ||
78 | #else | ||
79 | #define OSDBLK_DEBUG(fmt, a...) \ | ||
80 | do { if (0) printk(fmt, ##a); } while (0) | ||
81 | #endif | ||
82 | |||
83 | MODULE_AUTHOR("Jeff Garzik <jeff@garzik.org>"); | ||
84 | MODULE_DESCRIPTION("block device inside an OSD object osdblk.ko"); | ||
85 | MODULE_LICENSE("GPL"); | ||
86 | |||
87 | struct osdblk_device; | ||
88 | |||
89 | enum { | ||
90 | OSDBLK_MINORS_PER_MAJOR = 256, /* max minors per blkdev */ | ||
91 | OSDBLK_MAX_REQ = 32, /* max parallel requests */ | ||
92 | OSDBLK_OP_TIMEOUT = 4 * 60, /* sync OSD req timeout */ | ||
93 | }; | ||
94 | |||
95 | struct osdblk_request { | ||
96 | struct request *rq; /* blk layer request */ | ||
97 | struct bio *bio; /* cloned bio */ | ||
98 | struct osdblk_device *osdev; /* associated blkdev */ | ||
99 | }; | ||
100 | |||
101 | struct osdblk_device { | ||
102 | int id; /* blkdev unique id */ | ||
103 | |||
104 | int major; /* blkdev assigned major */ | ||
105 | struct gendisk *disk; /* blkdev's gendisk and rq */ | ||
106 | struct request_queue *q; | ||
107 | |||
108 | struct osd_dev *osd; /* associated OSD */ | ||
109 | |||
110 | char name[32]; /* blkdev name, e.g. osdblk34 */ | ||
111 | |||
112 | spinlock_t lock; /* queue lock */ | ||
113 | |||
114 | struct osd_obj_id obj; /* OSD partition, obj id */ | ||
115 | uint8_t obj_cred[OSD_CAP_LEN]; /* OSD cred */ | ||
116 | |||
117 | struct osdblk_request req[OSDBLK_MAX_REQ]; /* request table */ | ||
118 | |||
119 | struct list_head node; | ||
120 | |||
121 | char osd_path[0]; /* OSD device path */ | ||
122 | }; | ||
123 | |||
124 | static struct class *class_osdblk; /* /sys/class/osdblk */ | ||
125 | static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ | ||
126 | static LIST_HEAD(osdblkdev_list); | ||
127 | |||
128 | static struct block_device_operations osdblk_bd_ops = { | ||
129 | .owner = THIS_MODULE, | ||
130 | }; | ||
131 | |||
132 | static const struct osd_attr g_attr_logical_length = ATTR_DEF( | ||
133 | OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8); | ||
134 | |||
135 | static void osdblk_make_credential(u8 cred_a[OSD_CAP_LEN], | ||
136 | const struct osd_obj_id *obj) | ||
137 | { | ||
138 | osd_sec_init_nosec_doall_caps(cred_a, obj, false, true); | ||
139 | } | ||
140 | |||
141 | /* copied from exofs; move to libosd? */ | ||
142 | /* | ||
143 | * Perform a synchronous OSD operation. copied from exofs; move to libosd? | ||
144 | */ | ||
145 | static int osd_sync_op(struct osd_request *or, int timeout, uint8_t *credential) | ||
146 | { | ||
147 | int ret; | ||
148 | |||
149 | or->timeout = timeout; | ||
150 | ret = osd_finalize_request(or, 0, credential, NULL); | ||
151 | if (ret) | ||
152 | return ret; | ||
153 | |||
154 | ret = osd_execute_request(or); | ||
155 | |||
156 | /* osd_req_decode_sense(or, ret); */ | ||
157 | return ret; | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * Perform an asynchronous OSD operation. copied from exofs; move to libosd? | ||
162 | */ | ||
163 | static int osd_async_op(struct osd_request *or, osd_req_done_fn *async_done, | ||
164 | void *caller_context, u8 *cred) | ||
165 | { | ||
166 | int ret; | ||
167 | |||
168 | ret = osd_finalize_request(or, 0, cred, NULL); | ||
169 | if (ret) | ||
170 | return ret; | ||
171 | |||
172 | ret = osd_execute_request_async(or, async_done, caller_context); | ||
173 | |||
174 | return ret; | ||
175 | } | ||
176 | |||
177 | /* copied from exofs; move to libosd? */ | ||
178 | static int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr) | ||
179 | { | ||
180 | struct osd_attr cur_attr = {.attr_page = 0}; /* start with zeros */ | ||
181 | void *iter = NULL; | ||
182 | int nelem; | ||
183 | |||
184 | do { | ||
185 | nelem = 1; | ||
186 | osd_req_decode_get_attr_list(or, &cur_attr, &nelem, &iter); | ||
187 | if ((cur_attr.attr_page == attr->attr_page) && | ||
188 | (cur_attr.attr_id == attr->attr_id)) { | ||
189 | attr->len = cur_attr.len; | ||
190 | attr->val_ptr = cur_attr.val_ptr; | ||
191 | return 0; | ||
192 | } | ||
193 | } while (iter); | ||
194 | |||
195 | return -EIO; | ||
196 | } | ||
197 | |||
198 | static int osdblk_get_obj_size(struct osdblk_device *osdev, u64 *size_out) | ||
199 | { | ||
200 | struct osd_request *or; | ||
201 | struct osd_attr attr; | ||
202 | int ret; | ||
203 | |||
204 | /* start request */ | ||
205 | or = osd_start_request(osdev->osd, GFP_KERNEL); | ||
206 | if (!or) | ||
207 | return -ENOMEM; | ||
208 | |||
209 | /* create a get-attributes(length) request */ | ||
210 | osd_req_get_attributes(or, &osdev->obj); | ||
211 | |||
212 | osd_req_add_get_attr_list(or, &g_attr_logical_length, 1); | ||
213 | |||
214 | /* execute op synchronously */ | ||
215 | ret = osd_sync_op(or, OSDBLK_OP_TIMEOUT, osdev->obj_cred); | ||
216 | if (ret) | ||
217 | goto out; | ||
218 | |||
219 | /* extract length from returned attribute info */ | ||
220 | attr = g_attr_logical_length; | ||
221 | ret = extract_attr_from_req(or, &attr); | ||
222 | if (ret) | ||
223 | goto out; | ||
224 | |||
225 | *size_out = get_unaligned_be64(attr.val_ptr); | ||
226 | |||
227 | out: | ||
228 | osd_end_request(or); | ||
229 | return ret; | ||
230 | |||
231 | } | ||
232 | |||
233 | static void osdblk_osd_complete(struct osd_request *or, void *private) | ||
234 | { | ||
235 | struct osdblk_request *orq = private; | ||
236 | struct osd_sense_info osi; | ||
237 | int ret = osd_req_decode_sense(or, &osi); | ||
238 | |||
239 | if (ret) { | ||
240 | ret = -EIO; | ||
241 | OSDBLK_DEBUG("osdblk_osd_complete with err=%d\n", ret); | ||
242 | } | ||
243 | |||
244 | /* complete OSD request */ | ||
245 | osd_end_request(or); | ||
246 | |||
247 | /* complete request passed to osdblk by block layer */ | ||
248 | __blk_end_request_all(orq->rq, ret); | ||
249 | } | ||
250 | |||
251 | static void bio_chain_put(struct bio *chain) | ||
252 | { | ||
253 | struct bio *tmp; | ||
254 | |||
255 | while (chain) { | ||
256 | tmp = chain; | ||
257 | chain = chain->bi_next; | ||
258 | |||
259 | bio_put(tmp); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | static struct bio *bio_chain_clone(struct bio *old_chain, gfp_t gfpmask) | ||
264 | { | ||
265 | struct bio *tmp, *new_chain = NULL, *tail = NULL; | ||
266 | |||
267 | while (old_chain) { | ||
268 | tmp = bio_kmalloc(gfpmask, old_chain->bi_max_vecs); | ||
269 | if (!tmp) | ||
270 | goto err_out; | ||
271 | |||
272 | __bio_clone(tmp, old_chain); | ||
273 | tmp->bi_bdev = NULL; | ||
274 | gfpmask &= ~__GFP_WAIT; | ||
275 | tmp->bi_next = NULL; | ||
276 | |||
277 | if (!new_chain) | ||
278 | new_chain = tail = tmp; | ||
279 | else { | ||
280 | tail->bi_next = tmp; | ||
281 | tail = tmp; | ||
282 | } | ||
283 | |||
284 | old_chain = old_chain->bi_next; | ||
285 | } | ||
286 | |||
287 | return new_chain; | ||
288 | |||
289 | err_out: | ||
290 | OSDBLK_DEBUG("bio_chain_clone with err\n"); | ||
291 | bio_chain_put(new_chain); | ||
292 | return NULL; | ||
293 | } | ||
294 | |||
295 | static void osdblk_rq_fn(struct request_queue *q) | ||
296 | { | ||
297 | struct osdblk_device *osdev = q->queuedata; | ||
298 | |||
299 | while (1) { | ||
300 | struct request *rq; | ||
301 | struct osdblk_request *orq; | ||
302 | struct osd_request *or; | ||
303 | struct bio *bio; | ||
304 | bool do_write, do_flush; | ||
305 | |||
306 | /* peek at request from block layer */ | ||
307 | rq = blk_fetch_request(q); | ||
308 | if (!rq) | ||
309 | break; | ||
310 | |||
311 | /* filter out block requests we don't understand */ | ||
312 | if (!blk_fs_request(rq) && !blk_barrier_rq(rq)) { | ||
313 | blk_end_request_all(rq, 0); | ||
314 | continue; | ||
315 | } | ||
316 | |||
317 | /* deduce our operation (read, write, flush) */ | ||
318 | /* I wish the block layer simplified cmd_type/cmd_flags/cmd[] | ||
319 | * into a clearly defined set of RPC commands: | ||
320 | * read, write, flush, scsi command, power mgmt req, | ||
321 | * driver-specific, etc. | ||
322 | */ | ||
323 | |||
324 | do_flush = (rq->special == (void *) 0xdeadbeefUL); | ||
325 | do_write = (rq_data_dir(rq) == WRITE); | ||
326 | |||
327 | if (!do_flush) { /* osd_flush does not use a bio */ | ||
328 | /* a bio clone to be passed down to OSD request */ | ||
329 | bio = bio_chain_clone(rq->bio, GFP_ATOMIC); | ||
330 | if (!bio) | ||
331 | break; | ||
332 | } else | ||
333 | bio = NULL; | ||
334 | |||
335 | /* alloc internal OSD request, for OSD command execution */ | ||
336 | or = osd_start_request(osdev->osd, GFP_ATOMIC); | ||
337 | if (!or) { | ||
338 | bio_chain_put(bio); | ||
339 | OSDBLK_DEBUG("osd_start_request with err\n"); | ||
340 | break; | ||
341 | } | ||
342 | |||
343 | orq = &osdev->req[rq->tag]; | ||
344 | orq->rq = rq; | ||
345 | orq->bio = bio; | ||
346 | orq->osdev = osdev; | ||
347 | |||
348 | /* init OSD command: flush, write or read */ | ||
349 | if (do_flush) | ||
350 | osd_req_flush_object(or, &osdev->obj, | ||
351 | OSD_CDB_FLUSH_ALL, 0, 0); | ||
352 | else if (do_write) | ||
353 | osd_req_write(or, &osdev->obj, blk_rq_pos(rq) * 512ULL, | ||
354 | bio, blk_rq_bytes(rq)); | ||
355 | else | ||
356 | osd_req_read(or, &osdev->obj, blk_rq_pos(rq) * 512ULL, | ||
357 | bio, blk_rq_bytes(rq)); | ||
358 | |||
359 | OSDBLK_DEBUG("%s 0x%x bytes at 0x%llx\n", | ||
360 | do_flush ? "flush" : do_write ? | ||
361 | "write" : "read", blk_rq_bytes(rq), | ||
362 | blk_rq_pos(rq) * 512ULL); | ||
363 | |||
364 | /* begin OSD command execution */ | ||
365 | if (osd_async_op(or, osdblk_osd_complete, orq, | ||
366 | osdev->obj_cred)) { | ||
367 | osd_end_request(or); | ||
368 | blk_requeue_request(q, rq); | ||
369 | bio_chain_put(bio); | ||
370 | OSDBLK_DEBUG("osd_execute_request_async with err\n"); | ||
371 | break; | ||
372 | } | ||
373 | |||
374 | /* remove the special 'flush' marker, now that the command | ||
375 | * is executing | ||
376 | */ | ||
377 | rq->special = NULL; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | static void osdblk_prepare_flush(struct request_queue *q, struct request *rq) | ||
382 | { | ||
383 | /* add driver-specific marker, to indicate that this request | ||
384 | * is a flush command | ||
385 | */ | ||
386 | rq->special = (void *) 0xdeadbeefUL; | ||
387 | } | ||
388 | |||
389 | static void osdblk_free_disk(struct osdblk_device *osdev) | ||
390 | { | ||
391 | struct gendisk *disk = osdev->disk; | ||
392 | |||
393 | if (!disk) | ||
394 | return; | ||
395 | |||
396 | if (disk->flags & GENHD_FL_UP) | ||
397 | del_gendisk(disk); | ||
398 | if (disk->queue) | ||
399 | blk_cleanup_queue(disk->queue); | ||
400 | put_disk(disk); | ||
401 | } | ||
402 | |||
403 | static int osdblk_init_disk(struct osdblk_device *osdev) | ||
404 | { | ||
405 | struct gendisk *disk; | ||
406 | struct request_queue *q; | ||
407 | int rc; | ||
408 | u64 obj_size = 0; | ||
409 | |||
410 | /* contact OSD, request size info about the object being mapped */ | ||
411 | rc = osdblk_get_obj_size(osdev, &obj_size); | ||
412 | if (rc) | ||
413 | return rc; | ||
414 | |||
415 | /* create gendisk info */ | ||
416 | disk = alloc_disk(OSDBLK_MINORS_PER_MAJOR); | ||
417 | if (!disk) | ||
418 | return -ENOMEM; | ||
419 | |||
420 | sprintf(disk->disk_name, DRV_NAME "%d", osdev->id); | ||
421 | disk->major = osdev->major; | ||
422 | disk->first_minor = 0; | ||
423 | disk->fops = &osdblk_bd_ops; | ||
424 | disk->private_data = osdev; | ||
425 | |||
426 | /* init rq */ | ||
427 | q = blk_init_queue(osdblk_rq_fn, &osdev->lock); | ||
428 | if (!q) { | ||
429 | put_disk(disk); | ||
430 | return -ENOMEM; | ||
431 | } | ||
432 | |||
433 | /* switch queue to TCQ mode; allocate tag map */ | ||
434 | rc = blk_queue_init_tags(q, OSDBLK_MAX_REQ, NULL); | ||
435 | if (rc) { | ||
436 | blk_cleanup_queue(q); | ||
437 | put_disk(disk); | ||
438 | return rc; | ||
439 | } | ||
440 | |||
441 | /* Set our limits to the lower device limits, because osdblk cannot | ||
442 | * sleep when allocating a lower-request and therefore cannot be | ||
443 | * bouncing. | ||
444 | */ | ||
445 | blk_queue_stack_limits(q, osd_request_queue(osdev->osd)); | ||
446 | |||
447 | blk_queue_prep_rq(q, blk_queue_start_tag); | ||
448 | blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH, osdblk_prepare_flush); | ||
449 | |||
450 | disk->queue = q; | ||
451 | |||
452 | q->queuedata = osdev; | ||
453 | |||
454 | osdev->disk = disk; | ||
455 | osdev->q = q; | ||
456 | |||
457 | /* finally, announce the disk to the world */ | ||
458 | set_capacity(disk, obj_size / 512ULL); | ||
459 | add_disk(disk); | ||
460 | |||
461 | printk(KERN_INFO "%s: Added of size 0x%llx\n", | ||
462 | disk->disk_name, (unsigned long long)obj_size); | ||
463 | |||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | /******************************************************************** | ||
468 | * /sys/class/osdblk/ | ||
469 | * add map OSD object to blkdev | ||
470 | * remove unmap OSD object | ||
471 | * list show mappings | ||
472 | *******************************************************************/ | ||
473 | |||
474 | static void class_osdblk_release(struct class *cls) | ||
475 | { | ||
476 | kfree(cls); | ||
477 | } | ||
478 | |||
479 | static ssize_t class_osdblk_list(struct class *c, char *data) | ||
480 | { | ||
481 | int n = 0; | ||
482 | struct list_head *tmp; | ||
483 | |||
484 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
485 | |||
486 | list_for_each(tmp, &osdblkdev_list) { | ||
487 | struct osdblk_device *osdev; | ||
488 | |||
489 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
490 | |||
491 | n += sprintf(data+n, "%d %d %llu %llu %s\n", | ||
492 | osdev->id, | ||
493 | osdev->major, | ||
494 | osdev->obj.partition, | ||
495 | osdev->obj.id, | ||
496 | osdev->osd_path); | ||
497 | } | ||
498 | |||
499 | mutex_unlock(&ctl_mutex); | ||
500 | return n; | ||
501 | } | ||
502 | |||
503 | static ssize_t class_osdblk_add(struct class *c, const char *buf, size_t count) | ||
504 | { | ||
505 | struct osdblk_device *osdev; | ||
506 | ssize_t rc; | ||
507 | int irc, new_id = 0; | ||
508 | struct list_head *tmp; | ||
509 | |||
510 | if (!try_module_get(THIS_MODULE)) | ||
511 | return -ENODEV; | ||
512 | |||
513 | /* new osdblk_device object */ | ||
514 | osdev = kzalloc(sizeof(*osdev) + strlen(buf) + 1, GFP_KERNEL); | ||
515 | if (!osdev) { | ||
516 | rc = -ENOMEM; | ||
517 | goto err_out_mod; | ||
518 | } | ||
519 | |||
520 | /* static osdblk_device initialization */ | ||
521 | spin_lock_init(&osdev->lock); | ||
522 | INIT_LIST_HEAD(&osdev->node); | ||
523 | |||
524 | /* generate unique id: find highest unique id, add one */ | ||
525 | |||
526 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
527 | |||
528 | list_for_each(tmp, &osdblkdev_list) { | ||
529 | struct osdblk_device *osdev; | ||
530 | |||
531 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
532 | if (osdev->id > new_id) | ||
533 | new_id = osdev->id + 1; | ||
534 | } | ||
535 | |||
536 | osdev->id = new_id; | ||
537 | |||
538 | /* add to global list */ | ||
539 | list_add_tail(&osdev->node, &osdblkdev_list); | ||
540 | |||
541 | mutex_unlock(&ctl_mutex); | ||
542 | |||
543 | /* parse add command */ | ||
544 | if (sscanf(buf, "%llu %llu %s", &osdev->obj.partition, &osdev->obj.id, | ||
545 | osdev->osd_path) != 3) { | ||
546 | rc = -EINVAL; | ||
547 | goto err_out_slot; | ||
548 | } | ||
549 | |||
550 | /* initialize rest of new object */ | ||
551 | sprintf(osdev->name, DRV_NAME "%d", osdev->id); | ||
552 | |||
553 | /* contact requested OSD */ | ||
554 | osdev->osd = osduld_path_lookup(osdev->osd_path); | ||
555 | if (IS_ERR(osdev->osd)) { | ||
556 | rc = PTR_ERR(osdev->osd); | ||
557 | goto err_out_slot; | ||
558 | } | ||
559 | |||
560 | /* build OSD credential */ | ||
561 | osdblk_make_credential(osdev->obj_cred, &osdev->obj); | ||
562 | |||
563 | /* register our block device */ | ||
564 | irc = register_blkdev(0, osdev->name); | ||
565 | if (irc < 0) { | ||
566 | rc = irc; | ||
567 | goto err_out_osd; | ||
568 | } | ||
569 | |||
570 | osdev->major = irc; | ||
571 | |||
572 | /* set up and announce blkdev mapping */ | ||
573 | rc = osdblk_init_disk(osdev); | ||
574 | if (rc) | ||
575 | goto err_out_blkdev; | ||
576 | |||
577 | return count; | ||
578 | |||
579 | err_out_blkdev: | ||
580 | unregister_blkdev(osdev->major, osdev->name); | ||
581 | err_out_osd: | ||
582 | osduld_put_device(osdev->osd); | ||
583 | err_out_slot: | ||
584 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
585 | list_del_init(&osdev->node); | ||
586 | mutex_unlock(&ctl_mutex); | ||
587 | |||
588 | kfree(osdev); | ||
589 | err_out_mod: | ||
590 | OSDBLK_DEBUG("Error adding device %s\n", buf); | ||
591 | module_put(THIS_MODULE); | ||
592 | return rc; | ||
593 | } | ||
594 | |||
595 | static ssize_t class_osdblk_remove(struct class *c, const char *buf, | ||
596 | size_t count) | ||
597 | { | ||
598 | struct osdblk_device *osdev = NULL; | ||
599 | int target_id, rc; | ||
600 | unsigned long ul; | ||
601 | struct list_head *tmp; | ||
602 | |||
603 | rc = strict_strtoul(buf, 10, &ul); | ||
604 | if (rc) | ||
605 | return rc; | ||
606 | |||
607 | /* convert to int; abort if we lost anything in the conversion */ | ||
608 | target_id = (int) ul; | ||
609 | if (target_id != ul) | ||
610 | return -EINVAL; | ||
611 | |||
612 | /* remove object from list immediately */ | ||
613 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
614 | |||
615 | list_for_each(tmp, &osdblkdev_list) { | ||
616 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
617 | if (osdev->id == target_id) { | ||
618 | list_del_init(&osdev->node); | ||
619 | break; | ||
620 | } | ||
621 | osdev = NULL; | ||
622 | } | ||
623 | |||
624 | mutex_unlock(&ctl_mutex); | ||
625 | |||
626 | if (!osdev) | ||
627 | return -ENOENT; | ||
628 | |||
629 | /* clean up and free blkdev and associated OSD connection */ | ||
630 | osdblk_free_disk(osdev); | ||
631 | unregister_blkdev(osdev->major, osdev->name); | ||
632 | osduld_put_device(osdev->osd); | ||
633 | kfree(osdev); | ||
634 | |||
635 | /* release module ref */ | ||
636 | module_put(THIS_MODULE); | ||
637 | |||
638 | return count; | ||
639 | } | ||
640 | |||
641 | static struct class_attribute class_osdblk_attrs[] = { | ||
642 | __ATTR(add, 0200, NULL, class_osdblk_add), | ||
643 | __ATTR(remove, 0200, NULL, class_osdblk_remove), | ||
644 | __ATTR(list, 0444, class_osdblk_list, NULL), | ||
645 | __ATTR_NULL | ||
646 | }; | ||
647 | |||
648 | static int osdblk_sysfs_init(void) | ||
649 | { | ||
650 | int ret = 0; | ||
651 | |||
652 | /* | ||
653 | * create control files in sysfs | ||
654 | * /sys/class/osdblk/... | ||
655 | */ | ||
656 | class_osdblk = kzalloc(sizeof(*class_osdblk), GFP_KERNEL); | ||
657 | if (!class_osdblk) | ||
658 | return -ENOMEM; | ||
659 | |||
660 | class_osdblk->name = DRV_NAME; | ||
661 | class_osdblk->owner = THIS_MODULE; | ||
662 | class_osdblk->class_release = class_osdblk_release; | ||
663 | class_osdblk->class_attrs = class_osdblk_attrs; | ||
664 | |||
665 | ret = class_register(class_osdblk); | ||
666 | if (ret) { | ||
667 | kfree(class_osdblk); | ||
668 | class_osdblk = NULL; | ||
669 | printk(PFX "failed to create class osdblk\n"); | ||
670 | return ret; | ||
671 | } | ||
672 | |||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | static void osdblk_sysfs_cleanup(void) | ||
677 | { | ||
678 | if (class_osdblk) | ||
679 | class_destroy(class_osdblk); | ||
680 | class_osdblk = NULL; | ||
681 | } | ||
682 | |||
683 | static int __init osdblk_init(void) | ||
684 | { | ||
685 | int rc; | ||
686 | |||
687 | rc = osdblk_sysfs_init(); | ||
688 | if (rc) | ||
689 | return rc; | ||
690 | |||
691 | return 0; | ||
692 | } | ||
693 | |||
694 | static void __exit osdblk_exit(void) | ||
695 | { | ||
696 | osdblk_sysfs_cleanup(); | ||
697 | } | ||
698 | |||
699 | module_init(osdblk_init); | ||
700 | module_exit(osdblk_exit); | ||
701 | |||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 83650e00632d..99a506f619b7 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -1372,8 +1372,10 @@ try_next_bio: | |||
1372 | wakeup = (pd->write_congestion_on > 0 | 1372 | wakeup = (pd->write_congestion_on > 0 |
1373 | && pd->bio_queue_size <= pd->write_congestion_off); | 1373 | && pd->bio_queue_size <= pd->write_congestion_off); |
1374 | spin_unlock(&pd->lock); | 1374 | spin_unlock(&pd->lock); |
1375 | if (wakeup) | 1375 | if (wakeup) { |
1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, WRITE); | 1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, |
1377 | BLK_RW_ASYNC); | ||
1378 | } | ||
1377 | 1379 | ||
1378 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); | 1380 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); |
1379 | pkt_set_state(pkt, PACKET_WAITING_STATE); | 1381 | pkt_set_state(pkt, PACKET_WAITING_STATE); |
@@ -2592,10 +2594,10 @@ static int pkt_make_request(struct request_queue *q, struct bio *bio) | |||
2592 | spin_lock(&pd->lock); | 2594 | spin_lock(&pd->lock); |
2593 | if (pd->write_congestion_on > 0 | 2595 | if (pd->write_congestion_on > 0 |
2594 | && pd->bio_queue_size >= pd->write_congestion_on) { | 2596 | && pd->bio_queue_size >= pd->write_congestion_on) { |
2595 | set_bdi_congested(&q->backing_dev_info, WRITE); | 2597 | set_bdi_congested(&q->backing_dev_info, BLK_RW_ASYNC); |
2596 | do { | 2598 | do { |
2597 | spin_unlock(&pd->lock); | 2599 | spin_unlock(&pd->lock); |
2598 | congestion_wait(WRITE, HZ); | 2600 | congestion_wait(BLK_RW_ASYNC, HZ); |
2599 | spin_lock(&pd->lock); | 2601 | spin_lock(&pd->lock); |
2600 | } while(pd->bio_queue_size > pd->write_congestion_off); | 2602 | } while(pd->bio_queue_size > pd->write_congestion_off); |
2601 | } | 2603 | } |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 43db3ea15b54..fbeefb68a31f 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -213,7 +213,7 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
213 | * Only allow the generic SCSI ioctls if the host can support it. | 213 | * Only allow the generic SCSI ioctls if the host can support it. |
214 | */ | 214 | */ |
215 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) | 215 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) |
216 | return -ENOIOCTLCMD; | 216 | return -ENOTTY; |
217 | 217 | ||
218 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); | 218 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); |
219 | } | 219 | } |
@@ -360,6 +360,9 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
360 | blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2); | 360 | blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2); |
361 | blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2); | 361 | blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2); |
362 | 362 | ||
363 | /* No need to bounce any requests */ | ||
364 | blk_queue_bounce_limit(vblk->disk->queue, BLK_BOUNCE_ANY); | ||
365 | |||
363 | /* No real sector limit. */ | 366 | /* No real sector limit. */ |
364 | blk_queue_max_sectors(vblk->disk->queue, -1U); | 367 | blk_queue_max_sectors(vblk->disk->queue, -1U); |
365 | 368 | ||
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 1df9dda2e377..d5cde6d86f89 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/types.h> | 31 | #include <linux/types.h> |
33 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
34 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 72429b6b2fa8..6c32fbf07164 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -81,6 +81,7 @@ static char *serial_version = "4.30"; | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | 82 | #include <linux/seq_file.h> |
83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
84 | #include <linux/smp_lock.h> | ||
84 | #include <linux/init.h> | 85 | #include <linux/init.h> |
85 | #include <linux/bitops.h> | 86 | #include <linux/bitops.h> |
86 | 87 | ||
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index f3366d3f06cf..2dafc2da0648 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -633,6 +633,7 @@ | |||
633 | #include <linux/tty.h> | 633 | #include <linux/tty.h> |
634 | #include <linux/tty_flip.h> | 634 | #include <linux/tty_flip.h> |
635 | #include <linux/serial.h> | 635 | #include <linux/serial.h> |
636 | #include <linux/smp_lock.h> | ||
636 | #include <linux/major.h> | 637 | #include <linux/major.h> |
637 | #include <linux/string.h> | 638 | #include <linux/string.h> |
638 | #include <linux/fcntl.h> | 639 | #include <linux/fcntl.h> |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index abef1f7d84fe..ff647ca1c489 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/tty.h> | 36 | #include <linux/tty.h> |
37 | #include <linux/tty_flip.h> | 37 | #include <linux/tty_flip.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> | ||
39 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
40 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
41 | #include <linux/uaccess.h> | 42 | #include <linux/uaccess.h> |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 621d1184673c..4f1f4cd670da 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -122,6 +122,7 @@ | |||
122 | #include <linux/fs.h> | 122 | #include <linux/fs.h> |
123 | #include <linux/sched.h> | 123 | #include <linux/sched.h> |
124 | #include <linux/serial.h> | 124 | #include <linux/serial.h> |
125 | #include <linux/smp_lock.h> | ||
125 | #include <linux/mm.h> | 126 | #include <linux/mm.h> |
126 | #include <linux/interrupt.h> | 127 | #include <linux/interrupt.h> |
127 | #include <linux/timer.h> | 128 | #include <linux/timer.h> |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 0c999f5bb3db..ab2f3349c5c4 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/smp_lock.h> | ||
23 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
24 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
25 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 65b6ff2442c6..dd0083bbb64a 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/tty.h> | 34 | #include <linux/tty.h> |
35 | #include <linux/tty_flip.h> | 35 | #include <linux/tty_flip.h> |
36 | #include <linux/major.h> | 36 | #include <linux/major.h> |
37 | #include <linux/smp_lock.h> | ||
37 | #include <linux/string.h> | 38 | #include <linux/string.h> |
38 | #include <linux/fcntl.h> | 39 | #include <linux/fcntl.h> |
39 | #include <linux/ptrace.h> | 40 | #include <linux/ptrace.h> |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 52d953eb30c3..dbf8d52f31d0 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/signal.h> | 24 | #include <linux/signal.h> |
25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
26 | #include <linux/smp_lock.h> | ||
26 | #include <linux/timer.h> | 27 | #include <linux/timer.h> |
27 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
28 | #include <linux/tty.h> | 29 | #include <linux/tty.h> |
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 1c43c8cdee25..c68118efad84 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -97,6 +97,7 @@ | |||
97 | #include <linux/slab.h> | 97 | #include <linux/slab.h> |
98 | #include <linux/tty.h> | 98 | #include <linux/tty.h> |
99 | #include <linux/errno.h> | 99 | #include <linux/errno.h> |
100 | #include <linux/smp_lock.h> | ||
100 | #include <linux/string.h> /* used in new tty drivers */ | 101 | #include <linux/string.h> /* used in new tty drivers */ |
101 | #include <linux/signal.h> /* used in new tty drivers */ | 102 | #include <linux/signal.h> /* used in new tty drivers */ |
102 | #include <linux/if.h> | 103 | #include <linux/if.h> |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 2e99158ebb8a..6934025a1ac1 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/ioport.h> | 58 | #include <linux/ioport.h> |
59 | #include <linux/in.h> | 59 | #include <linux/in.h> |
60 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
61 | #include <linux/smp_lock.h> | ||
61 | #include <linux/tty.h> | 62 | #include <linux/tty.h> |
62 | #include <linux/errno.h> | 63 | #include <linux/errno.h> |
63 | #include <linux/string.h> /* used in new tty drivers */ | 64 | #include <linux/string.h> /* used in new tty drivers */ |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 94a5d5020abc..ff47907ff1bf 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -1331,9 +1331,6 @@ handle_newline: | |||
1331 | 1331 | ||
1332 | static void n_tty_write_wakeup(struct tty_struct *tty) | 1332 | static void n_tty_write_wakeup(struct tty_struct *tty) |
1333 | { | 1333 | { |
1334 | /* Write out any echoed characters that are still pending */ | ||
1335 | process_echoes(tty); | ||
1336 | |||
1337 | if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) | 1334 | if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) |
1338 | kill_fasync(&tty->fasync, SIGIO, POLL_OUT); | 1335 | kill_fasync(&tty->fasync, SIGIO, POLL_OUT); |
1339 | } | 1336 | } |
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 574f1c79b6e6..280b41c507a7 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
@@ -828,7 +828,7 @@ static int receive_data(enum port_type index, struct nozomi *dc) | |||
828 | struct port *port = &dc->port[index]; | 828 | struct port *port = &dc->port[index]; |
829 | void __iomem *addr = port->dl_addr[port->toggle_dl]; | 829 | void __iomem *addr = port->dl_addr[port->toggle_dl]; |
830 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 830 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
831 | int i; | 831 | int i, ret; |
832 | 832 | ||
833 | if (unlikely(!tty)) { | 833 | if (unlikely(!tty)) { |
834 | DBG1("tty not open for port: %d?", index); | 834 | DBG1("tty not open for port: %d?", index); |
@@ -844,12 +844,14 @@ static int receive_data(enum port_type index, struct nozomi *dc) | |||
844 | 844 | ||
845 | /* disable interrupt in downlink... */ | 845 | /* disable interrupt in downlink... */ |
846 | disable_transmit_dl(index, dc); | 846 | disable_transmit_dl(index, dc); |
847 | return 0; | 847 | ret = 0; |
848 | goto put; | ||
848 | } | 849 | } |
849 | 850 | ||
850 | if (unlikely(size == 0)) { | 851 | if (unlikely(size == 0)) { |
851 | dev_err(&dc->pdev->dev, "size == 0?\n"); | 852 | dev_err(&dc->pdev->dev, "size == 0?\n"); |
852 | return 1; | 853 | ret = 1; |
854 | goto put; | ||
853 | } | 855 | } |
854 | 856 | ||
855 | tty_buffer_request_room(tty, size); | 857 | tty_buffer_request_room(tty, size); |
@@ -871,8 +873,10 @@ static int receive_data(enum port_type index, struct nozomi *dc) | |||
871 | } | 873 | } |
872 | 874 | ||
873 | set_bit(index, &dc->flip); | 875 | set_bit(index, &dc->flip); |
876 | ret = 1; | ||
877 | put: | ||
874 | tty_kref_put(tty); | 878 | tty_kref_put(tty); |
875 | return 1; | 879 | return ret; |
876 | } | 880 | } |
877 | 881 | ||
878 | /* Debug for interrupts */ | 882 | /* Debug for interrupts */ |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 9d1b4f548f67..6e6942c45f5b 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/major.h> | 22 | #include <linux/major.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/smp_lock.h> | ||
25 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
26 | #include <linux/device.h> | 27 | #include <linux/device.h> |
27 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index ce81da5b2da9..d58c2eb07f07 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/smp_lock.h> | ||
47 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
48 | #include <linux/init.h> | 49 | #include <linux/init.h> |
49 | 50 | ||
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 217660451237..171711acf5cd 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/tty_flip.h> | 49 | #include <linux/tty_flip.h> |
50 | #include <linux/smp_lock.h> | ||
50 | #include <linux/spinlock.h> | 51 | #include <linux/spinlock.h> |
51 | #include <linux/device.h> | 52 | #include <linux/device.h> |
52 | 53 | ||
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 63d5b628477a..0e29a23ec4c5 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include <linux/tty_driver.h> | 73 | #include <linux/tty_driver.h> |
74 | #include <linux/tty_flip.h> | 74 | #include <linux/tty_flip.h> |
75 | #include <linux/serial.h> | 75 | #include <linux/serial.h> |
76 | #include <linux/smp_lock.h> | ||
76 | #include <linux/string.h> | 77 | #include <linux/string.h> |
77 | #include <linux/fcntl.h> | 78 | #include <linux/fcntl.h> |
78 | #include <linux/ptrace.h> | 79 | #include <linux/ptrace.h> |
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index f1f24f0ee26f..51e7a46787be 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/serial.h> | 53 | #include <linux/serial.h> |
54 | #include <linux/serialP.h> | 54 | #include <linux/serialP.h> |
55 | #include <linux/smp_lock.h> | ||
55 | #include <linux/string.h> | 56 | #include <linux/string.h> |
56 | #include <linux/fcntl.h> | 57 | #include <linux/fcntl.h> |
57 | #include <linux/ptrace.h> | 58 | #include <linux/ptrace.h> |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index e72be4190a44..bfe4cdb2febb 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -87,6 +87,7 @@ | |||
87 | #include <linux/tty_flip.h> | 87 | #include <linux/tty_flip.h> |
88 | #include <linux/mm.h> | 88 | #include <linux/mm.h> |
89 | #include <linux/serial.h> | 89 | #include <linux/serial.h> |
90 | #include <linux/smp_lock.h> | ||
90 | #include <linux/fcntl.h> | 91 | #include <linux/fcntl.h> |
91 | #include <linux/major.h> | 92 | #include <linux/major.h> |
92 | #include <linux/delay.h> | 93 | #include <linux/delay.h> |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 518f2a25d91e..a81ec4fcf6ff 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -216,6 +216,7 @@ | |||
216 | #include <linux/eisa.h> | 216 | #include <linux/eisa.h> |
217 | #include <linux/pci.h> | 217 | #include <linux/pci.h> |
218 | #include <linux/slab.h> | 218 | #include <linux/slab.h> |
219 | #include <linux/smp_lock.h> | ||
219 | #include <linux/init.h> | 220 | #include <linux/init.h> |
220 | #include <linux/miscdevice.h> | 221 | #include <linux/miscdevice.h> |
221 | #include <linux/bitops.h> | 222 | #include <linux/bitops.h> |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index afded3a2379c..813552f14884 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | 82 | #include <linux/seq_file.h> |
83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
84 | #include <linux/smp_lock.h> | ||
84 | #include <linux/delay.h> | 85 | #include <linux/delay.h> |
85 | #include <linux/netdevice.h> | 86 | #include <linux/netdevice.h> |
86 | #include <linux/vmalloc.h> | 87 | #include <linux/vmalloc.h> |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index a2e67e6df3a1..91f20a92fddf 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/mm.h> | 62 | #include <linux/mm.h> |
63 | #include <linux/seq_file.h> | 63 | #include <linux/seq_file.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
65 | #include <linux/netdevice.h> | 66 | #include <linux/netdevice.h> |
66 | #include <linux/vmalloc.h> | 67 | #include <linux/vmalloc.h> |
67 | #include <linux/init.h> | 68 | #include <linux/init.h> |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 6f727e3c53ad..8d4a2a8a0a70 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
53 | #include <linux/seq_file.h> | 53 | #include <linux/seq_file.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/smp_lock.h> | ||
55 | #include <linux/netdevice.h> | 56 | #include <linux/netdevice.h> |
56 | #include <linux/vmalloc.h> | 57 | #include <linux/vmalloc.h> |
57 | #include <linux/init.h> | 58 | #include <linux/init.h> |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index ccdd828adcef..b0603b2e5684 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/poll.h> | 26 | #include <linux/poll.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/smp_lock.h> | ||
30 | 29 | ||
31 | #include "tpm.h" | 30 | #include "tpm.h" |
32 | 31 | ||
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index b24f6c6a1ea3..ad6ba4ed2808 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/smp_lock.h> | ||
25 | 24 | ||
26 | #include <asm/io.h> | 25 | #include <asm/io.h> |
27 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 913aa8d3f1c5..acd76b767d4c 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/proc_fs.h> | 21 | #include <linux/proc_fs.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/device.h> | 24 | #include <linux/device.h> |
26 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
27 | #include <linux/bitops.h> | 26 | #include <linux/bitops.h> |
@@ -791,17 +790,20 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
791 | * N_TTY. | 790 | * N_TTY. |
792 | */ | 791 | */ |
793 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { | 792 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { |
794 | /* Avoid racing set_ldisc */ | 793 | /* Avoid racing set_ldisc or tty_ldisc_release */ |
795 | mutex_lock(&tty->ldisc_mutex); | 794 | mutex_lock(&tty->ldisc_mutex); |
796 | /* Switch back to N_TTY */ | 795 | if (tty->ldisc) { /* Not yet closed */ |
797 | tty_ldisc_halt(tty); | 796 | /* Switch back to N_TTY */ |
798 | tty_ldisc_wait_idle(tty); | 797 | tty_ldisc_halt(tty); |
799 | tty_ldisc_reinit(tty); | 798 | tty_ldisc_wait_idle(tty); |
800 | /* At this point we have a closed ldisc and we want to | 799 | tty_ldisc_reinit(tty); |
801 | reopen it. We could defer this to the next open but | 800 | /* At this point we have a closed ldisc and we want to |
802 | it means auditing a lot of other paths so this is a FIXME */ | 801 | reopen it. We could defer this to the next open but |
803 | WARN_ON(tty_ldisc_open(tty, tty->ldisc)); | 802 | it means auditing a lot of other paths so this is |
804 | tty_ldisc_enable(tty); | 803 | a FIXME */ |
804 | WARN_ON(tty_ldisc_open(tty, tty->ldisc)); | ||
805 | tty_ldisc_enable(tty); | ||
806 | } | ||
805 | mutex_unlock(&tty->ldisc_mutex); | 807 | mutex_unlock(&tty->ldisc_mutex); |
806 | tty_reset_termios(tty); | 808 | tty_reset_termios(tty); |
807 | } | 809 | } |
@@ -866,6 +868,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty) | |||
866 | 868 | ||
867 | tty_ldisc_wait_idle(tty); | 869 | tty_ldisc_wait_idle(tty); |
868 | 870 | ||
871 | mutex_lock(&tty->ldisc_mutex); | ||
869 | /* | 872 | /* |
870 | * Now kill off the ldisc | 873 | * Now kill off the ldisc |
871 | */ | 874 | */ |
@@ -876,6 +879,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty) | |||
876 | 879 | ||
877 | /* Ensure the next open requests the N_TTY ldisc */ | 880 | /* Ensure the next open requests the N_TTY ldisc */ |
878 | tty_set_termios_ldisc(tty, N_TTY); | 881 | tty_set_termios_ldisc(tty, N_TTY); |
882 | mutex_unlock(&tty->ldisc_mutex); | ||
879 | 883 | ||
880 | /* This will need doing differently if we need to lock */ | 884 | /* This will need doing differently if we need to lock */ |
881 | if (o_tty) | 885 | if (o_tty) |
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index 4e862a75f7ff..9769b1149f76 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
@@ -267,7 +267,7 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
267 | if (retval == 0) | 267 | if (retval == 0) |
268 | port->flags |= ASYNC_NORMAL_ACTIVE; | 268 | port->flags |= ASYNC_NORMAL_ACTIVE; |
269 | spin_unlock_irqrestore(&port->lock, flags); | 269 | spin_unlock_irqrestore(&port->lock, flags); |
270 | return 0; | 270 | return retval; |
271 | 271 | ||
272 | } | 272 | } |
273 | EXPORT_SYMBOL(tty_port_block_til_ready); | 273 | EXPORT_SYMBOL(tty_port_block_til_ready); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index d9113b4c76e3..404f4c1ee431 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -89,6 +89,7 @@ | |||
89 | #include <linux/mutex.h> | 89 | #include <linux/mutex.h> |
90 | #include <linux/vt_kern.h> | 90 | #include <linux/vt_kern.h> |
91 | #include <linux/selection.h> | 91 | #include <linux/selection.h> |
92 | #include <linux/smp_lock.h> | ||
92 | #include <linux/tiocl.h> | 93 | #include <linux/tiocl.h> |
93 | #include <linux/kbd_kern.h> | 94 | #include <linux/kbd_kern.h> |
94 | #include <linux/consolemap.h> | 95 | #include <linux/consolemap.h> |
@@ -769,14 +770,12 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ | |||
769 | visual_init(vc, currcons, 1); | 770 | visual_init(vc, currcons, 1); |
770 | if (!*vc->vc_uni_pagedir_loc) | 771 | if (!*vc->vc_uni_pagedir_loc) |
771 | con_set_default_unimap(vc); | 772 | con_set_default_unimap(vc); |
772 | if (!vc->vc_kmalloced) | 773 | vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); |
773 | vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); | ||
774 | if (!vc->vc_screenbuf) { | 774 | if (!vc->vc_screenbuf) { |
775 | kfree(vc); | 775 | kfree(vc); |
776 | vc_cons[currcons].d = NULL; | 776 | vc_cons[currcons].d = NULL; |
777 | return -ENOMEM; | 777 | return -ENOMEM; |
778 | } | 778 | } |
779 | vc->vc_kmalloced = 1; | ||
780 | vc_init(vc, vc->vc_rows, vc->vc_cols, 1); | 779 | vc_init(vc, vc->vc_rows, vc->vc_cols, 1); |
781 | vcs_make_sysfs(currcons); | 780 | vcs_make_sysfs(currcons); |
782 | atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m); | 781 | atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m); |
@@ -912,10 +911,8 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, | |||
912 | if (new_scr_end > new_origin) | 911 | if (new_scr_end > new_origin) |
913 | scr_memsetw((void *)new_origin, vc->vc_video_erase_char, | 912 | scr_memsetw((void *)new_origin, vc->vc_video_erase_char, |
914 | new_scr_end - new_origin); | 913 | new_scr_end - new_origin); |
915 | if (vc->vc_kmalloced) | 914 | kfree(vc->vc_screenbuf); |
916 | kfree(vc->vc_screenbuf); | ||
917 | vc->vc_screenbuf = newscreen; | 915 | vc->vc_screenbuf = newscreen; |
918 | vc->vc_kmalloced = 1; | ||
919 | vc->vc_screenbuf_size = new_screen_size; | 916 | vc->vc_screenbuf_size = new_screen_size; |
920 | set_origin(vc); | 917 | set_origin(vc); |
921 | 918 | ||
@@ -994,8 +991,7 @@ void vc_deallocate(unsigned int currcons) | |||
994 | vc->vc_sw->con_deinit(vc); | 991 | vc->vc_sw->con_deinit(vc); |
995 | put_pid(vc->vt_pid); | 992 | put_pid(vc->vt_pid); |
996 | module_put(vc->vc_sw->owner); | 993 | module_put(vc->vc_sw->owner); |
997 | if (vc->vc_kmalloced) | 994 | kfree(vc->vc_screenbuf); |
998 | kfree(vc->vc_screenbuf); | ||
999 | if (currcons >= MIN_NR_CONSOLES) | 995 | if (currcons >= MIN_NR_CONSOLES) |
1000 | kfree(vc); | 996 | kfree(vc); |
1001 | vc_cons[currcons].d = NULL; | 997 | vc_cons[currcons].d = NULL; |
@@ -2880,7 +2876,6 @@ static int __init con_init(void) | |||
2880 | INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); | 2876 | INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); |
2881 | visual_init(vc, currcons, 1); | 2877 | visual_init(vc, currcons, 1); |
2882 | vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); | 2878 | vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); |
2883 | vc->vc_kmalloced = 0; | ||
2884 | vc_init(vc, vc->vc_rows, vc->vc_cols, | 2879 | vc_init(vc, vc->vc_rows, vc->vc_cols, |
2885 | currcons || !vc->vc_sw->con_save_screen); | 2880 | currcons || !vc->vc_sw->con_save_screen); |
2886 | } | 2881 | } |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 7539bed0f7e0..95189f288f8c 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/console.h> | 25 | #include <linux/console.h> |
26 | #include <linux/consolemap.h> | 26 | #include <linux/consolemap.h> |
27 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
28 | #include <linux/smp_lock.h> | ||
28 | #include <linux/timex.h> | 29 | #include <linux/timex.h> |
29 | 30 | ||
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |
diff --git a/drivers/gpio/vr41xx_giu.c b/drivers/gpio/vr41xx_giu.c index b70e06133e78..b16c9a8c03f5 100644 --- a/drivers/gpio/vr41xx_giu.c +++ b/drivers/gpio/vr41xx_giu.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
35 | 34 | ||
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index a6f73f1e99d9..3da9cfa31848 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -1090,6 +1090,8 @@ int drm_helper_resume_force_mode(struct drm_device *dev) | |||
1090 | if (ret == false) | 1090 | if (ret == false) |
1091 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); | 1091 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); |
1092 | } | 1092 | } |
1093 | /* disable the unused connectors while restoring the modesetting */ | ||
1094 | drm_helper_disable_unused_functions(dev); | ||
1093 | return 0; | 1095 | return 0; |
1094 | } | 1096 | } |
1095 | EXPORT_SYMBOL(drm_helper_resume_force_mode); | 1097 | EXPORT_SYMBOL(drm_helper_resume_force_mode); |
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 2960b6d73456..9903f270e440 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c | |||
@@ -101,6 +101,10 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, | |||
101 | continue; | 101 | continue; |
102 | 102 | ||
103 | tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); | 103 | tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); |
104 | if (tmp == NULL) { | ||
105 | ret = -1; | ||
106 | goto fail; | ||
107 | } | ||
104 | ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO, | 108 | ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO, |
105 | root, tmp, &drm_debugfs_fops); | 109 | root, tmp, &drm_debugfs_fops); |
106 | if (!ent) { | 110 | if (!ent) { |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 8104ecaea26f..ffe8f4394d50 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -134,26 +134,29 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size) | |||
134 | BUG_ON((size & (PAGE_SIZE - 1)) != 0); | 134 | BUG_ON((size & (PAGE_SIZE - 1)) != 0); |
135 | 135 | ||
136 | obj = kzalloc(sizeof(*obj), GFP_KERNEL); | 136 | obj = kzalloc(sizeof(*obj), GFP_KERNEL); |
137 | if (!obj) | ||
138 | goto free; | ||
137 | 139 | ||
138 | obj->dev = dev; | 140 | obj->dev = dev; |
139 | obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE); | 141 | obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE); |
140 | if (IS_ERR(obj->filp)) { | 142 | if (IS_ERR(obj->filp)) |
141 | kfree(obj); | 143 | goto free; |
142 | return NULL; | ||
143 | } | ||
144 | 144 | ||
145 | kref_init(&obj->refcount); | 145 | kref_init(&obj->refcount); |
146 | kref_init(&obj->handlecount); | 146 | kref_init(&obj->handlecount); |
147 | obj->size = size; | 147 | obj->size = size; |
148 | if (dev->driver->gem_init_object != NULL && | 148 | if (dev->driver->gem_init_object != NULL && |
149 | dev->driver->gem_init_object(obj) != 0) { | 149 | dev->driver->gem_init_object(obj) != 0) { |
150 | fput(obj->filp); | 150 | goto fput; |
151 | kfree(obj); | ||
152 | return NULL; | ||
153 | } | 151 | } |
154 | atomic_inc(&dev->object_count); | 152 | atomic_inc(&dev->object_count); |
155 | atomic_add(obj->size, &dev->object_memory); | 153 | atomic_add(obj->size, &dev->object_memory); |
156 | return obj; | 154 | return obj; |
155 | fput: | ||
156 | fput(obj->filp); | ||
157 | free: | ||
158 | kfree(obj); | ||
159 | return NULL; | ||
157 | } | 160 | } |
158 | EXPORT_SYMBOL(drm_gem_object_alloc); | 161 | EXPORT_SYMBOL(drm_gem_object_alloc); |
159 | 162 | ||
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 155a5bbce680..55bb8a82d612 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -489,7 +489,7 @@ int drm_put_minor(struct drm_minor **minor_p) | |||
489 | */ | 489 | */ |
490 | void drm_put_dev(struct drm_device *dev) | 490 | void drm_put_dev(struct drm_device *dev) |
491 | { | 491 | { |
492 | struct drm_driver *driver = dev->driver; | 492 | struct drm_driver *driver; |
493 | struct drm_map_list *r_list, *list_temp; | 493 | struct drm_map_list *r_list, *list_temp; |
494 | 494 | ||
495 | DRM_DEBUG("\n"); | 495 | DRM_DEBUG("\n"); |
@@ -498,6 +498,7 @@ void drm_put_dev(struct drm_device *dev) | |||
498 | DRM_ERROR("cleanup called no dev\n"); | 498 | DRM_ERROR("cleanup called no dev\n"); |
499 | return; | 499 | return; |
500 | } | 500 | } |
501 | driver = dev->driver; | ||
501 | 502 | ||
502 | drm_vblank_cleanup(dev); | 503 | drm_vblank_cleanup(dev); |
503 | 504 | ||
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index f112c769d533..8c4783180bf6 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -846,7 +846,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data, | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | 848 | ||
849 | printk(KERN_DEBUG "set status page addr 0x%08x\n", (u32)hws->addr); | 849 | DRM_DEBUG("set status page addr 0x%08x\n", (u32)hws->addr); |
850 | 850 | ||
851 | dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12); | 851 | dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12); |
852 | 852 | ||
@@ -885,8 +885,8 @@ static int i915_set_status_page(struct drm_device *dev, void *data, | |||
885 | * some RAM for the framebuffer at early boot. This code figures out | 885 | * some RAM for the framebuffer at early boot. This code figures out |
886 | * how much was set aside so we can use it for our own purposes. | 886 | * how much was set aside so we can use it for our own purposes. |
887 | */ | 887 | */ |
888 | static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | 888 | static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size, |
889 | unsigned long *preallocated_size) | 889 | uint32_t *preallocated_size) |
890 | { | 890 | { |
891 | struct pci_dev *bridge_dev; | 891 | struct pci_dev *bridge_dev; |
892 | u16 tmp = 0; | 892 | u16 tmp = 0; |
@@ -984,10 +984,11 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | |||
984 | return 0; | 984 | return 0; |
985 | } | 985 | } |
986 | 986 | ||
987 | static int i915_load_modeset_init(struct drm_device *dev) | 987 | static int i915_load_modeset_init(struct drm_device *dev, |
988 | unsigned long prealloc_size, | ||
989 | unsigned long agp_size) | ||
988 | { | 990 | { |
989 | struct drm_i915_private *dev_priv = dev->dev_private; | 991 | struct drm_i915_private *dev_priv = dev->dev_private; |
990 | unsigned long agp_size, prealloc_size; | ||
991 | int fb_bar = IS_I9XX(dev) ? 2 : 0; | 992 | int fb_bar = IS_I9XX(dev) ? 2 : 0; |
992 | int ret = 0; | 993 | int ret = 0; |
993 | 994 | ||
@@ -1002,10 +1003,6 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1002 | if (IS_I965G(dev) || IS_G33(dev)) | 1003 | if (IS_I965G(dev) || IS_G33(dev)) |
1003 | dev_priv->cursor_needs_physical = false; | 1004 | dev_priv->cursor_needs_physical = false; |
1004 | 1005 | ||
1005 | ret = i915_probe_agp(dev, &agp_size, &prealloc_size); | ||
1006 | if (ret) | ||
1007 | goto out; | ||
1008 | |||
1009 | /* Basic memrange allocator for stolen space (aka vram) */ | 1006 | /* Basic memrange allocator for stolen space (aka vram) */ |
1010 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); | 1007 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); |
1011 | 1008 | ||
@@ -1082,6 +1079,44 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master) | |||
1082 | master->driver_priv = NULL; | 1079 | master->driver_priv = NULL; |
1083 | } | 1080 | } |
1084 | 1081 | ||
1082 | static void i915_get_mem_freq(struct drm_device *dev) | ||
1083 | { | ||
1084 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1085 | u32 tmp; | ||
1086 | |||
1087 | if (!IS_IGD(dev)) | ||
1088 | return; | ||
1089 | |||
1090 | tmp = I915_READ(CLKCFG); | ||
1091 | |||
1092 | switch (tmp & CLKCFG_FSB_MASK) { | ||
1093 | case CLKCFG_FSB_533: | ||
1094 | dev_priv->fsb_freq = 533; /* 133*4 */ | ||
1095 | break; | ||
1096 | case CLKCFG_FSB_800: | ||
1097 | dev_priv->fsb_freq = 800; /* 200*4 */ | ||
1098 | break; | ||
1099 | case CLKCFG_FSB_667: | ||
1100 | dev_priv->fsb_freq = 667; /* 167*4 */ | ||
1101 | break; | ||
1102 | case CLKCFG_FSB_400: | ||
1103 | dev_priv->fsb_freq = 400; /* 100*4 */ | ||
1104 | break; | ||
1105 | } | ||
1106 | |||
1107 | switch (tmp & CLKCFG_MEM_MASK) { | ||
1108 | case CLKCFG_MEM_533: | ||
1109 | dev_priv->mem_freq = 533; | ||
1110 | break; | ||
1111 | case CLKCFG_MEM_667: | ||
1112 | dev_priv->mem_freq = 667; | ||
1113 | break; | ||
1114 | case CLKCFG_MEM_800: | ||
1115 | dev_priv->mem_freq = 800; | ||
1116 | break; | ||
1117 | } | ||
1118 | } | ||
1119 | |||
1085 | /** | 1120 | /** |
1086 | * i915_driver_load - setup chip and create an initial config | 1121 | * i915_driver_load - setup chip and create an initial config |
1087 | * @dev: DRM device | 1122 | * @dev: DRM device |
@@ -1098,6 +1133,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1098 | struct drm_i915_private *dev_priv = dev->dev_private; | 1133 | struct drm_i915_private *dev_priv = dev->dev_private; |
1099 | resource_size_t base, size; | 1134 | resource_size_t base, size; |
1100 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; | 1135 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; |
1136 | uint32_t agp_size, prealloc_size; | ||
1101 | 1137 | ||
1102 | /* i915 has 4 more counters */ | 1138 | /* i915 has 4 more counters */ |
1103 | dev->counters += 4; | 1139 | dev->counters += 4; |
@@ -1146,9 +1182,22 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1146 | "performance may suffer.\n"); | 1182 | "performance may suffer.\n"); |
1147 | } | 1183 | } |
1148 | 1184 | ||
1185 | ret = i915_probe_agp(dev, &agp_size, &prealloc_size); | ||
1186 | if (ret) | ||
1187 | goto out_iomapfree; | ||
1188 | |||
1149 | /* enable GEM by default */ | 1189 | /* enable GEM by default */ |
1150 | dev_priv->has_gem = 1; | 1190 | dev_priv->has_gem = 1; |
1151 | 1191 | ||
1192 | if (prealloc_size > agp_size * 3 / 4) { | ||
1193 | DRM_ERROR("Detected broken video BIOS with %d/%dkB of video " | ||
1194 | "memory stolen.\n", | ||
1195 | prealloc_size / 1024, agp_size / 1024); | ||
1196 | DRM_ERROR("Disabling GEM. (try reducing stolen memory or " | ||
1197 | "updating the BIOS to fix).\n"); | ||
1198 | dev_priv->has_gem = 0; | ||
1199 | } | ||
1200 | |||
1152 | dev->driver->get_vblank_counter = i915_get_vblank_counter; | 1201 | dev->driver->get_vblank_counter = i915_get_vblank_counter; |
1153 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ | 1202 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ |
1154 | if (IS_G4X(dev) || IS_IGDNG(dev)) { | 1203 | if (IS_G4X(dev) || IS_IGDNG(dev)) { |
@@ -1165,6 +1214,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1165 | goto out_iomapfree; | 1214 | goto out_iomapfree; |
1166 | } | 1215 | } |
1167 | 1216 | ||
1217 | i915_get_mem_freq(dev); | ||
1218 | |||
1168 | /* On the 945G/GM, the chipset reports the MSI capability on the | 1219 | /* On the 945G/GM, the chipset reports the MSI capability on the |
1169 | * integrated graphics even though the support isn't actually there | 1220 | * integrated graphics even though the support isn't actually there |
1170 | * according to the published specs. It doesn't appear to function | 1221 | * according to the published specs. It doesn't appear to function |
@@ -1180,6 +1231,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1180 | pci_enable_msi(dev->pdev); | 1231 | pci_enable_msi(dev->pdev); |
1181 | 1232 | ||
1182 | spin_lock_init(&dev_priv->user_irq_lock); | 1233 | spin_lock_init(&dev_priv->user_irq_lock); |
1234 | spin_lock_init(&dev_priv->error_lock); | ||
1183 | dev_priv->user_irq_refcount = 0; | 1235 | dev_priv->user_irq_refcount = 0; |
1184 | 1236 | ||
1185 | ret = drm_vblank_init(dev, I915_NUM_PIPE); | 1237 | ret = drm_vblank_init(dev, I915_NUM_PIPE); |
@@ -1190,7 +1242,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1190 | } | 1242 | } |
1191 | 1243 | ||
1192 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1244 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1193 | ret = i915_load_modeset_init(dev); | 1245 | ret = i915_load_modeset_init(dev, prealloc_size, agp_size); |
1194 | if (ret < 0) { | 1246 | if (ret < 0) { |
1195 | DRM_ERROR("failed to init modeset\n"); | 1247 | DRM_ERROR("failed to init modeset\n"); |
1196 | goto out_rmmap; | 1248 | goto out_rmmap; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e3cb4025e323..fc4b68aa2d05 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include "drm_pciids.h" | 36 | #include "drm_pciids.h" |
37 | #include <linux/console.h> | 37 | #include <linux/console.h> |
38 | #include "drm_crtc_helper.h" | ||
38 | 39 | ||
39 | static unsigned int i915_modeset = -1; | 40 | static unsigned int i915_modeset = -1; |
40 | module_param_named(modeset, i915_modeset, int, 0400); | 41 | module_param_named(modeset, i915_modeset, int, 0400); |
@@ -57,8 +58,8 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
57 | struct drm_i915_private *dev_priv = dev->dev_private; | 58 | struct drm_i915_private *dev_priv = dev->dev_private; |
58 | 59 | ||
59 | if (!dev || !dev_priv) { | 60 | if (!dev || !dev_priv) { |
60 | printk(KERN_ERR "dev: %p, dev_priv: %p\n", dev, dev_priv); | 61 | DRM_ERROR("dev: %p, dev_priv: %p\n", dev, dev_priv); |
61 | printk(KERN_ERR "DRM not initialized, aborting suspend.\n"); | 62 | DRM_ERROR("DRM not initialized, aborting suspend.\n"); |
62 | return -ENODEV; | 63 | return -ENODEV; |
63 | } | 64 | } |
64 | 65 | ||
@@ -115,6 +116,10 @@ static int i915_resume(struct drm_device *dev) | |||
115 | 116 | ||
116 | drm_irq_install(dev); | 117 | drm_irq_install(dev); |
117 | } | 118 | } |
119 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
120 | /* Resume the modeset for every activated CRTC */ | ||
121 | drm_helper_resume_force_mode(dev); | ||
122 | } | ||
118 | 123 | ||
119 | return ret; | 124 | return ret; |
120 | } | 125 | } |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index bb4c2d387b6c..d08752875885 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -133,6 +133,22 @@ struct sdvo_device_mapping { | |||
133 | u8 initialized; | 133 | u8 initialized; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | struct drm_i915_error_state { | ||
137 | u32 eir; | ||
138 | u32 pgtbl_er; | ||
139 | u32 pipeastat; | ||
140 | u32 pipebstat; | ||
141 | u32 ipeir; | ||
142 | u32 ipehr; | ||
143 | u32 instdone; | ||
144 | u32 acthd; | ||
145 | u32 instpm; | ||
146 | u32 instps; | ||
147 | u32 instdone1; | ||
148 | u32 seqno; | ||
149 | struct timeval time; | ||
150 | }; | ||
151 | |||
136 | typedef struct drm_i915_private { | 152 | typedef struct drm_i915_private { |
137 | struct drm_device *dev; | 153 | struct drm_device *dev; |
138 | 154 | ||
@@ -209,6 +225,11 @@ typedef struct drm_i915_private { | |||
209 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ | 225 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ |
210 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ | 226 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ |
211 | 227 | ||
228 | unsigned int fsb_freq, mem_freq; | ||
229 | |||
230 | spinlock_t error_lock; | ||
231 | struct drm_i915_error_state *first_error; | ||
232 | |||
212 | /* Register state */ | 233 | /* Register state */ |
213 | u8 saveLBB; | 234 | u8 saveLBB; |
214 | u32 saveDSPACNTR; | 235 | u32 saveDSPACNTR; |
@@ -468,9 +489,6 @@ struct drm_i915_gem_object { | |||
468 | */ | 489 | */ |
469 | int fence_reg; | 490 | int fence_reg; |
470 | 491 | ||
471 | /** Boolean whether this object has a valid gtt offset. */ | ||
472 | int gtt_bound; | ||
473 | |||
474 | /** How many users have pinned this object in GTT space */ | 492 | /** How many users have pinned this object in GTT space */ |
475 | int pin_count; | 493 | int pin_count; |
476 | 494 | ||
@@ -655,6 +673,7 @@ void i915_gem_free_object(struct drm_gem_object *obj); | |||
655 | int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment); | 673 | int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment); |
656 | void i915_gem_object_unpin(struct drm_gem_object *obj); | 674 | void i915_gem_object_unpin(struct drm_gem_object *obj); |
657 | int i915_gem_object_unbind(struct drm_gem_object *obj); | 675 | int i915_gem_object_unbind(struct drm_gem_object *obj); |
676 | void i915_gem_release_mmap(struct drm_gem_object *obj); | ||
658 | void i915_gem_lastclose(struct drm_device *dev); | 677 | void i915_gem_lastclose(struct drm_device *dev); |
659 | uint32_t i915_get_gem_seqno(struct drm_device *dev); | 678 | uint32_t i915_get_gem_seqno(struct drm_device *dev); |
660 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); | 679 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); |
@@ -870,6 +889,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
870 | #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | 889 | #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev)) |
871 | #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | 890 | #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev)) |
872 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_I965G(dev)) | 891 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_I965G(dev)) |
892 | /* dsparb controlled by hw only */ | ||
893 | #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | ||
873 | 894 | ||
874 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) | 895 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) |
875 | 896 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 876b65cb7629..5bf420378b6d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1252,6 +1252,31 @@ out_free_list: | |||
1252 | return ret; | 1252 | return ret; |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | /** | ||
1256 | * i915_gem_release_mmap - remove physical page mappings | ||
1257 | * @obj: obj in question | ||
1258 | * | ||
1259 | * Preserve the reservation of the mmaping with the DRM core code, but | ||
1260 | * relinquish ownership of the pages back to the system. | ||
1261 | * | ||
1262 | * It is vital that we remove the page mapping if we have mapped a tiled | ||
1263 | * object through the GTT and then lose the fence register due to | ||
1264 | * resource pressure. Similarly if the object has been moved out of the | ||
1265 | * aperture, than pages mapped into userspace must be revoked. Removing the | ||
1266 | * mapping will then trigger a page fault on the next user access, allowing | ||
1267 | * fixup by i915_gem_fault(). | ||
1268 | */ | ||
1269 | void | ||
1270 | i915_gem_release_mmap(struct drm_gem_object *obj) | ||
1271 | { | ||
1272 | struct drm_device *dev = obj->dev; | ||
1273 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
1274 | |||
1275 | if (dev->dev_mapping) | ||
1276 | unmap_mapping_range(dev->dev_mapping, | ||
1277 | obj_priv->mmap_offset, obj->size, 1); | ||
1278 | } | ||
1279 | |||
1255 | static void | 1280 | static void |
1256 | i915_gem_free_mmap_offset(struct drm_gem_object *obj) | 1281 | i915_gem_free_mmap_offset(struct drm_gem_object *obj) |
1257 | { | 1282 | { |
@@ -1861,7 +1886,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
1861 | { | 1886 | { |
1862 | struct drm_device *dev = obj->dev; | 1887 | struct drm_device *dev = obj->dev; |
1863 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 1888 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
1864 | loff_t offset; | ||
1865 | int ret = 0; | 1889 | int ret = 0; |
1866 | 1890 | ||
1867 | #if WATCH_BUF | 1891 | #if WATCH_BUF |
@@ -1898,9 +1922,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
1898 | BUG_ON(obj_priv->active); | 1922 | BUG_ON(obj_priv->active); |
1899 | 1923 | ||
1900 | /* blow away mappings if mapped through GTT */ | 1924 | /* blow away mappings if mapped through GTT */ |
1901 | offset = ((loff_t) obj->map_list.hash.key) << PAGE_SHIFT; | 1925 | i915_gem_release_mmap(obj); |
1902 | if (dev->dev_mapping) | ||
1903 | unmap_mapping_range(dev->dev_mapping, offset, obj->size, 1); | ||
1904 | 1926 | ||
1905 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | 1927 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) |
1906 | i915_gem_clear_fence_reg(obj); | 1928 | i915_gem_clear_fence_reg(obj); |
@@ -2222,7 +2244,6 @@ try_again: | |||
2222 | /* None available, try to steal one or wait for a user to finish */ | 2244 | /* None available, try to steal one or wait for a user to finish */ |
2223 | if (i == dev_priv->num_fence_regs) { | 2245 | if (i == dev_priv->num_fence_regs) { |
2224 | uint32_t seqno = dev_priv->mm.next_gem_seqno; | 2246 | uint32_t seqno = dev_priv->mm.next_gem_seqno; |
2225 | loff_t offset; | ||
2226 | 2247 | ||
2227 | if (avail == 0) | 2248 | if (avail == 0) |
2228 | return -ENOSPC; | 2249 | return -ENOSPC; |
@@ -2274,10 +2295,7 @@ try_again: | |||
2274 | * Zap this virtual mapping so we can set up a fence again | 2295 | * Zap this virtual mapping so we can set up a fence again |
2275 | * for this object next time we need it. | 2296 | * for this object next time we need it. |
2276 | */ | 2297 | */ |
2277 | offset = ((loff_t) reg->obj->map_list.hash.key) << PAGE_SHIFT; | 2298 | i915_gem_release_mmap(reg->obj); |
2278 | if (dev->dev_mapping) | ||
2279 | unmap_mapping_range(dev->dev_mapping, offset, | ||
2280 | reg->obj->size, 1); | ||
2281 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; | 2299 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; |
2282 | } | 2300 | } |
2283 | 2301 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c b/drivers/gpu/drm/i915/i915_gem_debugfs.c index 28146e405e87..9a44bfcb8139 100644 --- a/drivers/gpu/drm/i915/i915_gem_debugfs.c +++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c | |||
@@ -75,11 +75,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
75 | case ACTIVE_LIST: | 75 | case ACTIVE_LIST: |
76 | seq_printf(m, "Active:\n"); | 76 | seq_printf(m, "Active:\n"); |
77 | lock = &dev_priv->mm.active_list_lock; | 77 | lock = &dev_priv->mm.active_list_lock; |
78 | spin_lock(lock); | ||
79 | head = &dev_priv->mm.active_list; | 78 | head = &dev_priv->mm.active_list; |
80 | break; | 79 | break; |
81 | case INACTIVE_LIST: | 80 | case INACTIVE_LIST: |
82 | seq_printf(m, "Inctive:\n"); | 81 | seq_printf(m, "Inactive:\n"); |
83 | head = &dev_priv->mm.inactive_list; | 82 | head = &dev_priv->mm.inactive_list; |
84 | break; | 83 | break; |
85 | case FLUSHING_LIST: | 84 | case FLUSHING_LIST: |
@@ -91,6 +90,8 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
91 | return 0; | 90 | return 0; |
92 | } | 91 | } |
93 | 92 | ||
93 | if (lock) | ||
94 | spin_lock(lock); | ||
94 | list_for_each_entry(obj_priv, head, list) | 95 | list_for_each_entry(obj_priv, head, list) |
95 | { | 96 | { |
96 | struct drm_gem_object *obj = obj_priv->obj; | 97 | struct drm_gem_object *obj = obj_priv->obj; |
@@ -104,7 +105,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
104 | if (obj->name) | 105 | if (obj->name) |
105 | seq_printf(m, " (name: %d)", obj->name); | 106 | seq_printf(m, " (name: %d)", obj->name); |
106 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | 107 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) |
107 | seq_printf(m, " (fence: %d)\n", obj_priv->fence_reg); | 108 | seq_printf(m, " (fence: %d)", obj_priv->fence_reg); |
109 | if (obj_priv->gtt_space != NULL) | ||
110 | seq_printf(m, " (gtt_offset: %08x)", obj_priv->gtt_offset); | ||
111 | |||
108 | seq_printf(m, "\n"); | 112 | seq_printf(m, "\n"); |
109 | } | 113 | } |
110 | 114 | ||
@@ -323,6 +327,39 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
323 | return 0; | 327 | return 0; |
324 | } | 328 | } |
325 | 329 | ||
330 | static int i915_error_state(struct seq_file *m, void *unused) | ||
331 | { | ||
332 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
333 | struct drm_device *dev = node->minor->dev; | ||
334 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
335 | struct drm_i915_error_state *error; | ||
336 | unsigned long flags; | ||
337 | |||
338 | spin_lock_irqsave(&dev_priv->error_lock, flags); | ||
339 | if (!dev_priv->first_error) { | ||
340 | seq_printf(m, "no error state collected\n"); | ||
341 | goto out; | ||
342 | } | ||
343 | |||
344 | error = dev_priv->first_error; | ||
345 | |||
346 | seq_printf(m, "EIR: 0x%08x\n", error->eir); | ||
347 | seq_printf(m, " PGTBL_ER: 0x%08x\n", error->pgtbl_er); | ||
348 | seq_printf(m, " INSTPM: 0x%08x\n", error->instpm); | ||
349 | seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir); | ||
350 | seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr); | ||
351 | seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone); | ||
352 | seq_printf(m, " ACTHD: 0x%08x\n", error->acthd); | ||
353 | if (IS_I965G(dev)) { | ||
354 | seq_printf(m, " INSTPS: 0x%08x\n", error->instps); | ||
355 | seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1); | ||
356 | } | ||
357 | |||
358 | out: | ||
359 | spin_unlock_irqrestore(&dev_priv->error_lock, flags); | ||
360 | |||
361 | return 0; | ||
362 | } | ||
326 | 363 | ||
327 | static struct drm_info_list i915_gem_debugfs_list[] = { | 364 | static struct drm_info_list i915_gem_debugfs_list[] = { |
328 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, | 365 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, |
@@ -336,6 +373,7 @@ static struct drm_info_list i915_gem_debugfs_list[] = { | |||
336 | {"i915_ringbuffer_data", i915_ringbuffer_data, 0}, | 373 | {"i915_ringbuffer_data", i915_ringbuffer_data, 0}, |
337 | {"i915_ringbuffer_info", i915_ringbuffer_info, 0}, | 374 | {"i915_ringbuffer_info", i915_ringbuffer_info, 0}, |
338 | {"i915_batchbuffers", i915_batchbuffer_info, 0}, | 375 | {"i915_batchbuffers", i915_batchbuffer_info, 0}, |
376 | {"i915_error_state", i915_error_state, 0}, | ||
339 | }; | 377 | }; |
340 | #define I915_GEM_DEBUGFS_ENTRIES ARRAY_SIZE(i915_gem_debugfs_list) | 378 | #define I915_GEM_DEBUGFS_ENTRIES ARRAY_SIZE(i915_gem_debugfs_list) |
341 | 379 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index daeae62e1c28..a2d527b22ec4 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -521,6 +521,12 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
521 | goto err; | 521 | goto err; |
522 | } | 522 | } |
523 | 523 | ||
524 | /* If we've changed tiling, GTT-mappings of the object | ||
525 | * need to re-fault to ensure that the correct fence register | ||
526 | * setup is in place. | ||
527 | */ | ||
528 | i915_gem_release_mmap(obj); | ||
529 | |||
524 | obj_priv->tiling_mode = args->tiling_mode; | 530 | obj_priv->tiling_mode = args->tiling_mode; |
525 | obj_priv->stride = args->stride; | 531 | obj_priv->stride = args->stride; |
526 | } | 532 | } |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 228546f6eaa4..7ba23a69a0c0 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/sysrq.h> | ||
29 | #include "drmP.h" | 30 | #include "drmP.h" |
30 | #include "drm.h" | 31 | #include "drm.h" |
31 | #include "i915_drm.h" | 32 | #include "i915_drm.h" |
@@ -41,9 +42,10 @@ | |||
41 | * we leave them always unmasked in IMR and then control enabling them through | 42 | * we leave them always unmasked in IMR and then control enabling them through |
42 | * PIPESTAT alone. | 43 | * PIPESTAT alone. |
43 | */ | 44 | */ |
44 | #define I915_INTERRUPT_ENABLE_FIX (I915_ASLE_INTERRUPT | \ | 45 | #define I915_INTERRUPT_ENABLE_FIX (I915_ASLE_INTERRUPT | \ |
45 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | \ | 46 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | \ |
46 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) | 47 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT | \ |
48 | I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT) | ||
47 | 49 | ||
48 | /** Interrupts that we mask and unmask at runtime. */ | 50 | /** Interrupts that we mask and unmask at runtime. */ |
49 | #define I915_INTERRUPT_ENABLE_VAR (I915_USER_INTERRUPT) | 51 | #define I915_INTERRUPT_ENABLE_VAR (I915_USER_INTERRUPT) |
@@ -288,6 +290,47 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev) | |||
288 | return ret; | 290 | return ret; |
289 | } | 291 | } |
290 | 292 | ||
293 | static void i915_capture_error_state(struct drm_device *dev) | ||
294 | { | ||
295 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
296 | struct drm_i915_error_state *error; | ||
297 | unsigned long flags; | ||
298 | |||
299 | spin_lock_irqsave(&dev_priv->error_lock, flags); | ||
300 | if (dev_priv->first_error) | ||
301 | goto out; | ||
302 | |||
303 | error = kmalloc(sizeof(*error), GFP_ATOMIC); | ||
304 | if (!error) { | ||
305 | DRM_DEBUG("out ot memory, not capturing error state\n"); | ||
306 | goto out; | ||
307 | } | ||
308 | |||
309 | error->eir = I915_READ(EIR); | ||
310 | error->pgtbl_er = I915_READ(PGTBL_ER); | ||
311 | error->pipeastat = I915_READ(PIPEASTAT); | ||
312 | error->pipebstat = I915_READ(PIPEBSTAT); | ||
313 | error->instpm = I915_READ(INSTPM); | ||
314 | if (!IS_I965G(dev)) { | ||
315 | error->ipeir = I915_READ(IPEIR); | ||
316 | error->ipehr = I915_READ(IPEHR); | ||
317 | error->instdone = I915_READ(INSTDONE); | ||
318 | error->acthd = I915_READ(ACTHD); | ||
319 | } else { | ||
320 | error->ipeir = I915_READ(IPEIR_I965); | ||
321 | error->ipehr = I915_READ(IPEHR_I965); | ||
322 | error->instdone = I915_READ(INSTDONE_I965); | ||
323 | error->instps = I915_READ(INSTPS); | ||
324 | error->instdone1 = I915_READ(INSTDONE1); | ||
325 | error->acthd = I915_READ(ACTHD_I965); | ||
326 | } | ||
327 | |||
328 | dev_priv->first_error = error; | ||
329 | |||
330 | out: | ||
331 | spin_unlock_irqrestore(&dev_priv->error_lock, flags); | ||
332 | } | ||
333 | |||
291 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 334 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
292 | { | 335 | { |
293 | struct drm_device *dev = (struct drm_device *) arg; | 336 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -333,11 +376,15 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
333 | * Clear the PIPE(A|B)STAT regs before the IIR | 376 | * Clear the PIPE(A|B)STAT regs before the IIR |
334 | */ | 377 | */ |
335 | if (pipea_stats & 0x8000ffff) { | 378 | if (pipea_stats & 0x8000ffff) { |
379 | if (pipea_stats & PIPE_FIFO_UNDERRUN_STATUS) | ||
380 | DRM_DEBUG("pipe a underrun\n"); | ||
336 | I915_WRITE(PIPEASTAT, pipea_stats); | 381 | I915_WRITE(PIPEASTAT, pipea_stats); |
337 | irq_received = 1; | 382 | irq_received = 1; |
338 | } | 383 | } |
339 | 384 | ||
340 | if (pipeb_stats & 0x8000ffff) { | 385 | if (pipeb_stats & 0x8000ffff) { |
386 | if (pipeb_stats & PIPE_FIFO_UNDERRUN_STATUS) | ||
387 | DRM_DEBUG("pipe b underrun\n"); | ||
341 | I915_WRITE(PIPEBSTAT, pipeb_stats); | 388 | I915_WRITE(PIPEBSTAT, pipeb_stats); |
342 | irq_received = 1; | 389 | irq_received = 1; |
343 | } | 390 | } |
@@ -362,6 +409,80 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
362 | I915_READ(PORT_HOTPLUG_STAT); | 409 | I915_READ(PORT_HOTPLUG_STAT); |
363 | } | 410 | } |
364 | 411 | ||
412 | if (iir & I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT) { | ||
413 | u32 eir = I915_READ(EIR); | ||
414 | |||
415 | i915_capture_error_state(dev); | ||
416 | |||
417 | printk(KERN_ERR "render error detected, EIR: 0x%08x\n", | ||
418 | eir); | ||
419 | if (eir & I915_ERROR_PAGE_TABLE) { | ||
420 | u32 pgtbl_err = I915_READ(PGTBL_ER); | ||
421 | printk(KERN_ERR "page table error\n"); | ||
422 | printk(KERN_ERR " PGTBL_ER: 0x%08x\n", | ||
423 | pgtbl_err); | ||
424 | I915_WRITE(PGTBL_ER, pgtbl_err); | ||
425 | (void)I915_READ(PGTBL_ER); | ||
426 | } | ||
427 | if (eir & I915_ERROR_MEMORY_REFRESH) { | ||
428 | printk(KERN_ERR "memory refresh error\n"); | ||
429 | printk(KERN_ERR "PIPEASTAT: 0x%08x\n", | ||
430 | pipea_stats); | ||
431 | printk(KERN_ERR "PIPEBSTAT: 0x%08x\n", | ||
432 | pipeb_stats); | ||
433 | /* pipestat has already been acked */ | ||
434 | } | ||
435 | if (eir & I915_ERROR_INSTRUCTION) { | ||
436 | printk(KERN_ERR "instruction error\n"); | ||
437 | printk(KERN_ERR " INSTPM: 0x%08x\n", | ||
438 | I915_READ(INSTPM)); | ||
439 | if (!IS_I965G(dev)) { | ||
440 | u32 ipeir = I915_READ(IPEIR); | ||
441 | |||
442 | printk(KERN_ERR " IPEIR: 0x%08x\n", | ||
443 | I915_READ(IPEIR)); | ||
444 | printk(KERN_ERR " IPEHR: 0x%08x\n", | ||
445 | I915_READ(IPEHR)); | ||
446 | printk(KERN_ERR " INSTDONE: 0x%08x\n", | ||
447 | I915_READ(INSTDONE)); | ||
448 | printk(KERN_ERR " ACTHD: 0x%08x\n", | ||
449 | I915_READ(ACTHD)); | ||
450 | I915_WRITE(IPEIR, ipeir); | ||
451 | (void)I915_READ(IPEIR); | ||
452 | } else { | ||
453 | u32 ipeir = I915_READ(IPEIR_I965); | ||
454 | |||
455 | printk(KERN_ERR " IPEIR: 0x%08x\n", | ||
456 | I915_READ(IPEIR_I965)); | ||
457 | printk(KERN_ERR " IPEHR: 0x%08x\n", | ||
458 | I915_READ(IPEHR_I965)); | ||
459 | printk(KERN_ERR " INSTDONE: 0x%08x\n", | ||
460 | I915_READ(INSTDONE_I965)); | ||
461 | printk(KERN_ERR " INSTPS: 0x%08x\n", | ||
462 | I915_READ(INSTPS)); | ||
463 | printk(KERN_ERR " INSTDONE1: 0x%08x\n", | ||
464 | I915_READ(INSTDONE1)); | ||
465 | printk(KERN_ERR " ACTHD: 0x%08x\n", | ||
466 | I915_READ(ACTHD_I965)); | ||
467 | I915_WRITE(IPEIR_I965, ipeir); | ||
468 | (void)I915_READ(IPEIR_I965); | ||
469 | } | ||
470 | } | ||
471 | |||
472 | I915_WRITE(EIR, eir); | ||
473 | (void)I915_READ(EIR); | ||
474 | eir = I915_READ(EIR); | ||
475 | if (eir) { | ||
476 | /* | ||
477 | * some errors might have become stuck, | ||
478 | * mask them. | ||
479 | */ | ||
480 | DRM_ERROR("EIR stuck: 0x%08x, masking\n", eir); | ||
481 | I915_WRITE(EMR, I915_READ(EMR) | eir); | ||
482 | I915_WRITE(IIR, I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT); | ||
483 | } | ||
484 | } | ||
485 | |||
365 | I915_WRITE(IIR, iir); | 486 | I915_WRITE(IIR, iir); |
366 | new_iir = I915_READ(IIR); /* Flush posted writes */ | 487 | new_iir = I915_READ(IIR); /* Flush posted writes */ |
367 | 488 | ||
@@ -732,6 +853,7 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
732 | { | 853 | { |
733 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 854 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
734 | u32 enable_mask = I915_INTERRUPT_ENABLE_FIX | I915_INTERRUPT_ENABLE_VAR; | 855 | u32 enable_mask = I915_INTERRUPT_ENABLE_FIX | I915_INTERRUPT_ENABLE_VAR; |
856 | u32 error_mask; | ||
735 | 857 | ||
736 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 858 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
737 | 859 | ||
@@ -768,6 +890,21 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
768 | i915_enable_irq(dev_priv, I915_DISPLAY_PORT_INTERRUPT); | 890 | i915_enable_irq(dev_priv, I915_DISPLAY_PORT_INTERRUPT); |
769 | } | 891 | } |
770 | 892 | ||
893 | /* | ||
894 | * Enable some error detection, note the instruction error mask | ||
895 | * bit is reserved, so we leave it masked. | ||
896 | */ | ||
897 | if (IS_G4X(dev)) { | ||
898 | error_mask = ~(GM45_ERROR_PAGE_TABLE | | ||
899 | GM45_ERROR_MEM_PRIV | | ||
900 | GM45_ERROR_CP_PRIV | | ||
901 | I915_ERROR_MEMORY_REFRESH); | ||
902 | } else { | ||
903 | error_mask = ~(I915_ERROR_PAGE_TABLE | | ||
904 | I915_ERROR_MEMORY_REFRESH); | ||
905 | } | ||
906 | I915_WRITE(EMR, error_mask); | ||
907 | |||
771 | /* Disable pipe interrupt enables, clear pending pipe status */ | 908 | /* Disable pipe interrupt enables, clear pending pipe status */ |
772 | I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); | 909 | I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); |
773 | I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); | 910 | I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 88bf7521405f..6c0858484094 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -206,6 +206,7 @@ | |||
206 | /* | 206 | /* |
207 | * Instruction and interrupt control regs | 207 | * Instruction and interrupt control regs |
208 | */ | 208 | */ |
209 | #define PGTBL_ER 0x02024 | ||
209 | #define PRB0_TAIL 0x02030 | 210 | #define PRB0_TAIL 0x02030 |
210 | #define PRB0_HEAD 0x02034 | 211 | #define PRB0_HEAD 0x02034 |
211 | #define PRB0_START 0x02038 | 212 | #define PRB0_START 0x02038 |
@@ -226,11 +227,18 @@ | |||
226 | #define PRB1_HEAD 0x02044 /* 915+ only */ | 227 | #define PRB1_HEAD 0x02044 /* 915+ only */ |
227 | #define PRB1_START 0x02048 /* 915+ only */ | 228 | #define PRB1_START 0x02048 /* 915+ only */ |
228 | #define PRB1_CTL 0x0204c /* 915+ only */ | 229 | #define PRB1_CTL 0x0204c /* 915+ only */ |
230 | #define IPEIR_I965 0x02064 | ||
231 | #define IPEHR_I965 0x02068 | ||
232 | #define INSTDONE_I965 0x0206c | ||
233 | #define INSTPS 0x02070 /* 965+ only */ | ||
234 | #define INSTDONE1 0x0207c /* 965+ only */ | ||
229 | #define ACTHD_I965 0x02074 | 235 | #define ACTHD_I965 0x02074 |
230 | #define HWS_PGA 0x02080 | 236 | #define HWS_PGA 0x02080 |
231 | #define HWS_ADDRESS_MASK 0xfffff000 | 237 | #define HWS_ADDRESS_MASK 0xfffff000 |
232 | #define HWS_START_ADDRESS_SHIFT 4 | 238 | #define HWS_START_ADDRESS_SHIFT 4 |
233 | #define IPEIR 0x02088 | 239 | #define IPEIR 0x02088 |
240 | #define IPEHR 0x0208c | ||
241 | #define INSTDONE 0x02090 | ||
234 | #define NOPID 0x02094 | 242 | #define NOPID 0x02094 |
235 | #define HWSTAM 0x02098 | 243 | #define HWSTAM 0x02098 |
236 | #define SCPD0 0x0209c /* 915+ only */ | 244 | #define SCPD0 0x0209c /* 915+ only */ |
@@ -258,10 +266,22 @@ | |||
258 | #define EIR 0x020b0 | 266 | #define EIR 0x020b0 |
259 | #define EMR 0x020b4 | 267 | #define EMR 0x020b4 |
260 | #define ESR 0x020b8 | 268 | #define ESR 0x020b8 |
269 | #define GM45_ERROR_PAGE_TABLE (1<<5) | ||
270 | #define GM45_ERROR_MEM_PRIV (1<<4) | ||
271 | #define I915_ERROR_PAGE_TABLE (1<<4) | ||
272 | #define GM45_ERROR_CP_PRIV (1<<3) | ||
273 | #define I915_ERROR_MEMORY_REFRESH (1<<1) | ||
274 | #define I915_ERROR_INSTRUCTION (1<<0) | ||
261 | #define INSTPM 0x020c0 | 275 | #define INSTPM 0x020c0 |
262 | #define ACTHD 0x020c8 | 276 | #define ACTHD 0x020c8 |
263 | #define FW_BLC 0x020d8 | 277 | #define FW_BLC 0x020d8 |
278 | #define FW_BLC2 0x020dc | ||
264 | #define FW_BLC_SELF 0x020e0 /* 915+ only */ | 279 | #define FW_BLC_SELF 0x020e0 /* 915+ only */ |
280 | #define FW_BLC_SELF_EN (1<<15) | ||
281 | #define MM_BURST_LENGTH 0x00700000 | ||
282 | #define MM_FIFO_WATERMARK 0x0001F000 | ||
283 | #define LM_BURST_LENGTH 0x00000700 | ||
284 | #define LM_FIFO_WATERMARK 0x0000001F | ||
265 | #define MI_ARB_STATE 0x020e4 /* 915+ only */ | 285 | #define MI_ARB_STATE 0x020e4 /* 915+ only */ |
266 | #define CACHE_MODE_0 0x02120 /* 915+ only */ | 286 | #define CACHE_MODE_0 0x02120 /* 915+ only */ |
267 | #define CM0_MASK_SHIFT 16 | 287 | #define CM0_MASK_SHIFT 16 |
@@ -571,17 +591,21 @@ | |||
571 | 591 | ||
572 | /* Clocking configuration register */ | 592 | /* Clocking configuration register */ |
573 | #define CLKCFG 0x10c00 | 593 | #define CLKCFG 0x10c00 |
574 | #define CLKCFG_FSB_400 (0 << 0) /* hrawclk 100 */ | 594 | #define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */ |
575 | #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */ | 595 | #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */ |
576 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ | 596 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ |
577 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ | 597 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ |
578 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ | 598 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ |
579 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ | 599 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ |
580 | /* this is a guess, could be 5 as well */ | 600 | /* Note, below two are guess */ |
581 | #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */ | 601 | #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */ |
582 | #define CLKCFG_FSB_1600_ALT (5 << 0) /* hrawclk 400 */ | 602 | #define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */ |
583 | #define CLKCFG_FSB_MASK (7 << 0) | 603 | #define CLKCFG_FSB_MASK (7 << 0) |
584 | 604 | #define CLKCFG_MEM_533 (1 << 4) | |
605 | #define CLKCFG_MEM_667 (2 << 4) | ||
606 | #define CLKCFG_MEM_800 (3 << 4) | ||
607 | #define CLKCFG_MEM_MASK (7 << 4) | ||
608 | |||
585 | /** GM965 GM45 render standby register */ | 609 | /** GM965 GM45 render standby register */ |
586 | #define MCHBAR_RENDER_STANDBY 0x111B8 | 610 | #define MCHBAR_RENDER_STANDBY 0x111B8 |
587 | 611 | ||
@@ -1581,6 +1605,34 @@ | |||
1581 | #define DSPARB_CSTART_SHIFT 7 | 1605 | #define DSPARB_CSTART_SHIFT 7 |
1582 | #define DSPARB_BSTART_MASK (0x7f) | 1606 | #define DSPARB_BSTART_MASK (0x7f) |
1583 | #define DSPARB_BSTART_SHIFT 0 | 1607 | #define DSPARB_BSTART_SHIFT 0 |
1608 | #define DSPARB_BEND_SHIFT 9 /* on 855 */ | ||
1609 | #define DSPARB_AEND_SHIFT 0 | ||
1610 | |||
1611 | #define DSPFW1 0x70034 | ||
1612 | #define DSPFW2 0x70038 | ||
1613 | #define DSPFW3 0x7003c | ||
1614 | #define IGD_SELF_REFRESH_EN (1<<30) | ||
1615 | |||
1616 | /* FIFO watermark sizes etc */ | ||
1617 | #define I915_FIFO_LINE_SIZE 64 | ||
1618 | #define I830_FIFO_LINE_SIZE 32 | ||
1619 | #define I945_FIFO_SIZE 127 /* 945 & 965 */ | ||
1620 | #define I915_FIFO_SIZE 95 | ||
1621 | #define I855GM_FIFO_SIZE 255 | ||
1622 | #define I830_FIFO_SIZE 95 | ||
1623 | #define I915_MAX_WM 0x3f | ||
1624 | |||
1625 | #define IGD_DISPLAY_FIFO 512 /* in 64byte unit */ | ||
1626 | #define IGD_FIFO_LINE_SIZE 64 | ||
1627 | #define IGD_MAX_WM 0x1ff | ||
1628 | #define IGD_DFT_WM 0x3f | ||
1629 | #define IGD_DFT_HPLLOFF_WM 0 | ||
1630 | #define IGD_GUARD_WM 10 | ||
1631 | #define IGD_CURSOR_FIFO 64 | ||
1632 | #define IGD_CURSOR_MAX_WM 0x3f | ||
1633 | #define IGD_CURSOR_DFT_WM 0 | ||
1634 | #define IGD_CURSOR_GUARD_WM 5 | ||
1635 | |||
1584 | /* | 1636 | /* |
1585 | * The two pipe frame counter registers are not synchronized, so | 1637 | * The two pipe frame counter registers are not synchronized, so |
1586 | * reading a stable value is somewhat tricky. The following code | 1638 | * reading a stable value is somewhat tricky. The following code |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 8d8e083d14ab..9e1d16e5c3ea 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -222,23 +222,12 @@ static void i915_restore_vga(struct drm_device *dev) | |||
222 | I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); | 222 | I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); |
223 | } | 223 | } |
224 | 224 | ||
225 | int i915_save_state(struct drm_device *dev) | 225 | static void i915_save_modeset_reg(struct drm_device *dev) |
226 | { | 226 | { |
227 | struct drm_i915_private *dev_priv = dev->dev_private; | 227 | struct drm_i915_private *dev_priv = dev->dev_private; |
228 | int i; | ||
229 | |||
230 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | ||
231 | |||
232 | /* Render Standby */ | ||
233 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
234 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
235 | |||
236 | /* Hardware status page */ | ||
237 | dev_priv->saveHWS = I915_READ(HWS_PGA); | ||
238 | |||
239 | /* Display arbitration control */ | ||
240 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
241 | 228 | ||
229 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
230 | return; | ||
242 | /* Pipe & plane A info */ | 231 | /* Pipe & plane A info */ |
243 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); | 232 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); |
244 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); | 233 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); |
@@ -294,7 +283,122 @@ int i915_save_state(struct drm_device *dev) | |||
294 | } | 283 | } |
295 | i915_save_palette(dev, PIPE_B); | 284 | i915_save_palette(dev, PIPE_B); |
296 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); | 285 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); |
286 | return; | ||
287 | } | ||
288 | static void i915_restore_modeset_reg(struct drm_device *dev) | ||
289 | { | ||
290 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
291 | |||
292 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
293 | return; | ||
294 | |||
295 | /* Pipe & plane A info */ | ||
296 | /* Prime the clock */ | ||
297 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | ||
298 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | ||
299 | ~DPLL_VCO_ENABLE); | ||
300 | DRM_UDELAY(150); | ||
301 | } | ||
302 | I915_WRITE(FPA0, dev_priv->saveFPA0); | ||
303 | I915_WRITE(FPA1, dev_priv->saveFPA1); | ||
304 | /* Actually enable it */ | ||
305 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | ||
306 | DRM_UDELAY(150); | ||
307 | if (IS_I965G(dev)) | ||
308 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | ||
309 | DRM_UDELAY(150); | ||
310 | |||
311 | /* Restore mode */ | ||
312 | I915_WRITE(HTOTAL_A, dev_priv->saveHTOTAL_A); | ||
313 | I915_WRITE(HBLANK_A, dev_priv->saveHBLANK_A); | ||
314 | I915_WRITE(HSYNC_A, dev_priv->saveHSYNC_A); | ||
315 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | ||
316 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | ||
317 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | ||
318 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
319 | |||
320 | /* Restore plane info */ | ||
321 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | ||
322 | I915_WRITE(DSPAPOS, dev_priv->saveDSPAPOS); | ||
323 | I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC); | ||
324 | I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR); | ||
325 | I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE); | ||
326 | if (IS_I965G(dev)) { | ||
327 | I915_WRITE(DSPASURF, dev_priv->saveDSPASURF); | ||
328 | I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); | ||
329 | } | ||
330 | |||
331 | I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF); | ||
332 | |||
333 | i915_restore_palette(dev, PIPE_A); | ||
334 | /* Enable the plane */ | ||
335 | I915_WRITE(DSPACNTR, dev_priv->saveDSPACNTR); | ||
336 | I915_WRITE(DSPAADDR, I915_READ(DSPAADDR)); | ||
337 | |||
338 | /* Pipe & plane B info */ | ||
339 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | ||
340 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | ||
341 | ~DPLL_VCO_ENABLE); | ||
342 | DRM_UDELAY(150); | ||
343 | } | ||
344 | I915_WRITE(FPB0, dev_priv->saveFPB0); | ||
345 | I915_WRITE(FPB1, dev_priv->saveFPB1); | ||
346 | /* Actually enable it */ | ||
347 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | ||
348 | DRM_UDELAY(150); | ||
349 | if (IS_I965G(dev)) | ||
350 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | ||
351 | DRM_UDELAY(150); | ||
352 | |||
353 | /* Restore mode */ | ||
354 | I915_WRITE(HTOTAL_B, dev_priv->saveHTOTAL_B); | ||
355 | I915_WRITE(HBLANK_B, dev_priv->saveHBLANK_B); | ||
356 | I915_WRITE(HSYNC_B, dev_priv->saveHSYNC_B); | ||
357 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | ||
358 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | ||
359 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | ||
360 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
361 | |||
362 | /* Restore plane info */ | ||
363 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | ||
364 | I915_WRITE(DSPBPOS, dev_priv->saveDSPBPOS); | ||
365 | I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC); | ||
366 | I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR); | ||
367 | I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); | ||
368 | if (IS_I965G(dev)) { | ||
369 | I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF); | ||
370 | I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); | ||
371 | } | ||
372 | |||
373 | I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); | ||
374 | |||
375 | i915_restore_palette(dev, PIPE_B); | ||
376 | /* Enable the plane */ | ||
377 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); | ||
378 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); | ||
297 | 379 | ||
380 | return; | ||
381 | } | ||
382 | int i915_save_state(struct drm_device *dev) | ||
383 | { | ||
384 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
385 | int i; | ||
386 | |||
387 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | ||
388 | |||
389 | /* Render Standby */ | ||
390 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
391 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
392 | |||
393 | /* Hardware status page */ | ||
394 | dev_priv->saveHWS = I915_READ(HWS_PGA); | ||
395 | |||
396 | /* Display arbitration control */ | ||
397 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
398 | |||
399 | /* This is only meaningful in non-KMS mode */ | ||
400 | /* Don't save them in KMS mode */ | ||
401 | i915_save_modeset_reg(dev); | ||
298 | /* Cursor state */ | 402 | /* Cursor state */ |
299 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); | 403 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); |
300 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); | 404 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); |
@@ -430,92 +534,9 @@ int i915_restore_state(struct drm_device *dev) | |||
430 | I915_WRITE(PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N); | 534 | I915_WRITE(PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N); |
431 | I915_WRITE(PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N); | 535 | I915_WRITE(PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N); |
432 | } | 536 | } |
433 | 537 | /* This is only meaningful in non-KMS mode */ | |
434 | /* Pipe & plane A info */ | 538 | /* Don't restore them in KMS mode */ |
435 | /* Prime the clock */ | 539 | i915_restore_modeset_reg(dev); |
436 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | ||
437 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | ||
438 | ~DPLL_VCO_ENABLE); | ||
439 | DRM_UDELAY(150); | ||
440 | } | ||
441 | I915_WRITE(FPA0, dev_priv->saveFPA0); | ||
442 | I915_WRITE(FPA1, dev_priv->saveFPA1); | ||
443 | /* Actually enable it */ | ||
444 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | ||
445 | DRM_UDELAY(150); | ||
446 | if (IS_I965G(dev)) | ||
447 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | ||
448 | DRM_UDELAY(150); | ||
449 | |||
450 | /* Restore mode */ | ||
451 | I915_WRITE(HTOTAL_A, dev_priv->saveHTOTAL_A); | ||
452 | I915_WRITE(HBLANK_A, dev_priv->saveHBLANK_A); | ||
453 | I915_WRITE(HSYNC_A, dev_priv->saveHSYNC_A); | ||
454 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | ||
455 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | ||
456 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | ||
457 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
458 | |||
459 | /* Restore plane info */ | ||
460 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | ||
461 | I915_WRITE(DSPAPOS, dev_priv->saveDSPAPOS); | ||
462 | I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC); | ||
463 | I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR); | ||
464 | I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE); | ||
465 | if (IS_I965G(dev)) { | ||
466 | I915_WRITE(DSPASURF, dev_priv->saveDSPASURF); | ||
467 | I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); | ||
468 | } | ||
469 | |||
470 | I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF); | ||
471 | |||
472 | i915_restore_palette(dev, PIPE_A); | ||
473 | /* Enable the plane */ | ||
474 | I915_WRITE(DSPACNTR, dev_priv->saveDSPACNTR); | ||
475 | I915_WRITE(DSPAADDR, I915_READ(DSPAADDR)); | ||
476 | |||
477 | /* Pipe & plane B info */ | ||
478 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | ||
479 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | ||
480 | ~DPLL_VCO_ENABLE); | ||
481 | DRM_UDELAY(150); | ||
482 | } | ||
483 | I915_WRITE(FPB0, dev_priv->saveFPB0); | ||
484 | I915_WRITE(FPB1, dev_priv->saveFPB1); | ||
485 | /* Actually enable it */ | ||
486 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | ||
487 | DRM_UDELAY(150); | ||
488 | if (IS_I965G(dev)) | ||
489 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | ||
490 | DRM_UDELAY(150); | ||
491 | |||
492 | /* Restore mode */ | ||
493 | I915_WRITE(HTOTAL_B, dev_priv->saveHTOTAL_B); | ||
494 | I915_WRITE(HBLANK_B, dev_priv->saveHBLANK_B); | ||
495 | I915_WRITE(HSYNC_B, dev_priv->saveHSYNC_B); | ||
496 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | ||
497 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | ||
498 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | ||
499 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
500 | |||
501 | /* Restore plane info */ | ||
502 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | ||
503 | I915_WRITE(DSPBPOS, dev_priv->saveDSPBPOS); | ||
504 | I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC); | ||
505 | I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR); | ||
506 | I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); | ||
507 | if (IS_I965G(dev)) { | ||
508 | I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF); | ||
509 | I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); | ||
510 | } | ||
511 | |||
512 | I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); | ||
513 | |||
514 | i915_restore_palette(dev, PIPE_B); | ||
515 | /* Enable the plane */ | ||
516 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); | ||
517 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); | ||
518 | |||
519 | /* Cursor state */ | 540 | /* Cursor state */ |
520 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); | 541 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); |
521 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); | 542 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 716409a57244..7cc447191028 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -97,6 +97,7 @@ static void | |||
97 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, | 97 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, |
98 | struct bdb_header *bdb) | 98 | struct bdb_header *bdb) |
99 | { | 99 | { |
100 | struct drm_device *dev = dev_priv->dev; | ||
100 | struct bdb_lvds_options *lvds_options; | 101 | struct bdb_lvds_options *lvds_options; |
101 | struct bdb_lvds_lfp_data *lvds_lfp_data; | 102 | struct bdb_lvds_lfp_data *lvds_lfp_data; |
102 | struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs; | 103 | struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs; |
@@ -132,7 +133,14 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, | |||
132 | entry = (struct bdb_lvds_lfp_data_entry *) | 133 | entry = (struct bdb_lvds_lfp_data_entry *) |
133 | ((uint8_t *)lvds_lfp_data->data + (lfp_data_size * | 134 | ((uint8_t *)lvds_lfp_data->data + (lfp_data_size * |
134 | lvds_options->panel_type)); | 135 | lvds_options->panel_type)); |
135 | dvo_timing = &entry->dvo_timing; | 136 | |
137 | /* On IGDNG mobile, LVDS data block removes panel fitting registers. | ||
138 | So dec 2 dword from dvo_timing offset */ | ||
139 | if (IS_IGDNG(dev)) | ||
140 | dvo_timing = (struct lvds_dvo_timing *) | ||
141 | ((u8 *)&entry->dvo_timing - 8); | ||
142 | else | ||
143 | dvo_timing = &entry->dvo_timing; | ||
136 | 144 | ||
137 | panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); | 145 | panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); |
138 | 146 | ||
@@ -195,10 +203,12 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
195 | dev_priv->lvds_use_ssc = general->enable_ssc; | 203 | dev_priv->lvds_use_ssc = general->enable_ssc; |
196 | 204 | ||
197 | if (dev_priv->lvds_use_ssc) { | 205 | if (dev_priv->lvds_use_ssc) { |
198 | if (IS_I855(dev_priv->dev)) | 206 | if (IS_I85X(dev_priv->dev)) |
199 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48; | 207 | dev_priv->lvds_ssc_freq = |
200 | else | 208 | general->ssc_freq ? 66 : 48; |
201 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96; | 209 | else |
210 | dev_priv->lvds_ssc_freq = | ||
211 | general->ssc_freq ? 100 : 96; | ||
202 | } | 212 | } |
203 | } | 213 | } |
204 | } | 214 | } |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 6de97fc66029..d6a1a6e5539a 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -46,7 +46,7 @@ static void intel_crt_dpms(struct drm_encoder *encoder, int mode) | |||
46 | 46 | ||
47 | temp = I915_READ(reg); | 47 | temp = I915_READ(reg); |
48 | temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); | 48 | temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); |
49 | temp |= ADPA_DAC_ENABLE; | 49 | temp &= ~ADPA_DAC_ENABLE; |
50 | 50 | ||
51 | switch(mode) { | 51 | switch(mode) { |
52 | case DRM_MODE_DPMS_ON: | 52 | case DRM_MODE_DPMS_ON: |
@@ -428,8 +428,34 @@ static void intel_crt_destroy(struct drm_connector *connector) | |||
428 | 428 | ||
429 | static int intel_crt_get_modes(struct drm_connector *connector) | 429 | static int intel_crt_get_modes(struct drm_connector *connector) |
430 | { | 430 | { |
431 | int ret; | ||
431 | struct intel_output *intel_output = to_intel_output(connector); | 432 | struct intel_output *intel_output = to_intel_output(connector); |
432 | return intel_ddc_get_modes(intel_output); | 433 | struct i2c_adapter *ddcbus; |
434 | struct drm_device *dev = connector->dev; | ||
435 | |||
436 | |||
437 | ret = intel_ddc_get_modes(intel_output); | ||
438 | if (ret || !IS_G4X(dev)) | ||
439 | goto end; | ||
440 | |||
441 | ddcbus = intel_output->ddc_bus; | ||
442 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ | ||
443 | intel_output->ddc_bus = | ||
444 | intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D"); | ||
445 | |||
446 | if (!intel_output->ddc_bus) { | ||
447 | intel_output->ddc_bus = ddcbus; | ||
448 | dev_printk(KERN_ERR, &connector->dev->pdev->dev, | ||
449 | "DDC bus registration failed for CRTDDC_D.\n"); | ||
450 | goto end; | ||
451 | } | ||
452 | /* Try to get modes by GPIOD port */ | ||
453 | ret = intel_ddc_get_modes(intel_output); | ||
454 | intel_i2c_destroy(ddcbus); | ||
455 | |||
456 | end: | ||
457 | return ret; | ||
458 | |||
433 | } | 459 | } |
434 | 460 | ||
435 | static int intel_crt_set_property(struct drm_connector *connector, | 461 | static int intel_crt_set_property(struct drm_connector *connector, |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 73e7b9cecac8..508838ee31e0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/kernel.h> | ||
28 | #include "drmP.h" | 29 | #include "drmP.h" |
29 | #include "intel_drv.h" | 30 | #include "intel_drv.h" |
30 | #include "i915_drm.h" | 31 | #include "i915_drm.h" |
@@ -34,6 +35,7 @@ | |||
34 | #include "drm_crtc_helper.h" | 35 | #include "drm_crtc_helper.h" |
35 | 36 | ||
36 | bool intel_pipe_has_type (struct drm_crtc *crtc, int type); | 37 | bool intel_pipe_has_type (struct drm_crtc *crtc, int type); |
38 | static void intel_update_watermarks(struct drm_device *dev); | ||
37 | 39 | ||
38 | typedef struct { | 40 | typedef struct { |
39 | /* given values */ | 41 | /* given values */ |
@@ -814,24 +816,21 @@ intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
814 | { | 816 | { |
815 | intel_clock_t clock; | 817 | intel_clock_t clock; |
816 | if (target < 200000) { | 818 | if (target < 200000) { |
817 | clock.dot = 161670; | ||
818 | clock.p = 20; | ||
819 | clock.p1 = 2; | 819 | clock.p1 = 2; |
820 | clock.p2 = 10; | 820 | clock.p2 = 10; |
821 | clock.n = 0x01; | 821 | clock.n = 2; |
822 | clock.m = 97; | 822 | clock.m1 = 23; |
823 | clock.m1 = 0x10; | 823 | clock.m2 = 8; |
824 | clock.m2 = 0x05; | ||
825 | } else { | 824 | } else { |
826 | clock.dot = 270000; | ||
827 | clock.p = 10; | ||
828 | clock.p1 = 1; | 825 | clock.p1 = 1; |
829 | clock.p2 = 10; | 826 | clock.p2 = 10; |
830 | clock.n = 0x02; | 827 | clock.n = 1; |
831 | clock.m = 108; | 828 | clock.m1 = 14; |
832 | clock.m1 = 0x12; | 829 | clock.m2 = 2; |
833 | clock.m2 = 0x06; | ||
834 | } | 830 | } |
831 | clock.m = 5 * (clock.m1 + 2) + (clock.m2 + 2); | ||
832 | clock.p = (clock.p1 * clock.p2); | ||
833 | clock.dot = 96000 * clock.m / (clock.n + 2) / clock.p; | ||
835 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); | 834 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); |
836 | return true; | 835 | return true; |
837 | } | 836 | } |
@@ -1005,7 +1004,7 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1005 | struct drm_i915_private *dev_priv = dev->dev_private; | 1004 | struct drm_i915_private *dev_priv = dev->dev_private; |
1006 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 1005 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
1007 | int pipe = intel_crtc->pipe; | 1006 | int pipe = intel_crtc->pipe; |
1008 | int plane = intel_crtc->pipe; | 1007 | int plane = intel_crtc->plane; |
1009 | int pch_dpll_reg = (pipe == 0) ? PCH_DPLL_A : PCH_DPLL_B; | 1008 | int pch_dpll_reg = (pipe == 0) ? PCH_DPLL_A : PCH_DPLL_B; |
1010 | int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; | 1009 | int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; |
1011 | int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; | 1010 | int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; |
@@ -1335,8 +1334,10 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1335 | 1334 | ||
1336 | /* Give the overlay scaler a chance to enable if it's on this pipe */ | 1335 | /* Give the overlay scaler a chance to enable if it's on this pipe */ |
1337 | //intel_crtc_dpms_video(crtc, true); TODO | 1336 | //intel_crtc_dpms_video(crtc, true); TODO |
1337 | intel_update_watermarks(dev); | ||
1338 | break; | 1338 | break; |
1339 | case DRM_MODE_DPMS_OFF: | 1339 | case DRM_MODE_DPMS_OFF: |
1340 | intel_update_watermarks(dev); | ||
1340 | /* Give the overlay scaler a chance to disable if it's on this pipe */ | 1341 | /* Give the overlay scaler a chance to disable if it's on this pipe */ |
1341 | //intel_crtc_dpms_video(crtc, FALSE); TODO | 1342 | //intel_crtc_dpms_video(crtc, FALSE); TODO |
1342 | 1343 | ||
@@ -1515,7 +1516,6 @@ static int intel_get_core_clock_speed(struct drm_device *dev) | |||
1515 | return 0; /* Silence gcc warning */ | 1516 | return 0; /* Silence gcc warning */ |
1516 | } | 1517 | } |
1517 | 1518 | ||
1518 | |||
1519 | /** | 1519 | /** |
1520 | * Return the pipe currently connected to the panel fitter, | 1520 | * Return the pipe currently connected to the panel fitter, |
1521 | * or -1 if the panel fitter is not present or not in use | 1521 | * or -1 if the panel fitter is not present or not in use |
@@ -1574,7 +1574,7 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes, | |||
1574 | 1574 | ||
1575 | temp = (u64) DATA_N * pixel_clock; | 1575 | temp = (u64) DATA_N * pixel_clock; |
1576 | temp = div_u64(temp, link_clock); | 1576 | temp = div_u64(temp, link_clock); |
1577 | m_n->gmch_m = (temp * bytes_per_pixel) / nlanes; | 1577 | m_n->gmch_m = div_u64(temp * bytes_per_pixel, nlanes); |
1578 | m_n->gmch_n = DATA_N; | 1578 | m_n->gmch_n = DATA_N; |
1579 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); | 1579 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); |
1580 | 1580 | ||
@@ -1585,6 +1585,420 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes, | |||
1585 | } | 1585 | } |
1586 | 1586 | ||
1587 | 1587 | ||
1588 | struct intel_watermark_params { | ||
1589 | unsigned long fifo_size; | ||
1590 | unsigned long max_wm; | ||
1591 | unsigned long default_wm; | ||
1592 | unsigned long guard_size; | ||
1593 | unsigned long cacheline_size; | ||
1594 | }; | ||
1595 | |||
1596 | /* IGD has different values for various configs */ | ||
1597 | static struct intel_watermark_params igd_display_wm = { | ||
1598 | IGD_DISPLAY_FIFO, | ||
1599 | IGD_MAX_WM, | ||
1600 | IGD_DFT_WM, | ||
1601 | IGD_GUARD_WM, | ||
1602 | IGD_FIFO_LINE_SIZE | ||
1603 | }; | ||
1604 | static struct intel_watermark_params igd_display_hplloff_wm = { | ||
1605 | IGD_DISPLAY_FIFO, | ||
1606 | IGD_MAX_WM, | ||
1607 | IGD_DFT_HPLLOFF_WM, | ||
1608 | IGD_GUARD_WM, | ||
1609 | IGD_FIFO_LINE_SIZE | ||
1610 | }; | ||
1611 | static struct intel_watermark_params igd_cursor_wm = { | ||
1612 | IGD_CURSOR_FIFO, | ||
1613 | IGD_CURSOR_MAX_WM, | ||
1614 | IGD_CURSOR_DFT_WM, | ||
1615 | IGD_CURSOR_GUARD_WM, | ||
1616 | IGD_FIFO_LINE_SIZE, | ||
1617 | }; | ||
1618 | static struct intel_watermark_params igd_cursor_hplloff_wm = { | ||
1619 | IGD_CURSOR_FIFO, | ||
1620 | IGD_CURSOR_MAX_WM, | ||
1621 | IGD_CURSOR_DFT_WM, | ||
1622 | IGD_CURSOR_GUARD_WM, | ||
1623 | IGD_FIFO_LINE_SIZE | ||
1624 | }; | ||
1625 | static struct intel_watermark_params i945_wm_info = { | ||
1626 | I915_FIFO_LINE_SIZE, | ||
1627 | I915_MAX_WM, | ||
1628 | 1, | ||
1629 | 0, | ||
1630 | IGD_FIFO_LINE_SIZE | ||
1631 | }; | ||
1632 | static struct intel_watermark_params i915_wm_info = { | ||
1633 | I945_FIFO_SIZE, | ||
1634 | I915_MAX_WM, | ||
1635 | 1, | ||
1636 | 0, | ||
1637 | I915_FIFO_LINE_SIZE | ||
1638 | }; | ||
1639 | static struct intel_watermark_params i855_wm_info = { | ||
1640 | I855GM_FIFO_SIZE, | ||
1641 | I915_MAX_WM, | ||
1642 | 1, | ||
1643 | 0, | ||
1644 | I830_FIFO_LINE_SIZE | ||
1645 | }; | ||
1646 | static struct intel_watermark_params i830_wm_info = { | ||
1647 | I830_FIFO_SIZE, | ||
1648 | I915_MAX_WM, | ||
1649 | 1, | ||
1650 | 0, | ||
1651 | I830_FIFO_LINE_SIZE | ||
1652 | }; | ||
1653 | |||
1654 | static unsigned long intel_calculate_wm(unsigned long clock_in_khz, | ||
1655 | struct intel_watermark_params *wm, | ||
1656 | int pixel_size, | ||
1657 | unsigned long latency_ns) | ||
1658 | { | ||
1659 | unsigned long bytes_required, wm_size; | ||
1660 | |||
1661 | bytes_required = (clock_in_khz * pixel_size * latency_ns) / 1000000; | ||
1662 | bytes_required /= wm->cacheline_size; | ||
1663 | wm_size = wm->fifo_size - bytes_required - wm->guard_size; | ||
1664 | |||
1665 | if (wm_size > wm->max_wm) | ||
1666 | wm_size = wm->max_wm; | ||
1667 | if (wm_size == 0) | ||
1668 | wm_size = wm->default_wm; | ||
1669 | return wm_size; | ||
1670 | } | ||
1671 | |||
1672 | struct cxsr_latency { | ||
1673 | int is_desktop; | ||
1674 | unsigned long fsb_freq; | ||
1675 | unsigned long mem_freq; | ||
1676 | unsigned long display_sr; | ||
1677 | unsigned long display_hpll_disable; | ||
1678 | unsigned long cursor_sr; | ||
1679 | unsigned long cursor_hpll_disable; | ||
1680 | }; | ||
1681 | |||
1682 | static struct cxsr_latency cxsr_latency_table[] = { | ||
1683 | {1, 800, 400, 3382, 33382, 3983, 33983}, /* DDR2-400 SC */ | ||
1684 | {1, 800, 667, 3354, 33354, 3807, 33807}, /* DDR2-667 SC */ | ||
1685 | {1, 800, 800, 3347, 33347, 3763, 33763}, /* DDR2-800 SC */ | ||
1686 | |||
1687 | {1, 667, 400, 3400, 33400, 4021, 34021}, /* DDR2-400 SC */ | ||
1688 | {1, 667, 667, 3372, 33372, 3845, 33845}, /* DDR2-667 SC */ | ||
1689 | {1, 667, 800, 3386, 33386, 3822, 33822}, /* DDR2-800 SC */ | ||
1690 | |||
1691 | {1, 400, 400, 3472, 33472, 4173, 34173}, /* DDR2-400 SC */ | ||
1692 | {1, 400, 667, 3443, 33443, 3996, 33996}, /* DDR2-667 SC */ | ||
1693 | {1, 400, 800, 3430, 33430, 3946, 33946}, /* DDR2-800 SC */ | ||
1694 | |||
1695 | {0, 800, 400, 3438, 33438, 4065, 34065}, /* DDR2-400 SC */ | ||
1696 | {0, 800, 667, 3410, 33410, 3889, 33889}, /* DDR2-667 SC */ | ||
1697 | {0, 800, 800, 3403, 33403, 3845, 33845}, /* DDR2-800 SC */ | ||
1698 | |||
1699 | {0, 667, 400, 3456, 33456, 4103, 34106}, /* DDR2-400 SC */ | ||
1700 | {0, 667, 667, 3428, 33428, 3927, 33927}, /* DDR2-667 SC */ | ||
1701 | {0, 667, 800, 3443, 33443, 3905, 33905}, /* DDR2-800 SC */ | ||
1702 | |||
1703 | {0, 400, 400, 3528, 33528, 4255, 34255}, /* DDR2-400 SC */ | ||
1704 | {0, 400, 667, 3500, 33500, 4079, 34079}, /* DDR2-667 SC */ | ||
1705 | {0, 400, 800, 3487, 33487, 4029, 34029}, /* DDR2-800 SC */ | ||
1706 | }; | ||
1707 | |||
1708 | static struct cxsr_latency *intel_get_cxsr_latency(int is_desktop, int fsb, | ||
1709 | int mem) | ||
1710 | { | ||
1711 | int i; | ||
1712 | struct cxsr_latency *latency; | ||
1713 | |||
1714 | if (fsb == 0 || mem == 0) | ||
1715 | return NULL; | ||
1716 | |||
1717 | for (i = 0; i < ARRAY_SIZE(cxsr_latency_table); i++) { | ||
1718 | latency = &cxsr_latency_table[i]; | ||
1719 | if (is_desktop == latency->is_desktop && | ||
1720 | fsb == latency->fsb_freq && mem == latency->mem_freq) | ||
1721 | break; | ||
1722 | } | ||
1723 | if (i >= ARRAY_SIZE(cxsr_latency_table)) { | ||
1724 | DRM_DEBUG("Unknown FSB/MEM found, disable CxSR\n"); | ||
1725 | return NULL; | ||
1726 | } | ||
1727 | return latency; | ||
1728 | } | ||
1729 | |||
1730 | static void igd_disable_cxsr(struct drm_device *dev) | ||
1731 | { | ||
1732 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1733 | u32 reg; | ||
1734 | |||
1735 | /* deactivate cxsr */ | ||
1736 | reg = I915_READ(DSPFW3); | ||
1737 | reg &= ~(IGD_SELF_REFRESH_EN); | ||
1738 | I915_WRITE(DSPFW3, reg); | ||
1739 | DRM_INFO("Big FIFO is disabled\n"); | ||
1740 | } | ||
1741 | |||
1742 | static void igd_enable_cxsr(struct drm_device *dev, unsigned long clock, | ||
1743 | int pixel_size) | ||
1744 | { | ||
1745 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1746 | u32 reg; | ||
1747 | unsigned long wm; | ||
1748 | struct cxsr_latency *latency; | ||
1749 | |||
1750 | latency = intel_get_cxsr_latency(IS_IGDG(dev), dev_priv->fsb_freq, | ||
1751 | dev_priv->mem_freq); | ||
1752 | if (!latency) { | ||
1753 | DRM_DEBUG("Unknown FSB/MEM found, disable CxSR\n"); | ||
1754 | igd_disable_cxsr(dev); | ||
1755 | return; | ||
1756 | } | ||
1757 | |||
1758 | /* Display SR */ | ||
1759 | wm = intel_calculate_wm(clock, &igd_display_wm, pixel_size, | ||
1760 | latency->display_sr); | ||
1761 | reg = I915_READ(DSPFW1); | ||
1762 | reg &= 0x7fffff; | ||
1763 | reg |= wm << 23; | ||
1764 | I915_WRITE(DSPFW1, reg); | ||
1765 | DRM_DEBUG("DSPFW1 register is %x\n", reg); | ||
1766 | |||
1767 | /* cursor SR */ | ||
1768 | wm = intel_calculate_wm(clock, &igd_cursor_wm, pixel_size, | ||
1769 | latency->cursor_sr); | ||
1770 | reg = I915_READ(DSPFW3); | ||
1771 | reg &= ~(0x3f << 24); | ||
1772 | reg |= (wm & 0x3f) << 24; | ||
1773 | I915_WRITE(DSPFW3, reg); | ||
1774 | |||
1775 | /* Display HPLL off SR */ | ||
1776 | wm = intel_calculate_wm(clock, &igd_display_hplloff_wm, | ||
1777 | latency->display_hpll_disable, I915_FIFO_LINE_SIZE); | ||
1778 | reg = I915_READ(DSPFW3); | ||
1779 | reg &= 0xfffffe00; | ||
1780 | reg |= wm & 0x1ff; | ||
1781 | I915_WRITE(DSPFW3, reg); | ||
1782 | |||
1783 | /* cursor HPLL off SR */ | ||
1784 | wm = intel_calculate_wm(clock, &igd_cursor_hplloff_wm, pixel_size, | ||
1785 | latency->cursor_hpll_disable); | ||
1786 | reg = I915_READ(DSPFW3); | ||
1787 | reg &= ~(0x3f << 16); | ||
1788 | reg |= (wm & 0x3f) << 16; | ||
1789 | I915_WRITE(DSPFW3, reg); | ||
1790 | DRM_DEBUG("DSPFW3 register is %x\n", reg); | ||
1791 | |||
1792 | /* activate cxsr */ | ||
1793 | reg = I915_READ(DSPFW3); | ||
1794 | reg |= IGD_SELF_REFRESH_EN; | ||
1795 | I915_WRITE(DSPFW3, reg); | ||
1796 | |||
1797 | DRM_INFO("Big FIFO is enabled\n"); | ||
1798 | |||
1799 | return; | ||
1800 | } | ||
1801 | |||
1802 | const static int latency_ns = 5000; /* default for non-igd platforms */ | ||
1803 | |||
1804 | |||
1805 | static void i965_update_wm(struct drm_device *dev) | ||
1806 | { | ||
1807 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1808 | |||
1809 | DRM_DEBUG("Setting FIFO watermarks - A: 8, B: 8, C: 8, SR 8\n"); | ||
1810 | |||
1811 | /* 965 has limitations... */ | ||
1812 | I915_WRITE(DSPFW1, (8 << 16) | (8 << 8) | (8 << 0)); | ||
1813 | I915_WRITE(DSPFW2, (8 << 8) | (8 << 0)); | ||
1814 | } | ||
1815 | |||
1816 | static void i9xx_update_wm(struct drm_device *dev, int planea_clock, | ||
1817 | int planeb_clock, int sr_hdisplay, int pixel_size) | ||
1818 | { | ||
1819 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1820 | uint32_t fwater_lo = I915_READ(FW_BLC) & MM_FIFO_WATERMARK; | ||
1821 | uint32_t fwater_hi = I915_READ(FW_BLC2) & LM_FIFO_WATERMARK; | ||
1822 | int bsize, asize, cwm, bwm = 1, awm = 1, srwm = 1; | ||
1823 | uint32_t dsparb = I915_READ(DSPARB); | ||
1824 | int planea_entries, planeb_entries; | ||
1825 | struct intel_watermark_params *wm_params; | ||
1826 | unsigned long line_time_us; | ||
1827 | int sr_clock, sr_entries = 0; | ||
1828 | |||
1829 | if (IS_I965GM(dev) || IS_I945GM(dev)) | ||
1830 | wm_params = &i945_wm_info; | ||
1831 | else if (IS_I9XX(dev)) | ||
1832 | wm_params = &i915_wm_info; | ||
1833 | else | ||
1834 | wm_params = &i855_wm_info; | ||
1835 | |||
1836 | planea_entries = intel_calculate_wm(planea_clock, wm_params, | ||
1837 | pixel_size, latency_ns); | ||
1838 | planeb_entries = intel_calculate_wm(planeb_clock, wm_params, | ||
1839 | pixel_size, latency_ns); | ||
1840 | |||
1841 | DRM_DEBUG("FIFO entries - A: %d, B: %d\n", planea_entries, | ||
1842 | planeb_entries); | ||
1843 | |||
1844 | if (IS_I9XX(dev)) { | ||
1845 | asize = dsparb & 0x7f; | ||
1846 | bsize = (dsparb >> DSPARB_CSTART_SHIFT) & 0x7f; | ||
1847 | } else { | ||
1848 | asize = dsparb & 0x1ff; | ||
1849 | bsize = (dsparb >> DSPARB_BEND_SHIFT) & 0x1ff; | ||
1850 | } | ||
1851 | DRM_DEBUG("FIFO size - A: %d, B: %d\n", asize, bsize); | ||
1852 | |||
1853 | /* Two extra entries for padding */ | ||
1854 | awm = asize - (planea_entries + 2); | ||
1855 | bwm = bsize - (planeb_entries + 2); | ||
1856 | |||
1857 | /* Sanity check against potentially bad FIFO allocations */ | ||
1858 | if (awm <= 0) { | ||
1859 | /* pipe is on but has too few FIFO entries */ | ||
1860 | if (planea_entries != 0) | ||
1861 | DRM_DEBUG("plane A needs more FIFO entries\n"); | ||
1862 | awm = 1; | ||
1863 | } | ||
1864 | if (bwm <= 0) { | ||
1865 | if (planeb_entries != 0) | ||
1866 | DRM_DEBUG("plane B needs more FIFO entries\n"); | ||
1867 | bwm = 1; | ||
1868 | } | ||
1869 | |||
1870 | /* | ||
1871 | * Overlay gets an aggressive default since video jitter is bad. | ||
1872 | */ | ||
1873 | cwm = 2; | ||
1874 | |||
1875 | /* Calc sr entries for one pipe configs */ | ||
1876 | if (!planea_clock || !planeb_clock) { | ||
1877 | sr_clock = planea_clock ? planea_clock : planeb_clock; | ||
1878 | line_time_us = (sr_hdisplay * 1000) / sr_clock; | ||
1879 | sr_entries = (((latency_ns / line_time_us) + 1) * pixel_size * | ||
1880 | sr_hdisplay) / 1000; | ||
1881 | sr_entries = roundup(sr_entries / wm_params->cacheline_size, 1); | ||
1882 | if (sr_entries < wm_params->fifo_size) | ||
1883 | srwm = wm_params->fifo_size - sr_entries; | ||
1884 | } | ||
1885 | |||
1886 | DRM_DEBUG("Setting FIFO watermarks - A: %d, B: %d, C: %d, SR %d\n", | ||
1887 | awm, bwm, cwm, srwm); | ||
1888 | |||
1889 | fwater_lo = fwater_lo | ((bwm & 0x3f) << 16) | (awm & 0x3f); | ||
1890 | fwater_hi = fwater_hi | (cwm & 0x1f); | ||
1891 | |||
1892 | I915_WRITE(FW_BLC, fwater_lo); | ||
1893 | I915_WRITE(FW_BLC2, fwater_hi); | ||
1894 | if (IS_I9XX(dev)) | ||
1895 | I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN | (srwm & 0x3f)); | ||
1896 | } | ||
1897 | |||
1898 | static void i830_update_wm(struct drm_device *dev, int planea_clock, | ||
1899 | int pixel_size) | ||
1900 | { | ||
1901 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1902 | uint32_t dsparb = I915_READ(DSPARB); | ||
1903 | uint32_t fwater_lo = I915_READ(FW_BLC) & MM_FIFO_WATERMARK; | ||
1904 | unsigned int asize, awm; | ||
1905 | int planea_entries; | ||
1906 | |||
1907 | planea_entries = intel_calculate_wm(planea_clock, &i830_wm_info, | ||
1908 | pixel_size, latency_ns); | ||
1909 | |||
1910 | asize = dsparb & 0x7f; | ||
1911 | |||
1912 | awm = asize - planea_entries; | ||
1913 | |||
1914 | fwater_lo = fwater_lo | awm; | ||
1915 | |||
1916 | I915_WRITE(FW_BLC, fwater_lo); | ||
1917 | } | ||
1918 | |||
1919 | /** | ||
1920 | * intel_update_watermarks - update FIFO watermark values based on current modes | ||
1921 | * | ||
1922 | * Calculate watermark values for the various WM regs based on current mode | ||
1923 | * and plane configuration. | ||
1924 | * | ||
1925 | * There are several cases to deal with here: | ||
1926 | * - normal (i.e. non-self-refresh) | ||
1927 | * - self-refresh (SR) mode | ||
1928 | * - lines are large relative to FIFO size (buffer can hold up to 2) | ||
1929 | * - lines are small relative to FIFO size (buffer can hold more than 2 | ||
1930 | * lines), so need to account for TLB latency | ||
1931 | * | ||
1932 | * The normal calculation is: | ||
1933 | * watermark = dotclock * bytes per pixel * latency | ||
1934 | * where latency is platform & configuration dependent (we assume pessimal | ||
1935 | * values here). | ||
1936 | * | ||
1937 | * The SR calculation is: | ||
1938 | * watermark = (trunc(latency/line time)+1) * surface width * | ||
1939 | * bytes per pixel | ||
1940 | * where | ||
1941 | * line time = htotal / dotclock | ||
1942 | * and latency is assumed to be high, as above. | ||
1943 | * | ||
1944 | * The final value programmed to the register should always be rounded up, | ||
1945 | * and include an extra 2 entries to account for clock crossings. | ||
1946 | * | ||
1947 | * We don't use the sprite, so we can ignore that. And on Crestline we have | ||
1948 | * to set the non-SR watermarks to 8. | ||
1949 | */ | ||
1950 | static void intel_update_watermarks(struct drm_device *dev) | ||
1951 | { | ||
1952 | struct drm_crtc *crtc; | ||
1953 | struct intel_crtc *intel_crtc; | ||
1954 | int sr_hdisplay = 0; | ||
1955 | unsigned long planea_clock = 0, planeb_clock = 0, sr_clock = 0; | ||
1956 | int enabled = 0, pixel_size = 0; | ||
1957 | |||
1958 | if (DSPARB_HWCONTROL(dev)) | ||
1959 | return; | ||
1960 | |||
1961 | /* Get the clock config from both planes */ | ||
1962 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
1963 | intel_crtc = to_intel_crtc(crtc); | ||
1964 | if (crtc->enabled) { | ||
1965 | enabled++; | ||
1966 | if (intel_crtc->plane == 0) { | ||
1967 | DRM_DEBUG("plane A (pipe %d) clock: %d\n", | ||
1968 | intel_crtc->pipe, crtc->mode.clock); | ||
1969 | planea_clock = crtc->mode.clock; | ||
1970 | } else { | ||
1971 | DRM_DEBUG("plane B (pipe %d) clock: %d\n", | ||
1972 | intel_crtc->pipe, crtc->mode.clock); | ||
1973 | planeb_clock = crtc->mode.clock; | ||
1974 | } | ||
1975 | sr_hdisplay = crtc->mode.hdisplay; | ||
1976 | sr_clock = crtc->mode.clock; | ||
1977 | if (crtc->fb) | ||
1978 | pixel_size = crtc->fb->bits_per_pixel / 8; | ||
1979 | else | ||
1980 | pixel_size = 4; /* by default */ | ||
1981 | } | ||
1982 | } | ||
1983 | |||
1984 | if (enabled <= 0) | ||
1985 | return; | ||
1986 | |||
1987 | /* Single pipe configs can enable self refresh */ | ||
1988 | if (enabled == 1 && IS_IGD(dev)) | ||
1989 | igd_enable_cxsr(dev, sr_clock, pixel_size); | ||
1990 | else if (IS_IGD(dev)) | ||
1991 | igd_disable_cxsr(dev); | ||
1992 | |||
1993 | if (IS_I965G(dev)) | ||
1994 | i965_update_wm(dev); | ||
1995 | else if (IS_I9XX(dev) || IS_MOBILE(dev)) | ||
1996 | i9xx_update_wm(dev, planea_clock, planeb_clock, sr_hdisplay, | ||
1997 | pixel_size); | ||
1998 | else | ||
1999 | i830_update_wm(dev, planea_clock, pixel_size); | ||
2000 | } | ||
2001 | |||
1588 | static int intel_crtc_mode_set(struct drm_crtc *crtc, | 2002 | static int intel_crtc_mode_set(struct drm_crtc *crtc, |
1589 | struct drm_display_mode *mode, | 2003 | struct drm_display_mode *mode, |
1590 | struct drm_display_mode *adjusted_mode, | 2004 | struct drm_display_mode *adjusted_mode, |
@@ -1951,6 +2365,9 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
1951 | 2365 | ||
1952 | /* Flush the plane changes */ | 2366 | /* Flush the plane changes */ |
1953 | ret = intel_pipe_set_base(crtc, x, y, old_fb); | 2367 | ret = intel_pipe_set_base(crtc, x, y, old_fb); |
2368 | |||
2369 | intel_update_watermarks(dev); | ||
2370 | |||
1954 | drm_vblank_post_modeset(dev, pipe); | 2371 | drm_vblank_post_modeset(dev, pipe); |
1955 | 2372 | ||
1956 | return ret; | 2373 | return ret; |
@@ -2439,6 +2856,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
2439 | 2856 | ||
2440 | drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256); | 2857 | drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256); |
2441 | intel_crtc->pipe = pipe; | 2858 | intel_crtc->pipe = pipe; |
2859 | intel_crtc->plane = pipe; | ||
2442 | for (i = 0; i < 256; i++) { | 2860 | for (i = 0; i < 256; i++) { |
2443 | intel_crtc->lut_r[i] = i; | 2861 | intel_crtc->lut_r[i] = i; |
2444 | intel_crtc->lut_g[i] = i; | 2862 | intel_crtc->lut_g[i] = i; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 8f8d37d5663a..6770ae88370d 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -246,7 +246,7 @@ intel_dp_aux_ch(struct intel_output *intel_output, | |||
246 | } | 246 | } |
247 | 247 | ||
248 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { | 248 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { |
249 | printk(KERN_ERR "dp_aux_ch not done status 0x%08x\n", status); | 249 | DRM_ERROR("dp_aux_ch not done status 0x%08x\n", status); |
250 | return -EBUSY; | 250 | return -EBUSY; |
251 | } | 251 | } |
252 | 252 | ||
@@ -254,11 +254,14 @@ intel_dp_aux_ch(struct intel_output *intel_output, | |||
254 | * Timeouts occur when the sink is not connected | 254 | * Timeouts occur when the sink is not connected |
255 | */ | 255 | */ |
256 | if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { | 256 | if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { |
257 | printk(KERN_ERR "dp_aux_ch receive error status 0x%08x\n", status); | 257 | DRM_ERROR("dp_aux_ch receive error status 0x%08x\n", status); |
258 | return -EIO; | 258 | return -EIO; |
259 | } | 259 | } |
260 | |||
261 | /* Timeouts occur when the device isn't connected, so they're | ||
262 | * "normal" -- don't fill the kernel log with these */ | ||
260 | if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { | 263 | if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { |
261 | printk(KERN_ERR "dp_aux_ch timeout status 0x%08x\n", status); | 264 | DRM_DEBUG("dp_aux_ch timeout status 0x%08x\n", status); |
262 | return -ETIMEDOUT; | 265 | return -ETIMEDOUT; |
263 | } | 266 | } |
264 | 267 | ||
@@ -411,7 +414,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
411 | dp_priv->link_bw = bws[clock]; | 414 | dp_priv->link_bw = bws[clock]; |
412 | dp_priv->lane_count = lane_count; | 415 | dp_priv->lane_count = lane_count; |
413 | adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw); | 416 | adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw); |
414 | printk(KERN_ERR "link bw %02x lane count %d clock %d\n", | 417 | DRM_DEBUG("Display port link bw %02x lane count %d clock %d\n", |
415 | dp_priv->link_bw, dp_priv->lane_count, | 418 | dp_priv->link_bw, dp_priv->lane_count, |
416 | adjusted_mode->clock); | 419 | adjusted_mode->clock); |
417 | return true; | 420 | return true; |
diff --git a/drivers/gpu/drm/i915/intel_dp_i2c.c b/drivers/gpu/drm/i915/intel_dp_i2c.c index 4e60f14b1a6d..a63b6f57d2d4 100644 --- a/drivers/gpu/drm/i915/intel_dp_i2c.c +++ b/drivers/gpu/drm/i915/intel_dp_i2c.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/i2c.h> | 30 | #include <linux/i2c.h> |
31 | #include "intel_dp.h" | 31 | #include "intel_dp.h" |
32 | #include "drmP.h" | ||
32 | 33 | ||
33 | /* Run a single AUX_CH I2C transaction, writing/reading data as necessary */ | 34 | /* Run a single AUX_CH I2C transaction, writing/reading data as necessary */ |
34 | 35 | ||
@@ -84,7 +85,7 @@ i2c_algo_dp_aux_transaction(struct i2c_adapter *adapter, int mode, | |||
84 | msg, msg_bytes, | 85 | msg, msg_bytes, |
85 | reply, reply_bytes); | 86 | reply, reply_bytes); |
86 | if (ret < 0) { | 87 | if (ret < 0) { |
87 | printk(KERN_ERR "aux_ch failed %d\n", ret); | 88 | DRM_DEBUG("aux_ch failed %d\n", ret); |
88 | return ret; | 89 | return ret; |
89 | } | 90 | } |
90 | switch (reply[0] & AUX_I2C_REPLY_MASK) { | 91 | switch (reply[0] & AUX_I2C_REPLY_MASK) { |
@@ -94,14 +95,14 @@ i2c_algo_dp_aux_transaction(struct i2c_adapter *adapter, int mode, | |||
94 | } | 95 | } |
95 | return reply_bytes - 1; | 96 | return reply_bytes - 1; |
96 | case AUX_I2C_REPLY_NACK: | 97 | case AUX_I2C_REPLY_NACK: |
97 | printk(KERN_ERR "aux_ch nack\n"); | 98 | DRM_DEBUG("aux_ch nack\n"); |
98 | return -EREMOTEIO; | 99 | return -EREMOTEIO; |
99 | case AUX_I2C_REPLY_DEFER: | 100 | case AUX_I2C_REPLY_DEFER: |
100 | printk(KERN_ERR "aux_ch defer\n"); | 101 | DRM_DEBUG("aux_ch defer\n"); |
101 | udelay(100); | 102 | udelay(100); |
102 | break; | 103 | break; |
103 | default: | 104 | default: |
104 | printk(KERN_ERR "aux_ch invalid reply 0x%02x\n", reply[0]); | 105 | DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); |
105 | return -EREMOTEIO; | 106 | return -EREMOTEIO; |
106 | } | 107 | } |
107 | } | 108 | } |
@@ -223,7 +224,7 @@ i2c_algo_dp_aux_xfer(struct i2c_adapter *adapter, | |||
223 | if (ret >= 0) | 224 | if (ret >= 0) |
224 | ret = num; | 225 | ret = num; |
225 | i2c_algo_dp_aux_stop(adapter, reading); | 226 | i2c_algo_dp_aux_stop(adapter, reading); |
226 | printk(KERN_ERR "dp_aux_xfer return %d\n", ret); | 227 | DRM_DEBUG("dp_aux_xfer return %d\n", ret); |
227 | return ret; | 228 | return ret; |
228 | } | 229 | } |
229 | 230 | ||
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 1af7d68e3807..1d30802e773e 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -453,7 +453,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
453 | size = ALIGN(size, PAGE_SIZE); | 453 | size = ALIGN(size, PAGE_SIZE); |
454 | fbo = drm_gem_object_alloc(dev, size); | 454 | fbo = drm_gem_object_alloc(dev, size); |
455 | if (!fbo) { | 455 | if (!fbo) { |
456 | printk(KERN_ERR "failed to allocate framebuffer\n"); | 456 | DRM_ERROR("failed to allocate framebuffer\n"); |
457 | ret = -ENOMEM; | 457 | ret = -ENOMEM; |
458 | goto out; | 458 | goto out; |
459 | } | 459 | } |
@@ -610,8 +610,8 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
610 | par->dev = dev; | 610 | par->dev = dev; |
611 | 611 | ||
612 | /* To allow resizeing without swapping buffers */ | 612 | /* To allow resizeing without swapping buffers */ |
613 | printk("allocated %dx%d fb: 0x%08x, bo %p\n", intel_fb->base.width, | 613 | DRM_DEBUG("allocated %dx%d fb: 0x%08x, bo %p\n", intel_fb->base.width, |
614 | intel_fb->base.height, obj_priv->gtt_offset, fbo); | 614 | intel_fb->base.height, obj_priv->gtt_offset, fbo); |
615 | 615 | ||
616 | mutex_unlock(&dev->struct_mutex); | 616 | mutex_unlock(&dev->struct_mutex); |
617 | return 0; | 617 | return 0; |
@@ -698,13 +698,13 @@ static int intelfb_multi_fb_probe_crtc(struct drm_device *dev, struct drm_crtc * | |||
698 | } else | 698 | } else |
699 | intelfb_set_par(info); | 699 | intelfb_set_par(info); |
700 | 700 | ||
701 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, | 701 | DRM_INFO("fb%d: %s frame buffer device\n", info->node, |
702 | info->fix.id); | 702 | info->fix.id); |
703 | 703 | ||
704 | /* Switch back to kernel console on panic */ | 704 | /* Switch back to kernel console on panic */ |
705 | kernelfb_mode = *modeset; | 705 | kernelfb_mode = *modeset; |
706 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); | 706 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); |
707 | printk(KERN_INFO "registered panic notifier\n"); | 707 | DRM_DEBUG("registered panic notifier\n"); |
708 | 708 | ||
709 | return 0; | 709 | return 0; |
710 | } | 710 | } |
@@ -852,13 +852,13 @@ static int intelfb_single_fb_probe(struct drm_device *dev) | |||
852 | } else | 852 | } else |
853 | intelfb_set_par(info); | 853 | intelfb_set_par(info); |
854 | 854 | ||
855 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, | 855 | DRM_INFO("fb%d: %s frame buffer device\n", info->node, |
856 | info->fix.id); | 856 | info->fix.id); |
857 | 857 | ||
858 | /* Switch back to kernel console on panic */ | 858 | /* Switch back to kernel console on panic */ |
859 | kernelfb_mode = *modeset; | 859 | kernelfb_mode = *modeset; |
860 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); | 860 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); |
861 | printk(KERN_INFO "registered panic notifier\n"); | 861 | DRM_DEBUG("registered panic notifier\n"); |
862 | 862 | ||
863 | return 0; | 863 | return 0; |
864 | } | 864 | } |
@@ -872,8 +872,8 @@ void intelfb_restore(void) | |||
872 | { | 872 | { |
873 | int ret; | 873 | int ret; |
874 | if ((ret = drm_crtc_helper_set_config(&kernelfb_mode)) != 0) { | 874 | if ((ret = drm_crtc_helper_set_config(&kernelfb_mode)) != 0) { |
875 | printk(KERN_ERR "Failed to restore crtc configuration: %d\n", | 875 | DRM_ERROR("Failed to restore crtc configuration: %d\n", |
876 | ret); | 876 | ret); |
877 | } | 877 | } |
878 | } | 878 | } |
879 | 879 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 9564ca44a977..9ab38efffecf 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "intel_drv.h" | 36 | #include "intel_drv.h" |
37 | #include "i915_drm.h" | 37 | #include "i915_drm.h" |
38 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
39 | #include <linux/acpi.h> | ||
39 | 40 | ||
40 | #define I915_LVDS "i915_lvds" | 41 | #define I915_LVDS "i915_lvds" |
41 | 42 | ||
@@ -252,14 +253,14 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
252 | 253 | ||
253 | /* Should never happen!! */ | 254 | /* Should never happen!! */ |
254 | if (!IS_I965G(dev) && intel_crtc->pipe == 0) { | 255 | if (!IS_I965G(dev) && intel_crtc->pipe == 0) { |
255 | printk(KERN_ERR "Can't support LVDS on pipe A\n"); | 256 | DRM_ERROR("Can't support LVDS on pipe A\n"); |
256 | return false; | 257 | return false; |
257 | } | 258 | } |
258 | 259 | ||
259 | /* Should never happen!! */ | 260 | /* Should never happen!! */ |
260 | list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, head) { | 261 | list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, head) { |
261 | if (tmp_encoder != encoder && tmp_encoder->crtc == encoder->crtc) { | 262 | if (tmp_encoder != encoder && tmp_encoder->crtc == encoder->crtc) { |
262 | printk(KERN_ERR "Can't enable LVDS and another " | 263 | DRM_ERROR("Can't enable LVDS and another " |
263 | "encoder on the same pipe\n"); | 264 | "encoder on the same pipe\n"); |
264 | return false; | 265 | return false; |
265 | } | 266 | } |
@@ -788,6 +789,65 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
788 | { } /* terminating entry */ | 789 | { } /* terminating entry */ |
789 | }; | 790 | }; |
790 | 791 | ||
792 | #ifdef CONFIG_ACPI | ||
793 | /* | ||
794 | * check_lid_device -- check whether @handle is an ACPI LID device. | ||
795 | * @handle: ACPI device handle | ||
796 | * @level : depth in the ACPI namespace tree | ||
797 | * @context: the number of LID device when we find the device | ||
798 | * @rv: a return value to fill if desired (Not use) | ||
799 | */ | ||
800 | static acpi_status | ||
801 | check_lid_device(acpi_handle handle, u32 level, void *context, | ||
802 | void **return_value) | ||
803 | { | ||
804 | struct acpi_device *acpi_dev; | ||
805 | int *lid_present = context; | ||
806 | |||
807 | acpi_dev = NULL; | ||
808 | /* Get the acpi device for device handle */ | ||
809 | if (acpi_bus_get_device(handle, &acpi_dev) || !acpi_dev) { | ||
810 | /* If there is no ACPI device for handle, return */ | ||
811 | return AE_OK; | ||
812 | } | ||
813 | |||
814 | if (!strncmp(acpi_device_hid(acpi_dev), "PNP0C0D", 7)) | ||
815 | *lid_present = 1; | ||
816 | |||
817 | return AE_OK; | ||
818 | } | ||
819 | |||
820 | /** | ||
821 | * check whether there exists the ACPI LID device by enumerating the ACPI | ||
822 | * device tree. | ||
823 | */ | ||
824 | static int intel_lid_present(void) | ||
825 | { | ||
826 | int lid_present = 0; | ||
827 | |||
828 | if (acpi_disabled) { | ||
829 | /* If ACPI is disabled, there is no ACPI device tree to | ||
830 | * check, so assume the LID device would have been present. | ||
831 | */ | ||
832 | return 1; | ||
833 | } | ||
834 | |||
835 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
836 | ACPI_UINT32_MAX, | ||
837 | check_lid_device, &lid_present, NULL); | ||
838 | |||
839 | return lid_present; | ||
840 | } | ||
841 | #else | ||
842 | static int intel_lid_present(void) | ||
843 | { | ||
844 | /* In the absence of ACPI built in, assume that the LID device would | ||
845 | * have been present. | ||
846 | */ | ||
847 | return 1; | ||
848 | } | ||
849 | #endif | ||
850 | |||
791 | /** | 851 | /** |
792 | * intel_lvds_init - setup LVDS connectors on this device | 852 | * intel_lvds_init - setup LVDS connectors on this device |
793 | * @dev: drm device | 853 | * @dev: drm device |
@@ -811,6 +871,16 @@ void intel_lvds_init(struct drm_device *dev) | |||
811 | if (dmi_check_system(intel_no_lvds)) | 871 | if (dmi_check_system(intel_no_lvds)) |
812 | return; | 872 | return; |
813 | 873 | ||
874 | /* Assume that any device without an ACPI LID device also doesn't | ||
875 | * have an integrated LVDS. We would be better off parsing the BIOS | ||
876 | * to get a reliable indicator, but that code isn't written yet. | ||
877 | * | ||
878 | * In the case of all-in-one desktops using LVDS that we've seen, | ||
879 | * they're using SDVO LVDS. | ||
880 | */ | ||
881 | if (!intel_lid_present()) | ||
882 | return; | ||
883 | |||
814 | if (IS_IGDNG(dev)) { | 884 | if (IS_IGDNG(dev)) { |
815 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) | 885 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) |
816 | return; | 886 | return; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index f03473779feb..4f0c30948bc4 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -68,12 +68,23 @@ struct intel_sdvo_priv { | |||
68 | * This is set if we treat the device as HDMI, instead of DVI. | 68 | * This is set if we treat the device as HDMI, instead of DVI. |
69 | */ | 69 | */ |
70 | bool is_hdmi; | 70 | bool is_hdmi; |
71 | |||
71 | /** | 72 | /** |
72 | * This is set if we detect output of sdvo device as LVDS. | 73 | * This is set if we detect output of sdvo device as LVDS. |
73 | */ | 74 | */ |
74 | bool is_lvds; | 75 | bool is_lvds; |
75 | 76 | ||
76 | /** | 77 | /** |
78 | * This is sdvo flags for input timing. | ||
79 | */ | ||
80 | uint8_t sdvo_flags; | ||
81 | |||
82 | /** | ||
83 | * This is sdvo fixed pannel mode pointer | ||
84 | */ | ||
85 | struct drm_display_mode *sdvo_lvds_fixed_mode; | ||
86 | |||
87 | /** | ||
77 | * Returned SDTV resolutions allowed for the current format, if the | 88 | * Returned SDTV resolutions allowed for the current format, if the |
78 | * device reported it. | 89 | * device reported it. |
79 | */ | 90 | */ |
@@ -592,6 +603,7 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
592 | uint16_t height) | 603 | uint16_t height) |
593 | { | 604 | { |
594 | struct intel_sdvo_preferred_input_timing_args args; | 605 | struct intel_sdvo_preferred_input_timing_args args; |
606 | struct intel_sdvo_priv *sdvo_priv = output->dev_priv; | ||
595 | uint8_t status; | 607 | uint8_t status; |
596 | 608 | ||
597 | memset(&args, 0, sizeof(args)); | 609 | memset(&args, 0, sizeof(args)); |
@@ -599,7 +611,12 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
599 | args.width = width; | 611 | args.width = width; |
600 | args.height = height; | 612 | args.height = height; |
601 | args.interlace = 0; | 613 | args.interlace = 0; |
602 | args.scaled = 0; | 614 | |
615 | if (sdvo_priv->is_lvds && | ||
616 | (sdvo_priv->sdvo_lvds_fixed_mode->hdisplay != width || | ||
617 | sdvo_priv->sdvo_lvds_fixed_mode->vdisplay != height)) | ||
618 | args.scaled = 1; | ||
619 | |||
603 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, | 620 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, |
604 | &args, sizeof(args)); | 621 | &args, sizeof(args)); |
605 | status = intel_sdvo_read_response(output, NULL, 0); | 622 | status = intel_sdvo_read_response(output, NULL, 0); |
@@ -944,12 +961,7 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
944 | struct intel_output *output = enc_to_intel_output(encoder); | 961 | struct intel_output *output = enc_to_intel_output(encoder); |
945 | struct intel_sdvo_priv *dev_priv = output->dev_priv; | 962 | struct intel_sdvo_priv *dev_priv = output->dev_priv; |
946 | 963 | ||
947 | if (!dev_priv->is_tv) { | 964 | if (dev_priv->is_tv) { |
948 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
949 | * SDVO device will be told of the multiplier during mode_set. | ||
950 | */ | ||
951 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
952 | } else { | ||
953 | struct intel_sdvo_dtd output_dtd; | 965 | struct intel_sdvo_dtd output_dtd; |
954 | bool success; | 966 | bool success; |
955 | 967 | ||
@@ -980,6 +992,47 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
980 | intel_sdvo_get_preferred_input_timing(output, | 992 | intel_sdvo_get_preferred_input_timing(output, |
981 | &input_dtd); | 993 | &input_dtd); |
982 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | 994 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); |
995 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
996 | |||
997 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
998 | |||
999 | mode->clock = adjusted_mode->clock; | ||
1000 | |||
1001 | adjusted_mode->clock *= | ||
1002 | intel_sdvo_get_pixel_multiplier(mode); | ||
1003 | } else { | ||
1004 | return false; | ||
1005 | } | ||
1006 | } else if (dev_priv->is_lvds) { | ||
1007 | struct intel_sdvo_dtd output_dtd; | ||
1008 | bool success; | ||
1009 | |||
1010 | drm_mode_set_crtcinfo(dev_priv->sdvo_lvds_fixed_mode, 0); | ||
1011 | /* Set output timings */ | ||
1012 | intel_sdvo_get_dtd_from_mode(&output_dtd, | ||
1013 | dev_priv->sdvo_lvds_fixed_mode); | ||
1014 | |||
1015 | intel_sdvo_set_target_output(output, | ||
1016 | dev_priv->controlled_output); | ||
1017 | intel_sdvo_set_output_timing(output, &output_dtd); | ||
1018 | |||
1019 | /* Set the input timing to the screen. Assume always input 0. */ | ||
1020 | intel_sdvo_set_target_input(output, true, false); | ||
1021 | |||
1022 | |||
1023 | success = intel_sdvo_create_preferred_input_timing( | ||
1024 | output, | ||
1025 | mode->clock / 10, | ||
1026 | mode->hdisplay, | ||
1027 | mode->vdisplay); | ||
1028 | |||
1029 | if (success) { | ||
1030 | struct intel_sdvo_dtd input_dtd; | ||
1031 | |||
1032 | intel_sdvo_get_preferred_input_timing(output, | ||
1033 | &input_dtd); | ||
1034 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | ||
1035 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
983 | 1036 | ||
984 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 1037 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
985 | 1038 | ||
@@ -990,6 +1043,12 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
990 | } else { | 1043 | } else { |
991 | return false; | 1044 | return false; |
992 | } | 1045 | } |
1046 | |||
1047 | } else { | ||
1048 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
1049 | * SDVO device will be told of the multiplier during mode_set. | ||
1050 | */ | ||
1051 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
993 | } | 1052 | } |
994 | return true; | 1053 | return true; |
995 | } | 1054 | } |
@@ -1033,15 +1092,16 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1033 | 1092 | ||
1034 | /* We have tried to get input timing in mode_fixup, and filled into | 1093 | /* We have tried to get input timing in mode_fixup, and filled into |
1035 | adjusted_mode */ | 1094 | adjusted_mode */ |
1036 | if (sdvo_priv->is_tv) | 1095 | if (sdvo_priv->is_tv || sdvo_priv->is_lvds) { |
1037 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | 1096 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); |
1038 | else | 1097 | input_dtd.part2.sdvo_flags = sdvo_priv->sdvo_flags; |
1098 | } else | ||
1039 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); | 1099 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); |
1040 | 1100 | ||
1041 | /* If it's a TV, we already set the output timing in mode_fixup. | 1101 | /* If it's a TV, we already set the output timing in mode_fixup. |
1042 | * Otherwise, the output timing is equal to the input timing. | 1102 | * Otherwise, the output timing is equal to the input timing. |
1043 | */ | 1103 | */ |
1044 | if (!sdvo_priv->is_tv) { | 1104 | if (!sdvo_priv->is_tv && !sdvo_priv->is_lvds) { |
1045 | /* Set the output timing to the screen */ | 1105 | /* Set the output timing to the screen */ |
1046 | intel_sdvo_set_target_output(output, | 1106 | intel_sdvo_set_target_output(output, |
1047 | sdvo_priv->controlled_output); | 1107 | sdvo_priv->controlled_output); |
@@ -1116,6 +1176,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1116 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; | 1176 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; |
1117 | } | 1177 | } |
1118 | 1178 | ||
1179 | if (sdvo_priv->sdvo_flags & SDVO_NEED_TO_STALL) | ||
1180 | sdvox |= SDVO_STALL_SELECT; | ||
1119 | intel_sdvo_write_sdvox(output, sdvox); | 1181 | intel_sdvo_write_sdvox(output, sdvox); |
1120 | } | 1182 | } |
1121 | 1183 | ||
@@ -1276,6 +1338,17 @@ static int intel_sdvo_mode_valid(struct drm_connector *connector, | |||
1276 | if (sdvo_priv->pixel_clock_max < mode->clock) | 1338 | if (sdvo_priv->pixel_clock_max < mode->clock) |
1277 | return MODE_CLOCK_HIGH; | 1339 | return MODE_CLOCK_HIGH; |
1278 | 1340 | ||
1341 | if (sdvo_priv->is_lvds == true) { | ||
1342 | if (sdvo_priv->sdvo_lvds_fixed_mode == NULL) | ||
1343 | return MODE_PANEL; | ||
1344 | |||
1345 | if (mode->hdisplay > sdvo_priv->sdvo_lvds_fixed_mode->hdisplay) | ||
1346 | return MODE_PANEL; | ||
1347 | |||
1348 | if (mode->vdisplay > sdvo_priv->sdvo_lvds_fixed_mode->vdisplay) | ||
1349 | return MODE_PANEL; | ||
1350 | } | ||
1351 | |||
1279 | return MODE_OK; | 1352 | return MODE_OK; |
1280 | } | 1353 | } |
1281 | 1354 | ||
@@ -1549,6 +1622,8 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1549 | { | 1622 | { |
1550 | struct intel_output *intel_output = to_intel_output(connector); | 1623 | struct intel_output *intel_output = to_intel_output(connector); |
1551 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | 1624 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
1625 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1626 | struct drm_display_mode *newmode; | ||
1552 | 1627 | ||
1553 | /* | 1628 | /* |
1554 | * Attempt to get the mode list from DDC. | 1629 | * Attempt to get the mode list from DDC. |
@@ -1557,11 +1632,10 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1557 | */ | 1632 | */ |
1558 | intel_ddc_get_modes(intel_output); | 1633 | intel_ddc_get_modes(intel_output); |
1559 | if (list_empty(&connector->probed_modes) == false) | 1634 | if (list_empty(&connector->probed_modes) == false) |
1560 | return; | 1635 | goto end; |
1561 | 1636 | ||
1562 | /* Fetch modes from VBT */ | 1637 | /* Fetch modes from VBT */ |
1563 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { | 1638 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { |
1564 | struct drm_display_mode *newmode; | ||
1565 | newmode = drm_mode_duplicate(connector->dev, | 1639 | newmode = drm_mode_duplicate(connector->dev, |
1566 | dev_priv->sdvo_lvds_vbt_mode); | 1640 | dev_priv->sdvo_lvds_vbt_mode); |
1567 | if (newmode != NULL) { | 1641 | if (newmode != NULL) { |
@@ -1571,6 +1645,16 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1571 | drm_mode_probed_add(connector, newmode); | 1645 | drm_mode_probed_add(connector, newmode); |
1572 | } | 1646 | } |
1573 | } | 1647 | } |
1648 | |||
1649 | end: | ||
1650 | list_for_each_entry(newmode, &connector->probed_modes, head) { | ||
1651 | if (newmode->type & DRM_MODE_TYPE_PREFERRED) { | ||
1652 | sdvo_priv->sdvo_lvds_fixed_mode = | ||
1653 | drm_mode_duplicate(connector->dev, newmode); | ||
1654 | break; | ||
1655 | } | ||
1656 | } | ||
1657 | |||
1574 | } | 1658 | } |
1575 | 1659 | ||
1576 | static int intel_sdvo_get_modes(struct drm_connector *connector) | 1660 | static int intel_sdvo_get_modes(struct drm_connector *connector) |
@@ -1593,14 +1677,20 @@ static int intel_sdvo_get_modes(struct drm_connector *connector) | |||
1593 | static void intel_sdvo_destroy(struct drm_connector *connector) | 1677 | static void intel_sdvo_destroy(struct drm_connector *connector) |
1594 | { | 1678 | { |
1595 | struct intel_output *intel_output = to_intel_output(connector); | 1679 | struct intel_output *intel_output = to_intel_output(connector); |
1680 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1596 | 1681 | ||
1597 | if (intel_output->i2c_bus) | 1682 | if (intel_output->i2c_bus) |
1598 | intel_i2c_destroy(intel_output->i2c_bus); | 1683 | intel_i2c_destroy(intel_output->i2c_bus); |
1599 | if (intel_output->ddc_bus) | 1684 | if (intel_output->ddc_bus) |
1600 | intel_i2c_destroy(intel_output->ddc_bus); | 1685 | intel_i2c_destroy(intel_output->ddc_bus); |
1601 | 1686 | ||
1687 | if (sdvo_priv->sdvo_lvds_fixed_mode != NULL) | ||
1688 | drm_mode_destroy(connector->dev, | ||
1689 | sdvo_priv->sdvo_lvds_fixed_mode); | ||
1690 | |||
1602 | drm_sysfs_connector_remove(connector); | 1691 | drm_sysfs_connector_remove(connector); |
1603 | drm_connector_cleanup(connector); | 1692 | drm_connector_cleanup(connector); |
1693 | |||
1604 | kfree(intel_output); | 1694 | kfree(intel_output); |
1605 | } | 1695 | } |
1606 | 1696 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo_regs.h b/drivers/gpu/drm/i915/intel_sdvo_regs.h index 193938b7d7f9..ba5cdf8ae40b 100644 --- a/drivers/gpu/drm/i915/intel_sdvo_regs.h +++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h | |||
@@ -715,6 +715,7 @@ struct intel_sdvo_enhancements_arg { | |||
715 | #define SDVO_HBUF_TX_ONCE (2 << 6) | 715 | #define SDVO_HBUF_TX_ONCE (2 << 6) |
716 | #define SDVO_HBUF_TX_VSYNC (3 << 6) | 716 | #define SDVO_HBUF_TX_VSYNC (3 << 6) |
717 | #define SDVO_CMD_GET_AUDIO_TX_INFO 0x9c | 717 | #define SDVO_CMD_GET_AUDIO_TX_INFO 0x9c |
718 | #define SDVO_NEED_TO_STALL (1 << 7) | ||
718 | 719 | ||
719 | struct intel_sdvo_encode{ | 720 | struct intel_sdvo_encode{ |
720 | u8 dvi_rev; | 721 | u8 dvi_rev; |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 40b75032ea47..fe949a12fe40 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c | |||
@@ -327,7 +327,7 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, | |||
327 | goto out_unref; | 327 | goto out_unref; |
328 | 328 | ||
329 | kmap_offset = dev_offset - bo->vm_node->start; | 329 | kmap_offset = dev_offset - bo->vm_node->start; |
330 | if (unlikely(kmap_offset) >= bo->num_pages) { | 330 | if (unlikely(kmap_offset >= bo->num_pages)) { |
331 | ret = -EFBIG; | 331 | ret = -EFBIG; |
332 | goto out_unref; | 332 | goto out_unref; |
333 | } | 333 | } |
@@ -401,7 +401,7 @@ ssize_t ttm_bo_fbdev_io(struct ttm_buffer_object *bo, const char __user *wbuf, | |||
401 | bool dummy; | 401 | bool dummy; |
402 | 402 | ||
403 | kmap_offset = (*f_pos >> PAGE_SHIFT); | 403 | kmap_offset = (*f_pos >> PAGE_SHIFT); |
404 | if (unlikely(kmap_offset) >= bo->num_pages) | 404 | if (unlikely(kmap_offset >= bo->num_pages)) |
405 | return -EFBIG; | 405 | return -EFBIG; |
406 | 406 | ||
407 | page_offset = *f_pos & ~PAGE_MASK; | 407 | page_offset = *f_pos & ~PAGE_MASK; |
diff --git a/drivers/gpu/drm/via/via_irq.c b/drivers/gpu/drm/via/via_irq.c index c248c1d37268..5935b8842e86 100644 --- a/drivers/gpu/drm/via/via_irq.c +++ b/drivers/gpu/drm/via/via_irq.c | |||
@@ -183,7 +183,7 @@ int via_enable_vblank(struct drm_device *dev, int crtc) | |||
183 | } | 183 | } |
184 | 184 | ||
185 | status = VIA_READ(VIA_REG_INTERRUPT); | 185 | status = VIA_READ(VIA_REG_INTERRUPT); |
186 | VIA_WRITE(VIA_REG_INTERRUPT, status & VIA_IRQ_VBLANK_ENABLE); | 186 | VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_VBLANK_ENABLE); |
187 | 187 | ||
188 | VIA_WRITE8(0x83d4, 0x11); | 188 | VIA_WRITE8(0x83d4, 0x11); |
189 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); | 189 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); |
@@ -194,6 +194,10 @@ int via_enable_vblank(struct drm_device *dev, int crtc) | |||
194 | void via_disable_vblank(struct drm_device *dev, int crtc) | 194 | void via_disable_vblank(struct drm_device *dev, int crtc) |
195 | { | 195 | { |
196 | drm_via_private_t *dev_priv = dev->dev_private; | 196 | drm_via_private_t *dev_priv = dev->dev_private; |
197 | u32 status; | ||
198 | |||
199 | status = VIA_READ(VIA_REG_INTERRUPT); | ||
200 | VIA_WRITE(VIA_REG_INTERRUPT, status & ~VIA_IRQ_VBLANK_ENABLE); | ||
197 | 201 | ||
198 | VIA_WRITE8(0x83d4, 0x11); | 202 | VIA_WRITE8(0x83d4, 0x11); |
199 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); | 203 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 76c4bbe9dccb..3c1fcb7640ab 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
25 | #include <linux/smp_lock.h> | ||
26 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
27 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
28 | #include <asm/byteorder.h> | 27 | #include <asm/byteorder.h> |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index ad2b3431b725..7d3f15d32fdf 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -357,7 +357,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
357 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, | 357 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, |
358 | { NULL, 0, 0, 0, 0, 0 } } | 358 | { NULL, 0, 0, 0, 0, 0 } } |
359 | }, | 359 | }, |
360 | { 0x0014, NULL /* Abit AB9 Pro, need DMI string */, { | 360 | { 0x0014, "AB9", /* + AB9 Pro */ { |
361 | { "CPU Core", 0, 0, 10, 1, 0 }, | 361 | { "CPU Core", 0, 0, 10, 1, 0 }, |
362 | { "DDR", 1, 0, 10, 1, 0 }, | 362 | { "DDR", 1, 0, 10, 1, 0 }, |
363 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 363 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -455,7 +455,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
455 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, | 455 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, |
456 | { NULL, 0, 0, 0, 0, 0 } } | 456 | { NULL, 0, 0, 0, 0, 0 } } |
457 | }, | 457 | }, |
458 | { 0x0018, NULL /* Unknown, need DMI string */, { | 458 | { 0x0018, "AB9 QuadGT", { |
459 | { "CPU Core", 0, 0, 10, 1, 0 }, | 459 | { "CPU Core", 0, 0, 10, 1, 0 }, |
460 | { "DDR2", 1, 0, 20, 1, 0 }, | 460 | { "DDR2", 1, 0, 20, 1, 0 }, |
461 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 461 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -564,7 +564,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
564 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 564 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
565 | { NULL, 0, 0, 0, 0, 0 } } | 565 | { NULL, 0, 0, 0, 0, 0 } } |
566 | }, | 566 | }, |
567 | { 0x001C, NULL /* Unknown, need DMI string */, { | 567 | { 0x001C, "IX38 QuadGT", { |
568 | { "CPU Core", 0, 0, 10, 1, 0 }, | 568 | { "CPU Core", 0, 0, 10, 1, 0 }, |
569 | { "DDR2", 1, 0, 20, 1, 0 }, | 569 | { "DDR2", 1, 0, 20, 1, 0 }, |
570 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 570 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index 86142a858238..58f66be61b1f 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c | |||
@@ -418,6 +418,7 @@ static ssize_t set_div(struct device *dev, struct device_attribute *devattr, | |||
418 | data->count = 3; | 418 | data->count = 3; |
419 | break; | 419 | break; |
420 | default: | 420 | default: |
421 | mutex_unlock(&data->update_lock); | ||
421 | dev_err(&client->dev, | 422 | dev_err(&client->dev, |
422 | "illegal value for fan divider (%d)\n", div); | 423 | "illegal value for fan divider (%d)\n", div); |
423 | return -EINVAL; | 424 | return -EINVAL; |
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 56cd6004da36..6290a259456e 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c | |||
@@ -257,7 +257,7 @@ static inline int sht15_update_single_val(struct sht15_data *data, | |||
257 | (data->flag == SHT15_READING_NOTHING), | 257 | (data->flag == SHT15_READING_NOTHING), |
258 | msecs_to_jiffies(timeout_msecs)); | 258 | msecs_to_jiffies(timeout_msecs)); |
259 | if (ret == 0) {/* timeout occurred */ | 259 | if (ret == 0) {/* timeout occurred */ |
260 | disable_irq_nosync(gpio_to_irq(data->pdata->gpio_data));; | 260 | disable_irq_nosync(gpio_to_irq(data->pdata->gpio_data)); |
261 | sht15_connection_reset(data); | 261 | sht15_connection_reset(data); |
262 | return -ETIME; | 262 | return -ETIME; |
263 | } | 263 | } |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 3fae3a91ce5b..c89687a10835 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -187,6 +187,11 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev) | |||
187 | davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh); | 187 | davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh); |
188 | davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl); | 188 | davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl); |
189 | 189 | ||
190 | /* Respond at reserved "SMBus Host" slave address" (and zero); | ||
191 | * we seem to have no option to not respond... | ||
192 | */ | ||
193 | davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, 0x08); | ||
194 | |||
190 | dev_dbg(dev->dev, "input_clock = %d, CLK = %d\n", input_clock, clk); | 195 | dev_dbg(dev->dev, "input_clock = %d, CLK = %d\n", input_clock, clk); |
191 | dev_dbg(dev->dev, "PSC = %d\n", | 196 | dev_dbg(dev->dev, "PSC = %d\n", |
192 | davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG)); | 197 | davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG)); |
@@ -387,7 +392,7 @@ static void terminate_write(struct davinci_i2c_dev *dev) | |||
387 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); | 392 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); |
388 | 393 | ||
389 | if (!dev->terminate) | 394 | if (!dev->terminate) |
390 | dev_err(dev->dev, "TDR IRQ while no data to send\n"); | 395 | dev_dbg(dev->dev, "TDR IRQ while no data to send\n"); |
391 | } | 396 | } |
392 | 397 | ||
393 | /* | 398 | /* |
@@ -473,9 +478,14 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id) | |||
473 | break; | 478 | break; |
474 | 479 | ||
475 | case DAVINCI_I2C_IVR_AAS: | 480 | case DAVINCI_I2C_IVR_AAS: |
476 | dev_warn(dev->dev, "Address as slave interrupt\n"); | 481 | dev_dbg(dev->dev, "Address as slave interrupt\n"); |
477 | }/* switch */ | 482 | break; |
478 | }/* while */ | 483 | |
484 | default: | ||
485 | dev_warn(dev->dev, "Unrecognized irq stat %d\n", stat); | ||
486 | break; | ||
487 | } | ||
488 | } | ||
479 | 489 | ||
480 | return count ? IRQ_HANDLED : IRQ_NONE; | 490 | return count ? IRQ_HANDLED : IRQ_NONE; |
481 | } | 491 | } |
@@ -505,7 +515,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) | |||
505 | return -ENODEV; | 515 | return -ENODEV; |
506 | } | 516 | } |
507 | 517 | ||
508 | ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1, | 518 | ioarea = request_mem_region(mem->start, resource_size(mem), |
509 | pdev->name); | 519 | pdev->name); |
510 | if (!ioarea) { | 520 | if (!ioarea) { |
511 | dev_err(&pdev->dev, "I2C region already claimed\n"); | 521 | dev_err(&pdev->dev, "I2C region already claimed\n"); |
@@ -523,7 +533,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) | |||
523 | dev->irq = irq->start; | 533 | dev->irq = irq->start; |
524 | platform_set_drvdata(pdev, dev); | 534 | platform_set_drvdata(pdev, dev); |
525 | 535 | ||
526 | dev->clk = clk_get(&pdev->dev, "I2CCLK"); | 536 | dev->clk = clk_get(&pdev->dev, NULL); |
527 | if (IS_ERR(dev->clk)) { | 537 | if (IS_ERR(dev->clk)) { |
528 | r = -ENODEV; | 538 | r = -ENODEV; |
529 | goto err_free_mem; | 539 | goto err_free_mem; |
@@ -568,7 +578,7 @@ err_free_mem: | |||
568 | put_device(&pdev->dev); | 578 | put_device(&pdev->dev); |
569 | kfree(dev); | 579 | kfree(dev); |
570 | err_release_region: | 580 | err_release_region: |
571 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 581 | release_mem_region(mem->start, resource_size(mem)); |
572 | 582 | ||
573 | return r; | 583 | return r; |
574 | } | 584 | } |
@@ -591,7 +601,7 @@ static int davinci_i2c_remove(struct platform_device *pdev) | |||
591 | kfree(dev); | 601 | kfree(dev); |
592 | 602 | ||
593 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 603 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
594 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 604 | release_mem_region(mem->start, resource_size(mem)); |
595 | return 0; | 605 | return 0; |
596 | } | 606 | } |
597 | 607 | ||
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index ad8d2010c921..fdd83277c8a8 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -806,7 +806,7 @@ omap_i2c_probe(struct platform_device *pdev) | |||
806 | return -ENODEV; | 806 | return -ENODEV; |
807 | } | 807 | } |
808 | 808 | ||
809 | ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1, | 809 | ioarea = request_mem_region(mem->start, resource_size(mem), |
810 | pdev->name); | 810 | pdev->name); |
811 | if (!ioarea) { | 811 | if (!ioarea) { |
812 | dev_err(&pdev->dev, "I2C region already claimed\n"); | 812 | dev_err(&pdev->dev, "I2C region already claimed\n"); |
@@ -905,7 +905,7 @@ err_free_mem: | |||
905 | platform_set_drvdata(pdev, NULL); | 905 | platform_set_drvdata(pdev, NULL); |
906 | kfree(dev); | 906 | kfree(dev); |
907 | err_release_region: | 907 | err_release_region: |
908 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 908 | release_mem_region(mem->start, resource_size(mem)); |
909 | 909 | ||
910 | return r; | 910 | return r; |
911 | } | 911 | } |
@@ -925,7 +925,7 @@ omap_i2c_remove(struct platform_device *pdev) | |||
925 | iounmap(dev->base); | 925 | iounmap(dev->base); |
926 | kfree(dev); | 926 | kfree(dev); |
927 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 927 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
928 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 928 | release_mem_region(mem->start, resource_size(mem)); |
929 | return 0; | 929 | return 0; |
930 | } | 930 | } |
931 | 931 | ||
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 1c01083b01b5..4f3d99cd1692 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c | |||
@@ -563,7 +563,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) | |||
563 | goto err_irq; | 563 | goto err_irq; |
564 | } | 564 | } |
565 | 565 | ||
566 | size = (res->end - res->start) + 1; | 566 | size = resource_size(res); |
567 | 567 | ||
568 | pd->reg = ioremap(res->start, size); | 568 | pd->reg = ioremap(res->start, size); |
569 | if (pd->reg == NULL) { | 569 | if (pd->reg == NULL) { |
diff --git a/drivers/i2c/busses/i2c-simtec.c b/drivers/i2c/busses/i2c-simtec.c index 042fda295f3a..6407f47bda82 100644 --- a/drivers/i2c/busses/i2c-simtec.c +++ b/drivers/i2c/busses/i2c-simtec.c | |||
@@ -92,7 +92,7 @@ static int simtec_i2c_probe(struct platform_device *dev) | |||
92 | goto err; | 92 | goto err; |
93 | } | 93 | } |
94 | 94 | ||
95 | size = (res->end-res->start)+1; | 95 | size = resource_size(res); |
96 | 96 | ||
97 | pd->ioarea = request_mem_region(res->start, size, dev->name); | 97 | pd->ioarea = request_mem_region(res->start, size, dev->name); |
98 | if (pd->ioarea == NULL) { | 98 | if (pd->ioarea == NULL) { |
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 8df889b0c1a9..9de54202c90c 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/kernel_stat.h> | 37 | #include <linux/kernel_stat.h> |
38 | #include <linux/usb.h> | 38 | #include <linux/usb.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/sched.h> | 40 | #include <linux/sched.h> |
42 | #include <linux/moduleparam.h> | 41 | #include <linux/moduleparam.h> |
43 | #include "hisax.h" | 42 | #include "hisax.h" |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index b4d4522e5071..2881a66c1aa9 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/isdn.h> | 14 | #include <linux/isdn.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/smp_lock.h> | ||
16 | #include "isdn_common.h" | 17 | #include "isdn_common.h" |
17 | #include "isdn_tty.h" | 18 | #include "isdn_tty.h" |
18 | #ifdef CONFIG_ISDN_AUDIO | 19 | #ifdef CONFIG_ISDN_AUDIO |
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index e2f45019ebf0..3e1532a180ff 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/mISDNif.h> | 18 | #include <linux/mISDNif.h> |
19 | #include <linux/kthread.h> | 19 | #include <linux/kthread.h> |
20 | #include <linux/smp_lock.h> | ||
20 | #include "core.h" | 21 | #include "core.h" |
21 | 22 | ||
22 | static u_int *debug; | 23 | static u_int *debug; |
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 9c3138265f8e..01c591923793 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
@@ -38,8 +38,6 @@ struct lguest_pages | |||
38 | #define CHANGED_GDT_TLS 4 /* Actually a subset of CHANGED_GDT */ | 38 | #define CHANGED_GDT_TLS 4 /* Actually a subset of CHANGED_GDT */ |
39 | #define CHANGED_ALL 3 | 39 | #define CHANGED_ALL 3 |
40 | 40 | ||
41 | struct lguest; | ||
42 | |||
43 | struct lg_cpu { | 41 | struct lg_cpu { |
44 | unsigned int id; | 42 | unsigned int id; |
45 | struct lguest *lg; | 43 | struct lguest *lg; |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 9933eb861c71..529e2ba505c3 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -776,7 +776,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
776 | * But don't wait if split was due to the io size restriction | 776 | * But don't wait if split was due to the io size restriction |
777 | */ | 777 | */ |
778 | if (unlikely(out_of_pages)) | 778 | if (unlikely(out_of_pages)) |
779 | congestion_wait(WRITE, HZ/100); | 779 | congestion_wait(BLK_RW_ASYNC, HZ/100); |
780 | 780 | ||
781 | /* | 781 | /* |
782 | * With async crypto it is unsafe to share the crypto context | 782 | * With async crypto it is unsafe to share the crypto context |
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 4601b059b2b2..0e246eaad05a 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/smp_lock.h> | ||
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <linux/dvb/ca.h> | 26 | #include <linux/dvb/ca.h> |
26 | #include "dvbdev.h" | 27 | #include "dvbdev.h" |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 79927305e84d..487919bea7ae 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/poll.h> | 27 | #include <linux/poll.h> |
28 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/smp_lock.h> | ||
31 | 30 | ||
32 | #define DVB_MAJOR 212 | 31 | #define DVB_MAJOR 212 |
33 | 32 | ||
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index d1d959ed37b7..8d65c652ba50 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/timer.h> | 37 | #include <linux/timer.h> |
38 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
39 | #include <linux/smp_lock.h> | ||
40 | 39 | ||
41 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
42 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index 837467f93805..575bf9d89419 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/module.h> | 58 | #include <linux/module.h> |
59 | #include <linux/init.h> | 59 | #include <linux/init.h> |
60 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
61 | #include <linux/smp_lock.h> | ||
61 | #include <linux/input.h> | 62 | #include <linux/input.h> |
62 | #include <linux/videodev2.h> | 63 | #include <linux/videodev2.h> |
63 | #include <media/v4l2-device.h> | 64 | #include <media/v4l2-device.h> |
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 46d216329611..e85f318b4d2b 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -127,6 +127,7 @@ | |||
127 | #include <linux/module.h> | 127 | #include <linux/module.h> |
128 | #include <linux/init.h> | 128 | #include <linux/init.h> |
129 | #include <linux/slab.h> | 129 | #include <linux/slab.h> |
130 | #include <linux/smp_lock.h> | ||
130 | #include <linux/input.h> | 131 | #include <linux/input.h> |
131 | #include <linux/usb.h> | 132 | #include <linux/usb.h> |
132 | #include <linux/hid.h> | 133 | #include <linux/hid.h> |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 5eb1464af670..d147d29bb0d3 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/fs.h> | 41 | #include <linux/fs.h> |
42 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
43 | #include <linux/sched.h> | 43 | #include <linux/sched.h> |
44 | #include <linux/smp_lock.h> | ||
44 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
45 | #include <linux/kdev_t.h> | 46 | #include <linux/kdev_t.h> |
46 | #include "bttvp.h" | 47 | #include "bttvp.h" |
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index 2943bfd32a94..428f0c45e6b7 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/smp_lock.h> | ||
34 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
35 | #include <media/v4l2-ioctl.h> | 36 | #include <media/v4l2-ioctl.h> |
36 | #include <media/cx2341x.h> | 37 | #include <media/cx2341x.h> |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 70836af3ab48..5d6093336300 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
30 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
31 | #include <linux/kthread.h> | 32 | #include <linux/kthread.h> |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 44eacfb0d0d6..356d6896da3f 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/firmware.h> | 34 | #include <linux/firmware.h> |
35 | #include <linux/smp_lock.h> | ||
35 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
36 | #include <media/v4l2-ioctl.h> | 37 | #include <media/v4l2-ioctl.h> |
37 | #include <media/cx2341x.h> | 38 | #include <media/cx2341x.h> |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index b12770848c00..2bb54c3ef5cd 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/kmod.h> | 31 | #include <linux/kmod.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
34 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
35 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
36 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
diff --git a/drivers/media/video/dabusb.c b/drivers/media/video/dabusb.c index ec2f45dde164..0664d111085f 100644 --- a/drivers/media/video/dabusb.c +++ b/drivers/media/video/dabusb.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/list.h> | 32 | #include <linux/list.h> |
33 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/smp_lock.h> | ||
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <asm/atomic.h> | 38 | #include <asm/atomic.h> |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index db25c3034c11..8d17cf613306 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/module.h> | 62 | #include <linux/module.h> |
63 | #include <linux/poll.h> | 63 | #include <linux/poll.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
65 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV | 66 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV |
66 | #include <linux/usb/input.h> | 67 | #include <linux/usb/input.h> |
67 | #endif | 68 | #endif |
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 0be6f814f539..0b658dee05a4 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/version.h> | 32 | #include <linux/version.h> |
34 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
35 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 6be845ccc7d7..9e3262c0ba37 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/videodev2.h> | 48 | #include <linux/videodev2.h> |
49 | #include <linux/version.h> | 49 | #include <linux/version.h> |
50 | #include <linux/mm.h> | 50 | #include <linux/mm.h> |
51 | #include <linux/smp_lock.h> | ||
51 | #include <media/videobuf-vmalloc.h> | 52 | #include <media/videobuf-vmalloc.h> |
52 | #include <media/v4l2-common.h> | 53 | #include <media/v4l2-common.h> |
53 | #include <media/v4l2-ioctl.h> | 54 | #include <media/v4l2-ioctl.h> |
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 155804b061e9..b624a4c01fdc 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/mm.h> | 43 | #include <linux/mm.h> |
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/i2c.h> | 45 | #include <linux/i2c.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
48 | #include <linux/videotext.h> | 47 | #include <linux/videotext.h> |
49 | #include <linux/videodev2.h> | 48 | #include <linux/videodev2.h> |
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 271d6e931b75..12835fb82c95 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/mm.h> | 46 | #include <linux/mm.h> |
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/i2c.h> | 48 | #include <linux/i2c.h> |
49 | #include <linux/smp_lock.h> | ||
50 | #include <linux/mutex.h> | 49 | #include <linux/mutex.h> |
51 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
52 | #include <linux/videotext.h> | 51 | #include <linux/videotext.h> |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index add1757f8930..296788c3bf0e 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/smp_lock.h> | ||
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | 27 | ||
27 | #include "saa7134-reg.h" | 28 | #include "saa7134-reg.h" |
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index c8f05297d0f0..85ffc2cba039 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -31,6 +31,7 @@ static const char version[] = "0.24"; | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
34 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
35 | #include <linux/usb.h> | 36 | #include <linux/usb.h> |
36 | #include "se401.h" | 37 | #include "se401.h" |
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index 2e5937047278..4d6785e63455 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/smp_lock.h> | ||
30 | 31 | ||
31 | #include <linux/usb.h> | 32 | #include <linux/usb.h> |
32 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 0eb313082c97..eaada39c76fd 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/major.h> | 27 | #include <linux/major.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
31 | #include <linux/poll.h> | 32 | #include <linux/poll.h> |
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index 75f286f7a2e9..8b4e7dafce7b 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/init.h> | 62 | #include <linux/init.h> |
63 | #include <linux/vmalloc.h> | 63 | #include <linux/vmalloc.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
65 | #include <linux/pagemap.h> | 66 | #include <linux/pagemap.h> |
66 | #include <linux/errno.h> | 67 | #include <linux/errno.h> |
67 | #include <linux/videodev.h> | 68 | #include <linux/videodev.h> |
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 8d73979596f9..45fce39ec9ad 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/mm.h> | 44 | #include <linux/mm.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/smp_lock.h> | ||
46 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
47 | #include <linux/firmware.h> | 48 | #include <linux/firmware.h> |
48 | #include <linux/ihex.h> | 49 | #include <linux/ihex.h> |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 90b58914f984..90d9b5c0e9a7 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/list.h> | 50 | #include <linux/list.h> |
51 | #include <linux/timer.h> | 51 | #include <linux/timer.h> |
52 | #include <linux/slab.h> | 52 | #include <linux/slab.h> |
53 | #include <linux/smp_lock.h> | ||
53 | #include <linux/mm.h> | 54 | #include <linux/mm.h> |
54 | #include <linux/utsname.h> | 55 | #include <linux/utsname.h> |
55 | #include <linux/highmem.h> | 56 | #include <linux/highmem.h> |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 31eac66411d7..a7f1b69a7dab 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
30 | #include <asm/system.h> | 29 | #include <asm/system.h> |
31 | 30 | ||
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 3d7df32a3d87..bcdefb1bcb3d 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/smp_lock.h> | ||
52 | #include <linux/pci.h> | 53 | #include <linux/pci.h> |
53 | #include <linux/vmalloc.h> | 54 | #include <linux/vmalloc.h> |
54 | #include <linux/wait.h> | 55 | #include <linux/wait.h> |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index fa2d93a9fb8d..aed609832bc2 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
34 | #include <linux/device.h> | 33 | #include <linux/device.h> |
35 | #include <linux/miscdevice.h> | 34 | #include <linux/miscdevice.h> |
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c index eedbf9c32760..79689b10f937 100644 --- a/drivers/misc/sgi-gru/grukservices.c +++ b/drivers/misc/sgi-gru/grukservices.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/smp_lock.h> | ||
28 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
29 | #include <linux/device.h> | 28 | #include <linux/device.h> |
30 | #include <linux/miscdevice.h> | 29 | #include <linux/miscdevice.h> |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 286ed594e5a0..e1f7d0a78b9d 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -657,6 +657,11 @@ static int io_init(struct ubi_device *ubi) | |||
657 | if (ubi->mtd->block_isbad && ubi->mtd->block_markbad) | 657 | if (ubi->mtd->block_isbad && ubi->mtd->block_markbad) |
658 | ubi->bad_allowed = 1; | 658 | ubi->bad_allowed = 1; |
659 | 659 | ||
660 | if (ubi->mtd->type == MTD_NORFLASH) { | ||
661 | ubi_assert(ubi->mtd->writesize == 1); | ||
662 | ubi->nor_flash = 1; | ||
663 | } | ||
664 | |||
660 | ubi->min_io_size = ubi->mtd->writesize; | 665 | ubi->min_io_size = ubi->mtd->writesize; |
661 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; | 666 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; |
662 | 667 | ||
@@ -996,6 +1001,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) | |||
996 | ubi_msg("number of PEBs reserved for bad PEB handling: %d", | 1001 | ubi_msg("number of PEBs reserved for bad PEB handling: %d", |
997 | ubi->beb_rsvd_pebs); | 1002 | ubi->beb_rsvd_pebs); |
998 | ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); | 1003 | ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); |
1004 | ubi_msg("image sequence number: %d", ubi->image_seq); | ||
999 | 1005 | ||
1000 | /* | 1006 | /* |
1001 | * The below lock makes sure we do not race with 'ubi_thread()' which | 1007 | * The below lock makes sure we do not race with 'ubi_thread()' which |
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index c0ed60e8ade9..54b0186915fb 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -44,6 +44,8 @@ void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr) | |||
44 | be32_to_cpu(ec_hdr->vid_hdr_offset)); | 44 | be32_to_cpu(ec_hdr->vid_hdr_offset)); |
45 | printk(KERN_DEBUG "\tdata_offset %d\n", | 45 | printk(KERN_DEBUG "\tdata_offset %d\n", |
46 | be32_to_cpu(ec_hdr->data_offset)); | 46 | be32_to_cpu(ec_hdr->data_offset)); |
47 | printk(KERN_DEBUG "\timage_seq %d\n", | ||
48 | be32_to_cpu(ec_hdr->image_seq)); | ||
47 | printk(KERN_DEBUG "\thdr_crc %#08x\n", | 49 | printk(KERN_DEBUG "\thdr_crc %#08x\n", |
48 | be32_to_cpu(ec_hdr->hdr_crc)); | 50 | be32_to_cpu(ec_hdr->hdr_crc)); |
49 | printk(KERN_DEBUG "erase counter header hexdump:\n"); | 51 | printk(KERN_DEBUG "erase counter header hexdump:\n"); |
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 13777e5beac9..a4da7a09b949 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -93,6 +93,12 @@ void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | |||
93 | #define UBI_IO_DEBUG 0 | 93 | #define UBI_IO_DEBUG 0 |
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID | ||
97 | int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len); | ||
98 | #else | ||
99 | #define ubi_dbg_check_all_ff(ubi, pnum, offset, len) 0 | ||
100 | #endif | ||
101 | |||
96 | #ifdef CONFIG_MTD_UBI_DEBUG_DISABLE_BGT | 102 | #ifdef CONFIG_MTD_UBI_DEBUG_DISABLE_BGT |
97 | #define DBG_DISABLE_BGT 1 | 103 | #define DBG_DISABLE_BGT 1 |
98 | #else | 104 | #else |
@@ -167,6 +173,7 @@ static inline int ubi_dbg_is_erase_failure(void) | |||
167 | #define ubi_dbg_is_bitflip() 0 | 173 | #define ubi_dbg_is_bitflip() 0 |
168 | #define ubi_dbg_is_write_failure() 0 | 174 | #define ubi_dbg_is_write_failure() 0 |
169 | #define ubi_dbg_is_erase_failure() 0 | 175 | #define ubi_dbg_is_erase_failure() 0 |
176 | #define ubi_dbg_check_all_ff(ubi, pnum, offset, len) 0 | ||
170 | 177 | ||
171 | #endif /* !CONFIG_MTD_UBI_DEBUG */ | 178 | #endif /* !CONFIG_MTD_UBI_DEBUG */ |
172 | #endif /* !__UBI_DEBUG_H__ */ | 179 | #endif /* !__UBI_DEBUG_H__ */ |
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index effaff28bab1..4cb69925d8d9 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -98,17 +98,12 @@ static int paranoid_check_ec_hdr(const struct ubi_device *ubi, int pnum, | |||
98 | static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum); | 98 | static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum); |
99 | static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum, | 99 | static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum, |
100 | const struct ubi_vid_hdr *vid_hdr); | 100 | const struct ubi_vid_hdr *vid_hdr); |
101 | static int paranoid_check_all_ff(struct ubi_device *ubi, int pnum, int offset, | ||
102 | int len); | ||
103 | static int paranoid_check_empty(struct ubi_device *ubi, int pnum); | ||
104 | #else | 101 | #else |
105 | #define paranoid_check_not_bad(ubi, pnum) 0 | 102 | #define paranoid_check_not_bad(ubi, pnum) 0 |
106 | #define paranoid_check_peb_ec_hdr(ubi, pnum) 0 | 103 | #define paranoid_check_peb_ec_hdr(ubi, pnum) 0 |
107 | #define paranoid_check_ec_hdr(ubi, pnum, ec_hdr) 0 | 104 | #define paranoid_check_ec_hdr(ubi, pnum, ec_hdr) 0 |
108 | #define paranoid_check_peb_vid_hdr(ubi, pnum) 0 | 105 | #define paranoid_check_peb_vid_hdr(ubi, pnum) 0 |
109 | #define paranoid_check_vid_hdr(ubi, pnum, vid_hdr) 0 | 106 | #define paranoid_check_vid_hdr(ubi, pnum, vid_hdr) 0 |
110 | #define paranoid_check_all_ff(ubi, pnum, offset, len) 0 | ||
111 | #define paranoid_check_empty(ubi, pnum) 0 | ||
112 | #endif | 107 | #endif |
113 | 108 | ||
114 | /** | 109 | /** |
@@ -244,7 +239,7 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, | |||
244 | return err > 0 ? -EINVAL : err; | 239 | return err > 0 ? -EINVAL : err; |
245 | 240 | ||
246 | /* The area we are writing to has to contain all 0xFF bytes */ | 241 | /* The area we are writing to has to contain all 0xFF bytes */ |
247 | err = paranoid_check_all_ff(ubi, pnum, offset, len); | 242 | err = ubi_dbg_check_all_ff(ubi, pnum, offset, len); |
248 | if (err) | 243 | if (err) |
249 | return err > 0 ? -EINVAL : err; | 244 | return err > 0 ? -EINVAL : err; |
250 | 245 | ||
@@ -271,8 +266,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, | |||
271 | addr = (loff_t)pnum * ubi->peb_size + offset; | 266 | addr = (loff_t)pnum * ubi->peb_size + offset; |
272 | err = ubi->mtd->write(ubi->mtd, addr, len, &written, buf); | 267 | err = ubi->mtd->write(ubi->mtd, addr, len, &written, buf); |
273 | if (err) { | 268 | if (err) { |
274 | ubi_err("error %d while writing %d bytes to PEB %d:%d, written" | 269 | ubi_err("error %d while writing %d bytes to PEB %d:%d, written " |
275 | " %zd bytes", err, len, pnum, offset, written); | 270 | "%zd bytes", err, len, pnum, offset, written); |
276 | ubi_dbg_dump_stack(); | 271 | ubi_dbg_dump_stack(); |
277 | } else | 272 | } else |
278 | ubi_assert(written == len); | 273 | ubi_assert(written == len); |
@@ -350,7 +345,7 @@ retry: | |||
350 | return -EIO; | 345 | return -EIO; |
351 | } | 346 | } |
352 | 347 | ||
353 | err = paranoid_check_all_ff(ubi, pnum, 0, ubi->peb_size); | 348 | err = ubi_dbg_check_all_ff(ubi, pnum, 0, ubi->peb_size); |
354 | if (err) | 349 | if (err) |
355 | return err > 0 ? -EINVAL : err; | 350 | return err > 0 ? -EINVAL : err; |
356 | 351 | ||
@@ -459,6 +454,54 @@ out: | |||
459 | } | 454 | } |
460 | 455 | ||
461 | /** | 456 | /** |
457 | * nor_erase_prepare - prepare a NOR flash PEB for erasure. | ||
458 | * @ubi: UBI device description object | ||
459 | * @pnum: physical eraseblock number to prepare | ||
460 | * | ||
461 | * NOR flash, or at least some of them, have peculiar embedded PEB erasure | ||
462 | * algorithm: the PEB is first filled with zeroes, then it is erased. And | ||
463 | * filling with zeroes starts from the end of the PEB. This was observed with | ||
464 | * Spansion S29GL512N NOR flash. | ||
465 | * | ||
466 | * This means that in case of a power cut we may end up with intact data at the | ||
467 | * beginning of the PEB, and all zeroes at the end of PEB. In other words, the | ||
468 | * EC and VID headers are OK, but a large chunk of data at the end of PEB is | ||
469 | * zeroed. This makes UBI mistakenly treat this PEB as used and associate it | ||
470 | * with an LEB, which leads to subsequent failures (e.g., UBIFS fails). | ||
471 | * | ||
472 | * This function is called before erasing NOR PEBs and it zeroes out EC and VID | ||
473 | * magic numbers in order to invalidate them and prevent the failures. Returns | ||
474 | * zero in case of success and a negative error code in case of failure. | ||
475 | */ | ||
476 | static int nor_erase_prepare(struct ubi_device *ubi, int pnum) | ||
477 | { | ||
478 | int err; | ||
479 | size_t written; | ||
480 | loff_t addr; | ||
481 | uint32_t data = 0; | ||
482 | |||
483 | addr = (loff_t)pnum * ubi->peb_size; | ||
484 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data); | ||
485 | if (err) { | ||
486 | ubi_err("error %d while writing 4 bytes to PEB %d:%d, written " | ||
487 | "%zd bytes", err, pnum, 0, written); | ||
488 | ubi_dbg_dump_stack(); | ||
489 | return err; | ||
490 | } | ||
491 | |||
492 | addr += ubi->vid_hdr_aloffset; | ||
493 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data); | ||
494 | if (err) { | ||
495 | ubi_err("error %d while writing 4 bytes to PEB %d:%d, written " | ||
496 | "%zd bytes", err, pnum, ubi->vid_hdr_aloffset, written); | ||
497 | ubi_dbg_dump_stack(); | ||
498 | return err; | ||
499 | } | ||
500 | |||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | /** | ||
462 | * ubi_io_sync_erase - synchronously erase a physical eraseblock. | 505 | * ubi_io_sync_erase - synchronously erase a physical eraseblock. |
463 | * @ubi: UBI device description object | 506 | * @ubi: UBI device description object |
464 | * @pnum: physical eraseblock number to erase | 507 | * @pnum: physical eraseblock number to erase |
@@ -489,6 +532,12 @@ int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture) | |||
489 | return -EROFS; | 532 | return -EROFS; |
490 | } | 533 | } |
491 | 534 | ||
535 | if (ubi->nor_flash) { | ||
536 | err = nor_erase_prepare(ubi, pnum); | ||
537 | if (err) | ||
538 | return err; | ||
539 | } | ||
540 | |||
492 | if (torture) { | 541 | if (torture) { |
493 | ret = torture_peb(ubi, pnum); | 542 | ret = torture_peb(ubi, pnum); |
494 | if (ret < 0) | 543 | if (ret < 0) |
@@ -672,11 +721,6 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
672 | if (read_err != -EBADMSG && | 721 | if (read_err != -EBADMSG && |
673 | check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { | 722 | check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { |
674 | /* The physical eraseblock is supposedly empty */ | 723 | /* The physical eraseblock is supposedly empty */ |
675 | err = paranoid_check_all_ff(ubi, pnum, 0, | ||
676 | ubi->peb_size); | ||
677 | if (err) | ||
678 | return err > 0 ? UBI_IO_BAD_EC_HDR : err; | ||
679 | |||
680 | if (verbose) | 724 | if (verbose) |
681 | ubi_warn("no EC header found at PEB %d, " | 725 | ubi_warn("no EC header found at PEB %d, " |
682 | "only 0xFF bytes", pnum); | 726 | "only 0xFF bytes", pnum); |
@@ -752,6 +796,7 @@ int ubi_io_write_ec_hdr(struct ubi_device *ubi, int pnum, | |||
752 | ec_hdr->version = UBI_VERSION; | 796 | ec_hdr->version = UBI_VERSION; |
753 | ec_hdr->vid_hdr_offset = cpu_to_be32(ubi->vid_hdr_offset); | 797 | ec_hdr->vid_hdr_offset = cpu_to_be32(ubi->vid_hdr_offset); |
754 | ec_hdr->data_offset = cpu_to_be32(ubi->leb_start); | 798 | ec_hdr->data_offset = cpu_to_be32(ubi->leb_start); |
799 | ec_hdr->image_seq = cpu_to_be32(ubi->image_seq); | ||
755 | crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC); | 800 | crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC); |
756 | ec_hdr->hdr_crc = cpu_to_be32(crc); | 801 | ec_hdr->hdr_crc = cpu_to_be32(crc); |
757 | 802 | ||
@@ -947,15 +992,6 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
947 | if (read_err != -EBADMSG && | 992 | if (read_err != -EBADMSG && |
948 | check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { | 993 | check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { |
949 | /* The physical eraseblock is supposedly free */ | 994 | /* The physical eraseblock is supposedly free */ |
950 | |||
951 | /* | ||
952 | * The below is just a paranoid check, it has to be | ||
953 | * compiled out if paranoid checks are disabled. | ||
954 | */ | ||
955 | err = paranoid_check_empty(ubi, pnum); | ||
956 | if (err) | ||
957 | return err > 0 ? UBI_IO_BAD_VID_HDR : err; | ||
958 | |||
959 | if (verbose) | 995 | if (verbose) |
960 | ubi_warn("no VID header found at PEB %d, " | 996 | ubi_warn("no VID header found at PEB %d, " |
961 | "only 0xFF bytes", pnum); | 997 | "only 0xFF bytes", pnum); |
@@ -1229,7 +1265,7 @@ exit: | |||
1229 | } | 1265 | } |
1230 | 1266 | ||
1231 | /** | 1267 | /** |
1232 | * paranoid_check_all_ff - check that a region of flash is empty. | 1268 | * ubi_dbg_check_all_ff - check that a region of flash is empty. |
1233 | * @ubi: UBI device description object | 1269 | * @ubi: UBI device description object |
1234 | * @pnum: the physical eraseblock number to check | 1270 | * @pnum: the physical eraseblock number to check |
1235 | * @offset: the starting offset within the physical eraseblock to check | 1271 | * @offset: the starting offset within the physical eraseblock to check |
@@ -1239,8 +1275,7 @@ exit: | |||
1239 | * @offset of the physical eraseblock @pnum, %1 if not, and a negative error | 1275 | * @offset of the physical eraseblock @pnum, %1 if not, and a negative error |
1240 | * code if an error occurred. | 1276 | * code if an error occurred. |
1241 | */ | 1277 | */ |
1242 | static int paranoid_check_all_ff(struct ubi_device *ubi, int pnum, int offset, | 1278 | int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len) |
1243 | int len) | ||
1244 | { | 1279 | { |
1245 | size_t read; | 1280 | size_t read; |
1246 | int err; | 1281 | int err; |
@@ -1276,74 +1311,4 @@ error: | |||
1276 | return err; | 1311 | return err; |
1277 | } | 1312 | } |
1278 | 1313 | ||
1279 | /** | ||
1280 | * paranoid_check_empty - whether a PEB is empty. | ||
1281 | * @ubi: UBI device description object | ||
1282 | * @pnum: the physical eraseblock number to check | ||
1283 | * | ||
1284 | * This function makes sure PEB @pnum is empty, which means it contains only | ||
1285 | * %0xFF data bytes. Returns zero if the PEB is empty, %1 if not, and a | ||
1286 | * negative error code in case of failure. | ||
1287 | * | ||
1288 | * Empty PEBs have the EC header, and do not have the VID header. The caller of | ||
1289 | * this function should have already made sure the PEB does not have the VID | ||
1290 | * header. However, this function re-checks that, because it is possible that | ||
1291 | * the header and data has already been written to the PEB. | ||
1292 | * | ||
1293 | * Let's consider a possible scenario. Suppose there are 2 tasks - A and B. | ||
1294 | * Task A is in 'wear_leveling_worker()'. It is reading VID header of PEB X to | ||
1295 | * find which LEB it corresponds to. PEB X is currently unmapped, and has no | ||
1296 | * VID header. Task B is trying to write to PEB X. | ||
1297 | * | ||
1298 | * Task A: in 'ubi_io_read_vid_hdr()': reads the VID header from PEB X. The | ||
1299 | * read data contain all 0xFF bytes; | ||
1300 | * Task B: writes VID header and some data to PEB X; | ||
1301 | * Task A: assumes PEB X is empty, calls 'paranoid_check_empty()'. And if we | ||
1302 | * do not re-read the VID header, and do not cancel the checking if it | ||
1303 | * is there, we fail. | ||
1304 | */ | ||
1305 | static int paranoid_check_empty(struct ubi_device *ubi, int pnum) | ||
1306 | { | ||
1307 | int err, offs = ubi->vid_hdr_aloffset, len = ubi->vid_hdr_alsize; | ||
1308 | size_t read; | ||
1309 | uint32_t magic; | ||
1310 | const struct ubi_vid_hdr *vid_hdr; | ||
1311 | |||
1312 | mutex_lock(&ubi->dbg_buf_mutex); | ||
1313 | err = ubi->mtd->read(ubi->mtd, offs, len, &read, ubi->dbg_peb_buf); | ||
1314 | if (err && err != -EUCLEAN) { | ||
1315 | ubi_err("error %d while reading %d bytes from PEB %d:%d, " | ||
1316 | "read %zd bytes", err, len, pnum, offs, read); | ||
1317 | goto error; | ||
1318 | } | ||
1319 | |||
1320 | vid_hdr = ubi->dbg_peb_buf; | ||
1321 | magic = be32_to_cpu(vid_hdr->magic); | ||
1322 | if (magic == UBI_VID_HDR_MAGIC) | ||
1323 | /* The PEB contains VID header, so it is not empty */ | ||
1324 | goto out; | ||
1325 | |||
1326 | err = check_pattern(ubi->dbg_peb_buf, 0xFF, len); | ||
1327 | if (err == 0) { | ||
1328 | ubi_err("flash region at PEB %d:%d, length %d does not " | ||
1329 | "contain all 0xFF bytes", pnum, offs, len); | ||
1330 | goto fail; | ||
1331 | } | ||
1332 | |||
1333 | out: | ||
1334 | mutex_unlock(&ubi->dbg_buf_mutex); | ||
1335 | return 0; | ||
1336 | |||
1337 | fail: | ||
1338 | ubi_err("paranoid check failed for PEB %d", pnum); | ||
1339 | ubi_msg("hex dump of the %d-%d region", offs, offs + len); | ||
1340 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, | ||
1341 | ubi->dbg_peb_buf, len, 1); | ||
1342 | err = 1; | ||
1343 | error: | ||
1344 | ubi_dbg_dump_stack(); | ||
1345 | mutex_unlock(&ubi->dbg_buf_mutex); | ||
1346 | return err; | ||
1347 | } | ||
1348 | |||
1349 | #endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ | 1314 | #endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index c3d653ba5ca0..f60895ee0aeb 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -757,6 +757,8 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
757 | si->is_empty = 0; | 757 | si->is_empty = 0; |
758 | 758 | ||
759 | if (!ec_corr) { | 759 | if (!ec_corr) { |
760 | int image_seq; | ||
761 | |||
760 | /* Make sure UBI version is OK */ | 762 | /* Make sure UBI version is OK */ |
761 | if (ech->version != UBI_VERSION) { | 763 | if (ech->version != UBI_VERSION) { |
762 | ubi_err("this UBI version is %d, image version is %d", | 764 | ubi_err("this UBI version is %d, image version is %d", |
@@ -778,6 +780,18 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
778 | ubi_dbg_dump_ec_hdr(ech); | 780 | ubi_dbg_dump_ec_hdr(ech); |
779 | return -EINVAL; | 781 | return -EINVAL; |
780 | } | 782 | } |
783 | |||
784 | image_seq = be32_to_cpu(ech->ec); | ||
785 | if (!si->image_seq_set) { | ||
786 | ubi->image_seq = image_seq; | ||
787 | si->image_seq_set = 1; | ||
788 | } else if (ubi->image_seq != image_seq) { | ||
789 | ubi_err("bad image sequence number %d in PEB %d, " | ||
790 | "expected %d", image_seq, pnum, ubi->image_seq); | ||
791 | ubi_dbg_dump_ec_hdr(ech); | ||
792 | return -EINVAL; | ||
793 | } | ||
794 | |||
781 | } | 795 | } |
782 | 796 | ||
783 | /* OK, we've done with the EC header, let's look at the VID header */ | 797 | /* OK, we've done with the EC header, let's look at the VID header */ |
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h index 61df208e2f20..1017cf12def5 100644 --- a/drivers/mtd/ubi/scan.h +++ b/drivers/mtd/ubi/scan.h | |||
@@ -102,6 +102,7 @@ struct ubi_scan_volume { | |||
102 | * @mean_ec: mean erase counter value | 102 | * @mean_ec: mean erase counter value |
103 | * @ec_sum: a temporary variable used when calculating @mean_ec | 103 | * @ec_sum: a temporary variable used when calculating @mean_ec |
104 | * @ec_count: a temporary variable used when calculating @mean_ec | 104 | * @ec_count: a temporary variable used when calculating @mean_ec |
105 | * @image_seq_set: indicates @ubi->image_seq is known | ||
105 | * | 106 | * |
106 | * This data structure contains the result of scanning and may be used by other | 107 | * This data structure contains the result of scanning and may be used by other |
107 | * UBI sub-systems to build final UBI data structures, further error-recovery | 108 | * UBI sub-systems to build final UBI data structures, further error-recovery |
@@ -124,6 +125,7 @@ struct ubi_scan_info { | |||
124 | int mean_ec; | 125 | int mean_ec; |
125 | uint64_t ec_sum; | 126 | uint64_t ec_sum; |
126 | int ec_count; | 127 | int ec_count; |
128 | int image_seq_set; | ||
127 | }; | 129 | }; |
128 | 130 | ||
129 | struct ubi_device; | 131 | struct ubi_device; |
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h index 8419fdccc79c..503ea9b27309 100644 --- a/drivers/mtd/ubi/ubi-media.h +++ b/drivers/mtd/ubi/ubi-media.h | |||
@@ -129,6 +129,7 @@ enum { | |||
129 | * @ec: the erase counter | 129 | * @ec: the erase counter |
130 | * @vid_hdr_offset: where the VID header starts | 130 | * @vid_hdr_offset: where the VID header starts |
131 | * @data_offset: where the user data start | 131 | * @data_offset: where the user data start |
132 | * @image_seq: image sequence number | ||
132 | * @padding2: reserved for future, zeroes | 133 | * @padding2: reserved for future, zeroes |
133 | * @hdr_crc: erase counter header CRC checksum | 134 | * @hdr_crc: erase counter header CRC checksum |
134 | * | 135 | * |
@@ -144,6 +145,14 @@ enum { | |||
144 | * volume identifier header and user data, relative to the beginning of the | 145 | * volume identifier header and user data, relative to the beginning of the |
145 | * physical eraseblock. These values have to be the same for all physical | 146 | * physical eraseblock. These values have to be the same for all physical |
146 | * eraseblocks. | 147 | * eraseblocks. |
148 | * | ||
149 | * The @image_seq field is used to validate a UBI image that has been prepared | ||
150 | * for a UBI device. The @image_seq value can be any value, but it must be the | ||
151 | * same on all eraseblocks. UBI will ensure that all new erase counter headers | ||
152 | * also contain this value, and will check the value when scanning at start-up. | ||
153 | * One way to make use of @image_seq is to increase its value by one every time | ||
154 | * an image is flashed over an existing image, then, if the flashing does not | ||
155 | * complete, UBI will detect the error when scanning. | ||
147 | */ | 156 | */ |
148 | struct ubi_ec_hdr { | 157 | struct ubi_ec_hdr { |
149 | __be32 magic; | 158 | __be32 magic; |
@@ -152,7 +161,8 @@ struct ubi_ec_hdr { | |||
152 | __be64 ec; /* Warning: the current limit is 31-bit anyway! */ | 161 | __be64 ec; /* Warning: the current limit is 31-bit anyway! */ |
153 | __be32 vid_hdr_offset; | 162 | __be32 vid_hdr_offset; |
154 | __be32 data_offset; | 163 | __be32 data_offset; |
155 | __u8 padding2[36]; | 164 | __be32 image_seq; |
165 | __u8 padding2[32]; | ||
156 | __be32 hdr_crc; | 166 | __be32 hdr_crc; |
157 | } __attribute__ ((packed)); | 167 | } __attribute__ ((packed)); |
158 | 168 | ||
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 28acd133c997..6a5fe9633783 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -301,6 +301,7 @@ struct ubi_wl_entry; | |||
301 | * @vol->readers, @vol->writers, @vol->exclusive, | 301 | * @vol->readers, @vol->writers, @vol->exclusive, |
302 | * @vol->ref_count, @vol->mapping and @vol->eba_tbl. | 302 | * @vol->ref_count, @vol->mapping and @vol->eba_tbl. |
303 | * @ref_count: count of references on the UBI device | 303 | * @ref_count: count of references on the UBI device |
304 | * @image_seq: image sequence number recorded on EC headers | ||
304 | * | 305 | * |
305 | * @rsvd_pebs: count of reserved physical eraseblocks | 306 | * @rsvd_pebs: count of reserved physical eraseblocks |
306 | * @avail_pebs: count of available physical eraseblocks | 307 | * @avail_pebs: count of available physical eraseblocks |
@@ -372,6 +373,7 @@ struct ubi_wl_entry; | |||
372 | * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset | 373 | * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset |
373 | * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or | 374 | * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or |
374 | * not | 375 | * not |
376 | * @nor_flash: non-zero if working on top of NOR flash | ||
375 | * @mtd: MTD device descriptor | 377 | * @mtd: MTD device descriptor |
376 | * | 378 | * |
377 | * @peb_buf1: a buffer of PEB size used for different purposes | 379 | * @peb_buf1: a buffer of PEB size used for different purposes |
@@ -390,6 +392,7 @@ struct ubi_device { | |||
390 | struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT]; | 392 | struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT]; |
391 | spinlock_t volumes_lock; | 393 | spinlock_t volumes_lock; |
392 | int ref_count; | 394 | int ref_count; |
395 | int image_seq; | ||
393 | 396 | ||
394 | int rsvd_pebs; | 397 | int rsvd_pebs; |
395 | int avail_pebs; | 398 | int avail_pebs; |
@@ -452,7 +455,8 @@ struct ubi_device { | |||
452 | int vid_hdr_offset; | 455 | int vid_hdr_offset; |
453 | int vid_hdr_aloffset; | 456 | int vid_hdr_aloffset; |
454 | int vid_hdr_shift; | 457 | int vid_hdr_shift; |
455 | int bad_allowed; | 458 | unsigned int bad_allowed:1; |
459 | unsigned int nor_flash:1; | ||
456 | struct mtd_info *mtd; | 460 | struct mtd_info *mtd; |
457 | 461 | ||
458 | void *peb_buf1; | 462 | void *peb_buf1; |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 2b2472300610..600c7229d5cf 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -459,6 +459,14 @@ retry: | |||
459 | dbg_wl("PEB %d EC %d", e->pnum, e->ec); | 459 | dbg_wl("PEB %d EC %d", e->pnum, e->ec); |
460 | prot_queue_add(ubi, e); | 460 | prot_queue_add(ubi, e); |
461 | spin_unlock(&ubi->wl_lock); | 461 | spin_unlock(&ubi->wl_lock); |
462 | |||
463 | err = ubi_dbg_check_all_ff(ubi, e->pnum, ubi->vid_hdr_aloffset, | ||
464 | ubi->peb_size - ubi->vid_hdr_aloffset); | ||
465 | if (err) { | ||
466 | ubi_err("new PEB %d does not contain all 0xFF bytes", e->pnum); | ||
467 | return err > 0 ? -EINVAL : err; | ||
468 | } | ||
469 | |||
462 | return e->pnum; | 470 | return e->pnum; |
463 | } | 471 | } |
464 | 472 | ||
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 8ae72ec14456..0e2ba21d4441 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -908,6 +908,7 @@ static const struct net_device_ops rtl8139_netdev_ops = { | |||
908 | .ndo_open = rtl8139_open, | 908 | .ndo_open = rtl8139_open, |
909 | .ndo_stop = rtl8139_close, | 909 | .ndo_stop = rtl8139_close, |
910 | .ndo_get_stats = rtl8139_get_stats, | 910 | .ndo_get_stats = rtl8139_get_stats, |
911 | .ndo_change_mtu = eth_change_mtu, | ||
911 | .ndo_validate_addr = eth_validate_addr, | 912 | .ndo_validate_addr = eth_validate_addr, |
912 | .ndo_set_mac_address = rtl8139_set_mac_address, | 913 | .ndo_set_mac_address = rtl8139_set_mac_address, |
913 | .ndo_start_xmit = rtl8139_start_xmit, | 914 | .ndo_start_xmit = rtl8139_start_xmit, |
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c index 6f42ad728915..3fe09876e76d 100644 --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c | |||
@@ -1142,7 +1142,9 @@ static const struct net_device_ops ixp4xx_netdev_ops = { | |||
1142 | .ndo_start_xmit = eth_xmit, | 1142 | .ndo_start_xmit = eth_xmit, |
1143 | .ndo_set_multicast_list = eth_set_mcast_list, | 1143 | .ndo_set_multicast_list = eth_set_mcast_list, |
1144 | .ndo_do_ioctl = eth_ioctl, | 1144 | .ndo_do_ioctl = eth_ioctl, |
1145 | 1145 | .ndo_change_mtu = eth_change_mtu, | |
1146 | .ndo_set_mac_address = eth_mac_addr, | ||
1147 | .ndo_validate_addr = eth_validate_addr, | ||
1146 | }; | 1148 | }; |
1147 | 1149 | ||
1148 | static int __devinit eth_init_one(struct platform_device *pdev) | 1150 | static int __devinit eth_init_one(struct platform_device *pdev) |
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index c734b1983ec1..204db961029e 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -2071,7 +2071,7 @@ static int atl2_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
2071 | if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)) | 2071 | if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)) |
2072 | return -EOPNOTSUPP; | 2072 | return -EOPNOTSUPP; |
2073 | 2073 | ||
2074 | if (wol->wolopts & (WAKE_MCAST|WAKE_BCAST|WAKE_MCAST)) | 2074 | if (wol->wolopts & (WAKE_UCAST | WAKE_BCAST | WAKE_MCAST)) |
2075 | return -EOPNOTSUPP; | 2075 | return -EOPNOTSUPP; |
2076 | 2076 | ||
2077 | /* these settings will always override what we currently have */ | 2077 | /* these settings will always override what we currently have */ |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index a76315dc7767..206144f2470f 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -431,7 +431,7 @@ bmac_init_phy(struct net_device *dev) | |||
431 | printk(KERN_DEBUG); | 431 | printk(KERN_DEBUG); |
432 | printk(KERN_CONT " %.4x", bmac_mif_read(dev, addr)); | 432 | printk(KERN_CONT " %.4x", bmac_mif_read(dev, addr)); |
433 | } | 433 | } |
434 | print(KERN_CONT "\n"); | 434 | printk(KERN_CONT "\n"); |
435 | 435 | ||
436 | if (bp->is_bmac_plus) { | 436 | if (bp->is_bmac_plus) { |
437 | unsigned int capable, ctrl; | 437 | unsigned int capable, ctrl; |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 3eee666a9cd2..55445f980f9c 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1524,6 +1524,7 @@ static void net_timeout(struct net_device *dev) | |||
1524 | static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | 1524 | static int net_send_packet(struct sk_buff *skb, struct net_device *dev) |
1525 | { | 1525 | { |
1526 | struct net_local *lp = netdev_priv(dev); | 1526 | struct net_local *lp = netdev_priv(dev); |
1527 | unsigned long flags; | ||
1527 | 1528 | ||
1528 | if (net_debug > 3) { | 1529 | if (net_debug > 3) { |
1529 | printk("%s: sent %d byte packet of type %x\n", | 1530 | printk("%s: sent %d byte packet of type %x\n", |
@@ -1535,7 +1536,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1535 | ask the chip to start transmitting before the | 1536 | ask the chip to start transmitting before the |
1536 | whole packet has been completely uploaded. */ | 1537 | whole packet has been completely uploaded. */ |
1537 | 1538 | ||
1538 | spin_lock_irq(&lp->lock); | 1539 | spin_lock_irqsave(&lp->lock, flags); |
1539 | netif_stop_queue(dev); | 1540 | netif_stop_queue(dev); |
1540 | 1541 | ||
1541 | /* initiate a transmit sequence */ | 1542 | /* initiate a transmit sequence */ |
@@ -1549,13 +1550,13 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1549 | * we're waiting for TxOk, so return 1 and requeue this packet. | 1550 | * we're waiting for TxOk, so return 1 and requeue this packet. |
1550 | */ | 1551 | */ |
1551 | 1552 | ||
1552 | spin_unlock_irq(&lp->lock); | 1553 | spin_unlock_irqrestore(&lp->lock, flags); |
1553 | if (net_debug) printk("cs89x0: Tx buffer not free!\n"); | 1554 | if (net_debug) printk("cs89x0: Tx buffer not free!\n"); |
1554 | return NETDEV_TX_BUSY; | 1555 | return NETDEV_TX_BUSY; |
1555 | } | 1556 | } |
1556 | /* Write the contents of the packet */ | 1557 | /* Write the contents of the packet */ |
1557 | writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); | 1558 | writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); |
1558 | spin_unlock_irq(&lp->lock); | 1559 | spin_unlock_irqrestore(&lp->lock, flags); |
1559 | lp->stats.tx_bytes += skb->len; | 1560 | lp->stats.tx_bytes += skb->len; |
1560 | dev->trans_start = jiffies; | 1561 | dev->trans_start = jiffies; |
1561 | dev_kfree_skb (skb); | 1562 | dev_kfree_skb (skb); |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 538dda4422dc..fb5df5c6203e 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -642,8 +642,7 @@ static int setup_sge_qsets(struct adapter *adap) | |||
642 | struct port_info *pi = netdev_priv(dev); | 642 | struct port_info *pi = netdev_priv(dev); |
643 | 643 | ||
644 | pi->qs = &adap->sge.qs[pi->first_qset]; | 644 | pi->qs = &adap->sge.qs[pi->first_qset]; |
645 | for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; | 645 | for (j = 0; j < pi->nqsets; ++j, ++qset_idx) { |
646 | ++j, ++qset_idx) { | ||
647 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); | 646 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); |
648 | err = t3_sge_alloc_qset(adap, qset_idx, 1, | 647 | err = t3_sge_alloc_qset(adap, qset_idx, 1, |
649 | (adap->flags & USING_MSIX) ? qset_idx + 1 : | 648 | (adap->flags & USING_MSIX) ? qset_idx + 1 : |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 2df8fb0af701..12fd446f9895 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1820,11 +1820,19 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr) | |||
1820 | struct device *emac_dev = &priv->ndev->dev; | 1820 | struct device *emac_dev = &priv->ndev->dev; |
1821 | struct sockaddr *sa = addr; | 1821 | struct sockaddr *sa = addr; |
1822 | 1822 | ||
1823 | if (!is_valid_ether_addr(sa->sa_data)) | ||
1824 | return -EINVAL; | ||
1825 | |||
1823 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ | 1826 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ |
1824 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); | 1827 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); |
1825 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1826 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); | 1828 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); |
1827 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | 1829 | |
1830 | /* If the interface is down - rxch is NULL. */ | ||
1831 | /* MAC address is configured only after the interface is enabled. */ | ||
1832 | if (netif_running(ndev)) { | ||
1833 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1834 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | ||
1835 | } | ||
1828 | 1836 | ||
1829 | if (netif_msg_drv(priv)) | 1837 | if (netif_msg_drv(priv)) |
1830 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", | 1838 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 147c4b088fb3..e8d46cc1bec2 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -3080,7 +3080,9 @@ static const struct net_device_ops ehea_netdev_ops = { | |||
3080 | .ndo_poll_controller = ehea_netpoll, | 3080 | .ndo_poll_controller = ehea_netpoll, |
3081 | #endif | 3081 | #endif |
3082 | .ndo_get_stats = ehea_get_stats, | 3082 | .ndo_get_stats = ehea_get_stats, |
3083 | .ndo_change_mtu = eth_change_mtu, | ||
3083 | .ndo_set_mac_address = ehea_set_mac_addr, | 3084 | .ndo_set_mac_address = ehea_set_mac_addr, |
3085 | .ndo_validate_addr = eth_validate_addr, | ||
3084 | .ndo_set_multicast_list = ehea_set_multicast_list, | 3086 | .ndo_set_multicast_list = ehea_set_multicast_list, |
3085 | .ndo_change_mtu = ehea_change_mtu, | 3087 | .ndo_change_mtu = ehea_change_mtu, |
3086 | .ndo_vlan_rx_register = ehea_vlan_rx_register, | 3088 | .ndo_vlan_rx_register = ehea_vlan_rx_register, |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 0f19b743749b..d4b98074b1b7 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -1642,6 +1642,7 @@ static const struct net_device_ops fec_netdev_ops = { | |||
1642 | .ndo_stop = fec_enet_close, | 1642 | .ndo_stop = fec_enet_close, |
1643 | .ndo_start_xmit = fec_enet_start_xmit, | 1643 | .ndo_start_xmit = fec_enet_start_xmit, |
1644 | .ndo_set_multicast_list = set_multicast_list, | 1644 | .ndo_set_multicast_list = set_multicast_list, |
1645 | .ndo_change_mtu = eth_change_mtu, | ||
1645 | .ndo_validate_addr = eth_validate_addr, | 1646 | .ndo_validate_addr = eth_validate_addr, |
1646 | .ndo_tx_timeout = fec_timeout, | 1647 | .ndo_tx_timeout = fec_timeout, |
1647 | .ndo_set_mac_address = fec_set_mac_address, | 1648 | .ndo_set_mac_address = fec_set_mac_address, |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index 30b7dd671336..cc47f3f057c7 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -46,12 +46,12 @@ | |||
46 | 46 | ||
47 | #else | 47 | #else |
48 | 48 | ||
49 | #define FEC_ECNTRL; 0x000 /* Ethernet control reg */ | 49 | #define FEC_ECNTRL 0x000 /* Ethernet control reg */ |
50 | #define FEC_IEVENT; 0x004 /* Interrupt even reg */ | 50 | #define FEC_IEVENT 0x004 /* Interrupt even reg */ |
51 | #define FEC_IMASK; 0x008 /* Interrupt mask reg */ | 51 | #define FEC_IMASK 0x008 /* Interrupt mask reg */ |
52 | #define FEC_IVEC; 0x00c /* Interrupt vec status reg */ | 52 | #define FEC_IVEC 0x00c /* Interrupt vec status reg */ |
53 | #define FEC_R_DES_ACTIVE; 0x010 /* Receive descriptor reg */ | 53 | #define FEC_R_DES_ACTIVE 0x010 /* Receive descriptor reg */ |
54 | #define FEC_X_DES_ACTIVE; 0x01c /* Transmit descriptor reg */ | 54 | #define FEC_X_DES_ACTIVE 0x014 /* Transmit descriptor reg */ |
55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ | 55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ |
56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ | 56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ |
57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ | 57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 4ae1d259fced..43d813ed9f45 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -156,6 +156,8 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
156 | .ndo_tx_timeout = gfar_timeout, | 156 | .ndo_tx_timeout = gfar_timeout, |
157 | .ndo_do_ioctl = gfar_ioctl, | 157 | .ndo_do_ioctl = gfar_ioctl, |
158 | .ndo_vlan_rx_register = gfar_vlan_rx_register, | 158 | .ndo_vlan_rx_register = gfar_vlan_rx_register, |
159 | .ndo_set_mac_address = eth_mac_addr, | ||
160 | .ndo_validate_addr = eth_validate_addr, | ||
159 | #ifdef CONFIG_NET_POLL_CONTROLLER | 161 | #ifdef CONFIG_NET_POLL_CONTROLLER |
160 | .ndo_poll_controller = gfar_netpoll, | 162 | .ndo_poll_controller = gfar_netpoll, |
161 | #endif | 163 | #endif |
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index efd9be214885..ac28dd5a4fd1 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -190,6 +190,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
190 | phy->ops.write_reg = igb_write_phy_reg_igp; | 190 | phy->ops.write_reg = igb_write_phy_reg_igp; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* set lan id */ | ||
194 | hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >> | ||
195 | E1000_STATUS_FUNC_SHIFT; | ||
196 | |||
193 | /* Set phy->phy_addr and phy->id. */ | 197 | /* Set phy->phy_addr and phy->id. */ |
194 | ret_val = igb_get_phy_id_82575(hw); | 198 | ret_val = igb_get_phy_id_82575(hw); |
195 | if (ret_val) | 199 | if (ret_val) |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index be480292aba1..adb09d32625d 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -127,14 +127,48 @@ static void igb_restore_vlan(struct igb_adapter *); | |||
127 | static void igb_ping_all_vfs(struct igb_adapter *); | 127 | static void igb_ping_all_vfs(struct igb_adapter *); |
128 | static void igb_msg_task(struct igb_adapter *); | 128 | static void igb_msg_task(struct igb_adapter *); |
129 | static int igb_rcv_msg_from_vf(struct igb_adapter *, u32); | 129 | static int igb_rcv_msg_from_vf(struct igb_adapter *, u32); |
130 | static inline void igb_set_rah_pool(struct e1000_hw *, int , int); | ||
131 | static void igb_set_mc_list_pools(struct igb_adapter *, int, u16); | 130 | static void igb_set_mc_list_pools(struct igb_adapter *, int, u16); |
132 | static void igb_vmm_control(struct igb_adapter *); | 131 | static void igb_vmm_control(struct igb_adapter *); |
133 | static inline void igb_set_vmolr(struct e1000_hw *, int); | ||
134 | static inline int igb_set_vf_rlpml(struct igb_adapter *, int, int); | ||
135 | static int igb_set_vf_mac(struct igb_adapter *adapter, int, unsigned char *); | 132 | static int igb_set_vf_mac(struct igb_adapter *adapter, int, unsigned char *); |
136 | static void igb_restore_vf_multicasts(struct igb_adapter *adapter); | 133 | static void igb_restore_vf_multicasts(struct igb_adapter *adapter); |
137 | 134 | ||
135 | static inline void igb_set_vmolr(struct e1000_hw *hw, int vfn) | ||
136 | { | ||
137 | u32 reg_data; | ||
138 | |||
139 | reg_data = rd32(E1000_VMOLR(vfn)); | ||
140 | reg_data |= E1000_VMOLR_BAM | /* Accept broadcast */ | ||
141 | E1000_VMOLR_ROPE | /* Accept packets matched in UTA */ | ||
142 | E1000_VMOLR_ROMPE | /* Accept packets matched in MTA */ | ||
143 | E1000_VMOLR_AUPE | /* Accept untagged packets */ | ||
144 | E1000_VMOLR_STRVLAN; /* Strip vlan tags */ | ||
145 | wr32(E1000_VMOLR(vfn), reg_data); | ||
146 | } | ||
147 | |||
148 | static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, | ||
149 | int vfn) | ||
150 | { | ||
151 | struct e1000_hw *hw = &adapter->hw; | ||
152 | u32 vmolr; | ||
153 | |||
154 | vmolr = rd32(E1000_VMOLR(vfn)); | ||
155 | vmolr &= ~E1000_VMOLR_RLPML_MASK; | ||
156 | vmolr |= size | E1000_VMOLR_LPE; | ||
157 | wr32(E1000_VMOLR(vfn), vmolr); | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static inline void igb_set_rah_pool(struct e1000_hw *hw, int pool, int entry) | ||
163 | { | ||
164 | u32 reg_data; | ||
165 | |||
166 | reg_data = rd32(E1000_RAH(entry)); | ||
167 | reg_data &= ~E1000_RAH_POOL_MASK; | ||
168 | reg_data |= E1000_RAH_POOL_1 << pool;; | ||
169 | wr32(E1000_RAH(entry), reg_data); | ||
170 | } | ||
171 | |||
138 | #ifdef CONFIG_PM | 172 | #ifdef CONFIG_PM |
139 | static int igb_suspend(struct pci_dev *, pm_message_t); | 173 | static int igb_suspend(struct pci_dev *, pm_message_t); |
140 | static int igb_resume(struct pci_dev *); | 174 | static int igb_resume(struct pci_dev *); |
@@ -5418,43 +5452,6 @@ static void igb_io_resume(struct pci_dev *pdev) | |||
5418 | igb_get_hw_control(adapter); | 5452 | igb_get_hw_control(adapter); |
5419 | } | 5453 | } |
5420 | 5454 | ||
5421 | static inline void igb_set_vmolr(struct e1000_hw *hw, int vfn) | ||
5422 | { | ||
5423 | u32 reg_data; | ||
5424 | |||
5425 | reg_data = rd32(E1000_VMOLR(vfn)); | ||
5426 | reg_data |= E1000_VMOLR_BAM | /* Accept broadcast */ | ||
5427 | E1000_VMOLR_ROPE | /* Accept packets matched in UTA */ | ||
5428 | E1000_VMOLR_ROMPE | /* Accept packets matched in MTA */ | ||
5429 | E1000_VMOLR_AUPE | /* Accept untagged packets */ | ||
5430 | E1000_VMOLR_STRVLAN; /* Strip vlan tags */ | ||
5431 | wr32(E1000_VMOLR(vfn), reg_data); | ||
5432 | } | ||
5433 | |||
5434 | static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, | ||
5435 | int vfn) | ||
5436 | { | ||
5437 | struct e1000_hw *hw = &adapter->hw; | ||
5438 | u32 vmolr; | ||
5439 | |||
5440 | vmolr = rd32(E1000_VMOLR(vfn)); | ||
5441 | vmolr &= ~E1000_VMOLR_RLPML_MASK; | ||
5442 | vmolr |= size | E1000_VMOLR_LPE; | ||
5443 | wr32(E1000_VMOLR(vfn), vmolr); | ||
5444 | |||
5445 | return 0; | ||
5446 | } | ||
5447 | |||
5448 | static inline void igb_set_rah_pool(struct e1000_hw *hw, int pool, int entry) | ||
5449 | { | ||
5450 | u32 reg_data; | ||
5451 | |||
5452 | reg_data = rd32(E1000_RAH(entry)); | ||
5453 | reg_data &= ~E1000_RAH_POOL_MASK; | ||
5454 | reg_data |= E1000_RAH_POOL_1 << pool;; | ||
5455 | wr32(E1000_RAH(entry), reg_data); | ||
5456 | } | ||
5457 | |||
5458 | static void igb_set_mc_list_pools(struct igb_adapter *adapter, | 5455 | static void igb_set_mc_list_pools(struct igb_adapter *adapter, |
5459 | int entry_count, u16 total_rar_filters) | 5456 | int entry_count, u16 total_rar_filters) |
5460 | { | 5457 | { |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index d53aa9582137..20f9bc626688 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/tty.h> | 31 | #include <linux/tty.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
36 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
37 | 36 | ||
diff --git a/drivers/net/isa-skeleton.c b/drivers/net/isa-skeleton.c index 73585fd8f29f..d12377b84358 100644 --- a/drivers/net/isa-skeleton.c +++ b/drivers/net/isa-skeleton.c | |||
@@ -430,7 +430,8 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
430 | * hardware interrupt handler. Queue flow control is | 430 | * hardware interrupt handler. Queue flow control is |
431 | * thus managed under this lock as well. | 431 | * thus managed under this lock as well. |
432 | */ | 432 | */ |
433 | spin_lock_irq(&np->lock); | 433 | unsigned long flags; |
434 | spin_lock_irqsave(&np->lock, flags); | ||
434 | 435 | ||
435 | add_to_tx_ring(np, skb, length); | 436 | add_to_tx_ring(np, skb, length); |
436 | dev->trans_start = jiffies; | 437 | dev->trans_start = jiffies; |
@@ -446,7 +447,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
446 | * is when the transmit statistics are updated. | 447 | * is when the transmit statistics are updated. |
447 | */ | 448 | */ |
448 | 449 | ||
449 | spin_unlock_irq(&np->lock); | 450 | spin_unlock_irqrestore(&np->lock, flags); |
450 | #else | 451 | #else |
451 | /* This is the case for older hardware which takes | 452 | /* This is the case for older hardware which takes |
452 | * a single transmit buffer at a time, and it is | 453 | * a single transmit buffer at a time, and it is |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index d56890f5c9d5..7c5978ad929a 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -138,6 +138,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
138 | adapter->hw.fc.requested_mode = ixgbe_fc_none; | 138 | adapter->hw.fc.requested_mode = ixgbe_fc_none; |
139 | } | 139 | } |
140 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | 140 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; |
141 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | ||
142 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
143 | adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
144 | } | ||
141 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 145 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
142 | ixgbe_init_interrupt_scheme(adapter); | 146 | ixgbe_init_interrupt_scheme(adapter); |
143 | if (netif_running(netdev)) | 147 | if (netif_running(netdev)) |
@@ -154,6 +158,8 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
154 | adapter->dcb_cfg.pfc_mode_enable = false; | 158 | adapter->dcb_cfg.pfc_mode_enable = false; |
155 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | 159 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; |
156 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; | 160 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
161 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | ||
162 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
157 | ixgbe_init_interrupt_scheme(adapter); | 163 | ixgbe_init_interrupt_scheme(adapter); |
158 | if (netif_running(netdev)) | 164 | if (netif_running(netdev)) |
159 | netdev->netdev_ops->ndo_open(netdev); | 165 | netdev->netdev_ops->ndo_open(netdev); |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index a3061aacffd8..e3442f47f932 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -3130,7 +3130,11 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter) | |||
3130 | #endif | 3130 | #endif |
3131 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3131 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3132 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); | 3132 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); |
3133 | ixgbe_set_rss_queues(adapter); | 3133 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3134 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3135 | ixgbe_set_fdir_queues(adapter); | ||
3136 | else | ||
3137 | ixgbe_set_rss_queues(adapter); | ||
3134 | } | 3138 | } |
3135 | /* adding FCoE rx rings to the end */ | 3139 | /* adding FCoE rx rings to the end */ |
3136 | f->mask = adapter->num_rx_queues; | 3140 | f->mask = adapter->num_rx_queues; |
@@ -3388,7 +3392,12 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter) | |||
3388 | } | 3392 | } |
3389 | #endif /* CONFIG_IXGBE_DCB */ | 3393 | #endif /* CONFIG_IXGBE_DCB */ |
3390 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3394 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3391 | ixgbe_cache_ring_rss(adapter); | 3395 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3396 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3397 | ixgbe_cache_ring_fdir(adapter); | ||
3398 | else | ||
3399 | ixgbe_cache_ring_rss(adapter); | ||
3400 | |||
3392 | fcoe_i = f->mask; | 3401 | fcoe_i = f->mask; |
3393 | } | 3402 | } |
3394 | for (i = 0; i < f->indices; i++, fcoe_i++) | 3403 | for (i = 0; i < f->indices; i++, fcoe_i++) |
@@ -5578,12 +5587,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5578 | netdev->features |= NETIF_F_FCOE_CRC; | 5587 | netdev->features |= NETIF_F_FCOE_CRC; |
5579 | netdev->features |= NETIF_F_FSO; | 5588 | netdev->features |= NETIF_F_FSO; |
5580 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; | 5589 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; |
5581 | DPRINTK(DRV, INFO, "FCoE enabled, " | ||
5582 | "disabling Flow Director\n"); | ||
5583 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
5584 | adapter->flags &= | ||
5585 | ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
5586 | adapter->atr_sample_rate = 0; | ||
5587 | } else { | 5590 | } else { |
5588 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; | 5591 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; |
5589 | } | 5592 | } |
diff --git a/drivers/net/mlx4/cmd.c b/drivers/net/mlx4/cmd.c index 2845a0560b84..65ec77dc31f5 100644 --- a/drivers/net/mlx4/cmd.c +++ b/drivers/net/mlx4/cmd.c | |||
@@ -80,7 +80,9 @@ enum { | |||
80 | /* Bad management packet (silently discarded): */ | 80 | /* Bad management packet (silently discarded): */ |
81 | CMD_STAT_BAD_PKT = 0x30, | 81 | CMD_STAT_BAD_PKT = 0x30, |
82 | /* More outstanding CQEs in CQ than new CQ size: */ | 82 | /* More outstanding CQEs in CQ than new CQ size: */ |
83 | CMD_STAT_BAD_SIZE = 0x40 | 83 | CMD_STAT_BAD_SIZE = 0x40, |
84 | /* Multi Function device support required: */ | ||
85 | CMD_STAT_MULTI_FUNC_REQ = 0x50, | ||
84 | }; | 86 | }; |
85 | 87 | ||
86 | enum { | 88 | enum { |
@@ -128,6 +130,7 @@ static int mlx4_status_to_errno(u8 status) | |||
128 | [CMD_STAT_LAM_NOT_PRE] = -EAGAIN, | 130 | [CMD_STAT_LAM_NOT_PRE] = -EAGAIN, |
129 | [CMD_STAT_BAD_PKT] = -EINVAL, | 131 | [CMD_STAT_BAD_PKT] = -EINVAL, |
130 | [CMD_STAT_BAD_SIZE] = -ENOMEM, | 132 | [CMD_STAT_BAD_SIZE] = -ENOMEM, |
133 | [CMD_STAT_MULTI_FUNC_REQ] = -EACCES, | ||
131 | }; | 134 | }; |
132 | 135 | ||
133 | if (status >= ARRAY_SIZE(trans_table) || | 136 | if (status >= ARRAY_SIZE(trans_table) || |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 018348c01193..dac621b1e9fc 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -729,7 +729,10 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
729 | 729 | ||
730 | err = mlx4_QUERY_FW(dev); | 730 | err = mlx4_QUERY_FW(dev); |
731 | if (err) { | 731 | if (err) { |
732 | mlx4_err(dev, "QUERY_FW command failed, aborting.\n"); | 732 | if (err == -EACCES) |
733 | mlx4_info(dev, "non-primary physical function, skipping.\n"); | ||
734 | else | ||
735 | mlx4_err(dev, "QUERY_FW command failed, aborting.\n"); | ||
733 | return err; | 736 | return err; |
734 | } | 737 | } |
735 | 738 | ||
@@ -1285,6 +1288,7 @@ static struct pci_device_id mlx4_pci_table[] = { | |||
1285 | { PCI_VDEVICE(MELLANOX, 0x6750) }, /* MT25408 "Hermon" EN 10GigE PCIe gen2 */ | 1288 | { PCI_VDEVICE(MELLANOX, 0x6750) }, /* MT25408 "Hermon" EN 10GigE PCIe gen2 */ |
1286 | { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ | 1289 | { PCI_VDEVICE(MELLANOX, 0x6372) }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ |
1287 | { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ | 1290 | { PCI_VDEVICE(MELLANOX, 0x675a) }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ |
1291 | { PCI_VDEVICE(MELLANOX, 0x6764) }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ | ||
1288 | { 0, } | 1292 | { 0, } |
1289 | }; | 1293 | }; |
1290 | 1294 | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index eba937c46376..b10fedd82143 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -134,8 +134,10 @@ int phy_scan_fixups(struct phy_device *phydev) | |||
134 | 134 | ||
135 | err = fixup->run(phydev); | 135 | err = fixup->run(phydev); |
136 | 136 | ||
137 | if (err < 0) | 137 | if (err < 0) { |
138 | mutex_unlock(&phy_fixup_lock); | ||
138 | return err; | 139 | return err; |
140 | } | ||
139 | } | 141 | } |
140 | } | 142 | } |
141 | mutex_unlock(&phy_fixup_lock); | 143 | mutex_unlock(&phy_fixup_lock); |
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 7a62f781fef2..2ca8b0d84ee2 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -270,6 +270,9 @@ static const struct net_device_ops plip_netdev_ops = { | |||
270 | .ndo_stop = plip_close, | 270 | .ndo_stop = plip_close, |
271 | .ndo_start_xmit = plip_tx_packet, | 271 | .ndo_start_xmit = plip_tx_packet, |
272 | .ndo_do_ioctl = plip_ioctl, | 272 | .ndo_do_ioctl = plip_ioctl, |
273 | .ndo_change_mtu = eth_change_mtu, | ||
274 | .ndo_set_mac_address = eth_mac_addr, | ||
275 | .ndo_validate_addr = eth_validate_addr, | ||
273 | }; | 276 | }; |
274 | 277 | ||
275 | /* Entry point of PLIP driver. | 278 | /* Entry point of PLIP driver. |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 17c116bb332c..6de8399d6dd9 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -356,6 +356,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
356 | if (!skb_queue_empty(&ap->rqueue)) | 356 | if (!skb_queue_empty(&ap->rqueue)) |
357 | tasklet_schedule(&ap->tsk); | 357 | tasklet_schedule(&ap->tsk); |
358 | ap_put(ap); | 358 | ap_put(ap); |
359 | tty_unthrottle(tty); | ||
359 | } | 360 | } |
360 | 361 | ||
361 | static void | 362 | static void |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index aa3d39f38e22..d2fa2db13586 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -397,6 +397,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
397 | if (!skb_queue_empty(&ap->rqueue)) | 397 | if (!skb_queue_empty(&ap->rqueue)) |
398 | tasklet_schedule(&ap->tsk); | 398 | tasklet_schedule(&ap->tsk); |
399 | sp_put(ap); | 399 | sp_put(ap); |
400 | tty_unthrottle(tty); | ||
400 | } | 401 | } |
401 | 402 | ||
402 | static void | 403 | static void |
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c index d1a5fb4d6acb..a3932c9f3406 100644 --- a/drivers/net/ps3_gelic_net.c +++ b/drivers/net/ps3_gelic_net.c | |||
@@ -1411,6 +1411,7 @@ static const struct net_device_ops gelic_netdevice_ops = { | |||
1411 | .ndo_set_multicast_list = gelic_net_set_multi, | 1411 | .ndo_set_multicast_list = gelic_net_set_multi, |
1412 | .ndo_change_mtu = gelic_net_change_mtu, | 1412 | .ndo_change_mtu = gelic_net_change_mtu, |
1413 | .ndo_tx_timeout = gelic_net_tx_timeout, | 1413 | .ndo_tx_timeout = gelic_net_tx_timeout, |
1414 | .ndo_set_mac_address = eth_mac_addr, | ||
1414 | .ndo_validate_addr = eth_validate_addr, | 1415 | .ndo_validate_addr = eth_validate_addr, |
1415 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1416 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1416 | .ndo_poll_controller = gelic_net_poll_controller, | 1417 | .ndo_poll_controller = gelic_net_poll_controller, |
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index b6b3ca9bdb21..6932b08d746b 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c | |||
@@ -2707,6 +2707,7 @@ static const struct net_device_ops gelic_wl_netdevice_ops = { | |||
2707 | .ndo_set_multicast_list = gelic_net_set_multi, | 2707 | .ndo_set_multicast_list = gelic_net_set_multi, |
2708 | .ndo_change_mtu = gelic_net_change_mtu, | 2708 | .ndo_change_mtu = gelic_net_change_mtu, |
2709 | .ndo_tx_timeout = gelic_net_tx_timeout, | 2709 | .ndo_tx_timeout = gelic_net_tx_timeout, |
2710 | .ndo_set_mac_address = eth_mac_addr, | ||
2710 | .ndo_validate_addr = eth_validate_addr, | 2711 | .ndo_validate_addr = eth_validate_addr, |
2711 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2712 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2712 | .ndo_poll_controller = gelic_net_poll_controller, | 2713 | .ndo_poll_controller = gelic_net_poll_controller, |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index ed63d23a6452..961b5397a531 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -49,8 +49,8 @@ | |||
49 | #include <asm/processor.h> | 49 | #include <asm/processor.h> |
50 | 50 | ||
51 | #define DRV_NAME "r6040" | 51 | #define DRV_NAME "r6040" |
52 | #define DRV_VERSION "0.23" | 52 | #define DRV_VERSION "0.24" |
53 | #define DRV_RELDATE "05May2009" | 53 | #define DRV_RELDATE "08Jul2009" |
54 | 54 | ||
55 | /* PHY CHIP Address */ | 55 | /* PHY CHIP Address */ |
56 | #define PHY1_ADDR 1 /* For MAC1 */ | 56 | #define PHY1_ADDR 1 /* For MAC1 */ |
@@ -704,8 +704,11 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) | |||
704 | /* Read MISR status and clear */ | 704 | /* Read MISR status and clear */ |
705 | status = ioread16(ioaddr + MISR); | 705 | status = ioread16(ioaddr + MISR); |
706 | 706 | ||
707 | if (status == 0x0000 || status == 0xffff) | 707 | if (status == 0x0000 || status == 0xffff) { |
708 | /* Restore RDC MAC interrupt */ | ||
709 | iowrite16(misr, ioaddr + MIER); | ||
708 | return IRQ_NONE; | 710 | return IRQ_NONE; |
711 | } | ||
709 | 712 | ||
710 | /* RX interrupt request */ | 713 | /* RX interrupt request */ |
711 | if (status & RX_INTS) { | 714 | if (status & RX_INTS) { |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index fdcbaf8dfa73..1c70e999cc50 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -1774,6 +1774,7 @@ static const struct net_device_ops smc_netdev_ops = { | |||
1774 | .ndo_start_xmit = smc_hard_start_xmit, | 1774 | .ndo_start_xmit = smc_hard_start_xmit, |
1775 | .ndo_tx_timeout = smc_timeout, | 1775 | .ndo_tx_timeout = smc_timeout, |
1776 | .ndo_set_multicast_list = smc_set_multicast_list, | 1776 | .ndo_set_multicast_list = smc_set_multicast_list, |
1777 | .ndo_change_mtu = eth_change_mtu, | ||
1777 | .ndo_validate_addr = eth_validate_addr, | 1778 | .ndo_validate_addr = eth_validate_addr, |
1778 | .ndo_set_mac_address = eth_mac_addr, | 1779 | .ndo_set_mac_address = eth_mac_addr, |
1779 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1780 | #ifdef CONFIG_NET_POLL_CONTROLLER |
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index 66067f9d91c0..94b6d2658ddc 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -1779,6 +1779,7 @@ static const struct net_device_ops smsc911x_netdev_ops = { | |||
1779 | .ndo_get_stats = smsc911x_get_stats, | 1779 | .ndo_get_stats = smsc911x_get_stats, |
1780 | .ndo_set_multicast_list = smsc911x_set_multicast_list, | 1780 | .ndo_set_multicast_list = smsc911x_set_multicast_list, |
1781 | .ndo_do_ioctl = smsc911x_do_ioctl, | 1781 | .ndo_do_ioctl = smsc911x_do_ioctl, |
1782 | .ndo_change_mtu = eth_change_mtu, | ||
1782 | .ndo_validate_addr = eth_validate_addr, | 1783 | .ndo_validate_addr = eth_validate_addr, |
1783 | .ndo_set_mac_address = smsc911x_set_mac_address, | 1784 | .ndo_set_mac_address = smsc911x_set_mac_address, |
1784 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1785 | #ifdef CONFIG_NET_POLL_CONTROLLER |
diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c index a82fb2aca4cb..f1e5e4542c2a 100644 --- a/drivers/net/sunvnet.c +++ b/drivers/net/sunvnet.c | |||
@@ -1016,7 +1016,9 @@ static const struct net_device_ops vnet_ops = { | |||
1016 | .ndo_open = vnet_open, | 1016 | .ndo_open = vnet_open, |
1017 | .ndo_stop = vnet_close, | 1017 | .ndo_stop = vnet_close, |
1018 | .ndo_set_multicast_list = vnet_set_rx_mode, | 1018 | .ndo_set_multicast_list = vnet_set_rx_mode, |
1019 | .ndo_change_mtu = eth_change_mtu, | ||
1019 | .ndo_set_mac_address = vnet_set_mac_addr, | 1020 | .ndo_set_mac_address = vnet_set_mac_addr, |
1021 | .ndo_validate_addr = eth_validate_addr, | ||
1020 | .ndo_tx_timeout = vnet_tx_timeout, | 1022 | .ndo_tx_timeout = vnet_tx_timeout, |
1021 | .ndo_change_mtu = vnet_change_mtu, | 1023 | .ndo_change_mtu = vnet_change_mtu, |
1022 | .ndo_start_xmit = vnet_start_xmit, | 1024 | .ndo_start_xmit = vnet_start_xmit, |
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index e01314789718..1f9ec29fce50 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -999,6 +999,9 @@ static const struct net_device_ops kaweth_netdev_ops = { | |||
999 | .ndo_tx_timeout = kaweth_tx_timeout, | 999 | .ndo_tx_timeout = kaweth_tx_timeout, |
1000 | .ndo_set_multicast_list = kaweth_set_rx_mode, | 1000 | .ndo_set_multicast_list = kaweth_set_rx_mode, |
1001 | .ndo_get_stats = kaweth_netdev_stats, | 1001 | .ndo_get_stats = kaweth_netdev_stats, |
1002 | .ndo_change_mtu = eth_change_mtu, | ||
1003 | .ndo_set_mac_address = eth_mac_addr, | ||
1004 | .ndo_validate_addr = eth_validate_addr, | ||
1002 | }; | 1005 | }; |
1003 | 1006 | ||
1004 | static int kaweth_probe( | 1007 | static int kaweth_probe( |
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index 73acbd244aa1..631d269ac980 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -1493,6 +1493,9 @@ static const struct net_device_ops pegasus_netdev_ops = { | |||
1493 | .ndo_set_multicast_list = pegasus_set_multicast, | 1493 | .ndo_set_multicast_list = pegasus_set_multicast, |
1494 | .ndo_get_stats = pegasus_netdev_stats, | 1494 | .ndo_get_stats = pegasus_netdev_stats, |
1495 | .ndo_tx_timeout = pegasus_tx_timeout, | 1495 | .ndo_tx_timeout = pegasus_tx_timeout, |
1496 | .ndo_change_mtu = eth_change_mtu, | ||
1497 | .ndo_set_mac_address = eth_mac_addr, | ||
1498 | .ndo_validate_addr = eth_validate_addr, | ||
1496 | }; | 1499 | }; |
1497 | 1500 | ||
1498 | static struct usb_driver pegasus_driver = { | 1501 | static struct usb_driver pegasus_driver = { |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index d3489a3c4c03..88c30a58b4bd 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -621,6 +621,7 @@ static const struct net_device_ops rhine_netdev_ops = { | |||
621 | .ndo_start_xmit = rhine_start_tx, | 621 | .ndo_start_xmit = rhine_start_tx, |
622 | .ndo_get_stats = rhine_get_stats, | 622 | .ndo_get_stats = rhine_get_stats, |
623 | .ndo_set_multicast_list = rhine_set_rx_mode, | 623 | .ndo_set_multicast_list = rhine_set_rx_mode, |
624 | .ndo_change_mtu = eth_change_mtu, | ||
624 | .ndo_validate_addr = eth_validate_addr, | 625 | .ndo_validate_addr = eth_validate_addr, |
625 | .ndo_set_mac_address = eth_mac_addr, | 626 | .ndo_set_mac_address = eth_mac_addr, |
626 | .ndo_do_ioctl = netdev_ioctl, | 627 | .ndo_do_ioctl = netdev_ioctl, |
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig index d26e7b485315..eb0337c49546 100644 --- a/drivers/net/wireless/ath/Kconfig +++ b/drivers/net/wireless/ath/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config ATH_COMMON | 1 | config ATH_COMMON |
2 | tristate "Atheros Wireless Cards" | 2 | tristate "Atheros Wireless Cards" |
3 | depends on WLAN_80211 | ||
3 | depends on ATH5K || ATH9K || AR9170_USB | 4 | depends on ATH5K || ATH9K || AR9170_USB |
4 | 5 | ||
5 | source "drivers/net/wireless/ath/ath5k/Kconfig" | 6 | source "drivers/net/wireless/ath/ath5k/Kconfig" |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index b61a071788a5..4ccf48e396df 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -355,7 +355,14 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | if (bf_next == NULL) { | 357 | if (bf_next == NULL) { |
358 | INIT_LIST_HEAD(&bf_head); | 358 | /* |
359 | * Make sure the last desc is reclaimed if it | ||
360 | * not a holding desc. | ||
361 | */ | ||
362 | if (!bf_last->bf_stale) | ||
363 | list_move_tail(&bf->list, &bf_head); | ||
364 | else | ||
365 | INIT_LIST_HEAD(&bf_head); | ||
359 | } else { | 366 | } else { |
360 | ASSERT(!list_empty(bf_q)); | 367 | ASSERT(!list_empty(bf_q)); |
361 | list_move_tail(&bf->list, &bf_head); | 368 | list_move_tail(&bf->list, &bf_head); |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index f580c2812d91..40448067e4cc 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -648,6 +648,7 @@ struct b43_wl { | |||
648 | u8 nr_devs; | 648 | u8 nr_devs; |
649 | 649 | ||
650 | bool radiotap_enabled; | 650 | bool radiotap_enabled; |
651 | bool radio_enabled; | ||
651 | 652 | ||
652 | /* The beacon we are currently using (AP or IBSS mode). | 653 | /* The beacon we are currently using (AP or IBSS mode). |
653 | * This beacon stuff is protected by the irq_lock. */ | 654 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6456afebdba1..e71c8d9cd706 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3497,8 +3497,8 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3497 | if (phy->ops->set_rx_antenna) | 3497 | if (phy->ops->set_rx_antenna) |
3498 | phy->ops->set_rx_antenna(dev, antenna); | 3498 | phy->ops->set_rx_antenna(dev, antenna); |
3499 | 3499 | ||
3500 | if (!!conf->radio_enabled != phy->radio_on) { | 3500 | if (wl->radio_enabled != phy->radio_on) { |
3501 | if (conf->radio_enabled) { | 3501 | if (wl->radio_enabled) { |
3502 | b43_software_rfkill(dev, false); | 3502 | b43_software_rfkill(dev, false); |
3503 | b43info(dev->wl, "Radio turned on by software\n"); | 3503 | b43info(dev->wl, "Radio turned on by software\n"); |
3504 | if (!dev->radio_hw_enable) { | 3504 | if (!dev->radio_hw_enable) { |
@@ -4339,6 +4339,7 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4339 | wl->beacon0_uploaded = 0; | 4339 | wl->beacon0_uploaded = 0; |
4340 | wl->beacon1_uploaded = 0; | 4340 | wl->beacon1_uploaded = 0; |
4341 | wl->beacon_templates_virgin = 1; | 4341 | wl->beacon_templates_virgin = 1; |
4342 | wl->radio_enabled = 1; | ||
4342 | 4343 | ||
4343 | mutex_lock(&wl->mutex); | 4344 | mutex_lock(&wl->mutex); |
4344 | 4345 | ||
@@ -4378,6 +4379,7 @@ static void b43_op_stop(struct ieee80211_hw *hw) | |||
4378 | if (b43_status(dev) >= B43_STAT_STARTED) | 4379 | if (b43_status(dev) >= B43_STAT_STARTED) |
4379 | b43_wireless_core_stop(dev); | 4380 | b43_wireless_core_stop(dev); |
4380 | b43_wireless_core_exit(dev); | 4381 | b43_wireless_core_exit(dev); |
4382 | wl->radio_enabled = 0; | ||
4381 | mutex_unlock(&wl->mutex); | 4383 | mutex_unlock(&wl->mutex); |
4382 | 4384 | ||
4383 | cancel_work_sync(&(wl->txpower_adjust_work)); | 4385 | cancel_work_sync(&(wl->txpower_adjust_work)); |
@@ -4560,6 +4562,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4560 | B43_WARN_ON(1); | 4562 | B43_WARN_ON(1); |
4561 | 4563 | ||
4562 | dev->phy.gmode = have_2ghz_phy; | 4564 | dev->phy.gmode = have_2ghz_phy; |
4565 | dev->phy.radio_on = 1; | ||
4563 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; | 4566 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; |
4564 | b43_wireless_core_reset(dev, tmp); | 4567 | b43_wireless_core_reset(dev, tmp); |
4565 | 4568 | ||
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 3cfc30307a27..6c3a74964ab8 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { | 36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { |
37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), | 37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), |
38 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476), | ||
38 | PCMCIA_DEVICE_NULL, | 39 | PCMCIA_DEVICE_NULL, |
39 | }; | 40 | }; |
40 | 41 | ||
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index 77fda148ac46..038baa8869e2 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h | |||
@@ -607,6 +607,7 @@ struct b43legacy_wl { | |||
607 | u8 nr_devs; | 607 | u8 nr_devs; |
608 | 608 | ||
609 | bool radiotap_enabled; | 609 | bool radiotap_enabled; |
610 | bool radio_enabled; | ||
610 | 611 | ||
611 | /* The beacon we are currently using (AP or IBSS mode). | 612 | /* The beacon we are currently using (AP or IBSS mode). |
612 | * This beacon stuff is protected by the irq_lock. */ | 613 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index e5136fb65ddd..c4973c1942bf 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -2689,8 +2689,8 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw, | |||
2689 | /* Antennas for RX and management frame TX. */ | 2689 | /* Antennas for RX and management frame TX. */ |
2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); | 2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); |
2691 | 2691 | ||
2692 | if (!!conf->radio_enabled != phy->radio_on) { | 2692 | if (wl->radio_enabled != phy->radio_on) { |
2693 | if (conf->radio_enabled) { | 2693 | if (wl->radio_enabled) { |
2694 | b43legacy_radio_turn_on(dev); | 2694 | b43legacy_radio_turn_on(dev); |
2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); | 2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); |
2696 | if (!dev->radio_hw_enable) | 2696 | if (!dev->radio_hw_enable) |
@@ -3441,6 +3441,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) | |||
3441 | wl->beacon0_uploaded = 0; | 3441 | wl->beacon0_uploaded = 0; |
3442 | wl->beacon1_uploaded = 0; | 3442 | wl->beacon1_uploaded = 0; |
3443 | wl->beacon_templates_virgin = 1; | 3443 | wl->beacon_templates_virgin = 1; |
3444 | wl->radio_enabled = 1; | ||
3444 | 3445 | ||
3445 | mutex_lock(&wl->mutex); | 3446 | mutex_lock(&wl->mutex); |
3446 | 3447 | ||
@@ -3479,6 +3480,7 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw) | |||
3479 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) | 3480 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) |
3480 | b43legacy_wireless_core_stop(dev); | 3481 | b43legacy_wireless_core_stop(dev); |
3481 | b43legacy_wireless_core_exit(dev); | 3482 | b43legacy_wireless_core_exit(dev); |
3483 | wl->radio_enabled = 0; | ||
3482 | mutex_unlock(&wl->mutex); | 3484 | mutex_unlock(&wl->mutex); |
3483 | } | 3485 | } |
3484 | 3486 | ||
@@ -3620,6 +3622,7 @@ static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev) | |||
3620 | have_bphy = 1; | 3622 | have_bphy = 1; |
3621 | 3623 | ||
3622 | dev->phy.gmode = (have_gphy || have_bphy); | 3624 | dev->phy.gmode = (have_gphy || have_bphy); |
3625 | dev->phy.radio_on = 1; | ||
3623 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; | 3626 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; |
3624 | b43legacy_wireless_core_reset(dev, tmp); | 3627 | b43legacy_wireless_core_reset(dev, tmp); |
3625 | 3628 | ||
diff --git a/drivers/net/wireless/iwmc3200wifi/Kconfig b/drivers/net/wireless/iwmc3200wifi/Kconfig index 1eccb6df46dd..030401d367d3 100644 --- a/drivers/net/wireless/iwmc3200wifi/Kconfig +++ b/drivers/net/wireless/iwmc3200wifi/Kconfig | |||
@@ -4,6 +4,15 @@ config IWM | |||
4 | depends on CFG80211 | 4 | depends on CFG80211 |
5 | select WIRELESS_EXT | 5 | select WIRELESS_EXT |
6 | select FW_LOADER | 6 | select FW_LOADER |
7 | help | ||
8 | The Intel Wireless Multicomm 3200 hardware is a combo | ||
9 | card with GPS, Bluetooth, WiMax and 802.11 radios. It | ||
10 | runs over SDIO and is typically found on Moorestown | ||
11 | based platform. This driver takes care of the 802.11 | ||
12 | part, which is a fullmac one. | ||
13 | |||
14 | If you choose to build it as a module, it'll be called | ||
15 | iwmc3200wifi.ko. | ||
7 | 16 | ||
8 | config IWM_DEBUG | 17 | config IWM_DEBUG |
9 | bool "Enable full debugging output in iwmc3200wifi" | 18 | bool "Enable full debugging output in iwmc3200wifi" |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index e789c6e9938c..a111bda392e2 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -418,6 +418,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
418 | continue; | 418 | continue; |
419 | 419 | ||
420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || | 420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || |
421 | !data->channel || !data2->channel || | ||
421 | data->channel->center_freq != data2->channel->center_freq || | 422 | data->channel->center_freq != data2->channel->center_freq || |
422 | !(data->group & data2->group)) | 423 | !(data->group & data2->group)) |
423 | continue; | 424 | continue; |
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 345593c4accb..a370e510f19f 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -2521,6 +2521,8 @@ static const struct net_device_ops orinoco_netdev_ops = { | |||
2521 | .ndo_start_xmit = orinoco_xmit, | 2521 | .ndo_start_xmit = orinoco_xmit, |
2522 | .ndo_set_multicast_list = orinoco_set_multicast_list, | 2522 | .ndo_set_multicast_list = orinoco_set_multicast_list, |
2523 | .ndo_change_mtu = orinoco_change_mtu, | 2523 | .ndo_change_mtu = orinoco_change_mtu, |
2524 | .ndo_set_mac_address = eth_mac_addr, | ||
2525 | .ndo_validate_addr = eth_validate_addr, | ||
2524 | .ndo_tx_timeout = orinoco_tx_timeout, | 2526 | .ndo_tx_timeout = orinoco_tx_timeout, |
2525 | .ndo_get_stats = orinoco_get_stats, | 2527 | .ndo_get_stats = orinoco_get_stats, |
2526 | }; | 2528 | }; |
@@ -2555,7 +2557,6 @@ struct net_device | |||
2555 | priv->wireless_data.spy_data = &priv->spy_data; | 2557 | priv->wireless_data.spy_data = &priv->spy_data; |
2556 | dev->wireless_data = &priv->wireless_data; | 2558 | dev->wireless_data = &priv->wireless_data; |
2557 | #endif | 2559 | #endif |
2558 | /* we use the default eth_mac_addr for setting the MAC addr */ | ||
2559 | 2560 | ||
2560 | /* Reserve space in skb for the SNAP header */ | 2561 | /* Reserve space in skb for the SNAP header */ |
2561 | dev->hard_header_len += ENCAPS_OVERHEAD; | 2562 | dev->hard_header_len += ENCAPS_OVERHEAD; |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 48d81d98e12d..22ca122bd798 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -912,13 +912,14 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
912 | } | 912 | } |
913 | 913 | ||
914 | __skb_unlink(entry, &priv->tx_queue); | 914 | __skb_unlink(entry, &priv->tx_queue); |
915 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
916 | 915 | ||
917 | frame_len = entry->len; | 916 | frame_len = entry->len; |
918 | entry_hdr = (struct p54_hdr *) entry->data; | 917 | entry_hdr = (struct p54_hdr *) entry->data; |
919 | entry_data = (struct p54_tx_data *) entry_hdr->data; | 918 | entry_data = (struct p54_tx_data *) entry_hdr->data; |
920 | priv->tx_stats[entry_data->hw_queue].len--; | 919 | if (priv->tx_stats[entry_data->hw_queue].len) |
920 | priv->tx_stats[entry_data->hw_queue].len--; | ||
921 | priv->stats.dot11ACKFailureCount += payload->tries - 1; | 921 | priv->stats.dot11ACKFailureCount += payload->tries - 1; |
922 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
922 | 923 | ||
923 | /* | 924 | /* |
924 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are | 925 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 14a19baff214..0e6e44689cc6 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -38,7 +38,6 @@ static struct usb_device_id usb_ids[] = { | |||
38 | /* ZD1211 */ | 38 | /* ZD1211 */ |
39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, | 39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, |
40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, | 40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, |
41 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211 }, | ||
42 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, | 41 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, |
43 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, | 42 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, |
44 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, | 43 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, |
@@ -61,6 +60,7 @@ static struct usb_device_id usb_ids[] = { | |||
61 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, | 60 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, |
62 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, | 61 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, |
63 | /* ZD1211B */ | 62 | /* ZD1211B */ |
63 | { USB_DEVICE(0x054c, 0x0257), .driver_info = DEVICE_ZD1211B }, | ||
64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, |
65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, | 65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, |
66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, | 66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, |
@@ -87,6 +87,7 @@ static struct usb_device_id usb_ids[] = { | |||
87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, | 87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, |
88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, | 88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, |
89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, | 89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, |
90 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211B }, | ||
90 | /* "Driverless" devices that need ejecting */ | 91 | /* "Driverless" devices that need ejecting */ |
91 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 92 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
92 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, | 93 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, |
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index e1f6ce03705e..3c2270a8300c 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c | |||
@@ -33,6 +33,7 @@ void oprofile_reset_stats(void) | |||
33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); | 33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); |
34 | atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); | 34 | atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); |
35 | atomic_set(&oprofile_stats.event_lost_overflow, 0); | 35 | atomic_set(&oprofile_stats.event_lost_overflow, 0); |
36 | atomic_set(&oprofile_stats.bt_lost_no_mapping, 0); | ||
36 | } | 37 | } |
37 | 38 | ||
38 | 39 | ||
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index a5b9f6ae507b..d703e73fffa7 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/pci_hotplug.h> | 32 | #include <linux/pci_hotplug.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
35 | #include <linux/smp_lock.h> | ||
36 | #include <asm/atomic.h> | 35 | #include <asm/atomic.h> |
37 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
38 | #include <linux/kthread.h> | 37 | #include <linux/kthread.h> |
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 2fa47af992a8..0ff689afa757 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/wait.h> | 36 | #include <linux/wait.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
39 | #include <linux/pci_hotplug.h> | 38 | #include <linux/pci_hotplug.h> |
40 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index 8450f4a6568a..e6089bdb6e5b 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/workqueue.h> | 33 | #include <linux/workqueue.h> |
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <linux/pci_hotplug.h> | 35 | #include <linux/pci_hotplug.h> |
36 | #include <linux/smp_lock.h> | ||
36 | #include <linux/debugfs.h> | 37 | #include <linux/debugfs.h> |
37 | #include "cpqphp.h" | 38 | #include "cpqphp.h" |
38 | 39 | ||
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index ff4034502d24..8aab8edf123e 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/smp_lock.h> | ||
34 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
35 | #include <linux/workqueue.h> | 34 | #include <linux/workqueue.h> |
36 | #include "../pci.h" | 35 | #include "../pci.h" |
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index ec22284eed30..e1c1ec540893 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include <linux/syscalls.h> | 12 | #include <linux/syscalls.h> |
14 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
15 | #include "pci.h" | 14 | #include "pci.h" |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 4ac2311c00af..ca508564a181 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -171,7 +171,7 @@ static int hp_wmi_tablet_state(void) | |||
171 | static int hp_wmi_set_block(void *data, bool blocked) | 171 | static int hp_wmi_set_block(void *data, bool blocked) |
172 | { | 172 | { |
173 | unsigned long b = (unsigned long) data; | 173 | unsigned long b = (unsigned long) data; |
174 | int query = BIT(b + 8) | ((!!blocked) << b); | 174 | int query = BIT(b + 8) | ((!blocked) << b); |
175 | 175 | ||
176 | return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query); | 176 | return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query); |
177 | } | 177 | } |
diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c index 8bde92126d34..b787335a8419 100644 --- a/drivers/power/wm97xx_battery.c +++ b/drivers/power/wm97xx_battery.c | |||
@@ -33,14 +33,14 @@ static enum power_supply_property *prop; | |||
33 | 33 | ||
34 | static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) | 34 | static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) |
35 | { | 35 | { |
36 | return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data, | 36 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent), |
37 | pdata->batt_aux) * pdata->batt_mult / | 37 | pdata->batt_aux) * pdata->batt_mult / |
38 | pdata->batt_div; | 38 | pdata->batt_div; |
39 | } | 39 | } |
40 | 40 | ||
41 | static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) | 41 | static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) |
42 | { | 42 | { |
43 | return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data, | 43 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent), |
44 | pdata->temp_aux) * pdata->temp_mult / | 44 | pdata->temp_aux) * pdata->temp_mult / |
45 | pdata->temp_div; | 45 | pdata->temp_div; |
46 | } | 46 | } |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index f8b1f04f26b8..c11770f5b368 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1696,8 +1696,7 @@ static void dasd_eckd_handle_unsolicited_interrupt(struct dasd_device *device, | |||
1696 | DBF_DEV_EVENT(DBF_ERR, device, "%s", | 1696 | DBF_DEV_EVENT(DBF_ERR, device, "%s", |
1697 | "unsolicited interrupt received " | 1697 | "unsolicited interrupt received " |
1698 | "(sense available)"); | 1698 | "(sense available)"); |
1699 | device->discipline->dump_sense_dbf(device, NULL, irb, | 1699 | device->discipline->dump_sense_dbf(device, irb, "unsolicited"); |
1700 | "unsolicited"); | ||
1701 | } | 1700 | } |
1702 | 1701 | ||
1703 | dasd_schedule_device_bh(device); | 1702 | dasd_schedule_device_bh(device); |
@@ -2941,42 +2940,20 @@ dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) | |||
2941 | } | 2940 | } |
2942 | 2941 | ||
2943 | static void | 2942 | static void |
2944 | dasd_eckd_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, | 2943 | dasd_eckd_dump_sense_dbf(struct dasd_device *device, struct irb *irb, |
2945 | struct irb *irb, char *reason) | 2944 | char *reason) |
2946 | { | 2945 | { |
2947 | u64 *sense; | 2946 | u64 *sense; |
2948 | int sl; | ||
2949 | struct tsb *tsb; | ||
2950 | 2947 | ||
2951 | sense = NULL; | 2948 | sense = (u64 *) dasd_get_sense(irb); |
2952 | tsb = NULL; | ||
2953 | if (req && scsw_is_tm(&req->irb.scsw)) { | ||
2954 | if (irb->scsw.tm.tcw) | ||
2955 | tsb = tcw_get_tsb( | ||
2956 | (struct tcw *)(unsigned long)irb->scsw.tm.tcw); | ||
2957 | if (tsb && (irb->scsw.tm.fcxs == 0x01)) { | ||
2958 | switch (tsb->flags & 0x07) { | ||
2959 | case 1: /* tsa_iostat */ | ||
2960 | sense = (u64 *)tsb->tsa.iostat.sense; | ||
2961 | break; | ||
2962 | case 2: /* ts_ddpc */ | ||
2963 | sense = (u64 *)tsb->tsa.ddpc.sense; | ||
2964 | break; | ||
2965 | case 3: /* tsa_intrg */ | ||
2966 | break; | ||
2967 | } | ||
2968 | } | ||
2969 | } else { | ||
2970 | if (irb->esw.esw0.erw.cons) | ||
2971 | sense = (u64 *)irb->ecw; | ||
2972 | } | ||
2973 | if (sense) { | 2949 | if (sense) { |
2974 | for (sl = 0; sl < 4; sl++) { | 2950 | DBF_DEV_EVENT(DBF_EMERG, device, |
2975 | DBF_DEV_EVENT(DBF_EMERG, device, | 2951 | "%s: %s %02x%02x%02x %016llx %016llx %016llx " |
2976 | "%s: %016llx %016llx %016llx %016llx", | 2952 | "%016llx", reason, |
2977 | reason, sense[0], sense[1], sense[2], | 2953 | scsw_is_tm(&irb->scsw) ? "t" : "c", |
2978 | sense[3]); | 2954 | scsw_cc(&irb->scsw), scsw_cstat(&irb->scsw), |
2979 | } | 2955 | scsw_dstat(&irb->scsw), sense[0], sense[1], |
2956 | sense[2], sense[3]); | ||
2980 | } else { | 2957 | } else { |
2981 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", | 2958 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", |
2982 | "SORRY - NO VALID SENSE AVAILABLE\n"); | 2959 | "SORRY - NO VALID SENSE AVAILABLE\n"); |
diff --git a/drivers/s390/block/dasd_erp.c b/drivers/s390/block/dasd_erp.c index d970ce2814be..cb8f9cef7429 100644 --- a/drivers/s390/block/dasd_erp.c +++ b/drivers/s390/block/dasd_erp.c | |||
@@ -172,7 +172,7 @@ dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb) | |||
172 | device = cqr->startdev; | 172 | device = cqr->startdev; |
173 | /* dump sense data to s390 debugfeature*/ | 173 | /* dump sense data to s390 debugfeature*/ |
174 | if (device->discipline && device->discipline->dump_sense_dbf) | 174 | if (device->discipline && device->discipline->dump_sense_dbf) |
175 | device->discipline->dump_sense_dbf(device, cqr, irb, "log"); | 175 | device->discipline->dump_sense_dbf(device, irb, "log"); |
176 | } | 176 | } |
177 | EXPORT_SYMBOL(dasd_log_sense_dbf); | 177 | EXPORT_SYMBOL(dasd_log_sense_dbf); |
178 | 178 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index e21ee735f926..31849ad5e59f 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -241,7 +241,7 @@ static void dasd_fba_handle_unsolicited_interrupt(struct dasd_device *device, | |||
241 | /* check for unsolicited interrupts */ | 241 | /* check for unsolicited interrupts */ |
242 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", | 242 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
243 | "unsolicited interrupt received"); | 243 | "unsolicited interrupt received"); |
244 | device->discipline->dump_sense_dbf(device, NULL, irb, "unsolicited"); | 244 | device->discipline->dump_sense_dbf(device, irb, "unsolicited"); |
245 | dasd_schedule_device_bh(device); | 245 | dasd_schedule_device_bh(device); |
246 | return; | 246 | return; |
247 | }; | 247 | }; |
@@ -444,17 +444,20 @@ dasd_fba_fill_info(struct dasd_device * device, | |||
444 | } | 444 | } |
445 | 445 | ||
446 | static void | 446 | static void |
447 | dasd_fba_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, | 447 | dasd_fba_dump_sense_dbf(struct dasd_device *device, struct irb *irb, |
448 | struct irb *irb, char *reason) | 448 | char *reason) |
449 | { | 449 | { |
450 | int sl; | 450 | u64 *sense; |
451 | if (irb->esw.esw0.erw.cons) { | 451 | |
452 | for (sl = 0; sl < 4; sl++) { | 452 | sense = (u64 *) dasd_get_sense(irb); |
453 | DBF_DEV_EVENT(DBF_EMERG, device, | 453 | if (sense) { |
454 | "%s: %08x %08x %08x %08x", | 454 | DBF_DEV_EVENT(DBF_EMERG, device, |
455 | reason, irb->ecw[8 * 0], irb->ecw[8 * 1], | 455 | "%s: %s %02x%02x%02x %016llx %016llx %016llx " |
456 | irb->ecw[8 * 2], irb->ecw[8 * 3]); | 456 | "%016llx", reason, |
457 | } | 457 | scsw_is_tm(&irb->scsw) ? "t" : "c", |
458 | scsw_cc(&irb->scsw), scsw_cstat(&irb->scsw), | ||
459 | scsw_dstat(&irb->scsw), sense[0], sense[1], | ||
460 | sense[2], sense[3]); | ||
458 | } else { | 461 | } else { |
459 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", | 462 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", |
460 | "SORRY - NO VALID SENSE AVAILABLE\n"); | 463 | "SORRY - NO VALID SENSE AVAILABLE\n"); |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index fd63b2f2bda9..b699ca356ac5 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -284,8 +284,7 @@ struct dasd_discipline { | |||
284 | dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); | 284 | dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); |
285 | void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, | 285 | void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, |
286 | struct irb *); | 286 | struct irb *); |
287 | void (*dump_sense_dbf) (struct dasd_device *, struct dasd_ccw_req *, | 287 | void (*dump_sense_dbf) (struct dasd_device *, struct irb *, char *); |
288 | struct irb *, char *); | ||
289 | 288 | ||
290 | void (*handle_unsolicited_interrupt) (struct dasd_device *, | 289 | void (*handle_unsolicited_interrupt) (struct dasd_device *, |
291 | struct irb *); | 290 | struct irb *); |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 4ce3f72ee1c1..df918ef27965 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/major.h> | 16 | #include <linux/major.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/blkpg.h> | 18 | #include <linux/blkpg.h> |
19 | #include <linux/smp_lock.h> | ||
19 | 20 | ||
20 | #include <asm/ccwdev.h> | 21 | #include <asm/ccwdev.h> |
21 | #include <asm/cmb.h> | 22 | #include <asm/cmb.h> |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 016f9e9d2591..d34617682a62 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -964,7 +964,8 @@ static int dcssblk_freeze(struct device *dev) | |||
964 | break; | 964 | break; |
965 | } | 965 | } |
966 | if (rc) | 966 | if (rc) |
967 | pr_err("Suspend failed because device %s is writeable.\n", | 967 | pr_err("Suspending the system failed because DCSS device %s " |
968 | "is writable\n", | ||
968 | dev_info->segment_name); | 969 | dev_info->segment_name); |
969 | return rc; | 970 | return rc; |
970 | } | 971 | } |
@@ -987,8 +988,8 @@ static int dcssblk_restore(struct device *dev) | |||
987 | goto out_panic; | 988 | goto out_panic; |
988 | } | 989 | } |
989 | if (start != entry->start || end != entry->end) { | 990 | if (start != entry->start || end != entry->end) { |
990 | pr_err("Mismatch of start / end address after " | 991 | pr_err("The address range of DCSS %s changed " |
991 | "resuming device %s\n", | 992 | "while the system was suspended\n", |
992 | entry->segment_name); | 993 | entry->segment_name); |
993 | goto out_panic; | 994 | goto out_panic; |
994 | } | 995 | } |
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 2e9e1ecd6d82..db442cd6621e 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -443,7 +443,7 @@ fail: | |||
443 | */ | 443 | */ |
444 | static void xpram_resume_error(const char *message) | 444 | static void xpram_resume_error(const char *message) |
445 | { | 445 | { |
446 | pr_err("Resume error: %s\n", message); | 446 | pr_err("Resuming the system failed: %s\n", message); |
447 | panic("xpram resume error\n"); | 447 | panic("xpram resume error\n"); |
448 | } | 448 | } |
449 | 449 | ||
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index 7892550d7932..3234e90bd7f9 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c | |||
@@ -320,7 +320,7 @@ static int mon_open(struct inode *inode, struct file *filp) | |||
320 | goto out_path; | 320 | goto out_path; |
321 | } | 321 | } |
322 | filp->private_data = monpriv; | 322 | filp->private_data = monpriv; |
323 | dev_set_drvdata(&monreader_device, monpriv); | 323 | dev_set_drvdata(monreader_device, monpriv); |
324 | unlock_kernel(); | 324 | unlock_kernel(); |
325 | return nonseekable_open(inode, filp); | 325 | return nonseekable_open(inode, filp); |
326 | 326 | ||
@@ -463,7 +463,7 @@ static struct miscdevice mon_dev = { | |||
463 | *****************************************************************************/ | 463 | *****************************************************************************/ |
464 | static int monreader_freeze(struct device *dev) | 464 | static int monreader_freeze(struct device *dev) |
465 | { | 465 | { |
466 | struct mon_private *monpriv = dev_get_drvdata(&dev); | 466 | struct mon_private *monpriv = dev_get_drvdata(dev); |
467 | int rc; | 467 | int rc; |
468 | 468 | ||
469 | if (!monpriv) | 469 | if (!monpriv) |
diff --git a/drivers/s390/char/sclp_rw.h b/drivers/s390/char/sclp_rw.h index 85f491ea929c..7a7bfc947d97 100644 --- a/drivers/s390/char/sclp_rw.h +++ b/drivers/s390/char/sclp_rw.h | |||
@@ -92,5 +92,10 @@ void sclp_set_columns(struct sclp_buffer *, unsigned short); | |||
92 | void sclp_set_htab(struct sclp_buffer *, unsigned short); | 92 | void sclp_set_htab(struct sclp_buffer *, unsigned short); |
93 | int sclp_chars_in_buffer(struct sclp_buffer *); | 93 | int sclp_chars_in_buffer(struct sclp_buffer *); |
94 | 94 | ||
95 | #ifdef CONFIG_SCLP_CONSOLE | ||
95 | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); | 96 | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); |
97 | #else | ||
98 | static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { } | ||
99 | #endif | ||
100 | |||
96 | #endif /* __SCLP_RW_H__ */ | 101 | #endif /* __SCLP_RW_H__ */ |
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c index cb7854c10c04..f2bc287b69e4 100644 --- a/drivers/s390/char/vmwatchdog.c +++ b/drivers/s390/char/vmwatchdog.c | |||
@@ -250,14 +250,14 @@ static int vmwdt_resume(void) | |||
250 | static int vmwdt_suspend(void) | 250 | static int vmwdt_suspend(void) |
251 | { | 251 | { |
252 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { | 252 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { |
253 | pr_err("The watchdog is in use. " | 253 | pr_err("The system cannot be suspended while the watchdog" |
254 | "This prevents hibernation or suspend.\n"); | 254 | " is in use\n"); |
255 | return NOTIFY_BAD; | 255 | return NOTIFY_BAD; |
256 | } | 256 | } |
257 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { | 257 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { |
258 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | 258 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); |
259 | pr_err("The watchdog is running. " | 259 | pr_err("The system cannot be suspended while the watchdog" |
260 | "This prevents hibernation or suspend.\n"); | 260 | " is running\n"); |
261 | return NOTIFY_BAD; | 261 | return NOTIFY_BAD; |
262 | } | 262 | } |
263 | return NOTIFY_DONE; | 263 | return NOTIFY_DONE; |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 650bcef08f2a..cd78c501803a 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/moduleparam.h> | 10 | #include <linux/moduleparam.h> |
11 | #include <linux/vmalloc.h> | 11 | #include <linux/vmalloc.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include <linux/list.h> | 12 | #include <linux/list.h> |
14 | 13 | ||
15 | #include <scsi/scsi_tcq.h> | 14 | #include <scsi/scsi_tcq.h> |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 4d6f2fe1cfe9..9230402c45af 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1656,6 +1656,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd) | |||
1656 | md->nr_entries = req_schp->k_use_sg; | 1656 | md->nr_entries = req_schp->k_use_sg; |
1657 | md->offset = 0; | 1657 | md->offset = 0; |
1658 | md->null_mapped = hp->dxferp ? 0 : 1; | 1658 | md->null_mapped = hp->dxferp ? 0 : 1; |
1659 | if (dxfer_dir == SG_DXFER_TO_FROM_DEV) | ||
1660 | md->from_user = 1; | ||
1661 | else | ||
1662 | md->from_user = 0; | ||
1659 | } | 1663 | } |
1660 | 1664 | ||
1661 | if (iov_count) { | 1665 | if (iov_count) { |
diff --git a/drivers/serial/bfin_sport_uart.c b/drivers/serial/bfin_sport_uart.c index 34b4ae0fe760..c108b1a0ce98 100644 --- a/drivers/serial/bfin_sport_uart.c +++ b/drivers/serial/bfin_sport_uart.c | |||
@@ -236,7 +236,6 @@ static int sport_startup(struct uart_port *port) | |||
236 | int retval; | 236 | int retval; |
237 | 237 | ||
238 | pr_debug("%s enter\n", __func__); | 238 | pr_debug("%s enter\n", __func__); |
239 | memset(buffer, 20, '\0'); | ||
240 | snprintf(buffer, 20, "%s rx", up->name); | 239 | snprintf(buffer, 20, "%s rx", up->name); |
241 | retval = request_irq(up->rx_irq, sport_uart_rx_irq, IRQF_SAMPLE_RANDOM, buffer, up); | 240 | retval = request_irq(up->rx_irq, sport_uart_rx_irq, IRQF_SAMPLE_RANDOM, buffer, up); |
242 | if (retval) { | 241 | if (retval) { |
diff --git a/drivers/serial/msm_serial.c b/drivers/serial/msm_serial.c index 698048f64f5e..f7c24baa1416 100644 --- a/drivers/serial/msm_serial.c +++ b/drivers/serial/msm_serial.c | |||
@@ -730,7 +730,6 @@ static int __devexit msm_serial_remove(struct platform_device *pdev) | |||
730 | } | 730 | } |
731 | 731 | ||
732 | static struct platform_driver msm_platform_driver = { | 732 | static struct platform_driver msm_platform_driver = { |
733 | .probe = msm_serial_probe, | ||
734 | .remove = msm_serial_remove, | 733 | .remove = msm_serial_remove, |
735 | .driver = { | 734 | .driver = { |
736 | .name = "msm_serial", | 735 | .name = "msm_serial", |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index 131030f693c7..100e7a5c5ea1 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -678,7 +678,8 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
678 | sprom->board_rev = tuple.TupleData[1]; | 678 | sprom->board_rev = tuple.TupleData[1]; |
679 | break; | 679 | break; |
680 | case SSB_PCMCIA_CIS_PA: | 680 | case SSB_PCMCIA_CIS_PA: |
681 | GOTO_ERROR_ON(tuple.TupleDataLen != 9, | 681 | GOTO_ERROR_ON((tuple.TupleDataLen != 9) && |
682 | (tuple.TupleDataLen != 10), | ||
682 | "pa tpl size"); | 683 | "pa tpl size"); |
683 | sprom->pa0b0 = tuple.TupleData[1] | | 684 | sprom->pa0b0 = tuple.TupleData[1] | |
684 | ((u16)tuple.TupleData[2] << 8); | 685 | ((u16)tuple.TupleData[2] << 8); |
@@ -718,7 +719,8 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
718 | sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; | 719 | sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; |
719 | break; | 720 | break; |
720 | case SSB_PCMCIA_CIS_BFLAGS: | 721 | case SSB_PCMCIA_CIS_BFLAGS: |
721 | GOTO_ERROR_ON(tuple.TupleDataLen != 3, | 722 | GOTO_ERROR_ON((tuple.TupleDataLen != 3) && |
723 | (tuple.TupleDataLen != 5), | ||
722 | "bfl tpl size"); | 724 | "bfl tpl size"); |
723 | sprom->boardflags_lo = tuple.TupleData[1] | | 725 | sprom->boardflags_lo = tuple.TupleData[1] | |
724 | ((u16)tuple.TupleData[2] << 8); | 726 | ((u16)tuple.TupleData[2] << 8); |
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index baf83c6a9412..e3c3adc282e2 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c | |||
@@ -45,6 +45,8 @@ Devices: [JR3] PCI force sensor board (jr3_pci) | |||
45 | #include <linux/delay.h> | 45 | #include <linux/delay.h> |
46 | #include <linux/ctype.h> | 46 | #include <linux/ctype.h> |
47 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
48 | #include <linux/jiffies.h> | ||
49 | #include <linux/timer.h> | ||
48 | #include "comedi_pci.h" | 50 | #include "comedi_pci.h" |
49 | #include "jr3_pci.h" | 51 | #include "jr3_pci.h" |
50 | 52 | ||
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 92121cf8c45c..5d9bab352c1d 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c | |||
@@ -111,9 +111,13 @@ static const struct s626_board s626_boards[] = { | |||
111 | #define PCI_VENDOR_ID_S626 0x1131 | 111 | #define PCI_VENDOR_ID_S626 0x1131 |
112 | #define PCI_DEVICE_ID_S626 0x7146 | 112 | #define PCI_DEVICE_ID_S626 0x7146 |
113 | 113 | ||
114 | /* | ||
115 | * For devices with vendor:device id == 0x1131:0x7146 you must specify | ||
116 | * also subvendor:subdevice ids, because otherwise it will conflict with | ||
117 | * Philips SAA7146 media/dvb based cards. | ||
118 | */ | ||
114 | static DEFINE_PCI_DEVICE_TABLE(s626_pci_table) = { | 119 | static DEFINE_PCI_DEVICE_TABLE(s626_pci_table) = { |
115 | {PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 120 | {PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, 0x6000, 0x0272, 0, 0, 0}, |
116 | 0}, | ||
117 | {0} | 121 | {0} |
118 | }; | 122 | }; |
119 | 123 | ||
@@ -499,25 +503,26 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
499 | resource_size_t resourceStart; | 503 | resource_size_t resourceStart; |
500 | dma_addr_t appdma; | 504 | dma_addr_t appdma; |
501 | struct comedi_subdevice *s; | 505 | struct comedi_subdevice *s; |
502 | struct pci_dev *pdev; | 506 | const struct pci_device_id *ids; |
507 | struct pci_dev *pdev = NULL; | ||
503 | 508 | ||
504 | if (alloc_private(dev, sizeof(struct s626_private)) < 0) | 509 | if (alloc_private(dev, sizeof(struct s626_private)) < 0) |
505 | return -ENOMEM; | 510 | return -ENOMEM; |
506 | 511 | ||
507 | for (pdev = pci_get_device(PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, | 512 | for (i = 0; i < (ARRAY_SIZE(s626_pci_table) - 1) && !pdev; i++) { |
508 | NULL); pdev != NULL; | 513 | ids = &s626_pci_table[i]; |
509 | pdev = pci_get_device(PCI_VENDOR_ID_S626, | 514 | do { |
510 | PCI_DEVICE_ID_S626, pdev)) { | 515 | pdev = pci_get_subsys(ids->vendor, ids->device, ids->subvendor, |
511 | if (it->options[0] || it->options[1]) { | 516 | ids->subdevice, pdev); |
512 | if (pdev->bus->number == it->options[0] && | 517 | |
513 | PCI_SLOT(pdev->devfn) == it->options[1]) { | 518 | if ((it->options[0] || it->options[1]) && pdev) { |
514 | /* matches requested bus/slot */ | 519 | /* matches requested bus/slot */ |
520 | if (pdev->bus->number == it->options[0] && | ||
521 | PCI_SLOT(pdev->devfn) == it->options[1]) | ||
522 | break; | ||
523 | } else | ||
515 | break; | 524 | break; |
516 | } | 525 | } while (1); |
517 | } else { | ||
518 | /* no bus/slot specified */ | ||
519 | break; | ||
520 | } | ||
521 | } | 526 | } |
522 | devpriv->pdev = pdev; | 527 | devpriv->pdev = pdev; |
523 | 528 | ||
diff --git a/drivers/staging/go7007/s2250-loader.c b/drivers/staging/go7007/s2250-loader.c index a5e4acab089e..bb22347af60e 100644 --- a/drivers/staging/go7007/s2250-loader.c +++ b/drivers/staging/go7007/s2250-loader.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/smp_lock.h> | ||
20 | #include <linux/usb.h> | 21 | #include <linux/usb.h> |
21 | #include <dvb-usb.h> | 22 | #include <dvb-usb.h> |
22 | 23 | ||
diff --git a/drivers/staging/meilhaus/TODO b/drivers/staging/meilhaus/TODO index 6ec25203089c..d6ce39823de6 100644 --- a/drivers/staging/meilhaus/TODO +++ b/drivers/staging/meilhaus/TODO | |||
@@ -7,4 +7,4 @@ TODO: | |||
7 | - possible comedi merge | 7 | - possible comedi merge |
8 | 8 | ||
9 | Please send cleanup patches to Greg Kroah-Hartman <greg@kroah.com> | 9 | Please send cleanup patches to Greg Kroah-Hartman <greg@kroah.com> |
10 | and CC: David Kiliani <mail@davidkiliani.de> | 10 | and CC: David Kiliani <mail@davidkiliani.de> and Meilhaus Support <support@meilhaus.de> |
diff --git a/drivers/staging/rspiusb/rspiusb.c b/drivers/staging/rspiusb/rspiusb.c index 1cdfe69585ea..2f8155c1968b 100644 --- a/drivers/staging/rspiusb/rspiusb.c +++ b/drivers/staging/rspiusb/rspiusb.c | |||
@@ -444,8 +444,7 @@ static void piusb_write_bulk_callback(struct urb *urb) | |||
444 | __func__, status); | 444 | __func__, status); |
445 | 445 | ||
446 | pdx->pendingWrite = 0; | 446 | pdx->pendingWrite = 0; |
447 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 447 | kfree(urb->transfer_buffer); |
448 | urb->transfer_buffer, urb->transfer_dma); | ||
449 | } | 448 | } |
450 | 449 | ||
451 | int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, | 450 | int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, |
@@ -457,9 +456,7 @@ int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, | |||
457 | 456 | ||
458 | urb = usb_alloc_urb(0, GFP_KERNEL); | 457 | urb = usb_alloc_urb(0, GFP_KERNEL); |
459 | if (urb != NULL) { | 458 | if (urb != NULL) { |
460 | kbuf = | 459 | kbuf = kmalloc(len, GFP_KERNEL); |
461 | usb_buffer_alloc(pdx->udev, len, GFP_KERNEL, | ||
462 | &urb->transfer_dma); | ||
463 | if (!kbuf) { | 460 | if (!kbuf) { |
464 | dev_err(&pdx->udev->dev, "buffer_alloc failed\n"); | 461 | dev_err(&pdx->udev->dev, "buffer_alloc failed\n"); |
465 | return -ENOMEM; | 462 | return -ENOMEM; |
@@ -470,7 +467,6 @@ int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, | |||
470 | } | 467 | } |
471 | usb_fill_bulk_urb(urb, pdx->udev, pdx->hEP[io->endpoint], kbuf, | 468 | usb_fill_bulk_urb(urb, pdx->udev, pdx->hEP[io->endpoint], kbuf, |
472 | len, piusb_write_bulk_callback, pdx); | 469 | len, piusb_write_bulk_callback, pdx); |
473 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
474 | err = usb_submit_urb(urb, GFP_KERNEL); | 470 | err = usb_submit_urb(urb, GFP_KERNEL); |
475 | if (err) { | 471 | if (err) { |
476 | dev_err(&pdx->udev->dev, | 472 | dev_err(&pdx->udev->dev, |
@@ -641,7 +637,7 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx) | |||
641 | numPagesRequired = | 637 | numPagesRequired = |
642 | ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT; | 638 | ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT; |
643 | dbg("Number of pages needed = %d", numPagesRequired); | 639 | dbg("Number of pages needed = %d", numPagesRequired); |
644 | maplist_p = vmalloc(numPagesRequired * sizeof(struct page)); | 640 | maplist_p = vmalloc(numPagesRequired * sizeof(struct page *)); |
645 | if (!maplist_p) { | 641 | if (!maplist_p) { |
646 | dbg("Can't Allocate Memory for maplist_p"); | 642 | dbg("Can't Allocate Memory for maplist_p"); |
647 | return -ENOMEM; | 643 | return -ENOMEM; |
@@ -712,9 +708,7 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx) | |||
712 | usb_fill_bulk_urb(pdx->PixelUrb[frameInfo][i], | 708 | usb_fill_bulk_urb(pdx->PixelUrb[frameInfo][i], |
713 | pdx->udev, | 709 | pdx->udev, |
714 | epAddr, | 710 | epAddr, |
715 | (dma_addr_t *) sg_dma_address(&pdx-> | 711 | NULL, // non-DMA HC? buy a better hardware |
716 | sgl[frameInfo] | ||
717 | [i]), | ||
718 | sg_dma_len(&pdx->sgl[frameInfo][i]), | 712 | sg_dma_len(&pdx->sgl[frameInfo][i]), |
719 | piusb_readPIXEL_callback, (void *)pdx); | 713 | piusb_readPIXEL_callback, (void *)pdx); |
720 | pdx->PixelUrb[frameInfo][i]->transfer_dma = | 714 | pdx->PixelUrb[frameInfo][i]->transfer_dma = |
diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h index 5e5b3f2b7eb1..29e3b53e52a1 100644 --- a/drivers/staging/rt2870/rt2870.h +++ b/drivers/staging/rt2870/rt2870.h | |||
@@ -89,6 +89,7 @@ | |||
89 | {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ \ | 89 | {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ \ |
90 | {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ \ | 90 | {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ \ |
91 | {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom */ \ | 91 | {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom */ \ |
92 | {USB_DEVICE(0x0DF6,0x003F)}, /* Sitecom WL-608 */ \ | ||
92 | {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ \ | 93 | {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ \ |
93 | {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ \ | 94 | {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ \ |
94 | {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ \ | 95 | {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ \ |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c index 93af37e2d31a..54b4b718f84a 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c | |||
@@ -461,19 +461,19 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, | |||
461 | struct iw_request_info *info, | 461 | struct iw_request_info *info, |
462 | union iwreq_data *wrqu, char *extra) | 462 | union iwreq_data *wrqu, char *extra) |
463 | { | 463 | { |
464 | strcpy(wrqu->name, "802.11"); | 464 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); |
465 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ | 465 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ |
466 | strcat(wrqu->name, "b"); | 466 | strlcat(wrqu->name, "b", IFNAMSIZ); |
467 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 467 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
468 | strcat(wrqu->name, "/g"); | 468 | strlcat(wrqu->name, "/g", IFNAMSIZ); |
469 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 469 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
470 | strcat(wrqu->name, "g"); | 470 | strlcat(wrqu->name, "g", IFNAMSIZ); |
471 | 471 | ||
472 | if((ieee->state == IEEE80211_LINKED) || | 472 | if((ieee->state == IEEE80211_LINKED) || |
473 | (ieee->state == IEEE80211_LINKED_SCANNING)) | 473 | (ieee->state == IEEE80211_LINKED_SCANNING)) |
474 | strcat(wrqu->name," linked"); | 474 | strlcat(wrqu->name," link", IFNAMSIZ); |
475 | else if(ieee->state != IEEE80211_NOLINK) | 475 | else if(ieee->state != IEEE80211_NOLINK) |
476 | strcat(wrqu->name," link.."); | 476 | strlcat(wrqu->name," .....", IFNAMSIZ); |
477 | 477 | ||
478 | 478 | ||
479 | return 0; | 479 | return 0; |
diff --git a/drivers/staging/rtl8192su/Kconfig b/drivers/staging/rtl8192su/Kconfig index 4b5552c5926e..770f41280f21 100644 --- a/drivers/staging/rtl8192su/Kconfig +++ b/drivers/staging/rtl8192su/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config RTL8192SU | 1 | config RTL8192SU |
2 | tristate "RealTek RTL8192SU Wireless LAN NIC driver" | 2 | tristate "RealTek RTL8192SU Wireless LAN NIC driver" |
3 | depends on PCI | 3 | depends on PCI |
4 | depends on WIRELESS_EXT && COMPAT_NET_DEV_OPS | 4 | depends on WIRELESS_EXT |
5 | default N | 5 | default N |
6 | ---help--- | 6 | ---help--- |
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c index f408b4583b82..759032db4a34 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c | |||
@@ -118,7 +118,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
118 | #else | 118 | #else |
119 | ieee = (struct ieee80211_device *)dev->priv; | 119 | ieee = (struct ieee80211_device *)dev->priv; |
120 | #endif | 120 | #endif |
121 | dev->hard_start_xmit = ieee80211_xmit; | ||
122 | 121 | ||
123 | memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); | 122 | memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); |
124 | ieee->dev = dev; | 123 | ieee->dev = dev; |
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c index 1f50c46dcb90..191dc3fbbe32 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c | |||
@@ -548,21 +548,21 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, | |||
548 | struct iw_request_info *info, | 548 | struct iw_request_info *info, |
549 | union iwreq_data *wrqu, char *extra) | 549 | union iwreq_data *wrqu, char *extra) |
550 | { | 550 | { |
551 | strcpy(wrqu->name, "802.11"); | 551 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); |
552 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ | 552 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ |
553 | strcat(wrqu->name, "b"); | 553 | strlcat(wrqu->name, "b", IFNAMSIZ); |
554 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 554 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
555 | strcat(wrqu->name, "/g"); | 555 | strlcat(wrqu->name, "/g", IFNAMSIZ); |
556 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 556 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
557 | strcat(wrqu->name, "g"); | 557 | strlcat(wrqu->name, "g", IFNAMSIZ); |
558 | if (ieee->mode & (IEEE_N_24G | IEEE_N_5G)) | 558 | if (ieee->mode & (IEEE_N_24G | IEEE_N_5G)) |
559 | strcat(wrqu->name, "/n"); | 559 | strlcat(wrqu->name, "/n", IFNAMSIZ); |
560 | 560 | ||
561 | if((ieee->state == IEEE80211_LINKED) || | 561 | if((ieee->state == IEEE80211_LINKED) || |
562 | (ieee->state == IEEE80211_LINKED_SCANNING)) | 562 | (ieee->state == IEEE80211_LINKED_SCANNING)) |
563 | strcat(wrqu->name," linked"); | 563 | strlcat(wrqu->name, " link", IFNAMSIZ); |
564 | else if(ieee->state != IEEE80211_NOLINK) | 564 | else if(ieee->state != IEEE80211_NOLINK) |
565 | strcat(wrqu->name," link.."); | 565 | strlcat(wrqu->name, " .....", IFNAMSIZ); |
566 | 566 | ||
567 | 567 | ||
568 | return 0; | 568 | return 0; |
diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c index f1423d714496..4ab250743e81 100644 --- a/drivers/staging/rtl8192su/r8192U_core.c +++ b/drivers/staging/rtl8192su/r8192U_core.c | |||
@@ -12132,6 +12132,19 @@ static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct | |||
12132 | } | 12132 | } |
12133 | #endif | 12133 | #endif |
12134 | 12134 | ||
12135 | static const struct net_device_ops rtl8192_netdev_ops = { | ||
12136 | .ndo_open = rtl8192_open, | ||
12137 | .ndo_stop = rtl8192_close, | ||
12138 | .ndo_get_stats = rtl8192_stats, | ||
12139 | .ndo_tx_timeout = tx_timeout, | ||
12140 | .ndo_do_ioctl = rtl8192_ioctl, | ||
12141 | .ndo_set_multicast_list = r8192_set_multicast, | ||
12142 | .ndo_set_mac_address = r8192_set_mac_adr, | ||
12143 | .ndo_validate_addr = eth_validate_addr, | ||
12144 | .ndo_change_mtu = eth_change_mtu, | ||
12145 | .ndo_start_xmit = ieee80211_xmit, | ||
12146 | }; | ||
12147 | |||
12135 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) | 12148 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) |
12136 | static int __devinit rtl8192_usb_probe(struct usb_interface *intf, | 12149 | static int __devinit rtl8192_usb_probe(struct usb_interface *intf, |
12137 | const struct usb_device_id *id) | 12150 | const struct usb_device_id *id) |
@@ -12186,15 +12199,7 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, | |||
12186 | priv->ops = &rtl8192u_ops; | 12199 | priv->ops = &rtl8192u_ops; |
12187 | #endif | 12200 | #endif |
12188 | 12201 | ||
12189 | dev->open = rtl8192_open; | 12202 | dev->netdev_ops = &rtl8192_netdev_ops; |
12190 | dev->stop = rtl8192_close; | ||
12191 | //dev->hard_start_xmit = rtl8192_8023_hard_start_xmit; | ||
12192 | dev->tx_timeout = tx_timeout; | ||
12193 | //dev->wireless_handlers = &r8192_wx_handlers_def; | ||
12194 | dev->do_ioctl = rtl8192_ioctl; | ||
12195 | dev->set_multicast_list = r8192_set_multicast; | ||
12196 | dev->set_mac_address = r8192_set_mac_adr; | ||
12197 | dev->get_stats = rtl8192_stats; | ||
12198 | 12203 | ||
12199 | //DMESG("Oops: i'm coming\n"); | 12204 | //DMESG("Oops: i'm coming\n"); |
12200 | #if WIRELESS_EXT >= 12 | 12205 | #if WIRELESS_EXT >= 12 |
diff --git a/drivers/staging/rtl8192su/r8192U_pm.c b/drivers/staging/rtl8192su/r8192U_pm.c index 92c95aa36638..b1531a8d0cde 100644 --- a/drivers/staging/rtl8192su/r8192U_pm.c +++ b/drivers/staging/rtl8192su/r8192U_pm.c | |||
@@ -35,7 +35,9 @@ int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state) | |||
35 | return 0; | 35 | return 0; |
36 | } | 36 | } |
37 | 37 | ||
38 | dev->stop(dev); | 38 | if (dev->netdev_ops->ndo_stop) |
39 | dev->netdev_ops->ndo_stop(dev); | ||
40 | |||
39 | mdelay(10); | 41 | mdelay(10); |
40 | 42 | ||
41 | netif_device_detach(dev); | 43 | netif_device_detach(dev); |
@@ -61,7 +63,9 @@ int rtl8192U_resume (struct usb_interface *intf) | |||
61 | } | 63 | } |
62 | 64 | ||
63 | netif_device_attach(dev); | 65 | netif_device_attach(dev); |
64 | dev->open(dev); | 66 | |
67 | if (dev->netdev_ops->ndo_open) | ||
68 | dev->netdev_ops->ndo_open(dev); | ||
65 | } | 69 | } |
66 | 70 | ||
67 | return 0; | 71 | return 0; |
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 90b29b564631..a9bd4106beb7 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c | |||
@@ -866,7 +866,7 @@ static void qt_release(struct usb_serial *serial) | |||
866 | 866 | ||
867 | } | 867 | } |
868 | 868 | ||
869 | int qt_open(struct tty_struct *tty, | 869 | static int qt_open(struct tty_struct *tty, |
870 | struct usb_serial_port *port, struct file *filp) | 870 | struct usb_serial_port *port, struct file *filp) |
871 | { | 871 | { |
872 | struct usb_serial *serial; | 872 | struct usb_serial *serial; |
@@ -1041,17 +1041,19 @@ static void qt_block_until_empty(struct tty_struct *tty, | |||
1041 | } | 1041 | } |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | static void qt_close(struct tty_struct *tty, struct usb_serial_port *port, | 1044 | static void qt_close( struct usb_serial_port *port) |
1045 | struct file *filp) | ||
1046 | { | 1045 | { |
1047 | struct usb_serial *serial = port->serial; | 1046 | struct usb_serial *serial = port->serial; |
1048 | struct quatech_port *qt_port; | 1047 | struct quatech_port *qt_port; |
1049 | struct quatech_port *port0; | 1048 | struct quatech_port *port0; |
1049 | struct tty_struct *tty; | ||
1050 | int status; | 1050 | int status; |
1051 | unsigned int index; | 1051 | unsigned int index; |
1052 | status = 0; | 1052 | status = 0; |
1053 | 1053 | ||
1054 | dbg("%s - port %d\n", __func__, port->number); | 1054 | dbg("%s - port %d\n", __func__, port->number); |
1055 | |||
1056 | tty = tty_port_tty_get(&port->port); | ||
1055 | index = tty->index - serial->minor; | 1057 | index = tty->index - serial->minor; |
1056 | 1058 | ||
1057 | qt_port = qt_get_port_private(port); | 1059 | qt_port = qt_get_port_private(port); |
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c index cfdaac9b747e..a137c78fac09 100644 --- a/drivers/staging/stlc45xx/stlc45xx.c +++ b/drivers/staging/stlc45xx/stlc45xx.c | |||
@@ -2235,24 +2235,6 @@ static void stlc45xx_op_remove_interface(struct ieee80211_hw *hw, | |||
2235 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); | 2235 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); |
2236 | } | 2236 | } |
2237 | 2237 | ||
2238 | static int stlc45xx_op_config_interface(struct ieee80211_hw *hw, | ||
2239 | struct ieee80211_vif *vif, | ||
2240 | struct ieee80211_if_conf *conf) | ||
2241 | { | ||
2242 | struct stlc45xx *stlc = hw->priv; | ||
2243 | |||
2244 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); | ||
2245 | |||
2246 | mutex_lock(&stlc->mutex); | ||
2247 | |||
2248 | memcpy(stlc->bssid, conf->bssid, ETH_ALEN); | ||
2249 | stlc45xx_tx_setup(stlc); | ||
2250 | |||
2251 | mutex_unlock(&stlc->mutex); | ||
2252 | |||
2253 | return 0; | ||
2254 | } | ||
2255 | |||
2256 | static int stlc45xx_op_config(struct ieee80211_hw *hw, u32 changed) | 2238 | static int stlc45xx_op_config(struct ieee80211_hw *hw, u32 changed) |
2257 | { | 2239 | { |
2258 | struct stlc45xx *stlc = hw->priv; | 2240 | struct stlc45xx *stlc = hw->priv; |
@@ -2295,6 +2277,14 @@ static void stlc45xx_op_bss_info_changed(struct ieee80211_hw *hw, | |||
2295 | { | 2277 | { |
2296 | struct stlc45xx *stlc = hw->priv; | 2278 | struct stlc45xx *stlc = hw->priv; |
2297 | 2279 | ||
2280 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); | ||
2281 | mutex_lock(&stlc->mutex); | ||
2282 | |||
2283 | memcpy(stlc->bssid, info->bssid, ETH_ALEN); | ||
2284 | stlc45xx_tx_setup(stlc); | ||
2285 | |||
2286 | mutex_unlock(&stlc->mutex); | ||
2287 | |||
2298 | if (changed & BSS_CHANGED_ASSOC) { | 2288 | if (changed & BSS_CHANGED_ASSOC) { |
2299 | stlc->associated = info->assoc; | 2289 | stlc->associated = info->assoc; |
2300 | if (info->assoc) | 2290 | if (info->assoc) |
@@ -2357,7 +2347,6 @@ static const struct ieee80211_ops stlc45xx_ops = { | |||
2357 | .add_interface = stlc45xx_op_add_interface, | 2347 | .add_interface = stlc45xx_op_add_interface, |
2358 | .remove_interface = stlc45xx_op_remove_interface, | 2348 | .remove_interface = stlc45xx_op_remove_interface, |
2359 | .config = stlc45xx_op_config, | 2349 | .config = stlc45xx_op_config, |
2360 | .config_interface = stlc45xx_op_config_interface, | ||
2361 | .configure_filter = stlc45xx_op_configure_filter, | 2350 | .configure_filter = stlc45xx_op_configure_filter, |
2362 | .tx = stlc45xx_op_tx, | 2351 | .tx = stlc45xx_op_tx, |
2363 | .bss_info_changed = stlc45xx_op_bss_info_changed, | 2352 | .bss_info_changed = stlc45xx_op_bss_info_changed, |
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 22f93dd0ba03..251220dc8851 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/smp_lock.h> | ||
21 | #include <linux/file.h> | 22 | #include <linux/file.h> |
22 | #include <linux/tcp.h> | 23 | #include <linux/tcp.h> |
23 | #include <linux/in.h> | 24 | #include <linux/in.h> |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index a10ed27acbc2..f43ca416e4a8 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -344,7 +344,7 @@ static CHIP_INFO chip_info_table[]= { | |||
344 | }; | 344 | }; |
345 | 345 | ||
346 | static struct pci_device_id device_id_table[] __devinitdata = { | 346 | static struct pci_device_id device_id_table[] __devinitdata = { |
347 | { 0x1106, 0x3253, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (int)&chip_info_table[0]}, | 347 | { 0x1106, 0x3253, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long)&chip_info_table[0]}, |
348 | { 0, } | 348 | { 0, } |
349 | }; | 349 | }; |
350 | #endif | 350 | #endif |
@@ -369,7 +369,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | |||
369 | 369 | ||
370 | #ifdef CONFIG_PM | 370 | #ifdef CONFIG_PM |
371 | static int device_notify_reboot(struct notifier_block *, unsigned long event, void *ptr); | 371 | static int device_notify_reboot(struct notifier_block *, unsigned long event, void *ptr); |
372 | static int viawget_suspend(struct pci_dev *pcid, u32 state); | 372 | static int viawget_suspend(struct pci_dev *pcid, pm_message_t state); |
373 | static int viawget_resume(struct pci_dev *pcid); | 373 | static int viawget_resume(struct pci_dev *pcid); |
374 | struct notifier_block device_notifier = { | 374 | struct notifier_block device_notifier = { |
375 | notifier_call: device_notify_reboot, | 375 | notifier_call: device_notify_reboot, |
@@ -3941,7 +3941,7 @@ device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p) | |||
3941 | while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { | 3941 | while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { |
3942 | if(pci_dev_driver(pdev) == &device_driver) { | 3942 | if(pci_dev_driver(pdev) == &device_driver) { |
3943 | if (pci_get_drvdata(pdev)) | 3943 | if (pci_get_drvdata(pdev)) |
3944 | viawget_suspend(pdev, 3); | 3944 | viawget_suspend(pdev, PMSG_HIBERNATE); |
3945 | } | 3945 | } |
3946 | } | 3946 | } |
3947 | } | 3947 | } |
@@ -3949,7 +3949,7 @@ device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p) | |||
3949 | } | 3949 | } |
3950 | 3950 | ||
3951 | static int | 3951 | static int |
3952 | viawget_suspend(struct pci_dev *pcid, u32 state) | 3952 | viawget_suspend(struct pci_dev *pcid, pm_message_t state) |
3953 | { | 3953 | { |
3954 | int power_status; // to silence the compiler | 3954 | int power_status; // to silence the compiler |
3955 | 3955 | ||
@@ -3971,7 +3971,7 @@ viawget_suspend(struct pci_dev *pcid, u32 state) | |||
3971 | memset(pMgmt->abyCurrBSSID, 0, 6); | 3971 | memset(pMgmt->abyCurrBSSID, 0, 6); |
3972 | pMgmt->eCurrState = WMAC_STATE_IDLE; | 3972 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
3973 | pci_disable_device(pcid); | 3973 | pci_disable_device(pcid); |
3974 | power_status = pci_set_power_state(pcid, state); | 3974 | power_status = pci_set_power_state(pcid, pci_choose_state(pcid, state)); |
3975 | spin_unlock_irq(&pDevice->lock); | 3975 | spin_unlock_irq(&pDevice->lock); |
3976 | return 0; | 3976 | return 0; |
3977 | } | 3977 | } |
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c index a913efc69669..40de151f2789 100644 --- a/drivers/telephony/ixj.c +++ b/drivers/telephony/ixj.c | |||
@@ -257,6 +257,7 @@ | |||
257 | #include <linux/fs.h> /* everything... */ | 257 | #include <linux/fs.h> /* everything... */ |
258 | #include <linux/errno.h> /* error codes */ | 258 | #include <linux/errno.h> /* error codes */ |
259 | #include <linux/slab.h> | 259 | #include <linux/slab.h> |
260 | #include <linux/smp_lock.h> | ||
260 | #include <linux/mm.h> | 261 | #include <linux/mm.h> |
261 | #include <linux/ioport.h> | 262 | #include <linux/ioport.h> |
262 | #include <linux/interrupt.h> | 263 | #include <linux/interrupt.h> |
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index b52cc830c0b4..f3873f650bb4 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/phonedev.h> | 24 | #include <linux/phonedev.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/smp_lock.h> | ||
27 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
28 | #include <asm/system.h> | 27 | #include <asm/system.h> |
29 | 28 | ||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 3f1045993474..5b15d9d8896b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -387,6 +387,7 @@ static void acm_rx_tasklet(unsigned long _acm) | |||
387 | struct acm_ru *rcv; | 387 | struct acm_ru *rcv; |
388 | unsigned long flags; | 388 | unsigned long flags; |
389 | unsigned char throttled; | 389 | unsigned char throttled; |
390 | struct usb_host_endpoint *ep; | ||
390 | 391 | ||
391 | dbg("Entering acm_rx_tasklet"); | 392 | dbg("Entering acm_rx_tasklet"); |
392 | 393 | ||
@@ -462,11 +463,20 @@ urbs: | |||
462 | 463 | ||
463 | rcv->buffer = buf; | 464 | rcv->buffer = buf; |
464 | 465 | ||
465 | usb_fill_bulk_urb(rcv->urb, acm->dev, | 466 | ep = (usb_pipein(acm->rx_endpoint) ? acm->dev->ep_in : acm->dev->ep_out) |
466 | acm->rx_endpoint, | 467 | [usb_pipeendpoint(acm->rx_endpoint)]; |
467 | buf->base, | 468 | if (usb_endpoint_xfer_int(&ep->desc)) |
468 | acm->readsize, | 469 | usb_fill_int_urb(rcv->urb, acm->dev, |
469 | acm_read_bulk, rcv); | 470 | acm->rx_endpoint, |
471 | buf->base, | ||
472 | acm->readsize, | ||
473 | acm_read_bulk, rcv, ep->desc.bInterval); | ||
474 | else | ||
475 | usb_fill_bulk_urb(rcv->urb, acm->dev, | ||
476 | acm->rx_endpoint, | ||
477 | buf->base, | ||
478 | acm->readsize, | ||
479 | acm_read_bulk, rcv); | ||
470 | rcv->urb->transfer_dma = buf->dma; | 480 | rcv->urb->transfer_dma = buf->dma; |
471 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 481 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
472 | 482 | ||
@@ -1227,9 +1237,14 @@ made_compressed_probe: | |||
1227 | goto alloc_fail7; | 1237 | goto alloc_fail7; |
1228 | } | 1238 | } |
1229 | 1239 | ||
1230 | usb_fill_bulk_urb(snd->urb, usb_dev, | 1240 | if (usb_endpoint_xfer_int(epwrite)) |
1231 | usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), | 1241 | usb_fill_int_urb(snd->urb, usb_dev, |
1232 | NULL, acm->writesize, acm_write_bulk, snd); | 1242 | usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), |
1243 | NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval); | ||
1244 | else | ||
1245 | usb_fill_bulk_urb(snd->urb, usb_dev, | ||
1246 | usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), | ||
1247 | NULL, acm->writesize, acm_write_bulk, snd); | ||
1233 | snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 1248 | snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
1234 | snd->instance = acm; | 1249 | snd->instance = acm; |
1235 | } | 1250 | } |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 0fe434505ac4..ba589d4ca8bc 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
20 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
21 | #include <linux/bitops.h> | 20 | #include <linux/bitops.h> |
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 3703789d0d2a..b09a527f7341 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
@@ -751,7 +751,7 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
751 | { | 751 | { |
752 | struct device *dev = &data->usb_dev->dev; | 752 | struct device *dev = &data->usb_dev->dev; |
753 | char *buffer; | 753 | char *buffer; |
754 | int rv; | 754 | int rv = 0; |
755 | 755 | ||
756 | buffer = kmalloc(0x18, GFP_KERNEL); | 756 | buffer = kmalloc(0x18, GFP_KERNEL); |
757 | if (!buffer) | 757 | if (!buffer) |
@@ -763,7 +763,7 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
763 | 0, 0, buffer, 0x18, USBTMC_TIMEOUT); | 763 | 0, 0, buffer, 0x18, USBTMC_TIMEOUT); |
764 | if (rv < 0) { | 764 | if (rv < 0) { |
765 | dev_err(dev, "usb_control_msg returned %d\n", rv); | 765 | dev_err(dev, "usb_control_msg returned %d\n", rv); |
766 | return rv; | 766 | goto err_out; |
767 | } | 767 | } |
768 | 768 | ||
769 | dev_dbg(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); | 769 | dev_dbg(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); |
@@ -773,7 +773,8 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
773 | dev_dbg(dev, "USB488 device capabilities are %x\n", buffer[15]); | 773 | dev_dbg(dev, "USB488 device capabilities are %x\n", buffer[15]); |
774 | if (buffer[0] != USBTMC_STATUS_SUCCESS) { | 774 | if (buffer[0] != USBTMC_STATUS_SUCCESS) { |
775 | dev_err(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); | 775 | dev_err(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); |
776 | return -EPERM; | 776 | rv = -EPERM; |
777 | goto err_out; | ||
777 | } | 778 | } |
778 | 779 | ||
779 | data->capabilities.interface_capabilities = buffer[4]; | 780 | data->capabilities.interface_capabilities = buffer[4]; |
@@ -781,8 +782,9 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
781 | data->capabilities.usb488_interface_capabilities = buffer[14]; | 782 | data->capabilities.usb488_interface_capabilities = buffer[14]; |
782 | data->capabilities.usb488_device_capabilities = buffer[15]; | 783 | data->capabilities.usb488_device_capabilities = buffer[15]; |
783 | 784 | ||
785 | err_out: | ||
784 | kfree(buffer); | 786 | kfree(buffer); |
785 | return 0; | 787 | return rv; |
786 | } | 788 | } |
787 | 789 | ||
788 | #define capability_attribute(name) \ | 790 | #define capability_attribute(name) \ |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 69280c35b5cb..ad925946f869 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -28,7 +28,7 @@ comment "Miscellaneous USB options" | |||
28 | depends on USB | 28 | depends on USB |
29 | 29 | ||
30 | config USB_DEVICEFS | 30 | config USB_DEVICEFS |
31 | bool "USB device filesystem (DEPRECATED)" if EMBEDDED | 31 | bool "USB device filesystem (DEPRECATED)" |
32 | depends on USB | 32 | depends on USB |
33 | ---help--- | 33 | ---help--- |
34 | If you say Y here (and to "/proc file system support" in the "File | 34 | If you say Y here (and to "/proc file system support" in the "File |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 73c108d117b4..96f11715cd26 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -136,17 +136,19 @@ static const struct class_info clas_info[] = | |||
136 | {USB_CLASS_AUDIO, "audio"}, | 136 | {USB_CLASS_AUDIO, "audio"}, |
137 | {USB_CLASS_COMM, "comm."}, | 137 | {USB_CLASS_COMM, "comm."}, |
138 | {USB_CLASS_HID, "HID"}, | 138 | {USB_CLASS_HID, "HID"}, |
139 | {USB_CLASS_HUB, "hub"}, | ||
140 | {USB_CLASS_PHYSICAL, "PID"}, | 139 | {USB_CLASS_PHYSICAL, "PID"}, |
140 | {USB_CLASS_STILL_IMAGE, "still"}, | ||
141 | {USB_CLASS_PRINTER, "print"}, | 141 | {USB_CLASS_PRINTER, "print"}, |
142 | {USB_CLASS_MASS_STORAGE, "stor."}, | 142 | {USB_CLASS_MASS_STORAGE, "stor."}, |
143 | {USB_CLASS_HUB, "hub"}, | ||
143 | {USB_CLASS_CDC_DATA, "data"}, | 144 | {USB_CLASS_CDC_DATA, "data"}, |
144 | {USB_CLASS_APP_SPEC, "app."}, | ||
145 | {USB_CLASS_VENDOR_SPEC, "vend."}, | ||
146 | {USB_CLASS_STILL_IMAGE, "still"}, | ||
147 | {USB_CLASS_CSCID, "scard"}, | 145 | {USB_CLASS_CSCID, "scard"}, |
148 | {USB_CLASS_CONTENT_SEC, "c-sec"}, | 146 | {USB_CLASS_CONTENT_SEC, "c-sec"}, |
149 | {USB_CLASS_VIDEO, "video"}, | 147 | {USB_CLASS_VIDEO, "video"}, |
148 | {USB_CLASS_WIRELESS_CONTROLLER, "wlcon"}, | ||
149 | {USB_CLASS_MISC, "misc"}, | ||
150 | {USB_CLASS_APP_SPEC, "app."}, | ||
151 | {USB_CLASS_VENDOR_SPEC, "vend."}, | ||
150 | {-1, "unk."} /* leave as last */ | 152 | {-1, "unk."} /* leave as last */ |
151 | }; | 153 | }; |
152 | 154 | ||
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 308609039c73..38b8bce782d6 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -325,21 +325,34 @@ static void async_completed(struct urb *urb) | |||
325 | struct async *as = urb->context; | 325 | struct async *as = urb->context; |
326 | struct dev_state *ps = as->ps; | 326 | struct dev_state *ps = as->ps; |
327 | struct siginfo sinfo; | 327 | struct siginfo sinfo; |
328 | struct pid *pid = NULL; | ||
329 | uid_t uid = 0; | ||
330 | uid_t euid = 0; | ||
331 | u32 secid = 0; | ||
332 | int signr; | ||
328 | 333 | ||
329 | spin_lock(&ps->lock); | 334 | spin_lock(&ps->lock); |
330 | list_move_tail(&as->asynclist, &ps->async_completed); | 335 | list_move_tail(&as->asynclist, &ps->async_completed); |
331 | spin_unlock(&ps->lock); | ||
332 | as->status = urb->status; | 336 | as->status = urb->status; |
333 | if (as->signr) { | 337 | signr = as->signr; |
338 | if (signr) { | ||
334 | sinfo.si_signo = as->signr; | 339 | sinfo.si_signo = as->signr; |
335 | sinfo.si_errno = as->status; | 340 | sinfo.si_errno = as->status; |
336 | sinfo.si_code = SI_ASYNCIO; | 341 | sinfo.si_code = SI_ASYNCIO; |
337 | sinfo.si_addr = as->userurb; | 342 | sinfo.si_addr = as->userurb; |
338 | kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid, | 343 | pid = as->pid; |
339 | as->euid, as->secid); | 344 | uid = as->uid; |
345 | euid = as->euid; | ||
346 | secid = as->secid; | ||
340 | } | 347 | } |
341 | snoop(&urb->dev->dev, "urb complete\n"); | 348 | snoop(&urb->dev->dev, "urb complete\n"); |
342 | snoop_urb(urb, as->userurb); | 349 | snoop_urb(urb, as->userurb); |
350 | spin_unlock(&ps->lock); | ||
351 | |||
352 | if (signr) | ||
353 | kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid, | ||
354 | euid, secid); | ||
355 | |||
343 | wake_up(&ps->wait); | 356 | wake_up(&ps->wait); |
344 | } | 357 | } |
345 | 358 | ||
@@ -982,7 +995,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
982 | USBDEVFS_URB_ZERO_PACKET | | 995 | USBDEVFS_URB_ZERO_PACKET | |
983 | USBDEVFS_URB_NO_INTERRUPT)) | 996 | USBDEVFS_URB_NO_INTERRUPT)) |
984 | return -EINVAL; | 997 | return -EINVAL; |
985 | if (!uurb->buffer) | 998 | if (uurb->buffer_length > 0 && !uurb->buffer) |
986 | return -EINVAL; | 999 | return -EINVAL; |
987 | if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && | 1000 | if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && |
988 | (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) { | 1001 | (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) { |
@@ -1038,11 +1051,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1038 | is_in = 0; | 1051 | is_in = 0; |
1039 | uurb->endpoint &= ~USB_DIR_IN; | 1052 | uurb->endpoint &= ~USB_DIR_IN; |
1040 | } | 1053 | } |
1041 | if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, | ||
1042 | uurb->buffer, uurb->buffer_length)) { | ||
1043 | kfree(dr); | ||
1044 | return -EFAULT; | ||
1045 | } | ||
1046 | snoop(&ps->dev->dev, "control urb: bRequest=%02x " | 1054 | snoop(&ps->dev->dev, "control urb: bRequest=%02x " |
1047 | "bRrequestType=%02x wValue=%04x " | 1055 | "bRrequestType=%02x wValue=%04x " |
1048 | "wIndex=%04x wLength=%04x\n", | 1056 | "wIndex=%04x wLength=%04x\n", |
@@ -1062,9 +1070,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1062 | uurb->number_of_packets = 0; | 1070 | uurb->number_of_packets = 0; |
1063 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | 1071 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) |
1064 | return -EINVAL; | 1072 | return -EINVAL; |
1065 | if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, | ||
1066 | uurb->buffer, uurb->buffer_length)) | ||
1067 | return -EFAULT; | ||
1068 | snoop(&ps->dev->dev, "bulk urb\n"); | 1073 | snoop(&ps->dev->dev, "bulk urb\n"); |
1069 | break; | 1074 | break; |
1070 | 1075 | ||
@@ -1106,28 +1111,35 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1106 | return -EINVAL; | 1111 | return -EINVAL; |
1107 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | 1112 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) |
1108 | return -EINVAL; | 1113 | return -EINVAL; |
1109 | if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, | ||
1110 | uurb->buffer, uurb->buffer_length)) | ||
1111 | return -EFAULT; | ||
1112 | snoop(&ps->dev->dev, "interrupt urb\n"); | 1114 | snoop(&ps->dev->dev, "interrupt urb\n"); |
1113 | break; | 1115 | break; |
1114 | 1116 | ||
1115 | default: | 1117 | default: |
1116 | return -EINVAL; | 1118 | return -EINVAL; |
1117 | } | 1119 | } |
1118 | as = alloc_async(uurb->number_of_packets); | 1120 | if (uurb->buffer_length > 0 && |
1119 | if (!as) { | 1121 | !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, |
1122 | uurb->buffer, uurb->buffer_length)) { | ||
1120 | kfree(isopkt); | 1123 | kfree(isopkt); |
1121 | kfree(dr); | 1124 | kfree(dr); |
1122 | return -ENOMEM; | 1125 | return -EFAULT; |
1123 | } | 1126 | } |
1124 | as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL); | 1127 | as = alloc_async(uurb->number_of_packets); |
1125 | if (!as->urb->transfer_buffer) { | 1128 | if (!as) { |
1126 | kfree(isopkt); | 1129 | kfree(isopkt); |
1127 | kfree(dr); | 1130 | kfree(dr); |
1128 | free_async(as); | ||
1129 | return -ENOMEM; | 1131 | return -ENOMEM; |
1130 | } | 1132 | } |
1133 | if (uurb->buffer_length > 0) { | ||
1134 | as->urb->transfer_buffer = kmalloc(uurb->buffer_length, | ||
1135 | GFP_KERNEL); | ||
1136 | if (!as->urb->transfer_buffer) { | ||
1137 | kfree(isopkt); | ||
1138 | kfree(dr); | ||
1139 | free_async(as); | ||
1140 | return -ENOMEM; | ||
1141 | } | ||
1142 | } | ||
1131 | as->urb->dev = ps->dev; | 1143 | as->urb->dev = ps->dev; |
1132 | as->urb->pipe = (uurb->type << 30) | | 1144 | as->urb->pipe = (uurb->type << 30) | |
1133 | __create_pipe(ps->dev, uurb->endpoint & 0xf) | | 1145 | __create_pipe(ps->dev, uurb->endpoint & 0xf) | |
@@ -1169,7 +1181,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1169 | kfree(isopkt); | 1181 | kfree(isopkt); |
1170 | as->ps = ps; | 1182 | as->ps = ps; |
1171 | as->userurb = arg; | 1183 | as->userurb = arg; |
1172 | if (uurb->endpoint & USB_DIR_IN) | 1184 | if (is_in && uurb->buffer_length > 0) |
1173 | as->userbuffer = uurb->buffer; | 1185 | as->userbuffer = uurb->buffer; |
1174 | else | 1186 | else |
1175 | as->userbuffer = NULL; | 1187 | as->userbuffer = NULL; |
@@ -1179,9 +1191,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1179 | as->uid = cred->uid; | 1191 | as->uid = cred->uid; |
1180 | as->euid = cred->euid; | 1192 | as->euid = cred->euid; |
1181 | security_task_getsecid(current, &as->secid); | 1193 | security_task_getsecid(current, &as->secid); |
1182 | if (!is_in) { | 1194 | if (!is_in && uurb->buffer_length > 0) { |
1183 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, | 1195 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, |
1184 | as->urb->transfer_buffer_length)) { | 1196 | uurb->buffer_length)) { |
1185 | free_async(as); | 1197 | free_async(as); |
1186 | return -EFAULT; | 1198 | return -EFAULT; |
1187 | } | 1199 | } |
@@ -1231,22 +1243,22 @@ static int processcompl(struct async *as, void __user * __user *arg) | |||
1231 | if (as->userbuffer) | 1243 | if (as->userbuffer) |
1232 | if (copy_to_user(as->userbuffer, urb->transfer_buffer, | 1244 | if (copy_to_user(as->userbuffer, urb->transfer_buffer, |
1233 | urb->transfer_buffer_length)) | 1245 | urb->transfer_buffer_length)) |
1234 | return -EFAULT; | 1246 | goto err_out; |
1235 | if (put_user(as->status, &userurb->status)) | 1247 | if (put_user(as->status, &userurb->status)) |
1236 | return -EFAULT; | 1248 | goto err_out; |
1237 | if (put_user(urb->actual_length, &userurb->actual_length)) | 1249 | if (put_user(urb->actual_length, &userurb->actual_length)) |
1238 | return -EFAULT; | 1250 | goto err_out; |
1239 | if (put_user(urb->error_count, &userurb->error_count)) | 1251 | if (put_user(urb->error_count, &userurb->error_count)) |
1240 | return -EFAULT; | 1252 | goto err_out; |
1241 | 1253 | ||
1242 | if (usb_endpoint_xfer_isoc(&urb->ep->desc)) { | 1254 | if (usb_endpoint_xfer_isoc(&urb->ep->desc)) { |
1243 | for (i = 0; i < urb->number_of_packets; i++) { | 1255 | for (i = 0; i < urb->number_of_packets; i++) { |
1244 | if (put_user(urb->iso_frame_desc[i].actual_length, | 1256 | if (put_user(urb->iso_frame_desc[i].actual_length, |
1245 | &userurb->iso_frame_desc[i].actual_length)) | 1257 | &userurb->iso_frame_desc[i].actual_length)) |
1246 | return -EFAULT; | 1258 | goto err_out; |
1247 | if (put_user(urb->iso_frame_desc[i].status, | 1259 | if (put_user(urb->iso_frame_desc[i].status, |
1248 | &userurb->iso_frame_desc[i].status)) | 1260 | &userurb->iso_frame_desc[i].status)) |
1249 | return -EFAULT; | 1261 | goto err_out; |
1250 | } | 1262 | } |
1251 | } | 1263 | } |
1252 | 1264 | ||
@@ -1255,6 +1267,10 @@ static int processcompl(struct async *as, void __user * __user *arg) | |||
1255 | if (put_user(addr, (void __user * __user *)arg)) | 1267 | if (put_user(addr, (void __user * __user *)arg)) |
1256 | return -EFAULT; | 1268 | return -EFAULT; |
1257 | return 0; | 1269 | return 0; |
1270 | |||
1271 | err_out: | ||
1272 | free_async(as); | ||
1273 | return -EFAULT; | ||
1258 | } | 1274 | } |
1259 | 1275 | ||
1260 | static struct async *reap_as(struct dev_state *ps) | 1276 | static struct async *reap_as(struct dev_state *ps) |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index d397ecfd5b17..ec5c67ea07b7 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -227,6 +227,10 @@ struct hc_driver { | |||
227 | /* has a port been handed over to a companion? */ | 227 | /* has a port been handed over to a companion? */ |
228 | int (*port_handed_over)(struct usb_hcd *, int); | 228 | int (*port_handed_over)(struct usb_hcd *, int); |
229 | 229 | ||
230 | /* CLEAR_TT_BUFFER completion callback */ | ||
231 | void (*clear_tt_buffer_complete)(struct usb_hcd *, | ||
232 | struct usb_host_endpoint *); | ||
233 | |||
230 | /* xHCI specific functions */ | 234 | /* xHCI specific functions */ |
231 | /* Called by usb_alloc_dev to alloc HC device structures */ | 235 | /* Called by usb_alloc_dev to alloc HC device structures */ |
232 | int (*alloc_dev)(struct usb_hcd *, struct usb_device *); | 236 | int (*alloc_dev)(struct usb_hcd *, struct usb_device *); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 2af3b4f06054..71f86c60d83c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -450,10 +450,10 @@ hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt) | |||
450 | * talking to TTs must queue control transfers (not just bulk and iso), so | 450 | * talking to TTs must queue control transfers (not just bulk and iso), so |
451 | * both can talk to the same hub concurrently. | 451 | * both can talk to the same hub concurrently. |
452 | */ | 452 | */ |
453 | static void hub_tt_kevent (struct work_struct *work) | 453 | static void hub_tt_work(struct work_struct *work) |
454 | { | 454 | { |
455 | struct usb_hub *hub = | 455 | struct usb_hub *hub = |
456 | container_of(work, struct usb_hub, tt.kevent); | 456 | container_of(work, struct usb_hub, tt.clear_work); |
457 | unsigned long flags; | 457 | unsigned long flags; |
458 | int limit = 100; | 458 | int limit = 100; |
459 | 459 | ||
@@ -462,6 +462,7 @@ static void hub_tt_kevent (struct work_struct *work) | |||
462 | struct list_head *next; | 462 | struct list_head *next; |
463 | struct usb_tt_clear *clear; | 463 | struct usb_tt_clear *clear; |
464 | struct usb_device *hdev = hub->hdev; | 464 | struct usb_device *hdev = hub->hdev; |
465 | const struct hc_driver *drv; | ||
465 | int status; | 466 | int status; |
466 | 467 | ||
467 | next = hub->tt.clear_list.next; | 468 | next = hub->tt.clear_list.next; |
@@ -471,21 +472,25 @@ static void hub_tt_kevent (struct work_struct *work) | |||
471 | /* drop lock so HCD can concurrently report other TT errors */ | 472 | /* drop lock so HCD can concurrently report other TT errors */ |
472 | spin_unlock_irqrestore (&hub->tt.lock, flags); | 473 | spin_unlock_irqrestore (&hub->tt.lock, flags); |
473 | status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt); | 474 | status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt); |
474 | spin_lock_irqsave (&hub->tt.lock, flags); | ||
475 | |||
476 | if (status) | 475 | if (status) |
477 | dev_err (&hdev->dev, | 476 | dev_err (&hdev->dev, |
478 | "clear tt %d (%04x) error %d\n", | 477 | "clear tt %d (%04x) error %d\n", |
479 | clear->tt, clear->devinfo, status); | 478 | clear->tt, clear->devinfo, status); |
479 | |||
480 | /* Tell the HCD, even if the operation failed */ | ||
481 | drv = clear->hcd->driver; | ||
482 | if (drv->clear_tt_buffer_complete) | ||
483 | (drv->clear_tt_buffer_complete)(clear->hcd, clear->ep); | ||
484 | |||
480 | kfree(clear); | 485 | kfree(clear); |
486 | spin_lock_irqsave(&hub->tt.lock, flags); | ||
481 | } | 487 | } |
482 | spin_unlock_irqrestore (&hub->tt.lock, flags); | 488 | spin_unlock_irqrestore (&hub->tt.lock, flags); |
483 | } | 489 | } |
484 | 490 | ||
485 | /** | 491 | /** |
486 | * usb_hub_tt_clear_buffer - clear control/bulk TT state in high speed hub | 492 | * usb_hub_clear_tt_buffer - clear control/bulk TT state in high speed hub |
487 | * @udev: the device whose split transaction failed | 493 | * @urb: an URB associated with the failed or incomplete split transaction |
488 | * @pipe: identifies the endpoint of the failed transaction | ||
489 | * | 494 | * |
490 | * High speed HCDs use this to tell the hub driver that some split control or | 495 | * High speed HCDs use this to tell the hub driver that some split control or |
491 | * bulk transaction failed in a way that requires clearing internal state of | 496 | * bulk transaction failed in a way that requires clearing internal state of |
@@ -495,8 +500,10 @@ static void hub_tt_kevent (struct work_struct *work) | |||
495 | * It may not be possible for that hub to handle additional full (or low) | 500 | * It may not be possible for that hub to handle additional full (or low) |
496 | * speed transactions until that state is fully cleared out. | 501 | * speed transactions until that state is fully cleared out. |
497 | */ | 502 | */ |
498 | void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | 503 | int usb_hub_clear_tt_buffer(struct urb *urb) |
499 | { | 504 | { |
505 | struct usb_device *udev = urb->dev; | ||
506 | int pipe = urb->pipe; | ||
500 | struct usb_tt *tt = udev->tt; | 507 | struct usb_tt *tt = udev->tt; |
501 | unsigned long flags; | 508 | unsigned long flags; |
502 | struct usb_tt_clear *clear; | 509 | struct usb_tt_clear *clear; |
@@ -508,7 +515,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | |||
508 | if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) { | 515 | if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) { |
509 | dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n"); | 516 | dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n"); |
510 | /* FIXME recover somehow ... RESET_TT? */ | 517 | /* FIXME recover somehow ... RESET_TT? */ |
511 | return; | 518 | return -ENOMEM; |
512 | } | 519 | } |
513 | 520 | ||
514 | /* info that CLEAR_TT_BUFFER needs */ | 521 | /* info that CLEAR_TT_BUFFER needs */ |
@@ -520,14 +527,19 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | |||
520 | : (USB_ENDPOINT_XFER_BULK << 11); | 527 | : (USB_ENDPOINT_XFER_BULK << 11); |
521 | if (usb_pipein (pipe)) | 528 | if (usb_pipein (pipe)) |
522 | clear->devinfo |= 1 << 15; | 529 | clear->devinfo |= 1 << 15; |
523 | 530 | ||
531 | /* info for completion callback */ | ||
532 | clear->hcd = bus_to_hcd(udev->bus); | ||
533 | clear->ep = urb->ep; | ||
534 | |||
524 | /* tell keventd to clear state for this TT */ | 535 | /* tell keventd to clear state for this TT */ |
525 | spin_lock_irqsave (&tt->lock, flags); | 536 | spin_lock_irqsave (&tt->lock, flags); |
526 | list_add_tail (&clear->clear_list, &tt->clear_list); | 537 | list_add_tail (&clear->clear_list, &tt->clear_list); |
527 | schedule_work (&tt->kevent); | 538 | schedule_work(&tt->clear_work); |
528 | spin_unlock_irqrestore (&tt->lock, flags); | 539 | spin_unlock_irqrestore (&tt->lock, flags); |
540 | return 0; | ||
529 | } | 541 | } |
530 | EXPORT_SYMBOL_GPL(usb_hub_tt_clear_buffer); | 542 | EXPORT_SYMBOL_GPL(usb_hub_clear_tt_buffer); |
531 | 543 | ||
532 | /* If do_delay is false, return the number of milliseconds the caller | 544 | /* If do_delay is false, return the number of milliseconds the caller |
533 | * needs to delay. | 545 | * needs to delay. |
@@ -818,7 +830,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) | |||
818 | if (hub->has_indicators) | 830 | if (hub->has_indicators) |
819 | cancel_delayed_work_sync(&hub->leds); | 831 | cancel_delayed_work_sync(&hub->leds); |
820 | if (hub->tt.hub) | 832 | if (hub->tt.hub) |
821 | cancel_work_sync(&hub->tt.kevent); | 833 | cancel_work_sync(&hub->tt.clear_work); |
822 | } | 834 | } |
823 | 835 | ||
824 | /* caller has locked the hub device */ | 836 | /* caller has locked the hub device */ |
@@ -935,7 +947,7 @@ static int hub_configure(struct usb_hub *hub, | |||
935 | 947 | ||
936 | spin_lock_init (&hub->tt.lock); | 948 | spin_lock_init (&hub->tt.lock); |
937 | INIT_LIST_HEAD (&hub->tt.clear_list); | 949 | INIT_LIST_HEAD (&hub->tt.clear_list); |
938 | INIT_WORK (&hub->tt.kevent, hub_tt_kevent); | 950 | INIT_WORK(&hub->tt.clear_work, hub_tt_work); |
939 | switch (hdev->descriptor.bDeviceProtocol) { | 951 | switch (hdev->descriptor.bDeviceProtocol) { |
940 | case 0: | 952 | case 0: |
941 | break; | 953 | break; |
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 889c0f32a40b..de8081f065ed 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h | |||
@@ -188,16 +188,18 @@ struct usb_tt { | |||
188 | /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ | 188 | /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ |
189 | spinlock_t lock; | 189 | spinlock_t lock; |
190 | struct list_head clear_list; /* of usb_tt_clear */ | 190 | struct list_head clear_list; /* of usb_tt_clear */ |
191 | struct work_struct kevent; | 191 | struct work_struct clear_work; |
192 | }; | 192 | }; |
193 | 193 | ||
194 | struct usb_tt_clear { | 194 | struct usb_tt_clear { |
195 | struct list_head clear_list; | 195 | struct list_head clear_list; |
196 | unsigned tt; | 196 | unsigned tt; |
197 | u16 devinfo; | 197 | u16 devinfo; |
198 | struct usb_hcd *hcd; | ||
199 | struct usb_host_endpoint *ep; | ||
198 | }; | 200 | }; |
199 | 201 | ||
200 | extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe); | 202 | extern int usb_hub_clear_tt_buffer(struct urb *urb); |
201 | extern void usb_ep0_reinit(struct usb_device *); | 203 | extern void usb_ep0_reinit(struct usb_device *); |
202 | 204 | ||
203 | #endif /* __LINUX_HUB_H */ | 205 | #endif /* __LINUX_HUB_H */ |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 2bed83caacb1..9720e699f472 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -806,6 +806,48 @@ static int usb_string_sub(struct usb_device *dev, unsigned int langid, | |||
806 | return rc; | 806 | return rc; |
807 | } | 807 | } |
808 | 808 | ||
809 | static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) | ||
810 | { | ||
811 | int err; | ||
812 | |||
813 | if (dev->have_langid) | ||
814 | return 0; | ||
815 | |||
816 | if (dev->string_langid < 0) | ||
817 | return -EPIPE; | ||
818 | |||
819 | err = usb_string_sub(dev, 0, 0, tbuf); | ||
820 | |||
821 | /* If the string was reported but is malformed, default to english | ||
822 | * (0x0409) */ | ||
823 | if (err == -ENODATA || (err > 0 && err < 4)) { | ||
824 | dev->string_langid = 0x0409; | ||
825 | dev->have_langid = 1; | ||
826 | dev_err(&dev->dev, | ||
827 | "string descriptor 0 malformed (err = %d), " | ||
828 | "defaulting to 0x%04x\n", | ||
829 | err, dev->string_langid); | ||
830 | return 0; | ||
831 | } | ||
832 | |||
833 | /* In case of all other errors, we assume the device is not able to | ||
834 | * deal with strings at all. Set string_langid to -1 in order to | ||
835 | * prevent any string to be retrieved from the device */ | ||
836 | if (err < 0) { | ||
837 | dev_err(&dev->dev, "string descriptor 0 read error: %d\n", | ||
838 | err); | ||
839 | dev->string_langid = -1; | ||
840 | return -EPIPE; | ||
841 | } | ||
842 | |||
843 | /* always use the first langid listed */ | ||
844 | dev->string_langid = tbuf[2] | (tbuf[3] << 8); | ||
845 | dev->have_langid = 1; | ||
846 | dev_dbg(&dev->dev, "default language 0x%04x\n", | ||
847 | dev->string_langid); | ||
848 | return 0; | ||
849 | } | ||
850 | |||
809 | /** | 851 | /** |
810 | * usb_string - returns UTF-8 version of a string descriptor | 852 | * usb_string - returns UTF-8 version of a string descriptor |
811 | * @dev: the device whose string descriptor is being retrieved | 853 | * @dev: the device whose string descriptor is being retrieved |
@@ -837,24 +879,9 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) | |||
837 | if (!tbuf) | 879 | if (!tbuf) |
838 | return -ENOMEM; | 880 | return -ENOMEM; |
839 | 881 | ||
840 | /* get langid for strings if it's not yet known */ | 882 | err = usb_get_langid(dev, tbuf); |
841 | if (!dev->have_langid) { | 883 | if (err < 0) |
842 | err = usb_string_sub(dev, 0, 0, tbuf); | 884 | goto errout; |
843 | if (err < 0) { | ||
844 | dev_err(&dev->dev, | ||
845 | "string descriptor 0 read error: %d\n", | ||
846 | err); | ||
847 | } else if (err < 4) { | ||
848 | dev_err(&dev->dev, "string descriptor 0 too short\n"); | ||
849 | } else { | ||
850 | dev->string_langid = tbuf[2] | (tbuf[3] << 8); | ||
851 | /* always use the first langid listed */ | ||
852 | dev_dbg(&dev->dev, "default language 0x%04x\n", | ||
853 | dev->string_langid); | ||
854 | } | ||
855 | |||
856 | dev->have_langid = 1; | ||
857 | } | ||
858 | 885 | ||
859 | err = usb_string_sub(dev, dev->string_langid, index, tbuf); | 886 | err = usb_string_sub(dev, dev->string_langid, index, tbuf); |
860 | if (err < 0) | 887 | if (err < 0) |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 5d1ddf485d1e..7f8e83a954ac 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -286,6 +286,27 @@ config USB_S3C_HSOTG | |||
286 | default USB_GADGET | 286 | default USB_GADGET |
287 | select USB_GADGET_SELECTED | 287 | select USB_GADGET_SELECTED |
288 | 288 | ||
289 | config USB_GADGET_IMX | ||
290 | boolean "Freescale IMX USB Peripheral Controller" | ||
291 | depends on ARCH_MX1 | ||
292 | help | ||
293 | Freescale's IMX series include an integrated full speed | ||
294 | USB 1.1 device controller. The controller in the IMX series | ||
295 | is register-compatible. | ||
296 | |||
297 | It has Six fixed-function endpoints, as well as endpoint | ||
298 | zero (for control transfers). | ||
299 | |||
300 | Say "y" to link the driver statically, or "m" to build a | ||
301 | dynamically linked module called "imx_udc" and force all | ||
302 | gadget drivers to also be dynamically linked. | ||
303 | |||
304 | config USB_IMX | ||
305 | tristate | ||
306 | depends on USB_GADGET_IMX | ||
307 | default USB_GADGET | ||
308 | select USB_GADGET_SELECTED | ||
309 | |||
289 | config USB_GADGET_S3C2410 | 310 | config USB_GADGET_S3C2410 |
290 | boolean "S3C2410 USB Device Controller" | 311 | boolean "S3C2410 USB Device Controller" |
291 | depends on ARCH_S3C2410 | 312 | depends on ARCH_S3C2410 |
@@ -321,27 +342,6 @@ config USB_GADGET_MUSB_HDRC | |||
321 | This OTG-capable silicon IP is used in dual designs including | 342 | This OTG-capable silicon IP is used in dual designs including |
322 | the TI DaVinci, OMAP 243x, OMAP 343x, TUSB 6010, and ADI Blackfin | 343 | the TI DaVinci, OMAP 243x, OMAP 343x, TUSB 6010, and ADI Blackfin |
323 | 344 | ||
324 | config USB_GADGET_IMX | ||
325 | boolean "Freescale IMX USB Peripheral Controller" | ||
326 | depends on ARCH_MX1 | ||
327 | help | ||
328 | Freescale's IMX series include an integrated full speed | ||
329 | USB 1.1 device controller. The controller in the IMX series | ||
330 | is register-compatible. | ||
331 | |||
332 | It has Six fixed-function endpoints, as well as endpoint | ||
333 | zero (for control transfers). | ||
334 | |||
335 | Say "y" to link the driver statically, or "m" to build a | ||
336 | dynamically linked module called "imx_udc" and force all | ||
337 | gadget drivers to also be dynamically linked. | ||
338 | |||
339 | config USB_IMX | ||
340 | tristate | ||
341 | depends on USB_GADGET_IMX | ||
342 | default USB_GADGET | ||
343 | select USB_GADGET_SELECTED | ||
344 | |||
345 | config USB_GADGET_M66592 | 345 | config USB_GADGET_M66592 |
346 | boolean "Renesas M66592 USB Peripheral Controller" | 346 | boolean "Renesas M66592 USB Peripheral Controller" |
347 | select USB_GADGET_DUALSPEED | 347 | select USB_GADGET_DUALSPEED |
@@ -604,6 +604,7 @@ config USB_ZERO_HNPTEST | |||
604 | config USB_AUDIO | 604 | config USB_AUDIO |
605 | tristate "Audio Gadget (EXPERIMENTAL)" | 605 | tristate "Audio Gadget (EXPERIMENTAL)" |
606 | depends on SND | 606 | depends on SND |
607 | select SND_PCM | ||
607 | help | 608 | help |
608 | Gadget Audio is compatible with USB Audio Class specification 1.0. | 609 | Gadget Audio is compatible with USB Audio Class specification 1.0. |
609 | It will include at least one AudioControl interface, zero or more | 610 | It will include at least one AudioControl interface, zero or more |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 826f3adde5d8..77352ccc245e 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/ioport.h> | 48 | #include <linux/ioport.h> |
49 | #include <linux/sched.h> | 49 | #include <linux/sched.h> |
50 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
51 | #include <linux/smp_lock.h> | ||
52 | #include <linux/errno.h> | 51 | #include <linux/errno.h> |
53 | #include <linux/init.h> | 52 | #include <linux/init.h> |
54 | #include <linux/timer.h> | 53 | #include <linux/timer.h> |
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 94de7e864614..9f80f4e970bd 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c | |||
@@ -42,9 +42,9 @@ | |||
42 | * Instead: allocate your own, using normal USB-IF procedures. | 42 | * Instead: allocate your own, using normal USB-IF procedures. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /* Thanks to NetChip Technologies for donating this product ID. */ | 45 | /* Thanks to Linux Foundation for donating this product ID. */ |
46 | #define AUDIO_VENDOR_NUM 0x0525 /* NetChip */ | 46 | #define AUDIO_VENDOR_NUM 0x1d6b /* Linux Foundation */ |
47 | #define AUDIO_PRODUCT_NUM 0xa4a1 /* Linux-USB Audio Gadget */ | 47 | #define AUDIO_PRODUCT_NUM 0x0101 /* Linux-USB Audio Gadget */ |
48 | 48 | ||
49 | /*-------------------------------------------------------------------------*/ | 49 | /*-------------------------------------------------------------------------*/ |
50 | 50 | ||
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index d006dc652e02..bd102f5052ba 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -293,15 +293,16 @@ static int __init eth_bind(struct usb_composite_dev *cdev) | |||
293 | /* CDC Subset */ | 293 | /* CDC Subset */ |
294 | eth_config_driver.label = "CDC Subset/SAFE"; | 294 | eth_config_driver.label = "CDC Subset/SAFE"; |
295 | 295 | ||
296 | device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM), | 296 | device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM); |
297 | device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM), | 297 | device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM); |
298 | device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC; | 298 | if (!has_rndis()) |
299 | device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC; | ||
299 | } | 300 | } |
300 | 301 | ||
301 | if (has_rndis()) { | 302 | if (has_rndis()) { |
302 | /* RNDIS plus ECM-or-Subset */ | 303 | /* RNDIS plus ECM-or-Subset */ |
303 | device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM), | 304 | device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM); |
304 | device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM), | 305 | device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM); |
305 | device_desc.bNumConfigurations = 2; | 306 | device_desc.bNumConfigurations = 2; |
306 | } | 307 | } |
307 | 308 | ||
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index 6829d5961359..a3913519fd58 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
39 | #include <linux/init.h> | 38 | #include <linux/init.h> |
40 | #include <linux/timer.h> | 39 | #include <linux/timer.h> |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 0ce4e2819847..ed21e263f832 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -139,7 +139,7 @@ static int is_vbus_present(void) | |||
139 | { | 139 | { |
140 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 140 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
141 | 141 | ||
142 | if (mach->gpio_vbus) { | 142 | if (gpio_is_valid(mach->gpio_vbus)) { |
143 | int value = gpio_get_value(mach->gpio_vbus); | 143 | int value = gpio_get_value(mach->gpio_vbus); |
144 | 144 | ||
145 | if (mach->gpio_vbus_inverted) | 145 | if (mach->gpio_vbus_inverted) |
@@ -158,7 +158,7 @@ static void pullup_off(void) | |||
158 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 158 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
159 | int off_level = mach->gpio_pullup_inverted; | 159 | int off_level = mach->gpio_pullup_inverted; |
160 | 160 | ||
161 | if (mach->gpio_pullup) | 161 | if (gpio_is_valid(mach->gpio_pullup)) |
162 | gpio_set_value(mach->gpio_pullup, off_level); | 162 | gpio_set_value(mach->gpio_pullup, off_level); |
163 | else if (mach->udc_command) | 163 | else if (mach->udc_command) |
164 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | 164 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); |
@@ -169,7 +169,7 @@ static void pullup_on(void) | |||
169 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 169 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
170 | int on_level = !mach->gpio_pullup_inverted; | 170 | int on_level = !mach->gpio_pullup_inverted; |
171 | 171 | ||
172 | if (mach->gpio_pullup) | 172 | if (gpio_is_valid(mach->gpio_pullup)) |
173 | gpio_set_value(mach->gpio_pullup, on_level); | 173 | gpio_set_value(mach->gpio_pullup, on_level); |
174 | else if (mach->udc_command) | 174 | else if (mach->udc_command) |
175 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); | 175 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); |
@@ -1000,7 +1000,7 @@ static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active) | |||
1000 | udc = container_of(_gadget, struct pxa25x_udc, gadget); | 1000 | udc = container_of(_gadget, struct pxa25x_udc, gadget); |
1001 | 1001 | ||
1002 | /* not all boards support pullup control */ | 1002 | /* not all boards support pullup control */ |
1003 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 1003 | if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command) |
1004 | return -EOPNOTSUPP; | 1004 | return -EOPNOTSUPP; |
1005 | 1005 | ||
1006 | udc->pullup = (is_active != 0); | 1006 | udc->pullup = (is_active != 0); |
@@ -1802,11 +1802,13 @@ pxa25x_udc_irq(int irq, void *_dev) | |||
1802 | USIR0 |= tmp; | 1802 | USIR0 |= tmp; |
1803 | handled = 1; | 1803 | handled = 1; |
1804 | } | 1804 | } |
1805 | #ifndef CONFIG_USB_PXA25X_SMALL | ||
1805 | if (usir1 & tmp) { | 1806 | if (usir1 & tmp) { |
1806 | handle_ep(&dev->ep[i+8]); | 1807 | handle_ep(&dev->ep[i+8]); |
1807 | USIR1 |= tmp; | 1808 | USIR1 |= tmp; |
1808 | handled = 1; | 1809 | handled = 1; |
1809 | } | 1810 | } |
1811 | #endif | ||
1810 | } | 1812 | } |
1811 | } | 1813 | } |
1812 | 1814 | ||
@@ -2160,7 +2162,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2160 | dev->dev = &pdev->dev; | 2162 | dev->dev = &pdev->dev; |
2161 | dev->mach = pdev->dev.platform_data; | 2163 | dev->mach = pdev->dev.platform_data; |
2162 | 2164 | ||
2163 | if (dev->mach->gpio_vbus) { | 2165 | if (gpio_is_valid(dev->mach->gpio_vbus)) { |
2164 | if ((retval = gpio_request(dev->mach->gpio_vbus, | 2166 | if ((retval = gpio_request(dev->mach->gpio_vbus, |
2165 | "pxa25x_udc GPIO VBUS"))) { | 2167 | "pxa25x_udc GPIO VBUS"))) { |
2166 | dev_dbg(&pdev->dev, | 2168 | dev_dbg(&pdev->dev, |
@@ -2173,7 +2175,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2173 | } else | 2175 | } else |
2174 | vbus_irq = 0; | 2176 | vbus_irq = 0; |
2175 | 2177 | ||
2176 | if (dev->mach->gpio_pullup) { | 2178 | if (gpio_is_valid(dev->mach->gpio_pullup)) { |
2177 | if ((retval = gpio_request(dev->mach->gpio_pullup, | 2179 | if ((retval = gpio_request(dev->mach->gpio_pullup, |
2178 | "pca25x_udc GPIO PULLUP"))) { | 2180 | "pca25x_udc GPIO PULLUP"))) { |
2179 | dev_dbg(&pdev->dev, | 2181 | dev_dbg(&pdev->dev, |
@@ -2256,10 +2258,10 @@ lubbock_fail0: | |||
2256 | #endif | 2258 | #endif |
2257 | free_irq(irq, dev); | 2259 | free_irq(irq, dev); |
2258 | err_irq1: | 2260 | err_irq1: |
2259 | if (dev->mach->gpio_pullup) | 2261 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2260 | gpio_free(dev->mach->gpio_pullup); | 2262 | gpio_free(dev->mach->gpio_pullup); |
2261 | err_gpio_pullup: | 2263 | err_gpio_pullup: |
2262 | if (dev->mach->gpio_vbus) | 2264 | if (gpio_is_valid(dev->mach->gpio_vbus)) |
2263 | gpio_free(dev->mach->gpio_vbus); | 2265 | gpio_free(dev->mach->gpio_vbus); |
2264 | err_gpio_vbus: | 2266 | err_gpio_vbus: |
2265 | clk_put(dev->clk); | 2267 | clk_put(dev->clk); |
@@ -2294,11 +2296,11 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) | |||
2294 | free_irq(LUBBOCK_USB_IRQ, dev); | 2296 | free_irq(LUBBOCK_USB_IRQ, dev); |
2295 | } | 2297 | } |
2296 | #endif | 2298 | #endif |
2297 | if (dev->mach->gpio_vbus) { | 2299 | if (gpio_is_valid(dev->mach->gpio_vbus)) { |
2298 | free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev); | 2300 | free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev); |
2299 | gpio_free(dev->mach->gpio_vbus); | 2301 | gpio_free(dev->mach->gpio_vbus); |
2300 | } | 2302 | } |
2301 | if (dev->mach->gpio_pullup) | 2303 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2302 | gpio_free(dev->mach->gpio_pullup); | 2304 | gpio_free(dev->mach->gpio_pullup); |
2303 | 2305 | ||
2304 | clk_put(dev->clk); | 2306 | clk_put(dev->clk); |
@@ -2329,7 +2331,7 @@ static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state) | |||
2329 | struct pxa25x_udc *udc = platform_get_drvdata(dev); | 2331 | struct pxa25x_udc *udc = platform_get_drvdata(dev); |
2330 | unsigned long flags; | 2332 | unsigned long flags; |
2331 | 2333 | ||
2332 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 2334 | if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command) |
2333 | WARNING("USB host won't detect disconnect!\n"); | 2335 | WARNING("USB host won't detect disconnect!\n"); |
2334 | udc->suspended = 1; | 2336 | udc->suspended = 1; |
2335 | 2337 | ||
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 2b4660e08c4d..ca41b0b5afb3 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -442,6 +442,8 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
442 | 442 | ||
443 | case OID_802_3_MAC_OPTIONS: | 443 | case OID_802_3_MAC_OPTIONS: |
444 | pr_debug("%s: OID_802_3_MAC_OPTIONS\n", __func__); | 444 | pr_debug("%s: OID_802_3_MAC_OPTIONS\n", __func__); |
445 | *outbuf = cpu_to_le32(0); | ||
446 | retval = 0; | ||
445 | break; | 447 | break; |
446 | 448 | ||
447 | /* ieee802.3 statistics OIDs (table 4-4) */ | 449 | /* ieee802.3 statistics OIDs (table 4-4) */ |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index 9a2b8920532d..a9b452fe6221 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
34 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 0c03471f0d41..1a920c70b5a1 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -181,26 +181,27 @@ config USB_OHCI_HCD_PPC_SOC | |||
181 | Enables support for the USB controller on the MPC52xx or | 181 | Enables support for the USB controller on the MPC52xx or |
182 | STB03xxx processor chip. If unsure, say Y. | 182 | STB03xxx processor chip. If unsure, say Y. |
183 | 183 | ||
184 | config USB_OHCI_HCD_PPC_OF | ||
185 | bool "OHCI support for PPC USB controller on OF platform bus" | ||
186 | depends on USB_OHCI_HCD && PPC_OF | ||
187 | default y | ||
188 | ---help--- | ||
189 | Enables support for the USB controller PowerPC present on the | ||
190 | OpenFirmware platform bus. | ||
191 | |||
192 | config USB_OHCI_HCD_PPC_OF_BE | 184 | config USB_OHCI_HCD_PPC_OF_BE |
193 | bool "Support big endian HC" | 185 | bool "OHCI support for OF platform bus (big endian)" |
194 | depends on USB_OHCI_HCD_PPC_OF | 186 | depends on USB_OHCI_HCD && PPC_OF |
195 | default y | ||
196 | select USB_OHCI_BIG_ENDIAN_DESC | 187 | select USB_OHCI_BIG_ENDIAN_DESC |
197 | select USB_OHCI_BIG_ENDIAN_MMIO | 188 | select USB_OHCI_BIG_ENDIAN_MMIO |
189 | ---help--- | ||
190 | Enables support for big-endian USB controllers present on the | ||
191 | OpenFirmware platform bus. | ||
198 | 192 | ||
199 | config USB_OHCI_HCD_PPC_OF_LE | 193 | config USB_OHCI_HCD_PPC_OF_LE |
200 | bool "Support little endian HC" | 194 | bool "OHCI support for OF platform bus (little endian)" |
201 | depends on USB_OHCI_HCD_PPC_OF | 195 | depends on USB_OHCI_HCD && PPC_OF |
202 | default n | ||
203 | select USB_OHCI_LITTLE_ENDIAN | 196 | select USB_OHCI_LITTLE_ENDIAN |
197 | ---help--- | ||
198 | Enables support for little-endian USB controllers present on the | ||
199 | OpenFirmware platform bus. | ||
200 | |||
201 | config USB_OHCI_HCD_PPC_OF | ||
202 | bool | ||
203 | depends on USB_OHCI_HCD && PPC_OF | ||
204 | default USB_OHCI_HCD_PPC_OF_BE || USB_OHCI_HCD_PPC_OF_LE | ||
204 | 205 | ||
205 | config USB_OHCI_HCD_PCI | 206 | config USB_OHCI_HCD_PCI |
206 | bool "OHCI support for PCI-bus USB controllers" | 207 | bool "OHCI support for PCI-bus USB controllers" |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index c3a778bd359c..59d208d94d4e 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -113,6 +113,8 @@ static const struct hc_driver ehci_au1xxx_hc_driver = { | |||
113 | .bus_resume = ehci_bus_resume, | 113 | .bus_resume = ehci_bus_resume, |
114 | .relinquish_port = ehci_relinquish_port, | 114 | .relinquish_port = ehci_relinquish_port, |
115 | .port_handed_over = ehci_port_handed_over, | 115 | .port_handed_over = ehci_port_handed_over, |
116 | |||
117 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
116 | }; | 118 | }; |
117 | 119 | ||
118 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) | 120 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index bf86809c5120..991174937db3 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -325,6 +325,8 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
325 | .bus_resume = ehci_bus_resume, | 325 | .bus_resume = ehci_bus_resume, |
326 | .relinquish_port = ehci_relinquish_port, | 326 | .relinquish_port = ehci_relinquish_port, |
327 | .port_handed_over = ehci_port_handed_over, | 327 | .port_handed_over = ehci_port_handed_over, |
328 | |||
329 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
328 | }; | 330 | }; |
329 | 331 | ||
330 | static int ehci_fsl_drv_probe(struct platform_device *pdev) | 332 | static int ehci_fsl_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 2b72473544d3..7d03549c3339 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1003,6 +1003,8 @@ idle_timeout: | |||
1003 | schedule_timeout_uninterruptible(1); | 1003 | schedule_timeout_uninterruptible(1); |
1004 | goto rescan; | 1004 | goto rescan; |
1005 | case QH_STATE_IDLE: /* fully unlinked */ | 1005 | case QH_STATE_IDLE: /* fully unlinked */ |
1006 | if (qh->clearing_tt) | ||
1007 | goto idle_timeout; | ||
1006 | if (list_empty (&qh->qtd_list)) { | 1008 | if (list_empty (&qh->qtd_list)) { |
1007 | qh_put (qh); | 1009 | qh_put (qh); |
1008 | break; | 1010 | break; |
@@ -1030,12 +1032,14 @@ ehci_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) | |||
1030 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 1032 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
1031 | struct ehci_qh *qh; | 1033 | struct ehci_qh *qh; |
1032 | int eptype = usb_endpoint_type(&ep->desc); | 1034 | int eptype = usb_endpoint_type(&ep->desc); |
1035 | int epnum = usb_endpoint_num(&ep->desc); | ||
1036 | int is_out = usb_endpoint_dir_out(&ep->desc); | ||
1037 | unsigned long flags; | ||
1033 | 1038 | ||
1034 | if (eptype != USB_ENDPOINT_XFER_BULK && eptype != USB_ENDPOINT_XFER_INT) | 1039 | if (eptype != USB_ENDPOINT_XFER_BULK && eptype != USB_ENDPOINT_XFER_INT) |
1035 | return; | 1040 | return; |
1036 | 1041 | ||
1037 | rescan: | 1042 | spin_lock_irqsave(&ehci->lock, flags); |
1038 | spin_lock_irq(&ehci->lock); | ||
1039 | qh = ep->hcpriv; | 1043 | qh = ep->hcpriv; |
1040 | 1044 | ||
1041 | /* For Bulk and Interrupt endpoints we maintain the toggle state | 1045 | /* For Bulk and Interrupt endpoints we maintain the toggle state |
@@ -1044,29 +1048,24 @@ ehci_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) | |||
1044 | * the toggle bit in the QH. | 1048 | * the toggle bit in the QH. |
1045 | */ | 1049 | */ |
1046 | if (qh) { | 1050 | if (qh) { |
1051 | usb_settoggle(qh->dev, epnum, is_out, 0); | ||
1047 | if (!list_empty(&qh->qtd_list)) { | 1052 | if (!list_empty(&qh->qtd_list)) { |
1048 | WARN_ONCE(1, "clear_halt for a busy endpoint\n"); | 1053 | WARN_ONCE(1, "clear_halt for a busy endpoint\n"); |
1049 | } else if (qh->qh_state == QH_STATE_IDLE) { | 1054 | } else if (qh->qh_state == QH_STATE_LINKED) { |
1050 | qh->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE); | 1055 | |
1051 | } else { | 1056 | /* The toggle value in the QH can't be updated |
1052 | /* It's not safe to write into the overlay area | 1057 | * while the QH is active. Unlink it now; |
1053 | * while the QH is active. Unlink it first and | 1058 | * re-linking will call qh_refresh(). |
1054 | * wait for the unlink to complete. | ||
1055 | */ | 1059 | */ |
1056 | if (qh->qh_state == QH_STATE_LINKED) { | 1060 | if (eptype == USB_ENDPOINT_XFER_BULK) { |
1057 | if (eptype == USB_ENDPOINT_XFER_BULK) { | 1061 | unlink_async(ehci, qh); |
1058 | unlink_async(ehci, qh); | 1062 | } else { |
1059 | } else { | 1063 | intr_deschedule(ehci, qh); |
1060 | intr_deschedule(ehci, qh); | 1064 | (void) qh_schedule(ehci, qh); |
1061 | (void) qh_schedule(ehci, qh); | ||
1062 | } | ||
1063 | } | 1065 | } |
1064 | spin_unlock_irq(&ehci->lock); | ||
1065 | schedule_timeout_uninterruptible(1); | ||
1066 | goto rescan; | ||
1067 | } | 1066 | } |
1068 | } | 1067 | } |
1069 | spin_unlock_irq(&ehci->lock); | 1068 | spin_unlock_irqrestore(&ehci->lock, flags); |
1070 | } | 1069 | } |
1071 | 1070 | ||
1072 | static int ehci_get_frame (struct usb_hcd *hcd) | 1071 | static int ehci_get_frame (struct usb_hcd *hcd) |
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c index a44bb4a94954..89b7c70c6ed6 100644 --- a/drivers/usb/host/ehci-ixp4xx.c +++ b/drivers/usb/host/ehci-ixp4xx.c | |||
@@ -61,6 +61,8 @@ static const struct hc_driver ixp4xx_ehci_hc_driver = { | |||
61 | #endif | 61 | #endif |
62 | .relinquish_port = ehci_relinquish_port, | 62 | .relinquish_port = ehci_relinquish_port, |
63 | .port_handed_over = ehci_port_handed_over, | 63 | .port_handed_over = ehci_port_handed_over, |
64 | |||
65 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | static int ixp4xx_ehci_probe(struct platform_device *pdev) | 68 | static int ixp4xx_ehci_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 770dd9aba62a..dc2ac613a9d1 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -165,6 +165,8 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
165 | .bus_resume = ehci_bus_resume, | 165 | .bus_resume = ehci_bus_resume, |
166 | .relinquish_port = ehci_relinquish_port, | 166 | .relinquish_port = ehci_relinquish_port, |
167 | .port_handed_over = ehci_port_handed_over, | 167 | .port_handed_over = ehci_port_handed_over, |
168 | |||
169 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
168 | }; | 170 | }; |
169 | 171 | ||
170 | static void __init | 172 | static void __init |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index f3683e1da161..c2f1b7df918c 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -404,6 +404,8 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
404 | .bus_resume = ehci_bus_resume, | 404 | .bus_resume = ehci_bus_resume, |
405 | .relinquish_port = ehci_relinquish_port, | 405 | .relinquish_port = ehci_relinquish_port, |
406 | .port_handed_over = ehci_port_handed_over, | 406 | .port_handed_over = ehci_port_handed_over, |
407 | |||
408 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
407 | }; | 409 | }; |
408 | 410 | ||
409 | /*-------------------------------------------------------------------------*/ | 411 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index fbd272288fc2..36f96da129f5 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -79,6 +79,8 @@ static const struct hc_driver ehci_ppc_of_hc_driver = { | |||
79 | #endif | 79 | #endif |
80 | .relinquish_port = ehci_relinquish_port, | 80 | .relinquish_port = ehci_relinquish_port, |
81 | .port_handed_over = ehci_port_handed_over, | 81 | .port_handed_over = ehci_port_handed_over, |
82 | |||
83 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | 86 | ||
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 93f7035d00a1..1dee33b9139e 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
@@ -75,6 +75,8 @@ static const struct hc_driver ps3_ehci_hc_driver = { | |||
75 | #endif | 75 | #endif |
76 | .relinquish_port = ehci_relinquish_port, | 76 | .relinquish_port = ehci_relinquish_port, |
77 | .port_handed_over = ehci_port_handed_over, | 77 | .port_handed_over = ehci_port_handed_over, |
78 | |||
79 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
78 | }; | 80 | }; |
79 | 81 | ||
80 | static int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev) | 82 | static int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev) |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 3192f683f807..9a1384747f3b 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -93,6 +93,22 @@ qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd) | |||
93 | qh->hw_qtd_next = QTD_NEXT(ehci, qtd->qtd_dma); | 93 | qh->hw_qtd_next = QTD_NEXT(ehci, qtd->qtd_dma); |
94 | qh->hw_alt_next = EHCI_LIST_END(ehci); | 94 | qh->hw_alt_next = EHCI_LIST_END(ehci); |
95 | 95 | ||
96 | /* Except for control endpoints, we make hardware maintain data | ||
97 | * toggle (like OHCI) ... here (re)initialize the toggle in the QH, | ||
98 | * and set the pseudo-toggle in udev. Only usb_clear_halt() will | ||
99 | * ever clear it. | ||
100 | */ | ||
101 | if (!(qh->hw_info1 & cpu_to_hc32(ehci, 1 << 14))) { | ||
102 | unsigned is_out, epnum; | ||
103 | |||
104 | is_out = !(qtd->hw_token & cpu_to_hc32(ehci, 1 << 8)); | ||
105 | epnum = (hc32_to_cpup(ehci, &qh->hw_info1) >> 8) & 0x0f; | ||
106 | if (unlikely (!usb_gettoggle (qh->dev, epnum, is_out))) { | ||
107 | qh->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE); | ||
108 | usb_settoggle (qh->dev, epnum, is_out, 1); | ||
109 | } | ||
110 | } | ||
111 | |||
96 | /* HC must see latest qtd and qh data before we clear ACTIVE+HALT */ | 112 | /* HC must see latest qtd and qh data before we clear ACTIVE+HALT */ |
97 | wmb (); | 113 | wmb (); |
98 | qh->hw_token &= cpu_to_hc32(ehci, QTD_TOGGLE | QTD_STS_PING); | 114 | qh->hw_token &= cpu_to_hc32(ehci, QTD_TOGGLE | QTD_STS_PING); |
@@ -123,6 +139,55 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
123 | 139 | ||
124 | /*-------------------------------------------------------------------------*/ | 140 | /*-------------------------------------------------------------------------*/ |
125 | 141 | ||
142 | static void qh_link_async(struct ehci_hcd *ehci, struct ehci_qh *qh); | ||
143 | |||
144 | static void ehci_clear_tt_buffer_complete(struct usb_hcd *hcd, | ||
145 | struct usb_host_endpoint *ep) | ||
146 | { | ||
147 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
148 | struct ehci_qh *qh = ep->hcpriv; | ||
149 | unsigned long flags; | ||
150 | |||
151 | spin_lock_irqsave(&ehci->lock, flags); | ||
152 | qh->clearing_tt = 0; | ||
153 | if (qh->qh_state == QH_STATE_IDLE && !list_empty(&qh->qtd_list) | ||
154 | && HC_IS_RUNNING(hcd->state)) | ||
155 | qh_link_async(ehci, qh); | ||
156 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
157 | } | ||
158 | |||
159 | static void ehci_clear_tt_buffer(struct ehci_hcd *ehci, struct ehci_qh *qh, | ||
160 | struct urb *urb, u32 token) | ||
161 | { | ||
162 | |||
163 | /* If an async split transaction gets an error or is unlinked, | ||
164 | * the TT buffer may be left in an indeterminate state. We | ||
165 | * have to clear the TT buffer. | ||
166 | * | ||
167 | * Note: this routine is never called for Isochronous transfers. | ||
168 | */ | ||
169 | if (urb->dev->tt && !usb_pipeint(urb->pipe) && !qh->clearing_tt) { | ||
170 | #ifdef DEBUG | ||
171 | struct usb_device *tt = urb->dev->tt->hub; | ||
172 | dev_dbg(&tt->dev, | ||
173 | "clear tt buffer port %d, a%d ep%d t%08x\n", | ||
174 | urb->dev->ttport, urb->dev->devnum, | ||
175 | usb_pipeendpoint(urb->pipe), token); | ||
176 | #endif /* DEBUG */ | ||
177 | if (!ehci_is_TDI(ehci) | ||
178 | || urb->dev->tt->hub != | ||
179 | ehci_to_hcd(ehci)->self.root_hub) { | ||
180 | if (usb_hub_clear_tt_buffer(urb) == 0) | ||
181 | qh->clearing_tt = 1; | ||
182 | } else { | ||
183 | |||
184 | /* REVISIT ARC-derived cores don't clear the root | ||
185 | * hub TT buffer in this way... | ||
186 | */ | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
126 | static int qtd_copy_status ( | 191 | static int qtd_copy_status ( |
127 | struct ehci_hcd *ehci, | 192 | struct ehci_hcd *ehci, |
128 | struct urb *urb, | 193 | struct urb *urb, |
@@ -149,6 +214,14 @@ static int qtd_copy_status ( | |||
149 | if (token & QTD_STS_BABBLE) { | 214 | if (token & QTD_STS_BABBLE) { |
150 | /* FIXME "must" disable babbling device's port too */ | 215 | /* FIXME "must" disable babbling device's port too */ |
151 | status = -EOVERFLOW; | 216 | status = -EOVERFLOW; |
217 | /* CERR nonzero + halt --> stall */ | ||
218 | } else if (QTD_CERR(token)) { | ||
219 | status = -EPIPE; | ||
220 | |||
221 | /* In theory, more than one of the following bits can be set | ||
222 | * since they are sticky and the transaction is retried. | ||
223 | * Which to test first is rather arbitrary. | ||
224 | */ | ||
152 | } else if (token & QTD_STS_MMF) { | 225 | } else if (token & QTD_STS_MMF) { |
153 | /* fs/ls interrupt xfer missed the complete-split */ | 226 | /* fs/ls interrupt xfer missed the complete-split */ |
154 | status = -EPROTO; | 227 | status = -EPROTO; |
@@ -157,21 +230,15 @@ static int qtd_copy_status ( | |||
157 | ? -ENOSR /* hc couldn't read data */ | 230 | ? -ENOSR /* hc couldn't read data */ |
158 | : -ECOMM; /* hc couldn't write data */ | 231 | : -ECOMM; /* hc couldn't write data */ |
159 | } else if (token & QTD_STS_XACT) { | 232 | } else if (token & QTD_STS_XACT) { |
160 | /* timeout, bad crc, wrong PID, etc; retried */ | 233 | /* timeout, bad CRC, wrong PID, etc */ |
161 | if (QTD_CERR (token)) | 234 | ehci_dbg(ehci, "devpath %s ep%d%s 3strikes\n", |
162 | status = -EPIPE; | 235 | urb->dev->devpath, |
163 | else { | 236 | usb_pipeendpoint(urb->pipe), |
164 | ehci_dbg (ehci, "devpath %s ep%d%s 3strikes\n", | 237 | usb_pipein(urb->pipe) ? "in" : "out"); |
165 | urb->dev->devpath, | 238 | status = -EPROTO; |
166 | usb_pipeendpoint (urb->pipe), | 239 | } else { /* unknown */ |
167 | usb_pipein (urb->pipe) ? "in" : "out"); | ||
168 | status = -EPROTO; | ||
169 | } | ||
170 | /* CERR nonzero + no errors + halt --> stall */ | ||
171 | } else if (QTD_CERR (token)) | ||
172 | status = -EPIPE; | ||
173 | else /* unknown */ | ||
174 | status = -EPROTO; | 240 | status = -EPROTO; |
241 | } | ||
175 | 242 | ||
176 | ehci_vdbg (ehci, | 243 | ehci_vdbg (ehci, |
177 | "dev%d ep%d%s qtd token %08x --> status %d\n", | 244 | "dev%d ep%d%s qtd token %08x --> status %d\n", |
@@ -179,28 +246,6 @@ static int qtd_copy_status ( | |||
179 | usb_pipeendpoint (urb->pipe), | 246 | usb_pipeendpoint (urb->pipe), |
180 | usb_pipein (urb->pipe) ? "in" : "out", | 247 | usb_pipein (urb->pipe) ? "in" : "out", |
181 | token, status); | 248 | token, status); |
182 | |||
183 | /* if async CSPLIT failed, try cleaning out the TT buffer */ | ||
184 | if (status != -EPIPE | ||
185 | && urb->dev->tt | ||
186 | && !usb_pipeint(urb->pipe) | ||
187 | && ((token & QTD_STS_MMF) != 0 | ||
188 | || QTD_CERR(token) == 0) | ||
189 | && (!ehci_is_TDI(ehci) | ||
190 | || urb->dev->tt->hub != | ||
191 | ehci_to_hcd(ehci)->self.root_hub)) { | ||
192 | #ifdef DEBUG | ||
193 | struct usb_device *tt = urb->dev->tt->hub; | ||
194 | dev_dbg (&tt->dev, | ||
195 | "clear tt buffer port %d, a%d ep%d t%08x\n", | ||
196 | urb->dev->ttport, urb->dev->devnum, | ||
197 | usb_pipeendpoint (urb->pipe), token); | ||
198 | #endif /* DEBUG */ | ||
199 | /* REVISIT ARC-derived cores don't clear the root | ||
200 | * hub TT buffer in this way... | ||
201 | */ | ||
202 | usb_hub_tt_clear_buffer (urb->dev, urb->pipe); | ||
203 | } | ||
204 | } | 249 | } |
205 | 250 | ||
206 | return status; | 251 | return status; |
@@ -391,9 +436,16 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
391 | /* qh unlinked; token in overlay may be most current */ | 436 | /* qh unlinked; token in overlay may be most current */ |
392 | if (state == QH_STATE_IDLE | 437 | if (state == QH_STATE_IDLE |
393 | && cpu_to_hc32(ehci, qtd->qtd_dma) | 438 | && cpu_to_hc32(ehci, qtd->qtd_dma) |
394 | == qh->hw_current) | 439 | == qh->hw_current) { |
395 | token = hc32_to_cpu(ehci, qh->hw_token); | 440 | token = hc32_to_cpu(ehci, qh->hw_token); |
396 | 441 | ||
442 | /* An unlink may leave an incomplete | ||
443 | * async transaction in the TT buffer. | ||
444 | * We have to clear it. | ||
445 | */ | ||
446 | ehci_clear_tt_buffer(ehci, qh, urb, token); | ||
447 | } | ||
448 | |||
397 | /* force halt for unlinked or blocked qh, so we'll | 449 | /* force halt for unlinked or blocked qh, so we'll |
398 | * patch the qh later and so that completions can't | 450 | * patch the qh later and so that completions can't |
399 | * activate it while we "know" it's stopped. | 451 | * activate it while we "know" it's stopped. |
@@ -419,6 +471,13 @@ halt: | |||
419 | && (qtd->hw_alt_next | 471 | && (qtd->hw_alt_next |
420 | & EHCI_LIST_END(ehci))) | 472 | & EHCI_LIST_END(ehci))) |
421 | last_status = -EINPROGRESS; | 473 | last_status = -EINPROGRESS; |
474 | |||
475 | /* As part of low/full-speed endpoint-halt processing | ||
476 | * we must clear the TT buffer (11.17.5). | ||
477 | */ | ||
478 | if (unlikely(last_status != -EINPROGRESS && | ||
479 | last_status != -EREMOTEIO)) | ||
480 | ehci_clear_tt_buffer(ehci, qh, urb, token); | ||
422 | } | 481 | } |
423 | 482 | ||
424 | /* if we're removing something not at the queue head, | 483 | /* if we're removing something not at the queue head, |
@@ -834,6 +893,7 @@ done: | |||
834 | qh->qh_state = QH_STATE_IDLE; | 893 | qh->qh_state = QH_STATE_IDLE; |
835 | qh->hw_info1 = cpu_to_hc32(ehci, info1); | 894 | qh->hw_info1 = cpu_to_hc32(ehci, info1); |
836 | qh->hw_info2 = cpu_to_hc32(ehci, info2); | 895 | qh->hw_info2 = cpu_to_hc32(ehci, info2); |
896 | usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1); | ||
837 | qh_refresh (ehci, qh); | 897 | qh_refresh (ehci, qh); |
838 | return qh; | 898 | return qh; |
839 | } | 899 | } |
@@ -847,6 +907,10 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
847 | __hc32 dma = QH_NEXT(ehci, qh->qh_dma); | 907 | __hc32 dma = QH_NEXT(ehci, qh->qh_dma); |
848 | struct ehci_qh *head; | 908 | struct ehci_qh *head; |
849 | 909 | ||
910 | /* Don't link a QH if there's a Clear-TT-Buffer pending */ | ||
911 | if (unlikely(qh->clearing_tt)) | ||
912 | return; | ||
913 | |||
850 | /* (re)start the async schedule? */ | 914 | /* (re)start the async schedule? */ |
851 | head = ehci->async; | 915 | head = ehci->async; |
852 | timer_action_done (ehci, TIMER_ASYNC_OFF); | 916 | timer_action_done (ehci, TIMER_ASYNC_OFF); |
@@ -864,7 +928,7 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
864 | } | 928 | } |
865 | } | 929 | } |
866 | 930 | ||
867 | /* clear halt and maybe recover from silicon quirk */ | 931 | /* clear halt and/or toggle; and maybe recover from silicon quirk */ |
868 | if (qh->qh_state == QH_STATE_IDLE) | 932 | if (qh->qh_state == QH_STATE_IDLE) |
869 | qh_refresh (ehci, qh); | 933 | qh_refresh (ehci, qh); |
870 | 934 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 9d1babc7ff65..74f7f83b29ad 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1619,11 +1619,14 @@ itd_complete ( | |||
1619 | desc->status = -EPROTO; | 1619 | desc->status = -EPROTO; |
1620 | 1620 | ||
1621 | /* HC need not update length with this error */ | 1621 | /* HC need not update length with this error */ |
1622 | if (!(t & EHCI_ISOC_BABBLE)) | 1622 | if (!(t & EHCI_ISOC_BABBLE)) { |
1623 | desc->actual_length = EHCI_ITD_LENGTH (t); | 1623 | desc->actual_length = EHCI_ITD_LENGTH(t); |
1624 | urb->actual_length += desc->actual_length; | ||
1625 | } | ||
1624 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { | 1626 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { |
1625 | desc->status = 0; | 1627 | desc->status = 0; |
1626 | desc->actual_length = EHCI_ITD_LENGTH (t); | 1628 | desc->actual_length = EHCI_ITD_LENGTH(t); |
1629 | urb->actual_length += desc->actual_length; | ||
1627 | } else { | 1630 | } else { |
1628 | /* URB was too late */ | 1631 | /* URB was too late */ |
1629 | desc->status = -EXDEV; | 1632 | desc->status = -EXDEV; |
@@ -2014,7 +2017,8 @@ sitd_complete ( | |||
2014 | desc->status = -EPROTO; | 2017 | desc->status = -EPROTO; |
2015 | } else { | 2018 | } else { |
2016 | desc->status = 0; | 2019 | desc->status = 0; |
2017 | desc->actual_length = desc->length - SITD_LENGTH (t); | 2020 | desc->actual_length = desc->length - SITD_LENGTH(t); |
2021 | urb->actual_length += desc->actual_length; | ||
2018 | } | 2022 | } |
2019 | stream->depth -= stream->interval << 3; | 2023 | stream->depth -= stream->interval << 3; |
2020 | 2024 | ||
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 90ad3395bb21..2bfff30f4704 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -354,7 +354,9 @@ struct ehci_qh { | |||
354 | unsigned short period; /* polling interval */ | 354 | unsigned short period; /* polling interval */ |
355 | unsigned short start; /* where polling starts */ | 355 | unsigned short start; /* where polling starts */ |
356 | #define NO_FRAME ((unsigned short)~0) /* pick new start */ | 356 | #define NO_FRAME ((unsigned short)~0) /* pick new start */ |
357 | |||
357 | struct usb_device *dev; /* access to TT */ | 358 | struct usb_device *dev; /* access to TT */ |
359 | unsigned clearing_tt:1; /* Clear-TT-Buf in progress */ | ||
358 | } __attribute__ ((aligned (32))); | 360 | } __attribute__ ((aligned (32))); |
359 | 361 | ||
360 | /*-------------------------------------------------------------------------*/ | 362 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c index bb63b68ddb77..62a226b61670 100644 --- a/drivers/usb/host/fhci-sched.c +++ b/drivers/usb/host/fhci-sched.c | |||
@@ -576,9 +576,7 @@ irqreturn_t fhci_irq(struct usb_hcd *hcd) | |||
576 | out_be16(&usb->fhci->regs->usb_event, | 576 | out_be16(&usb->fhci->regs->usb_event, |
577 | usb->saved_msk); | 577 | usb->saved_msk); |
578 | } else if (usb->port_status == FHCI_PORT_DISABLED) { | 578 | } else if (usb->port_status == FHCI_PORT_DISABLED) { |
579 | if (fhci_ioports_check_bus_state(fhci) == 1 && | 579 | if (fhci_ioports_check_bus_state(fhci) == 1) |
580 | usb->port_status != FHCI_PORT_LOW && | ||
581 | usb->port_status != FHCI_PORT_FULL) | ||
582 | fhci_device_connected_interrupt(fhci); | 580 | fhci_device_connected_interrupt(fhci); |
583 | } | 581 | } |
584 | usb_er &= ~USB_E_RESET_MASK; | 582 | usb_er &= ~USB_E_RESET_MASK; |
@@ -605,9 +603,7 @@ irqreturn_t fhci_irq(struct usb_hcd *hcd) | |||
605 | } | 603 | } |
606 | 604 | ||
607 | if (usb_er & USB_E_IDLE_MASK) { | 605 | if (usb_er & USB_E_IDLE_MASK) { |
608 | if (usb->port_status == FHCI_PORT_DISABLED && | 606 | if (usb->port_status == FHCI_PORT_DISABLED) { |
609 | usb->port_status != FHCI_PORT_LOW && | ||
610 | usb->port_status != FHCI_PORT_FULL) { | ||
611 | usb_er &= ~USB_E_RESET_MASK; | 607 | usb_er &= ~USB_E_RESET_MASK; |
612 | fhci_device_connected_interrupt(fhci); | 608 | fhci_device_connected_interrupt(fhci); |
613 | } else if (usb->port_status == | 609 | } else if (usb->port_status == |
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 3fa3a1702796..d4feebfc63bd 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -361,7 +361,7 @@ static int __devexit isp1760_plat_remove(struct platform_device *pdev) | |||
361 | 361 | ||
362 | static struct platform_driver isp1760_plat_driver = { | 362 | static struct platform_driver isp1760_plat_driver = { |
363 | .probe = isp1760_plat_probe, | 363 | .probe = isp1760_plat_probe, |
364 | .remove = isp1760_plat_remove, | 364 | .remove = __devexit_p(isp1760_plat_remove), |
365 | .driver = { | 365 | .driver = { |
366 | .name = "isp1760", | 366 | .name = "isp1760", |
367 | }, | 367 | }, |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 56976cc0352a..e18f74946e68 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
32 | #include <linux/timer.h> | 31 | #include <linux/timer.h> |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 3c5fe5cee05a..90e1a8dedfa9 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/smp_lock.h> | ||
21 | #include <linux/poll.h> | 22 | #include <linux/poll.h> |
22 | #include <linux/usb/iowarrior.h> | 23 | #include <linux/usb/iowarrior.h> |
23 | 24 | ||
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index deb95bb49fd1..d645f3899fe1 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/signal.h> | 33 | #include <linux/signal.h> |
34 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
35 | #include <linux/smp_lock.h> | ||
35 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
36 | #include <linux/random.h> | 37 | #include <linux/random.h> |
37 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index e0ff9ccd866b..29092b8e59ce 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/smp_lock.h> | ||
19 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
20 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
diff --git a/drivers/usb/musb/cppi_dma.h b/drivers/usb/musb/cppi_dma.h index 8a39de3e6e47..59bf949e589b 100644 --- a/drivers/usb/musb/cppi_dma.h +++ b/drivers/usb/musb/cppi_dma.h | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/smp_lock.h> | ||
9 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
10 | #include <linux/dmapool.h> | 9 | #include <linux/dmapool.h> |
11 | 10 | ||
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 180d7daa4099..e16ff605c458 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -35,13 +35,14 @@ | |||
35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
36 | #include <mach/memory.h> | 36 | #include <mach/memory.h> |
37 | #include <mach/gpio.h> | 37 | #include <mach/gpio.h> |
38 | #include <mach/cputype.h> | ||
38 | 39 | ||
39 | #include <asm/mach-types.h> | 40 | #include <asm/mach-types.h> |
40 | 41 | ||
41 | #include "musb_core.h" | 42 | #include "musb_core.h" |
42 | 43 | ||
43 | #ifdef CONFIG_MACH_DAVINCI_EVM | 44 | #ifdef CONFIG_MACH_DAVINCI_EVM |
44 | #define GPIO_nVBUS_DRV 87 | 45 | #define GPIO_nVBUS_DRV 144 |
45 | #endif | 46 | #endif |
46 | 47 | ||
47 | #include "davinci.h" | 48 | #include "davinci.h" |
@@ -329,7 +330,6 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci) | |||
329 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 330 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
330 | WARNING("VBUS error workaround (delay coming)\n"); | 331 | WARNING("VBUS error workaround (delay coming)\n"); |
331 | } else if (is_host_enabled(musb) && drvvbus) { | 332 | } else if (is_host_enabled(musb) && drvvbus) { |
332 | musb->is_active = 1; | ||
333 | MUSB_HST_MODE(musb); | 333 | MUSB_HST_MODE(musb); |
334 | musb->xceiv->default_a = 1; | 334 | musb->xceiv->default_a = 1; |
335 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 335 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; |
@@ -343,7 +343,9 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci) | |||
343 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 343 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
344 | } | 344 | } |
345 | 345 | ||
346 | /* NOTE: this must complete poweron within 100 msec */ | 346 | /* NOTE: this must complete poweron within 100 msec |
347 | * (OTG_TIME_A_WAIT_VRISE) but we don't check for that. | ||
348 | */ | ||
347 | davinci_source_power(musb, drvvbus, 0); | 349 | davinci_source_power(musb, drvvbus, 0); |
348 | DBG(2, "VBUS %s (%s)%s, devctl %02x\n", | 350 | DBG(2, "VBUS %s (%s)%s, devctl %02x\n", |
349 | drvvbus ? "on" : "off", | 351 | drvvbus ? "on" : "off", |
@@ -411,6 +413,21 @@ int __init musb_platform_init(struct musb *musb) | |||
411 | __raw_writel(phy_ctrl, USB_PHY_CTRL); | 413 | __raw_writel(phy_ctrl, USB_PHY_CTRL); |
412 | } | 414 | } |
413 | 415 | ||
416 | /* On dm355, the default-A state machine needs DRVVBUS control. | ||
417 | * If we won't be a host, there's no need to turn it on. | ||
418 | */ | ||
419 | if (cpu_is_davinci_dm355()) { | ||
420 | u32 deepsleep = __raw_readl(DM355_DEEPSLEEP); | ||
421 | |||
422 | if (is_host_enabled(musb)) { | ||
423 | deepsleep &= ~DRVVBUS_OVERRIDE; | ||
424 | } else { | ||
425 | deepsleep &= ~DRVVBUS_FORCE; | ||
426 | deepsleep |= DRVVBUS_OVERRIDE; | ||
427 | } | ||
428 | __raw_writel(deepsleep, DM355_DEEPSLEEP); | ||
429 | } | ||
430 | |||
414 | /* reset the controller */ | 431 | /* reset the controller */ |
415 | musb_writel(tibase, DAVINCI_USB_CTRL_REG, 0x1); | 432 | musb_writel(tibase, DAVINCI_USB_CTRL_REG, 0x1); |
416 | 433 | ||
@@ -437,6 +454,15 @@ int musb_platform_exit(struct musb *musb) | |||
437 | if (is_host_enabled(musb)) | 454 | if (is_host_enabled(musb)) |
438 | del_timer_sync(&otg_workaround); | 455 | del_timer_sync(&otg_workaround); |
439 | 456 | ||
457 | /* force VBUS off */ | ||
458 | if (cpu_is_davinci_dm355()) { | ||
459 | u32 deepsleep = __raw_readl(DM355_DEEPSLEEP); | ||
460 | |||
461 | deepsleep &= ~DRVVBUS_FORCE; | ||
462 | deepsleep |= DRVVBUS_OVERRIDE; | ||
463 | __raw_writel(deepsleep, DM355_DEEPSLEEP); | ||
464 | } | ||
465 | |||
440 | davinci_source_power(musb, 0 /*off*/, 1); | 466 | davinci_source_power(musb, 0 /*off*/, 1); |
441 | 467 | ||
442 | /* delay, to avoid problems with module reload */ | 468 | /* delay, to avoid problems with module reload */ |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index f3772ca3b2cf..381d648a36b8 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/list.h> | 39 | #include <linux/list.h> |
40 | #include <linux/interrupt.h> | 40 | #include <linux/interrupt.h> |
41 | #include <linux/smp_lock.h> | ||
42 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
43 | #include <linux/timer.h> | 42 | #include <linux/timer.h> |
44 | #include <linux/clk.h> | 43 | #include <linux/clk.h> |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 94a2a350a414..cf94511485f2 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -373,7 +373,7 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, | |||
373 | musb_save_toggle(qh, is_in, urb); | 373 | musb_save_toggle(qh, is_in, urb); |
374 | break; | 374 | break; |
375 | case USB_ENDPOINT_XFER_ISOC: | 375 | case USB_ENDPOINT_XFER_ISOC: |
376 | if (urb->error_count) | 376 | if (status == 0 && urb->error_count) |
377 | status = -EXDEV; | 377 | status = -EXDEV; |
378 | break; | 378 | break; |
379 | } | 379 | } |
@@ -2235,13 +2235,30 @@ static void musb_h_stop(struct usb_hcd *hcd) | |||
2235 | static int musb_bus_suspend(struct usb_hcd *hcd) | 2235 | static int musb_bus_suspend(struct usb_hcd *hcd) |
2236 | { | 2236 | { |
2237 | struct musb *musb = hcd_to_musb(hcd); | 2237 | struct musb *musb = hcd_to_musb(hcd); |
2238 | u8 devctl; | ||
2238 | 2239 | ||
2239 | if (musb->xceiv->state == OTG_STATE_A_SUSPEND) | 2240 | if (!is_host_active(musb)) |
2240 | return 0; | 2241 | return 0; |
2241 | 2242 | ||
2242 | if (is_host_active(musb) && musb->is_active) { | 2243 | switch (musb->xceiv->state) { |
2243 | WARNING("trying to suspend as %s is_active=%i\n", | 2244 | case OTG_STATE_A_SUSPEND: |
2244 | otg_state_string(musb), musb->is_active); | 2245 | return 0; |
2246 | case OTG_STATE_A_WAIT_VRISE: | ||
2247 | /* ID could be grounded even if there's no device | ||
2248 | * on the other end of the cable. NOTE that the | ||
2249 | * A_WAIT_VRISE timers are messy with MUSB... | ||
2250 | */ | ||
2251 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
2252 | if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) | ||
2253 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | ||
2254 | break; | ||
2255 | default: | ||
2256 | break; | ||
2257 | } | ||
2258 | |||
2259 | if (musb->is_active) { | ||
2260 | WARNING("trying to suspend as %s while active\n", | ||
2261 | otg_state_string(musb)); | ||
2245 | return -EBUSY; | 2262 | return -EBUSY; |
2246 | } else | 2263 | } else |
2247 | return 0; | 2264 | return 0; |
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig index 69feeec1628c..aa884d072f0b 100644 --- a/drivers/usb/otg/Kconfig +++ b/drivers/usb/otg/Kconfig | |||
@@ -59,18 +59,4 @@ config NOP_USB_XCEIV | |||
59 | built-in with usb ip or which are autonomous and doesn't require any | 59 | built-in with usb ip or which are autonomous and doesn't require any |
60 | phy programming such as ISP1x04 etc. | 60 | phy programming such as ISP1x04 etc. |
61 | 61 | ||
62 | config USB_LANGWELL_OTG | ||
63 | tristate "Intel Langwell USB OTG dual-role support" | ||
64 | depends on USB && MRST | ||
65 | select USB_OTG | ||
66 | select USB_OTG_UTILS | ||
67 | help | ||
68 | Say Y here if you want to build Intel Langwell USB OTG | ||
69 | transciever driver in kernel. This driver implements role | ||
70 | switch between EHCI host driver and Langwell USB OTG | ||
71 | client driver. | ||
72 | |||
73 | To compile this driver as a module, choose M here: the | ||
74 | module will be called langwell_otg. | ||
75 | |||
76 | endif # USB || OTG | 62 | endif # USB || OTG |
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile index 6d1abdd3c0ac..208167856529 100644 --- a/drivers/usb/otg/Makefile +++ b/drivers/usb/otg/Makefile | |||
@@ -9,7 +9,6 @@ obj-$(CONFIG_USB_OTG_UTILS) += otg.o | |||
9 | obj-$(CONFIG_USB_GPIO_VBUS) += gpio_vbus.o | 9 | obj-$(CONFIG_USB_GPIO_VBUS) += gpio_vbus.o |
10 | obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o | 10 | obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o |
11 | obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o | 11 | obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o |
12 | obj-$(CONFIG_USB_LANGWELL_OTG) += langwell_otg.o | ||
13 | obj-$(CONFIG_NOP_USB_XCEIV) += nop-usb-xceiv.o | 12 | obj-$(CONFIG_NOP_USB_XCEIV) += nop-usb-xceiv.o |
14 | 13 | ||
15 | ccflags-$(CONFIG_USB_DEBUG) += -DDEBUG | 14 | ccflags-$(CONFIG_USB_DEBUG) += -DDEBUG |
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c deleted file mode 100644 index 6f628d0e9f39..000000000000 --- a/drivers/usb/otg/langwell_otg.c +++ /dev/null | |||
@@ -1,1915 +0,0 @@ | |||
1 | /* | ||
2 | * Intel Langwell USB OTG transceiver driver | ||
3 | * Copyright (C) 2008 - 2009, Intel Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | */ | ||
19 | /* This driver helps to switch Langwell OTG controller function between host | ||
20 | * and peripheral. It works with EHCI driver and Langwell client controller | ||
21 | * driver together. | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/pci.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/device.h> | ||
30 | #include <linux/moduleparam.h> | ||
31 | #include <linux/usb/ch9.h> | ||
32 | #include <linux/usb/gadget.h> | ||
33 | #include <linux/usb.h> | ||
34 | #include <linux/usb/otg.h> | ||
35 | #include <linux/notifier.h> | ||
36 | #include <asm/ipc_defs.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include "../core/hcd.h" | ||
39 | |||
40 | #include <linux/usb/langwell_otg.h> | ||
41 | |||
42 | #define DRIVER_DESC "Intel Langwell USB OTG transceiver driver" | ||
43 | #define DRIVER_VERSION "3.0.0.32L.0002" | ||
44 | |||
45 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
46 | MODULE_AUTHOR("Henry Yuan <hang.yuan@intel.com>, Hao Wu <hao.wu@intel.com>"); | ||
47 | MODULE_VERSION(DRIVER_VERSION); | ||
48 | MODULE_LICENSE("GPL"); | ||
49 | |||
50 | static const char driver_name[] = "langwell_otg"; | ||
51 | |||
52 | static int langwell_otg_probe(struct pci_dev *pdev, | ||
53 | const struct pci_device_id *id); | ||
54 | static void langwell_otg_remove(struct pci_dev *pdev); | ||
55 | static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message); | ||
56 | static int langwell_otg_resume(struct pci_dev *pdev); | ||
57 | |||
58 | static int langwell_otg_set_host(struct otg_transceiver *otg, | ||
59 | struct usb_bus *host); | ||
60 | static int langwell_otg_set_peripheral(struct otg_transceiver *otg, | ||
61 | struct usb_gadget *gadget); | ||
62 | static int langwell_otg_start_srp(struct otg_transceiver *otg); | ||
63 | |||
64 | static const struct pci_device_id pci_ids[] = {{ | ||
65 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), | ||
66 | .class_mask = ~0, | ||
67 | .vendor = 0x8086, | ||
68 | .device = 0x0811, | ||
69 | .subvendor = PCI_ANY_ID, | ||
70 | .subdevice = PCI_ANY_ID, | ||
71 | }, { /* end: all zeroes */ } | ||
72 | }; | ||
73 | |||
74 | static struct pci_driver otg_pci_driver = { | ||
75 | .name = (char *) driver_name, | ||
76 | .id_table = pci_ids, | ||
77 | |||
78 | .probe = langwell_otg_probe, | ||
79 | .remove = langwell_otg_remove, | ||
80 | |||
81 | .suspend = langwell_otg_suspend, | ||
82 | .resume = langwell_otg_resume, | ||
83 | }; | ||
84 | |||
85 | static const char *state_string(enum usb_otg_state state) | ||
86 | { | ||
87 | switch (state) { | ||
88 | case OTG_STATE_A_IDLE: | ||
89 | return "a_idle"; | ||
90 | case OTG_STATE_A_WAIT_VRISE: | ||
91 | return "a_wait_vrise"; | ||
92 | case OTG_STATE_A_WAIT_BCON: | ||
93 | return "a_wait_bcon"; | ||
94 | case OTG_STATE_A_HOST: | ||
95 | return "a_host"; | ||
96 | case OTG_STATE_A_SUSPEND: | ||
97 | return "a_suspend"; | ||
98 | case OTG_STATE_A_PERIPHERAL: | ||
99 | return "a_peripheral"; | ||
100 | case OTG_STATE_A_WAIT_VFALL: | ||
101 | return "a_wait_vfall"; | ||
102 | case OTG_STATE_A_VBUS_ERR: | ||
103 | return "a_vbus_err"; | ||
104 | case OTG_STATE_B_IDLE: | ||
105 | return "b_idle"; | ||
106 | case OTG_STATE_B_SRP_INIT: | ||
107 | return "b_srp_init"; | ||
108 | case OTG_STATE_B_PERIPHERAL: | ||
109 | return "b_peripheral"; | ||
110 | case OTG_STATE_B_WAIT_ACON: | ||
111 | return "b_wait_acon"; | ||
112 | case OTG_STATE_B_HOST: | ||
113 | return "b_host"; | ||
114 | default: | ||
115 | return "UNDEFINED"; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | /* HSM timers */ | ||
120 | static inline struct langwell_otg_timer *otg_timer_initializer | ||
121 | (void (*function)(unsigned long), unsigned long expires, unsigned long data) | ||
122 | { | ||
123 | struct langwell_otg_timer *timer; | ||
124 | timer = kmalloc(sizeof(struct langwell_otg_timer), GFP_KERNEL); | ||
125 | timer->function = function; | ||
126 | timer->expires = expires; | ||
127 | timer->data = data; | ||
128 | return timer; | ||
129 | } | ||
130 | |||
131 | static struct langwell_otg_timer *a_wait_vrise_tmr, *a_wait_bcon_tmr, | ||
132 | *a_aidl_bdis_tmr, *b_ase0_brst_tmr, *b_se0_srp_tmr, *b_srp_res_tmr, | ||
133 | *b_bus_suspend_tmr; | ||
134 | |||
135 | static struct list_head active_timers; | ||
136 | |||
137 | static struct langwell_otg *the_transceiver; | ||
138 | |||
139 | /* host/client notify transceiver when event affects HNP state */ | ||
140 | void langwell_update_transceiver() | ||
141 | { | ||
142 | otg_dbg("transceiver driver is notified\n"); | ||
143 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
144 | } | ||
145 | EXPORT_SYMBOL(langwell_update_transceiver); | ||
146 | |||
147 | static int langwell_otg_set_host(struct otg_transceiver *otg, | ||
148 | struct usb_bus *host) | ||
149 | { | ||
150 | otg->host = host; | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static int langwell_otg_set_peripheral(struct otg_transceiver *otg, | ||
156 | struct usb_gadget *gadget) | ||
157 | { | ||
158 | otg->gadget = gadget; | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int langwell_otg_set_power(struct otg_transceiver *otg, | ||
164 | unsigned mA) | ||
165 | { | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | /* A-device drives vbus, controlled through PMIC CHRGCNTL register*/ | ||
170 | static void langwell_otg_drv_vbus(int on) | ||
171 | { | ||
172 | struct ipc_pmic_reg_data pmic_data = {0}; | ||
173 | struct ipc_pmic_reg_data battery_data; | ||
174 | |||
175 | /* Check if battery is attached or not */ | ||
176 | battery_data.pmic_reg_data[0].register_address = 0xd2; | ||
177 | battery_data.ioc = 0; | ||
178 | battery_data.num_entries = 1; | ||
179 | if (ipc_pmic_register_read(&battery_data)) { | ||
180 | otg_dbg("Failed to read PMIC register 0xd2.\n"); | ||
181 | return; | ||
182 | } | ||
183 | |||
184 | if ((battery_data.pmic_reg_data[0].value & 0x20) == 0) { | ||
185 | otg_dbg("no battery attached\n"); | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | /* Workaround for battery attachment issue */ | ||
190 | if (battery_data.pmic_reg_data[0].value == 0x34) { | ||
191 | otg_dbg("battery \n"); | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | otg_dbg("battery attached\n"); | ||
196 | |||
197 | pmic_data.ioc = 0; | ||
198 | pmic_data.pmic_reg_data[0].register_address = 0xD4; | ||
199 | pmic_data.num_entries = 1; | ||
200 | if (on) | ||
201 | pmic_data.pmic_reg_data[0].value = 0x20; | ||
202 | else | ||
203 | pmic_data.pmic_reg_data[0].value = 0xc0; | ||
204 | |||
205 | if (ipc_pmic_register_write(&pmic_data, TRUE)) | ||
206 | otg_dbg("Failed to write PMIC.\n"); | ||
207 | |||
208 | } | ||
209 | |||
210 | /* charge vbus or discharge vbus through a resistor to ground */ | ||
211 | static void langwell_otg_chrg_vbus(int on) | ||
212 | { | ||
213 | |||
214 | u32 val; | ||
215 | |||
216 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
217 | |||
218 | if (on) | ||
219 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_VC, | ||
220 | the_transceiver->regs + CI_OTGSC); | ||
221 | else | ||
222 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_VD, | ||
223 | the_transceiver->regs + CI_OTGSC); | ||
224 | |||
225 | } | ||
226 | |||
227 | /* Start SRP */ | ||
228 | static int langwell_otg_start_srp(struct otg_transceiver *otg) | ||
229 | { | ||
230 | u32 val; | ||
231 | |||
232 | otg_dbg("Start SRP ->\n"); | ||
233 | |||
234 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
235 | |||
236 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_HADP, | ||
237 | the_transceiver->regs + CI_OTGSC); | ||
238 | |||
239 | /* Check if the data plus is finished or not */ | ||
240 | msleep(8); | ||
241 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
242 | if (val & (OTGSC_HADP | OTGSC_DP)) | ||
243 | otg_dbg("DataLine SRP Error\n"); | ||
244 | |||
245 | /* FIXME: VBus SRP */ | ||
246 | |||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | |||
251 | /* stop SOF via bus_suspend */ | ||
252 | static void langwell_otg_loc_sof(int on) | ||
253 | { | ||
254 | struct usb_hcd *hcd; | ||
255 | int err; | ||
256 | |||
257 | otg_dbg("loc_sof -> %d\n", on); | ||
258 | |||
259 | hcd = bus_to_hcd(the_transceiver->otg.host); | ||
260 | if (on) | ||
261 | err = hcd->driver->bus_resume(hcd); | ||
262 | else | ||
263 | err = hcd->driver->bus_suspend(hcd); | ||
264 | |||
265 | if (err) | ||
266 | otg_dbg("Failed to resume/suspend bus - %d\n", err); | ||
267 | } | ||
268 | |||
269 | static void langwell_otg_phy_low_power(int on) | ||
270 | { | ||
271 | u32 val; | ||
272 | |||
273 | otg_dbg("phy low power mode-> %d\n", on); | ||
274 | |||
275 | val = readl(the_transceiver->regs + CI_HOSTPC1); | ||
276 | if (on) | ||
277 | writel(val | HOSTPC1_PHCD, the_transceiver->regs + CI_HOSTPC1); | ||
278 | else | ||
279 | writel(val & ~HOSTPC1_PHCD, the_transceiver->regs + CI_HOSTPC1); | ||
280 | } | ||
281 | |||
282 | /* Enable/Disable OTG interrupt */ | ||
283 | static void langwell_otg_intr(int on) | ||
284 | { | ||
285 | u32 val; | ||
286 | |||
287 | otg_dbg("interrupt -> %d\n", on); | ||
288 | |||
289 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
290 | if (on) { | ||
291 | val = val | (OTGSC_INTEN_MASK | OTGSC_IDPU); | ||
292 | writel(val, the_transceiver->regs + CI_OTGSC); | ||
293 | } else { | ||
294 | val = val & ~(OTGSC_INTEN_MASK | OTGSC_IDPU); | ||
295 | writel(val, the_transceiver->regs + CI_OTGSC); | ||
296 | } | ||
297 | } | ||
298 | |||
299 | /* set HAAR: Hardware Assist Auto-Reset */ | ||
300 | static void langwell_otg_HAAR(int on) | ||
301 | { | ||
302 | u32 val; | ||
303 | |||
304 | otg_dbg("HAAR -> %d\n", on); | ||
305 | |||
306 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
307 | if (on) | ||
308 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_HAAR, | ||
309 | the_transceiver->regs + CI_OTGSC); | ||
310 | else | ||
311 | writel((val & ~OTGSC_INTSTS_MASK) & ~OTGSC_HAAR, | ||
312 | the_transceiver->regs + CI_OTGSC); | ||
313 | } | ||
314 | |||
315 | /* set HABA: Hardware Assist B-Disconnect to A-Connect */ | ||
316 | static void langwell_otg_HABA(int on) | ||
317 | { | ||
318 | u32 val; | ||
319 | |||
320 | otg_dbg("HABA -> %d\n", on); | ||
321 | |||
322 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
323 | if (on) | ||
324 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_HABA, | ||
325 | the_transceiver->regs + CI_OTGSC); | ||
326 | else | ||
327 | writel((val & ~OTGSC_INTSTS_MASK) & ~OTGSC_HABA, | ||
328 | the_transceiver->regs + CI_OTGSC); | ||
329 | } | ||
330 | |||
331 | static int langwell_otg_check_se0_srp(int on) | ||
332 | { | ||
333 | u32 val; | ||
334 | |||
335 | int delay_time = TB_SE0_SRP * 10; /* step is 100us */ | ||
336 | |||
337 | otg_dbg("check_se0_srp -> \n"); | ||
338 | |||
339 | do { | ||
340 | udelay(100); | ||
341 | if (!delay_time--) | ||
342 | break; | ||
343 | val = readl(the_transceiver->regs + CI_PORTSC1); | ||
344 | val &= PORTSC_LS; | ||
345 | } while (!val); | ||
346 | |||
347 | otg_dbg("check_se0_srp <- \n"); | ||
348 | return val; | ||
349 | } | ||
350 | |||
351 | /* The timeout callback function to set time out bit */ | ||
352 | static void set_tmout(unsigned long indicator) | ||
353 | { | ||
354 | *(int *)indicator = 1; | ||
355 | } | ||
356 | |||
357 | void langwell_otg_nsf_msg(unsigned long indicator) | ||
358 | { | ||
359 | switch (indicator) { | ||
360 | case 2: | ||
361 | case 4: | ||
362 | case 6: | ||
363 | case 7: | ||
364 | printk(KERN_ERR "OTG:NSF-%lu - deivce not responding\n", | ||
365 | indicator); | ||
366 | break; | ||
367 | case 3: | ||
368 | printk(KERN_ERR "OTG:NSF-%lu - deivce not supported\n", | ||
369 | indicator); | ||
370 | break; | ||
371 | default: | ||
372 | printk(KERN_ERR "Do not have this kind of NSF\n"); | ||
373 | break; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | /* Initialize timers */ | ||
378 | static void langwell_otg_init_timers(struct otg_hsm *hsm) | ||
379 | { | ||
380 | /* HSM used timers */ | ||
381 | a_wait_vrise_tmr = otg_timer_initializer(&set_tmout, TA_WAIT_VRISE, | ||
382 | (unsigned long)&hsm->a_wait_vrise_tmout); | ||
383 | a_wait_bcon_tmr = otg_timer_initializer(&set_tmout, TA_WAIT_BCON, | ||
384 | (unsigned long)&hsm->a_wait_bcon_tmout); | ||
385 | a_aidl_bdis_tmr = otg_timer_initializer(&set_tmout, TA_AIDL_BDIS, | ||
386 | (unsigned long)&hsm->a_aidl_bdis_tmout); | ||
387 | b_ase0_brst_tmr = otg_timer_initializer(&set_tmout, TB_ASE0_BRST, | ||
388 | (unsigned long)&hsm->b_ase0_brst_tmout); | ||
389 | b_se0_srp_tmr = otg_timer_initializer(&set_tmout, TB_SE0_SRP, | ||
390 | (unsigned long)&hsm->b_se0_srp); | ||
391 | b_srp_res_tmr = otg_timer_initializer(&set_tmout, TB_SRP_RES, | ||
392 | (unsigned long)&hsm->b_srp_res_tmout); | ||
393 | b_bus_suspend_tmr = otg_timer_initializer(&set_tmout, TB_BUS_SUSPEND, | ||
394 | (unsigned long)&hsm->b_bus_suspend_tmout); | ||
395 | } | ||
396 | |||
397 | /* Free timers */ | ||
398 | static void langwell_otg_free_timers(void) | ||
399 | { | ||
400 | kfree(a_wait_vrise_tmr); | ||
401 | kfree(a_wait_bcon_tmr); | ||
402 | kfree(a_aidl_bdis_tmr); | ||
403 | kfree(b_ase0_brst_tmr); | ||
404 | kfree(b_se0_srp_tmr); | ||
405 | kfree(b_srp_res_tmr); | ||
406 | kfree(b_bus_suspend_tmr); | ||
407 | } | ||
408 | |||
409 | /* Add timer to timer list */ | ||
410 | static void langwell_otg_add_timer(void *gtimer) | ||
411 | { | ||
412 | struct langwell_otg_timer *timer = (struct langwell_otg_timer *)gtimer; | ||
413 | struct langwell_otg_timer *tmp_timer; | ||
414 | u32 val32; | ||
415 | |||
416 | /* Check if the timer is already in the active list, | ||
417 | * if so update timer count | ||
418 | */ | ||
419 | list_for_each_entry(tmp_timer, &active_timers, list) | ||
420 | if (tmp_timer == timer) { | ||
421 | timer->count = timer->expires; | ||
422 | return; | ||
423 | } | ||
424 | timer->count = timer->expires; | ||
425 | |||
426 | if (list_empty(&active_timers)) { | ||
427 | val32 = readl(the_transceiver->regs + CI_OTGSC); | ||
428 | writel(val32 | OTGSC_1MSE, the_transceiver->regs + CI_OTGSC); | ||
429 | } | ||
430 | |||
431 | list_add_tail(&timer->list, &active_timers); | ||
432 | } | ||
433 | |||
434 | /* Remove timer from the timer list; clear timeout status */ | ||
435 | static void langwell_otg_del_timer(void *gtimer) | ||
436 | { | ||
437 | struct langwell_otg_timer *timer = (struct langwell_otg_timer *)gtimer; | ||
438 | struct langwell_otg_timer *tmp_timer, *del_tmp; | ||
439 | u32 val32; | ||
440 | |||
441 | list_for_each_entry_safe(tmp_timer, del_tmp, &active_timers, list) | ||
442 | if (tmp_timer == timer) | ||
443 | list_del(&timer->list); | ||
444 | |||
445 | if (list_empty(&active_timers)) { | ||
446 | val32 = readl(the_transceiver->regs + CI_OTGSC); | ||
447 | writel(val32 & ~OTGSC_1MSE, the_transceiver->regs + CI_OTGSC); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | /* Reduce timer count by 1, and find timeout conditions.*/ | ||
452 | static int langwell_otg_tick_timer(u32 *int_sts) | ||
453 | { | ||
454 | struct langwell_otg_timer *tmp_timer, *del_tmp; | ||
455 | int expired = 0; | ||
456 | |||
457 | list_for_each_entry_safe(tmp_timer, del_tmp, &active_timers, list) { | ||
458 | tmp_timer->count--; | ||
459 | /* check if timer expires */ | ||
460 | if (!tmp_timer->count) { | ||
461 | list_del(&tmp_timer->list); | ||
462 | tmp_timer->function(tmp_timer->data); | ||
463 | expired = 1; | ||
464 | } | ||
465 | } | ||
466 | |||
467 | if (list_empty(&active_timers)) { | ||
468 | otg_dbg("tick timer: disable 1ms int\n"); | ||
469 | *int_sts = *int_sts & ~OTGSC_1MSE; | ||
470 | } | ||
471 | return expired; | ||
472 | } | ||
473 | |||
474 | static void reset_otg(void) | ||
475 | { | ||
476 | u32 val; | ||
477 | int delay_time = 1000; | ||
478 | |||
479 | otg_dbg("reseting OTG controller ...\n"); | ||
480 | val = readl(the_transceiver->regs + CI_USBCMD); | ||
481 | writel(val | USBCMD_RST, the_transceiver->regs + CI_USBCMD); | ||
482 | do { | ||
483 | udelay(100); | ||
484 | if (!delay_time--) | ||
485 | otg_dbg("reset timeout\n"); | ||
486 | val = readl(the_transceiver->regs + CI_USBCMD); | ||
487 | val &= USBCMD_RST; | ||
488 | } while (val != 0); | ||
489 | otg_dbg("reset done.\n"); | ||
490 | } | ||
491 | |||
492 | static void set_host_mode(void) | ||
493 | { | ||
494 | u32 val; | ||
495 | |||
496 | reset_otg(); | ||
497 | val = readl(the_transceiver->regs + CI_USBMODE); | ||
498 | val = (val & (~USBMODE_CM)) | USBMODE_HOST; | ||
499 | writel(val, the_transceiver->regs + CI_USBMODE); | ||
500 | } | ||
501 | |||
502 | static void set_client_mode(void) | ||
503 | { | ||
504 | u32 val; | ||
505 | |||
506 | reset_otg(); | ||
507 | val = readl(the_transceiver->regs + CI_USBMODE); | ||
508 | val = (val & (~USBMODE_CM)) | USBMODE_DEVICE; | ||
509 | writel(val, the_transceiver->regs + CI_USBMODE); | ||
510 | } | ||
511 | |||
512 | static void init_hsm(void) | ||
513 | { | ||
514 | struct langwell_otg *langwell = the_transceiver; | ||
515 | u32 val32; | ||
516 | |||
517 | /* read OTGSC after reset */ | ||
518 | val32 = readl(langwell->regs + CI_OTGSC); | ||
519 | otg_dbg("%s: OTGSC init value = 0x%x\n", __func__, val32); | ||
520 | |||
521 | /* set init state */ | ||
522 | if (val32 & OTGSC_ID) { | ||
523 | langwell->hsm.id = 1; | ||
524 | langwell->otg.default_a = 0; | ||
525 | set_client_mode(); | ||
526 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
527 | langwell_otg_drv_vbus(0); | ||
528 | } else { | ||
529 | langwell->hsm.id = 0; | ||
530 | langwell->otg.default_a = 1; | ||
531 | set_host_mode(); | ||
532 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
533 | } | ||
534 | |||
535 | /* set session indicator */ | ||
536 | if (val32 & OTGSC_BSE) | ||
537 | langwell->hsm.b_sess_end = 1; | ||
538 | if (val32 & OTGSC_BSV) | ||
539 | langwell->hsm.b_sess_vld = 1; | ||
540 | if (val32 & OTGSC_ASV) | ||
541 | langwell->hsm.a_sess_vld = 1; | ||
542 | if (val32 & OTGSC_AVV) | ||
543 | langwell->hsm.a_vbus_vld = 1; | ||
544 | |||
545 | /* defautly power the bus */ | ||
546 | langwell->hsm.a_bus_req = 1; | ||
547 | langwell->hsm.a_bus_drop = 0; | ||
548 | /* defautly don't request bus as B device */ | ||
549 | langwell->hsm.b_bus_req = 0; | ||
550 | /* no system error */ | ||
551 | langwell->hsm.a_clr_err = 0; | ||
552 | } | ||
553 | |||
554 | static irqreturn_t otg_dummy_irq(int irq, void *_dev) | ||
555 | { | ||
556 | void __iomem *reg_base = _dev; | ||
557 | u32 val; | ||
558 | u32 int_mask = 0; | ||
559 | |||
560 | val = readl(reg_base + CI_USBMODE); | ||
561 | if ((val & USBMODE_CM) != USBMODE_DEVICE) | ||
562 | return IRQ_NONE; | ||
563 | |||
564 | val = readl(reg_base + CI_USBSTS); | ||
565 | int_mask = val & INTR_DUMMY_MASK; | ||
566 | |||
567 | if (int_mask == 0) | ||
568 | return IRQ_NONE; | ||
569 | |||
570 | /* clear hsm.b_conn here since host driver can't detect it | ||
571 | * otg_dummy_irq called means B-disconnect happened. | ||
572 | */ | ||
573 | if (the_transceiver->hsm.b_conn) { | ||
574 | the_transceiver->hsm.b_conn = 0; | ||
575 | if (spin_trylock(&the_transceiver->wq_lock)) { | ||
576 | queue_work(the_transceiver->qwork, | ||
577 | &the_transceiver->work); | ||
578 | spin_unlock(&the_transceiver->wq_lock); | ||
579 | } | ||
580 | } | ||
581 | /* Clear interrupts */ | ||
582 | writel(int_mask, reg_base + CI_USBSTS); | ||
583 | return IRQ_HANDLED; | ||
584 | } | ||
585 | |||
586 | static irqreturn_t otg_irq(int irq, void *_dev) | ||
587 | { | ||
588 | struct langwell_otg *langwell = _dev; | ||
589 | u32 int_sts, int_en; | ||
590 | u32 int_mask = 0; | ||
591 | int flag = 0; | ||
592 | |||
593 | int_sts = readl(langwell->regs + CI_OTGSC); | ||
594 | int_en = (int_sts & OTGSC_INTEN_MASK) >> 8; | ||
595 | int_mask = int_sts & int_en; | ||
596 | if (int_mask == 0) | ||
597 | return IRQ_NONE; | ||
598 | |||
599 | if (int_mask & OTGSC_IDIS) { | ||
600 | otg_dbg("%s: id change int\n", __func__); | ||
601 | langwell->hsm.id = (int_sts & OTGSC_ID) ? 1 : 0; | ||
602 | flag = 1; | ||
603 | } | ||
604 | if (int_mask & OTGSC_DPIS) { | ||
605 | otg_dbg("%s: data pulse int\n", __func__); | ||
606 | langwell->hsm.a_srp_det = (int_sts & OTGSC_DPS) ? 1 : 0; | ||
607 | flag = 1; | ||
608 | } | ||
609 | if (int_mask & OTGSC_BSEIS) { | ||
610 | otg_dbg("%s: b session end int\n", __func__); | ||
611 | langwell->hsm.b_sess_end = (int_sts & OTGSC_BSE) ? 1 : 0; | ||
612 | flag = 1; | ||
613 | } | ||
614 | if (int_mask & OTGSC_BSVIS) { | ||
615 | otg_dbg("%s: b session valid int\n", __func__); | ||
616 | langwell->hsm.b_sess_vld = (int_sts & OTGSC_BSV) ? 1 : 0; | ||
617 | flag = 1; | ||
618 | } | ||
619 | if (int_mask & OTGSC_ASVIS) { | ||
620 | otg_dbg("%s: a session valid int\n", __func__); | ||
621 | langwell->hsm.a_sess_vld = (int_sts & OTGSC_ASV) ? 1 : 0; | ||
622 | flag = 1; | ||
623 | } | ||
624 | if (int_mask & OTGSC_AVVIS) { | ||
625 | otg_dbg("%s: a vbus valid int\n", __func__); | ||
626 | langwell->hsm.a_vbus_vld = (int_sts & OTGSC_AVV) ? 1 : 0; | ||
627 | flag = 1; | ||
628 | } | ||
629 | |||
630 | if (int_mask & OTGSC_1MSS) { | ||
631 | /* need to schedule otg_work if any timer is expired */ | ||
632 | if (langwell_otg_tick_timer(&int_sts)) | ||
633 | flag = 1; | ||
634 | } | ||
635 | |||
636 | writel((int_sts & ~OTGSC_INTSTS_MASK) | int_mask, | ||
637 | langwell->regs + CI_OTGSC); | ||
638 | if (flag) | ||
639 | queue_work(langwell->qwork, &langwell->work); | ||
640 | |||
641 | return IRQ_HANDLED; | ||
642 | } | ||
643 | |||
644 | static void langwell_otg_work(struct work_struct *work) | ||
645 | { | ||
646 | struct langwell_otg *langwell = container_of(work, | ||
647 | struct langwell_otg, work); | ||
648 | int retval; | ||
649 | |||
650 | otg_dbg("%s: old state = %s\n", __func__, | ||
651 | state_string(langwell->otg.state)); | ||
652 | |||
653 | switch (langwell->otg.state) { | ||
654 | case OTG_STATE_UNDEFINED: | ||
655 | case OTG_STATE_B_IDLE: | ||
656 | if (!langwell->hsm.id) { | ||
657 | langwell_otg_del_timer(b_srp_res_tmr); | ||
658 | langwell->otg.default_a = 1; | ||
659 | langwell->hsm.a_srp_det = 0; | ||
660 | |||
661 | langwell_otg_chrg_vbus(0); | ||
662 | langwell_otg_drv_vbus(0); | ||
663 | |||
664 | set_host_mode(); | ||
665 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
666 | queue_work(langwell->qwork, &langwell->work); | ||
667 | } else if (langwell->hsm.b_srp_res_tmout) { | ||
668 | langwell->hsm.b_srp_res_tmout = 0; | ||
669 | langwell->hsm.b_bus_req = 0; | ||
670 | langwell_otg_nsf_msg(6); | ||
671 | } else if (langwell->hsm.b_sess_vld) { | ||
672 | langwell_otg_del_timer(b_srp_res_tmr); | ||
673 | langwell->hsm.b_sess_end = 0; | ||
674 | langwell->hsm.a_bus_suspend = 0; | ||
675 | |||
676 | langwell_otg_chrg_vbus(0); | ||
677 | if (langwell->client_ops) { | ||
678 | langwell->client_ops->resume(langwell->pdev); | ||
679 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
680 | } else | ||
681 | otg_dbg("client driver not loaded.\n"); | ||
682 | |||
683 | } else if (langwell->hsm.b_bus_req && | ||
684 | (langwell->hsm.b_sess_end)) { | ||
685 | /* workaround for b_se0_srp detection */ | ||
686 | retval = langwell_otg_check_se0_srp(0); | ||
687 | if (retval) { | ||
688 | langwell->hsm.b_bus_req = 0; | ||
689 | otg_dbg("LS is not SE0, try again later\n"); | ||
690 | } else { | ||
691 | /* Start SRP */ | ||
692 | langwell_otg_start_srp(&langwell->otg); | ||
693 | langwell_otg_add_timer(b_srp_res_tmr); | ||
694 | } | ||
695 | } | ||
696 | break; | ||
697 | case OTG_STATE_B_SRP_INIT: | ||
698 | if (!langwell->hsm.id) { | ||
699 | langwell->otg.default_a = 1; | ||
700 | langwell->hsm.a_srp_det = 0; | ||
701 | |||
702 | langwell_otg_drv_vbus(0); | ||
703 | langwell_otg_chrg_vbus(0); | ||
704 | |||
705 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
706 | queue_work(langwell->qwork, &langwell->work); | ||
707 | } else if (langwell->hsm.b_sess_vld) { | ||
708 | langwell_otg_chrg_vbus(0); | ||
709 | if (langwell->client_ops) { | ||
710 | langwell->client_ops->resume(langwell->pdev); | ||
711 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
712 | } else | ||
713 | otg_dbg("client driver not loaded.\n"); | ||
714 | } | ||
715 | break; | ||
716 | case OTG_STATE_B_PERIPHERAL: | ||
717 | if (!langwell->hsm.id) { | ||
718 | langwell->otg.default_a = 1; | ||
719 | langwell->hsm.a_srp_det = 0; | ||
720 | |||
721 | langwell_otg_drv_vbus(0); | ||
722 | langwell_otg_chrg_vbus(0); | ||
723 | set_host_mode(); | ||
724 | |||
725 | if (langwell->client_ops) { | ||
726 | langwell->client_ops->suspend(langwell->pdev, | ||
727 | PMSG_FREEZE); | ||
728 | } else | ||
729 | otg_dbg("client driver has been removed.\n"); | ||
730 | |||
731 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
732 | queue_work(langwell->qwork, &langwell->work); | ||
733 | } else if (!langwell->hsm.b_sess_vld) { | ||
734 | langwell->hsm.b_hnp_enable = 0; | ||
735 | |||
736 | if (langwell->client_ops) { | ||
737 | langwell->client_ops->suspend(langwell->pdev, | ||
738 | PMSG_FREEZE); | ||
739 | } else | ||
740 | otg_dbg("client driver has been removed.\n"); | ||
741 | |||
742 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
743 | } else if (langwell->hsm.b_bus_req && langwell->hsm.b_hnp_enable | ||
744 | && langwell->hsm.a_bus_suspend) { | ||
745 | |||
746 | if (langwell->client_ops) { | ||
747 | langwell->client_ops->suspend(langwell->pdev, | ||
748 | PMSG_FREEZE); | ||
749 | } else | ||
750 | otg_dbg("client driver has been removed.\n"); | ||
751 | |||
752 | langwell_otg_HAAR(1); | ||
753 | langwell->hsm.a_conn = 0; | ||
754 | |||
755 | if (langwell->host_ops) { | ||
756 | langwell->host_ops->probe(langwell->pdev, | ||
757 | langwell->host_ops->id_table); | ||
758 | langwell->otg.state = OTG_STATE_B_WAIT_ACON; | ||
759 | } else | ||
760 | otg_dbg("host driver not loaded.\n"); | ||
761 | |||
762 | langwell->hsm.a_bus_resume = 0; | ||
763 | langwell->hsm.b_ase0_brst_tmout = 0; | ||
764 | langwell_otg_add_timer(b_ase0_brst_tmr); | ||
765 | } | ||
766 | break; | ||
767 | |||
768 | case OTG_STATE_B_WAIT_ACON: | ||
769 | if (!langwell->hsm.id) { | ||
770 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
771 | langwell->otg.default_a = 1; | ||
772 | langwell->hsm.a_srp_det = 0; | ||
773 | |||
774 | langwell_otg_drv_vbus(0); | ||
775 | langwell_otg_chrg_vbus(0); | ||
776 | set_host_mode(); | ||
777 | |||
778 | langwell_otg_HAAR(0); | ||
779 | if (langwell->host_ops) | ||
780 | langwell->host_ops->remove(langwell->pdev); | ||
781 | else | ||
782 | otg_dbg("host driver has been removed.\n"); | ||
783 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
784 | queue_work(langwell->qwork, &langwell->work); | ||
785 | } else if (!langwell->hsm.b_sess_vld) { | ||
786 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
787 | langwell->hsm.b_hnp_enable = 0; | ||
788 | langwell->hsm.b_bus_req = 0; | ||
789 | langwell_otg_chrg_vbus(0); | ||
790 | langwell_otg_HAAR(0); | ||
791 | |||
792 | if (langwell->host_ops) | ||
793 | langwell->host_ops->remove(langwell->pdev); | ||
794 | else | ||
795 | otg_dbg("host driver has been removed.\n"); | ||
796 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
797 | } else if (langwell->hsm.a_conn) { | ||
798 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
799 | langwell_otg_HAAR(0); | ||
800 | langwell->otg.state = OTG_STATE_B_HOST; | ||
801 | queue_work(langwell->qwork, &langwell->work); | ||
802 | } else if (langwell->hsm.a_bus_resume || | ||
803 | langwell->hsm.b_ase0_brst_tmout) { | ||
804 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
805 | langwell_otg_HAAR(0); | ||
806 | langwell_otg_nsf_msg(7); | ||
807 | |||
808 | if (langwell->host_ops) | ||
809 | langwell->host_ops->remove(langwell->pdev); | ||
810 | else | ||
811 | otg_dbg("host driver has been removed.\n"); | ||
812 | |||
813 | langwell->hsm.a_bus_suspend = 0; | ||
814 | langwell->hsm.b_bus_req = 0; | ||
815 | |||
816 | if (langwell->client_ops) | ||
817 | langwell->client_ops->resume(langwell->pdev); | ||
818 | else | ||
819 | otg_dbg("client driver not loaded.\n"); | ||
820 | |||
821 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
822 | } | ||
823 | break; | ||
824 | |||
825 | case OTG_STATE_B_HOST: | ||
826 | if (!langwell->hsm.id) { | ||
827 | langwell->otg.default_a = 1; | ||
828 | langwell->hsm.a_srp_det = 0; | ||
829 | |||
830 | langwell_otg_drv_vbus(0); | ||
831 | langwell_otg_chrg_vbus(0); | ||
832 | set_host_mode(); | ||
833 | if (langwell->host_ops) | ||
834 | langwell->host_ops->remove(langwell->pdev); | ||
835 | else | ||
836 | otg_dbg("host driver has been removed.\n"); | ||
837 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
838 | queue_work(langwell->qwork, &langwell->work); | ||
839 | } else if (!langwell->hsm.b_sess_vld) { | ||
840 | langwell->hsm.b_hnp_enable = 0; | ||
841 | langwell->hsm.b_bus_req = 0; | ||
842 | langwell_otg_chrg_vbus(0); | ||
843 | if (langwell->host_ops) | ||
844 | langwell->host_ops->remove(langwell->pdev); | ||
845 | else | ||
846 | otg_dbg("host driver has been removed.\n"); | ||
847 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
848 | } else if ((!langwell->hsm.b_bus_req) || | ||
849 | (!langwell->hsm.a_conn)) { | ||
850 | langwell->hsm.b_bus_req = 0; | ||
851 | langwell_otg_loc_sof(0); | ||
852 | if (langwell->host_ops) | ||
853 | langwell->host_ops->remove(langwell->pdev); | ||
854 | else | ||
855 | otg_dbg("host driver has been removed.\n"); | ||
856 | |||
857 | langwell->hsm.a_bus_suspend = 0; | ||
858 | |||
859 | if (langwell->client_ops) | ||
860 | langwell->client_ops->resume(langwell->pdev); | ||
861 | else | ||
862 | otg_dbg("client driver not loaded.\n"); | ||
863 | |||
864 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
865 | } | ||
866 | break; | ||
867 | |||
868 | case OTG_STATE_A_IDLE: | ||
869 | langwell->otg.default_a = 1; | ||
870 | if (langwell->hsm.id) { | ||
871 | langwell->otg.default_a = 0; | ||
872 | langwell->hsm.b_bus_req = 0; | ||
873 | langwell_otg_drv_vbus(0); | ||
874 | langwell_otg_chrg_vbus(0); | ||
875 | |||
876 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
877 | queue_work(langwell->qwork, &langwell->work); | ||
878 | } else if (langwell->hsm.a_sess_vld) { | ||
879 | langwell_otg_drv_vbus(1); | ||
880 | langwell->hsm.a_srp_det = 1; | ||
881 | langwell->hsm.a_wait_vrise_tmout = 0; | ||
882 | langwell_otg_add_timer(a_wait_vrise_tmr); | ||
883 | langwell->otg.state = OTG_STATE_A_WAIT_VRISE; | ||
884 | queue_work(langwell->qwork, &langwell->work); | ||
885 | } else if (!langwell->hsm.a_bus_drop && | ||
886 | (langwell->hsm.a_srp_det || langwell->hsm.a_bus_req)) { | ||
887 | langwell_otg_drv_vbus(1); | ||
888 | langwell->hsm.a_wait_vrise_tmout = 0; | ||
889 | langwell_otg_add_timer(a_wait_vrise_tmr); | ||
890 | langwell->otg.state = OTG_STATE_A_WAIT_VRISE; | ||
891 | queue_work(langwell->qwork, &langwell->work); | ||
892 | } | ||
893 | break; | ||
894 | case OTG_STATE_A_WAIT_VRISE: | ||
895 | if (langwell->hsm.id) { | ||
896 | langwell_otg_del_timer(a_wait_vrise_tmr); | ||
897 | langwell->hsm.b_bus_req = 0; | ||
898 | langwell->otg.default_a = 0; | ||
899 | langwell_otg_drv_vbus(0); | ||
900 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
901 | } else if (langwell->hsm.a_vbus_vld) { | ||
902 | langwell_otg_del_timer(a_wait_vrise_tmr); | ||
903 | if (langwell->host_ops) | ||
904 | langwell->host_ops->probe(langwell->pdev, | ||
905 | langwell->host_ops->id_table); | ||
906 | else | ||
907 | otg_dbg("host driver not loaded.\n"); | ||
908 | langwell->hsm.b_conn = 0; | ||
909 | langwell->hsm.a_set_b_hnp_en = 0; | ||
910 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
911 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
912 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
913 | } else if (langwell->hsm.a_wait_vrise_tmout) { | ||
914 | if (langwell->hsm.a_vbus_vld) { | ||
915 | if (langwell->host_ops) | ||
916 | langwell->host_ops->probe( | ||
917 | langwell->pdev, | ||
918 | langwell->host_ops->id_table); | ||
919 | else | ||
920 | otg_dbg("host driver not loaded.\n"); | ||
921 | langwell->hsm.b_conn = 0; | ||
922 | langwell->hsm.a_set_b_hnp_en = 0; | ||
923 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
924 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
925 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
926 | } else { | ||
927 | langwell_otg_drv_vbus(0); | ||
928 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
929 | } | ||
930 | } | ||
931 | break; | ||
932 | case OTG_STATE_A_WAIT_BCON: | ||
933 | if (langwell->hsm.id) { | ||
934 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
935 | |||
936 | langwell->otg.default_a = 0; | ||
937 | langwell->hsm.b_bus_req = 0; | ||
938 | if (langwell->host_ops) | ||
939 | langwell->host_ops->remove(langwell->pdev); | ||
940 | else | ||
941 | otg_dbg("host driver has been removed.\n"); | ||
942 | langwell_otg_drv_vbus(0); | ||
943 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
944 | queue_work(langwell->qwork, &langwell->work); | ||
945 | } else if (!langwell->hsm.a_vbus_vld) { | ||
946 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
947 | |||
948 | if (langwell->host_ops) | ||
949 | langwell->host_ops->remove(langwell->pdev); | ||
950 | else | ||
951 | otg_dbg("host driver has been removed.\n"); | ||
952 | langwell_otg_drv_vbus(0); | ||
953 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
954 | } else if (langwell->hsm.a_bus_drop || | ||
955 | (langwell->hsm.a_wait_bcon_tmout && | ||
956 | !langwell->hsm.a_bus_req)) { | ||
957 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
958 | |||
959 | if (langwell->host_ops) | ||
960 | langwell->host_ops->remove(langwell->pdev); | ||
961 | else | ||
962 | otg_dbg("host driver has been removed.\n"); | ||
963 | langwell_otg_drv_vbus(0); | ||
964 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
965 | } else if (langwell->hsm.b_conn) { | ||
966 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
967 | |||
968 | langwell->hsm.a_suspend_req = 0; | ||
969 | langwell->otg.state = OTG_STATE_A_HOST; | ||
970 | if (!langwell->hsm.a_bus_req && | ||
971 | langwell->hsm.a_set_b_hnp_en) { | ||
972 | /* It is not safe enough to do a fast | ||
973 | * transistion from A_WAIT_BCON to | ||
974 | * A_SUSPEND */ | ||
975 | msleep(10000); | ||
976 | if (langwell->hsm.a_bus_req) | ||
977 | break; | ||
978 | |||
979 | if (request_irq(langwell->pdev->irq, | ||
980 | otg_dummy_irq, IRQF_SHARED, | ||
981 | driver_name, langwell->regs) != 0) { | ||
982 | otg_dbg("request interrupt %d fail\n", | ||
983 | langwell->pdev->irq); | ||
984 | } | ||
985 | |||
986 | langwell_otg_HABA(1); | ||
987 | langwell->hsm.b_bus_resume = 0; | ||
988 | langwell->hsm.a_aidl_bdis_tmout = 0; | ||
989 | langwell_otg_add_timer(a_aidl_bdis_tmr); | ||
990 | |||
991 | langwell_otg_loc_sof(0); | ||
992 | langwell->otg.state = OTG_STATE_A_SUSPEND; | ||
993 | } else if (!langwell->hsm.a_bus_req && | ||
994 | !langwell->hsm.a_set_b_hnp_en) { | ||
995 | struct pci_dev *pdev = langwell->pdev; | ||
996 | if (langwell->host_ops) | ||
997 | langwell->host_ops->remove(pdev); | ||
998 | else | ||
999 | otg_dbg("host driver removed.\n"); | ||
1000 | langwell_otg_drv_vbus(0); | ||
1001 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1002 | } | ||
1003 | } | ||
1004 | break; | ||
1005 | case OTG_STATE_A_HOST: | ||
1006 | if (langwell->hsm.id) { | ||
1007 | langwell->otg.default_a = 0; | ||
1008 | langwell->hsm.b_bus_req = 0; | ||
1009 | if (langwell->host_ops) | ||
1010 | langwell->host_ops->remove(langwell->pdev); | ||
1011 | else | ||
1012 | otg_dbg("host driver has been removed.\n"); | ||
1013 | langwell_otg_drv_vbus(0); | ||
1014 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1015 | queue_work(langwell->qwork, &langwell->work); | ||
1016 | } else if (langwell->hsm.a_bus_drop || | ||
1017 | (!langwell->hsm.a_set_b_hnp_en && !langwell->hsm.a_bus_req)) { | ||
1018 | if (langwell->host_ops) | ||
1019 | langwell->host_ops->remove(langwell->pdev); | ||
1020 | else | ||
1021 | otg_dbg("host driver has been removed.\n"); | ||
1022 | langwell_otg_drv_vbus(0); | ||
1023 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1024 | } else if (!langwell->hsm.a_vbus_vld) { | ||
1025 | if (langwell->host_ops) | ||
1026 | langwell->host_ops->remove(langwell->pdev); | ||
1027 | else | ||
1028 | otg_dbg("host driver has been removed.\n"); | ||
1029 | langwell_otg_drv_vbus(0); | ||
1030 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
1031 | } else if (langwell->hsm.a_set_b_hnp_en | ||
1032 | && !langwell->hsm.a_bus_req) { | ||
1033 | /* Set HABA to enable hardware assistance to signal | ||
1034 | * A-connect after receiver B-disconnect. Hardware | ||
1035 | * will then set client mode and enable URE, SLE and | ||
1036 | * PCE after the assistance. otg_dummy_irq is used to | ||
1037 | * clean these ints when client driver is not resumed. | ||
1038 | */ | ||
1039 | if (request_irq(langwell->pdev->irq, | ||
1040 | otg_dummy_irq, IRQF_SHARED, driver_name, | ||
1041 | langwell->regs) != 0) { | ||
1042 | otg_dbg("request interrupt %d failed\n", | ||
1043 | langwell->pdev->irq); | ||
1044 | } | ||
1045 | |||
1046 | /* set HABA */ | ||
1047 | langwell_otg_HABA(1); | ||
1048 | langwell->hsm.b_bus_resume = 0; | ||
1049 | langwell->hsm.a_aidl_bdis_tmout = 0; | ||
1050 | langwell_otg_add_timer(a_aidl_bdis_tmr); | ||
1051 | langwell_otg_loc_sof(0); | ||
1052 | langwell->otg.state = OTG_STATE_A_SUSPEND; | ||
1053 | } else if (!langwell->hsm.b_conn || !langwell->hsm.a_bus_req) { | ||
1054 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
1055 | langwell->hsm.a_set_b_hnp_en = 0; | ||
1056 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1057 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
1058 | } | ||
1059 | break; | ||
1060 | case OTG_STATE_A_SUSPEND: | ||
1061 | if (langwell->hsm.id) { | ||
1062 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1063 | langwell_otg_HABA(0); | ||
1064 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1065 | langwell->otg.default_a = 0; | ||
1066 | langwell->hsm.b_bus_req = 0; | ||
1067 | if (langwell->host_ops) | ||
1068 | langwell->host_ops->remove(langwell->pdev); | ||
1069 | else | ||
1070 | otg_dbg("host driver has been removed.\n"); | ||
1071 | langwell_otg_drv_vbus(0); | ||
1072 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1073 | queue_work(langwell->qwork, &langwell->work); | ||
1074 | } else if (langwell->hsm.a_bus_req || | ||
1075 | langwell->hsm.b_bus_resume) { | ||
1076 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1077 | langwell_otg_HABA(0); | ||
1078 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1079 | langwell->hsm.a_suspend_req = 0; | ||
1080 | langwell_otg_loc_sof(1); | ||
1081 | langwell->otg.state = OTG_STATE_A_HOST; | ||
1082 | } else if (langwell->hsm.a_aidl_bdis_tmout || | ||
1083 | langwell->hsm.a_bus_drop) { | ||
1084 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1085 | langwell_otg_HABA(0); | ||
1086 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1087 | if (langwell->host_ops) | ||
1088 | langwell->host_ops->remove(langwell->pdev); | ||
1089 | else | ||
1090 | otg_dbg("host driver has been removed.\n"); | ||
1091 | langwell_otg_drv_vbus(0); | ||
1092 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1093 | } else if (!langwell->hsm.b_conn && | ||
1094 | langwell->hsm.a_set_b_hnp_en) { | ||
1095 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1096 | langwell_otg_HABA(0); | ||
1097 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1098 | |||
1099 | if (langwell->host_ops) | ||
1100 | langwell->host_ops->remove(langwell->pdev); | ||
1101 | else | ||
1102 | otg_dbg("host driver has been removed.\n"); | ||
1103 | |||
1104 | langwell->hsm.b_bus_suspend = 0; | ||
1105 | langwell->hsm.b_bus_suspend_vld = 0; | ||
1106 | langwell->hsm.b_bus_suspend_tmout = 0; | ||
1107 | |||
1108 | /* msleep(200); */ | ||
1109 | if (langwell->client_ops) | ||
1110 | langwell->client_ops->resume(langwell->pdev); | ||
1111 | else | ||
1112 | otg_dbg("client driver not loaded.\n"); | ||
1113 | |||
1114 | langwell_otg_add_timer(b_bus_suspend_tmr); | ||
1115 | langwell->otg.state = OTG_STATE_A_PERIPHERAL; | ||
1116 | break; | ||
1117 | } else if (!langwell->hsm.a_vbus_vld) { | ||
1118 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1119 | langwell_otg_HABA(0); | ||
1120 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1121 | if (langwell->host_ops) | ||
1122 | langwell->host_ops->remove(langwell->pdev); | ||
1123 | else | ||
1124 | otg_dbg("host driver has been removed.\n"); | ||
1125 | langwell_otg_drv_vbus(0); | ||
1126 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
1127 | } | ||
1128 | break; | ||
1129 | case OTG_STATE_A_PERIPHERAL: | ||
1130 | if (langwell->hsm.id) { | ||
1131 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1132 | langwell->otg.default_a = 0; | ||
1133 | langwell->hsm.b_bus_req = 0; | ||
1134 | if (langwell->client_ops) | ||
1135 | langwell->client_ops->suspend(langwell->pdev, | ||
1136 | PMSG_FREEZE); | ||
1137 | else | ||
1138 | otg_dbg("client driver has been removed.\n"); | ||
1139 | langwell_otg_drv_vbus(0); | ||
1140 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1141 | queue_work(langwell->qwork, &langwell->work); | ||
1142 | } else if (!langwell->hsm.a_vbus_vld) { | ||
1143 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1144 | if (langwell->client_ops) | ||
1145 | langwell->client_ops->suspend(langwell->pdev, | ||
1146 | PMSG_FREEZE); | ||
1147 | else | ||
1148 | otg_dbg("client driver has been removed.\n"); | ||
1149 | langwell_otg_drv_vbus(0); | ||
1150 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
1151 | } else if (langwell->hsm.a_bus_drop) { | ||
1152 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1153 | if (langwell->client_ops) | ||
1154 | langwell->client_ops->suspend(langwell->pdev, | ||
1155 | PMSG_FREEZE); | ||
1156 | else | ||
1157 | otg_dbg("client driver has been removed.\n"); | ||
1158 | langwell_otg_drv_vbus(0); | ||
1159 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1160 | } else if (langwell->hsm.b_bus_suspend) { | ||
1161 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1162 | if (langwell->client_ops) | ||
1163 | langwell->client_ops->suspend(langwell->pdev, | ||
1164 | PMSG_FREEZE); | ||
1165 | else | ||
1166 | otg_dbg("client driver has been removed.\n"); | ||
1167 | |||
1168 | if (langwell->host_ops) | ||
1169 | langwell->host_ops->probe(langwell->pdev, | ||
1170 | langwell->host_ops->id_table); | ||
1171 | else | ||
1172 | otg_dbg("host driver not loaded.\n"); | ||
1173 | langwell->hsm.a_set_b_hnp_en = 0; | ||
1174 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
1175 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1176 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
1177 | } else if (langwell->hsm.b_bus_suspend_tmout) { | ||
1178 | u32 val; | ||
1179 | val = readl(langwell->regs + CI_PORTSC1); | ||
1180 | if (!(val & PORTSC_SUSP)) | ||
1181 | break; | ||
1182 | if (langwell->client_ops) | ||
1183 | langwell->client_ops->suspend(langwell->pdev, | ||
1184 | PMSG_FREEZE); | ||
1185 | else | ||
1186 | otg_dbg("client driver has been removed.\n"); | ||
1187 | if (langwell->host_ops) | ||
1188 | langwell->host_ops->probe(langwell->pdev, | ||
1189 | langwell->host_ops->id_table); | ||
1190 | else | ||
1191 | otg_dbg("host driver not loaded.\n"); | ||
1192 | langwell->hsm.a_set_b_hnp_en = 0; | ||
1193 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
1194 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1195 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
1196 | } | ||
1197 | break; | ||
1198 | case OTG_STATE_A_VBUS_ERR: | ||
1199 | if (langwell->hsm.id) { | ||
1200 | langwell->otg.default_a = 0; | ||
1201 | langwell->hsm.a_clr_err = 0; | ||
1202 | langwell->hsm.a_srp_det = 0; | ||
1203 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1204 | queue_work(langwell->qwork, &langwell->work); | ||
1205 | } else if (langwell->hsm.a_clr_err) { | ||
1206 | langwell->hsm.a_clr_err = 0; | ||
1207 | langwell->hsm.a_srp_det = 0; | ||
1208 | reset_otg(); | ||
1209 | init_hsm(); | ||
1210 | if (langwell->otg.state == OTG_STATE_A_IDLE) | ||
1211 | queue_work(langwell->qwork, &langwell->work); | ||
1212 | } | ||
1213 | break; | ||
1214 | case OTG_STATE_A_WAIT_VFALL: | ||
1215 | if (langwell->hsm.id) { | ||
1216 | langwell->otg.default_a = 0; | ||
1217 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1218 | queue_work(langwell->qwork, &langwell->work); | ||
1219 | } else if (langwell->hsm.a_bus_req) { | ||
1220 | langwell_otg_drv_vbus(1); | ||
1221 | langwell->hsm.a_wait_vrise_tmout = 0; | ||
1222 | langwell_otg_add_timer(a_wait_vrise_tmr); | ||
1223 | langwell->otg.state = OTG_STATE_A_WAIT_VRISE; | ||
1224 | } else if (!langwell->hsm.a_sess_vld) { | ||
1225 | langwell->hsm.a_srp_det = 0; | ||
1226 | langwell_otg_drv_vbus(0); | ||
1227 | set_host_mode(); | ||
1228 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
1229 | } | ||
1230 | break; | ||
1231 | default: | ||
1232 | ; | ||
1233 | } | ||
1234 | |||
1235 | otg_dbg("%s: new state = %s\n", __func__, | ||
1236 | state_string(langwell->otg.state)); | ||
1237 | } | ||
1238 | |||
1239 | static ssize_t | ||
1240 | show_registers(struct device *_dev, struct device_attribute *attr, char *buf) | ||
1241 | { | ||
1242 | struct langwell_otg *langwell; | ||
1243 | char *next; | ||
1244 | unsigned size; | ||
1245 | unsigned t; | ||
1246 | |||
1247 | langwell = the_transceiver; | ||
1248 | next = buf; | ||
1249 | size = PAGE_SIZE; | ||
1250 | |||
1251 | t = scnprintf(next, size, | ||
1252 | "\n" | ||
1253 | "USBCMD = 0x%08x \n" | ||
1254 | "USBSTS = 0x%08x \n" | ||
1255 | "USBINTR = 0x%08x \n" | ||
1256 | "ASYNCLISTADDR = 0x%08x \n" | ||
1257 | "PORTSC1 = 0x%08x \n" | ||
1258 | "HOSTPC1 = 0x%08x \n" | ||
1259 | "OTGSC = 0x%08x \n" | ||
1260 | "USBMODE = 0x%08x \n", | ||
1261 | readl(langwell->regs + 0x30), | ||
1262 | readl(langwell->regs + 0x34), | ||
1263 | readl(langwell->regs + 0x38), | ||
1264 | readl(langwell->regs + 0x48), | ||
1265 | readl(langwell->regs + 0x74), | ||
1266 | readl(langwell->regs + 0xb4), | ||
1267 | readl(langwell->regs + 0xf4), | ||
1268 | readl(langwell->regs + 0xf8) | ||
1269 | ); | ||
1270 | size -= t; | ||
1271 | next += t; | ||
1272 | |||
1273 | return PAGE_SIZE - size; | ||
1274 | } | ||
1275 | static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); | ||
1276 | |||
1277 | static ssize_t | ||
1278 | show_hsm(struct device *_dev, struct device_attribute *attr, char *buf) | ||
1279 | { | ||
1280 | struct langwell_otg *langwell; | ||
1281 | char *next; | ||
1282 | unsigned size; | ||
1283 | unsigned t; | ||
1284 | |||
1285 | langwell = the_transceiver; | ||
1286 | next = buf; | ||
1287 | size = PAGE_SIZE; | ||
1288 | |||
1289 | t = scnprintf(next, size, | ||
1290 | "\n" | ||
1291 | "current state = %s\n" | ||
1292 | "a_bus_resume = \t%d\n" | ||
1293 | "a_bus_suspend = \t%d\n" | ||
1294 | "a_conn = \t%d\n" | ||
1295 | "a_sess_vld = \t%d\n" | ||
1296 | "a_srp_det = \t%d\n" | ||
1297 | "a_vbus_vld = \t%d\n" | ||
1298 | "b_bus_resume = \t%d\n" | ||
1299 | "b_bus_suspend = \t%d\n" | ||
1300 | "b_conn = \t%d\n" | ||
1301 | "b_se0_srp = \t%d\n" | ||
1302 | "b_sess_end = \t%d\n" | ||
1303 | "b_sess_vld = \t%d\n" | ||
1304 | "id = \t%d\n" | ||
1305 | "a_set_b_hnp_en = \t%d\n" | ||
1306 | "b_srp_done = \t%d\n" | ||
1307 | "b_hnp_enable = \t%d\n" | ||
1308 | "a_wait_vrise_tmout = \t%d\n" | ||
1309 | "a_wait_bcon_tmout = \t%d\n" | ||
1310 | "a_aidl_bdis_tmout = \t%d\n" | ||
1311 | "b_ase0_brst_tmout = \t%d\n" | ||
1312 | "a_bus_drop = \t%d\n" | ||
1313 | "a_bus_req = \t%d\n" | ||
1314 | "a_clr_err = \t%d\n" | ||
1315 | "a_suspend_req = \t%d\n" | ||
1316 | "b_bus_req = \t%d\n" | ||
1317 | "b_bus_suspend_tmout = \t%d\n" | ||
1318 | "b_bus_suspend_vld = \t%d\n", | ||
1319 | state_string(langwell->otg.state), | ||
1320 | langwell->hsm.a_bus_resume, | ||
1321 | langwell->hsm.a_bus_suspend, | ||
1322 | langwell->hsm.a_conn, | ||
1323 | langwell->hsm.a_sess_vld, | ||
1324 | langwell->hsm.a_srp_det, | ||
1325 | langwell->hsm.a_vbus_vld, | ||
1326 | langwell->hsm.b_bus_resume, | ||
1327 | langwell->hsm.b_bus_suspend, | ||
1328 | langwell->hsm.b_conn, | ||
1329 | langwell->hsm.b_se0_srp, | ||
1330 | langwell->hsm.b_sess_end, | ||
1331 | langwell->hsm.b_sess_vld, | ||
1332 | langwell->hsm.id, | ||
1333 | langwell->hsm.a_set_b_hnp_en, | ||
1334 | langwell->hsm.b_srp_done, | ||
1335 | langwell->hsm.b_hnp_enable, | ||
1336 | langwell->hsm.a_wait_vrise_tmout, | ||
1337 | langwell->hsm.a_wait_bcon_tmout, | ||
1338 | langwell->hsm.a_aidl_bdis_tmout, | ||
1339 | langwell->hsm.b_ase0_brst_tmout, | ||
1340 | langwell->hsm.a_bus_drop, | ||
1341 | langwell->hsm.a_bus_req, | ||
1342 | langwell->hsm.a_clr_err, | ||
1343 | langwell->hsm.a_suspend_req, | ||
1344 | langwell->hsm.b_bus_req, | ||
1345 | langwell->hsm.b_bus_suspend_tmout, | ||
1346 | langwell->hsm.b_bus_suspend_vld | ||
1347 | ); | ||
1348 | size -= t; | ||
1349 | next += t; | ||
1350 | |||
1351 | return PAGE_SIZE - size; | ||
1352 | } | ||
1353 | static DEVICE_ATTR(hsm, S_IRUGO, show_hsm, NULL); | ||
1354 | |||
1355 | static ssize_t | ||
1356 | get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) | ||
1357 | { | ||
1358 | struct langwell_otg *langwell; | ||
1359 | char *next; | ||
1360 | unsigned size; | ||
1361 | unsigned t; | ||
1362 | |||
1363 | langwell = the_transceiver; | ||
1364 | next = buf; | ||
1365 | size = PAGE_SIZE; | ||
1366 | |||
1367 | t = scnprintf(next, size, "%d", langwell->hsm.a_bus_req); | ||
1368 | size -= t; | ||
1369 | next += t; | ||
1370 | |||
1371 | return PAGE_SIZE - size; | ||
1372 | } | ||
1373 | |||
1374 | static ssize_t | ||
1375 | set_a_bus_req(struct device *dev, struct device_attribute *attr, | ||
1376 | const char *buf, size_t count) | ||
1377 | { | ||
1378 | struct langwell_otg *langwell; | ||
1379 | langwell = the_transceiver; | ||
1380 | if (!langwell->otg.default_a) | ||
1381 | return -1; | ||
1382 | if (count > 2) | ||
1383 | return -1; | ||
1384 | |||
1385 | if (buf[0] == '0') { | ||
1386 | langwell->hsm.a_bus_req = 0; | ||
1387 | otg_dbg("a_bus_req = 0\n"); | ||
1388 | } else if (buf[0] == '1') { | ||
1389 | /* If a_bus_drop is TRUE, a_bus_req can't be set */ | ||
1390 | if (langwell->hsm.a_bus_drop) | ||
1391 | return -1; | ||
1392 | langwell->hsm.a_bus_req = 1; | ||
1393 | otg_dbg("a_bus_req = 1\n"); | ||
1394 | } | ||
1395 | if (spin_trylock(&langwell->wq_lock)) { | ||
1396 | queue_work(langwell->qwork, &langwell->work); | ||
1397 | spin_unlock(&langwell->wq_lock); | ||
1398 | } | ||
1399 | return count; | ||
1400 | } | ||
1401 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUGO, get_a_bus_req, set_a_bus_req); | ||
1402 | |||
1403 | static ssize_t | ||
1404 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) | ||
1405 | { | ||
1406 | struct langwell_otg *langwell; | ||
1407 | char *next; | ||
1408 | unsigned size; | ||
1409 | unsigned t; | ||
1410 | |||
1411 | langwell = the_transceiver; | ||
1412 | next = buf; | ||
1413 | size = PAGE_SIZE; | ||
1414 | |||
1415 | t = scnprintf(next, size, "%d", langwell->hsm.a_bus_drop); | ||
1416 | size -= t; | ||
1417 | next += t; | ||
1418 | |||
1419 | return PAGE_SIZE - size; | ||
1420 | } | ||
1421 | |||
1422 | static ssize_t | ||
1423 | set_a_bus_drop(struct device *dev, struct device_attribute *attr, | ||
1424 | const char *buf, size_t count) | ||
1425 | { | ||
1426 | struct langwell_otg *langwell; | ||
1427 | langwell = the_transceiver; | ||
1428 | if (!langwell->otg.default_a) | ||
1429 | return -1; | ||
1430 | if (count > 2) | ||
1431 | return -1; | ||
1432 | |||
1433 | if (buf[0] == '0') { | ||
1434 | langwell->hsm.a_bus_drop = 0; | ||
1435 | otg_dbg("a_bus_drop = 0\n"); | ||
1436 | } else if (buf[0] == '1') { | ||
1437 | langwell->hsm.a_bus_drop = 1; | ||
1438 | langwell->hsm.a_bus_req = 0; | ||
1439 | otg_dbg("a_bus_drop = 1, then a_bus_req = 0\n"); | ||
1440 | } | ||
1441 | if (spin_trylock(&langwell->wq_lock)) { | ||
1442 | queue_work(langwell->qwork, &langwell->work); | ||
1443 | spin_unlock(&langwell->wq_lock); | ||
1444 | } | ||
1445 | return count; | ||
1446 | } | ||
1447 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUGO, | ||
1448 | get_a_bus_drop, set_a_bus_drop); | ||
1449 | |||
1450 | static ssize_t | ||
1451 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) | ||
1452 | { | ||
1453 | struct langwell_otg *langwell; | ||
1454 | char *next; | ||
1455 | unsigned size; | ||
1456 | unsigned t; | ||
1457 | |||
1458 | langwell = the_transceiver; | ||
1459 | next = buf; | ||
1460 | size = PAGE_SIZE; | ||
1461 | |||
1462 | t = scnprintf(next, size, "%d", langwell->hsm.b_bus_req); | ||
1463 | size -= t; | ||
1464 | next += t; | ||
1465 | |||
1466 | return PAGE_SIZE - size; | ||
1467 | } | ||
1468 | |||
1469 | static ssize_t | ||
1470 | set_b_bus_req(struct device *dev, struct device_attribute *attr, | ||
1471 | const char *buf, size_t count) | ||
1472 | { | ||
1473 | struct langwell_otg *langwell; | ||
1474 | langwell = the_transceiver; | ||
1475 | |||
1476 | if (langwell->otg.default_a) | ||
1477 | return -1; | ||
1478 | |||
1479 | if (count > 2) | ||
1480 | return -1; | ||
1481 | |||
1482 | if (buf[0] == '0') { | ||
1483 | langwell->hsm.b_bus_req = 0; | ||
1484 | otg_dbg("b_bus_req = 0\n"); | ||
1485 | } else if (buf[0] == '1') { | ||
1486 | langwell->hsm.b_bus_req = 1; | ||
1487 | otg_dbg("b_bus_req = 1\n"); | ||
1488 | } | ||
1489 | if (spin_trylock(&langwell->wq_lock)) { | ||
1490 | queue_work(langwell->qwork, &langwell->work); | ||
1491 | spin_unlock(&langwell->wq_lock); | ||
1492 | } | ||
1493 | return count; | ||
1494 | } | ||
1495 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUGO, get_b_bus_req, set_b_bus_req); | ||
1496 | |||
1497 | static ssize_t | ||
1498 | set_a_clr_err(struct device *dev, struct device_attribute *attr, | ||
1499 | const char *buf, size_t count) | ||
1500 | { | ||
1501 | struct langwell_otg *langwell; | ||
1502 | langwell = the_transceiver; | ||
1503 | |||
1504 | if (!langwell->otg.default_a) | ||
1505 | return -1; | ||
1506 | if (count > 2) | ||
1507 | return -1; | ||
1508 | |||
1509 | if (buf[0] == '1') { | ||
1510 | langwell->hsm.a_clr_err = 1; | ||
1511 | otg_dbg("a_clr_err = 1\n"); | ||
1512 | } | ||
1513 | if (spin_trylock(&langwell->wq_lock)) { | ||
1514 | queue_work(langwell->qwork, &langwell->work); | ||
1515 | spin_unlock(&langwell->wq_lock); | ||
1516 | } | ||
1517 | return count; | ||
1518 | } | ||
1519 | static DEVICE_ATTR(a_clr_err, S_IWUGO, NULL, set_a_clr_err); | ||
1520 | |||
1521 | static struct attribute *inputs_attrs[] = { | ||
1522 | &dev_attr_a_bus_req.attr, | ||
1523 | &dev_attr_a_bus_drop.attr, | ||
1524 | &dev_attr_b_bus_req.attr, | ||
1525 | &dev_attr_a_clr_err.attr, | ||
1526 | NULL, | ||
1527 | }; | ||
1528 | |||
1529 | static struct attribute_group debug_dev_attr_group = { | ||
1530 | .name = "inputs", | ||
1531 | .attrs = inputs_attrs, | ||
1532 | }; | ||
1533 | |||
1534 | int langwell_register_host(struct pci_driver *host_driver) | ||
1535 | { | ||
1536 | int ret = 0; | ||
1537 | |||
1538 | the_transceiver->host_ops = host_driver; | ||
1539 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1540 | otg_dbg("host controller driver is registered\n"); | ||
1541 | |||
1542 | return ret; | ||
1543 | } | ||
1544 | EXPORT_SYMBOL(langwell_register_host); | ||
1545 | |||
1546 | void langwell_unregister_host(struct pci_driver *host_driver) | ||
1547 | { | ||
1548 | if (the_transceiver->host_ops) | ||
1549 | the_transceiver->host_ops->remove(the_transceiver->pdev); | ||
1550 | the_transceiver->host_ops = NULL; | ||
1551 | the_transceiver->hsm.a_bus_drop = 1; | ||
1552 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1553 | otg_dbg("host controller driver is unregistered\n"); | ||
1554 | } | ||
1555 | EXPORT_SYMBOL(langwell_unregister_host); | ||
1556 | |||
1557 | int langwell_register_peripheral(struct pci_driver *client_driver) | ||
1558 | { | ||
1559 | int ret = 0; | ||
1560 | |||
1561 | if (client_driver) | ||
1562 | ret = client_driver->probe(the_transceiver->pdev, | ||
1563 | client_driver->id_table); | ||
1564 | if (!ret) { | ||
1565 | the_transceiver->client_ops = client_driver; | ||
1566 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1567 | otg_dbg("client controller driver is registered\n"); | ||
1568 | } | ||
1569 | |||
1570 | return ret; | ||
1571 | } | ||
1572 | EXPORT_SYMBOL(langwell_register_peripheral); | ||
1573 | |||
1574 | void langwell_unregister_peripheral(struct pci_driver *client_driver) | ||
1575 | { | ||
1576 | if (the_transceiver->client_ops) | ||
1577 | the_transceiver->client_ops->remove(the_transceiver->pdev); | ||
1578 | the_transceiver->client_ops = NULL; | ||
1579 | the_transceiver->hsm.b_bus_req = 0; | ||
1580 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1581 | otg_dbg("client controller driver is unregistered\n"); | ||
1582 | } | ||
1583 | EXPORT_SYMBOL(langwell_unregister_peripheral); | ||
1584 | |||
1585 | static int langwell_otg_probe(struct pci_dev *pdev, | ||
1586 | const struct pci_device_id *id) | ||
1587 | { | ||
1588 | unsigned long resource, len; | ||
1589 | void __iomem *base = NULL; | ||
1590 | int retval; | ||
1591 | u32 val32; | ||
1592 | struct langwell_otg *langwell; | ||
1593 | char qname[] = "langwell_otg_queue"; | ||
1594 | |||
1595 | retval = 0; | ||
1596 | otg_dbg("\notg controller is detected.\n"); | ||
1597 | if (pci_enable_device(pdev) < 0) { | ||
1598 | retval = -ENODEV; | ||
1599 | goto done; | ||
1600 | } | ||
1601 | |||
1602 | langwell = kzalloc(sizeof *langwell, GFP_KERNEL); | ||
1603 | if (langwell == NULL) { | ||
1604 | retval = -ENOMEM; | ||
1605 | goto done; | ||
1606 | } | ||
1607 | the_transceiver = langwell; | ||
1608 | |||
1609 | /* control register: BAR 0 */ | ||
1610 | resource = pci_resource_start(pdev, 0); | ||
1611 | len = pci_resource_len(pdev, 0); | ||
1612 | if (!request_mem_region(resource, len, driver_name)) { | ||
1613 | retval = -EBUSY; | ||
1614 | goto err; | ||
1615 | } | ||
1616 | langwell->region = 1; | ||
1617 | |||
1618 | base = ioremap_nocache(resource, len); | ||
1619 | if (base == NULL) { | ||
1620 | retval = -EFAULT; | ||
1621 | goto err; | ||
1622 | } | ||
1623 | langwell->regs = base; | ||
1624 | |||
1625 | if (!pdev->irq) { | ||
1626 | otg_dbg("No IRQ.\n"); | ||
1627 | retval = -ENODEV; | ||
1628 | goto err; | ||
1629 | } | ||
1630 | |||
1631 | langwell->qwork = create_workqueue(qname); | ||
1632 | if (!langwell->qwork) { | ||
1633 | otg_dbg("cannot create workqueue %s\n", qname); | ||
1634 | retval = -ENOMEM; | ||
1635 | goto err; | ||
1636 | } | ||
1637 | INIT_WORK(&langwell->work, langwell_otg_work); | ||
1638 | |||
1639 | /* OTG common part */ | ||
1640 | langwell->pdev = pdev; | ||
1641 | langwell->otg.dev = &pdev->dev; | ||
1642 | langwell->otg.label = driver_name; | ||
1643 | langwell->otg.set_host = langwell_otg_set_host; | ||
1644 | langwell->otg.set_peripheral = langwell_otg_set_peripheral; | ||
1645 | langwell->otg.set_power = langwell_otg_set_power; | ||
1646 | langwell->otg.start_srp = langwell_otg_start_srp; | ||
1647 | langwell->otg.state = OTG_STATE_UNDEFINED; | ||
1648 | if (otg_set_transceiver(&langwell->otg)) { | ||
1649 | otg_dbg("can't set transceiver\n"); | ||
1650 | retval = -EBUSY; | ||
1651 | goto err; | ||
1652 | } | ||
1653 | |||
1654 | reset_otg(); | ||
1655 | init_hsm(); | ||
1656 | |||
1657 | spin_lock_init(&langwell->lock); | ||
1658 | spin_lock_init(&langwell->wq_lock); | ||
1659 | INIT_LIST_HEAD(&active_timers); | ||
1660 | langwell_otg_init_timers(&langwell->hsm); | ||
1661 | |||
1662 | if (request_irq(pdev->irq, otg_irq, IRQF_SHARED, | ||
1663 | driver_name, langwell) != 0) { | ||
1664 | otg_dbg("request interrupt %d failed\n", pdev->irq); | ||
1665 | retval = -EBUSY; | ||
1666 | goto err; | ||
1667 | } | ||
1668 | |||
1669 | /* enable OTGSC int */ | ||
1670 | val32 = OTGSC_DPIE | OTGSC_BSEIE | OTGSC_BSVIE | | ||
1671 | OTGSC_ASVIE | OTGSC_AVVIE | OTGSC_IDIE | OTGSC_IDPU; | ||
1672 | writel(val32, langwell->regs + CI_OTGSC); | ||
1673 | |||
1674 | retval = device_create_file(&pdev->dev, &dev_attr_registers); | ||
1675 | if (retval < 0) { | ||
1676 | otg_dbg("Can't register sysfs attribute: %d\n", retval); | ||
1677 | goto err; | ||
1678 | } | ||
1679 | |||
1680 | retval = device_create_file(&pdev->dev, &dev_attr_hsm); | ||
1681 | if (retval < 0) { | ||
1682 | otg_dbg("Can't hsm sysfs attribute: %d\n", retval); | ||
1683 | goto err; | ||
1684 | } | ||
1685 | |||
1686 | retval = sysfs_create_group(&pdev->dev.kobj, &debug_dev_attr_group); | ||
1687 | if (retval < 0) { | ||
1688 | otg_dbg("Can't register sysfs attr group: %d\n", retval); | ||
1689 | goto err; | ||
1690 | } | ||
1691 | |||
1692 | if (langwell->otg.state == OTG_STATE_A_IDLE) | ||
1693 | queue_work(langwell->qwork, &langwell->work); | ||
1694 | |||
1695 | return 0; | ||
1696 | |||
1697 | err: | ||
1698 | if (the_transceiver) | ||
1699 | langwell_otg_remove(pdev); | ||
1700 | done: | ||
1701 | return retval; | ||
1702 | } | ||
1703 | |||
1704 | static void langwell_otg_remove(struct pci_dev *pdev) | ||
1705 | { | ||
1706 | struct langwell_otg *langwell; | ||
1707 | |||
1708 | langwell = the_transceiver; | ||
1709 | |||
1710 | if (langwell->qwork) { | ||
1711 | flush_workqueue(langwell->qwork); | ||
1712 | destroy_workqueue(langwell->qwork); | ||
1713 | } | ||
1714 | langwell_otg_free_timers(); | ||
1715 | |||
1716 | /* disable OTGSC interrupt as OTGSC doesn't change in reset */ | ||
1717 | writel(0, langwell->regs + CI_OTGSC); | ||
1718 | |||
1719 | if (pdev->irq) | ||
1720 | free_irq(pdev->irq, langwell); | ||
1721 | if (langwell->regs) | ||
1722 | iounmap(langwell->regs); | ||
1723 | if (langwell->region) | ||
1724 | release_mem_region(pci_resource_start(pdev, 0), | ||
1725 | pci_resource_len(pdev, 0)); | ||
1726 | |||
1727 | otg_set_transceiver(NULL); | ||
1728 | pci_disable_device(pdev); | ||
1729 | sysfs_remove_group(&pdev->dev.kobj, &debug_dev_attr_group); | ||
1730 | device_remove_file(&pdev->dev, &dev_attr_hsm); | ||
1731 | device_remove_file(&pdev->dev, &dev_attr_registers); | ||
1732 | kfree(langwell); | ||
1733 | langwell = NULL; | ||
1734 | } | ||
1735 | |||
1736 | static void transceiver_suspend(struct pci_dev *pdev) | ||
1737 | { | ||
1738 | pci_save_state(pdev); | ||
1739 | pci_set_power_state(pdev, PCI_D3hot); | ||
1740 | langwell_otg_phy_low_power(1); | ||
1741 | } | ||
1742 | |||
1743 | static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message) | ||
1744 | { | ||
1745 | int ret = 0; | ||
1746 | struct langwell_otg *langwell; | ||
1747 | |||
1748 | langwell = the_transceiver; | ||
1749 | |||
1750 | /* Disbale OTG interrupts */ | ||
1751 | langwell_otg_intr(0); | ||
1752 | |||
1753 | if (pdev->irq) | ||
1754 | free_irq(pdev->irq, langwell); | ||
1755 | |||
1756 | /* Prevent more otg_work */ | ||
1757 | flush_workqueue(langwell->qwork); | ||
1758 | spin_lock(&langwell->wq_lock); | ||
1759 | |||
1760 | /* start actions */ | ||
1761 | switch (langwell->otg.state) { | ||
1762 | case OTG_STATE_A_IDLE: | ||
1763 | case OTG_STATE_B_IDLE: | ||
1764 | case OTG_STATE_A_WAIT_VFALL: | ||
1765 | case OTG_STATE_A_VBUS_ERR: | ||
1766 | transceiver_suspend(pdev); | ||
1767 | break; | ||
1768 | case OTG_STATE_A_WAIT_VRISE: | ||
1769 | langwell_otg_del_timer(a_wait_vrise_tmr); | ||
1770 | langwell->hsm.a_srp_det = 0; | ||
1771 | langwell_otg_drv_vbus(0); | ||
1772 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
1773 | transceiver_suspend(pdev); | ||
1774 | break; | ||
1775 | case OTG_STATE_A_WAIT_BCON: | ||
1776 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
1777 | if (langwell->host_ops) | ||
1778 | ret = langwell->host_ops->suspend(pdev, message); | ||
1779 | langwell_otg_drv_vbus(0); | ||
1780 | break; | ||
1781 | case OTG_STATE_A_HOST: | ||
1782 | if (langwell->host_ops) | ||
1783 | ret = langwell->host_ops->suspend(pdev, message); | ||
1784 | langwell_otg_drv_vbus(0); | ||
1785 | langwell_otg_phy_low_power(1); | ||
1786 | break; | ||
1787 | case OTG_STATE_A_SUSPEND: | ||
1788 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1789 | langwell_otg_HABA(0); | ||
1790 | if (langwell->host_ops) | ||
1791 | langwell->host_ops->remove(pdev); | ||
1792 | else | ||
1793 | otg_dbg("host driver has been removed.\n"); | ||
1794 | langwell_otg_drv_vbus(0); | ||
1795 | transceiver_suspend(pdev); | ||
1796 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1797 | break; | ||
1798 | case OTG_STATE_A_PERIPHERAL: | ||
1799 | if (langwell->client_ops) | ||
1800 | ret = langwell->client_ops->suspend(pdev, message); | ||
1801 | else | ||
1802 | otg_dbg("client driver has been removed.\n"); | ||
1803 | langwell_otg_drv_vbus(0); | ||
1804 | transceiver_suspend(pdev); | ||
1805 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1806 | break; | ||
1807 | case OTG_STATE_B_HOST: | ||
1808 | if (langwell->host_ops) | ||
1809 | langwell->host_ops->remove(pdev); | ||
1810 | else | ||
1811 | otg_dbg("host driver has been removed.\n"); | ||
1812 | langwell->hsm.b_bus_req = 0; | ||
1813 | transceiver_suspend(pdev); | ||
1814 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1815 | break; | ||
1816 | case OTG_STATE_B_PERIPHERAL: | ||
1817 | if (langwell->client_ops) | ||
1818 | ret = langwell->client_ops->suspend(pdev, message); | ||
1819 | else | ||
1820 | otg_dbg("client driver has been removed.\n"); | ||
1821 | break; | ||
1822 | case OTG_STATE_B_WAIT_ACON: | ||
1823 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
1824 | langwell_otg_HAAR(0); | ||
1825 | if (langwell->host_ops) | ||
1826 | langwell->host_ops->remove(pdev); | ||
1827 | else | ||
1828 | otg_dbg("host driver has been removed.\n"); | ||
1829 | langwell->hsm.b_bus_req = 0; | ||
1830 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1831 | transceiver_suspend(pdev); | ||
1832 | break; | ||
1833 | default: | ||
1834 | otg_dbg("error state before suspend\n "); | ||
1835 | break; | ||
1836 | } | ||
1837 | spin_unlock(&langwell->wq_lock); | ||
1838 | |||
1839 | return ret; | ||
1840 | } | ||
1841 | |||
1842 | static void transceiver_resume(struct pci_dev *pdev) | ||
1843 | { | ||
1844 | pci_restore_state(pdev); | ||
1845 | pci_set_power_state(pdev, PCI_D0); | ||
1846 | langwell_otg_phy_low_power(0); | ||
1847 | } | ||
1848 | |||
1849 | static int langwell_otg_resume(struct pci_dev *pdev) | ||
1850 | { | ||
1851 | int ret = 0; | ||
1852 | struct langwell_otg *langwell; | ||
1853 | |||
1854 | langwell = the_transceiver; | ||
1855 | |||
1856 | spin_lock(&langwell->wq_lock); | ||
1857 | |||
1858 | switch (langwell->otg.state) { | ||
1859 | case OTG_STATE_A_IDLE: | ||
1860 | case OTG_STATE_B_IDLE: | ||
1861 | case OTG_STATE_A_WAIT_VFALL: | ||
1862 | case OTG_STATE_A_VBUS_ERR: | ||
1863 | transceiver_resume(pdev); | ||
1864 | break; | ||
1865 | case OTG_STATE_A_WAIT_BCON: | ||
1866 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1867 | langwell_otg_drv_vbus(1); | ||
1868 | if (langwell->host_ops) | ||
1869 | ret = langwell->host_ops->resume(pdev); | ||
1870 | break; | ||
1871 | case OTG_STATE_A_HOST: | ||
1872 | langwell_otg_drv_vbus(1); | ||
1873 | langwell_otg_phy_low_power(0); | ||
1874 | if (langwell->host_ops) | ||
1875 | ret = langwell->host_ops->resume(pdev); | ||
1876 | break; | ||
1877 | case OTG_STATE_B_PERIPHERAL: | ||
1878 | if (langwell->client_ops) | ||
1879 | ret = langwell->client_ops->resume(pdev); | ||
1880 | else | ||
1881 | otg_dbg("client driver not loaded.\n"); | ||
1882 | break; | ||
1883 | default: | ||
1884 | otg_dbg("error state before suspend\n "); | ||
1885 | break; | ||
1886 | } | ||
1887 | |||
1888 | if (request_irq(pdev->irq, otg_irq, IRQF_SHARED, | ||
1889 | driver_name, the_transceiver) != 0) { | ||
1890 | otg_dbg("request interrupt %d failed\n", pdev->irq); | ||
1891 | ret = -EBUSY; | ||
1892 | } | ||
1893 | |||
1894 | /* enable OTG interrupts */ | ||
1895 | langwell_otg_intr(1); | ||
1896 | |||
1897 | spin_unlock(&langwell->wq_lock); | ||
1898 | |||
1899 | queue_work(langwell->qwork, &langwell->work); | ||
1900 | |||
1901 | |||
1902 | return ret; | ||
1903 | } | ||
1904 | |||
1905 | static int __init langwell_otg_init(void) | ||
1906 | { | ||
1907 | return pci_register_driver(&otg_pci_driver); | ||
1908 | } | ||
1909 | module_init(langwell_otg_init); | ||
1910 | |||
1911 | static void __exit langwell_otg_cleanup(void) | ||
1912 | { | ||
1913 | pci_unregister_driver(&otg_pci_driver); | ||
1914 | } | ||
1915 | module_exit(langwell_otg_cleanup); | ||
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index 9ed5ea568679..af456b48985f 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c | |||
@@ -53,6 +53,7 @@ EXPORT_SYMBOL(usb_nop_xceiv_register); | |||
53 | void usb_nop_xceiv_unregister(void) | 53 | void usb_nop_xceiv_unregister(void) |
54 | { | 54 | { |
55 | platform_device_unregister(pd); | 55 | platform_device_unregister(pd); |
56 | pd = NULL; | ||
56 | } | 57 | } |
57 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); | 58 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); |
58 | 59 | ||
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 247b61bfb7f4..0e4f2e41ace5 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -169,9 +169,11 @@ static int usb_console_setup(struct console *co, char *options) | |||
169 | kfree(tty); | 169 | kfree(tty); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | /* So we know not to kill the hardware on a hangup on this | 172 | /* Now that any required fake tty operations are completed restore |
173 | port. We have also bumped the use count by one so it won't go | 173 | * the tty port count */ |
174 | idle */ | 174 | --port->port.count; |
175 | /* The console is special in terms of closing the device so | ||
176 | * indicate this port is now acting as a system console. */ | ||
175 | port->console = 1; | 177 | port->console = 1; |
176 | retval = 0; | 178 | retval = 0; |
177 | 179 | ||
@@ -204,7 +206,7 @@ static void usb_console_write(struct console *co, | |||
204 | 206 | ||
205 | dbg("%s - port %d, %d byte(s)", __func__, port->number, count); | 207 | dbg("%s - port %d, %d byte(s)", __func__, port->number, count); |
206 | 208 | ||
207 | if (!port->port.count) { | 209 | if (!port->console) { |
208 | dbg("%s - port not opened", __func__); | 210 | dbg("%s - port not opened", __func__); |
209 | return; | 211 | return; |
210 | } | 212 | } |
@@ -300,8 +302,7 @@ void usb_serial_console_exit(void) | |||
300 | { | 302 | { |
301 | if (usbcons_info.port) { | 303 | if (usbcons_info.port) { |
302 | unregister_console(&usbcons); | 304 | unregister_console(&usbcons); |
303 | if (usbcons_info.port->port.count) | 305 | usbcons_info.port->console = 0; |
304 | usbcons_info.port->port.count--; | ||
305 | usbcons_info.port = NULL; | 306 | usbcons_info.port = NULL; |
306 | } | 307 | } |
307 | } | 308 | } |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 2b9eeda62bfe..e9a40b820fd4 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -67,6 +67,8 @@ static struct usb_device_id id_table [] = { | |||
67 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ | 67 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ |
68 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ | 68 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ |
69 | { USB_DEVICE(0x10C4, 0x0F91) }, /* Vstabi */ | 69 | { USB_DEVICE(0x10C4, 0x0F91) }, /* Vstabi */ |
70 | { USB_DEVICE(0x10C4, 0x1101) }, /* Arkham Technology DS101 Bus Monitor */ | ||
71 | { USB_DEVICE(0x10C4, 0x1601) }, /* Arkham Technology DS101 Adapter */ | ||
70 | { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */ | 72 | { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */ |
71 | { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */ | 73 | { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */ |
72 | { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ | 74 | { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 9734085fd2fe..59adfe123110 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -1228,8 +1228,8 @@ static void cypress_read_int_callback(struct urb *urb) | |||
1228 | /* precursor to disconnect so just go away */ | 1228 | /* precursor to disconnect so just go away */ |
1229 | return; | 1229 | return; |
1230 | case -EPIPE: | 1230 | case -EPIPE: |
1231 | usb_clear_halt(port->serial->dev, 0x81); | 1231 | /* Can't call usb_clear_halt while in_interrupt */ |
1232 | break; | 1232 | /* FALLS THROUGH */ |
1233 | default: | 1233 | default: |
1234 | /* something ugly is going on... */ | 1234 | /* something ugly is going on... */ |
1235 | dev_err(&urb->dev->dev, | 1235 | dev_err(&urb->dev->dev, |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 3dc3768ca71c..60c64cc5be2a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/smp_lock.h> | ||
36 | #include <linux/tty.h> | 37 | #include <linux/tty.h> |
37 | #include <linux/tty_driver.h> | 38 | #include <linux/tty_driver.h> |
38 | #include <linux/tty_flip.h> | 39 | #include <linux/tty_flip.h> |
@@ -107,6 +108,7 @@ struct ftdi_sio_quirk { | |||
107 | 108 | ||
108 | static int ftdi_jtag_probe(struct usb_serial *serial); | 109 | static int ftdi_jtag_probe(struct usb_serial *serial); |
109 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); | 110 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); |
111 | static int ftdi_NDI_device_setup(struct usb_serial *serial); | ||
110 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); | 112 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); |
111 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); | 113 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); |
112 | 114 | ||
@@ -118,6 +120,10 @@ static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = { | |||
118 | .probe = ftdi_mtxorb_hack_setup, | 120 | .probe = ftdi_mtxorb_hack_setup, |
119 | }; | 121 | }; |
120 | 122 | ||
123 | static struct ftdi_sio_quirk ftdi_NDI_device_quirk = { | ||
124 | .probe = ftdi_NDI_device_setup, | ||
125 | }; | ||
126 | |||
121 | static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { | 127 | static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { |
122 | .port_probe = ftdi_USB_UIRT_setup, | 128 | .port_probe = ftdi_USB_UIRT_setup, |
123 | }; | 129 | }; |
@@ -191,6 +197,7 @@ static struct usb_device_id id_table_combined [] = { | |||
191 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, | 197 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, |
192 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, | 198 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
193 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 199 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
200 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, | ||
194 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, | 201 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, |
195 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, | 202 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, |
196 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, | 203 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, |
@@ -579,6 +586,9 @@ static struct usb_device_id id_table_combined [] = { | |||
579 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, | 586 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, |
580 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, | 587 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, |
581 | { USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) }, | 588 | { USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) }, |
589 | { USB_DEVICE(FTDI_VID, FTDI_CCSLOAD_N_GO_3_PID) }, | ||
590 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU64_4_PID) }, | ||
591 | { USB_DEVICE(FTDI_VID, FTDI_CCSPRIME8_5_PID) }, | ||
582 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, | 592 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, |
583 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, | 593 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, |
584 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, | 594 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, |
@@ -644,6 +654,16 @@ static struct usb_device_id id_table_combined [] = { | |||
644 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, | 654 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, |
645 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, | 655 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, |
646 | { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, | 656 | { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, |
657 | { USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID), | ||
658 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
659 | { USB_DEVICE(FTDI_VID, FTDI_NDI_SPECTRA_SCU_PID), | ||
660 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
661 | { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_2_PID), | ||
662 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
663 | { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_3_PID), | ||
664 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
665 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | ||
666 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
647 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 667 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
648 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 668 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
649 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 669 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
@@ -660,6 +680,8 @@ static struct usb_device_id id_table_combined [] = { | |||
660 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 680 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
661 | { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID), | 681 | { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID), |
662 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 682 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
683 | { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID), | ||
684 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
663 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | 685 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, |
664 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, | 686 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, |
665 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, | 687 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, |
@@ -667,7 +689,6 @@ static struct usb_device_id id_table_combined [] = { | |||
667 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, | 689 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, |
668 | { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, | 690 | { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, |
669 | { USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) }, | 691 | { USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) }, |
670 | { USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID) }, | ||
671 | { USB_DEVICE(ATMEL_VID, STK541_PID) }, | 692 | { USB_DEVICE(ATMEL_VID, STK541_PID) }, |
672 | { USB_DEVICE(DE_VID, STB_PID) }, | 693 | { USB_DEVICE(DE_VID, STB_PID) }, |
673 | { USB_DEVICE(DE_VID, WHT_PID) }, | 694 | { USB_DEVICE(DE_VID, WHT_PID) }, |
@@ -1023,6 +1044,16 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, | |||
1023 | case FT2232C: /* FT2232C chip */ | 1044 | case FT2232C: /* FT2232C chip */ |
1024 | case FT232RL: | 1045 | case FT232RL: |
1025 | if (baud <= 3000000) { | 1046 | if (baud <= 3000000) { |
1047 | __u16 product_id = le16_to_cpu( | ||
1048 | port->serial->dev->descriptor.idProduct); | ||
1049 | if (((FTDI_NDI_HUC_PID == product_id) || | ||
1050 | (FTDI_NDI_SPECTRA_SCU_PID == product_id) || | ||
1051 | (FTDI_NDI_FUTURE_2_PID == product_id) || | ||
1052 | (FTDI_NDI_FUTURE_3_PID == product_id) || | ||
1053 | (FTDI_NDI_AURORA_SCU_PID == product_id)) && | ||
1054 | (baud == 19200)) { | ||
1055 | baud = 1200000; | ||
1056 | } | ||
1026 | div_value = ftdi_232bm_baud_to_divisor(baud); | 1057 | div_value = ftdi_232bm_baud_to_divisor(baud); |
1027 | } else { | 1058 | } else { |
1028 | dbg("%s - Baud rate too high!", __func__); | 1059 | dbg("%s - Baud rate too high!", __func__); |
@@ -1554,6 +1585,39 @@ static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv) | |||
1554 | } /* ftdi_HE_TIRA1_setup */ | 1585 | } /* ftdi_HE_TIRA1_setup */ |
1555 | 1586 | ||
1556 | /* | 1587 | /* |
1588 | * Module parameter to control latency timer for NDI FTDI-based USB devices. | ||
1589 | * If this value is not set in modprobe.conf.local its value will be set to 1ms. | ||
1590 | */ | ||
1591 | static int ndi_latency_timer = 1; | ||
1592 | |||
1593 | /* Setup for the NDI FTDI-based USB devices, which requires hardwired | ||
1594 | * baudrate (19200 gets mapped to 1200000). | ||
1595 | * | ||
1596 | * Called from usbserial:serial_probe. | ||
1597 | */ | ||
1598 | static int ftdi_NDI_device_setup(struct usb_serial *serial) | ||
1599 | { | ||
1600 | struct usb_device *udev = serial->dev; | ||
1601 | int latency = ndi_latency_timer; | ||
1602 | int rv = 0; | ||
1603 | char buf[1]; | ||
1604 | |||
1605 | if (latency == 0) | ||
1606 | latency = 1; | ||
1607 | if (latency > 99) | ||
1608 | latency = 99; | ||
1609 | |||
1610 | dbg("%s setting NDI device latency to %d", __func__, latency); | ||
1611 | dev_info(&udev->dev, "NDI device with a latency value of %d", latency); | ||
1612 | |||
1613 | rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
1614 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST, | ||
1615 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, | ||
1616 | latency, 0, buf, 0, WDR_TIMEOUT); | ||
1617 | return 0; | ||
1618 | } | ||
1619 | |||
1620 | /* | ||
1557 | * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko | 1621 | * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko |
1558 | * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from | 1622 | * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from |
1559 | * userspace using openocd. | 1623 | * userspace using openocd. |
@@ -2121,7 +2185,7 @@ static void ftdi_process_read(struct work_struct *work) | |||
2121 | /* Note that the error flag is duplicated for | 2185 | /* Note that the error flag is duplicated for |
2122 | every character received since we don't know | 2186 | every character received since we don't know |
2123 | which character it applied to */ | 2187 | which character it applied to */ |
2124 | if (!usb_serial_handle_sysrq_char(port, | 2188 | if (!usb_serial_handle_sysrq_char(tty, port, |
2125 | data[packet_offset + i])) | 2189 | data[packet_offset + i])) |
2126 | tty_insert_flip_char(tty, | 2190 | tty_insert_flip_char(tty, |
2127 | data[packet_offset + i], | 2191 | data[packet_offset + i], |
@@ -2622,3 +2686,5 @@ MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" | |||
2622 | module_param(product, ushort, 0); | 2686 | module_param(product, ushort, 0); |
2623 | MODULE_PARM_DESC(product, "User specified product ID"); | 2687 | MODULE_PARM_DESC(product, "User specified product ID"); |
2624 | 2688 | ||
2689 | module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); | ||
2690 | MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override"); | ||
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index f1d440a728a3..c9fbd7415092 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -506,6 +506,7 @@ | |||
506 | * | 506 | * |
507 | * Armin Laeuger originally sent the PID for the UM 100 module. | 507 | * Armin Laeuger originally sent the PID for the UM 100 module. |
508 | */ | 508 | */ |
509 | #define FTDI_R2000KU_TRUE_RNG 0xFB80 /* R2000KU TRUE RNG */ | ||
509 | #define FTDI_ELV_UR100_PID 0xFB58 /* USB-RS232-Umsetzer (UR 100) */ | 510 | #define FTDI_ELV_UR100_PID 0xFB58 /* USB-RS232-Umsetzer (UR 100) */ |
510 | #define FTDI_ELV_UM100_PID 0xFB5A /* USB-Modul UM 100 */ | 511 | #define FTDI_ELV_UM100_PID 0xFB5A /* USB-Modul UM 100 */ |
511 | #define FTDI_ELV_UO100_PID 0xFB5B /* USB-Modul UO 100 */ | 512 | #define FTDI_ELV_UO100_PID 0xFB5B /* USB-Modul UO 100 */ |
@@ -614,6 +615,9 @@ | |||
614 | #define FTDI_CCSICDU20_0_PID 0xF9D0 | 615 | #define FTDI_CCSICDU20_0_PID 0xF9D0 |
615 | #define FTDI_CCSICDU40_1_PID 0xF9D1 | 616 | #define FTDI_CCSICDU40_1_PID 0xF9D1 |
616 | #define FTDI_CCSMACHX_2_PID 0xF9D2 | 617 | #define FTDI_CCSMACHX_2_PID 0xF9D2 |
618 | #define FTDI_CCSLOAD_N_GO_3_PID 0xF9D3 | ||
619 | #define FTDI_CCSICDU64_4_PID 0xF9D4 | ||
620 | #define FTDI_CCSPRIME8_5_PID 0xF9D5 | ||
617 | 621 | ||
618 | /* Inside Accesso contactless reader (http://www.insidefr.com) */ | 622 | /* Inside Accesso contactless reader (http://www.insidefr.com) */ |
619 | #define INSIDE_ACCESSO 0xFAD0 | 623 | #define INSIDE_ACCESSO 0xFAD0 |
@@ -736,6 +740,15 @@ | |||
736 | #define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ | 740 | #define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ |
737 | 741 | ||
738 | /* | 742 | /* |
743 | * NDI (www.ndigital.com) product ids | ||
744 | */ | ||
745 | #define FTDI_NDI_HUC_PID 0xDA70 /* NDI Host USB Converter */ | ||
746 | #define FTDI_NDI_SPECTRA_SCU_PID 0xDA71 /* NDI Spectra SCU */ | ||
747 | #define FTDI_NDI_FUTURE_2_PID 0xDA72 /* NDI future device #2 */ | ||
748 | #define FTDI_NDI_FUTURE_3_PID 0xDA73 /* NDI future device #3 */ | ||
749 | #define FTDI_NDI_AURORA_SCU_PID 0xDA74 /* NDI Aurora SCU */ | ||
750 | |||
751 | /* | ||
739 | * Posiflex inc retail equipment (http://www.posiflex.com.tw) | 752 | * Posiflex inc retail equipment (http://www.posiflex.com.tw) |
740 | */ | 753 | */ |
741 | #define POSIFLEX_VID 0x0d3a /* Vendor ID */ | 754 | #define POSIFLEX_VID 0x0d3a /* Vendor ID */ |
@@ -848,9 +861,6 @@ | |||
848 | #define TML_VID 0x1B91 /* Vendor ID */ | 861 | #define TML_VID 0x1B91 /* Vendor ID */ |
849 | #define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */ | 862 | #define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */ |
850 | 863 | ||
851 | /* NDI Polaris System */ | ||
852 | #define FTDI_NDI_HUC_PID 0xDA70 | ||
853 | |||
854 | /* Propox devices */ | 864 | /* Propox devices */ |
855 | #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 | 865 | #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 |
856 | 866 | ||
@@ -934,6 +944,8 @@ | |||
934 | #define MARVELL_VID 0x9e88 | 944 | #define MARVELL_VID 0x9e88 |
935 | #define MARVELL_SHEEVAPLUG_PID 0x9e8f | 945 | #define MARVELL_SHEEVAPLUG_PID 0x9e8f |
936 | 946 | ||
947 | #define FTDI_TURTELIZER_PID 0xBDC8 /* JTAG/RS-232 adapter by egnite GmBH */ | ||
948 | |||
937 | /* | 949 | /* |
938 | * BmRequestType: 1100 0000b | 950 | * BmRequestType: 1100 0000b |
939 | * bRequest: FTDI_E2_READ | 951 | * bRequest: FTDI_E2_READ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 932d6241b787..ce57f6a32bdf 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -424,10 +424,17 @@ static void flush_and_resubmit_read_urb(struct usb_serial_port *port) | |||
424 | if (!tty) | 424 | if (!tty) |
425 | goto done; | 425 | goto done; |
426 | 426 | ||
427 | /* Push data to tty */ | 427 | /* The per character mucking around with sysrq path it too slow for |
428 | for (i = 0; i < urb->actual_length; i++, ch++) { | 428 | stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases |
429 | if (!usb_serial_handle_sysrq_char(port, *ch)) | 429 | where the USB serial is not a console anyway */ |
430 | tty_insert_flip_char(tty, *ch, TTY_NORMAL); | 430 | if (!port->console || !port->sysrq) |
431 | tty_insert_flip_string(tty, ch, urb->actual_length); | ||
432 | else { | ||
433 | /* Push data to tty */ | ||
434 | for (i = 0; i < urb->actual_length; i++, ch++) { | ||
435 | if (!usb_serial_handle_sysrq_char(tty, port, *ch)) | ||
436 | tty_insert_flip_char(tty, *ch, TTY_NORMAL); | ||
437 | } | ||
431 | } | 438 | } |
432 | tty_flip_buffer_push(tty); | 439 | tty_flip_buffer_push(tty); |
433 | tty_kref_put(tty); | 440 | tty_kref_put(tty); |
@@ -527,11 +534,12 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) | |||
527 | } | 534 | } |
528 | } | 535 | } |
529 | 536 | ||
530 | int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) | 537 | int usb_serial_handle_sysrq_char(struct tty_struct *tty, |
538 | struct usb_serial_port *port, unsigned int ch) | ||
531 | { | 539 | { |
532 | if (port->sysrq && port->console) { | 540 | if (port->sysrq && port->console) { |
533 | if (ch && time_before(jiffies, port->sysrq)) { | 541 | if (ch && time_before(jiffies, port->sysrq)) { |
534 | handle_sysrq(ch, tty_port_tty_get(&port->port)); | 542 | handle_sysrq(ch, tty); |
535 | port->sysrq = 0; | 543 | port->sysrq = 0; |
536 | return 1; | 544 | return 1; |
537 | } | 545 | } |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index c40f95c1951c..c31940a307f8 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/tty.h> | 30 | #include <linux/tty.h> |
30 | #include <linux/tty_driver.h> | 31 | #include <linux/tty_driver.h> |
31 | #include <linux/tty_flip.h> | 32 | #include <linux/tty_flip.h> |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 575816e6ba37..98262dd552bb 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -206,6 +206,7 @@ static int option_resume(struct usb_serial *serial); | |||
206 | #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 | 206 | #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 |
207 | #define NOVATELWIRELESS_PRODUCT_U727 0x5010 | 207 | #define NOVATELWIRELESS_PRODUCT_U727 0x5010 |
208 | #define NOVATELWIRELESS_PRODUCT_MC760 0x6000 | 208 | #define NOVATELWIRELESS_PRODUCT_MC760 0x6000 |
209 | #define NOVATELWIRELESS_PRODUCT_OVMC760 0x6002 | ||
209 | 210 | ||
210 | /* FUTURE NOVATEL PRODUCTS */ | 211 | /* FUTURE NOVATEL PRODUCTS */ |
211 | #define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0X6001 | 212 | #define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0X6001 |
@@ -307,11 +308,20 @@ static int option_resume(struct usb_serial *serial); | |||
307 | #define DLINK_VENDOR_ID 0x1186 | 308 | #define DLINK_VENDOR_ID 0x1186 |
308 | #define DLINK_PRODUCT_DWM_652 0x3e04 | 309 | #define DLINK_PRODUCT_DWM_652 0x3e04 |
309 | 310 | ||
311 | #define QISDA_VENDOR_ID 0x1da5 | ||
312 | #define QISDA_PRODUCT_H21_4512 0x4512 | ||
313 | #define QISDA_PRODUCT_H21_4523 0x4523 | ||
314 | #define QISDA_PRODUCT_H20_4515 0x4515 | ||
315 | #define QISDA_PRODUCT_H20_4519 0x4519 | ||
316 | |||
310 | 317 | ||
311 | /* TOSHIBA PRODUCTS */ | 318 | /* TOSHIBA PRODUCTS */ |
312 | #define TOSHIBA_VENDOR_ID 0x0930 | 319 | #define TOSHIBA_VENDOR_ID 0x0930 |
313 | #define TOSHIBA_PRODUCT_HSDPA_MINICARD 0x1302 | 320 | #define TOSHIBA_PRODUCT_HSDPA_MINICARD 0x1302 |
314 | 321 | ||
322 | #define ALINK_VENDOR_ID 0x1e0e | ||
323 | #define ALINK_PRODUCT_3GU 0x9200 | ||
324 | |||
315 | static struct usb_device_id option_ids[] = { | 325 | static struct usb_device_id option_ids[] = { |
316 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 326 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
317 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 327 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -430,6 +440,7 @@ static struct usb_device_id option_ids[] = { | |||
430 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ | 440 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ |
431 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel MC727/U727/USB727 */ | 441 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel MC727/U727/USB727 */ |
432 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC760) }, /* Novatel MC760/U760/USB760 */ | 442 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC760) }, /* Novatel MC760/U760/USB760 */ |
443 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_OVMC760) }, /* Novatel Ovation MC760 */ | ||
433 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, /* Novatel HSPA product */ | 444 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, /* Novatel HSPA product */ |
434 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, /* Novatel EVDO Embedded product */ | 445 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, /* Novatel EVDO Embedded product */ |
435 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, /* Novatel HSPA Embedded product */ | 446 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, /* Novatel HSPA Embedded product */ |
@@ -529,8 +540,13 @@ static struct usb_device_id option_ids[] = { | |||
529 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, | 540 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, |
530 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | 541 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, |
531 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, | 542 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, |
532 | { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */ | 543 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, |
544 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, | ||
545 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, | ||
546 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, | ||
533 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ | 547 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ |
548 | { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, | ||
549 | { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, | ||
534 | { } /* Terminating entry */ | 550 | { } /* Terminating entry */ |
535 | }; | 551 | }; |
536 | MODULE_DEVICE_TABLE(usb, option_ids); | 552 | MODULE_DEVICE_TABLE(usb, option_ids); |
@@ -732,7 +748,6 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
732 | memcpy(this_urb->transfer_buffer, buf, todo); | 748 | memcpy(this_urb->transfer_buffer, buf, todo); |
733 | this_urb->transfer_buffer_length = todo; | 749 | this_urb->transfer_buffer_length = todo; |
734 | 750 | ||
735 | this_urb->dev = port->serial->dev; | ||
736 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 751 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
737 | if (err) { | 752 | if (err) { |
738 | dbg("usb_submit_urb %p (write bulk) failed " | 753 | dbg("usb_submit_urb %p (write bulk) failed " |
@@ -860,7 +875,6 @@ static void option_instat_callback(struct urb *urb) | |||
860 | 875 | ||
861 | /* Resubmit urb so we continue receiving IRQ data */ | 876 | /* Resubmit urb so we continue receiving IRQ data */ |
862 | if (status != -ESHUTDOWN && status != -ENOENT) { | 877 | if (status != -ESHUTDOWN && status != -ENOENT) { |
863 | urb->dev = serial->dev; | ||
864 | err = usb_submit_urb(urb, GFP_ATOMIC); | 878 | err = usb_submit_urb(urb, GFP_ATOMIC); |
865 | if (err) | 879 | if (err) |
866 | dbg("%s: resubmit intr urb failed. (%d)", | 880 | dbg("%s: resubmit intr urb failed. (%d)", |
@@ -921,23 +935,11 @@ static int option_open(struct tty_struct *tty, | |||
921 | 935 | ||
922 | dbg("%s", __func__); | 936 | dbg("%s", __func__); |
923 | 937 | ||
924 | /* Reset low level data toggle and start reading from endpoints */ | 938 | /* Start reading from the IN endpoint */ |
925 | for (i = 0; i < N_IN_URB; i++) { | 939 | for (i = 0; i < N_IN_URB; i++) { |
926 | urb = portdata->in_urbs[i]; | 940 | urb = portdata->in_urbs[i]; |
927 | if (!urb) | 941 | if (!urb) |
928 | continue; | 942 | continue; |
929 | if (urb->dev != serial->dev) { | ||
930 | dbg("%s: dev %p != %p", __func__, | ||
931 | urb->dev, serial->dev); | ||
932 | continue; | ||
933 | } | ||
934 | |||
935 | /* | ||
936 | * make sure endpoint data toggle is synchronized with the | ||
937 | * device | ||
938 | */ | ||
939 | usb_clear_halt(urb->dev, urb->pipe); | ||
940 | |||
941 | err = usb_submit_urb(urb, GFP_KERNEL); | 943 | err = usb_submit_urb(urb, GFP_KERNEL); |
942 | if (err) { | 944 | if (err) { |
943 | dbg("%s: submit urb %d failed (%d) %d", | 945 | dbg("%s: submit urb %d failed (%d) %d", |
@@ -946,16 +948,6 @@ static int option_open(struct tty_struct *tty, | |||
946 | } | 948 | } |
947 | } | 949 | } |
948 | 950 | ||
949 | /* Reset low level data toggle on out endpoints */ | ||
950 | for (i = 0; i < N_OUT_URB; i++) { | ||
951 | urb = portdata->out_urbs[i]; | ||
952 | if (!urb) | ||
953 | continue; | ||
954 | urb->dev = serial->dev; | ||
955 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), | ||
956 | usb_pipeout(urb->pipe), 0); */ | ||
957 | } | ||
958 | |||
959 | option_send_setup(port); | 951 | option_send_setup(port); |
960 | 952 | ||
961 | return 0; | 953 | return 0; |
@@ -1218,7 +1210,6 @@ static int option_resume(struct usb_serial *serial) | |||
1218 | dbg("%s: No interrupt URB for port %d\n", __func__, i); | 1210 | dbg("%s: No interrupt URB for port %d\n", __func__, i); |
1219 | continue; | 1211 | continue; |
1220 | } | 1212 | } |
1221 | port->interrupt_in_urb->dev = serial->dev; | ||
1222 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); | 1213 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); |
1223 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); | 1214 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); |
1224 | if (err < 0) { | 1215 | if (err < 0) { |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ec6c132a25b5..7d15bfa7c2db 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -94,6 +94,7 @@ static struct usb_device_id id_table [] = { | |||
94 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, | 94 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, |
95 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, | 95 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, |
96 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, | 96 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, |
97 | { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, | ||
97 | { } /* Terminating entry */ | 98 | { } /* Terminating entry */ |
98 | }; | 99 | }; |
99 | 100 | ||
@@ -971,18 +972,46 @@ exit: | |||
971 | __func__, retval); | 972 | __func__, retval); |
972 | } | 973 | } |
973 | 974 | ||
975 | static void pl2303_push_data(struct tty_struct *tty, | ||
976 | struct usb_serial_port *port, struct urb *urb, | ||
977 | u8 line_status) | ||
978 | { | ||
979 | unsigned char *data = urb->transfer_buffer; | ||
980 | /* get tty_flag from status */ | ||
981 | char tty_flag = TTY_NORMAL; | ||
982 | /* break takes precedence over parity, */ | ||
983 | /* which takes precedence over framing errors */ | ||
984 | if (line_status & UART_BREAK_ERROR) | ||
985 | tty_flag = TTY_BREAK; | ||
986 | else if (line_status & UART_PARITY_ERROR) | ||
987 | tty_flag = TTY_PARITY; | ||
988 | else if (line_status & UART_FRAME_ERROR) | ||
989 | tty_flag = TTY_FRAME; | ||
990 | dbg("%s - tty_flag = %d", __func__, tty_flag); | ||
991 | |||
992 | tty_buffer_request_room(tty, urb->actual_length + 1); | ||
993 | /* overrun is special, not associated with a char */ | ||
994 | if (line_status & UART_OVERRUN_ERROR) | ||
995 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
996 | if (port->console && port->sysrq) { | ||
997 | int i; | ||
998 | for (i = 0; i < urb->actual_length; ++i) | ||
999 | if (!usb_serial_handle_sysrq_char(tty, port, data[i])) | ||
1000 | tty_insert_flip_char(tty, data[i], tty_flag); | ||
1001 | } else | ||
1002 | tty_insert_flip_string(tty, data, urb->actual_length); | ||
1003 | tty_flip_buffer_push(tty); | ||
1004 | } | ||
1005 | |||
974 | static void pl2303_read_bulk_callback(struct urb *urb) | 1006 | static void pl2303_read_bulk_callback(struct urb *urb) |
975 | { | 1007 | { |
976 | struct usb_serial_port *port = urb->context; | 1008 | struct usb_serial_port *port = urb->context; |
977 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 1009 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
978 | struct tty_struct *tty; | 1010 | struct tty_struct *tty; |
979 | unsigned char *data = urb->transfer_buffer; | ||
980 | unsigned long flags; | 1011 | unsigned long flags; |
981 | int i; | ||
982 | int result; | 1012 | int result; |
983 | int status = urb->status; | 1013 | int status = urb->status; |
984 | u8 line_status; | 1014 | u8 line_status; |
985 | char tty_flag; | ||
986 | 1015 | ||
987 | dbg("%s - port %d", __func__, port->number); | 1016 | dbg("%s - port %d", __func__, port->number); |
988 | 1017 | ||
@@ -1010,10 +1039,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1010 | } | 1039 | } |
1011 | 1040 | ||
1012 | usb_serial_debug_data(debug, &port->dev, __func__, | 1041 | usb_serial_debug_data(debug, &port->dev, __func__, |
1013 | urb->actual_length, data); | 1042 | urb->actual_length, urb->transfer_buffer); |
1014 | |||
1015 | /* get tty_flag from status */ | ||
1016 | tty_flag = TTY_NORMAL; | ||
1017 | 1043 | ||
1018 | spin_lock_irqsave(&priv->lock, flags); | 1044 | spin_lock_irqsave(&priv->lock, flags); |
1019 | line_status = priv->line_status; | 1045 | line_status = priv->line_status; |
@@ -1021,26 +1047,9 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1021 | spin_unlock_irqrestore(&priv->lock, flags); | 1047 | spin_unlock_irqrestore(&priv->lock, flags); |
1022 | wake_up_interruptible(&priv->delta_msr_wait); | 1048 | wake_up_interruptible(&priv->delta_msr_wait); |
1023 | 1049 | ||
1024 | /* break takes precedence over parity, */ | ||
1025 | /* which takes precedence over framing errors */ | ||
1026 | if (line_status & UART_BREAK_ERROR) | ||
1027 | tty_flag = TTY_BREAK; | ||
1028 | else if (line_status & UART_PARITY_ERROR) | ||
1029 | tty_flag = TTY_PARITY; | ||
1030 | else if (line_status & UART_FRAME_ERROR) | ||
1031 | tty_flag = TTY_FRAME; | ||
1032 | dbg("%s - tty_flag = %d", __func__, tty_flag); | ||
1033 | |||
1034 | tty = tty_port_tty_get(&port->port); | 1050 | tty = tty_port_tty_get(&port->port); |
1035 | if (tty && urb->actual_length) { | 1051 | if (tty && urb->actual_length) { |
1036 | tty_buffer_request_room(tty, urb->actual_length + 1); | 1052 | pl2303_push_data(tty, port, urb, line_status); |
1037 | /* overrun is special, not associated with a char */ | ||
1038 | if (line_status & UART_OVERRUN_ERROR) | ||
1039 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
1040 | for (i = 0; i < urb->actual_length; ++i) | ||
1041 | if (!usb_serial_handle_sysrq_char(port, data[i])) | ||
1042 | tty_insert_flip_char(tty, data[i], tty_flag); | ||
1043 | tty_flip_buffer_push(tty); | ||
1044 | } | 1053 | } |
1045 | tty_kref_put(tty); | 1054 | tty_kref_put(tty); |
1046 | /* Schedule the next read _if_ we are still open */ | 1055 | /* Schedule the next read _if_ we are still open */ |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 1d7a22e3a9fd..12aac7d2462d 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -122,3 +122,7 @@ | |||
122 | /* Hewlett-Packard LD220-HP POS Pole Display */ | 122 | /* Hewlett-Packard LD220-HP POS Pole Display */ |
123 | #define HP_VENDOR_ID 0x03f0 | 123 | #define HP_VENDOR_ID 0x03f0 |
124 | #define HP_LD220_PRODUCT_ID 0x3524 | 124 | #define HP_LD220_PRODUCT_ID 0x3524 |
125 | |||
126 | /* Cressi Edy (diving computer) PC interface */ | ||
127 | #define CRESSI_VENDOR_ID 0x04b8 | ||
128 | #define CRESSI_EDY_PRODUCT_ID 0x0521 | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 032f7aeb40a4..f48d05e0acc1 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -181,35 +181,50 @@ static const struct sierra_iface_info direct_ip_interface_blacklist = { | |||
181 | }; | 181 | }; |
182 | 182 | ||
183 | static struct usb_device_id id_table [] = { | 183 | static struct usb_device_id id_table [] = { |
184 | { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ | ||
185 | { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */ | ||
186 | { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */ | ||
187 | |||
184 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ | 188 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ |
185 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ | 189 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ |
186 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ | 190 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ |
187 | { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */ | ||
188 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ | 191 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ |
189 | { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ | ||
190 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ | 192 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ |
193 | { USB_DEVICE(0x1199, 0x0022) }, /* Sierra Wireless EM5725 */ | ||
194 | { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ | ||
195 | { USB_DEVICE(0x1199, 0x0224) }, /* Sierra Wireless MC5727 */ | ||
191 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ | 196 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ |
192 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ | 197 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ |
198 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ | ||
193 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ | 199 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ |
194 | /* Sierra Wireless C597 */ | 200 | /* Sierra Wireless C597 */ |
195 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, | 201 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, |
196 | /* Sierra Wireless Device */ | 202 | /* Sierra Wireless T598 */ |
197 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, | 203 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, |
198 | { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */ | 204 | { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless T11 */ |
199 | { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */ | 205 | { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless AC402 */ |
200 | { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */ | 206 | { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless MC5728 */ |
207 | { USB_DEVICE(0x1199, 0x0029) }, /* Sierra Wireless Device */ | ||
201 | 208 | ||
202 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ | 209 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ |
203 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ | ||
204 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | 210 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ |
211 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ | ||
212 | { USB_DEVICE(0x1199, 0x6805) }, /* Sierra Wireless MC8765 */ | ||
213 | { USB_DEVICE(0x1199, 0x6808) }, /* Sierra Wireless MC8755 */ | ||
214 | { USB_DEVICE(0x1199, 0x6809) }, /* Sierra Wireless MC8765 */ | ||
205 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ | 215 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ |
206 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Lenovo) */ | 216 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 */ |
207 | { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ | 217 | { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ |
208 | { USB_DEVICE(0x03f0, 0x1e1d) }, /* HP hs2300 a.k.a MC8775 */ | 218 | { USB_DEVICE(0x1199, 0x6816) }, /* Sierra Wireless MC8775 */ |
209 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | 219 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ |
210 | { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ | 220 | { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ |
221 | { USB_DEVICE(0x1199, 0x6822) }, /* Sierra Wireless AirCard 875E */ | ||
211 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ | 222 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ |
212 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ | 223 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ |
224 | { USB_DEVICE(0x1199, 0x6834) }, /* Sierra Wireless MC8780 */ | ||
225 | { USB_DEVICE(0x1199, 0x6835) }, /* Sierra Wireless MC8781 */ | ||
226 | { USB_DEVICE(0x1199, 0x6838) }, /* Sierra Wireless MC8780 */ | ||
227 | { USB_DEVICE(0x1199, 0x6839) }, /* Sierra Wireless MC8781 */ | ||
213 | { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */ | 228 | { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */ |
214 | { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ | 229 | { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ |
215 | /* Sierra Wireless MC8790, MC8791, MC8792 Composite */ | 230 | /* Sierra Wireless MC8790, MC8791, MC8792 Composite */ |
@@ -227,16 +242,13 @@ static struct usb_device_id id_table [] = { | |||
227 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ | 242 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ |
228 | /* Sierra Wireless C885 */ | 243 | /* Sierra Wireless C885 */ |
229 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, | 244 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, |
230 | /* Sierra Wireless Device */ | 245 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ |
231 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, | 246 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, |
232 | /* Sierra Wireless Device */ | 247 | /* Sierra Wireless C22/C33 */ |
233 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)}, | 248 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)}, |
234 | /* Sierra Wireless Device */ | 249 | /* Sierra Wireless HSPA Non-Composite Device */ |
235 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 250 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
236 | 251 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | |
237 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ | ||
238 | { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ | ||
239 | |||
240 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 252 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
241 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 253 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
242 | }, | 254 | }, |
@@ -814,7 +826,7 @@ static int sierra_startup(struct usb_serial *serial) | |||
814 | return 0; | 826 | return 0; |
815 | } | 827 | } |
816 | 828 | ||
817 | static void sierra_disconnect(struct usb_serial *serial) | 829 | static void sierra_release(struct usb_serial *serial) |
818 | { | 830 | { |
819 | int i; | 831 | int i; |
820 | struct usb_serial_port *port; | 832 | struct usb_serial_port *port; |
@@ -830,7 +842,6 @@ static void sierra_disconnect(struct usb_serial *serial) | |||
830 | if (!portdata) | 842 | if (!portdata) |
831 | continue; | 843 | continue; |
832 | kfree(portdata); | 844 | kfree(portdata); |
833 | usb_set_serial_port_data(port, NULL); | ||
834 | } | 845 | } |
835 | } | 846 | } |
836 | 847 | ||
@@ -853,7 +864,7 @@ static struct usb_serial_driver sierra_device = { | |||
853 | .tiocmget = sierra_tiocmget, | 864 | .tiocmget = sierra_tiocmget, |
854 | .tiocmset = sierra_tiocmset, | 865 | .tiocmset = sierra_tiocmset, |
855 | .attach = sierra_startup, | 866 | .attach = sierra_startup, |
856 | .disconnect = sierra_disconnect, | 867 | .release = sierra_release, |
857 | .read_int_callback = sierra_instat_callback, | 868 | .read_int_callback = sierra_instat_callback, |
858 | }; | 869 | }; |
859 | 870 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 991d8232e376..14971a926990 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -191,7 +191,6 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = { | |||
191 | { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, | 191 | { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, |
192 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, | 192 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, |
193 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, | 193 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, |
194 | { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, | ||
195 | }; | 194 | }; |
196 | 195 | ||
197 | static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = { | 196 | static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = { |
@@ -1658,7 +1657,7 @@ static int ti_do_download(struct usb_device *dev, int pipe, | |||
1658 | u8 cs = 0; | 1657 | u8 cs = 0; |
1659 | int done; | 1658 | int done; |
1660 | struct ti_firmware_header *header; | 1659 | struct ti_firmware_header *header; |
1661 | int status; | 1660 | int status = 0; |
1662 | int len; | 1661 | int len; |
1663 | 1662 | ||
1664 | for (pos = sizeof(struct ti_firmware_header); pos < size; pos++) | 1663 | for (pos = sizeof(struct ti_firmware_header); pos < size; pos++) |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a84216464ca0..bd7581b3a48a 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/smp_lock.h> | ||
24 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
25 | #include <linux/tty_driver.h> | 26 | #include <linux/tty_driver.h> |
26 | #include <linux/tty_flip.h> | 27 | #include <linux/tty_flip.h> |
@@ -220,7 +221,8 @@ static int serial_open (struct tty_struct *tty, struct file *filp) | |||
220 | tty->driver_data = port; | 221 | tty->driver_data = port; |
221 | tty_port_tty_set(&port->port, tty); | 222 | tty_port_tty_set(&port->port, tty); |
222 | 223 | ||
223 | if (port->port.count == 1) { | 224 | /* If the console is attached, the device is already open */ |
225 | if (port->port.count == 1 && !port->console) { | ||
224 | 226 | ||
225 | /* lock this module before we call it | 227 | /* lock this module before we call it |
226 | * this may fail, which means we must bail out, | 228 | * this may fail, which means we must bail out, |
diff --git a/drivers/usb/storage/option_ms.c b/drivers/usb/storage/option_ms.c index d41cc0a970f7..773a5cd38c5a 100644 --- a/drivers/usb/storage/option_ms.c +++ b/drivers/usb/storage/option_ms.c | |||
@@ -118,6 +118,9 @@ static int option_inquiry(struct us_data *us) | |||
118 | 118 | ||
119 | result = memcmp(buffer+8, "Option", 6); | 119 | result = memcmp(buffer+8, "Option", 6); |
120 | 120 | ||
121 | if (result != 0) | ||
122 | result = memcmp(buffer+8, "ZCOPTION", 8); | ||
123 | |||
121 | /* Read the CSW */ | 124 | /* Read the CSW */ |
122 | usb_stor_bulk_transfer_buf(us, | 125 | usb_stor_bulk_transfer_buf(us, |
123 | us->recv_bulk_pipe, | 126 | us->recv_bulk_pipe, |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 8afcf08eba98..3b54b3940178 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1119,12 +1119,13 @@ config FB_CARILLO_RANCH | |||
1119 | 1119 | ||
1120 | config FB_INTEL | 1120 | config FB_INTEL |
1121 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" | 1121 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" |
1122 | depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL | 1122 | depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL && EMBEDDED |
1123 | select FB_MODE_HELPERS | 1123 | select FB_MODE_HELPERS |
1124 | select FB_CFB_FILLRECT | 1124 | select FB_CFB_FILLRECT |
1125 | select FB_CFB_COPYAREA | 1125 | select FB_CFB_COPYAREA |
1126 | select FB_CFB_IMAGEBLIT | 1126 | select FB_CFB_IMAGEBLIT |
1127 | select FB_BOOT_VESA_SUPPORT if FB_INTEL = y | 1127 | select FB_BOOT_VESA_SUPPORT if FB_INTEL = y |
1128 | depends on !DRM_I915 | ||
1128 | help | 1129 | help |
1129 | This driver supports the on-board graphics built in to the Intel | 1130 | This driver supports the on-board graphics built in to the Intel |
1130 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. | 1131 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 53ea05645ff8..a85c818be945 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/compat.h> | 16 | #include <linux/compat.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/major.h> | 20 | #include <linux/major.h> |
22 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index 567fb944bd2a..f8778cde2183 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -1365,11 +1365,6 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan) | |||
1365 | init_completion(&mx3fbi->flip_cmpl); | 1365 | init_completion(&mx3fbi->flip_cmpl); |
1366 | disable_irq(ichan->eof_irq); | 1366 | disable_irq(ichan->eof_irq); |
1367 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); | 1367 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); |
1368 | ret = mx3fb_set_par(fbi); | ||
1369 | if (ret < 0) | ||
1370 | goto esetpar; | ||
1371 | |||
1372 | mx3fb_blank(FB_BLANK_UNBLANK, fbi); | ||
1373 | 1368 | ||
1374 | dev_info(dev, "registered, using mode %s\n", fb_mode); | 1369 | dev_info(dev, "registered, using mode %s\n", fb_mode); |
1375 | 1370 | ||
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 4ea99bfc37b4..8862233d57b6 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c | |||
@@ -1254,7 +1254,7 @@ static struct fb_ops omapfb_ops = { | |||
1254 | static ssize_t omapfb_show_caps_num(struct device *dev, | 1254 | static ssize_t omapfb_show_caps_num(struct device *dev, |
1255 | struct device_attribute *attr, char *buf) | 1255 | struct device_attribute *attr, char *buf) |
1256 | { | 1256 | { |
1257 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1257 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1258 | int plane; | 1258 | int plane; |
1259 | size_t size; | 1259 | size_t size; |
1260 | struct omapfb_caps caps; | 1260 | struct omapfb_caps caps; |
@@ -1274,7 +1274,7 @@ static ssize_t omapfb_show_caps_num(struct device *dev, | |||
1274 | static ssize_t omapfb_show_caps_text(struct device *dev, | 1274 | static ssize_t omapfb_show_caps_text(struct device *dev, |
1275 | struct device_attribute *attr, char *buf) | 1275 | struct device_attribute *attr, char *buf) |
1276 | { | 1276 | { |
1277 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1277 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1278 | int i; | 1278 | int i; |
1279 | struct omapfb_caps caps; | 1279 | struct omapfb_caps caps; |
1280 | int plane; | 1280 | int plane; |
@@ -1321,7 +1321,7 @@ static DEVICE_ATTR(caps_text, 0444, omapfb_show_caps_text, NULL); | |||
1321 | static ssize_t omapfb_show_panel_name(struct device *dev, | 1321 | static ssize_t omapfb_show_panel_name(struct device *dev, |
1322 | struct device_attribute *attr, char *buf) | 1322 | struct device_attribute *attr, char *buf) |
1323 | { | 1323 | { |
1324 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1324 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1325 | 1325 | ||
1326 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name); | 1326 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name); |
1327 | } | 1327 | } |
@@ -1330,7 +1330,7 @@ static ssize_t omapfb_show_bklight_level(struct device *dev, | |||
1330 | struct device_attribute *attr, | 1330 | struct device_attribute *attr, |
1331 | char *buf) | 1331 | char *buf) |
1332 | { | 1332 | { |
1333 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1333 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1334 | int r; | 1334 | int r; |
1335 | 1335 | ||
1336 | if (fbdev->panel->get_bklight_level) { | 1336 | if (fbdev->panel->get_bklight_level) { |
@@ -1345,7 +1345,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev, | |||
1345 | struct device_attribute *attr, | 1345 | struct device_attribute *attr, |
1346 | const char *buf, size_t size) | 1346 | const char *buf, size_t size) |
1347 | { | 1347 | { |
1348 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1348 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1349 | int r; | 1349 | int r; |
1350 | 1350 | ||
1351 | if (fbdev->panel->set_bklight_level) { | 1351 | if (fbdev->panel->set_bklight_level) { |
@@ -1364,7 +1364,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev, | |||
1364 | static ssize_t omapfb_show_bklight_max(struct device *dev, | 1364 | static ssize_t omapfb_show_bklight_max(struct device *dev, |
1365 | struct device_attribute *attr, char *buf) | 1365 | struct device_attribute *attr, char *buf) |
1366 | { | 1366 | { |
1367 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1367 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1368 | int r; | 1368 | int r; |
1369 | 1369 | ||
1370 | if (fbdev->panel->get_bklight_level) { | 1370 | if (fbdev->panel->get_bklight_level) { |
@@ -1397,7 +1397,7 @@ static struct attribute_group panel_attr_grp = { | |||
1397 | static ssize_t omapfb_show_ctrl_name(struct device *dev, | 1397 | static ssize_t omapfb_show_ctrl_name(struct device *dev, |
1398 | struct device_attribute *attr, char *buf) | 1398 | struct device_attribute *attr, char *buf) |
1399 | { | 1399 | { |
1400 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1400 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1401 | 1401 | ||
1402 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name); | 1402 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name); |
1403 | } | 1403 | } |
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 16d4f4c7d52b..924d79462780 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -1540,9 +1540,6 @@ static int sm501fb_init_fb(struct fb_info *fb, | |||
1540 | if (ret) | 1540 | if (ret) |
1541 | dev_err(info->dev, "check_var() failed on initial setup?\n"); | 1541 | dev_err(info->dev, "check_var() failed on initial setup?\n"); |
1542 | 1542 | ||
1543 | /* ensure we've activated our new configuration */ | ||
1544 | (fb->fbops->fb_set_par)(fb); | ||
1545 | |||
1546 | return 0; | 1543 | return 0; |
1547 | } | 1544 | } |
1548 | 1545 | ||
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 193c8f0e5cc5..bcec78ffc765 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -669,7 +669,7 @@ static int __init virtio_pci_init(void) | |||
669 | 669 | ||
670 | err = pci_register_driver(&virtio_pci_driver); | 670 | err = pci_register_driver(&virtio_pci_driver); |
671 | if (err) | 671 | if (err) |
672 | device_unregister(virtio_pci_root); | 672 | root_device_unregister(virtio_pci_root); |
673 | 673 | ||
674 | return err; | 674 | return err; |
675 | } | 675 | } |
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c index 5c7011cda6a6..751c003864ad 100644 --- a/drivers/watchdog/bcm47xx_wdt.c +++ b/drivers/watchdog/bcm47xx_wdt.c | |||
@@ -161,7 +161,7 @@ static long bcm47xx_wdt_ioctl(struct file *file, | |||
161 | { | 161 | { |
162 | void __user *argp = (void __user *)arg; | 162 | void __user *argp = (void __user *)arg; |
163 | int __user *p = argp; | 163 | int __user *p = argp; |
164 | int new_value, retval = -EINVAL;; | 164 | int new_value, retval = -EINVAL; |
165 | 165 | ||
166 | switch (cmd) { | 166 | switch (cmd) { |
167 | case WDIOC_GETSUPPORT: | 167 | case WDIOC_GETSUPPORT: |
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index ee1caae4d33b..016245419fad 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | static unsigned long oscr_freq; | 39 | static unsigned long oscr_freq; |
40 | static unsigned long sa1100wdt_users; | 40 | static unsigned long sa1100wdt_users; |
41 | static int pre_margin; | 41 | static unsigned int pre_margin; |
42 | static int boot_status; | 42 | static int boot_status; |
43 | 43 | ||
44 | /* | 44 | /* |
@@ -84,6 +84,7 @@ static const struct watchdog_info ident = { | |||
84 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | 84 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT |
85 | | WDIOF_KEEPALIVEPING, | 85 | | WDIOF_KEEPALIVEPING, |
86 | .identity = "SA1100/PXA255 Watchdog", | 86 | .identity = "SA1100/PXA255 Watchdog", |
87 | .firmware_version = 1, | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | static long sa1100dog_ioctl(struct file *file, unsigned int cmd, | 90 | static long sa1100dog_ioctl(struct file *file, unsigned int cmd, |
@@ -118,7 +119,7 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd, | |||
118 | if (ret) | 119 | if (ret) |
119 | break; | 120 | break; |
120 | 121 | ||
121 | if (time <= 0 || time > 255) { | 122 | if (time <= 0 || (oscr_freq * (long long)time >= 0xffffffff)) { |
122 | ret = -EINVAL; | 123 | ret = -EINVAL; |
123 | break; | 124 | break; |
124 | } | 125 | } |
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index 916890abffdd..f201accc4e3d 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c | |||
@@ -89,6 +89,11 @@ static void w83627hf_select_wd_register(void) | |||
89 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ | 89 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ |
90 | outb_p(0x2b, WDT_EFER); | 90 | outb_p(0x2b, WDT_EFER); |
91 | outb_p(c, WDT_EFDR); /* set GPIO3 to WDT0 */ | 91 | outb_p(c, WDT_EFDR); /* set GPIO3 to WDT0 */ |
92 | } else if (c == 0x88) { /* W83627EHF */ | ||
93 | outb_p(0x2d, WDT_EFER); /* select GPIO5 */ | ||
94 | c = inb_p(WDT_EFDR) & ~0x01; /* PIN77 -> WDT0# */ | ||
95 | outb_p(0x2d, WDT_EFER); | ||
96 | outb_p(c, WDT_EFDR); /* set GPIO5 to WDT0 */ | ||
92 | } | 97 | } |
93 | 98 | ||
94 | outb_p(0x07, WDT_EFER); /* point to logical device number reg */ | 99 | outb_p(0x07, WDT_EFER); /* point to logical device number reg */ |
diff --git a/drivers/watchdog/w83697ug_wdt.c b/drivers/watchdog/w83697ug_wdt.c index 883b5f79673a..a6c12dec91a1 100644 --- a/drivers/watchdog/w83697ug_wdt.c +++ b/drivers/watchdog/w83697ug_wdt.c | |||
@@ -149,8 +149,10 @@ static void wdt_ctrl(int timeout) | |||
149 | { | 149 | { |
150 | spin_lock(&io_lock); | 150 | spin_lock(&io_lock); |
151 | 151 | ||
152 | if (w83697ug_select_wd_register() < 0) | 152 | if (w83697ug_select_wd_register() < 0) { |
153 | spin_unlock(&io_lock); | ||
153 | return; | 154 | return; |
155 | } | ||
154 | 156 | ||
155 | outb_p(0xF4, WDT_EFER); /* Select CRF4 */ | 157 | outb_p(0xF4, WDT_EFER); /* Select CRF4 */ |
156 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF4 */ | 158 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF4 */ |