aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/idt77252.c27
-rw-r--r--drivers/atm/idt77252.h4
-rw-r--r--drivers/block/floppy.c2
-rw-r--r--drivers/char/cyclades.c1
-rw-r--r--drivers/crypto/geode-aes.c12
-rw-r--r--drivers/crypto/geode-aes.h3
-rw-r--r--drivers/hwmon/applesmc.c10
-rw-r--r--drivers/isdn/hardware/eicon/capifunc.c16
-rw-r--r--drivers/isdn/hardware/eicon/message.c13
-rw-r--r--drivers/isdn/hisax/config.c2
-rw-r--r--drivers/isdn/hisax/hfc_usb.c43
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c6
-rw-r--r--drivers/isdn/hisax/st5481_init.c7
-rw-r--r--drivers/isdn/hisax/st5481_usb.c1
-rw-r--r--drivers/md/bitmap.c17
-rw-r--r--drivers/md/linear.c10
-rw-r--r--drivers/md/md.c20
-rw-r--r--drivers/md/raid0.c3
-rw-r--r--drivers/message/i2o/driver.c26
-rw-r--r--drivers/misc/phantom.c29
-rw-r--r--drivers/mmc/card/block.c18
-rw-r--r--drivers/mmc/card/queue.c35
-rw-r--r--drivers/mmc/card/queue.h8
-rw-r--r--drivers/net/arcnet/Kconfig17
-rw-r--r--drivers/net/tokenring/Kconfig33
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c25
-rw-r--r--drivers/spi/omap_uwire.c4
-rw-r--r--drivers/spi/spidev.c13
-rw-r--r--drivers/usb/host/ehci-fsl.c13
-rw-r--r--drivers/usb/host/ehci-fsl.h1
-rw-r--r--drivers/video/Kconfig183
-rw-r--r--drivers/video/imxfb.c24
-rw-r--r--drivers/video/pm2fb.c17
-rw-r--r--drivers/video/pm3fb.c333
-rw-r--r--drivers/video/ps3fb.c8
-rw-r--r--drivers/video/w100fb.c14
36 files changed, 483 insertions, 515 deletions
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 057efbc55d38..3800bc0cb2ef 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -47,7 +47,8 @@ static char const rcsid[] =
47#include <linux/bitops.h> 47#include <linux/bitops.h>
48#include <linux/wait.h> 48#include <linux/wait.h>
49#include <linux/jiffies.h> 49#include <linux/jiffies.h>
50#include <asm/semaphore.h> 50#include <linux/mutex.h>
51
51#include <asm/io.h> 52#include <asm/io.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/atomic.h> 54#include <asm/atomic.h>
@@ -2435,7 +2436,7 @@ idt77252_open(struct atm_vcc *vcc)
2435 2436
2436 set_bit(ATM_VF_ADDR, &vcc->flags); 2437 set_bit(ATM_VF_ADDR, &vcc->flags);
2437 2438
2438 down(&card->mutex); 2439 mutex_lock(&card->mutex);
2439 2440
2440 OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci); 2441 OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci);
2441 2442
@@ -2446,7 +2447,7 @@ idt77252_open(struct atm_vcc *vcc)
2446 break; 2447 break;
2447 default: 2448 default:
2448 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal); 2449 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
2449 up(&card->mutex); 2450 mutex_unlock(&card->mutex);
2450 return -EPROTONOSUPPORT; 2451 return -EPROTONOSUPPORT;
2451 } 2452 }
2452 2453
@@ -2455,7 +2456,7 @@ idt77252_open(struct atm_vcc *vcc)
2455 card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL); 2456 card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2456 if (!card->vcs[index]) { 2457 if (!card->vcs[index]) {
2457 printk("%s: can't alloc vc in open()\n", card->name); 2458 printk("%s: can't alloc vc in open()\n", card->name);
2458 up(&card->mutex); 2459 mutex_unlock(&card->mutex);
2459 return -ENOMEM; 2460 return -ENOMEM;
2460 } 2461 }
2461 card->vcs[index]->card = card; 2462 card->vcs[index]->card = card;
@@ -2484,14 +2485,14 @@ idt77252_open(struct atm_vcc *vcc)
2484 if (inuse) { 2485 if (inuse) {
2485 printk("%s: %s vci already in use.\n", card->name, 2486 printk("%s: %s vci already in use.\n", card->name,
2486 inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx"); 2487 inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx");
2487 up(&card->mutex); 2488 mutex_unlock(&card->mutex);
2488 return -EADDRINUSE; 2489 return -EADDRINUSE;
2489 } 2490 }
2490 2491
2491 if (vcc->qos.txtp.traffic_class != ATM_NONE) { 2492 if (vcc->qos.txtp.traffic_class != ATM_NONE) {
2492 error = idt77252_init_tx(card, vc, vcc, &vcc->qos); 2493 error = idt77252_init_tx(card, vc, vcc, &vcc->qos);
2493 if (error) { 2494 if (error) {
2494 up(&card->mutex); 2495 mutex_unlock(&card->mutex);
2495 return error; 2496 return error;
2496 } 2497 }
2497 } 2498 }
@@ -2499,14 +2500,14 @@ idt77252_open(struct atm_vcc *vcc)
2499 if (vcc->qos.rxtp.traffic_class != ATM_NONE) { 2500 if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
2500 error = idt77252_init_rx(card, vc, vcc, &vcc->qos); 2501 error = idt77252_init_rx(card, vc, vcc, &vcc->qos);
2501 if (error) { 2502 if (error) {
2502 up(&card->mutex); 2503 mutex_unlock(&card->mutex);
2503 return error; 2504 return error;
2504 } 2505 }
2505 } 2506 }
2506 2507
2507 set_bit(ATM_VF_READY, &vcc->flags); 2508 set_bit(ATM_VF_READY, &vcc->flags);
2508 2509
2509 up(&card->mutex); 2510 mutex_unlock(&card->mutex);
2510 return 0; 2511 return 0;
2511} 2512}
2512 2513
@@ -2520,7 +2521,7 @@ idt77252_close(struct atm_vcc *vcc)
2520 unsigned long addr; 2521 unsigned long addr;
2521 unsigned long timeout; 2522 unsigned long timeout;
2522 2523
2523 down(&card->mutex); 2524 mutex_lock(&card->mutex);
2524 2525
2525 IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n", 2526 IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n",
2526 card->name, vc->index, vcc->vpi, vcc->vci); 2527 card->name, vc->index, vcc->vpi, vcc->vci);
@@ -2591,7 +2592,7 @@ done:
2591 free_scq(card, vc->scq); 2592 free_scq(card, vc->scq);
2592 } 2593 }
2593 2594
2594 up(&card->mutex); 2595 mutex_unlock(&card->mutex);
2595} 2596}
2596 2597
2597static int 2598static int
@@ -2602,7 +2603,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
2602 struct vc_map *vc = vcc->dev_data; 2603 struct vc_map *vc = vcc->dev_data;
2603 int error = 0; 2604 int error = 0;
2604 2605
2605 down(&card->mutex); 2606 mutex_lock(&card->mutex);
2606 2607
2607 if (qos->txtp.traffic_class != ATM_NONE) { 2608 if (qos->txtp.traffic_class != ATM_NONE) {
2608 if (!test_bit(VCF_TX, &vc->flags)) { 2609 if (!test_bit(VCF_TX, &vc->flags)) {
@@ -2648,7 +2649,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
2648 set_bit(ATM_VF_HASQOS, &vcc->flags); 2649 set_bit(ATM_VF_HASQOS, &vcc->flags);
2649 2650
2650out: 2651out:
2651 up(&card->mutex); 2652 mutex_unlock(&card->mutex);
2652 return error; 2653 return error;
2653} 2654}
2654 2655
@@ -3709,7 +3710,7 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
3709 membase = pci_resource_start(pcidev, 1); 3710 membase = pci_resource_start(pcidev, 1);
3710 srambase = pci_resource_start(pcidev, 2); 3711 srambase = pci_resource_start(pcidev, 2);
3711 3712
3712 init_MUTEX(&card->mutex); 3713 mutex_init(&card->mutex);
3713 spin_lock_init(&card->cmd_lock); 3714 spin_lock_init(&card->cmd_lock);
3714 spin_lock_init(&card->tst_lock); 3715 spin_lock_init(&card->tst_lock);
3715 3716
diff --git a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h
index 544b39738291..6f2b4a5875fb 100644
--- a/drivers/atm/idt77252.h
+++ b/drivers/atm/idt77252.h
@@ -37,7 +37,7 @@
37#include <linux/ptrace.h> 37#include <linux/ptrace.h>
38#include <linux/skbuff.h> 38#include <linux/skbuff.h>
39#include <linux/workqueue.h> 39#include <linux/workqueue.h>
40 40#include <linux/mutex.h>
41 41
42/*****************************************************************************/ 42/*****************************************************************************/
43/* */ 43/* */
@@ -359,7 +359,7 @@ struct idt77252_dev
359 unsigned long srambase; /* SAR's sram base address */ 359 unsigned long srambase; /* SAR's sram base address */
360 void __iomem *fbq[4]; /* FBQ fill addresses */ 360 void __iomem *fbq[4]; /* FBQ fill addresses */
361 361
362 struct semaphore mutex; 362 struct mutex mutex;
363 spinlock_t cmd_lock; /* for r/w utility/sram */ 363 spinlock_t cmd_lock; /* for r/w utility/sram */
364 364
365 unsigned long softstat; 365 unsigned long softstat;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 3587cb434371..fe088045dd08 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -670,7 +670,7 @@ static void __reschedule_timeout(int drive, const char *message, int marg)
670 if (drive == current_reqD) 670 if (drive == current_reqD)
671 drive = current_drive; 671 drive = current_drive;
672 del_timer(&fd_timeout); 672 del_timer(&fd_timeout);
673 if (drive < 0 || drive > N_DRIVE) { 673 if (drive < 0 || drive >= N_DRIVE) {
674 fd_timeout.expires = jiffies + 20UL * HZ; 674 fd_timeout.expires = jiffies + 20UL * HZ;
675 drive = 0; 675 drive = 0;
676 } else 676 } else
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index c72ee97d3892..ca376b92162c 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -1061,6 +1061,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
1061 1061
1062 if (data & info->ignore_status_mask) { 1062 if (data & info->ignore_status_mask) {
1063 info->icount.rx++; 1063 info->icount.rx++;
1064 spin_unlock(&cinfo->card_lock);
1064 return; 1065 return;
1065 } 1066 }
1066 if (tty_buffer_request_room(tty, 1)) { 1067 if (tty_buffer_request_room(tty, 1)) {
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index 6d3840e629de..6a86958b577f 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -102,10 +102,15 @@ geode_aes_crypt(struct geode_aes_op *op)
102 u32 flags = 0; 102 u32 flags = 0;
103 unsigned long iflags; 103 unsigned long iflags;
104 104
105 if (op->len == 0 || op->src == op->dst) 105 if (op->len == 0)
106 return 0; 106 return 0;
107 107
108 if (op->flags & AES_FLAGS_COHERENT) 108 /* If the source and destination is the same, then
109 * we need to turn on the coherent flags, otherwise
110 * we don't need to worry
111 */
112
113 if (op->src == op->dst)
109 flags |= (AES_CTRL_DCA | AES_CTRL_SCA); 114 flags |= (AES_CTRL_DCA | AES_CTRL_SCA);
110 115
111 if (op->dir == AES_DIR_ENCRYPT) 116 if (op->dir == AES_DIR_ENCRYPT)
@@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op)
120 _writefield(AES_WRITEIV0_REG, op->iv); 125 _writefield(AES_WRITEIV0_REG, op->iv);
121 } 126 }
122 127
123 if (op->flags & AES_FLAGS_USRKEY) { 128 if (!(op->flags & AES_FLAGS_HIDDENKEY)) {
124 flags |= AES_CTRL_WRKEY; 129 flags |= AES_CTRL_WRKEY;
125 _writefield(AES_WRITEKEY0_REG, op->key); 130 _writefield(AES_WRITEKEY0_REG, op->key);
126 } 131 }
@@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg = {
289 .setkey = geode_setkey, 294 .setkey = geode_setkey,
290 .encrypt = geode_cbc_encrypt, 295 .encrypt = geode_cbc_encrypt,
291 .decrypt = geode_cbc_decrypt, 296 .decrypt = geode_cbc_decrypt,
297 .ivsize = AES_IV_LENGTH,
292 } 298 }
293 } 299 }
294}; 300};
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h
index 8003a36f3a83..f47968671ae7 100644
--- a/drivers/crypto/geode-aes.h
+++ b/drivers/crypto/geode-aes.h
@@ -20,8 +20,7 @@
20#define AES_DIR_DECRYPT 0 20#define AES_DIR_DECRYPT 0
21#define AES_DIR_ENCRYPT 1 21#define AES_DIR_ENCRYPT 1
22 22
23#define AES_FLAGS_USRKEY (1 << 0) 23#define AES_FLAGS_HIDDENKEY (1 << 0)
24#define AES_FLAGS_COHERENT (1 << 1)
25 24
26struct geode_aes_op { 25struct geode_aes_op {
27 26
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0c160675b3ac..366f4a1a2cb8 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -491,6 +491,12 @@ out:
491 491
492/* Sysfs Files */ 492/* Sysfs Files */
493 493
494static ssize_t applesmc_name_show(struct device *dev,
495 struct device_attribute *attr, char *buf)
496{
497 return snprintf(buf, PAGE_SIZE, "applesmc\n");
498}
499
494static ssize_t applesmc_position_show(struct device *dev, 500static ssize_t applesmc_position_show(struct device *dev,
495 struct device_attribute *attr, char *buf) 501 struct device_attribute *attr, char *buf)
496{ 502{
@@ -913,6 +919,8 @@ static struct led_classdev applesmc_backlight = {
913 .brightness_set = applesmc_brightness_set, 919 .brightness_set = applesmc_brightness_set,
914}; 920};
915 921
922static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL);
923
916static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL); 924static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL);
917static DEVICE_ATTR(calibrate, 0644, 925static DEVICE_ATTR(calibrate, 0644,
918 applesmc_calibrate_show, applesmc_calibrate_store); 926 applesmc_calibrate_show, applesmc_calibrate_store);
@@ -1197,6 +1205,8 @@ static int __init applesmc_init(void)
1197 goto out_driver; 1205 goto out_driver;
1198 } 1206 }
1199 1207
1208 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr);
1209
1200 /* Create key enumeration sysfs files */ 1210 /* Create key enumeration sysfs files */
1201 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); 1211 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group);
1202 if (ret) 1212 if (ret)
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
index ff284aeb8fbb..82edc1c1db7a 100644
--- a/drivers/isdn/hardware/eicon/capifunc.c
+++ b/drivers/isdn/hardware/eicon/capifunc.c
@@ -189,21 +189,21 @@ void *TransmitBufferSet(APPL * appl, dword ref)
189{ 189{
190 appl->xbuffer_used[ref] = true; 190 appl->xbuffer_used[ref] = true;
191 DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1)) 191 DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1))
192 return (void *) ref; 192 return (void *)(long)ref;
193} 193}
194 194
195void *TransmitBufferGet(APPL * appl, void *p) 195void *TransmitBufferGet(APPL * appl, void *p)
196{ 196{
197 if (appl->xbuffer_internal[(dword) p]) 197 if (appl->xbuffer_internal[(dword)(long)p])
198 return appl->xbuffer_internal[(dword) p]; 198 return appl->xbuffer_internal[(dword)(long)p];
199 199
200 return appl->xbuffer_ptr[(dword) p]; 200 return appl->xbuffer_ptr[(dword)(long)p];
201} 201}
202 202
203void TransmitBufferFree(APPL * appl, void *p) 203void TransmitBufferFree(APPL * appl, void *p)
204{ 204{
205 appl->xbuffer_used[(dword) p] = false; 205 appl->xbuffer_used[(dword)(long)p] = false;
206 DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword) p) + 1)) 206 DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword)(long)p) + 1))
207} 207}
208 208
209void *ReceiveBufferGet(APPL * appl, int Num) 209void *ReceiveBufferGet(APPL * appl, int Num)
@@ -301,7 +301,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
301 /* if DATA_B3_IND, copy data too */ 301 /* if DATA_B3_IND, copy data too */
302 if (command == _DATA_B3_I) { 302 if (command == _DATA_B3_I) {
303 dword data = GET_DWORD(&msg.info.data_b3_ind.Data); 303 dword data = GET_DWORD(&msg.info.data_b3_ind.Data);
304 memcpy(write + length, (void *) data, dlength); 304 memcpy(write + length, (void *)(long)data, dlength);
305 } 305 }
306 306
307#ifndef DIVA_NO_DEBUGLIB 307#ifndef DIVA_NO_DEBUGLIB
@@ -318,7 +318,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
318 if (myDriverDebugHandle.dbgMask & DL_BLK) { 318 if (myDriverDebugHandle.dbgMask & DL_BLK) {
319 xlog("\x00\x02", &msg, 0x81, length); 319 xlog("\x00\x02", &msg, 0x81, length);
320 for (i = 0; i < dlength; i += 256) { 320 for (i = 0; i < dlength; i += 256) {
321 DBG_BLK((((char *) GET_DWORD(&msg.info.data_b3_ind.Data)) + i, 321 DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i,
322 ((dlength - i) < 256) ? (dlength - i) : 256)) 322 ((dlength - i) < 256) ? (dlength - i) : 256))
323 if (!(myDriverDebugHandle.dbgMask & DL_PRV0)) 323 if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
324 break; /* not more if not explicitely requested */ 324 break; /* not more if not explicitely requested */
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 784232a144c8..ccd35d047ec8 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * 2 *
4 Copyright (c) Eicon Networks, 2002. 3 Copyright (c) Eicon Networks, 2002.
@@ -533,7 +532,7 @@ word api_put(APPL * appl, CAPI_MSG * msg)
533 if (m->header.command == _DATA_B3_R) 532 if (m->header.command == _DATA_B3_R)
534 { 533 {
535 534
536 m->info.data_b3_req.Data = (dword)(TransmitBufferSet (appl, m->info.data_b3_req.Data)); 535 m->info.data_b3_req.Data = (dword)(long)(TransmitBufferSet (appl, m->info.data_b3_req.Data));
537 536
538 } 537 }
539 538
@@ -1032,7 +1031,7 @@ static void plci_free_msg_in_queue (PLCI *plci)
1032 { 1031 {
1033 1032
1034 TransmitBufferFree (plci->appl, 1033 TransmitBufferFree (plci->appl,
1035 (byte *)(((CAPI_MSG *)(&((byte *)(plci->msg_in_queue))[i]))->info.data_b3_req.Data)); 1034 (byte *)(long)(((CAPI_MSG *)(&((byte *)(plci->msg_in_queue))[i]))->info.data_b3_req.Data));
1036 1035
1037 } 1036 }
1038 1037
@@ -3118,7 +3117,7 @@ byte data_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci,
3118 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) 3117 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue)))
3119 { 3118 {
3120 3119
3121 data->P = (byte *)(*((dword *)(parms[0].info))); 3120 data->P = (byte *)(long)(*((dword *)(parms[0].info)));
3122 3121
3123 } 3122 }
3124 else 3123 else
@@ -3151,7 +3150,7 @@ byte data_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci,
3151 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) 3150 && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue)))
3152 { 3151 {
3153 3152
3154 TransmitBufferFree (appl, (byte *)(*((dword *)(parms[0].info)))); 3153 TransmitBufferFree (appl, (byte *)(long)(*((dword *)(parms[0].info))));
3155 3154
3156 } 3155 }
3157 } 3156 }
@@ -4057,7 +4056,7 @@ capi_callback_suffix:
4057 { 4056 {
4058 if (m->header.command == _DATA_B3_R) 4057 if (m->header.command == _DATA_B3_R)
4059 4058
4060 TransmitBufferFree (appl, (byte *)(m->info.data_b3_req.Data)); 4059 TransmitBufferFree (appl, (byte *)(long)(m->info.data_b3_req.Data));
4061 4060
4062 dbug(1,dprintf("Error 0x%04x from msg(0x%04x)", i, m->header.command)); 4061 dbug(1,dprintf("Error 0x%04x from msg(0x%04x)", i, m->header.command));
4063 break; 4062 break;
@@ -7134,7 +7133,7 @@ void nl_ind(PLCI * plci)
7134 case N_UDATA: 7133 case N_UDATA:
7135 if (!(udata_forwarding_table[plci->NL.RBuffer->P[0] >> 5] & (1L << (plci->NL.RBuffer->P[0] & 0x1f)))) 7134 if (!(udata_forwarding_table[plci->NL.RBuffer->P[0] >> 5] & (1L << (plci->NL.RBuffer->P[0] & 0x1f))))
7136 { 7135 {
7137 plci->RData[0].P = plci->internal_ind_buffer + (-((int)(plci->internal_ind_buffer)) & 3); 7136 plci->RData[0].P = plci->internal_ind_buffer + (-((int)(long)(plci->internal_ind_buffer)) & 3);
7138 plci->RData[0].PLength = INTERNAL_IND_BUFFER_SIZE; 7137 plci->RData[0].PLength = INTERNAL_IND_BUFFER_SIZE;
7139 plci->NL.R = plci->RData; 7138 plci->NL.R = plci->RData;
7140 plci->NL.RNum = 1; 7139 plci->NL.RNum = 1;
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index da4196f21e0f..8d53a7fd2671 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1551,7 +1551,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
1551 if (retval == 0) { // yuck 1551 if (retval == 0) { // yuck
1552 cards[i].typ = 0; 1552 cards[i].typ = 0;
1553 nrcards--; 1553 nrcards--;
1554 return retval; 1554 return -EINVAL;
1555 } 1555 }
1556 cs = cards[i].cs; 1556 cs = cards[i].cs;
1557 hisax_d_if->cs = cs; 1557 hisax_d_if->cs = cs;
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index 1f18f1993387..b1a26e02df02 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -485,7 +485,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe,
485{ 485{
486 int k; 486 int k;
487 487
488 spin_lock_init(&urb->lock);
489 urb->dev = dev; 488 urb->dev = dev;
490 urb->pipe = pipe; 489 urb->pipe = pipe;
491 urb->complete = complete; 490 urb->complete = complete;
@@ -578,16 +577,14 @@ stop_isoc_chain(usb_fifo * fifo)
578 "HFC-S USB: Stopping iso chain for fifo %i.%i", 577 "HFC-S USB: Stopping iso chain for fifo %i.%i",
579 fifo->fifonum, i); 578 fifo->fifonum, i);
580#endif 579#endif
581 usb_unlink_urb(fifo->iso[i].purb); 580 usb_kill_urb(fifo->iso[i].purb);
582 usb_free_urb(fifo->iso[i].purb); 581 usb_free_urb(fifo->iso[i].purb);
583 fifo->iso[i].purb = NULL; 582 fifo->iso[i].purb = NULL;
584 } 583 }
585 } 584 }
586 if (fifo->urb) { 585 usb_kill_urb(fifo->urb);
587 usb_unlink_urb(fifo->urb); 586 usb_free_urb(fifo->urb);
588 usb_free_urb(fifo->urb); 587 fifo->urb = NULL;
589 fifo->urb = NULL;
590 }
591 fifo->active = 0; 588 fifo->active = 0;
592} 589}
593 590
@@ -1305,7 +1302,11 @@ usb_init(hfcusb_data * hfc)
1305 } 1302 }
1306 /* default Prot: EURO ISDN, should be a module_param */ 1303 /* default Prot: EURO ISDN, should be a module_param */
1307 hfc->protocol = 2; 1304 hfc->protocol = 2;
1308 hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol); 1305 i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol);
1306 if (i) {
1307 printk(KERN_INFO "HFC-S USB: hisax_register -> %d\n", i);
1308 return i;
1309 }
1309 1310
1310#ifdef CONFIG_HISAX_DEBUG 1311#ifdef CONFIG_HISAX_DEBUG
1311 hfc_debug = debug; 1312 hfc_debug = debug;
@@ -1626,11 +1627,9 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1626#endif 1627#endif
1627 /* init the chip and register the driver */ 1628 /* init the chip and register the driver */
1628 if (usb_init(context)) { 1629 if (usb_init(context)) {
1629 if (context->ctrl_urb) { 1630 usb_kill_urb(context->ctrl_urb);
1630 usb_unlink_urb(context->ctrl_urb); 1631 usb_free_urb(context->ctrl_urb);
1631 usb_free_urb(context->ctrl_urb); 1632 context->ctrl_urb = NULL;
1632 context->ctrl_urb = NULL;
1633 }
1634 kfree(context); 1633 kfree(context);
1635 return (-EIO); 1634 return (-EIO);
1636 } 1635 }
@@ -1682,21 +1681,15 @@ hfc_usb_disconnect(struct usb_interface
1682 i); 1681 i);
1683#endif 1682#endif
1684 } 1683 }
1685 if (context->fifos[i].urb) { 1684 usb_kill_urb(context->fifos[i].urb);
1686 usb_unlink_urb(context->fifos[i].urb); 1685 usb_free_urb(context->fifos[i].urb);
1687 usb_free_urb(context->fifos[i].urb); 1686 context->fifos[i].urb = NULL;
1688 context->fifos[i].urb = NULL;
1689 }
1690 } 1687 }
1691 context->fifos[i].active = 0; 1688 context->fifos[i].active = 0;
1692 } 1689 }
1693 /* wait for all URBS to terminate */ 1690 usb_kill_urb(context->ctrl_urb);
1694 mdelay(10); 1691 usb_free_urb(context->ctrl_urb);
1695 if (context->ctrl_urb) { 1692 context->ctrl_urb = NULL;
1696 usb_unlink_urb(context->ctrl_urb);
1697 usb_free_urb(context->ctrl_urb);
1698 context->ctrl_urb = NULL;
1699 }
1700 hisax_unregister(&context->d_if); 1693 hisax_unregister(&context->d_if);
1701 kfree(context); /* free our structure again */ 1694 kfree(context); /* free our structure again */
1702} /* hfc_usb_disconnect */ 1695} /* hfc_usb_disconnect */
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index 9e088fce8c3a..7993e01f9fc5 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -859,7 +859,11 @@ new_adapter(void)
859 for (i = 0; i < 2; i++) 859 for (i = 0; i < 2; i++)
860 b_if[i] = &adapter->bcs[i].b_if; 860 b_if[i] = &adapter->bcs[i].b_if;
861 861
862 hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp", protocol); 862 if (hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp",
863 protocol) != 0) {
864 kfree(adapter);
865 adapter = NULL;
866 }
863 867
864 return adapter; 868 return adapter;
865} 869}
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c
index bb3a28a53ff4..13751237bfcd 100644
--- a/drivers/isdn/hisax/st5481_init.c
+++ b/drivers/isdn/hisax/st5481_init.c
@@ -107,12 +107,17 @@ static int probe_st5481(struct usb_interface *intf,
107 for (i = 0; i < 2; i++) 107 for (i = 0; i < 2; i++)
108 b_if[i] = &adapter->bcs[i].b_if; 108 b_if[i] = &adapter->bcs[i].b_if;
109 109
110 hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb", protocol); 110 if (hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb",
111 protocol) != 0)
112 goto err_b1;
113
111 st5481_start(adapter); 114 st5481_start(adapter);
112 115
113 usb_set_intfdata(intf, adapter); 116 usb_set_intfdata(intf, adapter);
114 return 0; 117 return 0;
115 118
119 err_b1:
120 st5481_release_b(&adapter->bcs[1]);
116 err_b: 121 err_b:
117 st5481_release_b(&adapter->bcs[0]); 122 st5481_release_b(&adapter->bcs[0]);
118 err_d: 123 err_d:
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
index ff1595122048..4ada66b8b679 100644
--- a/drivers/isdn/hisax/st5481_usb.c
+++ b/drivers/isdn/hisax/st5481_usb.c
@@ -407,7 +407,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev,
407{ 407{
408 int k; 408 int k;
409 409
410 spin_lock_init(&urb->lock);
411 urb->dev=dev; 410 urb->dev=dev;
412 urb->pipe=pipe; 411 urb->pipe=pipe;
413 urb->interval = 1; 412 urb->interval = 1;
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 5a4a74c1097c..9620d452d030 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -255,19 +255,25 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde
255 255
256} 256}
257 257
258static int write_sb_page(mddev_t *mddev, long offset, struct page *page, int wait) 258static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
259{ 259{
260 mdk_rdev_t *rdev; 260 mdk_rdev_t *rdev;
261 struct list_head *tmp; 261 struct list_head *tmp;
262 mddev_t *mddev = bitmap->mddev;
262 263
263 ITERATE_RDEV(mddev, rdev, tmp) 264 ITERATE_RDEV(mddev, rdev, tmp)
264 if (test_bit(In_sync, &rdev->flags) 265 if (test_bit(In_sync, &rdev->flags)
265 && !test_bit(Faulty, &rdev->flags)) 266 && !test_bit(Faulty, &rdev->flags)) {
267 int size = PAGE_SIZE;
268 if (page->index == bitmap->file_pages-1)
269 size = roundup(bitmap->last_page_size,
270 bdev_hardsect_size(rdev->bdev));
266 md_super_write(mddev, rdev, 271 md_super_write(mddev, rdev,
267 (rdev->sb_offset<<1) + offset 272 (rdev->sb_offset<<1) + bitmap->offset
268 + page->index * (PAGE_SIZE/512), 273 + page->index * (PAGE_SIZE/512),
269 PAGE_SIZE, 274 size,
270 page); 275 page);
276 }
271 277
272 if (wait) 278 if (wait)
273 md_super_wait(mddev); 279 md_super_wait(mddev);
@@ -282,7 +288,7 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait)
282 struct buffer_head *bh; 288 struct buffer_head *bh;
283 289
284 if (bitmap->file == NULL) 290 if (bitmap->file == NULL)
285 return write_sb_page(bitmap->mddev, bitmap->offset, page, wait); 291 return write_sb_page(bitmap, page, wait);
286 292
287 bh = page_buffers(page); 293 bh = page_buffers(page);
288 294
@@ -923,6 +929,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
923 } 929 }
924 930
925 bitmap->filemap[bitmap->file_pages++] = page; 931 bitmap->filemap[bitmap->file_pages++] = page;
932 bitmap->last_page_size = count;
926 } 933 }
927 paddr = kmap_atomic(page, KM_USER0); 934 paddr = kmap_atomic(page, KM_USER0);
928 if (bitmap->flags & BITMAP_HOSTENDIAN) 935 if (bitmap->flags & BITMAP_HOSTENDIAN)
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index d5ecd2d53046..192741083196 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -139,8 +139,6 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
139 if (!conf) 139 if (!conf)
140 return NULL; 140 return NULL;
141 141
142 mddev->private = conf;
143
144 cnt = 0; 142 cnt = 0;
145 conf->array_size = 0; 143 conf->array_size = 0;
146 144
@@ -232,7 +230,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
232 * First calculate the device offsets. 230 * First calculate the device offsets.
233 */ 231 */
234 conf->disks[0].offset = 0; 232 conf->disks[0].offset = 0;
235 for (i=1; i<mddev->raid_disks; i++) 233 for (i = 1; i < raid_disks; i++)
236 conf->disks[i].offset = 234 conf->disks[i].offset =
237 conf->disks[i-1].offset + 235 conf->disks[i-1].offset +
238 conf->disks[i-1].size; 236 conf->disks[i-1].size;
@@ -244,7 +242,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
244 curr_offset < conf->array_size; 242 curr_offset < conf->array_size;
245 curr_offset += conf->hash_spacing) { 243 curr_offset += conf->hash_spacing) {
246 244
247 while (i < mddev->raid_disks-1 && 245 while (i < raid_disks-1 &&
248 curr_offset >= conf->disks[i+1].offset) 246 curr_offset >= conf->disks[i+1].offset)
249 i++; 247 i++;
250 248
@@ -299,9 +297,11 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
299 */ 297 */
300 linear_conf_t *newconf; 298 linear_conf_t *newconf;
301 299
302 if (rdev->raid_disk != mddev->raid_disks) 300 if (rdev->saved_raid_disk != mddev->raid_disks)
303 return -EINVAL; 301 return -EINVAL;
304 302
303 rdev->raid_disk = rdev->saved_raid_disk;
304
305 newconf = linear_conf(mddev,mddev->raid_disks+1); 305 newconf = linear_conf(mddev,mddev->raid_disks+1);
306 306
307 if (!newconf) 307 if (!newconf)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c10ce91b64e9..1c54f3c1cca7 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1298,8 +1298,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1298 ITERATE_RDEV(mddev,rdev2,tmp) 1298 ITERATE_RDEV(mddev,rdev2,tmp)
1299 if (rdev2->desc_nr+1 > max_dev) 1299 if (rdev2->desc_nr+1 > max_dev)
1300 max_dev = rdev2->desc_nr+1; 1300 max_dev = rdev2->desc_nr+1;
1301 1301
1302 sb->max_dev = cpu_to_le32(max_dev); 1302 if (max_dev > le32_to_cpu(sb->max_dev))
1303 sb->max_dev = cpu_to_le32(max_dev);
1303 for (i=0; i<max_dev;i++) 1304 for (i=0; i<max_dev;i++)
1304 sb->dev_roles[i] = cpu_to_le16(0xfffe); 1305 sb->dev_roles[i] = cpu_to_le16(0xfffe);
1305 1306
@@ -1365,10 +1366,14 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1365 } 1366 }
1366 /* make sure rdev->size exceeds mddev->size */ 1367 /* make sure rdev->size exceeds mddev->size */
1367 if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) { 1368 if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) {
1368 if (mddev->pers) 1369 if (mddev->pers) {
1369 /* Cannot change size, so fail */ 1370 /* Cannot change size, so fail
1370 return -ENOSPC; 1371 * If mddev->level <= 0, then we don't care
1371 else 1372 * about aligning sizes (e.g. linear)
1373 */
1374 if (mddev->level > 0)
1375 return -ENOSPC;
1376 } else
1372 mddev->size = rdev->size; 1377 mddev->size = rdev->size;
1373 } 1378 }
1374 1379
@@ -2142,6 +2147,9 @@ static void analyze_sbs(mddev_t * mddev)
2142 rdev->desc_nr = i++; 2147 rdev->desc_nr = i++;
2143 rdev->raid_disk = rdev->desc_nr; 2148 rdev->raid_disk = rdev->desc_nr;
2144 set_bit(In_sync, &rdev->flags); 2149 set_bit(In_sync, &rdev->flags);
2150 } else if (rdev->raid_disk >= mddev->raid_disks) {
2151 rdev->raid_disk = -1;
2152 clear_bit(In_sync, &rdev->flags);
2145 } 2153 }
2146 } 2154 }
2147 2155
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index dfe32149ad3a..2c404f73a377 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -415,7 +415,7 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
415 raid0_conf_t *conf = mddev_to_conf(mddev); 415 raid0_conf_t *conf = mddev_to_conf(mddev);
416 struct strip_zone *zone; 416 struct strip_zone *zone;
417 mdk_rdev_t *tmp_dev; 417 mdk_rdev_t *tmp_dev;
418 unsigned long chunk; 418 sector_t chunk;
419 sector_t block, rsect; 419 sector_t block, rsect;
420 const int rw = bio_data_dir(bio); 420 const int rw = bio_data_dir(bio);
421 421
@@ -470,7 +470,6 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
470 470
471 sector_div(x, zone->nb_dev); 471 sector_div(x, zone->nb_dev);
472 chunk = x; 472 chunk = x;
473 BUG_ON(x != (sector_t)chunk);
474 473
475 x = block >> chunksize_bits; 474 x = block >> chunksize_bits;
476 tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; 475 tmp_dev = zone->dev[sector_div(x, zone->nb_dev)];
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index d3235f213c89..e0d474b17433 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -123,8 +123,12 @@ int i2o_driver_register(struct i2o_driver *drv)
123 } 123 }
124 124
125 rc = driver_register(&drv->driver); 125 rc = driver_register(&drv->driver);
126 if (rc) 126 if (rc) {
127 destroy_workqueue(drv->event_queue); 127 if (drv->event) {
128 destroy_workqueue(drv->event_queue);
129 drv->event_queue = NULL;
130 }
131 }
128 132
129 return rc; 133 return rc;
130}; 134};
@@ -256,7 +260,7 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c)
256 int i; 260 int i;
257 struct i2o_driver *drv; 261 struct i2o_driver *drv;
258 262
259 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 263 for (i = 0; i < i2o_max_drivers; i++) {
260 drv = i2o_drivers[i]; 264 drv = i2o_drivers[i];
261 265
262 if (drv) 266 if (drv)
@@ -276,7 +280,7 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c)
276 int i; 280 int i;
277 struct i2o_driver *drv; 281 struct i2o_driver *drv;
278 282
279 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 283 for (i = 0; i < i2o_max_drivers; i++) {
280 drv = i2o_drivers[i]; 284 drv = i2o_drivers[i];
281 285
282 if (drv) 286 if (drv)
@@ -295,7 +299,7 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev)
295 int i; 299 int i;
296 struct i2o_driver *drv; 300 struct i2o_driver *drv;
297 301
298 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 302 for (i = 0; i < i2o_max_drivers; i++) {
299 drv = i2o_drivers[i]; 303 drv = i2o_drivers[i];
300 304
301 if (drv) 305 if (drv)
@@ -314,7 +318,7 @@ void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev)
314 int i; 318 int i;
315 struct i2o_driver *drv; 319 struct i2o_driver *drv;
316 320
317 for (i = 0; i < I2O_MAX_DRIVERS; i++) { 321 for (i = 0; i < i2o_max_drivers; i++) {
318 drv = i2o_drivers[i]; 322 drv = i2o_drivers[i];
319 323
320 if (drv) 324 if (drv)
@@ -335,17 +339,15 @@ int __init i2o_driver_init(void)
335 339
336 spin_lock_init(&i2o_drivers_lock); 340 spin_lock_init(&i2o_drivers_lock);
337 341
338 if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || 342 if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64)) {
339 ((i2o_max_drivers ^ (i2o_max_drivers - 1)) != 343 osm_warn("max_drivers set to %d, but must be >=2 and <= 64\n",
340 (2 * i2o_max_drivers - 1))) { 344 i2o_max_drivers);
341 osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and "
342 "a power of 2\n", i2o_max_drivers);
343 i2o_max_drivers = I2O_MAX_DRIVERS; 345 i2o_max_drivers = I2O_MAX_DRIVERS;
344 } 346 }
345 osm_info("max drivers = %d\n", i2o_max_drivers); 347 osm_info("max drivers = %d\n", i2o_max_drivers);
346 348
347 i2o_drivers = 349 i2o_drivers =
348 kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); 350 kcalloc(i2o_max_drivers, sizeof(*i2o_drivers), GFP_KERNEL);
349 if (!i2o_drivers) 351 if (!i2o_drivers)
350 return -ENOMEM; 352 return -ENOMEM;
351 353
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index 35b139b0e5f2..5108b7c576df 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -47,6 +47,7 @@ struct phantom_device {
47 struct cdev cdev; 47 struct cdev cdev;
48 48
49 struct mutex open_lock; 49 struct mutex open_lock;
50 spinlock_t ioctl_lock;
50}; 51};
51 52
52static unsigned char phantom_devices[PHANTOM_MAX_MINORS]; 53static unsigned char phantom_devices[PHANTOM_MAX_MINORS];
@@ -59,8 +60,11 @@ static int phantom_status(struct phantom_device *dev, unsigned long newstat)
59 atomic_set(&dev->counter, 0); 60 atomic_set(&dev->counter, 0);
60 iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL); 61 iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL);
61 iowrite32(0x43, dev->caddr + PHN_IRQCTL); 62 iowrite32(0x43, dev->caddr + PHN_IRQCTL);
62 } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) 63 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
64 } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) {
63 iowrite32(0, dev->caddr + PHN_IRQCTL); 65 iowrite32(0, dev->caddr + PHN_IRQCTL);
66 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
67 }
64 68
65 dev->status = newstat; 69 dev->status = newstat;
66 70
@@ -71,8 +75,8 @@ static int phantom_status(struct phantom_device *dev, unsigned long newstat)
71 * File ops 75 * File ops
72 */ 76 */
73 77
74static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd, 78static long phantom_ioctl(struct file *file, unsigned int cmd,
75 u_long arg) 79 unsigned long arg)
76{ 80{
77 struct phantom_device *dev = file->private_data; 81 struct phantom_device *dev = file->private_data;
78 struct phm_regs rs; 82 struct phm_regs rs;
@@ -92,24 +96,32 @@ static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd,
92 if (r.reg > 7) 96 if (r.reg > 7)
93 return -EINVAL; 97 return -EINVAL;
94 98
99 spin_lock(&dev->ioctl_lock);
95 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) && 100 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) &&
96 phantom_status(dev, dev->status | PHB_RUNNING)) 101 phantom_status(dev, dev->status | PHB_RUNNING)){
102 spin_unlock(&dev->ioctl_lock);
97 return -ENODEV; 103 return -ENODEV;
104 }
98 105
99 pr_debug("phantom: writing %x to %u\n", r.value, r.reg); 106 pr_debug("phantom: writing %x to %u\n", r.value, r.reg);
100 iowrite32(r.value, dev->iaddr + r.reg); 107 iowrite32(r.value, dev->iaddr + r.reg);
108 ioread32(dev->iaddr); /* PCI posting */
101 109
102 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ)) 110 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ))
103 phantom_status(dev, dev->status & ~PHB_RUNNING); 111 phantom_status(dev, dev->status & ~PHB_RUNNING);
112 spin_unlock(&dev->ioctl_lock);
104 break; 113 break;
105 case PHN_SET_REGS: 114 case PHN_SET_REGS:
106 if (copy_from_user(&rs, argp, sizeof(rs))) 115 if (copy_from_user(&rs, argp, sizeof(rs)))
107 return -EFAULT; 116 return -EFAULT;
108 117
109 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask); 118 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask);
119 spin_lock(&dev->ioctl_lock);
110 for (i = 0; i < min(rs.count, 8U); i++) 120 for (i = 0; i < min(rs.count, 8U); i++)
111 if ((1 << i) & rs.mask) 121 if ((1 << i) & rs.mask)
112 iowrite32(rs.values[i], dev->oaddr + i); 122 iowrite32(rs.values[i], dev->oaddr + i);
123 ioread32(dev->iaddr); /* PCI posting */
124 spin_unlock(&dev->ioctl_lock);
113 break; 125 break;
114 case PHN_GET_REG: 126 case PHN_GET_REG:
115 if (copy_from_user(&r, argp, sizeof(r))) 127 if (copy_from_user(&r, argp, sizeof(r)))
@@ -128,9 +140,11 @@ static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd,
128 return -EFAULT; 140 return -EFAULT;
129 141
130 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask); 142 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask);
143 spin_lock(&dev->ioctl_lock);
131 for (i = 0; i < min(rs.count, 8U); i++) 144 for (i = 0; i < min(rs.count, 8U); i++)
132 if ((1 << i) & rs.mask) 145 if ((1 << i) & rs.mask)
133 rs.values[i] = ioread32(dev->iaddr + i); 146 rs.values[i] = ioread32(dev->iaddr + i);
147 spin_unlock(&dev->ioctl_lock);
134 148
135 if (copy_to_user(argp, &rs, sizeof(rs))) 149 if (copy_to_user(argp, &rs, sizeof(rs)))
136 return -EFAULT; 150 return -EFAULT;
@@ -199,7 +213,7 @@ static unsigned int phantom_poll(struct file *file, poll_table *wait)
199static struct file_operations phantom_file_ops = { 213static struct file_operations phantom_file_ops = {
200 .open = phantom_open, 214 .open = phantom_open,
201 .release = phantom_release, 215 .release = phantom_release,
202 .ioctl = phantom_ioctl, 216 .unlocked_ioctl = phantom_ioctl,
203 .poll = phantom_poll, 217 .poll = phantom_poll,
204}; 218};
205 219
@@ -212,6 +226,7 @@ static irqreturn_t phantom_isr(int irq, void *data)
212 226
213 iowrite32(0, dev->iaddr); 227 iowrite32(0, dev->iaddr);
214 iowrite32(0xc0, dev->iaddr); 228 iowrite32(0xc0, dev->iaddr);
229 ioread32(dev->iaddr); /* PCI posting */
215 230
216 atomic_inc(&dev->counter); 231 atomic_inc(&dev->counter);
217 wake_up_interruptible(&dev->wait); 232 wake_up_interruptible(&dev->wait);
@@ -282,11 +297,13 @@ static int __devinit phantom_probe(struct pci_dev *pdev,
282 } 297 }
283 298
284 mutex_init(&pht->open_lock); 299 mutex_init(&pht->open_lock);
300 spin_lock_init(&pht->ioctl_lock);
285 init_waitqueue_head(&pht->wait); 301 init_waitqueue_head(&pht->wait);
286 cdev_init(&pht->cdev, &phantom_file_ops); 302 cdev_init(&pht->cdev, &phantom_file_ops);
287 pht->cdev.owner = THIS_MODULE; 303 pht->cdev.owner = THIS_MODULE;
288 304
289 iowrite32(0, pht->caddr + PHN_IRQCTL); 305 iowrite32(0, pht->caddr + PHN_IRQCTL);
306 ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */
290 retval = request_irq(pdev->irq, phantom_isr, 307 retval = request_irq(pdev->irq, phantom_isr,
291 IRQF_SHARED | IRQF_DISABLED, "phantom", pht); 308 IRQF_SHARED | IRQF_DISABLED, "phantom", pht);
292 if (retval) { 309 if (retval) {
@@ -337,6 +354,7 @@ static void __devexit phantom_remove(struct pci_dev *pdev)
337 cdev_del(&pht->cdev); 354 cdev_del(&pht->cdev);
338 355
339 iowrite32(0, pht->caddr + PHN_IRQCTL); 356 iowrite32(0, pht->caddr + PHN_IRQCTL);
357 ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */
340 free_irq(pdev->irq, pht); 358 free_irq(pdev->irq, pht);
341 359
342 pci_iounmap(pdev, pht->oaddr); 360 pci_iounmap(pdev, pht->oaddr);
@@ -358,6 +376,7 @@ static int phantom_suspend(struct pci_dev *pdev, pm_message_t state)
358 struct phantom_device *dev = pci_get_drvdata(pdev); 376 struct phantom_device *dev = pci_get_drvdata(pdev);
359 377
360 iowrite32(0, dev->caddr + PHN_IRQCTL); 378 iowrite32(0, dev->caddr + PHN_IRQCTL);
379 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
361 380
362 return 0; 381 return 0;
363} 382}
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index a7562f7fc0b3..540ff4bea54c 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -135,23 +135,6 @@ struct mmc_blk_request {
135 struct mmc_data data; 135 struct mmc_data data;
136}; 136};
137 137
138static int mmc_blk_prep_rq(struct mmc_queue *mq, struct request *req)
139{
140 struct mmc_blk_data *md = mq->data;
141 int stat = BLKPREP_OK;
142
143 /*
144 * If we have no device, we haven't finished initialising.
145 */
146 if (!md || !mq->card) {
147 printk(KERN_ERR "%s: killing request - no device/host\n",
148 req->rq_disk->disk_name);
149 stat = BLKPREP_KILL;
150 }
151
152 return stat;
153}
154
155static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) 138static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
156{ 139{
157 int err; 140 int err;
@@ -460,7 +443,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
460 if (ret) 443 if (ret)
461 goto err_putdisk; 444 goto err_putdisk;
462 445
463 md->queue.prep_fn = mmc_blk_prep_rq;
464 md->queue.issue_fn = mmc_blk_issue_rq; 446 md->queue.issue_fn = mmc_blk_issue_rq;
465 md->queue.data = md; 447 md->queue.data = md;
466 448
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 2e77963db334..dd97bc798409 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -20,40 +20,21 @@
20#define MMC_QUEUE_SUSPENDED (1 << 0) 20#define MMC_QUEUE_SUSPENDED (1 << 0)
21 21
22/* 22/*
23 * Prepare a MMC request. Essentially, this means passing the 23 * Prepare a MMC request. This just filters out odd stuff.
24 * preparation off to the media driver. The media driver will
25 * create a mmc_io_request in req->special.
26 */ 24 */
27static int mmc_prep_request(struct request_queue *q, struct request *req) 25static int mmc_prep_request(struct request_queue *q, struct request *req)
28{ 26{
29 struct mmc_queue *mq = q->queuedata; 27 /*
30 int ret = BLKPREP_KILL; 28 * We only like normal block requests.
31 29 */
32 if (blk_special_request(req)) { 30 if (!blk_fs_request(req) && !blk_pc_request(req)) {
33 /*
34 * Special commands already have the command
35 * blocks already setup in req->special.
36 */
37 BUG_ON(!req->special);
38
39 ret = BLKPREP_OK;
40 } else if (blk_fs_request(req) || blk_pc_request(req)) {
41 /*
42 * Block I/O requests need translating according
43 * to the protocol.
44 */
45 ret = mq->prep_fn(mq, req);
46 } else {
47 /*
48 * Everything else is invalid.
49 */
50 blk_dump_rq_flags(req, "MMC bad request"); 31 blk_dump_rq_flags(req, "MMC bad request");
32 return BLKPREP_KILL;
51 } 33 }
52 34
53 if (ret == BLKPREP_OK) 35 req->cmd_flags |= REQ_DONTPREP;
54 req->cmd_flags |= REQ_DONTPREP;
55 36
56 return ret; 37 return BLKPREP_OK;
57} 38}
58 39
59static int mmc_queue_thread(void *d) 40static int mmc_queue_thread(void *d)
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
index c9f139e764f6..1590b3f3f1f7 100644
--- a/drivers/mmc/card/queue.h
+++ b/drivers/mmc/card/queue.h
@@ -10,20 +10,12 @@ struct mmc_queue {
10 struct semaphore thread_sem; 10 struct semaphore thread_sem;
11 unsigned int flags; 11 unsigned int flags;
12 struct request *req; 12 struct request *req;
13 int (*prep_fn)(struct mmc_queue *, struct request *);
14 int (*issue_fn)(struct mmc_queue *, struct request *); 13 int (*issue_fn)(struct mmc_queue *, struct request *);
15 void *data; 14 void *data;
16 struct request_queue *queue; 15 struct request_queue *queue;
17 struct scatterlist *sg; 16 struct scatterlist *sg;
18}; 17};
19 18
20struct mmc_io_request {
21 struct request *rq;
22 int num;
23 struct mmc_command selcmd; /* mmc_queue private */
24 struct mmc_command cmd[4]; /* max 4 commands */
25};
26
27extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); 19extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *);
28extern void mmc_cleanup_queue(struct mmc_queue *); 20extern void mmc_cleanup_queue(struct mmc_queue *);
29extern void mmc_queue_suspend(struct mmc_queue *); 21extern void mmc_queue_suspend(struct mmc_queue *);
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index 7284ccad0b91..4030274fe788 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -2,10 +2,8 @@
2# Arcnet configuration 2# Arcnet configuration
3# 3#
4 4
5menu "ARCnet devices" 5menuconfig ARCNET
6 depends on NETDEVICES && (ISA || PCI) 6 depends on NETDEVICES && (ISA || PCI)
7
8config ARCNET
9 tristate "ARCnet support" 7 tristate "ARCnet support"
10 ---help--- 8 ---help---
11 If you have a network card of this type, say Y and check out the 9 If you have a network card of this type, say Y and check out the
@@ -25,9 +23,10 @@ config ARCNET
25 <file:Documentation/networking/net-modules.txt>. The module will 23 <file:Documentation/networking/net-modules.txt>. The module will
26 be called arcnet. 24 be called arcnet.
27 25
26if ARCNET
27
28config ARCNET_1201 28config ARCNET_1201
29 tristate "Enable standard ARCNet packet format (RFC 1201)" 29 tristate "Enable standard ARCNet packet format (RFC 1201)"
30 depends on ARCNET
31 help 30 help
32 This allows you to use RFC1201 with your ARCnet card via the virtual 31 This allows you to use RFC1201 with your ARCnet card via the virtual
33 arc0 device. You need to say Y here to communicate with 32 arc0 device. You need to say Y here to communicate with
@@ -38,7 +37,6 @@ config ARCNET_1201
38 37
39config ARCNET_1051 38config ARCNET_1051
40 tristate "Enable old ARCNet packet format (RFC 1051)" 39 tristate "Enable old ARCNet packet format (RFC 1051)"
41 depends on ARCNET
42 ---help--- 40 ---help---
43 This allows you to use RFC1051 with your ARCnet card via the virtual 41 This allows you to use RFC1051 with your ARCnet card via the virtual
44 arc0s device. You only need arc0s if you want to talk to ARCnet 42 arc0s device. You only need arc0s if you want to talk to ARCnet
@@ -53,7 +51,6 @@ config ARCNET_1051
53 51
54config ARCNET_RAW 52config ARCNET_RAW
55 tristate "Enable raw mode packet interface" 53 tristate "Enable raw mode packet interface"
56 depends on ARCNET
57 help 54 help
58 ARCnet "raw mode" packet encapsulation, no soft headers. Unlikely 55 ARCnet "raw mode" packet encapsulation, no soft headers. Unlikely
59 to work unless talking to a copy of the same Linux arcnet driver, 56 to work unless talking to a copy of the same Linux arcnet driver,
@@ -61,7 +58,6 @@ config ARCNET_RAW
61 58
62config ARCNET_CAP 59config ARCNET_CAP
63 tristate "Enable CAP mode packet interface" 60 tristate "Enable CAP mode packet interface"
64 depends on ARCNET
65 help 61 help
66 ARCnet "cap mode" packet encapsulation. Used to get the hardware 62 ARCnet "cap mode" packet encapsulation. Used to get the hardware
67 acknowledge back to userspace. After the initial protocol byte every 63 acknowledge back to userspace. After the initial protocol byte every
@@ -80,7 +76,6 @@ config ARCNET_CAP
80 76
81config ARCNET_COM90xx 77config ARCNET_COM90xx
82 tristate "ARCnet COM90xx (normal) chipset driver" 78 tristate "ARCnet COM90xx (normal) chipset driver"
83 depends on ARCNET
84 help 79 help
85 This is the chipset driver for the standard COM90xx cards. If you 80 This is the chipset driver for the standard COM90xx cards. If you
86 have always used the old ARCnet driver without knowing what type of 81 have always used the old ARCnet driver without knowing what type of
@@ -92,7 +87,6 @@ config ARCNET_COM90xx
92 87
93config ARCNET_COM90xxIO 88config ARCNET_COM90xxIO
94 tristate "ARCnet COM90xx (IO mapped) chipset driver" 89 tristate "ARCnet COM90xx (IO mapped) chipset driver"
95 depends on ARCNET
96 ---help--- 90 ---help---
97 This is the chipset driver for the COM90xx cards, using them in 91 This is the chipset driver for the COM90xx cards, using them in
98 IO-mapped mode instead of memory-mapped mode. This is slower than 92 IO-mapped mode instead of memory-mapped mode. This is slower than
@@ -105,7 +99,6 @@ config ARCNET_COM90xxIO
105 99
106config ARCNET_RIM_I 100config ARCNET_RIM_I
107 tristate "ARCnet COM90xx (RIM I) chipset driver" 101 tristate "ARCnet COM90xx (RIM I) chipset driver"
108 depends on ARCNET
109 ---help--- 102 ---help---
110 This is yet another chipset driver for the COM90xx cards, but this 103 This is yet another chipset driver for the COM90xx cards, but this
111 time only using memory-mapped mode, and no IO ports at all. This 104 time only using memory-mapped mode, and no IO ports at all. This
@@ -118,7 +111,6 @@ config ARCNET_RIM_I
118 111
119config ARCNET_COM20020 112config ARCNET_COM20020
120 tristate "ARCnet COM20020 chipset driver" 113 tristate "ARCnet COM20020 chipset driver"
121 depends on ARCNET
122 help 114 help
123 This is the driver for the new COM20020 chipset. It supports such 115 This is the driver for the new COM20020 chipset. It supports such
124 things as promiscuous mode, so packet sniffing is possible, and 116 things as promiscuous mode, so packet sniffing is possible, and
@@ -136,5 +128,4 @@ config ARCNET_COM20020_PCI
136 tristate "Support for COM20020 on PCI" 128 tristate "Support for COM20020 on PCI"
137 depends on ARCNET_COM20020 && PCI 129 depends on ARCNET_COM20020 && PCI
138 130
139endmenu 131endif # ARCNET
140
diff --git a/drivers/net/tokenring/Kconfig b/drivers/net/tokenring/Kconfig
index 99c4c1922f19..e6b2e06493e7 100644
--- a/drivers/net/tokenring/Kconfig
+++ b/drivers/net/tokenring/Kconfig
@@ -2,12 +2,10 @@
2# Token Ring driver configuration 2# Token Ring driver configuration
3# 3#
4 4
5menu "Token Ring devices"
6 depends on NETDEVICES && !UML
7
8# So far, we only have PCI, ISA, and MCA token ring devices 5# So far, we only have PCI, ISA, and MCA token ring devices
9config TR 6menuconfig TR
10 bool "Token Ring driver support" 7 bool "Token Ring driver support"
8 depends on NETDEVICES && !UML
11 depends on (PCI || ISA || MCA || CCW) 9 depends on (PCI || ISA || MCA || CCW)
12 select LLC 10 select LLC
13 help 11 help
@@ -20,9 +18,11 @@ config TR
20 from <http://www.tldp.org/docs.html#howto>. Most people can 18 from <http://www.tldp.org/docs.html#howto>. Most people can
21 say N here. 19 say N here.
22 20
21if TR
22
23config IBMTR 23config IBMTR
24 tristate "IBM Tropic chipset based adapter support" 24 tristate "IBM Tropic chipset based adapter support"
25 depends on TR && (ISA || MCA) 25 depends on ISA || MCA
26 ---help--- 26 ---help---
27 This is support for all IBM Token Ring cards that don't use DMA. If 27 This is support for all IBM Token Ring cards that don't use DMA. If
28 you have such a beast, say Y and read the Token-Ring mini-HOWTO, 28 you have such a beast, say Y and read the Token-Ring mini-HOWTO,
@@ -36,7 +36,7 @@ config IBMTR
36 36
37config IBMOL 37config IBMOL
38 tristate "IBM Olympic chipset PCI adapter support" 38 tristate "IBM Olympic chipset PCI adapter support"
39 depends on TR && PCI 39 depends on PCI
40 ---help--- 40 ---help---
41 This is support for all non-Lanstreamer IBM PCI Token Ring Cards. 41 This is support for all non-Lanstreamer IBM PCI Token Ring Cards.
42 Specifically this is all IBM PCI, PCI Wake On Lan, PCI II, PCI II 42 Specifically this is all IBM PCI, PCI Wake On Lan, PCI II, PCI II
@@ -54,7 +54,7 @@ config IBMOL
54 54
55config IBMLS 55config IBMLS
56 tristate "IBM Lanstreamer chipset PCI adapter support" 56 tristate "IBM Lanstreamer chipset PCI adapter support"
57 depends on TR && PCI && !64BIT 57 depends on PCI && !64BIT
58 help 58 help
59 This is support for IBM Lanstreamer PCI Token Ring Cards. 59 This is support for IBM Lanstreamer PCI Token Ring Cards.
60 60
@@ -66,7 +66,7 @@ config IBMLS
66 66
67config 3C359 67config 3C359
68 tristate "3Com 3C359 Token Link Velocity XL adapter support" 68 tristate "3Com 3C359 Token Link Velocity XL adapter support"
69 depends on TR && PCI 69 depends on PCI
70 ---help--- 70 ---help---
71 This is support for the 3Com PCI Velocity XL cards, specifically 71 This is support for the 3Com PCI Velocity XL cards, specifically
72 the 3Com 3C359, please note this is not for the 3C339 cards, you 72 the 3Com 3C359, please note this is not for the 3C339 cards, you
@@ -84,7 +84,7 @@ config 3C359
84 84
85config TMS380TR 85config TMS380TR
86 tristate "Generic TMS380 Token Ring ISA/PCI adapter support" 86 tristate "Generic TMS380 Token Ring ISA/PCI adapter support"
87 depends on TR && (PCI || ISA && ISA_DMA_API || MCA) 87 depends on PCI || ISA && ISA_DMA_API || MCA
88 select FW_LOADER 88 select FW_LOADER
89 ---help--- 89 ---help---
90 This driver provides generic support for token ring adapters 90 This driver provides generic support for token ring adapters
@@ -108,7 +108,7 @@ config TMS380TR
108 108
109config TMSPCI 109config TMSPCI
110 tristate "Generic TMS380 PCI support" 110 tristate "Generic TMS380 PCI support"
111 depends on TR && TMS380TR && PCI 111 depends on TMS380TR && PCI
112 ---help--- 112 ---help---
113 This tms380 module supports generic TMS380-based PCI cards. 113 This tms380 module supports generic TMS380-based PCI cards.
114 114
@@ -123,7 +123,7 @@ config TMSPCI
123 123
124config SKISA 124config SKISA
125 tristate "SysKonnect TR4/16 ISA support" 125 tristate "SysKonnect TR4/16 ISA support"
126 depends on TR && TMS380TR && ISA 126 depends on TMS380TR && ISA
127 help 127 help
128 This tms380 module supports SysKonnect TR4/16 ISA cards. 128 This tms380 module supports SysKonnect TR4/16 ISA cards.
129 129
@@ -135,7 +135,7 @@ config SKISA
135 135
136config PROTEON 136config PROTEON
137 tristate "Proteon ISA support" 137 tristate "Proteon ISA support"
138 depends on TR && TMS380TR && ISA 138 depends on TMS380TR && ISA
139 help 139 help
140 This tms380 module supports Proteon ISA cards. 140 This tms380 module supports Proteon ISA cards.
141 141
@@ -148,7 +148,7 @@ config PROTEON
148 148
149config ABYSS 149config ABYSS
150 tristate "Madge Smart 16/4 PCI Mk2 support" 150 tristate "Madge Smart 16/4 PCI Mk2 support"
151 depends on TR && TMS380TR && PCI 151 depends on TMS380TR && PCI
152 help 152 help
153 This tms380 module supports the Madge Smart 16/4 PCI Mk2 153 This tms380 module supports the Madge Smart 16/4 PCI Mk2
154 cards (51-02). 154 cards (51-02).
@@ -158,7 +158,7 @@ config ABYSS
158 158
159config MADGEMC 159config MADGEMC
160 tristate "Madge Smart 16/4 Ringnode MicroChannel" 160 tristate "Madge Smart 16/4 Ringnode MicroChannel"
161 depends on TR && TMS380TR && MCA 161 depends on TMS380TR && MCA
162 help 162 help
163 This tms380 module supports the Madge Smart 16/4 MC16 and MC32 163 This tms380 module supports the Madge Smart 16/4 MC16 and MC32
164 MicroChannel adapters. 164 MicroChannel adapters.
@@ -168,7 +168,7 @@ config MADGEMC
168 168
169config SMCTR 169config SMCTR
170 tristate "SMC ISA/MCA adapter support" 170 tristate "SMC ISA/MCA adapter support"
171 depends on TR && (ISA || MCA_LEGACY) && (BROKEN || !64BIT) 171 depends on (ISA || MCA_LEGACY) && (BROKEN || !64BIT)
172 ---help--- 172 ---help---
173 This is support for the ISA and MCA SMC Token Ring cards, 173 This is support for the ISA and MCA SMC Token Ring cards,
174 specifically SMC TokenCard Elite (8115T) and SMC TokenCard Elite/A 174 specifically SMC TokenCard Elite (8115T) and SMC TokenCard Elite/A
@@ -182,5 +182,4 @@ config SMCTR
182 To compile this driver as a module, choose M here: the module will be 182 To compile this driver as a module, choose M here: the module will be
183 called smctr. 183 called smctr.
184 184
185endmenu 185endif # TR
186
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 052359fc41ee..11f36bef3057 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
329 int ret = 0; 329 int ret = 0;
330 330
331#if defined(CONFIG_PPC_MERGE) 331#if defined(CONFIG_PPC_MERGE)
332 cdm = mpc52xx_find_and_map("mpc52xx-cdm"); 332 cdm = mpc52xx_find_and_map("mpc5200-cdm");
333 gpio = mpc52xx_find_and_map("mpc52xx-gpio"); 333 gpio = mpc52xx_find_and_map("mpc5200-gpio");
334#else 334#else
335 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); 335 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
336 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); 336 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
@@ -445,9 +445,6 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
445 struct spi_master *master; 445 struct spi_master *master;
446 int ret; 446 int ret;
447 447
448 if (pdata == NULL)
449 return -ENODEV;
450
451 master = spi_alloc_master(dev, sizeof *mps); 448 master = spi_alloc_master(dev, sizeof *mps);
452 if (master == NULL) 449 if (master == NULL)
453 return -ENOMEM; 450 return -ENOMEM;
@@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
594 } 591 }
595 regaddr64 = of_translate_address(op->node, regaddr_p); 592 regaddr64 = of_translate_address(op->node, regaddr_p);
596 593
594 /* get PSC id (1..6, used by port_config) */
597 if (op->dev.platform_data == NULL) { 595 if (op->dev.platform_data == NULL) {
598 struct device_node *np; 596 const u32 *psc_nump;
599 int i = 0;
600 597
601 for_each_node_by_type(np, "spi") { 598 psc_nump = of_get_property(op->node, "cell-index", NULL);
602 if (of_find_device_by_node(np) == op) { 599 if (!psc_nump || *psc_nump > 5) {
603 id = i; 600 printk(KERN_ERR "mpc52xx_psc_spi: Device node %s has invalid "
604 break; 601 "cell-index property\n", op->node->full_name);
605 } 602 return -EINVAL;
606 i++;
607 } 603 }
604 id = *psc_nump + 1;
608 } 605 }
609 606
610 return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, 607 return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
@@ -617,7 +614,7 @@ static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op)
617} 614}
618 615
619static struct of_device_id mpc52xx_psc_spi_of_match[] = { 616static struct of_device_id mpc52xx_psc_spi_of_match[] = {
620 { .type = "spi", .compatible = "mpc52xx-psc-spi", }, 617 { .type = "spi", .compatible = "mpc5200-psc-spi", },
621 {}, 618 {},
622}; 619};
623 620
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index 96f62b2df300..95183e1df525 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -358,11 +358,11 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
358 switch (spi->mode & (SPI_CPOL | SPI_CPHA)) { 358 switch (spi->mode & (SPI_CPOL | SPI_CPHA)) {
359 case SPI_MODE_0: 359 case SPI_MODE_0:
360 case SPI_MODE_3: 360 case SPI_MODE_3:
361 flags |= UWIRE_WRITE_RISING_EDGE | UWIRE_READ_FALLING_EDGE; 361 flags |= UWIRE_WRITE_FALLING_EDGE | UWIRE_READ_RISING_EDGE;
362 break; 362 break;
363 case SPI_MODE_1: 363 case SPI_MODE_1:
364 case SPI_MODE_2: 364 case SPI_MODE_2:
365 flags |= UWIRE_WRITE_FALLING_EDGE | UWIRE_READ_RISING_EDGE; 365 flags |= UWIRE_WRITE_RISING_EDGE | UWIRE_READ_FALLING_EDGE;
366 break; 366 break;
367 } 367 }
368 368
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 225d6b2f82dd..d04242aee40d 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -168,6 +168,12 @@ static int spidev_message(struct spidev_data *spidev,
168 n--, k_tmp++, u_tmp++) { 168 n--, k_tmp++, u_tmp++) {
169 k_tmp->len = u_tmp->len; 169 k_tmp->len = u_tmp->len;
170 170
171 total += k_tmp->len;
172 if (total > bufsiz) {
173 status = -EMSGSIZE;
174 goto done;
175 }
176
171 if (u_tmp->rx_buf) { 177 if (u_tmp->rx_buf) {
172 k_tmp->rx_buf = buf; 178 k_tmp->rx_buf = buf;
173 if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) 179 if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len))
@@ -179,12 +185,6 @@ static int spidev_message(struct spidev_data *spidev,
179 u_tmp->len)) 185 u_tmp->len))
180 goto done; 186 goto done;
181 } 187 }
182
183 total += k_tmp->len;
184 if (total > bufsiz) {
185 status = -EMSGSIZE;
186 goto done;
187 }
188 buf += k_tmp->len; 188 buf += k_tmp->len;
189 189
190 k_tmp->cs_change = !!u_tmp->cs_change; 190 k_tmp->cs_change = !!u_tmp->cs_change;
@@ -364,6 +364,7 @@ spidev_ioctl(struct inode *inode, struct file *filp,
364 break; 364 break;
365 } 365 }
366 if (__copy_from_user(ioc, (void __user *)arg, tmp)) { 366 if (__copy_from_user(ioc, (void __user *)arg, tmp)) {
367 kfree(ioc);
367 retval = -EFAULT; 368 retval = -EFAULT;
368 break; 369 break;
369 } 370 }
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index a52480505f78..c7a7c590426f 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -193,6 +193,19 @@ static void mpc83xx_usb_setup(struct usb_hcd *hcd)
193 out_be32(non_ehci + FSL_SOC_USB_CTRL, 0x00000004); 193 out_be32(non_ehci + FSL_SOC_USB_CTRL, 0x00000004);
194 out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0000001b); 194 out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0000001b);
195 195
196#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
197 /*
198 * Turn on cache snooping hardware, since some PowerPC platforms
199 * wholly rely on hardware to deal with cache coherent
200 */
201
202 /* Setup Snooping for all the 4GB space */
203 /* SNOOP1 starts from 0x0, size 2G */
204 out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB);
205 /* SNOOP2 starts from 0x80000000, size 2G */
206 out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x80000000 | SNOOP_SIZE_2GB);
207#endif
208
196 if (pdata->operating_mode == FSL_USB2_DR_HOST) 209 if (pdata->operating_mode == FSL_USB2_DR_HOST)
197 mpc83xx_setup_phy(ehci, pdata->phy_mode, 0); 210 mpc83xx_setup_phy(ehci, pdata->phy_mode, 0);
198 211
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h
index f28736a917e4..b5e59db53347 100644
--- a/drivers/usb/host/ehci-fsl.h
+++ b/drivers/usb/host/ehci-fsl.h
@@ -34,4 +34,5 @@
34#define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */ 34#define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */
35#define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */ 35#define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */
36#define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */ 36#define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */
37#define SNOOP_SIZE_2GB 0x1e
37#endif /* _EHCI_FSL_H */ 38#endif /* _EHCI_FSL_H */
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4d7485fa553f..6e1f1ea21b38 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -704,6 +704,91 @@ config FB_CG6
704 This is the frame buffer device driver for the CGsix (GX, TurboGX) 704 This is the frame buffer device driver for the CGsix (GX, TurboGX)
705 frame buffer. 705 frame buffer.
706 706
707config FB_FFB
708 bool "Creator/Creator3D/Elite3D support"
709 depends on FB_SBUS && SPARC64
710 select FB_CFB_COPYAREA
711 select FB_CFB_IMAGEBLIT
712 help
713 This is the frame buffer device driver for the Creator, Creator3D,
714 and Elite3D graphics boards.
715
716config FB_TCX
717 bool "TCX (SS4/SS5 only) support"
718 depends on FB_SBUS
719 select FB_CFB_FILLRECT
720 select FB_CFB_COPYAREA
721 select FB_CFB_IMAGEBLIT
722 help
723 This is the frame buffer device driver for the TCX 24/8bit frame
724 buffer.
725
726config FB_CG14
727 bool "CGfourteen (SX) support"
728 depends on FB_SBUS
729 select FB_CFB_FILLRECT
730 select FB_CFB_COPYAREA
731 select FB_CFB_IMAGEBLIT
732 help
733 This is the frame buffer device driver for the CGfourteen frame
734 buffer on Desktop SPARCsystems with the SX graphics option.
735
736config FB_P9100
737 bool "P9100 (Sparcbook 3 only) support"
738 depends on FB_SBUS
739 select FB_CFB_FILLRECT
740 select FB_CFB_COPYAREA
741 select FB_CFB_IMAGEBLIT
742 help
743 This is the frame buffer device driver for the P9100 card
744 supported on Sparcbook 3 machines.
745
746config FB_LEO
747 bool "Leo (ZX) support"
748 depends on FB_SBUS
749 select FB_CFB_FILLRECT
750 select FB_CFB_COPYAREA
751 select FB_CFB_IMAGEBLIT
752 help
753 This is the frame buffer device driver for the SBUS-based Sun ZX
754 (leo) frame buffer cards.
755
756config FB_IGA
757 bool "IGA 168x display support"
758 depends on FB && SPARC32
759 select FB_CFB_FILLRECT
760 select FB_CFB_COPYAREA
761 select FB_CFB_IMAGEBLIT
762 help
763 This is the framebuffer device for the INTERGRAPHICS 1680 and
764 successor frame buffer cards.
765
766config FB_XVR500
767 bool "Sun XVR-500 3DLABS Wildcat support"
768 depends on FB && PCI && SPARC64
769 select FB_CFB_FILLRECT
770 select FB_CFB_COPYAREA
771 select FB_CFB_IMAGEBLIT
772 help
773 This is the framebuffer device for the Sun XVR-500 and similar
774 graphics cards based upon the 3DLABS Wildcat chipset. The driver
775 only works on sparc64 systems where the system firwmare has
776 mostly initialized the card already. It is treated as a
777 completely dumb framebuffer device.
778
779config FB_XVR2500
780 bool "Sun XVR-2500 3DLABS Wildcat support"
781 depends on FB && PCI && SPARC64
782 select FB_CFB_FILLRECT
783 select FB_CFB_COPYAREA
784 select FB_CFB_IMAGEBLIT
785 help
786 This is the framebuffer device for the Sun XVR-2500 and similar
787 graphics cards based upon the 3DLABS Wildcat chipset. The driver
788 only works on sparc64 systems where the system firwmare has
789 mostly initialized the card already. It is treated as a
790 completely dumb framebuffer device.
791
707config FB_PVR2 792config FB_PVR2
708 tristate "NEC PowerVR 2 display support" 793 tristate "NEC PowerVR 2 display support"
709 depends on FB && SH_DREAMCAST 794 depends on FB && SH_DREAMCAST
@@ -1195,7 +1280,7 @@ config FB_ATY
1195config FB_ATY_CT 1280config FB_ATY_CT
1196 bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" 1281 bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support"
1197 depends on PCI && FB_ATY 1282 depends on PCI && FB_ATY
1198 default y if SPARC64 && FB_PCI 1283 default y if SPARC64 && PCI
1199 help 1284 help
1200 Say Y here to support use of ATI's 64-bit Rage boards (or other 1285 Say Y here to support use of ATI's 64-bit Rage boards (or other
1201 boards based on the Mach64 CT, VT, GT, and LT chipsets) as a 1286 boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
@@ -1484,95 +1569,6 @@ config FB_AU1200
1484 1569
1485source "drivers/video/geode/Kconfig" 1570source "drivers/video/geode/Kconfig"
1486 1571
1487config FB_FFB
1488 bool "Creator/Creator3D/Elite3D support"
1489 depends on FB_SBUS && SPARC64
1490 select FB_CFB_COPYAREA
1491 select FB_CFB_IMAGEBLIT
1492 help
1493 This is the frame buffer device driver for the Creator, Creator3D,
1494 and Elite3D graphics boards.
1495
1496config FB_TCX
1497 bool "TCX (SS4/SS5 only) support"
1498 depends on FB_SBUS
1499 select FB_CFB_FILLRECT
1500 select FB_CFB_COPYAREA
1501 select FB_CFB_IMAGEBLIT
1502 help
1503 This is the frame buffer device driver for the TCX 24/8bit frame
1504 buffer.
1505
1506config FB_CG14
1507 bool "CGfourteen (SX) support"
1508 depends on FB_SBUS
1509 select FB_CFB_FILLRECT
1510 select FB_CFB_COPYAREA
1511 select FB_CFB_IMAGEBLIT
1512 help
1513 This is the frame buffer device driver for the CGfourteen frame
1514 buffer on Desktop SPARCsystems with the SX graphics option.
1515
1516config FB_P9100
1517 bool "P9100 (Sparcbook 3 only) support"
1518 depends on FB_SBUS
1519 select FB_CFB_FILLRECT
1520 select FB_CFB_COPYAREA
1521 select FB_CFB_IMAGEBLIT
1522 help
1523 This is the frame buffer device driver for the P9100 card
1524 supported on Sparcbook 3 machines.
1525
1526config FB_LEO
1527 bool "Leo (ZX) support"
1528 depends on FB_SBUS
1529 select FB_CFB_FILLRECT
1530 select FB_CFB_COPYAREA
1531 select FB_CFB_IMAGEBLIT
1532 help
1533 This is the frame buffer device driver for the SBUS-based Sun ZX
1534 (leo) frame buffer cards.
1535
1536config FB_XVR500
1537 bool "Sun XVR-500 3DLABS Wildcat support"
1538 depends on (FB = y) && PCI && SPARC64
1539 select FB_CFB_FILLRECT
1540 select FB_CFB_COPYAREA
1541 select FB_CFB_IMAGEBLIT
1542 help
1543 This is the framebuffer device for the Sun XVR-500 and similar
1544 graphics cards based upon the 3DLABS Wildcat chipset. The driver
1545 only works on sparc64 systems where the system firwmare has
1546 mostly initialized the card already. It is treated as a
1547 completely dumb framebuffer device.
1548
1549config FB_XVR2500
1550 bool "Sun XVR-2500 3DLABS Wildcat support"
1551 depends on (FB = y) && PCI && SPARC64
1552 select FB_CFB_FILLRECT
1553 select FB_CFB_COPYAREA
1554 select FB_CFB_IMAGEBLIT
1555 help
1556 This is the framebuffer device for the Sun XVR-2500 and similar
1557 graphics cards based upon the 3DLABS Wildcat chipset. The driver
1558 only works on sparc64 systems where the system firwmare has
1559 mostly initialized the card already. It is treated as a
1560 completely dumb framebuffer device.
1561
1562config FB_PCI
1563 bool "PCI framebuffers"
1564 depends on (FB = y) && PCI && SPARC
1565
1566config FB_IGA
1567 bool "IGA 168x display support"
1568 depends on SPARC32 && FB_PCI
1569 select FB_CFB_FILLRECT
1570 select FB_CFB_COPYAREA
1571 select FB_CFB_IMAGEBLIT
1572 help
1573 This is the framebuffer device for the INTERGRAPHICS 1680 and
1574 successor frame buffer cards.
1575
1576config FB_HIT 1572config FB_HIT
1577 tristate "HD64461 Frame Buffer support" 1573 tristate "HD64461 Frame Buffer support"
1578 depends on FB && HD64461 1574 depends on FB && HD64461
@@ -1796,9 +1792,10 @@ config FB_IBM_GXT4500
1796config FB_PS3 1792config FB_PS3
1797 bool "PS3 GPU framebuffer driver" 1793 bool "PS3 GPU framebuffer driver"
1798 depends on (FB = y) && PS3_PS3AV 1794 depends on (FB = y) && PS3_PS3AV
1799 select FB_CFB_FILLRECT 1795 select FB_SYS_FILLRECT
1800 select FB_CFB_COPYAREA 1796 select FB_SYS_COPYAREA
1801 select FB_CFB_IMAGEBLIT 1797 select FB_SYS_IMAGEBLIT
1798 select FB_SYS_FOPS
1802 ---help--- 1799 ---help---
1803 Include support for the virtual frame buffer in the PS3 platform. 1800 Include support for the virtual frame buffer in the PS3 platform.
1804 1801
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 267c1ff9ebd9..a12589898597 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -394,26 +394,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi)
394 394
395 /* initialize GPIOs */ 395 /* initialize GPIOs */
396 imx_gpio_mode(PD6_PF_LSCLK); 396 imx_gpio_mode(PD6_PF_LSCLK);
397 imx_gpio_mode(PD10_PF_SPL_SPR);
398 imx_gpio_mode(PD11_PF_CONTRAST); 397 imx_gpio_mode(PD11_PF_CONTRAST);
399 imx_gpio_mode(PD14_PF_FLM_VSYNC); 398 imx_gpio_mode(PD14_PF_FLM_VSYNC);
400 imx_gpio_mode(PD13_PF_LP_HSYNC); 399 imx_gpio_mode(PD13_PF_LP_HSYNC);
401 imx_gpio_mode(PD7_PF_REV);
402 imx_gpio_mode(PD8_PF_CLS);
403
404#ifndef CONFIG_MACH_PIMX1
405 /* on PiMX1 used as buffers enable signal
406 */
407 imx_gpio_mode(PD9_PF_PS);
408#endif
409
410#ifndef CONFIG_MACH_MX1FS2
411 /* on mx1fs2 this pin is used to (de)activate the display, so we need
412 * it as a normal gpio
413 */
414 imx_gpio_mode(PD12_PF_ACD_OE); 400 imx_gpio_mode(PD12_PF_ACD_OE);
415#endif
416 401
402 /* These are only needed for Sharp HR TFT displays */
403 if (fbi->pcr & PCR_SHARP) {
404 imx_gpio_mode(PD7_PF_REV);
405 imx_gpio_mode(PD8_PF_CLS);
406 imx_gpio_mode(PD9_PF_PS);
407 imx_gpio_mode(PD10_PF_SPL_SPR);
408 }
417} 409}
418 410
419#ifdef CONFIG_PM 411#ifdef CONFIG_PM
@@ -476,7 +468,6 @@ static int __init imxfb_init_fbinfo(struct device *dev)
476 468
477 info->fbops = &imxfb_ops; 469 info->fbops = &imxfb_ops;
478 info->flags = FBINFO_FLAG_DEFAULT; 470 info->flags = FBINFO_FLAG_DEFAULT;
479 info->pseudo_palette = (fbi + 1);
480 471
481 fbi->rgb[RGB_16] = &def_rgb_16; 472 fbi->rgb[RGB_16] = &def_rgb_16;
482 fbi->rgb[RGB_8] = &def_rgb_8; 473 fbi->rgb[RGB_8] = &def_rgb_8;
@@ -499,6 +490,7 @@ static int __init imxfb_init_fbinfo(struct device *dev)
499 info->var.sync = inf->sync; 490 info->var.sync = inf->sync;
500 info->var.grayscale = inf->cmap_greyscale; 491 info->var.grayscale = inf->cmap_greyscale;
501 fbi->cmap_inverse = inf->cmap_inverse; 492 fbi->cmap_inverse = inf->cmap_inverse;
493 fbi->cmap_static = inf->cmap_static;
502 fbi->pcr = inf->pcr; 494 fbi->pcr = inf->pcr;
503 fbi->lscr1 = inf->lscr1; 495 fbi->lscr1 = inf->lscr1;
504 fbi->dmacr = inf->dmacr; 496 fbi->dmacr = inf->dmacr;
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index ab5e66890e4e..0a04483aa3e0 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -183,15 +183,17 @@ static inline void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
183 index = PM2VR_RD_INDEXED_DATA; 183 index = PM2VR_RD_INDEXED_DATA;
184 break; 184 break;
185 } 185 }
186 mb(); 186 wmb();
187 pm2_WR(p, index, v); 187 pm2_WR(p, index, v);
188 wmb();
188} 189}
189 190
190static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 191static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
191{ 192{
192 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); 193 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
193 mb(); 194 wmb();
194 pm2_WR(p, PM2VR_RD_INDEXED_DATA, v); 195 pm2_WR(p, PM2VR_RD_INDEXED_DATA, v);
196 wmb();
195} 197}
196 198
197#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT 199#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT
@@ -466,11 +468,9 @@ static void set_memclock(struct pm2fb_par* par, u32 clk)
466 WAIT_FIFO(par, 8); 468 WAIT_FIFO(par, 8);
467 pm2_WR(par, PM2VR_RD_INDEX_HIGH, PM2VI_RD_MCLK_CONTROL >> 8); 469 pm2_WR(par, PM2VR_RD_INDEX_HIGH, PM2VI_RD_MCLK_CONTROL >> 8);
468 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 0); 470 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 0);
469 wmb();
470 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_PRESCALE, m); 471 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_PRESCALE, m);
471 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_FEEDBACK, n); 472 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_FEEDBACK, n);
472 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_POSTSCALE, p); 473 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_POSTSCALE, p);
473 wmb();
474 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 1); 474 pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 1);
475 rmb(); 475 rmb();
476 for (i = 256; 476 for (i = 256;
@@ -483,12 +483,9 @@ static void set_memclock(struct pm2fb_par* par, u32 clk)
483 pm2_mnp(clk, &m, &n, &p); 483 pm2_mnp(clk, &m, &n, &p);
484 WAIT_FIFO(par, 10); 484 WAIT_FIFO(par, 10);
485 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 6); 485 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 6);
486 wmb();
487 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_1, m); 486 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_1, m);
488 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_2, n); 487 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_2, n);
489 wmb();
490 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 8|p); 488 pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 8|p);
491 wmb();
492 pm2_RDAC_RD(par, PM2I_RD_MEMORY_CLOCK_STATUS); 489 pm2_RDAC_RD(par, PM2I_RD_MEMORY_CLOCK_STATUS);
493 rmb(); 490 rmb();
494 for (i = 256; 491 for (i = 256;
@@ -509,12 +506,9 @@ static void set_pixclock(struct pm2fb_par* par, u32 clk)
509 pm2_mnp(clk, &m, &n, &p); 506 pm2_mnp(clk, &m, &n, &p);
510 WAIT_FIFO(par, 8); 507 WAIT_FIFO(par, 8);
511 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 0); 508 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 0);
512 wmb();
513 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A1, m); 509 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A1, m);
514 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A2, n); 510 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A2, n);
515 wmb();
516 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 8|p); 511 pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 8|p);
517 wmb();
518 pm2_RDAC_RD(par, PM2I_RD_PIXEL_CLOCK_STATUS); 512 pm2_RDAC_RD(par, PM2I_RD_PIXEL_CLOCK_STATUS);
519 rmb(); 513 rmb();
520 for (i = 256; 514 for (i = 256;
@@ -1066,10 +1060,9 @@ static void pm2fb_block_op(struct fb_info* info, int copy,
1066 1060
1067 if (!w || !h) 1061 if (!w || !h)
1068 return; 1062 return;
1069 WAIT_FIFO(par, 6); 1063 WAIT_FIFO(par, 5);
1070 pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE | 1064 pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE |
1071 PM2F_CONFIG_FB_READ_SOURCE_ENABLE); 1065 PM2F_CONFIG_FB_READ_SOURCE_ENABLE);
1072 pm2_WR(par, PM2R_FB_PIXEL_OFFSET, 0);
1073 if (copy) 1066 if (copy)
1074 pm2_WR(par, PM2R_FB_SOURCE_DELTA, 1067 pm2_WR(par, PM2R_FB_SOURCE_DELTA,
1075 ((ysrc-y) & 0xfff) << 16 | ((xsrc-x) & 0xfff)); 1068 ((ysrc-y) & 0xfff) << 16 | ((xsrc-x) & 0xfff));
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
index c77a1a1fd46b..616a0c08e30c 100644
--- a/drivers/video/pm3fb.c
+++ b/drivers/video/pm3fb.c
@@ -52,11 +52,6 @@
52static char *mode_option __devinitdata; 52static char *mode_option __devinitdata;
53 53
54/* 54/*
55 * If your driver supports multiple boards, you should make the
56 * below data types arrays, or allocate them dynamically (using kmalloc()).
57 */
58
59/*
60 * This structure defines the hardware state of the graphics card. Normally 55 * This structure defines the hardware state of the graphics card. Normally
61 * you place this in a header file in linux/include/video. This file usually 56 * you place this in a header file in linux/include/video. This file usually
62 * also includes register information. That allows other driver subsystems 57 * also includes register information. That allows other driver subsystems
@@ -67,7 +62,7 @@ struct pm3_par {
67 unsigned char __iomem *v_regs;/* virtual address of p_regs */ 62 unsigned char __iomem *v_regs;/* virtual address of p_regs */
68 u32 video; /* video flags before blanking */ 63 u32 video; /* video flags before blanking */
69 u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */ 64 u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */
70 u32 palette[16]; 65 u32 palette[16];
71}; 66};
72 67
73/* 68/*
@@ -104,36 +99,28 @@ static inline void PM3_WAIT(struct pm3_par *par, u32 n)
104 while (PM3_READ_REG(par, PM3InFIFOSpace) < n); 99 while (PM3_READ_REG(par, PM3InFIFOSpace) < n);
105} 100}
106 101
107static inline void PM3_SLOW_WRITE_REG(struct pm3_par *par, s32 off, u32 v)
108{
109 if (par->v_regs) {
110 mb();
111 PM3_WAIT(par, 1);
112 wmb();
113 PM3_WRITE_REG(par, off, v);
114 }
115}
116
117static inline void PM3_SET_INDEX(struct pm3_par *par, unsigned index)
118{
119 PM3_SLOW_WRITE_REG(par, PM3RD_IndexHigh, (index >> 8) & 0xff);
120 PM3_SLOW_WRITE_REG(par, PM3RD_IndexLow, index & 0xff);
121}
122
123static inline void PM3_WRITE_DAC_REG(struct pm3_par *par, unsigned r, u8 v) 102static inline void PM3_WRITE_DAC_REG(struct pm3_par *par, unsigned r, u8 v)
124{ 103{
125 PM3_SET_INDEX(par, r); 104 PM3_WAIT(par, 3);
105 PM3_WRITE_REG(par, PM3RD_IndexHigh, (r >> 8) & 0xff);
106 PM3_WRITE_REG(par, PM3RD_IndexLow, r & 0xff);
126 wmb(); 107 wmb();
127 PM3_WRITE_REG(par, PM3RD_IndexedData, v); 108 PM3_WRITE_REG(par, PM3RD_IndexedData, v);
109 wmb();
128} 110}
129 111
130static inline void pm3fb_set_color(struct pm3_par *par, unsigned char regno, 112static inline void pm3fb_set_color(struct pm3_par *par, unsigned char regno,
131 unsigned char r, unsigned char g, unsigned char b) 113 unsigned char r, unsigned char g, unsigned char b)
132{ 114{
133 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteWriteAddress, regno); 115 PM3_WAIT(par, 4);
134 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, r); 116 PM3_WRITE_REG(par, PM3RD_PaletteWriteAddress, regno);
135 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, g); 117 wmb();
136 PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, b); 118 PM3_WRITE_REG(par, PM3RD_PaletteData, r);
119 wmb();
120 PM3_WRITE_REG(par, PM3RD_PaletteData, g);
121 wmb();
122 PM3_WRITE_REG(par, PM3RD_PaletteData, b);
123 wmb();
137} 124}
138 125
139static void pm3fb_clear_colormap(struct pm3_par *par, 126static void pm3fb_clear_colormap(struct pm3_par *par,
@@ -141,7 +128,7 @@ static void pm3fb_clear_colormap(struct pm3_par *par,
141{ 128{
142 int i; 129 int i;
143 130
144 for (i = 0; i < 256 ; i++) /* fill color map with white */ 131 for (i = 0; i < 256 ; i++)
145 pm3fb_set_color(par, i, r, g, b); 132 pm3fb_set_color(par, i, r, g, b);
146 133
147} 134}
@@ -175,19 +162,26 @@ static void pm3fb_calculate_clock(unsigned long reqclock,
175 } 162 }
176} 163}
177 164
178static inline int pm3fb_shift_bpp(unsigned long depth, int v) 165static inline int pm3fb_depth(const struct fb_var_screeninfo *var)
179{ 166{
180 switch (depth) { 167 if ( var->bits_per_pixel == 16 )
168 return var->red.length + var->green.length
169 + var->blue.length;
170
171 return var->bits_per_pixel;
172}
173
174static inline int pm3fb_shift_bpp(unsigned bpp, int v)
175{
176 switch (bpp) {
181 case 8: 177 case 8:
182 return (v >> 4); 178 return (v >> 4);
183 case 12:
184 case 15:
185 case 16: 179 case 16:
186 return (v >> 3); 180 return (v >> 3);
187 case 32: 181 case 32:
188 return (v >> 2); 182 return (v >> 2);
189 } 183 }
190 DPRINTK("Unsupported depth %ld\n", depth); 184 DPRINTK("Unsupported depth %u\n", bpp);
191 return 0; 185 return 0;
192} 186}
193 187
@@ -206,56 +200,50 @@ static void pm3fb_write_mode(struct fb_info *info)
206 const u32 vbend = vsend + info->var.upper_margin; 200 const u32 vbend = vsend + info->var.upper_margin;
207 const u32 vtotal = info->var.yres + vbend; 201 const u32 vtotal = info->var.yres + vbend;
208 const u32 width = (info->var.xres_virtual + 7) & ~7; 202 const u32 width = (info->var.xres_virtual + 7) & ~7;
209 203 const unsigned bpp = info->var.bits_per_pixel;
210 PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, 0xffffffff); 204
211 PM3_SLOW_WRITE_REG(par, PM3Aperture0, 0x00000000); 205 PM3_WAIT(par, 20);
212 PM3_SLOW_WRITE_REG(par, PM3Aperture1, 0x00000000); 206 PM3_WRITE_REG(par, PM3MemBypassWriteMask, 0xffffffff);
213 PM3_SLOW_WRITE_REG(par, PM3FIFODis, 0x00000007); 207 PM3_WRITE_REG(par, PM3Aperture0, 0x00000000);
214 208 PM3_WRITE_REG(par, PM3Aperture1, 0x00000000);
215 PM3_SLOW_WRITE_REG(par, PM3HTotal, 209 PM3_WRITE_REG(par, PM3FIFODis, 0x00000007);
216 pm3fb_shift_bpp(info->var.bits_per_pixel, 210
217 htotal - 1)); 211 PM3_WRITE_REG(par, PM3HTotal,
218 PM3_SLOW_WRITE_REG(par, PM3HsEnd, 212 pm3fb_shift_bpp(bpp, htotal - 1));
219 pm3fb_shift_bpp(info->var.bits_per_pixel, 213 PM3_WRITE_REG(par, PM3HsEnd,
220 hsend)); 214 pm3fb_shift_bpp(bpp, hsend));
221 PM3_SLOW_WRITE_REG(par, PM3HsStart, 215 PM3_WRITE_REG(par, PM3HsStart,
222 pm3fb_shift_bpp(info->var.bits_per_pixel, 216 pm3fb_shift_bpp(bpp, hsstart));
223 hsstart)); 217 PM3_WRITE_REG(par, PM3HbEnd,
224 PM3_SLOW_WRITE_REG(par, PM3HbEnd, 218 pm3fb_shift_bpp(bpp, hbend));
225 pm3fb_shift_bpp(info->var.bits_per_pixel, 219 PM3_WRITE_REG(par, PM3HgEnd,
226 hbend)); 220 pm3fb_shift_bpp(bpp, hbend));
227 PM3_SLOW_WRITE_REG(par, PM3HgEnd, 221 PM3_WRITE_REG(par, PM3ScreenStride,
228 pm3fb_shift_bpp(info->var.bits_per_pixel, 222 pm3fb_shift_bpp(bpp, width));
229 hbend)); 223 PM3_WRITE_REG(par, PM3VTotal, vtotal - 1);
230 PM3_SLOW_WRITE_REG(par, PM3ScreenStride, 224 PM3_WRITE_REG(par, PM3VsEnd, vsend - 1);
231 pm3fb_shift_bpp(info->var.bits_per_pixel, 225 PM3_WRITE_REG(par, PM3VsStart, vsstart - 1);
232 width)); 226 PM3_WRITE_REG(par, PM3VbEnd, vbend);
233 PM3_SLOW_WRITE_REG(par, PM3VTotal, vtotal - 1); 227
234 PM3_SLOW_WRITE_REG(par, PM3VsEnd, vsend - 1); 228 switch (bpp) {
235 PM3_SLOW_WRITE_REG(par, PM3VsStart, vsstart - 1);
236 PM3_SLOW_WRITE_REG(par, PM3VbEnd, vbend);
237
238 switch (info->var.bits_per_pixel) {
239 case 8: 229 case 8:
240 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 230 PM3_WRITE_REG(par, PM3ByAperture1Mode,
241 PM3ByApertureMode_PIXELSIZE_8BIT); 231 PM3ByApertureMode_PIXELSIZE_8BIT);
242 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 232 PM3_WRITE_REG(par, PM3ByAperture2Mode,
243 PM3ByApertureMode_PIXELSIZE_8BIT); 233 PM3ByApertureMode_PIXELSIZE_8BIT);
244 break; 234 break;
245 235
246 case 12:
247 case 15:
248 case 16: 236 case 16:
249#ifndef __BIG_ENDIAN 237#ifndef __BIG_ENDIAN
250 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 238 PM3_WRITE_REG(par, PM3ByAperture1Mode,
251 PM3ByApertureMode_PIXELSIZE_16BIT); 239 PM3ByApertureMode_PIXELSIZE_16BIT);
252 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 240 PM3_WRITE_REG(par, PM3ByAperture2Mode,
253 PM3ByApertureMode_PIXELSIZE_16BIT); 241 PM3ByApertureMode_PIXELSIZE_16BIT);
254#else 242#else
255 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 243 PM3_WRITE_REG(par, PM3ByAperture1Mode,
256 PM3ByApertureMode_PIXELSIZE_16BIT | 244 PM3ByApertureMode_PIXELSIZE_16BIT |
257 PM3ByApertureMode_BYTESWAP_BADC); 245 PM3ByApertureMode_BYTESWAP_BADC);
258 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 246 PM3_WRITE_REG(par, PM3ByAperture2Mode,
259 PM3ByApertureMode_PIXELSIZE_16BIT | 247 PM3ByApertureMode_PIXELSIZE_16BIT |
260 PM3ByApertureMode_BYTESWAP_BADC); 248 PM3ByApertureMode_BYTESWAP_BADC);
261#endif /* ! __BIG_ENDIAN */ 249#endif /* ! __BIG_ENDIAN */
@@ -263,23 +251,22 @@ static void pm3fb_write_mode(struct fb_info *info)
263 251
264 case 32: 252 case 32:
265#ifndef __BIG_ENDIAN 253#ifndef __BIG_ENDIAN
266 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 254 PM3_WRITE_REG(par, PM3ByAperture1Mode,
267 PM3ByApertureMode_PIXELSIZE_32BIT); 255 PM3ByApertureMode_PIXELSIZE_32BIT);
268 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 256 PM3_WRITE_REG(par, PM3ByAperture2Mode,
269 PM3ByApertureMode_PIXELSIZE_32BIT); 257 PM3ByApertureMode_PIXELSIZE_32BIT);
270#else 258#else
271 PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, 259 PM3_WRITE_REG(par, PM3ByAperture1Mode,
272 PM3ByApertureMode_PIXELSIZE_32BIT | 260 PM3ByApertureMode_PIXELSIZE_32BIT |
273 PM3ByApertureMode_BYTESWAP_DCBA); 261 PM3ByApertureMode_BYTESWAP_DCBA);
274 PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, 262 PM3_WRITE_REG(par, PM3ByAperture2Mode,
275 PM3ByApertureMode_PIXELSIZE_32BIT | 263 PM3ByApertureMode_PIXELSIZE_32BIT |
276 PM3ByApertureMode_BYTESWAP_DCBA); 264 PM3ByApertureMode_BYTESWAP_DCBA);
277#endif /* ! __BIG_ENDIAN */ 265#endif /* ! __BIG_ENDIAN */
278 break; 266 break;
279 267
280 default: 268 default:
281 DPRINTK("Unsupported depth %d\n", 269 DPRINTK("Unsupported depth %d\n", bpp);
282 info->var.bits_per_pixel);
283 break; 270 break;
284 } 271 }
285 272
@@ -296,14 +283,15 @@ static void pm3fb_write_mode(struct fb_info *info)
296 PM3VideoControl_VSYNC_MASK); 283 PM3VideoControl_VSYNC_MASK);
297 video |= PM3VideoControl_HSYNC_ACTIVE_HIGH | 284 video |= PM3VideoControl_HSYNC_ACTIVE_HIGH |
298 PM3VideoControl_VSYNC_ACTIVE_HIGH; 285 PM3VideoControl_VSYNC_ACTIVE_HIGH;
299 PM3_SLOW_WRITE_REG(par, PM3VideoControl, video); 286 PM3_WRITE_REG(par, PM3VideoControl, video);
300 } 287 }
301 PM3_SLOW_WRITE_REG(par, PM3VClkCtl, 288 PM3_WRITE_REG(par, PM3VClkCtl,
302 (PM3_READ_REG(par, PM3VClkCtl) & 0xFFFFFFFC)); 289 (PM3_READ_REG(par, PM3VClkCtl) & 0xFFFFFFFC));
303 PM3_SLOW_WRITE_REG(par, PM3ScreenBase, par->base); 290 PM3_WRITE_REG(par, PM3ScreenBase, par->base);
304 PM3_SLOW_WRITE_REG(par, PM3ChipConfig, 291 PM3_WRITE_REG(par, PM3ChipConfig,
305 (PM3_READ_REG(par, PM3ChipConfig) & 0xFFFFFFFD)); 292 (PM3_READ_REG(par, PM3ChipConfig) & 0xFFFFFFFD));
306 293
294 wmb();
307 { 295 {
308 unsigned char uninitialized_var(m); /* ClkPreScale */ 296 unsigned char uninitialized_var(m); /* ClkPreScale */
309 unsigned char uninitialized_var(n); /* ClkFeedBackScale */ 297 unsigned char uninitialized_var(n); /* ClkFeedBackScale */
@@ -337,7 +325,7 @@ static void pm3fb_write_mode(struct fb_info *info)
337 325
338 PM3_WRITE_DAC_REG(par, PM3RD_DACControl, 0x00); 326 PM3_WRITE_DAC_REG(par, PM3RD_DACControl, 0x00);
339 327
340 switch (info->var.bits_per_pixel) { 328 switch (pm3fb_depth(&info->var)) {
341 case 8: 329 case 8:
342 PM3_WRITE_DAC_REG(par, PM3RD_PixelSize, 330 PM3_WRITE_DAC_REG(par, PM3RD_PixelSize,
343 PM3RD_PixelSize_8_BIT_PIXELS); 331 PM3RD_PixelSize_8_BIT_PIXELS);
@@ -393,57 +381,44 @@ static void pm3fb_write_mode(struct fb_info *info)
393 * hardware independent functions 381 * hardware independent functions
394 */ 382 */
395int pm3fb_init(void); 383int pm3fb_init(void);
396int pm3fb_setup(char*);
397 384
398static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 385static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
399{ 386{
400 u32 lpitch; 387 u32 lpitch;
388 unsigned bpp = var->red.length + var->green.length
389 + var->blue.length + var->transp.length;
401 390
402 var->transp.offset = 0; 391 if ( bpp != var->bits_per_pixel ) {
403 var->transp.length = 0; 392 /* set predefined mode for bits_per_pixel settings */
404 switch(var->bits_per_pixel) { 393
405 case 8: 394 switch(var->bits_per_pixel) {
406 var->red.length = var->green.length = var->blue.length = 8; 395 case 8:
407 var->red.offset = var->green.offset = var->blue.offset = 0; 396 var->red.length = var->green.length = var->blue.length = 8;
408 break; 397 var->red.offset = var->green.offset = var->blue.offset = 0;
409 case 12: 398 var->transp.offset = 0;
410 var->red.offset = 8; 399 var->transp.length = 0;
411 var->red.length = 4; 400 break;
412 var->green.offset = 4; 401 case 16:
413 var->green.length = 4; 402 var->red.length = var->blue.length = 5;
414 var->blue.offset = 0; 403 var->green.length = 6;
415 var->blue.length = 4; 404 var->transp.length = 0;
416 var->transp.offset = 12; 405 break;
417 var->transp.length = 4; 406 case 32:
418 case 15: 407 var->red.length = var->green.length = var->blue.length = 8;
419 var->red.offset = 10; 408 var->transp.length = 8;
420 var->red.length = 5; 409 break;
421 var->green.offset = 5; 410 default:
422 var->green.length = 5; 411 DPRINTK("depth not supported: %u\n", var->bits_per_pixel);
423 var->blue.offset = 0; 412 return -EINVAL;
424 var->blue.length = 5; 413 }
425 var->transp.offset = 15; 414 }
426 var->transp.length = 1; 415 /* it is assumed BGRA order */
427 break; 416 if (var->bits_per_pixel > 8 )
428 case 16: 417 {
429 var->red.offset = 11; 418 var->blue.offset = 0;
430 var->red.length = 5; 419 var->green.offset = var->blue.length;
431 var->green.offset = 5; 420 var->red.offset = var->green.offset + var->green.length;
432 var->green.length = 6; 421 var->transp.offset = var->red.offset + var->red.length;
433 var->blue.offset = 0;
434 var->blue.length = 5;
435 break;
436 case 32:
437 var->transp.offset = 24;
438 var->transp.length = 8;
439 var->red.offset = 16;
440 var->green.offset = 8;
441 var->blue.offset = 0;
442 var->red.length = var->green.length = var->blue.length = 8;
443 break;
444 default:
445 DPRINTK("depth not supported: %u\n", var->bits_per_pixel);
446 return -EINVAL;
447 } 422 }
448 var->height = var->width = -1; 423 var->height = var->width = -1;
449 424
@@ -502,10 +477,9 @@ static int pm3fb_set_par(struct fb_info *info)
502{ 477{
503 struct pm3_par *par = info->par; 478 struct pm3_par *par = info->par;
504 const u32 xres = (info->var.xres + 31) & ~31; 479 const u32 xres = (info->var.xres + 31) & ~31;
505 const int depth = (info->var.bits_per_pixel + 7) & ~7; 480 const unsigned bpp = info->var.bits_per_pixel;
506 481
507 par->base = pm3fb_shift_bpp(info->var.bits_per_pixel, 482 par->base = pm3fb_shift_bpp(bpp,(info->var.yoffset * xres)
508 (info->var.yoffset * xres)
509 + info->var.xoffset); 483 + info->var.xoffset);
510 par->video = 0; 484 par->video = 0;
511 485
@@ -530,12 +504,10 @@ static int pm3fb_set_par(struct fb_info *info)
530 par->video |= PM3VideoControl_DISABLE; 504 par->video |= PM3VideoControl_DISABLE;
531 DPRINTK("PM3Video disabled\n"); 505 DPRINTK("PM3Video disabled\n");
532 } 506 }
533 switch (depth) { 507 switch (bpp) {
534 case 8: 508 case 8:
535 par->video |= PM3VideoControl_PIXELSIZE_8BIT; 509 par->video |= PM3VideoControl_PIXELSIZE_8BIT;
536 break; 510 break;
537 case 12:
538 case 15:
539 case 16: 511 case 16:
540 par->video |= PM3VideoControl_PIXELSIZE_16BIT; 512 par->video |= PM3VideoControl_PIXELSIZE_16BIT;
541 break; 513 break;
@@ -548,9 +520,9 @@ static int pm3fb_set_par(struct fb_info *info)
548 } 520 }
549 521
550 info->fix.visual = 522 info->fix.visual =
551 (depth == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; 523 (bpp == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
552 info->fix.line_length = ((info->var.xres_virtual + 7) & ~7) 524 info->fix.line_length = ((info->var.xres_virtual + 7) & ~7)
553 * depth / 8; 525 * bpp / 8;
554 526
555/* pm3fb_clear_memory(info, 0);*/ 527/* pm3fb_clear_memory(info, 0);*/
556 pm3fb_clear_colormap(par, 0, 0, 0); 528 pm3fb_clear_colormap(par, 0, 0, 0);
@@ -580,8 +552,8 @@ static int pm3fb_setcolreg(unsigned regno, unsigned red, unsigned green,
580 * var->{color}.length contains length of bitfield 552 * var->{color}.length contains length of bitfield
581 * {hardwarespecific} contains width of DAC 553 * {hardwarespecific} contains width of DAC
582 * pseudo_palette[X] is programmed to (X << red.offset) | 554 * pseudo_palette[X] is programmed to (X << red.offset) |
583 * (X << green.offset) | 555 * (X << green.offset) |
584 * (X << blue.offset) 556 * (X << blue.offset)
585 * RAMDAC[X] is programmed to (red, green, blue) 557 * RAMDAC[X] is programmed to (red, green, blue)
586 * color depth = SUM(var->{color}.length) 558 * color depth = SUM(var->{color}.length)
587 * 559 *
@@ -621,7 +593,6 @@ static int pm3fb_setcolreg(unsigned regno, unsigned red, unsigned green,
621 case 8: 593 case 8:
622 break; 594 break;
623 case 16: 595 case 16:
624 case 24:
625 case 32: 596 case 32:
626 ((u32*)(info->pseudo_palette))[regno] = v; 597 ((u32*)(info->pseudo_palette))[regno] = v;
627 break; 598 break;
@@ -643,7 +614,8 @@ static int pm3fb_pan_display(struct fb_var_screeninfo *var,
643 par->base = pm3fb_shift_bpp(var->bits_per_pixel, 614 par->base = pm3fb_shift_bpp(var->bits_per_pixel,
644 (var->yoffset * xres) 615 (var->yoffset * xres)
645 + var->xoffset); 616 + var->xoffset);
646 PM3_SLOW_WRITE_REG(par, PM3ScreenBase, par->base); 617 PM3_WAIT(par, 1);
618 PM3_WRITE_REG(par, PM3ScreenBase, par->base);
647 return 0; 619 return 0;
648} 620}
649 621
@@ -665,31 +637,31 @@ static int pm3fb_blank(int blank_mode, struct fb_info *info)
665 637
666 switch (blank_mode) { 638 switch (blank_mode) {
667 case FB_BLANK_UNBLANK: 639 case FB_BLANK_UNBLANK:
668 video = video | PM3VideoControl_ENABLE; 640 video |= PM3VideoControl_ENABLE;
669 break; 641 break;
670 case FB_BLANK_NORMAL: /* FIXME */ 642 case FB_BLANK_NORMAL:
671 video = video & ~(PM3VideoControl_ENABLE); 643 video &= ~(PM3VideoControl_ENABLE);
672 break; 644 break;
673 case FB_BLANK_HSYNC_SUSPEND: 645 case FB_BLANK_HSYNC_SUSPEND:
674 video = video & ~(PM3VideoControl_HSYNC_MASK | 646 video &= ~(PM3VideoControl_HSYNC_MASK |
675 PM3VideoControl_BLANK_ACTIVE_LOW); 647 PM3VideoControl_BLANK_ACTIVE_LOW);
676 break; 648 break;
677 case FB_BLANK_VSYNC_SUSPEND: 649 case FB_BLANK_VSYNC_SUSPEND:
678 video = video & ~(PM3VideoControl_VSYNC_MASK | 650 video &= ~(PM3VideoControl_VSYNC_MASK |
679 PM3VideoControl_BLANK_ACTIVE_LOW); 651 PM3VideoControl_BLANK_ACTIVE_LOW);
680 break; 652 break;
681 case FB_BLANK_POWERDOWN: 653 case FB_BLANK_POWERDOWN:
682 video = video & ~(PM3VideoControl_HSYNC_MASK | 654 video &= ~(PM3VideoControl_HSYNC_MASK |
683 PM3VideoControl_VSYNC_MASK | 655 PM3VideoControl_VSYNC_MASK |
684 PM3VideoControl_BLANK_ACTIVE_LOW); 656 PM3VideoControl_BLANK_ACTIVE_LOW);
685 break; 657 break;
686 default: 658 default:
687 DPRINTK("Unsupported blanking %d\n", blank_mode); 659 DPRINTK("Unsupported blanking %d\n", blank_mode);
688 return 1; 660 return 1;
689 } 661 }
690 662
691 PM3_SLOW_WRITE_REG(par,PM3VideoControl, video); 663 PM3_WAIT(par, 1);
692 664 PM3_WRITE_REG(par,PM3VideoControl, video);
693 return 0; 665 return 0;
694} 666}
695 667
@@ -703,9 +675,9 @@ static struct fb_ops pm3fb_ops = {
703 .fb_set_par = pm3fb_set_par, 675 .fb_set_par = pm3fb_set_par,
704 .fb_setcolreg = pm3fb_setcolreg, 676 .fb_setcolreg = pm3fb_setcolreg,
705 .fb_pan_display = pm3fb_pan_display, 677 .fb_pan_display = pm3fb_pan_display,
706 .fb_fillrect = cfb_fillrect, /* Needed !!! */ 678 .fb_fillrect = cfb_fillrect,
707 .fb_copyarea = cfb_copyarea, /* Needed !!! */ 679 .fb_copyarea = cfb_copyarea,
708 .fb_imageblit = cfb_imageblit, /* Needed !!! */ 680 .fb_imageblit = cfb_imageblit,
709 .fb_blank = pm3fb_blank, 681 .fb_blank = pm3fb_blank,
710}; 682};
711 683
@@ -722,7 +694,7 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
722 unsigned long memsize = 0, tempBypass, i, temp1, temp2; 694 unsigned long memsize = 0, tempBypass, i, temp1, temp2;
723 unsigned char __iomem *screen_mem; 695 unsigned char __iomem *screen_mem;
724 696
725 pm3fb_fix.smem_len = 64 * 1024 * 1024; /* request full aperture size */ 697 pm3fb_fix.smem_len = 64 * 1024l * 1024; /* request full aperture size */
726 /* Linear frame buffer - request region and map it. */ 698 /* Linear frame buffer - request region and map it. */
727 if (!request_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len, 699 if (!request_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len,
728 "pm3fb smem")) { 700 "pm3fb smem")) {
@@ -744,7 +716,8 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
744 716
745 DPRINTK("PM3MemBypassWriteMask was: 0x%08lx\n", tempBypass); 717 DPRINTK("PM3MemBypassWriteMask was: 0x%08lx\n", tempBypass);
746 718
747 PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, 0xFFFFFFFF); 719 PM3_WAIT(par, 1);
720 PM3_WRITE_REG(par, PM3MemBypassWriteMask, 0xFFFFFFFF);
748 721
749 /* pm3 split up memory, replicates, and do a lot of nasty stuff IMHO ;-) */ 722 /* pm3 split up memory, replicates, and do a lot of nasty stuff IMHO ;-) */
750 for (i = 0; i < 32; i++) { 723 for (i = 0; i < 32; i++) {
@@ -765,10 +738,9 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
765 if (memsize + 1 == i) { 738 if (memsize + 1 == i) {
766 for (i = 0; i < 32; i++) { 739 for (i = 0; i < 32; i++) {
767 /* Clear first 32MB ; 0 is 0, no need to byteswap */ 740 /* Clear first 32MB ; 0 is 0, no need to byteswap */
768 writel(0x0000000, 741 writel(0x0000000, (screen_mem + (i * 1048576)));
769 (screen_mem + (i * 1048576)));
770 mb();
771 } 742 }
743 wmb();
772 744
773 for (i = 32; i < 64; i++) { 745 for (i = 32; i < 64; i++) {
774 fb_writel(i * 0x00345678, 746 fb_writel(i * 0x00345678,
@@ -787,7 +759,8 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par)
787 } 759 }
788 DPRINTK("Second detect pass got %ld MB\n", memsize + 1); 760 DPRINTK("Second detect pass got %ld MB\n", memsize + 1);
789 761
790 PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, tempBypass); 762 PM3_WAIT(par, 1);
763 PM3_WRITE_REG(par, PM3MemBypassWriteMask, tempBypass);
791 764
792 iounmap(screen_mem); 765 iounmap(screen_mem);
793 release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len); 766 release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len);
@@ -890,7 +863,6 @@ static int __devinit pm3fb_probe(struct pci_dev *dev,
890 goto err_exit_both; 863 goto err_exit_both;
891 } 864 }
892 865
893 /* This has to been done !!! */
894 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { 866 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
895 retval = -ENOMEM; 867 retval = -ENOMEM;
896 goto err_exit_both; 868 goto err_exit_both;
@@ -907,7 +879,7 @@ static int __devinit pm3fb_probe(struct pci_dev *dev,
907 } 879 }
908 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, 880 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
909 info->fix.id); 881 info->fix.id);
910 pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */ 882 pci_set_drvdata(dev, info);
911 return 0; 883 return 0;
912 884
913 err_exit_all: 885 err_exit_all:
@@ -949,8 +921,7 @@ static void __devexit pm3fb_remove(struct pci_dev *dev)
949 921
950static struct pci_device_id pm3fb_id_table[] = { 922static struct pci_device_id pm3fb_id_table[] = {
951 { PCI_VENDOR_ID_3DLABS, 0x0a, 923 { PCI_VENDOR_ID_3DLABS, 0x0a,
952 PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, 924 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
953 0xff0000, 0 },
954 { 0, } 925 { 0, }
955}; 926};
956 927
@@ -964,6 +935,22 @@ static struct pci_driver pm3fb_driver = {
964 935
965MODULE_DEVICE_TABLE(pci, pm3fb_id_table); 936MODULE_DEVICE_TABLE(pci, pm3fb_id_table);
966 937
938#ifndef MODULE
939 /*
940 * Setup
941 */
942
943/*
944 * Only necessary if your driver takes special options,
945 * otherwise we fall back on the generic fb_setup().
946 */
947static int __init pm3fb_setup(char *options)
948{
949 /* Parse user speficied options (`video=pm3fb:') */
950 return 0;
951}
952#endif /* MODULE */
953
967int __init pm3fb_init(void) 954int __init pm3fb_init(void)
968{ 955{
969 /* 956 /*
@@ -985,22 +972,6 @@ static void __exit pm3fb_exit(void)
985 pci_unregister_driver(&pm3fb_driver); 972 pci_unregister_driver(&pm3fb_driver);
986} 973}
987 974
988#ifndef MODULE
989 /*
990 * Setup
991 */
992
993/*
994 * Only necessary if your driver takes special options,
995 * otherwise we fall back on the generic fb_setup().
996 */
997int __init pm3fb_setup(char *options)
998{
999 /* Parse user speficied options (`video=pm3fb:') */
1000 return 0;
1001}
1002#endif /* MODULE */
1003
1004module_init(pm3fb_init); 975module_init(pm3fb_init);
1005module_exit(pm3fb_exit); 976module_exit(pm3fb_exit);
1006 977
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 9756a728b74f..9cf92ba5d6e3 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -951,12 +951,14 @@ static int ps3fb_xdr_settings(u64 xdr_lpar)
951static struct fb_ops ps3fb_ops = { 951static struct fb_ops ps3fb_ops = {
952 .fb_open = ps3fb_open, 952 .fb_open = ps3fb_open,
953 .fb_release = ps3fb_release, 953 .fb_release = ps3fb_release,
954 .fb_read = fb_sys_read,
955 .fb_write = fb_sys_write,
954 .fb_check_var = ps3fb_check_var, 956 .fb_check_var = ps3fb_check_var,
955 .fb_set_par = ps3fb_set_par, 957 .fb_set_par = ps3fb_set_par,
956 .fb_setcolreg = ps3fb_setcolreg, 958 .fb_setcolreg = ps3fb_setcolreg,
957 .fb_fillrect = cfb_fillrect, 959 .fb_fillrect = sys_fillrect,
958 .fb_copyarea = cfb_copyarea, 960 .fb_copyarea = sys_copyarea,
959 .fb_imageblit = cfb_imageblit, 961 .fb_imageblit = sys_imageblit,
960 .fb_mmap = ps3fb_mmap, 962 .fb_mmap = ps3fb_mmap,
961 .fb_blank = ps3fb_blank, 963 .fb_blank = ps3fb_blank,
962 .fb_ioctl = ps3fb_ioctl, 964 .fb_ioctl = ps3fb_ioctl,
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
index 5fc86ea20692..003c49a490eb 100644
--- a/drivers/video/w100fb.c
+++ b/drivers/video/w100fb.c
@@ -660,7 +660,7 @@ int __init w100fb_probe(struct platform_device *pdev)
660 err = -ENODEV; 660 err = -ENODEV;
661 goto out; 661 goto out;
662 } 662 }
663 printk(" at 0x%08lx.\n", mem->start+W100_CFG_BASE); 663 printk(" at 0x%08lx.\n", (unsigned long) mem->start+W100_CFG_BASE);
664 664
665 /* Remap the framebuffer */ 665 /* Remap the framebuffer */
666 remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE); 666 remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE);
@@ -753,10 +753,14 @@ int __init w100fb_probe(struct platform_device *pdev)
753 goto out; 753 goto out;
754 } 754 }
755 755
756 device_create_file(&pdev->dev, &dev_attr_fastpllclk); 756 err = device_create_file(&pdev->dev, &dev_attr_fastpllclk);
757 device_create_file(&pdev->dev, &dev_attr_reg_read); 757 err |= device_create_file(&pdev->dev, &dev_attr_reg_read);
758 device_create_file(&pdev->dev, &dev_attr_reg_write); 758 err |= device_create_file(&pdev->dev, &dev_attr_reg_write);
759 device_create_file(&pdev->dev, &dev_attr_flip); 759 err |= device_create_file(&pdev->dev, &dev_attr_flip);
760
761 if (err != 0)
762 printk(KERN_WARNING "fb%d: failed to register attributes (%d)\n",
763 info->node, err);
760 764
761 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); 765 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
762 return 0; 766 return 0;