aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-12-01 01:54:02 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-12-01 01:54:02 -0500
commite538af42e416ac17368593370f7e1f5a71d55197 (patch)
tree507b90ccb700de4f564cc1a2def19658fe054a0c /drivers
parent2226340eb8df9c42f9fca74582d08d5117fc0cec (diff)
parent5666c0947ede0432ba5148570aa66ffb9febff5b (diff)
Merge branch 'master'
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/Kconfig7
-rw-r--r--drivers/atm/Makefile1
-rw-r--r--drivers/atm/adummy.c168
-rw-r--r--drivers/atm/atmdev_init.c54
-rw-r--r--drivers/atm/atmtcp.c20
-rw-r--r--drivers/atm/lanai.c102
-rw-r--r--drivers/char/drm/drm_context.c5
-rw-r--r--drivers/hwmon/w83792d.c25
-rw-r--r--drivers/message/fusion/mptbase.c6
-rw-r--r--drivers/message/fusion/mptbase.h2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c10
-rw-r--r--drivers/mtd/chips/cfi_probe.c8
-rw-r--r--drivers/mtd/chips/sharp.c123
-rw-r--r--drivers/mtd/devices/block2mtd.c6
-rw-r--r--drivers/mtd/devices/ms02-nv.c6
-rw-r--r--drivers/mtd/ftl.c6
-rw-r--r--drivers/mtd/maps/Kconfig6
-rw-r--r--drivers/mtd/maps/Makefile1
-rw-r--r--drivers/mtd/maps/ixp4xx.c78
-rw-r--r--drivers/mtd/maps/nettel.c4
-rw-r--r--drivers/mtd/maps/pci.c4
-rw-r--r--drivers/mtd/maps/physmap.c3
-rw-r--r--drivers/mtd/maps/sc520cdp.c4
-rw-r--r--drivers/mtd/nand/nandsim.c2
-rw-r--r--drivers/mtd/rfd_ftl.c6
-rw-r--r--drivers/scsi/megaraid.c29
-rw-r--r--drivers/usb/atm/cxacru.c3
-rw-r--r--drivers/usb/atm/usbatm.c4
-rw-r--r--drivers/usb/core/hcd-pci.c3
-rw-r--r--drivers/usb/core/hcd.c15
-rw-r--r--drivers/usb/core/hcd.h7
-rw-r--r--drivers/usb/host/ehci-pci.c46
-rw-r--r--drivers/usb/host/ehci-q.c24
-rw-r--r--drivers/usb/host/ehci-sched.c18
-rw-r--r--drivers/usb/host/ohci-hcd.c6
-rw-r--r--drivers/usb/host/ohci-hub.c24
-rw-r--r--drivers/usb/host/ohci-pci.c27
-rw-r--r--drivers/usb/host/uhci-hcd.c6
-rw-r--r--drivers/video/Kconfig13
-rw-r--r--drivers/video/cirrusfb.c15
40 files changed, 553 insertions, 344 deletions
diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index 489de81ea609..01a9f1cb7743 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -5,6 +5,13 @@
5menu "ATM drivers" 5menu "ATM drivers"
6 depends on NETDEVICES && ATM 6 depends on NETDEVICES && ATM
7 7
8config ATM_DUMMY
9 tristate "Dummy ATM driver"
10 depends on ATM
11 help
12 Dummy ATM driver. Useful for proxy signalling, testing,
13 and development. If unsure, say N.
14
8config ATM_TCP 15config ATM_TCP
9 tristate "ATM over TCP" 16 tristate "ATM over TCP"
10 depends on INET && ATM 17 depends on INET && ATM
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile
index 5b77188527a9..b5077ce8cb40 100644
--- a/drivers/atm/Makefile
+++ b/drivers/atm/Makefile
@@ -31,6 +31,7 @@ ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y)
31 obj-$(CONFIG_ATM_IDT77252) += suni.o 31 obj-$(CONFIG_ATM_IDT77252) += suni.o
32endif 32endif
33 33
34obj-$(CONFIG_ATM_DUMMY) += adummy.o
34obj-$(CONFIG_ATM_TCP) += atmtcp.o 35obj-$(CONFIG_ATM_TCP) += atmtcp.o
35obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o 36obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o
36obj-$(CONFIG_ATM_LANAI) += lanai.o 37obj-$(CONFIG_ATM_LANAI) += lanai.o
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
new file mode 100644
index 000000000000..d15c194be44a
--- /dev/null
+++ b/drivers/atm/adummy.c
@@ -0,0 +1,168 @@
1/*
2 * adummy.c: a dummy ATM driver
3 */
4
5#include <linux/config.h>
6#include <linux/module.h>
7#include <linux/version.h>
8#include <linux/kernel.h>
9#include <linux/skbuff.h>
10#include <linux/pci.h>
11#include <linux/errno.h>
12#include <linux/types.h>
13#include <linux/string.h>
14#include <linux/delay.h>
15#include <linux/init.h>
16#include <linux/mm.h>
17#include <linux/sched.h>
18#include <linux/timer.h>
19#include <linux/interrupt.h>
20#include <asm/io.h>
21#include <asm/byteorder.h>
22#include <asm/uaccess.h>
23
24#include <linux/atmdev.h>
25#include <linux/atm.h>
26#include <linux/sonet.h>
27
28/* version definition */
29
30#define DRV_VERSION "1.0"
31
32#define DEV_LABEL "adummy"
33
34#define ADUMMY_DEV(dev) ((struct adummy_dev *) (dev)->dev_data)
35
36struct adummy_dev {
37 struct atm_dev *atm_dev;
38
39 struct list_head entry;
40};
41
42/* globals */
43
44static LIST_HEAD(adummy_devs);
45
46static int __init
47adummy_start(struct atm_dev *dev)
48{
49 dev->ci_range.vpi_bits = 4;
50 dev->ci_range.vci_bits = 12;
51
52 return 0;
53}
54
55static int
56adummy_open(struct atm_vcc *vcc)
57{
58 short vpi = vcc->vpi;
59 int vci = vcc->vci;
60
61 if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC)
62 return 0;
63
64 set_bit(ATM_VF_ADDR, &vcc->flags);
65 set_bit(ATM_VF_READY, &vcc->flags);
66
67 return 0;
68}
69
70static void
71adummy_close(struct atm_vcc *vcc)
72{
73 clear_bit(ATM_VF_READY, &vcc->flags);
74 clear_bit(ATM_VF_ADDR, &vcc->flags);
75}
76
77static int
78adummy_send(struct atm_vcc *vcc, struct sk_buff *skb)
79{
80 if (vcc->pop)
81 vcc->pop(vcc, skb);
82 else
83 dev_kfree_skb_any(skb);
84 atomic_inc(&vcc->stats->tx);
85
86 return 0;
87}
88
89static int
90adummy_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
91{
92 int left = *pos;
93
94 if (!left--)
95 return sprintf(page, "version %s\n", DRV_VERSION);
96
97 return 0;
98}
99
100static struct atmdev_ops adummy_ops =
101{
102 .open = adummy_open,
103 .close = adummy_close,
104 .send = adummy_send,
105 .proc_read = adummy_proc_read,
106 .owner = THIS_MODULE
107};
108
109static int __init adummy_init(void)
110{
111 struct atm_dev *atm_dev;
112 struct adummy_dev *adummy_dev;
113 int err = 0;
114
115 printk(KERN_ERR "adummy: version %s\n", DRV_VERSION);
116
117 adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
118 GFP_KERNEL);
119 if (!adummy_dev) {
120 printk(KERN_ERR DEV_LABEL ": kmalloc() failed\n");
121 err = -ENOMEM;
122 goto out;
123 }
124 memset(adummy_dev, 0, sizeof(struct adummy_dev));
125
126 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, 0);
127 if (!atm_dev) {
128 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n");
129 err = -ENODEV;
130 goto out_kfree;
131 }
132
133 adummy_dev->atm_dev = atm_dev;
134 atm_dev->dev_data = adummy_dev;
135
136 if (adummy_start(atm_dev)) {
137 printk(KERN_ERR DEV_LABEL ": adummy_start() failed\n");
138 err = -ENODEV;
139 goto out_unregister;
140 }
141
142 list_add(&adummy_dev->entry, &adummy_devs);
143out:
144 return err;
145
146out_unregister:
147 atm_dev_deregister(atm_dev);
148out_kfree:
149 kfree(adummy_dev);
150 goto out;
151}
152
153static void __exit adummy_cleanup(void)
154{
155 struct adummy_dev *adummy_dev, *next;
156
157 list_for_each_entry_safe(adummy_dev, next, &adummy_devs, entry) {
158 atm_dev_deregister(adummy_dev->atm_dev);
159 kfree(adummy_dev);
160 }
161}
162
163module_init(adummy_init);
164module_exit(adummy_cleanup);
165
166MODULE_AUTHOR("chas williams <chas@cmf.nrl.navy.mil>");
167MODULE_DESCRIPTION("dummy ATM driver");
168MODULE_LICENSE("GPL");
diff --git a/drivers/atm/atmdev_init.c b/drivers/atm/atmdev_init.c
deleted file mode 100644
index 0e09e5c28e3f..000000000000
--- a/drivers/atm/atmdev_init.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/* drivers/atm/atmdev_init.c - ATM device driver initialization */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#include <linux/config.h>
7#include <linux/init.h>
8
9
10#ifdef CONFIG_ATM_ZATM
11extern int zatm_detect(void);
12#endif
13#ifdef CONFIG_ATM_AMBASSADOR
14extern int amb_detect(void);
15#endif
16#ifdef CONFIG_ATM_HORIZON
17extern int hrz_detect(void);
18#endif
19#ifdef CONFIG_ATM_FORE200E
20extern int fore200e_detect(void);
21#endif
22#ifdef CONFIG_ATM_LANAI
23extern int lanai_detect(void);
24#endif
25
26
27/*
28 * For historical reasons, atmdev_init returns the number of devices found.
29 * Note that some detections may not go via atmdev_init (e.g. eni.c), so this
30 * number is meaningless.
31 */
32
33int __init atmdev_init(void)
34{
35 int devs;
36
37 devs = 0;
38#ifdef CONFIG_ATM_ZATM
39 devs += zatm_detect();
40#endif
41#ifdef CONFIG_ATM_AMBASSADOR
42 devs += amb_detect();
43#endif
44#ifdef CONFIG_ATM_HORIZON
45 devs += hrz_detect();
46#endif
47#ifdef CONFIG_ATM_FORE200E
48 devs += fore200e_detect();
49#endif
50#ifdef CONFIG_ATM_LANAI
51 devs += lanai_detect();
52#endif
53 return devs;
54}
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 57f1810fdccd..fc518d85543d 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -246,10 +246,6 @@ static void atmtcp_c_close(struct atm_vcc *vcc)
246{ 246{
247 struct atm_dev *atmtcp_dev; 247 struct atm_dev *atmtcp_dev;
248 struct atmtcp_dev_data *dev_data; 248 struct atmtcp_dev_data *dev_data;
249 struct sock *s;
250 struct hlist_node *node;
251 struct atm_vcc *walk;
252 int i;
253 249
254 atmtcp_dev = (struct atm_dev *) vcc->dev_data; 250 atmtcp_dev = (struct atm_dev *) vcc->dev_data;
255 dev_data = PRIV(atmtcp_dev); 251 dev_data = PRIV(atmtcp_dev);
@@ -257,20 +253,8 @@ static void atmtcp_c_close(struct atm_vcc *vcc)
257 if (dev_data->persist) return; 253 if (dev_data->persist) return;
258 atmtcp_dev->dev_data = NULL; 254 atmtcp_dev->dev_data = NULL;
259 kfree(dev_data); 255 kfree(dev_data);
260 shutdown_atm_dev(atmtcp_dev); 256 atm_dev_deregister(atmtcp_dev);
261 vcc->dev_data = NULL; 257 vcc->dev_data = NULL;
262 read_lock(&vcc_sklist_lock);
263 for(i = 0; i < VCC_HTABLE_SIZE; ++i) {
264 struct hlist_head *head = &vcc_hash[i];
265
266 sk_for_each(s, node, head) {
267 walk = atm_sk(s);
268 if (walk->dev != atmtcp_dev)
269 continue;
270 wake_up(s->sk_sleep);
271 }
272 }
273 read_unlock(&vcc_sklist_lock);
274 module_put(THIS_MODULE); 258 module_put(THIS_MODULE);
275} 259}
276 260
@@ -450,7 +434,7 @@ static int atmtcp_remove_persistent(int itf)
450 if (PRIV(dev)->vcc) return 0; 434 if (PRIV(dev)->vcc) return 0;
451 kfree(dev_data); 435 kfree(dev_data);
452 atm_dev_put(dev); 436 atm_dev_put(dev);
453 shutdown_atm_dev(dev); 437 atm_dev_deregister(dev);
454 return 0; 438 return 0;
455} 439}
456 440
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 51ec14787293..69f4c7ce9a63 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -39,7 +39,7 @@
39 * o lanai_change_qos() isn't written yet 39 * o lanai_change_qos() isn't written yet
40 * 40 *
41 * o There aren't any ioctl's yet -- I'd like to eventually support 41 * o There aren't any ioctl's yet -- I'd like to eventually support
42 * setting loopback and LED modes that way. (see lanai_ioctl) 42 * setting loopback and LED modes that way.
43 * 43 *
44 * o If the segmentation engine or DMA gets shut down we should restart 44 * o If the segmentation engine or DMA gets shut down we should restart
45 * card as per section 17.0i. (see lanai_reset) 45 * card as per section 17.0i. (see lanai_reset)
@@ -305,7 +305,7 @@ struct lanai_dev {
305 * vci with their bit set 305 * vci with their bit set
306 */ 306 */
307static void vci_bitfield_iterate(struct lanai_dev *lanai, 307static void vci_bitfield_iterate(struct lanai_dev *lanai,
308 /*const*/ unsigned long *lp, 308 const unsigned long *lp,
309 void (*func)(struct lanai_dev *,vci_t vci)) 309 void (*func)(struct lanai_dev *,vci_t vci))
310{ 310{
311 vci_t vci = find_first_bit(lp, NUM_VCI); 311 vci_t vci = find_first_bit(lp, NUM_VCI);
@@ -951,7 +951,7 @@ static int __devinit eeprom_read(struct lanai_dev *lanai)
951/* read a big-endian 4-byte value out of eeprom */ 951/* read a big-endian 4-byte value out of eeprom */
952static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address) 952static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address)
953{ 953{
954 return be32_to_cpup((u32 *) (&lanai->eeprom[address])); 954 return be32_to_cpup((const u32 *) &lanai->eeprom[address]);
955} 955}
956 956
957/* Checksum/validate EEPROM contents */ 957/* Checksum/validate EEPROM contents */
@@ -1160,7 +1160,7 @@ static inline int vcc_tx_space(const struct lanai_vcc *lvcc, int endptr)
1160} 1160}
1161 1161
1162/* test if VCC is currently backlogged */ 1162/* test if VCC is currently backlogged */
1163static inline int vcc_is_backlogged(/*const*/ struct lanai_vcc *lvcc) 1163static inline int vcc_is_backlogged(const struct lanai_vcc *lvcc)
1164{ 1164{
1165 return !skb_queue_empty(&lvcc->tx.backlog); 1165 return !skb_queue_empty(&lvcc->tx.backlog);
1166} 1166}
@@ -1395,7 +1395,8 @@ static void vcc_rx_aal5(struct lanai_vcc *lvcc, int endptr)
1395{ 1395{
1396 int size; 1396 int size;
1397 struct sk_buff *skb; 1397 struct sk_buff *skb;
1398 /*const*/ u32 *x, *end = &lvcc->rx.buf.start[endptr * 4]; 1398 const u32 *x;
1399 u32 *end = &lvcc->rx.buf.start[endptr * 4];
1399 int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr); 1400 int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr);
1400 if (n < 0) 1401 if (n < 0)
1401 n += lanai_buf_size(&lvcc->rx.buf); 1402 n += lanai_buf_size(&lvcc->rx.buf);
@@ -2111,7 +2112,7 @@ static int lanai_normalize_ci(struct lanai_dev *lanai,
2111 * shifted by that much as we compute 2112 * shifted by that much as we compute
2112 * 2113 *
2113 */ 2114 */
2114static int pcr_to_cbricg(/*const*/ struct atm_qos *qos) 2115static int pcr_to_cbricg(const struct atm_qos *qos)
2115{ 2116{
2116 int rounddown = 0; /* 1 = Round PCR down, i.e. round ICG _up_ */ 2117 int rounddown = 0; /* 1 = Round PCR down, i.e. round ICG _up_ */
2117 int x, icg, pcr = atm_pcr_goal(&qos->txtp); 2118 int x, icg, pcr = atm_pcr_goal(&qos->txtp);
@@ -2434,93 +2435,6 @@ static int lanai_open(struct atm_vcc *atmvcc)
2434 return result; 2435 return result;
2435} 2436}
2436 2437
2437#if 0
2438/* ioctl operations for card */
2439/* NOTE: these are all DEBUGGING ONLY currently */
2440static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg)
2441{
2442 int result = 0;
2443 struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;
2444 switch(cmd) {
2445 case 2106275:
2446 shutdown_atm_dev(atmdev);
2447 return 0;
2448 case 2200000: {
2449 unsigned long flags;
2450 spin_lock_irqsave(&lanai->servicelock, flags);
2451 run_service(lanai);
2452 spin_unlock_irqrestore(&lanai->servicelock, flags);
2453 return 0; }
2454 case 2200002:
2455 get_statistics(lanai);
2456 return 0;
2457 case 2200003: {
2458 unsigned int i;
2459 for (i = 0; i <= 0x5C ; i += 4) {
2460 if (i==0x48) /* Write-only butt reg */
2461 continue;
2462 printk(KERN_CRIT DEV_LABEL " 0x%02X: "
2463 "0x%08X\n", i,
2464 (unsigned int) readl(lanai->base + i));
2465 barrier(); mb();
2466 pcistatus_check(lanai, 0);
2467 barrier(); mb();
2468 }
2469 return 0; }
2470 case 2200004: {
2471 u8 b;
2472 u16 w;
2473 u32 dw;
2474 struct pci_dev *pci = lanai->pci;
2475 (void) pci_read_config_word(pci, PCI_VENDOR_ID, &w);
2476 DPRINTK("vendor = 0x%X\n", (unsigned int) w);
2477 (void) pci_read_config_word(pci, PCI_DEVICE_ID, &w);
2478 DPRINTK("device = 0x%X\n", (unsigned int) w);
2479 (void) pci_read_config_word(pci, PCI_COMMAND, &w);
2480 DPRINTK("command = 0x%X\n", (unsigned int) w);
2481 (void) pci_read_config_word(pci, PCI_STATUS, &w);
2482 DPRINTK("status = 0x%X\n", (unsigned int) w);
2483 (void) pci_read_config_dword(pci,
2484 PCI_CLASS_REVISION, &dw);
2485 DPRINTK("class/revision = 0x%X\n", (unsigned int) dw);
2486 (void) pci_read_config_byte(pci,
2487 PCI_CACHE_LINE_SIZE, &b);
2488 DPRINTK("cache line size = 0x%X\n", (unsigned int) b);
2489 (void) pci_read_config_byte(pci, PCI_LATENCY_TIMER, &b);
2490 DPRINTK("latency = %d (0x%X)\n",
2491 (int) b, (unsigned int) b);
2492 (void) pci_read_config_byte(pci, PCI_HEADER_TYPE, &b);
2493 DPRINTK("header type = 0x%X\n", (unsigned int) b);
2494 (void) pci_read_config_byte(pci, PCI_BIST, &b);
2495 DPRINTK("bist = 0x%X\n", (unsigned int) b);
2496 /* skipping a few here */
2497 (void) pci_read_config_byte(pci,
2498 PCI_INTERRUPT_LINE, &b);
2499 DPRINTK("pci_int_line = 0x%X\n", (unsigned int) b);
2500 (void) pci_read_config_byte(pci,
2501 PCI_INTERRUPT_PIN, &b);
2502 DPRINTK("pci_int_pin = 0x%X\n", (unsigned int) b);
2503 (void) pci_read_config_byte(pci, PCI_MIN_GNT, &b);
2504 DPRINTK("min_gnt = 0x%X\n", (unsigned int) b);
2505 (void) pci_read_config_byte(pci, PCI_MAX_LAT, &b);
2506 DPRINTK("max_lat = 0x%X\n", (unsigned int) b); }
2507 return 0;
2508#ifdef USE_POWERDOWN
2509 case 2200005:
2510 DPRINTK("Coming out of powerdown\n");
2511 lanai->conf1 &= ~CONFIG1_POWERDOWN;
2512 conf1_write(lanai);
2513 return 0;
2514#endif
2515 default:
2516 result = -ENOIOCTLCMD;
2517 }
2518 return result;
2519}
2520#else /* !0 */
2521#define lanai_ioctl NULL
2522#endif /* 0 */
2523
2524static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb) 2438static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb)
2525{ 2439{
2526 struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data; 2440 struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data;
@@ -2678,7 +2592,6 @@ static const struct atmdev_ops ops = {
2678 .dev_close = lanai_dev_close, 2592 .dev_close = lanai_dev_close,
2679 .open = lanai_open, 2593 .open = lanai_open,
2680 .close = lanai_close, 2594 .close = lanai_close,
2681 .ioctl = lanai_ioctl,
2682 .getsockopt = NULL, 2595 .getsockopt = NULL,
2683 .setsockopt = NULL, 2596 .setsockopt = NULL,
2684 .send = lanai_send, 2597 .send = lanai_send,
@@ -2760,6 +2673,7 @@ static void __exit lanai_module_exit(void)
2760 * gone, so there isn't much to do 2673 * gone, so there isn't much to do
2761 */ 2674 */
2762 DPRINTK("cleanup_module()\n"); 2675 DPRINTK("cleanup_module()\n");
2676 pci_unregister_driver(&lanai_driver);
2763} 2677}
2764 2678
2765module_init(lanai_module_init); 2679module_init(lanai_module_init);
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
index bdd168d88f49..bd958d69a2ac 100644
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -432,7 +432,10 @@ int drm_addctx(struct inode *inode, struct file *filp,
432 432
433 if (ctx.handle != DRM_KERNEL_CONTEXT) { 433 if (ctx.handle != DRM_KERNEL_CONTEXT) {
434 if (dev->driver->context_ctor) 434 if (dev->driver->context_ctor)
435 dev->driver->context_ctor(dev, ctx.handle); 435 if (!dev->driver->context_ctor(dev, ctx.handle)) {
436 DRM_DEBUG( "Running out of ctxs or memory.\n");
437 return -ENOMEM;
438 }
436 } 439 }
437 440
438 ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST); 441 ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST);
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index 4be59dbb78c4..1ba072630361 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -193,6 +193,7 @@ static const u8 W83792D_REG_LEVELS[3][4] = {
193 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */ 193 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */
194}; 194};
195 195
196#define W83792D_REG_GPIO_EN 0x1A
196#define W83792D_REG_CONFIG 0x40 197#define W83792D_REG_CONFIG 0x40
197#define W83792D_REG_VID_FANDIV 0x47 198#define W83792D_REG_VID_FANDIV 0x47
198#define W83792D_REG_CHIPID 0x49 199#define W83792D_REG_CHIPID 0x49
@@ -257,7 +258,7 @@ DIV_TO_REG(long val)
257{ 258{
258 int i; 259 int i;
259 val = SENSORS_LIMIT(val, 1, 128) >> 1; 260 val = SENSORS_LIMIT(val, 1, 128) >> 1;
260 for (i = 0; i < 6; i++) { 261 for (i = 0; i < 7; i++) {
261 if (val == 0) 262 if (val == 0)
262 break; 263 break;
263 val >>= 1; 264 val >>= 1;
@@ -1282,8 +1283,8 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1282 w83792d_init_client(new_client); 1283 w83792d_init_client(new_client);
1283 1284
1284 /* A few vars need to be filled upon startup */ 1285 /* A few vars need to be filled upon startup */
1285 for (i = 1; i <= 7; i++) { 1286 for (i = 0; i < 7; i++) {
1286 data->fan_min[i - 1] = w83792d_read_value(new_client, 1287 data->fan_min[i] = w83792d_read_value(new_client,
1287 W83792D_REG_FAN_MIN[i]); 1288 W83792D_REG_FAN_MIN[i]);
1288 } 1289 }
1289 1290
@@ -1306,10 +1307,20 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1306 device_create_file_fan(new_client, 1); 1307 device_create_file_fan(new_client, 1);
1307 device_create_file_fan(new_client, 2); 1308 device_create_file_fan(new_client, 2);
1308 device_create_file_fan(new_client, 3); 1309 device_create_file_fan(new_client, 3);
1309 device_create_file_fan(new_client, 4); 1310
1310 device_create_file_fan(new_client, 5); 1311 /* Read GPIO enable register to check if pins for fan 4,5 are used as
1311 device_create_file_fan(new_client, 6); 1312 GPIO */
1312 device_create_file_fan(new_client, 7); 1313 val1 = w83792d_read_value(new_client, W83792D_REG_GPIO_EN);
1314 if (!(val1 & 0x40))
1315 device_create_file_fan(new_client, 4);
1316 if (!(val1 & 0x20))
1317 device_create_file_fan(new_client, 5);
1318
1319 val1 = w83792d_read_value(new_client, W83792D_REG_PIN);
1320 if (val1 & 0x40)
1321 device_create_file_fan(new_client, 6);
1322 if (val1 & 0x04)
1323 device_create_file_fan(new_client, 7);
1313 1324
1314 device_create_file_temp1(new_client); /* Temp1 */ 1325 device_create_file_temp1(new_client); /* Temp1 */
1315 device_create_file_temp_add(new_client, 2); /* Temp2 */ 1326 device_create_file_temp_add(new_client, 2); /* Temp2 */
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 74022316fc63..65c2ec5c421b 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -91,9 +91,9 @@ static int mfcounter = 0;
91 * Public data... 91 * Public data...
92 */ 92 */
93int mpt_lan_index = -1; 93int mpt_lan_index = -1;
94static int mpt_stm_index = -1; 94int mpt_stm_index = -1;
95 95
96static struct proc_dir_entry *mpt_proc_root_dir; 96struct proc_dir_entry *mpt_proc_root_dir;
97 97
98#define WHOINIT_UNKNOWN 0xAA 98#define WHOINIT_UNKNOWN 0xAA
99 99
@@ -6271,6 +6271,7 @@ EXPORT_SYMBOL(mpt_resume);
6271EXPORT_SYMBOL(mpt_suspend); 6271EXPORT_SYMBOL(mpt_suspend);
6272#endif 6272#endif
6273EXPORT_SYMBOL(ioc_list); 6273EXPORT_SYMBOL(ioc_list);
6274EXPORT_SYMBOL(mpt_proc_root_dir);
6274EXPORT_SYMBOL(mpt_register); 6275EXPORT_SYMBOL(mpt_register);
6275EXPORT_SYMBOL(mpt_deregister); 6276EXPORT_SYMBOL(mpt_deregister);
6276EXPORT_SYMBOL(mpt_event_register); 6277EXPORT_SYMBOL(mpt_event_register);
@@ -6288,6 +6289,7 @@ EXPORT_SYMBOL(mpt_verify_adapter);
6288EXPORT_SYMBOL(mpt_GetIocState); 6289EXPORT_SYMBOL(mpt_GetIocState);
6289EXPORT_SYMBOL(mpt_print_ioc_summary); 6290EXPORT_SYMBOL(mpt_print_ioc_summary);
6290EXPORT_SYMBOL(mpt_lan_index); 6291EXPORT_SYMBOL(mpt_lan_index);
6292EXPORT_SYMBOL(mpt_stm_index);
6291EXPORT_SYMBOL(mpt_HardResetHandler); 6293EXPORT_SYMBOL(mpt_HardResetHandler);
6292EXPORT_SYMBOL(mpt_config); 6294EXPORT_SYMBOL(mpt_config);
6293EXPORT_SYMBOL(mpt_toolbox); 6295EXPORT_SYMBOL(mpt_toolbox);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 8ad277a9afa1..5f5b3fb5b4d7 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -1006,8 +1006,10 @@ extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
1006 * Public data decl's... 1006 * Public data decl's...
1007 */ 1007 */
1008extern struct list_head ioc_list; 1008extern struct list_head ioc_list;
1009extern struct proc_dir_entry *mpt_proc_root_dir;
1009 1010
1010extern int mpt_lan_index; /* needed by mptlan.c */ 1011extern int mpt_lan_index; /* needed by mptlan.c */
1012extern int mpt_stm_index; /* needed by mptstm.c */
1011 1013
1012/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1014/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1013#endif /* } __KERNEL__ */ 1015#endif /* } __KERNEL__ */
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 143f01a4c170..69c04945591f 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (C) 2000 Red Hat. GPL'd 5 * (C) 2000 Red Hat. GPL'd
6 * 6 *
7 * $Id: cfi_cmdset_0001.c,v 1.185 2005/11/07 11:14:22 gleixner Exp $ 7 * $Id: cfi_cmdset_0001.c,v 1.186 2005/11/23 22:07:52 nico Exp $
8 * 8 *
9 * 9 *
10 * 10/10/2000 Nicolas Pitre <nico@cam.org> 10 * 10/10/2000 Nicolas Pitre <nico@cam.org>
@@ -644,9 +644,8 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
644 * 644 *
645 * - contension arbitration is handled in the owner's context. 645 * - contension arbitration is handled in the owner's context.
646 * 646 *
647 * The 'shared' struct can be read when its lock is taken. 647 * The 'shared' struct can be read and/or written only when
648 * However any writes to it can only be made when the current 648 * its lock is taken.
649 * owner's lock is also held.
650 */ 649 */
651 struct flchip_shared *shared = chip->priv; 650 struct flchip_shared *shared = chip->priv;
652 struct flchip *contender; 651 struct flchip *contender;
@@ -675,14 +674,13 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
675 } 674 }
676 timeo = jiffies + HZ; 675 timeo = jiffies + HZ;
677 spin_lock(&shared->lock); 676 spin_lock(&shared->lock);
677 spin_unlock(contender->mutex);
678 } 678 }
679 679
680 /* We now own it */ 680 /* We now own it */
681 shared->writing = chip; 681 shared->writing = chip;
682 if (mode == FL_ERASING) 682 if (mode == FL_ERASING)
683 shared->erasing = chip; 683 shared->erasing = chip;
684 if (contender && contender != chip)
685 spin_unlock(contender->mutex);
686 spin_unlock(&shared->lock); 684 spin_unlock(&shared->lock);
687 } 685 }
688 686
diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
index 90eb30e06b7c..e636aa86bc24 100644
--- a/drivers/mtd/chips/cfi_probe.c
+++ b/drivers/mtd/chips/cfi_probe.c
@@ -1,7 +1,7 @@
1/* 1/*
2 Common Flash Interface probe code. 2 Common Flash Interface probe code.
3 (C) 2000 Red Hat. GPL'd. 3 (C) 2000 Red Hat. GPL'd.
4 $Id: cfi_probe.c,v 1.84 2005/11/07 11:14:23 gleixner Exp $ 4 $Id: cfi_probe.c,v 1.86 2005/11/29 14:48:31 gleixner Exp $
5*/ 5*/
6 6
7#include <linux/config.h> 7#include <linux/config.h>
@@ -230,8 +230,8 @@ static int __xipram cfi_chip_setup(struct map_info *map,
230 cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL); 230 cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
231 cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); 231 cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
232 cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); 232 cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
233 cfi->mfr = cfi_read_query(map, base); 233 cfi->mfr = cfi_read_query16(map, base);
234 cfi->id = cfi_read_query(map, base + ofs_factor); 234 cfi->id = cfi_read_query16(map, base + ofs_factor);
235 235
236 /* Put it back into Read Mode */ 236 /* Put it back into Read Mode */
237 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); 237 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
@@ -426,7 +426,7 @@ static struct mtd_chip_driver cfi_chipdrv = {
426 .module = THIS_MODULE 426 .module = THIS_MODULE
427}; 427};
428 428
429int __init cfi_probe_init(void) 429static int __init cfi_probe_init(void)
430{ 430{
431 register_mtd_chip_driver(&cfi_chipdrv); 431 register_mtd_chip_driver(&cfi_chipdrv);
432 return 0; 432 return 0;
diff --git a/drivers/mtd/chips/sharp.c b/drivers/mtd/chips/sharp.c
index 2d26bdef82d5..36f61a6a766e 100644
--- a/drivers/mtd/chips/sharp.c
+++ b/drivers/mtd/chips/sharp.c
@@ -4,7 +4,7 @@
4 * Copyright 2000,2001 David A. Schleef <ds@schleef.org> 4 * Copyright 2000,2001 David A. Schleef <ds@schleef.org>
5 * 2000,2001 Lineo, Inc. 5 * 2000,2001 Lineo, Inc.
6 * 6 *
7 * $Id: sharp.c,v 1.16 2005/11/07 11:14:23 gleixner Exp $ 7 * $Id: sharp.c,v 1.17 2005/11/29 14:28:28 gleixner Exp $
8 * 8 *
9 * Devices supported: 9 * Devices supported:
10 * LH28F016SCT Symmetrical block flash memory, 2Mx8 10 * LH28F016SCT Symmetrical block flash memory, 2Mx8
@@ -160,22 +160,28 @@ struct mtd_info *sharp_probe(struct map_info *map)
160 return mtd; 160 return mtd;
161} 161}
162 162
163static inline void sharp_send_cmd(struct map_info *map, unsigned long cmd, unsigned long adr)
164{
165 map_word map_cmd;
166 map_cmd.x[0] = cmd;
167 map_write(map, map_cmd, adr);
168}
169
163static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) 170static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
164{ 171{
165 unsigned long tmp; 172 map_word tmp, read0, read4;
166 unsigned long base = 0; 173 unsigned long base = 0;
167 u32 read0, read4;
168 int width = 4; 174 int width = 4;
169 175
170 tmp = map_read32(map, base+0); 176 tmp = map_read(map, base+0);
171 177
172 map_write32(map, CMD_READ_ID, base+0); 178 sharp_send_cmd(map, CMD_READ_ID, base+0);
173 179
174 read0=map_read32(map, base+0); 180 read0 = map_read(map, base+0);
175 read4=map_read32(map, base+4); 181 read4 = map_read(map, base+4);
176 if(read0 == 0x89898989){ 182 if(read0.x[0] == 0x89898989){
177 printk("Looks like sharp flash\n"); 183 printk("Looks like sharp flash\n");
178 switch(read4){ 184 switch(read4.x[0]){
179 case 0xaaaaaaaa: 185 case 0xaaaaaaaa:
180 case 0xa0a0a0a0: 186 case 0xa0a0a0a0:
181 /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/ 187 /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/
@@ -197,16 +203,16 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
197 return width; 203 return width;
198#endif 204#endif
199 default: 205 default:
200 printk("Sort-of looks like sharp flash, 0x%08x 0x%08x\n", 206 printk("Sort-of looks like sharp flash, 0x%08lx 0x%08lx\n",
201 read0,read4); 207 read0.x[0], read4.x[0]);
202 } 208 }
203 }else if((map_read32(map, base+0) == CMD_READ_ID)){ 209 }else if((map_read(map, base+0).x[0] == CMD_READ_ID)){
204 /* RAM, probably */ 210 /* RAM, probably */
205 printk("Looks like RAM\n"); 211 printk("Looks like RAM\n");
206 map_write32(map, tmp, base+0); 212 map_write(map, tmp, base+0);
207 }else{ 213 }else{
208 printk("Doesn't look like sharp flash, 0x%08x 0x%08x\n", 214 printk("Doesn't look like sharp flash, 0x%08lx 0x%08lx\n",
209 read0,read4); 215 read0.x[0], read4.x[0]);
210 } 216 }
211 217
212 return 0; 218 return 0;
@@ -215,7 +221,8 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
215/* This function returns with the chip->mutex lock held. */ 221/* This function returns with the chip->mutex lock held. */
216static int sharp_wait(struct map_info *map, struct flchip *chip) 222static int sharp_wait(struct map_info *map, struct flchip *chip)
217{ 223{
218 int status, i; 224 int i;
225 map_word status;
219 unsigned long timeo = jiffies + HZ; 226 unsigned long timeo = jiffies + HZ;
220 DECLARE_WAITQUEUE(wait, current); 227 DECLARE_WAITQUEUE(wait, current);
221 int adr = 0; 228 int adr = 0;
@@ -225,12 +232,12 @@ retry:
225 232
226 switch(chip->state){ 233 switch(chip->state){
227 case FL_READY: 234 case FL_READY:
228 map_write32(map,CMD_READ_STATUS,adr); 235 sharp_send_cmd(map, CMD_READ_STATUS, adr);
229 chip->state = FL_STATUS; 236 chip->state = FL_STATUS;
230 case FL_STATUS: 237 case FL_STATUS:
231 for(i=0;i<100;i++){ 238 for(i=0;i<100;i++){
232 status = map_read32(map,adr); 239 status = map_read(map, adr);
233 if((status & SR_READY)==SR_READY) 240 if((status.x[0] & SR_READY)==SR_READY)
234 break; 241 break;
235 udelay(1); 242 udelay(1);
236 } 243 }
@@ -254,7 +261,7 @@ retry:
254 goto retry; 261 goto retry;
255 } 262 }
256 263
257 map_write32(map,CMD_RESET, adr); 264 sharp_send_cmd(map, CMD_RESET, adr);
258 265
259 chip->state = FL_READY; 266 chip->state = FL_READY;
260 267
@@ -351,37 +358,39 @@ static int sharp_write_oneword(struct map_info *map, struct flchip *chip,
351 int timeo; 358 int timeo;
352 int try; 359 int try;
353 int i; 360 int i;
354 int status = 0; 361 map_word data, status;
355 362
363 status.x[0] = 0;
356 ret = sharp_wait(map,chip); 364 ret = sharp_wait(map,chip);
357 365
358 for(try=0;try<10;try++){ 366 for(try=0;try<10;try++){
359 map_write32(map,CMD_BYTE_WRITE,adr); 367 sharp_send_cmd(map, CMD_BYTE_WRITE, adr);
360 /* cpu_to_le32 -> hack to fix the writel be->le conversion */ 368 /* cpu_to_le32 -> hack to fix the writel be->le conversion */
361 map_write32(map,cpu_to_le32(datum),adr); 369 data.x[0] = cpu_to_le32(datum);
370 map_write(map, data, adr);
362 371
363 chip->state = FL_WRITING; 372 chip->state = FL_WRITING;
364 373
365 timeo = jiffies + (HZ/2); 374 timeo = jiffies + (HZ/2);
366 375
367 map_write32(map,CMD_READ_STATUS,adr); 376 sharp_send_cmd(map, CMD_READ_STATUS, adr);
368 for(i=0;i<100;i++){ 377 for(i=0;i<100;i++){
369 status = map_read32(map,adr); 378 status = map_read(map, adr);
370 if((status & SR_READY)==SR_READY) 379 if((status.x[0] & SR_READY) == SR_READY)
371 break; 380 break;
372 } 381 }
373 if(i==100){ 382 if(i==100){
374 printk("sharp: timed out writing\n"); 383 printk("sharp: timed out writing\n");
375 } 384 }
376 385
377 if(!(status&SR_ERRORS)) 386 if(!(status.x[0] & SR_ERRORS))
378 break; 387 break;
379 388
380 printk("sharp: error writing byte at addr=%08lx status=%08x\n",adr,status); 389 printk("sharp: error writing byte at addr=%08lx status=%08lx\n", adr, status.x[0]);
381 390
382 map_write32(map,CMD_CLEAR_STATUS,adr); 391 sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);
383 } 392 }
384 map_write32(map,CMD_RESET,adr); 393 sharp_send_cmd(map, CMD_RESET, adr);
385 chip->state = FL_READY; 394 chip->state = FL_READY;
386 395
387 wake_up(&chip->wq); 396 wake_up(&chip->wq);
@@ -434,18 +443,18 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip,
434{ 443{
435 int ret; 444 int ret;
436 unsigned long timeo; 445 unsigned long timeo;
437 int status; 446 map_word status;
438 DECLARE_WAITQUEUE(wait, current); 447 DECLARE_WAITQUEUE(wait, current);
439 448
440 map_write32(map,CMD_READ_STATUS,adr); 449 sharp_send_cmd(map, CMD_READ_STATUS, adr);
441 status = map_read32(map,adr); 450 status = map_read(map, adr);
442 451
443 timeo = jiffies + HZ; 452 timeo = jiffies + HZ;
444 453
445 while(time_before(jiffies, timeo)){ 454 while(time_before(jiffies, timeo)){
446 map_write32(map,CMD_READ_STATUS,adr); 455 sharp_send_cmd(map, CMD_READ_STATUS, adr);
447 status = map_read32(map,adr); 456 status = map_read(map, adr);
448 if((status & SR_READY)==SR_READY){ 457 if((status.x[0] & SR_READY)==SR_READY){
449 ret = 0; 458 ret = 0;
450 goto out; 459 goto out;
451 } 460 }
@@ -476,7 +485,7 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip,
476{ 485{
477 int ret; 486 int ret;
478 //int timeo; 487 //int timeo;
479 int status; 488 map_word status;
480 //int i; 489 //int i;
481 490
482//printk("sharp_erase_oneblock()\n"); 491//printk("sharp_erase_oneblock()\n");
@@ -486,26 +495,26 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip,
486 sharp_unlock_oneblock(map,chip,adr); 495 sharp_unlock_oneblock(map,chip,adr);
487#endif 496#endif
488 497
489 map_write32(map,CMD_BLOCK_ERASE_1,adr); 498 sharp_send_cmd(map, CMD_BLOCK_ERASE_1, adr);
490 map_write32(map,CMD_BLOCK_ERASE_2,adr); 499 sharp_send_cmd(map, CMD_BLOCK_ERASE_2, adr);
491 500
492 chip->state = FL_ERASING; 501 chip->state = FL_ERASING;
493 502
494 ret = sharp_do_wait_for_ready(map,chip,adr); 503 ret = sharp_do_wait_for_ready(map,chip,adr);
495 if(ret<0)return ret; 504 if(ret<0)return ret;
496 505
497 map_write32(map,CMD_READ_STATUS,adr); 506 sharp_send_cmd(map, CMD_READ_STATUS, adr);
498 status = map_read32(map,adr); 507 status = map_read(map, adr);
499 508
500 if(!(status&SR_ERRORS)){ 509 if(!(status.x[0] & SR_ERRORS)){
501 map_write32(map,CMD_RESET,adr); 510 sharp_send_cmd(map, CMD_RESET, adr);
502 chip->state = FL_READY; 511 chip->state = FL_READY;
503 //spin_unlock_bh(chip->mutex); 512 //spin_unlock_bh(chip->mutex);
504 return 0; 513 return 0;
505 } 514 }
506 515
507 printk("sharp: error erasing block at addr=%08lx status=%08x\n",adr,status); 516 printk("sharp: error erasing block at addr=%08lx status=%08lx\n", adr, status.x[0]);
508 map_write32(map,CMD_CLEAR_STATUS,adr); 517 sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);
509 518
510 //spin_unlock_bh(chip->mutex); 519 //spin_unlock_bh(chip->mutex);
511 520
@@ -517,20 +526,20 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip,
517 unsigned long adr) 526 unsigned long adr)
518{ 527{
519 int i; 528 int i;
520 int status; 529 map_word status;
521 530
522 map_write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr); 531 sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_1, adr);
523 map_write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr); 532 sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_2, adr);
524 533
525 udelay(100); 534 udelay(100);
526 535
527 status = map_read32(map,adr); 536 status = map_read(map, adr);
528 printk("status=%08x\n",status); 537 printk("status=%08lx\n", status.x[0]);
529 538
530 for(i=0;i<1000;i++){ 539 for(i=0;i<1000;i++){
531 //map_write32(map,CMD_READ_STATUS,adr); 540 //sharp_send_cmd(map, CMD_READ_STATUS, adr);
532 status = map_read32(map,adr); 541 status = map_read(map, adr);
533 if((status & SR_READY)==SR_READY) 542 if((status.x[0] & SR_READY) == SR_READY)
534 break; 543 break;
535 udelay(100); 544 udelay(100);
536 } 545 }
@@ -538,14 +547,14 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip,
538 printk("sharp: timed out unlocking block\n"); 547 printk("sharp: timed out unlocking block\n");
539 } 548 }
540 549
541 if(!(status&SR_ERRORS)){ 550 if(!(status.x[0] & SR_ERRORS)){
542 map_write32(map,CMD_RESET,adr); 551 sharp_send_cmd(map, CMD_RESET, adr);
543 chip->state = FL_READY; 552 chip->state = FL_READY;
544 return; 553 return;
545 } 554 }
546 555
547 printk("sharp: error unlocking block at addr=%08lx status=%08x\n",adr,status); 556 printk("sharp: error unlocking block at addr=%08lx status=%08lx\n", adr, status.x[0]);
548 map_write32(map,CMD_CLEAR_STATUS,adr); 557 sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);
549} 558}
550#endif 559#endif
551 560
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index 0aaa0ced9aba..7ff403b2a0a0 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: block2mtd.c,v 1.29 2005/11/07 11:14:24 gleixner Exp $ 2 * $Id: block2mtd.c,v 1.30 2005/11/29 14:48:32 gleixner Exp $
3 * 3 *
4 * block2mtd.c - create an mtd from a block device 4 * block2mtd.c - create an mtd from a block device
5 * 5 *
@@ -19,7 +19,7 @@
19#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
20#include <linux/buffer_head.h> 20#include <linux/buffer_head.h>
21 21
22#define VERSION "$Revision: 1.29 $" 22#define VERSION "$Revision: 1.30 $"
23 23
24 24
25#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) 25#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
@@ -40,7 +40,7 @@ static LIST_HEAD(blkmtd_device_list);
40 40
41 41
42#define PAGE_READAHEAD 64 42#define PAGE_READAHEAD 64
43void cache_readahead(struct address_space *mapping, int index) 43static void cache_readahead(struct address_space *mapping, int index)
44{ 44{
45 filler_t *filler = (filler_t*)mapping->a_ops->readpage; 45 filler_t *filler = (filler_t*)mapping->a_ops->readpage;
46 int i, pagei; 46 int i, pagei;
diff --git a/drivers/mtd/devices/ms02-nv.c b/drivers/mtd/devices/ms02-nv.c
index f5026cee087f..0ff2e4378244 100644
--- a/drivers/mtd/devices/ms02-nv.c
+++ b/drivers/mtd/devices/ms02-nv.c
@@ -6,7 +6,7 @@
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 * 8 *
9 * $Id: ms02-nv.c,v 1.10 2005/06/20 12:24:41 macro Exp $ 9 * $Id: ms02-nv.c,v 1.11 2005/11/14 13:41:47 macro Exp $
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/init.h>
@@ -293,13 +293,13 @@ static int __init ms02nv_init(void)
293 293
294 switch (mips_machtype) { 294 switch (mips_machtype) {
295 case MACH_DS5000_200: 295 case MACH_DS5000_200:
296 csr = (volatile u32 *)KN02_CSR_BASE; 296 csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR);
297 if (*csr & KN02_CSR_BNK32M) 297 if (*csr & KN02_CSR_BNK32M)
298 stride = 2; 298 stride = 2;
299 break; 299 break;
300 case MACH_DS5000_2X0: 300 case MACH_DS5000_2X0:
301 case MACH_DS5900: 301 case MACH_DS5900:
302 csr = (volatile u32 *)KN03_MCR_BASE; 302 csr = (volatile u32 *)CKSEG1ADDR(KN03_SLOT_BASE + IOASIC_MCR);
303 if (*csr & KN03_MCR_BNK32M) 303 if (*csr & KN03_MCR_BNK32M)
304 stride = 2; 304 stride = 2;
305 break; 305 break;
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index de7e231d6d18..8a878b34eca0 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -1,5 +1,5 @@
1/* This version ported to the Linux-MTD system by dwmw2@infradead.org 1/* This version ported to the Linux-MTD system by dwmw2@infradead.org
2 * $Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $ 2 * $Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $
3 * 3 *
4 * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> 4 * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5 * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups 5 * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups
@@ -1084,9 +1084,9 @@ struct mtd_blktrans_ops ftl_tr = {
1084 .owner = THIS_MODULE, 1084 .owner = THIS_MODULE,
1085}; 1085};
1086 1086
1087int init_ftl(void) 1087static int init_ftl(void)
1088{ 1088{
1089 DEBUG(0, "$Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $\n"); 1089 DEBUG(0, "$Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $\n");
1090 1090
1091 return register_mtd_blktrans(&ftl_tr); 1091 return register_mtd_blktrans(&ftl_tr);
1092} 1092}
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 846a533323a8..452ccd5037c3 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -538,12 +538,6 @@ config MTD_MPC1211
538 This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). 538 This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02).
539 If you have such a board, say 'Y'. 539 If you have such a board, say 'Y'.
540 540
541config MTD_PQ2FADS
542 tristate "JEDEC flash SIMM mapped on PQ2FADS and 8272ADS boards"
543 depends on (ADS8272 || PQ2FADS) && MTD_PARTITIONS && MTD_JEDECPROBE && MTD_PHYSMAP && MTD_CFI_GEOMETRY && MTD_CFI_INTELEXT
544 help
545 This enables access to flash SIMM on PQ2FADS-like boards
546
547config MTD_OMAP_NOR 541config MTD_OMAP_NOR
548 tristate "TI OMAP board mappings" 542 tristate "TI OMAP board mappings"
549 depends on MTD_CFI && ARCH_OMAP 543 depends on MTD_CFI && ARCH_OMAP
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index 7d9e940a1dcd..2f7e254912f0 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -70,6 +70,5 @@ obj-$(CONFIG_MTD_DMV182) += dmv182.o
70obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o 70obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o
71obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o 71obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o
72obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o 72obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
73obj-$(CONFIG_MTD_PQ2FADS) += pq2fads.o
74obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o 73obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
75obj-$(CONFIG_MTD_TQM834x) += tqm834x.o 74obj-$(CONFIG_MTD_TQM834x) += tqm834x.o
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index a59f8027903c..986c58628390 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: ixp4xx.c,v 1.12 2005/11/07 11:14:27 gleixner Exp $ 2 * $Id: ixp4xx.c,v 1.13 2005/11/16 16:23:21 dvrabel Exp $
3 * 3 *
4 * drivers/mtd/maps/ixp4xx.c 4 * drivers/mtd/maps/ixp4xx.c
5 * 5 *
@@ -34,10 +34,55 @@
34 34
35#include <linux/reboot.h> 35#include <linux/reboot.h>
36 36
37/*
38 * Read/write a 16 bit word from flash address 'addr'.
39 *
40 * When the cpu is in little-endian mode it swizzles the address lines
41 * ('address coherency') so we need to undo the swizzling to ensure commands
42 * and the like end up on the correct flash address.
43 *
44 * To further complicate matters, due to the way the expansion bus controller
45 * handles 32 bit reads, the byte stream ABCD is stored on the flash as:
46 * D15 D0
47 * +---+---+
48 * | A | B | 0
49 * +---+---+
50 * | C | D | 2
51 * +---+---+
52 * This means that on LE systems each 16 bit word must be swapped. Note that
53 * this requires CONFIG_MTD_CFI_BE_BYTE_SWAP to be enabled to 'unswap' the CFI
54 * data and other flash commands which are always in D7-D0.
55 */
37#ifndef __ARMEB__ 56#ifndef __ARMEB__
57#ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP
58# error CONFIG_MTD_CFI_BE_BYTE_SWAP required
59#endif
60
61static inline u16 flash_read16(void __iomem *addr)
62{
63 return be16_to_cpu(__raw_readw((void __iomem *)((unsigned long)addr ^ 0x2)));
64}
65
66static inline void flash_write16(u16 d, void __iomem *addr)
67{
68 __raw_writew(cpu_to_be16(d), (void __iomem *)((unsigned long)addr ^ 0x2));
69}
70
38#define BYTE0(h) ((h) & 0xFF) 71#define BYTE0(h) ((h) & 0xFF)
39#define BYTE1(h) (((h) >> 8) & 0xFF) 72#define BYTE1(h) (((h) >> 8) & 0xFF)
73
40#else 74#else
75
76static inline u16 flash_read16(const void __iomem *addr)
77{
78 return __raw_readw(addr);
79}
80
81static inline void flash_write16(u16 d, void __iomem *addr)
82{
83 __raw_writew(d, addr);
84}
85
41#define BYTE0(h) (((h) >> 8) & 0xFF) 86#define BYTE0(h) (((h) >> 8) & 0xFF)
42#define BYTE1(h) ((h) & 0xFF) 87#define BYTE1(h) ((h) & 0xFF)
43#endif 88#endif
@@ -45,7 +90,7 @@
45static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) 90static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
46{ 91{
47 map_word val; 92 map_word val;
48 val.x[0] = le16_to_cpu(readw(map->virt + ofs)); 93 val.x[0] = flash_read16(map->virt + ofs);
49 return val; 94 return val;
50} 95}
51 96
@@ -57,19 +102,28 @@ static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
57static void ixp4xx_copy_from(struct map_info *map, void *to, 102static void ixp4xx_copy_from(struct map_info *map, void *to,
58 unsigned long from, ssize_t len) 103 unsigned long from, ssize_t len)
59{ 104{
60 int i;
61 u8 *dest = (u8 *) to; 105 u8 *dest = (u8 *) to;
62 void __iomem *src = map->virt + from; 106 void __iomem *src = map->virt + from;
63 u16 data;
64 107
65 for (i = 0; i < (len / 2); i++) { 108 if (len <= 0)
66 data = le16_to_cpu(readw(src + 2*i)); 109 return;
67 dest[i * 2] = BYTE0(data); 110
68 dest[i * 2 + 1] = BYTE1(data); 111 if (from & 1) {
112 *dest++ = BYTE1(flash_read16(src));
113 src++;
114 --len;
69 } 115 }
70 116
71 if (len & 1) 117 while (len >= 2) {
72 dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i))); 118 u16 data = flash_read16(src);
119 *dest++ = BYTE0(data);
120 *dest++ = BYTE1(data);
121 src += 2;
122 len -= 2;
123 }
124
125 if (len > 0)
126 *dest++ = BYTE0(flash_read16(src));
73} 127}
74 128
75/* 129/*
@@ -79,7 +133,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
79static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) 133static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
80{ 134{
81 if (!(adr & 1)) 135 if (!(adr & 1))
82 writew(cpu_to_le16(d.x[0]), map->virt + adr); 136 flash_write16(d.x[0], map->virt + adr);
83} 137}
84 138
85/* 139/*
@@ -87,7 +141,7 @@ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long
87 */ 141 */
88static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) 142static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
89{ 143{
90 writew(cpu_to_le16(d.x[0]), map->virt + adr); 144 flash_write16(d.x[0], map->virt + adr);
91} 145}
92 146
93struct ixp4xx_flash_info { 147struct ixp4xx_flash_info {
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c
index f00ee7e54dba..632eb2aa968f 100644
--- a/drivers/mtd/maps/nettel.c
+++ b/drivers/mtd/maps/nettel.c
@@ -6,7 +6,7 @@
6 * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) 6 * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com)
7 * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) 7 * (C) Copyright 2001-2002, SnapGear (www.snapgear.com)
8 * 8 *
9 * $Id: nettel.c,v 1.11 2005/11/07 11:14:27 gleixner Exp $ 9 * $Id: nettel.c,v 1.12 2005/11/29 14:30:00 gleixner Exp $
10 */ 10 */
11 11
12/****************************************************************************/ 12/****************************************************************************/
@@ -479,7 +479,7 @@ void __exit nettel_cleanup(void)
479 } 479 }
480 if (nettel_intel_map.virt) { 480 if (nettel_intel_map.virt) {
481 iounmap(nettel_intel_map.virt); 481 iounmap(nettel_intel_map.virt);
482 nettel_intel_map.virt = 0; 482 nettel_intel_map.virt = NULL;
483 } 483 }
484#endif 484#endif
485} 485}
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c
index 8b3570b09095..21822c2edbe4 100644
--- a/drivers/mtd/maps/pci.c
+++ b/drivers/mtd/maps/pci.c
@@ -7,7 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * $Id: pci.c,v 1.13 2005/11/07 11:14:27 gleixner Exp $ 10 * $Id: pci.c,v 1.14 2005/11/17 08:20:27 dwmw2 Exp $
11 * 11 *
12 * Generic PCI memory map driver. We support the following boards: 12 * Generic PCI memory map driver. We support the following boards:
13 * - Intel IQ80310 ATU. 13 * - Intel IQ80310 ATU.
@@ -102,7 +102,7 @@ static void mtd_pci_copyto(struct map_info *_map, unsigned long to, const void *
102 memcpy_toio(map->base + map->translate(map, to), from, len); 102 memcpy_toio(map->base + map->translate(map, to), from, len);
103} 103}
104 104
105static struct map_info mtd_pci_map = { 105static const struct map_info mtd_pci_map = {
106 .phys = NO_XIP, 106 .phys = NO_XIP,
107 .copy_from = mtd_pci_copyfrom, 107 .copy_from = mtd_pci_copyfrom,
108 .copy_to = mtd_pci_copyto, 108 .copy_to = mtd_pci_copyto,
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 9ee760f97bc6..f49ebc3c4606 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: physmap.c,v 1.38 2005/11/07 11:14:28 gleixner Exp $ 2 * $Id: physmap.c,v 1.39 2005/11/29 14:49:36 gleixner Exp $
3 * 3 *
4 * Normal mappings of chips in physical memory 4 * Normal mappings of chips in physical memory
5 * 5 *
@@ -19,6 +19,7 @@
19#include <linux/mtd/map.h> 19#include <linux/mtd/map.h>
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/mtd/physmap.h>
22 23
23static struct mtd_info *mymtd; 24static struct mtd_info *mymtd;
24 25
diff --git a/drivers/mtd/maps/sc520cdp.c b/drivers/mtd/maps/sc520cdp.c
index 6fb9f3c57aab..ed92afadd8a9 100644
--- a/drivers/mtd/maps/sc520cdp.c
+++ b/drivers/mtd/maps/sc520cdp.c
@@ -16,7 +16,7 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 * 18 *
19 * $Id: sc520cdp.c,v 1.22 2005/11/07 11:14:28 gleixner Exp $ 19 * $Id: sc520cdp.c,v 1.23 2005/11/17 08:20:27 dwmw2 Exp $
20 * 20 *
21 * 21 *
22 * The SC520CDP is an evaluation board for the Elan SC520 processor available 22 * The SC520CDP is an evaluation board for the Elan SC520 processor available
@@ -164,7 +164,7 @@ struct sc520_par_table
164 unsigned long default_address; 164 unsigned long default_address;
165}; 165};
166 166
167static struct sc520_par_table par_table[NUM_FLASH_BANKS] = 167static const struct sc520_par_table par_table[NUM_FLASH_BANKS] =
168{ 168{
169 { /* Flash Bank #0: selected by ROMCS0 */ 169 { /* Flash Bank #0: selected by ROMCS0 */
170 SC520_PAR_ROMCS0, 170 SC520_PAR_ROMCS0,
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index de4500395300..a0af92cc7efd 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -1486,7 +1486,7 @@ ns_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
1486/* 1486/*
1487 * Module initialization function 1487 * Module initialization function
1488 */ 1488 */
1489int __init ns_init_module(void) 1489static int __init ns_init_module(void)
1490{ 1490{
1491 struct nand_chip *chip; 1491 struct nand_chip *chip;
1492 struct nandsim *nand; 1492 struct nandsim *nand;
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index 0ab8d29caeea..20ce212638fc 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -30,11 +30,9 @@ MODULE_PARM_DESC(block_size, "Block size to use by RFD, defaults to erase unit s
30 30
31#define PREFIX "rfd_ftl: " 31#define PREFIX "rfd_ftl: "
32 32
33/* Major device # for FTL device */ 33/* This major has been assigned by device@lanana.org */
34
35/* A request for this major has been sent to device@lanana.org */
36#ifndef RFD_FTL_MAJOR 34#ifndef RFD_FTL_MAJOR
37#define RFD_FTL_MAJOR 95 35#define RFD_FTL_MAJOR 256
38#endif 36#endif
39 37
40/* Maximum number of partitions in an FTL region */ 38/* Maximum number of partitions in an FTL region */
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index dfea346b00a5..f9792528e33f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -380,23 +380,23 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
380 380
381 spin_lock_irqsave(&adapter->lock, flags); 381 spin_lock_irqsave(&adapter->lock, flags);
382 scb = mega_build_cmd(adapter, scmd, &busy); 382 scb = mega_build_cmd(adapter, scmd, &busy);
383 if (!scb)
384 goto out;
383 385
384 if(scb) { 386 scb->state |= SCB_PENDQ;
385 scb->state |= SCB_PENDQ; 387 list_add_tail(&scb->list, &adapter->pending_list);
386 list_add_tail(&scb->list, &adapter->pending_list);
387 388
388 /* 389 /*
389 * Check if the HBA is in quiescent state, e.g., during a 390 * Check if the HBA is in quiescent state, e.g., during a
390 * delete logical drive opertion. If it is, don't run 391 * delete logical drive opertion. If it is, don't run
391 * the pending_list. 392 * the pending_list.
392 */ 393 */
393 if(atomic_read(&adapter->quiescent) == 0) { 394 if (atomic_read(&adapter->quiescent) == 0)
394 mega_runpendq(adapter); 395 mega_runpendq(adapter);
395 }
396 return 0;
397 }
398 spin_unlock_irqrestore(&adapter->lock, flags);
399 396
397 busy = 0;
398 out:
399 spin_unlock_irqrestore(&adapter->lock, flags);
400 return busy; 400 return busy;
401} 401}
402 402
@@ -4677,7 +4677,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4677 4677
4678 adapter->flag = flag; 4678 adapter->flag = flag;
4679 spin_lock_init(&adapter->lock); 4679 spin_lock_init(&adapter->lock);
4680 scsi_assign_lock(host, &adapter->lock);
4681 4680
4682 host->cmd_per_lun = max_cmd_per_lun; 4681 host->cmd_per_lun = max_cmd_per_lun;
4683 host->max_sectors = max_sectors_per_io; 4682 host->max_sectors = max_sectors_per_io;
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 79861ee12a29..9d59dc62e6d2 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -787,6 +787,9 @@ static const struct usb_device_id cxacru_usb_ids[] = {
787 { /* V = Conexant P = ADSL modem (Hasbani project) */ 787 { /* V = Conexant P = ADSL modem (Hasbani project) */
788 USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 788 USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00
789 }, 789 },
790 { /* V = Conexant P = ADSL modem (Well PTI-800 */
791 USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00
792 },
790 { /* V = Conexant P = ADSL modem */ 793 { /* V = Conexant P = ADSL modem */
791 USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 794 USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00
792 }, 795 },
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index c466739428b2..2e6593e6c1bd 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -879,7 +879,7 @@ static int usbatm_atm_init(struct usbatm_data *instance)
879 879
880 fail: 880 fail:
881 instance->atm_dev = NULL; 881 instance->atm_dev = NULL;
882 shutdown_atm_dev(atm_dev); /* usbatm_atm_dev_close will eventually be called */ 882 atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */
883 return ret; 883 return ret;
884} 884}
885 885
@@ -1164,7 +1164,7 @@ void usbatm_usb_disconnect(struct usb_interface *intf)
1164 1164
1165 /* ATM finalize */ 1165 /* ATM finalize */
1166 if (instance->atm_dev) 1166 if (instance->atm_dev)
1167 shutdown_atm_dev(instance->atm_dev); 1167 atm_dev_deregister(instance->atm_dev);
1168 1168
1169 usbatm_put_instance(instance); /* taken in usbatm_usb_probe */ 1169 usbatm_put_instance(instance); /* taken in usbatm_usb_probe */
1170} 1170}
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 5131d88e8c5b..29b5b2a6e183 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -219,6 +219,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
219 goto done; 219 goto done;
220 } 220 }
221 } 221 }
222 synchronize_irq(dev->irq);
222 223
223 /* FIXME until the generic PM interfaces change a lot more, this 224 /* FIXME until the generic PM interfaces change a lot more, this
224 * can't use PCI D1 and D2 states. For example, the confusion 225 * can't use PCI D1 and D2 states. For example, the confusion
@@ -392,7 +393,7 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
392 393
393 dev->dev.power.power_state = PMSG_ON; 394 dev->dev.power.power_state = PMSG_ON;
394 395
395 hcd->saw_irq = 0; 396 clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
396 397
397 if (hcd->driver->resume) { 398 if (hcd->driver->resume) {
398 retval = hcd->driver->resume(hcd); 399 retval = hcd->driver->resume(hcd);
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5e5f65a475ab..da24c31ee00d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1315,11 +1315,12 @@ static int hcd_unlink_urb (struct urb *urb, int status)
1315 * finish unlinking the initial failed usb_set_address() 1315 * finish unlinking the initial failed usb_set_address()
1316 * or device descriptor fetch. 1316 * or device descriptor fetch.
1317 */ 1317 */
1318 if (!hcd->saw_irq && hcd->self.root_hub != urb->dev) { 1318 if (!test_bit(HCD_FLAG_SAW_IRQ, &hcd->flags)
1319 && hcd->self.root_hub != urb->dev) {
1319 dev_warn (hcd->self.controller, "Unlink after no-IRQ? " 1320 dev_warn (hcd->self.controller, "Unlink after no-IRQ? "
1320 "Controller is probably using the wrong IRQ." 1321 "Controller is probably using the wrong IRQ."
1321 "\n"); 1322 "\n");
1322 hcd->saw_irq = 1; 1323 set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
1323 } 1324 }
1324 1325
1325 urb->status = status; 1326 urb->status = status;
@@ -1649,13 +1650,15 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd, struct pt_regs * r)
1649 struct usb_hcd *hcd = __hcd; 1650 struct usb_hcd *hcd = __hcd;
1650 int start = hcd->state; 1651 int start = hcd->state;
1651 1652
1652 if (start == HC_STATE_HALT) 1653 if (unlikely(start == HC_STATE_HALT ||
1654 !test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)))
1653 return IRQ_NONE; 1655 return IRQ_NONE;
1654 if (hcd->driver->irq (hcd, r) == IRQ_NONE) 1656 if (hcd->driver->irq (hcd, r) == IRQ_NONE)
1655 return IRQ_NONE; 1657 return IRQ_NONE;
1656 1658
1657 hcd->saw_irq = 1; 1659 set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
1658 if (hcd->state == HC_STATE_HALT) 1660
1661 if (unlikely(hcd->state == HC_STATE_HALT))
1659 usb_hc_died (hcd); 1662 usb_hc_died (hcd);
1660 return IRQ_HANDLED; 1663 return IRQ_HANDLED;
1661} 1664}
@@ -1768,6 +1771,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
1768 1771
1769 dev_info(hcd->self.controller, "%s\n", hcd->product_desc); 1772 dev_info(hcd->self.controller, "%s\n", hcd->product_desc);
1770 1773
1774 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
1775
1771 /* till now HC has been in an indeterminate state ... */ 1776 /* till now HC has been in an indeterminate state ... */
1772 if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) { 1777 if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) {
1773 dev_err(hcd->self.controller, "can't reset\n"); 1778 dev_err(hcd->self.controller, "can't reset\n");
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 24a62a2ff86d..c8a1b350e2cf 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -72,7 +72,12 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */
72 * hardware info/state 72 * hardware info/state
73 */ 73 */
74 const struct hc_driver *driver; /* hw-specific hooks */ 74 const struct hc_driver *driver; /* hw-specific hooks */
75 unsigned saw_irq : 1; 75
76 /* Flags that need to be manipulated atomically */
77 unsigned long flags;
78#define HCD_FLAG_HW_ACCESSIBLE 0x00000001
79#define HCD_FLAG_SAW_IRQ 0x00000002
80
76 unsigned can_wakeup:1; /* hw supports wakeup? */ 81 unsigned can_wakeup:1; /* hw supports wakeup? */
77 unsigned remote_wakeup:1;/* sw should use wakeup? */ 82 unsigned remote_wakeup:1;/* sw should use wakeup? */
78 unsigned rh_registered:1;/* is root hub registered? */ 83 unsigned rh_registered:1;/* is root hub registered? */
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 441c26064b44..13f73a836e45 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -121,8 +121,8 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
121 return 0; 121 return 0;
122} 122}
123 123
124/* called by khubd or root hub (re)init threads; leaves HC in halt state */ 124/* called during probe() after chip reset completes */
125static int ehci_pci_reset(struct usb_hcd *hcd) 125static int ehci_pci_setup(struct usb_hcd *hcd)
126{ 126{
127 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 127 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
128 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 128 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
@@ -141,6 +141,11 @@ static int ehci_pci_reset(struct usb_hcd *hcd)
141 if (retval) 141 if (retval)
142 return retval; 142 return retval;
143 143
144 /* data structure init */
145 retval = ehci_init(hcd);
146 if (retval)
147 return retval;
148
144 /* NOTE: only the parts below this line are PCI-specific */ 149 /* NOTE: only the parts below this line are PCI-specific */
145 150
146 switch (pdev->vendor) { 151 switch (pdev->vendor) {
@@ -154,7 +159,8 @@ static int ehci_pci_reset(struct usb_hcd *hcd)
154 /* AMD8111 EHCI doesn't work, according to AMD errata */ 159 /* AMD8111 EHCI doesn't work, according to AMD errata */
155 if (pdev->device == 0x7463) { 160 if (pdev->device == 0x7463) {
156 ehci_info(ehci, "ignoring AMD8111 (errata)\n"); 161 ehci_info(ehci, "ignoring AMD8111 (errata)\n");
157 return -EIO; 162 retval = -EIO;
163 goto done;
158 } 164 }
159 break; 165 break;
160 case PCI_VENDOR_ID_NVIDIA: 166 case PCI_VENDOR_ID_NVIDIA:
@@ -207,9 +213,8 @@ static int ehci_pci_reset(struct usb_hcd *hcd)
207 /* REVISIT: per-port wake capability (PCI 0x62) currently unused */ 213 /* REVISIT: per-port wake capability (PCI 0x62) currently unused */
208 214
209 retval = ehci_pci_reinit(ehci, pdev); 215 retval = ehci_pci_reinit(ehci, pdev);
210 216done:
211 /* finish init */ 217 return retval;
212 return ehci_init(hcd);
213} 218}
214 219
215/*-------------------------------------------------------------------------*/ 220/*-------------------------------------------------------------------------*/
@@ -228,14 +233,36 @@ static int ehci_pci_reset(struct usb_hcd *hcd)
228static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) 233static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
229{ 234{
230 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 235 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
236 unsigned long flags;
237 int rc = 0;
231 238
232 if (time_before(jiffies, ehci->next_statechange)) 239 if (time_before(jiffies, ehci->next_statechange))
233 msleep(10); 240 msleep(10);
234 241
242 /* Root hub was already suspended. Disable irq emission and
243 * mark HW unaccessible, bail out if RH has been resumed. Use
244 * the spinlock to properly synchronize with possible pending
245 * RH suspend or resume activity.
246 *
247 * This is still racy as hcd->state is manipulated outside of
248 * any locks =P But that will be a different fix.
249 */
250 spin_lock_irqsave (&ehci->lock, flags);
251 if (hcd->state != HC_STATE_SUSPENDED) {
252 rc = -EINVAL;
253 goto bail;
254 }
255 writel (0, &ehci->regs->intr_enable);
256 (void)readl(&ehci->regs->intr_enable);
257
258 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
259 bail:
260 spin_unlock_irqrestore (&ehci->lock, flags);
261
235 // could save FLADJ in case of Vaux power loss 262 // could save FLADJ in case of Vaux power loss
236 // ... we'd only use it to handle clock skew 263 // ... we'd only use it to handle clock skew
237 264
238 return 0; 265 return rc;
239} 266}
240 267
241static int ehci_pci_resume(struct usb_hcd *hcd) 268static int ehci_pci_resume(struct usb_hcd *hcd)
@@ -251,6 +278,9 @@ static int ehci_pci_resume(struct usb_hcd *hcd)
251 if (time_before(jiffies, ehci->next_statechange)) 278 if (time_before(jiffies, ehci->next_statechange))
252 msleep(100); 279 msleep(100);
253 280
281 /* Mark hardware accessible again as we are out of D3 state by now */
282 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
283
254 /* If CF is clear, we lost PCI Vaux power and need to restart. */ 284 /* If CF is clear, we lost PCI Vaux power and need to restart. */
255 if (readl(&ehci->regs->configured_flag) != FLAG_CF) 285 if (readl(&ehci->regs->configured_flag) != FLAG_CF)
256 goto restart; 286 goto restart;
@@ -319,7 +349,7 @@ static const struct hc_driver ehci_pci_hc_driver = {
319 /* 349 /*
320 * basic lifecycle operations 350 * basic lifecycle operations
321 */ 351 */
322 .reset = ehci_pci_reset, 352 .reset = ehci_pci_setup,
323 .start = ehci_run, 353 .start = ehci_run,
324#ifdef CONFIG_PM 354#ifdef CONFIG_PM
325 .suspend = ehci_pci_suspend, 355 .suspend = ehci_pci_suspend,
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 5bb872c3496d..bf03ec0d8ee2 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -912,6 +912,7 @@ submit_async (
912 int epnum; 912 int epnum;
913 unsigned long flags; 913 unsigned long flags;
914 struct ehci_qh *qh = NULL; 914 struct ehci_qh *qh = NULL;
915 int rc = 0;
915 916
916 qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); 917 qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list);
917 epnum = ep->desc.bEndpointAddress; 918 epnum = ep->desc.bEndpointAddress;
@@ -926,21 +927,28 @@ submit_async (
926#endif 927#endif
927 928
928 spin_lock_irqsave (&ehci->lock, flags); 929 spin_lock_irqsave (&ehci->lock, flags);
930 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE,
931 &ehci_to_hcd(ehci)->flags))) {
932 rc = -ESHUTDOWN;
933 goto done;
934 }
935
929 qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); 936 qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv);
937 if (unlikely(qh == NULL)) {
938 rc = -ENOMEM;
939 goto done;
940 }
930 941
931 /* Control/bulk operations through TTs don't need scheduling, 942 /* Control/bulk operations through TTs don't need scheduling,
932 * the HC and TT handle it when the TT has a buffer ready. 943 * the HC and TT handle it when the TT has a buffer ready.
933 */ 944 */
934 if (likely (qh != NULL)) { 945 if (likely (qh->qh_state == QH_STATE_IDLE))
935 if (likely (qh->qh_state == QH_STATE_IDLE)) 946 qh_link_async (ehci, qh_get (qh));
936 qh_link_async (ehci, qh_get (qh)); 947 done:
937 }
938 spin_unlock_irqrestore (&ehci->lock, flags); 948 spin_unlock_irqrestore (&ehci->lock, flags);
939 if (unlikely (qh == NULL)) { 949 if (unlikely (qh == NULL))
940 qtd_list_free (ehci, urb, qtd_list); 950 qtd_list_free (ehci, urb, qtd_list);
941 return -ENOMEM; 951 return rc;
942 }
943 return 0;
944} 952}
945 953
946/*-------------------------------------------------------------------------*/ 954/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index f0c8aa1ccd5d..57e77374d228 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -602,6 +602,12 @@ static int intr_submit (
602 602
603 spin_lock_irqsave (&ehci->lock, flags); 603 spin_lock_irqsave (&ehci->lock, flags);
604 604
605 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE,
606 &ehci_to_hcd(ehci)->flags))) {
607 status = -ESHUTDOWN;
608 goto done;
609 }
610
605 /* get qh and force any scheduling errors */ 611 /* get qh and force any scheduling errors */
606 INIT_LIST_HEAD (&empty); 612 INIT_LIST_HEAD (&empty);
607 qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv); 613 qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv);
@@ -1456,7 +1462,11 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb,
1456 1462
1457 /* schedule ... need to lock */ 1463 /* schedule ... need to lock */
1458 spin_lock_irqsave (&ehci->lock, flags); 1464 spin_lock_irqsave (&ehci->lock, flags);
1459 status = iso_stream_schedule (ehci, urb, stream); 1465 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE,
1466 &ehci_to_hcd(ehci)->flags)))
1467 status = -ESHUTDOWN;
1468 else
1469 status = iso_stream_schedule (ehci, urb, stream);
1460 if (likely (status == 0)) 1470 if (likely (status == 0))
1461 itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); 1471 itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
1462 spin_unlock_irqrestore (&ehci->lock, flags); 1472 spin_unlock_irqrestore (&ehci->lock, flags);
@@ -1815,7 +1825,11 @@ static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb,
1815 1825
1816 /* schedule ... need to lock */ 1826 /* schedule ... need to lock */
1817 spin_lock_irqsave (&ehci->lock, flags); 1827 spin_lock_irqsave (&ehci->lock, flags);
1818 status = iso_stream_schedule (ehci, urb, stream); 1828 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE,
1829 &ehci_to_hcd(ehci)->flags)))
1830 status = -ESHUTDOWN;
1831 else
1832 status = iso_stream_schedule (ehci, urb, stream);
1819 if (status == 0) 1833 if (status == 0)
1820 sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); 1834 sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
1821 spin_unlock_irqrestore (&ehci->lock, flags); 1835 spin_unlock_irqrestore (&ehci->lock, flags);
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 5c0c6c8a7a82..bf1d9abc07ac 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -115,7 +115,7 @@
115 115
116/*-------------------------------------------------------------------------*/ 116/*-------------------------------------------------------------------------*/
117 117
118// #define OHCI_VERBOSE_DEBUG /* not always helpful */ 118#undef OHCI_VERBOSE_DEBUG /* not always helpful */
119 119
120/* For initializing controller (mask in an HCFS mode too) */ 120/* For initializing controller (mask in an HCFS mode too) */
121#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR 121#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
@@ -253,6 +253,10 @@ static int ohci_urb_enqueue (
253 spin_lock_irqsave (&ohci->lock, flags); 253 spin_lock_irqsave (&ohci->lock, flags);
254 254
255 /* don't submit to a dead HC */ 255 /* don't submit to a dead HC */
256 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
257 retval = -ENODEV;
258 goto fail;
259 }
256 if (!HC_IS_RUNNING(hcd->state)) { 260 if (!HC_IS_RUNNING(hcd->state)) {
257 retval = -ENODEV; 261 retval = -ENODEV;
258 goto fail; 262 goto fail;
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index e01e77bc324b..72e3b12a1926 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -53,6 +53,11 @@ static int ohci_bus_suspend (struct usb_hcd *hcd)
53 53
54 spin_lock_irqsave (&ohci->lock, flags); 54 spin_lock_irqsave (&ohci->lock, flags);
55 55
56 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) {
57 spin_unlock_irqrestore (&ohci->lock, flags);
58 return -ESHUTDOWN;
59 }
60
56 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); 61 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
57 switch (ohci->hc_control & OHCI_CTRL_HCFS) { 62 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
58 case OHCI_USB_RESUME: 63 case OHCI_USB_RESUME:
@@ -140,11 +145,19 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
140 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 145 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
141 u32 temp, enables; 146 u32 temp, enables;
142 int status = -EINPROGRESS; 147 int status = -EINPROGRESS;
148 unsigned long flags;
143 149
144 if (time_before (jiffies, ohci->next_statechange)) 150 if (time_before (jiffies, ohci->next_statechange))
145 msleep(5); 151 msleep(5);
146 152
147 spin_lock_irq (&ohci->lock); 153 spin_lock_irqsave (&ohci->lock, flags);
154
155 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) {
156 spin_unlock_irqrestore (&ohci->lock, flags);
157 return -ESHUTDOWN;
158 }
159
160
148 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); 161 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
149 162
150 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { 163 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
@@ -179,7 +192,7 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
179 ohci_dbg (ohci, "lost power\n"); 192 ohci_dbg (ohci, "lost power\n");
180 status = -EBUSY; 193 status = -EBUSY;
181 } 194 }
182 spin_unlock_irq (&ohci->lock); 195 spin_unlock_irqrestore (&ohci->lock, flags);
183 if (status == -EBUSY) { 196 if (status == -EBUSY) {
184 (void) ohci_init (ohci); 197 (void) ohci_init (ohci);
185 return ohci_restart (ohci); 198 return ohci_restart (ohci);
@@ -297,8 +310,8 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
297 /* handle autosuspended root: finish resuming before 310 /* handle autosuspended root: finish resuming before
298 * letting khubd or root hub timer see state changes. 311 * letting khubd or root hub timer see state changes.
299 */ 312 */
300 if ((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER 313 if (unlikely((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER
301 || !HC_IS_RUNNING(hcd->state)) { 314 || !HC_IS_RUNNING(hcd->state))) {
302 can_suspend = 0; 315 can_suspend = 0;
303 goto done; 316 goto done;
304 } 317 }
@@ -508,6 +521,9 @@ static int ohci_hub_control (
508 u32 temp; 521 u32 temp;
509 int retval = 0; 522 int retval = 0;
510 523
524 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)))
525 return -ESHUTDOWN;
526
511 switch (typeReq) { 527 switch (typeReq) {
512 case ClearHubFeature: 528 case ClearHubFeature:
513 switch (wValue) { 529 switch (wValue) {
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 5f22e6590cd1..1b09dde068e1 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -105,13 +105,36 @@ ohci_pci_start (struct usb_hcd *hcd)
105 105
106static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 106static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
107{ 107{
108 /* root hub was already suspended */ 108 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
109 return 0; 109 unsigned long flags;
110 int rc = 0;
111
112 /* Root hub was already suspended. Disable irq emission and
113 * mark HW unaccessible, bail out if RH has been resumed. Use
114 * the spinlock to properly synchronize with possible pending
115 * RH suspend or resume activity.
116 *
117 * This is still racy as hcd->state is manipulated outside of
118 * any locks =P But that will be a different fix.
119 */
120 spin_lock_irqsave (&ohci->lock, flags);
121 if (hcd->state != HC_STATE_SUSPENDED) {
122 rc = -EINVAL;
123 goto bail;
124 }
125 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
126 (void)ohci_readl(ohci, &ohci->regs->intrdisable);
127 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
128 bail:
129 spin_unlock_irqrestore (&ohci->lock, flags);
130
131 return rc;
110} 132}
111 133
112 134
113static int ohci_pci_resume (struct usb_hcd *hcd) 135static int ohci_pci_resume (struct usb_hcd *hcd)
114{ 136{
137 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
115 usb_hcd_resume_root_hub(hcd); 138 usb_hcd_resume_root_hub(hcd);
116 return 0; 139 return 0;
117} 140}
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index d33ce3982a5f..ed550132db0b 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -717,6 +717,7 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
717 * at the source, so we must turn off PIRQ. 717 * at the source, so we must turn off PIRQ.
718 */ 718 */
719 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); 719 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
720 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
720 uhci->hc_inaccessible = 1; 721 uhci->hc_inaccessible = 1;
721 hcd->poll_rh = 0; 722 hcd->poll_rh = 0;
722 723
@@ -733,6 +734,11 @@ static int uhci_resume(struct usb_hcd *hcd)
733 734
734 dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); 735 dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__);
735 736
737 /* We aren't in D3 state anymore, we do that even if dead as I
738 * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0
739 */
740 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
741
736 if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ 742 if (uhci->rh_state == UHCI_RH_RESET) /* Dead */
737 return 0; 743 return 0;
738 spin_lock_irq(&uhci->lock); 744 spin_lock_irq(&uhci->lock);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 25b6ca6ad081..3e470c8b4193 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -534,6 +534,12 @@ config FB_SUN3
534 bool "Sun3 framebuffer support" 534 bool "Sun3 framebuffer support"
535 depends on (FB = y) && (SUN3 || SUN3X) && BROKEN 535 depends on (FB = y) && (SUN3 || SUN3X) && BROKEN
536 536
537config FB_SBUS
538 bool "SBUS and UPA framebuffers"
539 depends on (FB = y) && (SPARC32 || SPARC64)
540 help
541 Say Y if you want support for SBUS or UPA based frame buffer device.
542
537config FB_BW2 543config FB_BW2
538 bool "BWtwo support" 544 bool "BWtwo support"
539 depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) 545 depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
@@ -546,6 +552,7 @@ config FB_BW2
546config FB_CG3 552config FB_CG3
547 bool "CGthree support" 553 bool "CGthree support"
548 depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) 554 depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
555 select FB_CFB_FILLRECT
549 select FB_CFB_COPYAREA 556 select FB_CFB_COPYAREA
550 select FB_CFB_IMAGEBLIT 557 select FB_CFB_IMAGEBLIT
551 help 558 help
@@ -1210,12 +1217,6 @@ config FB_AU1100
1210 1217
1211source "drivers/video/geode/Kconfig" 1218source "drivers/video/geode/Kconfig"
1212 1219
1213config FB_SBUS
1214 bool "SBUS and UPA framebuffers"
1215 depends on (FB = y) && (SPARC32 || SPARC64)
1216 help
1217 Say Y if you want support for SBUS or UPA based frame buffer device.
1218
1219config FB_FFB 1220config FB_FFB
1220 bool "Creator/Creator3D/Elite3D support" 1221 bool "Creator/Creator3D/Elite3D support"
1221 depends on FB_SBUS && SPARC64 1222 depends on FB_SBUS && SPARC64
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 2858c5c8ba3c..e0dbdfc0c8b4 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -404,7 +404,7 @@ struct cirrusfb_info {
404 struct cirrusfb_regs currentmode; 404 struct cirrusfb_regs currentmode;
405 int blank_mode; 405 int blank_mode;
406 406
407 u32 pseudo_palette[17]; 407 u32 pseudo_palette[16];
408 struct { u8 red, green, blue, pad; } palette[256]; 408 struct { u8 red, green, blue, pad; } palette[256];
409 409
410#ifdef CONFIG_ZORRO 410#ifdef CONFIG_ZORRO
@@ -1603,14 +1603,14 @@ static int cirrusfb_setcolreg (unsigned regno, unsigned red, unsigned green,
1603 1603
1604 switch (info->var.bits_per_pixel) { 1604 switch (info->var.bits_per_pixel) {
1605 case 8: 1605 case 8:
1606 ((u8*)(info->pseudo_palette))[regno] = v; 1606 cinfo->pseudo_palette[regno] = v;
1607 break; 1607 break;
1608 case 16: 1608 case 16:
1609 ((u16*)(info->pseudo_palette))[regno] = v; 1609 cinfo->pseudo_palette[regno] = v;
1610 break; 1610 break;
1611 case 24: 1611 case 24:
1612 case 32: 1612 case 32:
1613 ((u32*)(info->pseudo_palette))[regno] = v; 1613 cinfo->pseudo_palette[regno] = v;
1614 break; 1614 break;
1615 } 1615 }
1616 return 0; 1616 return 0;
@@ -2020,18 +2020,21 @@ static void cirrusfb_prim_fillrect(struct cirrusfb_info *cinfo,
2020 const struct fb_fillrect *region) 2020 const struct fb_fillrect *region)
2021{ 2021{
2022 int m; /* bytes per pixel */ 2022 int m; /* bytes per pixel */
2023 u32 color = (cinfo->info->fix.visual == FB_VISUAL_TRUECOLOR) ?
2024 cinfo->pseudo_palette[region->color] : region->color;
2025
2023 if(cinfo->info->var.bits_per_pixel == 1) { 2026 if(cinfo->info->var.bits_per_pixel == 1) {
2024 cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, 2027 cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel,
2025 region->dx / 8, region->dy, 2028 region->dx / 8, region->dy,
2026 region->width / 8, region->height, 2029 region->width / 8, region->height,
2027 region->color, 2030 color,
2028 cinfo->currentmode.line_length); 2031 cinfo->currentmode.line_length);
2029 } else { 2032 } else {
2030 m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8; 2033 m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8;
2031 cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, 2034 cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel,
2032 region->dx * m, region->dy, 2035 region->dx * m, region->dy,
2033 region->width * m, region->height, 2036 region->width * m, region->height,
2034 region->color, 2037 color,
2035 cinfo->currentmode.line_length); 2038 cinfo->currentmode.line_length);
2036 } 2039 }
2037 return; 2040 return;