aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-07-31 20:37:25 -0400
committerPaul Mackerras <paulus@samba.org>2006-07-31 20:37:25 -0400
commit57cad8084e0837e0f2c97da789ec9b3f36809be9 (patch)
treee9c790afb4286f78cb08d9664f58baa7e876fe55 /drivers/char
parentcb18bd40030c879cd93fef02fd579f74dbab473d (diff)
parent49b1e3ea19b1c95c2f012b8331ffb3b169e4c042 (diff)
Merge branch 'merge'
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hvsi.c2
-rw-r--r--drivers/char/hw_random/geode-rng.c6
-rw-r--r--drivers/char/hw_random/intel-rng.c2
-rw-r--r--drivers/char/ip2/ip2main.c7
-rw-r--r--drivers/char/mem.c4
-rw-r--r--drivers/char/nsc_gpio.c6
-rw-r--r--drivers/char/pc8736x_gpio.c58
-rw-r--r--drivers/char/pcmcia/synclink_cs.c14
-rw-r--r--drivers/char/rtc.c47
-rw-r--r--drivers/char/scx200_gpio.c72
-rw-r--r--drivers/char/snsc_event.c15
-rw-r--r--drivers/char/specialix.c6
-rw-r--r--drivers/char/synclink.c14
-rw-r--r--drivers/char/synclink_gt.c14
-rw-r--r--drivers/char/synclinkmp.c14
-rw-r--r--drivers/char/tpm/tpm.c1
-rw-r--r--drivers/char/tpm/tpm_tis.c77
-rw-r--r--drivers/char/vr41xx_giu.c1
18 files changed, 226 insertions, 134 deletions
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 542de0e51f35..9101784ecf02 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1298,7 +1298,7 @@ static int __init hvsi_console_init(void)
1298 hp->inbuf_end = hp->inbuf; 1298 hp->inbuf_end = hp->inbuf;
1299 hp->state = HVSI_CLOSED; 1299 hp->state = HVSI_CLOSED;
1300 hp->vtermno = *vtermno; 1300 hp->vtermno = *vtermno;
1301 hp->virq = irq_create_mapping(NULL, irq[0], 0); 1301 hp->virq = irq_create_mapping(NULL, irq[0]);
1302 if (hp->virq == NO_IRQ) { 1302 if (hp->virq == NO_IRQ) {
1303 printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n", 1303 printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n",
1304 __FUNCTION__, irq[0]); 1304 __FUNCTION__, irq[0]);
diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c
index be61f22ee7bb..d37ced0d132b 100644
--- a/drivers/char/hw_random/geode-rng.c
+++ b/drivers/char/hw_random/geode-rng.c
@@ -107,10 +107,14 @@ found:
107 if (err) { 107 if (err) {
108 printk(KERN_ERR PFX "RNG registering failed (%d)\n", 108 printk(KERN_ERR PFX "RNG registering failed (%d)\n",
109 err); 109 err);
110 goto out; 110 goto err_unmap;
111 } 111 }
112out: 112out:
113 return err; 113 return err;
114
115err_unmap:
116 iounmap(mem);
117 goto out;
114} 118}
115 119
116static void __exit mod_exit(void) 120static void __exit mod_exit(void)
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c
index 6594bd5645f4..ccd7e7102234 100644
--- a/drivers/char/hw_random/intel-rng.c
+++ b/drivers/char/hw_random/intel-rng.c
@@ -164,7 +164,7 @@ static int __init mod_init(void)
164 if (err) { 164 if (err) {
165 printk(KERN_ERR PFX "RNG registering failed (%d)\n", 165 printk(KERN_ERR PFX "RNG registering failed (%d)\n",
166 err); 166 err);
167 goto out; 167 goto err_unmap;
168 } 168 }
169out: 169out:
170 return err; 170 return err;
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 518ece7ac656..7907ae88c2f4 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -3186,3 +3186,10 @@ ip2trace (unsigned short pn, unsigned char cat, unsigned char label, unsigned lo
3186 3186
3187 3187
3188MODULE_LICENSE("GPL"); 3188MODULE_LICENSE("GPL");
3189
3190static struct pci_device_id ip2main_pci_tbl[] __devinitdata = {
3191 { PCI_DEVICE(PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_IP2EX) },
3192 { }
3193};
3194
3195MODULE_DEVICE_TABLE(pci, ip2main_pci_tbl);
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index e97c32ceb796..917b20402664 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -95,7 +95,7 @@ static inline int valid_phys_addr_range(unsigned long addr, size_t count)
95 return 1; 95 return 1;
96} 96}
97 97
98static inline int valid_mmap_phys_addr_range(unsigned long addr, size_t size) 98static inline int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
99{ 99{
100 return 1; 100 return 1;
101} 101}
@@ -242,7 +242,7 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma)
242{ 242{
243 size_t size = vma->vm_end - vma->vm_start; 243 size_t size = vma->vm_end - vma->vm_start;
244 244
245 if (!valid_mmap_phys_addr_range(vma->vm_pgoff << PAGE_SHIFT, size)) 245 if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))
246 return -EINVAL; 246 return -EINVAL;
247 247
248 vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff, 248 vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
diff --git a/drivers/char/nsc_gpio.c b/drivers/char/nsc_gpio.c
index 5b91e4e25641..7719bd75810b 100644
--- a/drivers/char/nsc_gpio.c
+++ b/drivers/char/nsc_gpio.c
@@ -68,13 +68,11 @@ ssize_t nsc_gpio_write(struct file *file, const char __user *data,
68 amp->gpio_config(m, ~1, 0); 68 amp->gpio_config(m, ~1, 0);
69 break; 69 break;
70 case 'T': 70 case 'T':
71 dev_dbg(dev, "GPIO%d output is push pull\n", 71 dev_dbg(dev, "GPIO%d output is push pull\n", m);
72 m);
73 amp->gpio_config(m, ~2, 2); 72 amp->gpio_config(m, ~2, 2);
74 break; 73 break;
75 case 't': 74 case 't':
76 dev_dbg(dev, "GPIO%d output is open drain\n", 75 dev_dbg(dev, "GPIO%d output is open drain\n", m);
77 m);
78 amp->gpio_config(m, ~2, 0); 76 amp->gpio_config(m, ~2, 0);
79 break; 77 break;
80 case 'P': 78 case 'P':
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index 4005ee0aa11e..84e5a68635f1 100644
--- a/drivers/char/pc8736x_gpio.c
+++ b/drivers/char/pc8736x_gpio.c
@@ -3,18 +3,18 @@
3 National Semiconductor PC8736x GPIO driver. Allows a user space 3 National Semiconductor PC8736x GPIO driver. Allows a user space
4 process to play with the GPIO pins. 4 process to play with the GPIO pins.
5 5
6 Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com> 6 Copyright (c) 2005,2006 Jim Cromie <jim.cromie@gmail.com>
7 7
8 adapted from linux/drivers/char/scx200_gpio.c 8 adapted from linux/drivers/char/scx200_gpio.c
9 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>, 9 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>,
10*/ 10*/
11 11
12#include <linux/config.h>
13#include <linux/fs.h> 12#include <linux/fs.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/errno.h> 14#include <linux/errno.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/cdev.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
@@ -25,7 +25,7 @@
25#define DEVNAME "pc8736x_gpio" 25#define DEVNAME "pc8736x_gpio"
26 26
27MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>"); 27MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>");
28MODULE_DESCRIPTION("NatSemi PC-8736x GPIO Pin Driver"); 28MODULE_DESCRIPTION("NatSemi/Winbond PC-8736x GPIO Pin Driver");
29MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
30 30
31static int major; /* default to dynamic major */ 31static int major; /* default to dynamic major */
@@ -38,14 +38,14 @@ static u8 pc8736x_gpio_shadow[4];
38 38
39#define SIO_BASE1 0x2E /* 1st command-reg to check */ 39#define SIO_BASE1 0x2E /* 1st command-reg to check */
40#define SIO_BASE2 0x4E /* alt command-reg to check */ 40#define SIO_BASE2 0x4E /* alt command-reg to check */
41#define SIO_BASE_OFFSET 0x20
42 41
43#define SIO_SID 0x20 /* SuperI/O ID Register */ 42#define SIO_SID 0x20 /* SuperI/O ID Register */
44#define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */ 43#define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */
45 44
46#define SIO_CF1 0x21 /* chip config, bit0 is chip enable */ 45#define SIO_CF1 0x21 /* chip config, bit0 is chip enable */
47 46
48#define PC8736X_GPIO_SIZE 16 47#define PC8736X_GPIO_RANGE 16 /* ioaddr range */
48#define PC8736X_GPIO_CT 32 /* minors matching 4 8 bit ports */
49 49
50#define SIO_UNIT_SEL 0x7 /* unit select reg */ 50#define SIO_UNIT_SEL 0x7 /* unit select reg */
51#define SIO_UNIT_ACT 0x30 /* unit enable */ 51#define SIO_UNIT_ACT 0x30 /* unit enable */
@@ -212,14 +212,12 @@ static void pc8736x_gpio_change(unsigned index)
212 pc8736x_gpio_set(index, !pc8736x_gpio_current(index)); 212 pc8736x_gpio_set(index, !pc8736x_gpio_current(index));
213} 213}
214 214
215static struct nsc_gpio_ops pc8736x_access = { 215static struct nsc_gpio_ops pc8736x_gpio_ops = {
216 .owner = THIS_MODULE, 216 .owner = THIS_MODULE,
217 .gpio_config = pc8736x_gpio_configure, 217 .gpio_config = pc8736x_gpio_configure,
218 .gpio_dump = nsc_gpio_dump, 218 .gpio_dump = nsc_gpio_dump,
219 .gpio_get = pc8736x_gpio_get, 219 .gpio_get = pc8736x_gpio_get,
220 .gpio_set = pc8736x_gpio_set, 220 .gpio_set = pc8736x_gpio_set,
221 .gpio_set_high = pc8736x_gpio_set_high,
222 .gpio_set_low = pc8736x_gpio_set_low,
223 .gpio_change = pc8736x_gpio_change, 221 .gpio_change = pc8736x_gpio_change,
224 .gpio_current = pc8736x_gpio_current 222 .gpio_current = pc8736x_gpio_current
225}; 223};
@@ -227,16 +225,16 @@ static struct nsc_gpio_ops pc8736x_access = {
227static int pc8736x_gpio_open(struct inode *inode, struct file *file) 225static int pc8736x_gpio_open(struct inode *inode, struct file *file)
228{ 226{
229 unsigned m = iminor(inode); 227 unsigned m = iminor(inode);
230 file->private_data = &pc8736x_access; 228 file->private_data = &pc8736x_gpio_ops;
231 229
232 dev_dbg(&pdev->dev, "open %d\n", m); 230 dev_dbg(&pdev->dev, "open %d\n", m);
233 231
234 if (m > 63) 232 if (m >= PC8736X_GPIO_CT)
235 return -EINVAL; 233 return -EINVAL;
236 return nonseekable_open(inode, file); 234 return nonseekable_open(inode, file);
237} 235}
238 236
239static const struct file_operations pc8736x_gpio_fops = { 237static const struct file_operations pc8736x_gpio_fileops = {
240 .owner = THIS_MODULE, 238 .owner = THIS_MODULE,
241 .open = pc8736x_gpio_open, 239 .open = pc8736x_gpio_open,
242 .write = nsc_gpio_write, 240 .write = nsc_gpio_write,
@@ -255,9 +253,12 @@ static void __init pc8736x_init_shadow(void)
255 253
256} 254}
257 255
256static struct cdev pc8736x_gpio_cdev;
257
258static int __init pc8736x_gpio_init(void) 258static int __init pc8736x_gpio_init(void)
259{ 259{
260 int rc = 0; 260 int rc;
261 dev_t devid;
261 262
262 pdev = platform_device_alloc(DEVNAME, 0); 263 pdev = platform_device_alloc(DEVNAME, 0);
263 if (!pdev) 264 if (!pdev)
@@ -275,7 +276,7 @@ static int __init pc8736x_gpio_init(void)
275 dev_err(&pdev->dev, "no device found\n"); 276 dev_err(&pdev->dev, "no device found\n");
276 goto undo_platform_dev_add; 277 goto undo_platform_dev_add;
277 } 278 }
278 pc8736x_access.dev = &pdev->dev; 279 pc8736x_gpio_ops.dev = &pdev->dev;
279 280
280 /* Verify that chip and it's GPIO unit are both enabled. 281 /* Verify that chip and it's GPIO unit are both enabled.
281 My BIOS does this, so I take minimum action here 282 My BIOS does this, so I take minimum action here
@@ -297,7 +298,7 @@ static int __init pc8736x_gpio_init(void)
297 pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8 298 pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8
298 | superio_inb(SIO_BASE_LADDR)); 299 | superio_inb(SIO_BASE_LADDR));
299 300
300 if (!request_region(pc8736x_gpio_base, 16, DEVNAME)) { 301 if (!request_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE, DEVNAME)) {
301 rc = -ENODEV; 302 rc = -ENODEV;
302 dev_err(&pdev->dev, "GPIO ioport %x busy\n", 303 dev_err(&pdev->dev, "GPIO ioport %x busy\n",
303 pc8736x_gpio_base); 304 pc8736x_gpio_base);
@@ -305,10 +306,17 @@ static int __init pc8736x_gpio_init(void)
305 } 306 }
306 dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base); 307 dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base);
307 308
308 rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops); 309 if (major) {
310 devid = MKDEV(major, 0);
311 rc = register_chrdev_region(devid, PC8736X_GPIO_CT, DEVNAME);
312 } else {
313 rc = alloc_chrdev_region(&devid, 0, PC8736X_GPIO_CT, DEVNAME);
314 major = MAJOR(devid);
315 }
316
309 if (rc < 0) { 317 if (rc < 0) {
310 dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc); 318 dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
311 goto undo_platform_dev_add; 319 goto undo_request_region;
312 } 320 }
313 if (!major) { 321 if (!major) {
314 major = rc; 322 major = rc;
@@ -316,8 +324,15 @@ static int __init pc8736x_gpio_init(void)
316 } 324 }
317 325
318 pc8736x_init_shadow(); 326 pc8736x_init_shadow();
327
328 /* ignore minor errs, and succeed */
329 cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fileops);
330 cdev_add(&pc8736x_gpio_cdev, devid, PC8736X_GPIO_CT);
331
319 return 0; 332 return 0;
320 333
334undo_request_region:
335 release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE);
321undo_platform_dev_add: 336undo_platform_dev_add:
322 platform_device_del(pdev); 337 platform_device_del(pdev);
323undo_platform_dev_alloc: 338undo_platform_dev_alloc:
@@ -328,14 +343,15 @@ undo_platform_dev_alloc:
328 343
329static void __exit pc8736x_gpio_cleanup(void) 344static void __exit pc8736x_gpio_cleanup(void)
330{ 345{
331 dev_dbg(&pdev->dev, " cleanup\n"); 346 dev_dbg(&pdev->dev, "cleanup\n");
332 347
333 release_region(pc8736x_gpio_base, 16); 348 cdev_del(&pc8736x_gpio_cdev);
349 unregister_chrdev_region(MKDEV(major,0), PC8736X_GPIO_CT);
350 release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE);
334 351
335 unregister_chrdev(major, DEVNAME); 352 platform_device_del(pdev);
353 platform_device_put(pdev);
336} 354}
337 355
338EXPORT_SYMBOL(pc8736x_access);
339
340module_init(pc8736x_gpio_init); 356module_init(pc8736x_gpio_init);
341module_exit(pc8736x_gpio_cleanup); 357module_exit(pc8736x_gpio_cleanup);
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 17bc8abd5df5..00f574cbb0d4 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1174,8 +1174,12 @@ static void dcd_change(MGSLPC_INFO *info)
1174 else 1174 else
1175 info->input_signal_events.dcd_down++; 1175 info->input_signal_events.dcd_down++;
1176#ifdef CONFIG_HDLC 1176#ifdef CONFIG_HDLC
1177 if (info->netcount) 1177 if (info->netcount) {
1178 hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, info->netdev); 1178 if (info->serial_signals & SerialSignal_DCD)
1179 netif_carrier_on(info->netdev);
1180 else
1181 netif_carrier_off(info->netdev);
1182 }
1179#endif 1183#endif
1180 wake_up_interruptible(&info->status_event_wait_q); 1184 wake_up_interruptible(&info->status_event_wait_q);
1181 wake_up_interruptible(&info->event_wait_q); 1185 wake_up_interruptible(&info->event_wait_q);
@@ -4251,8 +4255,10 @@ static int hdlcdev_open(struct net_device *dev)
4251 spin_lock_irqsave(&info->lock, flags); 4255 spin_lock_irqsave(&info->lock, flags);
4252 get_signals(info); 4256 get_signals(info);
4253 spin_unlock_irqrestore(&info->lock, flags); 4257 spin_unlock_irqrestore(&info->lock, flags);
4254 hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev); 4258 if (info->serial_signals & SerialSignal_DCD)
4255 4259 netif_carrier_on(dev);
4260 else
4261 netif_carrier_off(dev);
4256 return 0; 4262 return 0;
4257} 4263}
4258 4264
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index cc7bd1a3095b..6e6a7c7a7eff 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -46,13 +46,12 @@
46 * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init 46 * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init
47 * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer 47 * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
48 * CONFIG_HPET_EMULATE_RTC 48 * CONFIG_HPET_EMULATE_RTC
49 * 1.12a Maciej W. Rozycki: Handle memory-mapped chips properly.
49 * 1.12ac Alan Cox: Allow read access to the day of week register 50 * 1.12ac Alan Cox: Allow read access to the day of week register
50 */ 51 */
51 52
52#define RTC_VERSION "1.12ac" 53#define RTC_VERSION "1.12ac"
53 54
54#define RTC_IO_EXTENT 0x8
55
56/* 55/*
57 * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with 56 * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with
58 * interrupts disabled. Due to the index-port/data-port (0x70/0x71) 57 * interrupts disabled. Due to the index-port/data-port (0x70/0x71)
@@ -337,7 +336,15 @@ static ssize_t rtc_read(struct file *file, char __user *buf,
337 if (rtc_has_irq == 0) 336 if (rtc_has_irq == 0)
338 return -EIO; 337 return -EIO;
339 338
340 if (count < sizeof(unsigned)) 339 /*
340 * Historically this function used to assume that sizeof(unsigned long)
341 * is the same in userspace and kernelspace. This lead to problems
342 * for configurations with multiple ABIs such a the MIPS o32 and 64
343 * ABIs supported on the same kernel. So now we support read of both
344 * 4 and 8 bytes and assume that's the sizeof(unsigned long) in the
345 * userspace ABI.
346 */
347 if (count != sizeof(unsigned int) && count != sizeof(unsigned long))
341 return -EINVAL; 348 return -EINVAL;
342 349
343 add_wait_queue(&rtc_wait, &wait); 350 add_wait_queue(&rtc_wait, &wait);
@@ -368,10 +375,12 @@ static ssize_t rtc_read(struct file *file, char __user *buf,
368 schedule(); 375 schedule();
369 } while (1); 376 } while (1);
370 377
371 if (count < sizeof(unsigned long)) 378 if (count == sizeof(unsigned int))
372 retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int); 379 retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int);
373 else 380 else
374 retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long); 381 retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long);
382 if (!retval)
383 retval = count;
375 out: 384 out:
376 current->state = TASK_RUNNING; 385 current->state = TASK_RUNNING;
377 remove_wait_queue(&rtc_wait, &wait); 386 remove_wait_queue(&rtc_wait, &wait);
@@ -923,6 +932,9 @@ static int __init rtc_init(void)
923 struct sparc_isa_device *isa_dev; 932 struct sparc_isa_device *isa_dev;
924#endif 933#endif
925#endif 934#endif
935#ifndef __sparc__
936 void *r;
937#endif
926 938
927#ifdef __sparc__ 939#ifdef __sparc__
928 for_each_ebus(ebus) { 940 for_each_ebus(ebus) {
@@ -964,8 +976,13 @@ found:
964 } 976 }
965no_irq: 977no_irq:
966#else 978#else
967 if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc")) { 979 if (RTC_IOMAPPED)
968 printk(KERN_ERR "rtc: I/O port %d is not free.\n", RTC_PORT (0)); 980 r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
981 else
982 r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
983 if (!r) {
984 printk(KERN_ERR "rtc: I/O resource %lx is not free.\n",
985 (long)(RTC_PORT(0)));
969 return -EIO; 986 return -EIO;
970 } 987 }
971 988
@@ -979,7 +996,10 @@ no_irq:
979 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { 996 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) {
980 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ 997 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
981 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); 998 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
982 release_region(RTC_PORT(0), RTC_IO_EXTENT); 999 if (RTC_IOMAPPED)
1000 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1001 else
1002 release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
983 return -EIO; 1003 return -EIO;
984 } 1004 }
985 hpet_rtc_timer_init(); 1005 hpet_rtc_timer_init();
@@ -1079,7 +1099,10 @@ static void __exit rtc_exit (void)
1079 if (rtc_has_irq) 1099 if (rtc_has_irq)
1080 free_irq (rtc_irq, &rtc_port); 1100 free_irq (rtc_irq, &rtc_port);
1081#else 1101#else
1082 release_region (RTC_PORT (0), RTC_IO_EXTENT); 1102 if (RTC_IOMAPPED)
1103 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1104 else
1105 release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
1083#ifdef RTC_IRQ 1106#ifdef RTC_IRQ
1084 if (rtc_has_irq) 1107 if (rtc_has_irq)
1085 free_irq (RTC_IRQ, NULL); 1108 free_irq (RTC_IRQ, NULL);
@@ -1222,7 +1245,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
1222 1245
1223void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1246void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1224{ 1247{
1225 unsigned long uip_watchdog = jiffies; 1248 unsigned long uip_watchdog = jiffies, flags;
1226 unsigned char ctrl; 1249 unsigned char ctrl;
1227#ifdef CONFIG_MACH_DECSTATION 1250#ifdef CONFIG_MACH_DECSTATION
1228 unsigned int real_year; 1251 unsigned int real_year;
@@ -1249,7 +1272,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1249 * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is 1272 * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is
1250 * only updated by the RTC when initially set to a non-zero value. 1273 * only updated by the RTC when initially set to a non-zero value.
1251 */ 1274 */
1252 spin_lock_irq(&rtc_lock); 1275 spin_lock_irqsave(&rtc_lock, flags);
1253 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); 1276 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS);
1254 rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); 1277 rtc_tm->tm_min = CMOS_READ(RTC_MINUTES);
1255 rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); 1278 rtc_tm->tm_hour = CMOS_READ(RTC_HOURS);
@@ -1263,7 +1286,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1263 real_year = CMOS_READ(RTC_DEC_YEAR); 1286 real_year = CMOS_READ(RTC_DEC_YEAR);
1264#endif 1287#endif
1265 ctrl = CMOS_READ(RTC_CONTROL); 1288 ctrl = CMOS_READ(RTC_CONTROL);
1266 spin_unlock_irq(&rtc_lock); 1289 spin_unlock_irqrestore(&rtc_lock, flags);
1267 1290
1268 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 1291 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
1269 { 1292 {
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
index 425c58719db6..b956c7babd18 100644
--- a/drivers/char/scx200_gpio.c
+++ b/drivers/char/scx200_gpio.c
@@ -5,7 +5,6 @@
5 5
6 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */ 6 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */
7 7
8#include <linux/config.h>
9#include <linux/device.h> 8#include <linux/device.h>
10#include <linux/fs.h> 9#include <linux/fs.h>
11#include <linux/module.h> 10#include <linux/module.h>
@@ -22,37 +21,37 @@
22#include <linux/scx200_gpio.h> 21#include <linux/scx200_gpio.h>
23#include <linux/nsc_gpio.h> 22#include <linux/nsc_gpio.h>
24 23
25#define NAME "scx200_gpio" 24#define DRVNAME "scx200_gpio"
26#define DEVNAME NAME
27 25
28static struct platform_device *pdev; 26static struct platform_device *pdev;
29 27
30MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); 28MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>");
31MODULE_DESCRIPTION("NatSemi SCx200 GPIO Pin Driver"); 29MODULE_DESCRIPTION("NatSemi/AMD SCx200 GPIO Pin Driver");
32MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
33 31
34static int major = 0; /* default to dynamic major */ 32static int major = 0; /* default to dynamic major */
35module_param(major, int, 0); 33module_param(major, int, 0);
36MODULE_PARM_DESC(major, "Major device number"); 34MODULE_PARM_DESC(major, "Major device number");
37 35
38struct nsc_gpio_ops scx200_access = { 36#define MAX_PINS 32 /* 64 later, when known ok */
37
38struct nsc_gpio_ops scx200_gpio_ops = {
39 .owner = THIS_MODULE, 39 .owner = THIS_MODULE,
40 .gpio_config = scx200_gpio_configure, 40 .gpio_config = scx200_gpio_configure,
41 .gpio_dump = nsc_gpio_dump, 41 .gpio_dump = nsc_gpio_dump,
42 .gpio_get = scx200_gpio_get, 42 .gpio_get = scx200_gpio_get,
43 .gpio_set = scx200_gpio_set, 43 .gpio_set = scx200_gpio_set,
44 .gpio_set_high = scx200_gpio_set_high,
45 .gpio_set_low = scx200_gpio_set_low,
46 .gpio_change = scx200_gpio_change, 44 .gpio_change = scx200_gpio_change,
47 .gpio_current = scx200_gpio_current 45 .gpio_current = scx200_gpio_current
48}; 46};
47EXPORT_SYMBOL(scx200_gpio_ops);
49 48
50static int scx200_gpio_open(struct inode *inode, struct file *file) 49static int scx200_gpio_open(struct inode *inode, struct file *file)
51{ 50{
52 unsigned m = iminor(inode); 51 unsigned m = iminor(inode);
53 file->private_data = &scx200_access; 52 file->private_data = &scx200_gpio_ops;
54 53
55 if (m > 63) 54 if (m >= MAX_PINS)
56 return -EINVAL; 55 return -EINVAL;
57 return nonseekable_open(inode, file); 56 return nonseekable_open(inode, file);
58} 57}
@@ -62,8 +61,7 @@ static int scx200_gpio_release(struct inode *inode, struct file *file)
62 return 0; 61 return 0;
63} 62}
64 63
65 64static const struct file_operations scx200_gpio_fileops = {
66static const struct file_operations scx200_gpio_fops = {
67 .owner = THIS_MODULE, 65 .owner = THIS_MODULE,
68 .write = nsc_gpio_write, 66 .write = nsc_gpio_write,
69 .read = nsc_gpio_read, 67 .read = nsc_gpio_read,
@@ -71,21 +69,20 @@ static const struct file_operations scx200_gpio_fops = {
71 .release = scx200_gpio_release, 69 .release = scx200_gpio_release,
72}; 70};
73 71
74struct cdev *scx200_devices; 72struct cdev scx200_gpio_cdev; /* use 1 cdev for all pins */
75static int num_pins = 32;
76 73
77static int __init scx200_gpio_init(void) 74static int __init scx200_gpio_init(void)
78{ 75{
79 int rc, i; 76 int rc;
80 dev_t dev = MKDEV(major, 0); 77 dev_t devid;
81 78
82 if (!scx200_gpio_present()) { 79 if (!scx200_gpio_present()) {
83 printk(KERN_ERR NAME ": no SCx200 gpio present\n"); 80 printk(KERN_ERR DRVNAME ": no SCx200 gpio present\n");
84 return -ENODEV; 81 return -ENODEV;
85 } 82 }
86 83
87 /* support dev_dbg() with pdev->dev */ 84 /* support dev_dbg() with pdev->dev */
88 pdev = platform_device_alloc(DEVNAME, 0); 85 pdev = platform_device_alloc(DRVNAME, 0);
89 if (!pdev) 86 if (!pdev)
90 return -ENOMEM; 87 return -ENOMEM;
91 88
@@ -94,37 +91,25 @@ static int __init scx200_gpio_init(void)
94 goto undo_malloc; 91 goto undo_malloc;
95 92
96 /* nsc_gpio uses dev_dbg(), so needs this */ 93 /* nsc_gpio uses dev_dbg(), so needs this */
97 scx200_access.dev = &pdev->dev; 94 scx200_gpio_ops.dev = &pdev->dev;
98 95
99 if (major) 96 if (major) {
100 rc = register_chrdev_region(dev, num_pins, "scx200_gpio"); 97 devid = MKDEV(major, 0);
101 else { 98 rc = register_chrdev_region(devid, MAX_PINS, "scx200_gpio");
102 rc = alloc_chrdev_region(&dev, 0, num_pins, "scx200_gpio"); 99 } else {
103 major = MAJOR(dev); 100 rc = alloc_chrdev_region(&devid, 0, MAX_PINS, "scx200_gpio");
101 major = MAJOR(devid);
104 } 102 }
105 if (rc < 0) { 103 if (rc < 0) {
106 dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc); 104 dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc);
107 goto undo_platform_device_add; 105 goto undo_platform_device_add;
108 } 106 }
109 scx200_devices = kzalloc(num_pins * sizeof(struct cdev), GFP_KERNEL); 107
110 if (!scx200_devices) { 108 cdev_init(&scx200_gpio_cdev, &scx200_gpio_fileops);
111 rc = -ENOMEM; 109 cdev_add(&scx200_gpio_cdev, devid, MAX_PINS);
112 goto undo_chrdev_region;
113 }
114 for (i = 0; i < num_pins; i++) {
115 struct cdev *cdev = &scx200_devices[i];
116 cdev_init(cdev, &scx200_gpio_fops);
117 cdev->owner = THIS_MODULE;
118 rc = cdev_add(cdev, MKDEV(major, i), 1);
119 /* tolerate 'minor' errors */
120 if (rc)
121 dev_err(&pdev->dev, "Error %d on minor %d", rc, i);
122 }
123 110
124 return 0; /* succeed */ 111 return 0; /* succeed */
125 112
126undo_chrdev_region:
127 unregister_chrdev_region(dev, num_pins);
128undo_platform_device_add: 113undo_platform_device_add:
129 platform_device_del(pdev); 114 platform_device_del(pdev);
130undo_malloc: 115undo_malloc:
@@ -135,10 +120,11 @@ undo_malloc:
135 120
136static void __exit scx200_gpio_cleanup(void) 121static void __exit scx200_gpio_cleanup(void)
137{ 122{
138 kfree(scx200_devices); 123 cdev_del(&scx200_gpio_cdev);
139 unregister_chrdev_region(MKDEV(major, 0), num_pins); 124 /* cdev_put(&scx200_gpio_cdev); */
125
126 unregister_chrdev_region(MKDEV(major, 0), MAX_PINS);
140 platform_device_unregister(pdev); 127 platform_device_unregister(pdev);
141 /* kfree(pdev); */
142} 128}
143 129
144module_init(scx200_gpio_init); 130module_init(scx200_gpio_init);
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c
index 8b2210b633df..d12d4f629cec 100644
--- a/drivers/char/snsc_event.c
+++ b/drivers/char/snsc_event.c
@@ -220,20 +220,7 @@ scdrv_dispatch_event(char *event, int len)
220 " Sending SIGPWR to init...\n"); 220 " Sending SIGPWR to init...\n");
221 221
222 /* give a SIGPWR signal to init proc */ 222 /* give a SIGPWR signal to init proc */
223 223 kill_proc(1, SIGPWR, 0);
224 /* first find init's task */
225 read_lock(&tasklist_lock);
226 for_each_process(p) {
227 if (p->pid == 1)
228 break;
229 }
230 if (p) {
231 force_sig(SIGPWR, p);
232 } else {
233 printk(KERN_ERR "Failed to signal init!\n");
234 snsc_shutting_down = 0; /* so can try again (?) */
235 }
236 read_unlock(&tasklist_lock);
237 } else { 224 } else {
238 /* print to system log */ 225 /* print to system log */
239 printk("%s|$(0x%x)%s\n", severity, esp_code, desc); 226 printk("%s|$(0x%x)%s\n", severity, esp_code, desc);
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index cb2859249d49..a1d303f9a33d 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -2584,6 +2584,12 @@ static void __exit specialix_exit_module(void)
2584 func_exit(); 2584 func_exit();
2585} 2585}
2586 2586
2587static struct pci_device_id specialx_pci_tbl[] __devinitdata = {
2588 { PCI_DEVICE(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_IO8) },
2589 { }
2590};
2591MODULE_DEVICE_TABLE(pci, specialx_pci_tbl);
2592
2587module_init(specialix_init_module); 2593module_init(specialix_init_module);
2588module_exit(specialix_exit_module); 2594module_exit(specialix_exit_module);
2589 2595
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index df782dd1098c..78b1b1a2732b 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -1344,8 +1344,12 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info )
1344 } else 1344 } else
1345 info->input_signal_events.dcd_down++; 1345 info->input_signal_events.dcd_down++;
1346#ifdef CONFIG_HDLC 1346#ifdef CONFIG_HDLC
1347 if (info->netcount) 1347 if (info->netcount) {
1348 hdlc_set_carrier(status & MISCSTATUS_DCD, info->netdev); 1348 if (status & MISCSTATUS_DCD)
1349 netif_carrier_on(info->netdev);
1350 else
1351 netif_carrier_off(info->netdev);
1352 }
1349#endif 1353#endif
1350 } 1354 }
1351 if (status & MISCSTATUS_CTS_LATCHED) 1355 if (status & MISCSTATUS_CTS_LATCHED)
@@ -7844,8 +7848,10 @@ static int hdlcdev_open(struct net_device *dev)
7844 spin_lock_irqsave(&info->irq_spinlock, flags); 7848 spin_lock_irqsave(&info->irq_spinlock, flags);
7845 usc_get_serial_signals(info); 7849 usc_get_serial_signals(info);
7846 spin_unlock_irqrestore(&info->irq_spinlock, flags); 7850 spin_unlock_irqrestore(&info->irq_spinlock, flags);
7847 hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev); 7851 if (info->serial_signals & SerialSignal_DCD)
7848 7852 netif_carrier_on(dev);
7853 else
7854 netif_carrier_off(dev);
7849 return 0; 7855 return 0;
7850} 7856}
7851 7857
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index e829594195c1..b2dbbdb1bf81 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1497,8 +1497,10 @@ static int hdlcdev_open(struct net_device *dev)
1497 spin_lock_irqsave(&info->lock, flags); 1497 spin_lock_irqsave(&info->lock, flags);
1498 get_signals(info); 1498 get_signals(info);
1499 spin_unlock_irqrestore(&info->lock, flags); 1499 spin_unlock_irqrestore(&info->lock, flags);
1500 hdlc_set_carrier(info->signals & SerialSignal_DCD, dev); 1500 if (info->signals & SerialSignal_DCD)
1501 1501 netif_carrier_on(dev);
1502 else
1503 netif_carrier_off(dev);
1502 return 0; 1504 return 0;
1503} 1505}
1504 1506
@@ -1997,8 +1999,12 @@ static void dcd_change(struct slgt_info *info)
1997 info->input_signal_events.dcd_down++; 1999 info->input_signal_events.dcd_down++;
1998 } 2000 }
1999#ifdef CONFIG_HDLC 2001#ifdef CONFIG_HDLC
2000 if (info->netcount) 2002 if (info->netcount) {
2001 hdlc_set_carrier(info->signals & SerialSignal_DCD, info->netdev); 2003 if (info->signals & SerialSignal_DCD)
2004 netif_carrier_on(info->netdev);
2005 else
2006 netif_carrier_off(info->netdev);
2007 }
2002#endif 2008#endif
2003 wake_up_interruptible(&info->status_event_wait_q); 2009 wake_up_interruptible(&info->status_event_wait_q);
2004 wake_up_interruptible(&info->event_wait_q); 2010 wake_up_interruptible(&info->event_wait_q);
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 1e443a233f51..66f3754fbbdf 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1752,8 +1752,10 @@ static int hdlcdev_open(struct net_device *dev)
1752 spin_lock_irqsave(&info->lock, flags); 1752 spin_lock_irqsave(&info->lock, flags);
1753 get_signals(info); 1753 get_signals(info);
1754 spin_unlock_irqrestore(&info->lock, flags); 1754 spin_unlock_irqrestore(&info->lock, flags);
1755 hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev); 1755 if (info->serial_signals & SerialSignal_DCD)
1756 1756 netif_carrier_on(dev);
1757 else
1758 netif_carrier_off(dev);
1757 return 0; 1759 return 0;
1758} 1760}
1759 1761
@@ -2522,8 +2524,12 @@ void isr_io_pin( SLMP_INFO *info, u16 status )
2522 } else 2524 } else
2523 info->input_signal_events.dcd_down++; 2525 info->input_signal_events.dcd_down++;
2524#ifdef CONFIG_HDLC 2526#ifdef CONFIG_HDLC
2525 if (info->netcount) 2527 if (info->netcount) {
2526 hdlc_set_carrier(status & SerialSignal_DCD, info->netdev); 2528 if (status & SerialSignal_DCD)
2529 netif_carrier_on(info->netdev);
2530 else
2531 netif_carrier_off(info->netdev);
2532 }
2527#endif 2533#endif
2528 } 2534 }
2529 if (status & MISCSTATUS_CTS_LATCHED) 2535 if (status & MISCSTATUS_CTS_LATCHED)
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 6889e7db3aff..a082a2e34252 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1141,6 +1141,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1141 put_device(dev); 1141 put_device(dev);
1142 clear_bit(chip->dev_num, dev_mask); 1142 clear_bit(chip->dev_num, dev_mask);
1143 kfree(chip); 1143 kfree(chip);
1144 kfree(devname);
1144 return NULL; 1145 return NULL;
1145 } 1146 }
1146 1147
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 3232b1932597..ee7ac6f43c65 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -424,6 +424,7 @@ static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs)
424 iowrite32(interrupt, 424 iowrite32(interrupt,
425 chip->vendor.iobase + 425 chip->vendor.iobase +
426 TPM_INT_STATUS(chip->vendor.locality)); 426 TPM_INT_STATUS(chip->vendor.locality));
427 ioread32(chip->vendor.iobase + TPM_INT_STATUS(chip->vendor.locality));
427 return IRQ_HANDLED; 428 return IRQ_HANDLED;
428} 429}
429 430
@@ -431,23 +432,19 @@ static int interrupts = 1;
431module_param(interrupts, bool, 0444); 432module_param(interrupts, bool, 0444);
432MODULE_PARM_DESC(interrupts, "Enable interrupts"); 433MODULE_PARM_DESC(interrupts, "Enable interrupts");
433 434
434static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, 435static int tpm_tis_init(struct device *dev, resource_size_t start,
435 const struct pnp_device_id *pnp_id) 436 resource_size_t len)
436{ 437{
437 u32 vendor, intfcaps, intmask; 438 u32 vendor, intfcaps, intmask;
438 int rc, i; 439 int rc, i;
439 unsigned long start, len;
440 struct tpm_chip *chip; 440 struct tpm_chip *chip;
441 441
442 start = pnp_mem_start(pnp_dev, 0);
443 len = pnp_mem_len(pnp_dev, 0);
444
445 if (!start) 442 if (!start)
446 start = TIS_MEM_BASE; 443 start = TIS_MEM_BASE;
447 if (!len) 444 if (!len)
448 len = TIS_MEM_LEN; 445 len = TIS_MEM_LEN;
449 446
450 if (!(chip = tpm_register_hardware(&pnp_dev->dev, &tpm_tis))) 447 if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
451 return -ENODEV; 448 return -ENODEV;
452 449
453 chip->vendor.iobase = ioremap(start, len); 450 chip->vendor.iobase = ioremap(start, len);
@@ -464,7 +461,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
464 chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); 461 chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
465 chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); 462 chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
466 463
467 dev_info(&pnp_dev->dev, 464 dev_info(dev,
468 "1.2 TPM (device-id 0x%X, rev-id %d)\n", 465 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
469 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); 466 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
470 467
@@ -472,26 +469,26 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
472 intfcaps = 469 intfcaps =
473 ioread32(chip->vendor.iobase + 470 ioread32(chip->vendor.iobase +
474 TPM_INTF_CAPS(chip->vendor.locality)); 471 TPM_INTF_CAPS(chip->vendor.locality));
475 dev_dbg(&pnp_dev->dev, "TPM interface capabilities (0x%x):\n", 472 dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
476 intfcaps); 473 intfcaps);
477 if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) 474 if (intfcaps & TPM_INTF_BURST_COUNT_STATIC)
478 dev_dbg(&pnp_dev->dev, "\tBurst Count Static\n"); 475 dev_dbg(dev, "\tBurst Count Static\n");
479 if (intfcaps & TPM_INTF_CMD_READY_INT) 476 if (intfcaps & TPM_INTF_CMD_READY_INT)
480 dev_dbg(&pnp_dev->dev, "\tCommand Ready Int Support\n"); 477 dev_dbg(dev, "\tCommand Ready Int Support\n");
481 if (intfcaps & TPM_INTF_INT_EDGE_FALLING) 478 if (intfcaps & TPM_INTF_INT_EDGE_FALLING)
482 dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Falling\n"); 479 dev_dbg(dev, "\tInterrupt Edge Falling\n");
483 if (intfcaps & TPM_INTF_INT_EDGE_RISING) 480 if (intfcaps & TPM_INTF_INT_EDGE_RISING)
484 dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Rising\n"); 481 dev_dbg(dev, "\tInterrupt Edge Rising\n");
485 if (intfcaps & TPM_INTF_INT_LEVEL_LOW) 482 if (intfcaps & TPM_INTF_INT_LEVEL_LOW)
486 dev_dbg(&pnp_dev->dev, "\tInterrupt Level Low\n"); 483 dev_dbg(dev, "\tInterrupt Level Low\n");
487 if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) 484 if (intfcaps & TPM_INTF_INT_LEVEL_HIGH)
488 dev_dbg(&pnp_dev->dev, "\tInterrupt Level High\n"); 485 dev_dbg(dev, "\tInterrupt Level High\n");
489 if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) 486 if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT)
490 dev_dbg(&pnp_dev->dev, "\tLocality Change Int Support\n"); 487 dev_dbg(dev, "\tLocality Change Int Support\n");
491 if (intfcaps & TPM_INTF_STS_VALID_INT) 488 if (intfcaps & TPM_INTF_STS_VALID_INT)
492 dev_dbg(&pnp_dev->dev, "\tSts Valid Int Support\n"); 489 dev_dbg(dev, "\tSts Valid Int Support\n");
493 if (intfcaps & TPM_INTF_DATA_AVAIL_INT) 490 if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
494 dev_dbg(&pnp_dev->dev, "\tData Avail Int Support\n"); 491 dev_dbg(dev, "\tData Avail Int Support\n");
495 492
496 if (request_locality(chip, 0) != 0) { 493 if (request_locality(chip, 0) != 0) {
497 rc = -ENODEV; 494 rc = -ENODEV;
@@ -594,6 +591,16 @@ out_err:
594 return rc; 591 return rc;
595} 592}
596 593
594static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
595 const struct pnp_device_id *pnp_id)
596{
597 resource_size_t start, len;
598 start = pnp_mem_start(pnp_dev, 0);
599 len = pnp_mem_len(pnp_dev, 0);
600
601 return tpm_tis_init(&pnp_dev->dev, start, len);
602}
603
597static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) 604static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
598{ 605{
599 return tpm_pm_suspend(&dev->dev, msg); 606 return tpm_pm_suspend(&dev->dev, msg);
@@ -628,8 +635,36 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
628 sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); 635 sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
629MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); 636MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
630 637
638static struct device_driver tis_drv = {
639 .name = "tpm_tis",
640 .bus = &platform_bus_type,
641 .owner = THIS_MODULE,
642 .suspend = tpm_pm_suspend,
643 .resume = tpm_pm_resume,
644};
645
646static struct platform_device *pdev;
647
648static int force;
649module_param(force, bool, 0444);
650MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
631static int __init init_tis(void) 651static int __init init_tis(void)
632{ 652{
653 int rc;
654
655 if (force) {
656 rc = driver_register(&tis_drv);
657 if (rc < 0)
658 return rc;
659 if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
660 return PTR_ERR(pdev);
661 if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) {
662 platform_device_unregister(pdev);
663 driver_unregister(&tis_drv);
664 }
665 return rc;
666 }
667
633 return pnp_register_driver(&tis_pnp_driver); 668 return pnp_register_driver(&tis_pnp_driver);
634} 669}
635 670
@@ -654,7 +689,11 @@ static void __exit cleanup_tis(void)
654 tpm_remove_hardware(chip->dev); 689 tpm_remove_hardware(chip->dev);
655 } 690 }
656 spin_unlock(&tis_lock); 691 spin_unlock(&tis_lock);
657 pnp_unregister_driver(&tis_pnp_driver); 692 if (force) {
693 platform_device_unregister(pdev);
694 driver_unregister(&tis_drv);
695 } else
696 pnp_unregister_driver(&tis_pnp_driver);
658} 697}
659 698
660module_init(init_tis); 699module_init(init_tis);
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index 1b9b1f1d4c49..8116a47b80f4 100644
--- a/drivers/char/vr41xx_giu.c
+++ b/drivers/char/vr41xx_giu.c
@@ -33,6 +33,7 @@
33#include <asm/cpu.h> 33#include <asm/cpu.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/vr41xx/giu.h> 35#include <asm/vr41xx/giu.h>
36#include <asm/vr41xx/irq.h>
36#include <asm/vr41xx/vr41xx.h> 37#include <asm/vr41xx/vr41xx.h>
37 38
38MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); 39MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>");