diff options
Diffstat (limited to 'drivers')
236 files changed, 4433 insertions, 1396 deletions
diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c index 2b850e5860a0..e26f007a1417 100644 --- a/drivers/acorn/char/pcf8583.c +++ b/drivers/acorn/char/pcf8583.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * | 9 | * |
10 | * Driver for PCF8583 RTC & RAM chip | 10 | * Driver for PCF8583 RTC & RAM chip |
11 | */ | 11 | */ |
12 | #include <linux/module.h> | ||
12 | #include <linux/i2c.h> | 13 | #include <linux/i2c.h> |
13 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
14 | #include <linux/string.h> | 15 | #include <linux/string.h> |
@@ -32,7 +33,8 @@ static struct i2c_client_address_data addr_data = { | |||
32 | .forces = forces, | 33 | .forces = forces, |
33 | }; | 34 | }; |
34 | 35 | ||
35 | #define DAT(x) ((unsigned int)(x->dev.driver_data)) | 36 | #define set_ctrl(x, v) i2c_set_clientdata(x, (void *)(unsigned int)(v)) |
37 | #define get_ctrl(x) ((unsigned int)i2c_get_clientdata(x)) | ||
36 | 38 | ||
37 | static int | 39 | static int |
38 | pcf8583_attach(struct i2c_adapter *adap, int addr, int kind) | 40 | pcf8583_attach(struct i2c_adapter *adap, int addr, int kind) |
@@ -40,8 +42,17 @@ pcf8583_attach(struct i2c_adapter *adap, int addr, int kind) | |||
40 | struct i2c_client *c; | 42 | struct i2c_client *c; |
41 | unsigned char buf[1], ad[1] = { 0 }; | 43 | unsigned char buf[1], ad[1] = { 0 }; |
42 | struct i2c_msg msgs[2] = { | 44 | struct i2c_msg msgs[2] = { |
43 | { addr, 0, 1, ad }, | 45 | { |
44 | { addr, I2C_M_RD, 1, buf } | 46 | .addr = addr, |
47 | .flags = 0, | ||
48 | .len = 1, | ||
49 | .buf = ad, | ||
50 | }, { | ||
51 | .addr = addr, | ||
52 | .flags = I2C_M_RD, | ||
53 | .len = 1, | ||
54 | .buf = buf, | ||
55 | } | ||
45 | }; | 56 | }; |
46 | 57 | ||
47 | c = kmalloc(sizeof(*c), GFP_KERNEL); | 58 | c = kmalloc(sizeof(*c), GFP_KERNEL); |
@@ -54,7 +65,7 @@ pcf8583_attach(struct i2c_adapter *adap, int addr, int kind) | |||
54 | c->driver = &pcf8583_driver; | 65 | c->driver = &pcf8583_driver; |
55 | 66 | ||
56 | if (i2c_transfer(c->adapter, msgs, 2) == 2) | 67 | if (i2c_transfer(c->adapter, msgs, 2) == 2) |
57 | DAT(c) = buf[0]; | 68 | set_ctrl(c, buf[0]); |
58 | 69 | ||
59 | return i2c_attach_client(c); | 70 | return i2c_attach_client(c); |
60 | } | 71 | } |
@@ -78,8 +89,17 @@ pcf8583_get_datetime(struct i2c_client *client, struct rtc_tm *dt) | |||
78 | { | 89 | { |
79 | unsigned char buf[8], addr[1] = { 1 }; | 90 | unsigned char buf[8], addr[1] = { 1 }; |
80 | struct i2c_msg msgs[2] = { | 91 | struct i2c_msg msgs[2] = { |
81 | { client->addr, 0, 1, addr }, | 92 | { |
82 | { client->addr, I2C_M_RD, 6, buf } | 93 | .addr = client->addr, |
94 | .flags = 0, | ||
95 | .len = 1, | ||
96 | .buf = addr, | ||
97 | }, { | ||
98 | .addr = client->addr, | ||
99 | .flags = I2C_M_RD, | ||
100 | .len = 6, | ||
101 | .buf = buf, | ||
102 | } | ||
83 | }; | 103 | }; |
84 | int ret = -EIO; | 104 | int ret = -EIO; |
85 | 105 | ||
@@ -113,7 +133,7 @@ pcf8583_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) | |||
113 | int ret, len = 6; | 133 | int ret, len = 6; |
114 | 134 | ||
115 | buf[0] = 0; | 135 | buf[0] = 0; |
116 | buf[1] = DAT(client) | 0x80; | 136 | buf[1] = get_ctrl(client) | 0x80; |
117 | buf[2] = BIN_TO_BCD(dt->cs); | 137 | buf[2] = BIN_TO_BCD(dt->cs); |
118 | buf[3] = BIN_TO_BCD(dt->secs); | 138 | buf[3] = BIN_TO_BCD(dt->secs); |
119 | buf[4] = BIN_TO_BCD(dt->mins); | 139 | buf[4] = BIN_TO_BCD(dt->mins); |
@@ -129,7 +149,7 @@ pcf8583_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) | |||
129 | if (ret == len) | 149 | if (ret == len) |
130 | ret = 0; | 150 | ret = 0; |
131 | 151 | ||
132 | buf[1] = DAT(client); | 152 | buf[1] = get_ctrl(client); |
133 | i2c_master_send(client, (char *)buf, 2); | 153 | i2c_master_send(client, (char *)buf, 2); |
134 | 154 | ||
135 | return ret; | 155 | return ret; |
@@ -138,7 +158,7 @@ pcf8583_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) | |||
138 | static int | 158 | static int |
139 | pcf8583_get_ctrl(struct i2c_client *client, unsigned char *ctrl) | 159 | pcf8583_get_ctrl(struct i2c_client *client, unsigned char *ctrl) |
140 | { | 160 | { |
141 | *ctrl = DAT(client); | 161 | *ctrl = get_ctrl(client); |
142 | return 0; | 162 | return 0; |
143 | } | 163 | } |
144 | 164 | ||
@@ -149,7 +169,7 @@ pcf8583_set_ctrl(struct i2c_client *client, unsigned char *ctrl) | |||
149 | 169 | ||
150 | buf[0] = 0; | 170 | buf[0] = 0; |
151 | buf[1] = *ctrl; | 171 | buf[1] = *ctrl; |
152 | DAT(client) = *ctrl; | 172 | set_ctrl(client, *ctrl); |
153 | 173 | ||
154 | return i2c_master_send(client, (char *)buf, 2); | 174 | return i2c_master_send(client, (char *)buf, 2); |
155 | } | 175 | } |
@@ -159,15 +179,23 @@ pcf8583_read_mem(struct i2c_client *client, struct mem *mem) | |||
159 | { | 179 | { |
160 | unsigned char addr[1]; | 180 | unsigned char addr[1]; |
161 | struct i2c_msg msgs[2] = { | 181 | struct i2c_msg msgs[2] = { |
162 | { client->addr, 0, 1, addr }, | 182 | { |
163 | { client->addr, I2C_M_RD, 0, mem->data } | 183 | .addr = client->addr, |
184 | .flags = 0, | ||
185 | .len = 1, | ||
186 | .buf = addr, | ||
187 | }, { | ||
188 | .addr = client->addr, | ||
189 | .flags = I2C_M_RD, | ||
190 | .len = mem->nr, | ||
191 | .buf = mem->data, | ||
192 | } | ||
164 | }; | 193 | }; |
165 | 194 | ||
166 | if (mem->loc < 8) | 195 | if (mem->loc < 8) |
167 | return -EINVAL; | 196 | return -EINVAL; |
168 | 197 | ||
169 | addr[0] = mem->loc; | 198 | addr[0] = mem->loc; |
170 | msgs[1].len = mem->nr; | ||
171 | 199 | ||
172 | return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; | 200 | return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; |
173 | } | 201 | } |
@@ -177,15 +205,23 @@ pcf8583_write_mem(struct i2c_client *client, struct mem *mem) | |||
177 | { | 205 | { |
178 | unsigned char addr[1]; | 206 | unsigned char addr[1]; |
179 | struct i2c_msg msgs[2] = { | 207 | struct i2c_msg msgs[2] = { |
180 | { client->addr, 0, 1, addr }, | 208 | { |
181 | { client->addr, 0, 0, mem->data } | 209 | .addr = client->addr, |
210 | .flags = 0, | ||
211 | .len = 1, | ||
212 | .buf = addr, | ||
213 | }, { | ||
214 | .addr = client->addr, | ||
215 | .flags = I2C_M_NOSTART, | ||
216 | .len = mem->nr, | ||
217 | .buf = mem->data, | ||
218 | } | ||
182 | }; | 219 | }; |
183 | 220 | ||
184 | if (mem->loc < 8) | 221 | if (mem->loc < 8) |
185 | return -EINVAL; | 222 | return -EINVAL; |
186 | 223 | ||
187 | addr[0] = mem->loc; | 224 | addr[0] = mem->loc; |
188 | msgs[1].len = mem->nr; | ||
189 | 225 | ||
190 | return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; | 226 | return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; |
191 | } | 227 | } |
@@ -234,4 +270,14 @@ static __init int pcf8583_init(void) | |||
234 | return i2c_add_driver(&pcf8583_driver); | 270 | return i2c_add_driver(&pcf8583_driver); |
235 | } | 271 | } |
236 | 272 | ||
237 | __initcall(pcf8583_init); | 273 | static __exit void pcf8583_exit(void) |
274 | { | ||
275 | i2c_del_driver(&pcf8583_driver); | ||
276 | } | ||
277 | |||
278 | module_init(pcf8583_init); | ||
279 | module_exit(pcf8583_exit); | ||
280 | |||
281 | MODULE_AUTHOR("Russell King"); | ||
282 | MODULE_DESCRIPTION("PCF8583 I2C RTC driver"); | ||
283 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 26a3a4016115..161db4acfb91 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/acpi.h> | 37 | #include <linux/acpi.h> |
38 | #include <linux/dmi.h> | 38 | #include <linux/dmi.h> |
39 | #include <linux/moduleparam.h> | 39 | #include <linux/moduleparam.h> |
40 | #include <linux/sched.h> /* need_resched() */ | ||
40 | 41 | ||
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index aee50b453265..930427fc0c4b 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -158,7 +158,15 @@ int acpi_suspend(u32 acpi_state) | |||
158 | return -EINVAL; | 158 | return -EINVAL; |
159 | } | 159 | } |
160 | 160 | ||
161 | static int acpi_pm_state_valid(suspend_state_t pm_state) | ||
162 | { | ||
163 | u32 acpi_state = acpi_suspend_states[pm_state]; | ||
164 | |||
165 | return sleep_states[acpi_state]; | ||
166 | } | ||
167 | |||
161 | static struct pm_ops acpi_pm_ops = { | 168 | static struct pm_ops acpi_pm_ops = { |
169 | .valid = acpi_pm_state_valid, | ||
162 | .prepare = acpi_pm_prepare, | 170 | .prepare = acpi_pm_prepare, |
163 | .enter = acpi_pm_enter, | 171 | .enter = acpi_pm_enter, |
164 | .finish = acpi_pm_finish, | 172 | .finish = acpi_pm_finish, |
diff --git a/drivers/base/class.c b/drivers/base/class.c index c3e569730afe..db65fd0babe9 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/kdev_t.h> | 18 | #include <linux/kdev_t.h> |
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/slab.h> | ||
20 | #include "base.h" | 21 | #include "base.h" |
21 | 22 | ||
22 | #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) | 23 | #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 081c927b1ed8..a95844790f7b 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -16,6 +16,8 @@ struct sysdev_class cpu_sysdev_class = { | |||
16 | }; | 16 | }; |
17 | EXPORT_SYMBOL(cpu_sysdev_class); | 17 | EXPORT_SYMBOL(cpu_sysdev_class); |
18 | 18 | ||
19 | static struct sys_device *cpu_sys_devices[NR_CPUS]; | ||
20 | |||
19 | #ifdef CONFIG_HOTPLUG_CPU | 21 | #ifdef CONFIG_HOTPLUG_CPU |
20 | int __attribute__((weak)) smp_prepare_cpu (int cpu) | 22 | int __attribute__((weak)) smp_prepare_cpu (int cpu) |
21 | { | 23 | { |
@@ -64,6 +66,7 @@ static void __devinit register_cpu_control(struct cpu *cpu) | |||
64 | } | 66 | } |
65 | void unregister_cpu(struct cpu *cpu, struct node *root) | 67 | void unregister_cpu(struct cpu *cpu, struct node *root) |
66 | { | 68 | { |
69 | int logical_cpu = cpu->sysdev.id; | ||
67 | 70 | ||
68 | if (root) | 71 | if (root) |
69 | sysfs_remove_link(&root->sysdev.kobj, | 72 | sysfs_remove_link(&root->sysdev.kobj, |
@@ -71,7 +74,7 @@ void unregister_cpu(struct cpu *cpu, struct node *root) | |||
71 | sysdev_remove_file(&cpu->sysdev, &attr_online); | 74 | sysdev_remove_file(&cpu->sysdev, &attr_online); |
72 | 75 | ||
73 | sysdev_unregister(&cpu->sysdev); | 76 | sysdev_unregister(&cpu->sysdev); |
74 | 77 | cpu_sys_devices[logical_cpu] = NULL; | |
75 | return; | 78 | return; |
76 | } | 79 | } |
77 | #else /* ... !CONFIG_HOTPLUG_CPU */ | 80 | #else /* ... !CONFIG_HOTPLUG_CPU */ |
@@ -103,10 +106,19 @@ int __devinit register_cpu(struct cpu *cpu, int num, struct node *root) | |||
103 | kobject_name(&cpu->sysdev.kobj)); | 106 | kobject_name(&cpu->sysdev.kobj)); |
104 | if (!error && !cpu->no_control) | 107 | if (!error && !cpu->no_control) |
105 | register_cpu_control(cpu); | 108 | register_cpu_control(cpu); |
109 | if (!error) | ||
110 | cpu_sys_devices[num] = &cpu->sysdev; | ||
106 | return error; | 111 | return error; |
107 | } | 112 | } |
108 | 113 | ||
109 | 114 | struct sys_device *get_cpu_sysdev(int cpu) | |
115 | { | ||
116 | if (cpu < NR_CPUS) | ||
117 | return cpu_sys_devices[cpu]; | ||
118 | else | ||
119 | return NULL; | ||
120 | } | ||
121 | EXPORT_SYMBOL_GPL(get_cpu_sysdev); | ||
110 | 122 | ||
111 | int __init cpu_dev_init(void) | 123 | int __init cpu_dev_init(void) |
112 | { | 124 | { |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 4acb2c5733c3..98f6c02d6790 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -62,14 +62,16 @@ firmware_timeout_show(struct class *class, char *buf) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * firmware_timeout_store: | 65 | * firmware_timeout_store - set number of seconds to wait for firmware |
66 | * Description: | 66 | * @class: device class pointer |
67 | * @buf: buffer to scan for timeout value | ||
68 | * @count: number of bytes in @buf | ||
69 | * | ||
67 | * Sets the number of seconds to wait for the firmware. Once | 70 | * Sets the number of seconds to wait for the firmware. Once |
68 | * this expires an error will be return to the driver and no | 71 | * this expires an error will be returned to the driver and no |
69 | * firmware will be provided. | 72 | * firmware will be provided. |
70 | * | 73 | * |
71 | * Note: zero means 'wait for ever' | 74 | * Note: zero means 'wait forever'. |
72 | * | ||
73 | **/ | 75 | **/ |
74 | static ssize_t | 76 | static ssize_t |
75 | firmware_timeout_store(struct class *class, const char *buf, size_t count) | 77 | firmware_timeout_store(struct class *class, const char *buf, size_t count) |
@@ -123,12 +125,15 @@ firmware_loading_show(struct class_device *class_dev, char *buf) | |||
123 | } | 125 | } |
124 | 126 | ||
125 | /** | 127 | /** |
126 | * firmware_loading_store: - loading control file | 128 | * firmware_loading_store - set value in the 'loading' control file |
127 | * Description: | 129 | * @class_dev: class_device pointer |
130 | * @buf: buffer to scan for loading control value | ||
131 | * @count: number of bytes in @buf | ||
132 | * | ||
128 | * The relevant values are: | 133 | * The relevant values are: |
129 | * | 134 | * |
130 | * 1: Start a load, discarding any previous partial load. | 135 | * 1: Start a load, discarding any previous partial load. |
131 | * 0: Conclude the load and handle the data to the driver code. | 136 | * 0: Conclude the load and hand the data to the driver code. |
132 | * -1: Conclude the load with an error and discard any written data. | 137 | * -1: Conclude the load with an error and discard any written data. |
133 | **/ | 138 | **/ |
134 | static ssize_t | 139 | static ssize_t |
@@ -201,6 +206,7 @@ out: | |||
201 | up(&fw_lock); | 206 | up(&fw_lock); |
202 | return ret_count; | 207 | return ret_count; |
203 | } | 208 | } |
209 | |||
204 | static int | 210 | static int |
205 | fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) | 211 | fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) |
206 | { | 212 | { |
@@ -227,11 +233,13 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) | |||
227 | } | 233 | } |
228 | 234 | ||
229 | /** | 235 | /** |
230 | * firmware_data_write: | 236 | * firmware_data_write - write method for firmware |
237 | * @kobj: kobject for the class_device | ||
238 | * @buffer: buffer being written | ||
239 | * @offset: buffer offset for write in total data store area | ||
240 | * @count: buffer size | ||
231 | * | 241 | * |
232 | * Description: | 242 | * Data written to the 'data' attribute will be later handed to |
233 | * | ||
234 | * Data written to the 'data' attribute will be later handled to | ||
235 | * the driver as a firmware image. | 243 | * the driver as a firmware image. |
236 | **/ | 244 | **/ |
237 | static ssize_t | 245 | static ssize_t |
@@ -264,6 +272,7 @@ out: | |||
264 | up(&fw_lock); | 272 | up(&fw_lock); |
265 | return retval; | 273 | return retval; |
266 | } | 274 | } |
275 | |||
267 | static struct bin_attribute firmware_attr_data_tmpl = { | 276 | static struct bin_attribute firmware_attr_data_tmpl = { |
268 | .attr = {.name = "data", .mode = 0644, .owner = THIS_MODULE}, | 277 | .attr = {.name = "data", .mode = 0644, .owner = THIS_MODULE}, |
269 | .size = 0, | 278 | .size = 0, |
@@ -448,13 +457,16 @@ out: | |||
448 | 457 | ||
449 | /** | 458 | /** |
450 | * request_firmware: - request firmware to hotplug and wait for it | 459 | * request_firmware: - request firmware to hotplug and wait for it |
451 | * Description: | 460 | * @firmware_p: pointer to firmware image |
452 | * @firmware will be used to return a firmware image by the name | 461 | * @name: name of firmware file |
462 | * @device: device for which firmware is being loaded | ||
463 | * | ||
464 | * @firmware_p will be used to return a firmware image by the name | ||
453 | * of @name for device @device. | 465 | * of @name for device @device. |
454 | * | 466 | * |
455 | * Should be called from user context where sleeping is allowed. | 467 | * Should be called from user context where sleeping is allowed. |
456 | * | 468 | * |
457 | * @name will be use as $FIRMWARE in the hotplug environment and | 469 | * @name will be used as $FIRMWARE in the hotplug environment and |
458 | * should be distinctive enough not to be confused with any other | 470 | * should be distinctive enough not to be confused with any other |
459 | * firmware image for this or any other device. | 471 | * firmware image for this or any other device. |
460 | **/ | 472 | **/ |
@@ -468,6 +480,7 @@ request_firmware(const struct firmware **firmware_p, const char *name, | |||
468 | 480 | ||
469 | /** | 481 | /** |
470 | * release_firmware: - release the resource associated with a firmware image | 482 | * release_firmware: - release the resource associated with a firmware image |
483 | * @fw: firmware resource to release | ||
471 | **/ | 484 | **/ |
472 | void | 485 | void |
473 | release_firmware(const struct firmware *fw) | 486 | release_firmware(const struct firmware *fw) |
@@ -480,8 +493,10 @@ release_firmware(const struct firmware *fw) | |||
480 | 493 | ||
481 | /** | 494 | /** |
482 | * register_firmware: - provide a firmware image for later usage | 495 | * register_firmware: - provide a firmware image for later usage |
496 | * @name: name of firmware image file | ||
497 | * @data: buffer pointer for the firmware image | ||
498 | * @size: size of the data buffer area | ||
483 | * | 499 | * |
484 | * Description: | ||
485 | * Make sure that @data will be available by requesting firmware @name. | 500 | * Make sure that @data will be available by requesting firmware @name. |
486 | * | 501 | * |
487 | * Note: This will not be possible until some kind of persistence | 502 | * Note: This will not be possible until some kind of persistence |
@@ -526,21 +541,19 @@ request_firmware_work_func(void *arg) | |||
526 | } | 541 | } |
527 | 542 | ||
528 | /** | 543 | /** |
529 | * request_firmware_nowait: | 544 | * request_firmware_nowait: asynchronous version of request_firmware |
545 | * @module: module requesting the firmware | ||
546 | * @hotplug: invokes hotplug event to copy the firmware image if this flag | ||
547 | * is non-zero else the firmware copy must be done manually. | ||
548 | * @name: name of firmware file | ||
549 | * @device: device for which firmware is being loaded | ||
550 | * @context: will be passed over to @cont, and | ||
551 | * @fw may be %NULL if firmware request fails. | ||
552 | * @cont: function will be called asynchronously when the firmware | ||
553 | * request is over. | ||
530 | * | 554 | * |
531 | * Description: | ||
532 | * Asynchronous variant of request_firmware() for contexts where | 555 | * Asynchronous variant of request_firmware() for contexts where |
533 | * it is not possible to sleep. | 556 | * it is not possible to sleep. |
534 | * | ||
535 | * @hotplug invokes hotplug event to copy the firmware image if this flag | ||
536 | * is non-zero else the firmware copy must be done manually. | ||
537 | * | ||
538 | * @cont will be called asynchronously when the firmware request is over. | ||
539 | * | ||
540 | * @context will be passed over to @cont. | ||
541 | * | ||
542 | * @fw may be %NULL if firmware request fails. | ||
543 | * | ||
544 | **/ | 557 | **/ |
545 | int | 558 | int |
546 | request_firmware_nowait( | 559 | request_firmware_nowait( |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 75ce8711bca5..08d9cc99c7de 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
17 | #include <linux/bootmem.h> | 17 | #include <linux/bootmem.h> |
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/slab.h> | ||
19 | 20 | ||
20 | #include "base.h" | 21 | #include "base.h" |
21 | 22 | ||
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 3431eb6004c3..66ed8f2fece5 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
24 | #include <asm/semaphore.h> | ||
24 | 25 | ||
25 | extern struct subsystem devices_subsys; | 26 | extern struct subsystem devices_subsys; |
26 | 27 | ||
diff --git a/drivers/block/Kconfig.iosched b/drivers/block/Kconfig.iosched index 6070a480600b..5b90d2fa63b8 100644 --- a/drivers/block/Kconfig.iosched +++ b/drivers/block/Kconfig.iosched | |||
@@ -38,4 +38,32 @@ config IOSCHED_CFQ | |||
38 | among all processes in the system. It should provide a fair | 38 | among all processes in the system. It should provide a fair |
39 | working environment, suitable for desktop systems. | 39 | working environment, suitable for desktop systems. |
40 | 40 | ||
41 | choice | ||
42 | prompt "Default I/O scheduler" | ||
43 | default DEFAULT_AS | ||
44 | help | ||
45 | Select the I/O scheduler which will be used by default for all | ||
46 | block devices. | ||
47 | |||
48 | config DEFAULT_AS | ||
49 | bool "Anticipatory" if IOSCHED_AS | ||
50 | |||
51 | config DEFAULT_DEADLINE | ||
52 | bool "Deadline" if IOSCHED_DEADLINE | ||
53 | |||
54 | config DEFAULT_CFQ | ||
55 | bool "CFQ" if IOSCHED_CFQ | ||
56 | |||
57 | config DEFAULT_NOOP | ||
58 | bool "No-op" | ||
59 | |||
60 | endchoice | ||
61 | |||
62 | config DEFAULT_IOSCHED | ||
63 | string | ||
64 | default "anticipatory" if DEFAULT_AS | ||
65 | default "deadline" if DEFAULT_DEADLINE | ||
66 | default "cfq" if DEFAULT_CFQ | ||
67 | default "noop" if DEFAULT_NOOP | ||
68 | |||
41 | endmenu | 69 | endmenu |
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c index 564172234819..c6744ff38294 100644 --- a/drivers/block/as-iosched.c +++ b/drivers/block/as-iosched.c | |||
@@ -1973,8 +1973,8 @@ static int __init as_init(void) | |||
1973 | 1973 | ||
1974 | static void __exit as_exit(void) | 1974 | static void __exit as_exit(void) |
1975 | { | 1975 | { |
1976 | kmem_cache_destroy(arq_pool); | ||
1977 | elv_unregister(&iosched_as); | 1976 | elv_unregister(&iosched_as); |
1977 | kmem_cache_destroy(arq_pool); | ||
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | module_init(as_init); | 1980 | module_init(as_init); |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index e183a3ef7839..ec27976a57da 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -28,13 +28,17 @@ | |||
28 | through the array controller. Note in particular, neither | 28 | through the array controller. Note in particular, neither |
29 | physical nor logical disks are presented through the scsi layer. */ | 29 | physical nor logical disks are presented through the scsi layer. */ |
30 | 30 | ||
31 | #include <linux/timer.h> | ||
32 | #include <linux/completion.h> | ||
33 | #include <linux/slab.h> | ||
34 | #include <linux/string.h> | ||
35 | |||
36 | #include <asm/atomic.h> | ||
37 | |||
31 | #include <scsi/scsi.h> | 38 | #include <scsi/scsi.h> |
32 | #include <scsi/scsi_cmnd.h> | 39 | #include <scsi/scsi_cmnd.h> |
33 | #include <scsi/scsi_device.h> | 40 | #include <scsi/scsi_device.h> |
34 | #include <scsi/scsi_host.h> | 41 | #include <scsi/scsi_host.h> |
35 | #include <asm/atomic.h> | ||
36 | #include <linux/timer.h> | ||
37 | #include <linux/completion.h> | ||
38 | 42 | ||
39 | #include "cciss_scsi.h" | 43 | #include "cciss_scsi.h" |
40 | 44 | ||
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c index 94690e4d41e0..5281f8e70510 100644 --- a/drivers/block/cfq-iosched.c +++ b/drivers/block/cfq-iosched.c | |||
@@ -2418,28 +2418,8 @@ static int __init cfq_init(void) | |||
2418 | 2418 | ||
2419 | static void __exit cfq_exit(void) | 2419 | static void __exit cfq_exit(void) |
2420 | { | 2420 | { |
2421 | struct task_struct *g, *p; | ||
2422 | unsigned long flags; | ||
2423 | |||
2424 | read_lock_irqsave(&tasklist_lock, flags); | ||
2425 | |||
2426 | /* | ||
2427 | * iterate each process in the system, removing our io_context | ||
2428 | */ | ||
2429 | do_each_thread(g, p) { | ||
2430 | struct io_context *ioc = p->io_context; | ||
2431 | |||
2432 | if (ioc && ioc->cic) { | ||
2433 | ioc->cic->exit(ioc->cic); | ||
2434 | cfq_free_io_context(ioc->cic); | ||
2435 | ioc->cic = NULL; | ||
2436 | } | ||
2437 | } while_each_thread(g, p); | ||
2438 | |||
2439 | read_unlock_irqrestore(&tasklist_lock, flags); | ||
2440 | |||
2441 | cfq_slab_kill(); | ||
2442 | elv_unregister(&iosched_cfq); | 2421 | elv_unregister(&iosched_cfq); |
2422 | cfq_slab_kill(); | ||
2443 | } | 2423 | } |
2444 | 2424 | ||
2445 | module_init(cfq_init); | 2425 | module_init(cfq_init); |
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 55621d5c5774..36f1057084b0 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c | |||
@@ -147,24 +147,17 @@ static void elevator_setup_default(void) | |||
147 | struct elevator_type *e; | 147 | struct elevator_type *e; |
148 | 148 | ||
149 | /* | 149 | /* |
150 | * check if default is set and exists | 150 | * If default has not been set, use the compiled-in selection. |
151 | */ | 151 | */ |
152 | if (chosen_elevator[0] && (e = elevator_get(chosen_elevator))) { | 152 | if (!chosen_elevator[0]) |
153 | elevator_put(e); | 153 | strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED); |
154 | return; | ||
155 | } | ||
156 | 154 | ||
157 | #if defined(CONFIG_IOSCHED_AS) | 155 | /* |
158 | strcpy(chosen_elevator, "anticipatory"); | 156 | * If the given scheduler is not available, fall back to no-op. |
159 | #elif defined(CONFIG_IOSCHED_DEADLINE) | 157 | */ |
160 | strcpy(chosen_elevator, "deadline"); | 158 | if (!(e = elevator_find(chosen_elevator))) |
161 | #elif defined(CONFIG_IOSCHED_CFQ) | 159 | strcpy(chosen_elevator, "noop"); |
162 | strcpy(chosen_elevator, "cfq"); | 160 | elevator_put(e); |
163 | #elif defined(CONFIG_IOSCHED_NOOP) | ||
164 | strcpy(chosen_elevator, "noop"); | ||
165 | #else | ||
166 | #error "You must build at least 1 IO scheduler into the kernel" | ||
167 | #endif | ||
168 | } | 161 | } |
169 | 162 | ||
170 | static int __init elevator_setup(char *str) | 163 | static int __init elevator_setup(char *str) |
@@ -642,6 +635,27 @@ EXPORT_SYMBOL_GPL(elv_register); | |||
642 | 635 | ||
643 | void elv_unregister(struct elevator_type *e) | 636 | void elv_unregister(struct elevator_type *e) |
644 | { | 637 | { |
638 | struct task_struct *g, *p; | ||
639 | |||
640 | /* | ||
641 | * Iterate every thread in the process to remove the io contexts. | ||
642 | */ | ||
643 | read_lock(&tasklist_lock); | ||
644 | do_each_thread(g, p) { | ||
645 | struct io_context *ioc = p->io_context; | ||
646 | if (ioc && ioc->cic) { | ||
647 | ioc->cic->exit(ioc->cic); | ||
648 | ioc->cic->dtor(ioc->cic); | ||
649 | ioc->cic = NULL; | ||
650 | } | ||
651 | if (ioc && ioc->aic) { | ||
652 | ioc->aic->exit(ioc->aic); | ||
653 | ioc->aic->dtor(ioc->aic); | ||
654 | ioc->aic = NULL; | ||
655 | } | ||
656 | } while_each_thread(g, p); | ||
657 | read_unlock(&tasklist_lock); | ||
658 | |||
645 | spin_lock_irq(&elv_list_lock); | 659 | spin_lock_irq(&elv_list_lock); |
646 | list_del_init(&e->list); | 660 | list_del_init(&e->list); |
647 | spin_unlock_irq(&elv_list_lock); | 661 | spin_unlock_irq(&elv_list_lock); |
@@ -739,8 +753,10 @@ ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count) | |||
739 | return -EINVAL; | 753 | return -EINVAL; |
740 | } | 754 | } |
741 | 755 | ||
742 | if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) | 756 | if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) { |
757 | elevator_put(e); | ||
743 | return count; | 758 | return count; |
759 | } | ||
744 | 760 | ||
745 | elevator_switch(q, e); | 761 | elevator_switch(q, e); |
746 | return count; | 762 | return count; |
diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c index 1fef136c0e41..ce94aa11f6a7 100644 --- a/drivers/block/paride/paride.c +++ b/drivers/block/paride/paride.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | #include <linux/sched.h> /* TASK_* */ | ||
32 | 33 | ||
33 | #ifdef CONFIG_PARPORT_MODULE | 34 | #ifdef CONFIG_PARPORT_MODULE |
34 | #define CONFIG_PARPORT | 35 | #define CONFIG_PARPORT |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 94af920465b5..e9746af29b9f 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -807,10 +807,6 @@ static int pf_next_buf(void) | |||
807 | return 1; | 807 | return 1; |
808 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 808 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
809 | pf_end_request(1); | 809 | pf_end_request(1); |
810 | if (pf_req) { | ||
811 | pf_count = pf_req->current_nr_sectors; | ||
812 | pf_buf = pf_req->buffer; | ||
813 | } | ||
814 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 810 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); |
815 | return 1; | 811 | return 1; |
816 | } | 812 | } |
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 82f2d6d2eeef..6f5df0fad703 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -162,6 +162,8 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; | |||
162 | #include <linux/mtio.h> | 162 | #include <linux/mtio.h> |
163 | #include <linux/pg.h> | 163 | #include <linux/pg.h> |
164 | #include <linux/device.h> | 164 | #include <linux/device.h> |
165 | #include <linux/sched.h> /* current, TASK_* */ | ||
166 | #include <linux/jiffies.h> | ||
165 | 167 | ||
166 | #include <asm/uaccess.h> | 168 | #include <asm/uaccess.h> |
167 | 169 | ||
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 686c95573452..715ae5dc88fb 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
@@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3}; | |||
146 | #include <linux/slab.h> | 146 | #include <linux/slab.h> |
147 | #include <linux/mtio.h> | 147 | #include <linux/mtio.h> |
148 | #include <linux/device.h> | 148 | #include <linux/device.h> |
149 | #include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ | ||
149 | 150 | ||
150 | #include <asm/uaccess.h> | 151 | #include <asm/uaccess.h> |
151 | 152 | ||
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index e46ecd23b3ac..709f809f79f1 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -778,13 +778,16 @@ static struct vio_device_id viodasd_device_table[] __devinitdata = { | |||
778 | { "viodasd", "" }, | 778 | { "viodasd", "" }, |
779 | { "", "" } | 779 | { "", "" } |
780 | }; | 780 | }; |
781 | |||
782 | MODULE_DEVICE_TABLE(vio, viodasd_device_table); | 781 | MODULE_DEVICE_TABLE(vio, viodasd_device_table); |
782 | |||
783 | static struct vio_driver viodasd_driver = { | 783 | static struct vio_driver viodasd_driver = { |
784 | .name = "viodasd", | ||
785 | .id_table = viodasd_device_table, | 784 | .id_table = viodasd_device_table, |
786 | .probe = viodasd_probe, | 785 | .probe = viodasd_probe, |
787 | .remove = viodasd_remove | 786 | .remove = viodasd_remove, |
787 | .driver = { | ||
788 | .name = "viodasd", | ||
789 | .owner = THIS_MODULE, | ||
790 | } | ||
788 | }; | 791 | }; |
789 | 792 | ||
790 | /* | 793 | /* |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index 0829db58462f..36f31d202223 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -736,13 +736,16 @@ static struct vio_device_id viocd_device_table[] __devinitdata = { | |||
736 | { "viocd", "" }, | 736 | { "viocd", "" }, |
737 | { "", "" } | 737 | { "", "" } |
738 | }; | 738 | }; |
739 | |||
740 | MODULE_DEVICE_TABLE(vio, viocd_device_table); | 739 | MODULE_DEVICE_TABLE(vio, viocd_device_table); |
740 | |||
741 | static struct vio_driver viocd_driver = { | 741 | static struct vio_driver viocd_driver = { |
742 | .name = "viocd", | ||
743 | .id_table = viocd_device_table, | 742 | .id_table = viocd_device_table, |
744 | .probe = viocd_probe, | 743 | .probe = viocd_probe, |
745 | .remove = viocd_remove | 744 | .remove = viocd_remove, |
745 | .driver = { | ||
746 | .name = "viocd", | ||
747 | .owner = THIS_MODULE, | ||
748 | } | ||
746 | }; | 749 | }; |
747 | 750 | ||
748 | static int __init viocd_init(void) | 751 | static int __init viocd_init(void) |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index c29365d5b524..fdf4370db994 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -661,7 +661,7 @@ config HW_RANDOM | |||
661 | 661 | ||
662 | config NVRAM | 662 | config NVRAM |
663 | tristate "/dev/nvram support" | 663 | tristate "/dev/nvram support" |
664 | depends on ATARI || X86 || X86_64 || ARM || GENERIC_NVRAM | 664 | depends on ATARI || X86 || ARM || GENERIC_NVRAM |
665 | ---help--- | 665 | ---help--- |
666 | If you say Y here and create a character special file /dev/nvram | 666 | If you say Y here and create a character special file /dev/nvram |
667 | with major number 10 and minor number 144 using mknod ("man mknod"), | 667 | with major number 10 and minor number 144 using mknod ("man mknod"), |
@@ -985,7 +985,7 @@ config MAX_RAW_DEVS | |||
985 | 985 | ||
986 | config HANGCHECK_TIMER | 986 | config HANGCHECK_TIMER |
987 | tristate "Hangcheck timer" | 987 | tristate "Hangcheck timer" |
988 | depends on X86_64 || X86 || IA64 || PPC64 || ARCH_S390 | 988 | depends on X86 || IA64 || PPC64 || ARCH_S390 |
989 | help | 989 | help |
990 | The hangcheck-timer module detects when the system has gone | 990 | The hangcheck-timer module detects when the system has gone |
991 | out to lunch past a certain margin. It can reboot the system | 991 | out to lunch past a certain margin. It can reboot the system |
@@ -1001,5 +1001,17 @@ config MMTIMER | |||
1001 | 1001 | ||
1002 | source "drivers/char/tpm/Kconfig" | 1002 | source "drivers/char/tpm/Kconfig" |
1003 | 1003 | ||
1004 | config TELCLOCK | ||
1005 | tristate "Telecom clock driver for MPBL0010 ATCA SBC" | ||
1006 | depends on EXPERIMENTAL | ||
1007 | default n | ||
1008 | help | ||
1009 | The telecom clock device is specific to the MPBL0010 ATCA computer and | ||
1010 | allows direct userspace access to the configuration of the telecom clock | ||
1011 | configuration settings. This device is used for hardware synchronization | ||
1012 | across the ATCA backplane fabric. Upon loading, the driver exports a | ||
1013 | sysfs directory, /sys/devices/platform/telco_clock, with a number of | ||
1014 | files for controlling the behavior of this hardware. | ||
1015 | |||
1004 | endmenu | 1016 | endmenu |
1005 | 1017 | ||
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 08f69287ea36..4aeae687e88a 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -82,6 +82,7 @@ obj-$(CONFIG_NWFLASH) += nwflash.o | |||
82 | obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o | 82 | obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o |
83 | obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o | 83 | obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o |
84 | obj-$(CONFIG_TANBAC_TB0219) += tb0219.o | 84 | obj-$(CONFIG_TANBAC_TB0219) += tb0219.o |
85 | obj-$(CONFIG_TELCLOCK) += tlclk.o | ||
85 | 86 | ||
86 | obj-$(CONFIG_WATCHDOG) += watchdog/ | 87 | obj-$(CONFIG_WATCHDOG) += watchdog/ |
87 | obj-$(CONFIG_MWAVE) += mwave/ | 88 | obj-$(CONFIG_MWAVE) += mwave/ |
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index 7f8c1b53b754..486ed8a11b59 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -27,7 +27,7 @@ config AGP | |||
27 | 27 | ||
28 | config AGP_ALI | 28 | config AGP_ALI |
29 | tristate "ALI chipset support" | 29 | tristate "ALI chipset support" |
30 | depends on AGP && X86 && !X86_64 | 30 | depends on AGP && X86_32 |
31 | ---help--- | 31 | ---help--- |
32 | This option gives you AGP support for the GLX component of | 32 | This option gives you AGP support for the GLX component of |
33 | XFree86 4.x on the following ALi chipsets. The supported chipsets | 33 | XFree86 4.x on the following ALi chipsets. The supported chipsets |
@@ -45,7 +45,7 @@ config AGP_ALI | |||
45 | 45 | ||
46 | config AGP_ATI | 46 | config AGP_ATI |
47 | tristate "ATI chipset support" | 47 | tristate "ATI chipset support" |
48 | depends on AGP && X86 && !X86_64 | 48 | depends on AGP && X86_32 |
49 | ---help--- | 49 | ---help--- |
50 | This option gives you AGP support for the GLX component of | 50 | This option gives you AGP support for the GLX component of |
51 | XFree86 4.x on the ATI RadeonIGP family of chipsets. | 51 | XFree86 4.x on the ATI RadeonIGP family of chipsets. |
@@ -55,7 +55,7 @@ config AGP_ATI | |||
55 | 55 | ||
56 | config AGP_AMD | 56 | config AGP_AMD |
57 | tristate "AMD Irongate, 761, and 762 chipset support" | 57 | tristate "AMD Irongate, 761, and 762 chipset support" |
58 | depends on AGP && X86 && !X86_64 | 58 | depends on AGP && X86_32 |
59 | help | 59 | help |
60 | This option gives you AGP support for the GLX component of | 60 | This option gives you AGP support for the GLX component of |
61 | XFree86 4.x on AMD Irongate, 761, and 762 chipsets. | 61 | XFree86 4.x on AMD Irongate, 761, and 762 chipsets. |
@@ -91,7 +91,7 @@ config AGP_INTEL | |||
91 | 91 | ||
92 | config AGP_NVIDIA | 92 | config AGP_NVIDIA |
93 | tristate "NVIDIA nForce/nForce2 chipset support" | 93 | tristate "NVIDIA nForce/nForce2 chipset support" |
94 | depends on AGP && X86 && !X86_64 | 94 | depends on AGP && X86_32 |
95 | help | 95 | help |
96 | This option gives you AGP support for the GLX component of | 96 | This option gives you AGP support for the GLX component of |
97 | XFree86 4.x on the following NVIDIA chipsets. The supported chipsets | 97 | XFree86 4.x on the following NVIDIA chipsets. The supported chipsets |
@@ -99,7 +99,7 @@ config AGP_NVIDIA | |||
99 | 99 | ||
100 | config AGP_SIS | 100 | config AGP_SIS |
101 | tristate "SiS chipset support" | 101 | tristate "SiS chipset support" |
102 | depends on AGP && X86 && !X86_64 | 102 | depends on AGP && X86_32 |
103 | help | 103 | help |
104 | This option gives you AGP support for the GLX component of | 104 | This option gives you AGP support for the GLX component of |
105 | XFree86 4.x on Silicon Integrated Systems [SiS] chipsets. | 105 | XFree86 4.x on Silicon Integrated Systems [SiS] chipsets. |
@@ -111,14 +111,14 @@ config AGP_SIS | |||
111 | 111 | ||
112 | config AGP_SWORKS | 112 | config AGP_SWORKS |
113 | tristate "Serverworks LE/HE chipset support" | 113 | tristate "Serverworks LE/HE chipset support" |
114 | depends on AGP && X86 && !X86_64 | 114 | depends on AGP && X86_32 |
115 | help | 115 | help |
116 | Say Y here to support the Serverworks AGP card. See | 116 | Say Y here to support the Serverworks AGP card. See |
117 | <http://www.serverworks.com/> for product descriptions and images. | 117 | <http://www.serverworks.com/> for product descriptions and images. |
118 | 118 | ||
119 | config AGP_VIA | 119 | config AGP_VIA |
120 | tristate "VIA chipset support" | 120 | tristate "VIA chipset support" |
121 | depends on AGP && X86 && !X86_64 | 121 | depends on AGP && X86_32 |
122 | help | 122 | help |
123 | This option gives you AGP support for the GLX component of | 123 | This option gives you AGP support for the GLX component of |
124 | XFree86 4.x on VIA MVP3/Apollo Pro chipsets. | 124 | XFree86 4.x on VIA MVP3/Apollo Pro chipsets. |
@@ -154,7 +154,7 @@ config AGP_UNINORTH | |||
154 | 154 | ||
155 | config AGP_EFFICEON | 155 | config AGP_EFFICEON |
156 | tristate "Transmeta Efficeon support" | 156 | tristate "Transmeta Efficeon support" |
157 | depends on AGP && X86 && !X86_64 | 157 | depends on AGP && X86_32 |
158 | help | 158 | help |
159 | This option gives you AGP support for the Transmeta Efficeon | 159 | This option gives you AGP support for the Transmeta Efficeon |
160 | series processors with integrated northbridges. | 160 | series processors with integrated northbridges. |
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c index 9c9c9c2247ce..b02fc2267159 100644 --- a/drivers/char/agp/ali-agp.c +++ b/drivers/char/agp/ali-agp.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/agp_backend.h> | 9 | #include <linux/agp_backend.h> |
10 | #include <asm/page.h> /* PAGE_SIZE */ | ||
10 | #include "agp.h" | 11 | #include "agp.h" |
11 | 12 | ||
12 | #define ALI_AGPCTRL 0xb8 | 13 | #define ALI_AGPCTRL 0xb8 |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 0a7624a9b1c1..0e6c3a31d344 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/agp_backend.h> | 15 | #include <linux/agp_backend.h> |
16 | #include <asm/page.h> /* PAGE_SIZE */ | ||
16 | #include "agp.h" | 17 | #include "agp.h" |
17 | 18 | ||
18 | /* Will need to be increased if AMD64 ever goes >8-way. */ | 19 | /* Will need to be increased if AMD64 ever goes >8-way. */ |
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index e572ced9100a..0b6e72642d6e 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -6,6 +6,8 @@ | |||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/string.h> | ||
10 | #include <linux/slab.h> | ||
9 | #include <linux/agp_backend.h> | 11 | #include <linux/agp_backend.h> |
10 | #include <asm/agp.h> | 12 | #include <asm/agp.h> |
11 | #include "agp.h" | 13 | #include "agp.h" |
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c index 94943298c03e..a2d9e5e48bbe 100644 --- a/drivers/char/agp/i460-agp.c +++ b/drivers/char/agp/i460-agp.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/string.h> | ||
14 | #include <linux/slab.h> | ||
13 | #include <linux/agp_backend.h> | 15 | #include <linux/agp_backend.h> |
14 | 16 | ||
15 | #include "agp.h" | 17 | #include "agp.h" |
diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c index c9ac731504f2..40083241804e 100644 --- a/drivers/char/agp/isoch.c +++ b/drivers/char/agp/isoch.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
7 | #include <linux/agp_backend.h> | 7 | #include <linux/agp_backend.h> |
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/slab.h> | ||
9 | 10 | ||
10 | #include "agp.h" | 11 | #include "agp.h" |
11 | 12 | ||
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c index a9fb12c20eb7..71ea59a1dbeb 100644 --- a/drivers/char/agp/sworks-agp.c +++ b/drivers/char/agp/sworks-agp.c | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <linux/string.h> | ||
9 | #include <linux/slab.h> | ||
8 | #include <linux/agp_backend.h> | 10 | #include <linux/agp_backend.h> |
9 | #include "agp.h" | 11 | #include "agp.h" |
10 | 12 | ||
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index cf4c3648463d..c7f818cd7b02 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -281,7 +281,7 @@ static char rcsid[] = | |||
281 | * make sure "cyc" appears in all kernel messages; all soft interrupts | 281 | * make sure "cyc" appears in all kernel messages; all soft interrupts |
282 | * handled by same routine; recognize out-of-band reception; comment | 282 | * handled by same routine; recognize out-of-band reception; comment |
283 | * out some diagnostic messages; leave RTS/CTS flow control to hardware; | 283 | * out some diagnostic messages; leave RTS/CTS flow control to hardware; |
284 | * fix race condition in -Z buffer management; only -Y needs to explictly | 284 | * fix race condition in -Z buffer management; only -Y needs to explicitly |
285 | * flush chars; tidy up some startup messages; | 285 | * flush chars; tidy up some startup messages; |
286 | * | 286 | * |
287 | * Revision 1.36.4.18 1996/07/25 18:57:31 bentson | 287 | * Revision 1.36.4.18 1996/07/25 18:57:31 bentson |
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 475cc5e555e1..6d3449761914 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/kdev_t.h> | 16 | #include <linux/kdev_t.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/slab.h> | ||
19 | #include <linux/string.h> | ||
18 | 20 | ||
19 | #include "drm_core.h" | 21 | #include "drm_core.h" |
20 | #include "drmP.h" | 22 | #include "drmP.h" |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 407708a001e4..b7a0e4d6b934 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -3113,6 +3113,7 @@ MODULE_DEVICE_TABLE(pci, epca_pci_tbl); | |||
3113 | int __init init_PCI (void) | 3113 | int __init init_PCI (void) |
3114 | { /* Begin init_PCI */ | 3114 | { /* Begin init_PCI */ |
3115 | memset (&epca_driver, 0, sizeof (epca_driver)); | 3115 | memset (&epca_driver, 0, sizeof (epca_driver)); |
3116 | epca_driver.owner = THIS_MODULE; | ||
3116 | epca_driver.name = "epca"; | 3117 | epca_driver.name = "epca"; |
3117 | epca_driver.id_table = epca_pci_tbl; | 3118 | epca_driver.id_table = epca_pci_tbl; |
3118 | epca_driver.probe = epca_init_one; | 3119 | epca_driver.probe = epca_init_one; |
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c index a54bc93353af..66e53dd450ff 100644 --- a/drivers/char/hangcheck-timer.c +++ b/drivers/char/hangcheck-timer.c | |||
@@ -117,7 +117,7 @@ __setup("hcheck_reboot", hangcheck_parse_reboot); | |||
117 | __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks); | 117 | __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks); |
118 | #endif /* not MODULE */ | 118 | #endif /* not MODULE */ |
119 | 119 | ||
120 | #if defined(CONFIG_X86) || defined(CONFIG_X86_64) | 120 | #if defined(CONFIG_X86) |
121 | # define HAVE_MONOTONIC | 121 | # define HAVE_MONOTONIC |
122 | # define TIMER_FREQ 1000000000ULL | 122 | # define TIMER_FREQ 1000000000ULL |
123 | #elif defined(CONFIG_ARCH_S390) | 123 | #elif defined(CONFIG_ARCH_S390) |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index c055bb630ffc..3808d9572619 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -49,7 +49,9 @@ | |||
49 | #define HPET_USER_FREQ (64) | 49 | #define HPET_USER_FREQ (64) |
50 | #define HPET_DRIFT (500) | 50 | #define HPET_DRIFT (500) |
51 | 51 | ||
52 | static u32 hpet_ntimer, hpet_nhpet, hpet_max_freq = HPET_USER_FREQ; | 52 | #define HPET_RANGE_SIZE 1024 /* from HPET spec */ |
53 | |||
54 | static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ; | ||
53 | 55 | ||
54 | /* A lock for concurrent access by app and isr hpet activity. */ | 56 | /* A lock for concurrent access by app and isr hpet activity. */ |
55 | static DEFINE_SPINLOCK(hpet_lock); | 57 | static DEFINE_SPINLOCK(hpet_lock); |
@@ -78,7 +80,7 @@ struct hpets { | |||
78 | struct hpet __iomem *hp_hpet; | 80 | struct hpet __iomem *hp_hpet; |
79 | unsigned long hp_hpet_phys; | 81 | unsigned long hp_hpet_phys; |
80 | struct time_interpolator *hp_interpolator; | 82 | struct time_interpolator *hp_interpolator; |
81 | unsigned long hp_period; | 83 | unsigned long long hp_tick_freq; |
82 | unsigned long hp_delta; | 84 | unsigned long hp_delta; |
83 | unsigned int hp_ntimer; | 85 | unsigned int hp_ntimer; |
84 | unsigned int hp_which; | 86 | unsigned int hp_which; |
@@ -90,6 +92,7 @@ static struct hpets *hpets; | |||
90 | #define HPET_OPEN 0x0001 | 92 | #define HPET_OPEN 0x0001 |
91 | #define HPET_IE 0x0002 /* interrupt enabled */ | 93 | #define HPET_IE 0x0002 /* interrupt enabled */ |
92 | #define HPET_PERIODIC 0x0004 | 94 | #define HPET_PERIODIC 0x0004 |
95 | #define HPET_SHARED_IRQ 0x0008 | ||
93 | 96 | ||
94 | #if BITS_PER_LONG == 64 | 97 | #if BITS_PER_LONG == 64 |
95 | #define write_counter(V, MC) writeq(V, MC) | 98 | #define write_counter(V, MC) writeq(V, MC) |
@@ -120,6 +123,11 @@ static irqreturn_t hpet_interrupt(int irq, void *data, struct pt_regs *regs) | |||
120 | unsigned long isr; | 123 | unsigned long isr; |
121 | 124 | ||
122 | devp = data; | 125 | devp = data; |
126 | isr = 1 << (devp - devp->hd_hpets->hp_dev); | ||
127 | |||
128 | if ((devp->hd_flags & HPET_SHARED_IRQ) && | ||
129 | !(isr & readl(&devp->hd_hpet->hpet_isr))) | ||
130 | return IRQ_NONE; | ||
123 | 131 | ||
124 | spin_lock(&hpet_lock); | 132 | spin_lock(&hpet_lock); |
125 | devp->hd_irqdata++; | 133 | devp->hd_irqdata++; |
@@ -137,8 +145,8 @@ static irqreturn_t hpet_interrupt(int irq, void *data, struct pt_regs *regs) | |||
137 | &devp->hd_timer->hpet_compare); | 145 | &devp->hd_timer->hpet_compare); |
138 | } | 146 | } |
139 | 147 | ||
140 | isr = (1 << (devp - devp->hd_hpets->hp_dev)); | 148 | if (devp->hd_flags & HPET_SHARED_IRQ) |
141 | writeq(isr, &devp->hd_hpet->hpet_isr); | 149 | writel(isr, &devp->hd_hpet->hpet_isr); |
142 | spin_unlock(&hpet_lock); | 150 | spin_unlock(&hpet_lock); |
143 | 151 | ||
144 | spin_lock(&hpet_task_lock); | 152 | spin_lock(&hpet_task_lock); |
@@ -276,7 +284,8 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma) | |||
276 | 284 | ||
277 | if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, | 285 | if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, |
278 | PAGE_SIZE, vma->vm_page_prot)) { | 286 | PAGE_SIZE, vma->vm_page_prot)) { |
279 | printk(KERN_ERR "remap_pfn_range failed in hpet.c\n"); | 287 | printk(KERN_ERR "%s: io_remap_pfn_range failed\n", |
288 | __FUNCTION__); | ||
280 | return -EAGAIN; | 289 | return -EAGAIN; |
281 | } | 290 | } |
282 | 291 | ||
@@ -364,7 +373,9 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) | |||
364 | hpet = devp->hd_hpet; | 373 | hpet = devp->hd_hpet; |
365 | hpetp = devp->hd_hpets; | 374 | hpetp = devp->hd_hpets; |
366 | 375 | ||
367 | v = readq(&timer->hpet_config); | 376 | if (!devp->hd_ireqfreq) |
377 | return -EIO; | ||
378 | |||
368 | spin_lock_irq(&hpet_lock); | 379 | spin_lock_irq(&hpet_lock); |
369 | 380 | ||
370 | if (devp->hd_flags & HPET_IE) { | 381 | if (devp->hd_flags & HPET_IE) { |
@@ -373,16 +384,21 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) | |||
373 | } | 384 | } |
374 | 385 | ||
375 | devp->hd_flags |= HPET_IE; | 386 | devp->hd_flags |= HPET_IE; |
387 | |||
388 | if (readl(&timer->hpet_config) & Tn_INT_TYPE_CNF_MASK) | ||
389 | devp->hd_flags |= HPET_SHARED_IRQ; | ||
376 | spin_unlock_irq(&hpet_lock); | 390 | spin_unlock_irq(&hpet_lock); |
377 | 391 | ||
378 | t = readq(&timer->hpet_config); | ||
379 | irq = devp->hd_hdwirq; | 392 | irq = devp->hd_hdwirq; |
380 | 393 | ||
381 | if (irq) { | 394 | if (irq) { |
382 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); | 395 | unsigned long irq_flags; |
383 | 396 | ||
384 | if (request_irq | 397 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); |
385 | (irq, hpet_interrupt, SA_INTERRUPT, devp->hd_name, (void *)devp)) { | 398 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ |
399 | ? SA_SHIRQ : SA_INTERRUPT; | ||
400 | if (request_irq(irq, hpet_interrupt, irq_flags, | ||
401 | devp->hd_name, (void *)devp)) { | ||
386 | printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); | 402 | printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); |
387 | irq = 0; | 403 | irq = 0; |
388 | } | 404 | } |
@@ -416,20 +432,24 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) | |||
416 | write_counter(t + m + hpetp->hp_delta, &timer->hpet_compare); | 432 | write_counter(t + m + hpetp->hp_delta, &timer->hpet_compare); |
417 | } | 433 | } |
418 | 434 | ||
419 | isr = (1 << (devp - hpets->hp_dev)); | 435 | if (devp->hd_flags & HPET_SHARED_IRQ) { |
420 | writeq(isr, &hpet->hpet_isr); | 436 | isr = 1 << (devp - devp->hd_hpets->hp_dev); |
437 | writel(isr, &hpet->hpet_isr); | ||
438 | } | ||
421 | writeq(g, &timer->hpet_config); | 439 | writeq(g, &timer->hpet_config); |
422 | local_irq_restore(flags); | 440 | local_irq_restore(flags); |
423 | 441 | ||
424 | return 0; | 442 | return 0; |
425 | } | 443 | } |
426 | 444 | ||
427 | static inline unsigned long hpet_time_div(unsigned long dis) | 445 | /* converts Hz to number of timer ticks */ |
446 | static inline unsigned long hpet_time_div(struct hpets *hpets, | ||
447 | unsigned long dis) | ||
428 | { | 448 | { |
429 | unsigned long long m = 1000000000000000ULL; | 449 | unsigned long long m; |
430 | 450 | ||
451 | m = hpets->hp_tick_freq + (dis >> 1); | ||
431 | do_div(m, dis); | 452 | do_div(m, dis); |
432 | |||
433 | return (unsigned long)m; | 453 | return (unsigned long)m; |
434 | } | 454 | } |
435 | 455 | ||
@@ -477,14 +497,21 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) | |||
477 | { | 497 | { |
478 | struct hpet_info info; | 498 | struct hpet_info info; |
479 | 499 | ||
480 | info.hi_ireqfreq = hpet_time_div(hpetp->hp_period * | 500 | if (devp->hd_ireqfreq) |
481 | devp->hd_ireqfreq); | 501 | info.hi_ireqfreq = |
502 | hpet_time_div(hpetp, devp->hd_ireqfreq); | ||
503 | else | ||
504 | info.hi_ireqfreq = 0; | ||
482 | info.hi_flags = | 505 | info.hi_flags = |
483 | readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK; | 506 | readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK; |
484 | info.hi_hpet = devp->hd_hpets->hp_which; | 507 | info.hi_hpet = hpetp->hp_which; |
485 | info.hi_timer = devp - devp->hd_hpets->hp_dev; | 508 | info.hi_timer = devp - hpetp->hp_dev; |
486 | if (copy_to_user((void __user *)arg, &info, sizeof(info))) | 509 | if (kernel) |
487 | err = -EFAULT; | 510 | memcpy((void *)arg, &info, sizeof(info)); |
511 | else | ||
512 | if (copy_to_user((void __user *)arg, &info, | ||
513 | sizeof(info))) | ||
514 | err = -EFAULT; | ||
488 | break; | 515 | break; |
489 | } | 516 | } |
490 | case HPET_EPI: | 517 | case HPET_EPI: |
@@ -516,12 +543,12 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) | |||
516 | break; | 543 | break; |
517 | } | 544 | } |
518 | 545 | ||
519 | if (arg & (arg - 1)) { | 546 | if (!arg) { |
520 | err = -EINVAL; | 547 | err = -EINVAL; |
521 | break; | 548 | break; |
522 | } | 549 | } |
523 | 550 | ||
524 | devp->hd_ireqfreq = hpet_time_div(hpetp->hp_period * arg); | 551 | devp->hd_ireqfreq = hpet_time_div(hpetp, arg); |
525 | } | 552 | } |
526 | 553 | ||
527 | return err; | 554 | return err; |
@@ -539,6 +566,17 @@ static struct file_operations hpet_fops = { | |||
539 | .mmap = hpet_mmap, | 566 | .mmap = hpet_mmap, |
540 | }; | 567 | }; |
541 | 568 | ||
569 | static int hpet_is_known(struct hpet_data *hdp) | ||
570 | { | ||
571 | struct hpets *hpetp; | ||
572 | |||
573 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) | ||
574 | if (hpetp->hp_hpet_phys == hdp->hd_phys_address) | ||
575 | return 1; | ||
576 | |||
577 | return 0; | ||
578 | } | ||
579 | |||
542 | EXPORT_SYMBOL(hpet_alloc); | 580 | EXPORT_SYMBOL(hpet_alloc); |
543 | EXPORT_SYMBOL(hpet_register); | 581 | EXPORT_SYMBOL(hpet_register); |
544 | EXPORT_SYMBOL(hpet_unregister); | 582 | EXPORT_SYMBOL(hpet_unregister); |
@@ -563,6 +601,8 @@ int hpet_register(struct hpet_task *tp, int periodic) | |||
563 | return -EINVAL; | 601 | return -EINVAL; |
564 | } | 602 | } |
565 | 603 | ||
604 | tp->ht_opaque = NULL; | ||
605 | |||
566 | spin_lock_irq(&hpet_task_lock); | 606 | spin_lock_irq(&hpet_task_lock); |
567 | spin_lock(&hpet_lock); | 607 | spin_lock(&hpet_lock); |
568 | 608 | ||
@@ -702,15 +742,14 @@ static void hpet_register_interpolator(struct hpets *hpetp) | |||
702 | #ifdef CONFIG_TIME_INTERPOLATION | 742 | #ifdef CONFIG_TIME_INTERPOLATION |
703 | struct time_interpolator *ti; | 743 | struct time_interpolator *ti; |
704 | 744 | ||
705 | ti = kmalloc(sizeof(*ti), GFP_KERNEL); | 745 | ti = kzalloc(sizeof(*ti), GFP_KERNEL); |
706 | if (!ti) | 746 | if (!ti) |
707 | return; | 747 | return; |
708 | 748 | ||
709 | memset(ti, 0, sizeof(*ti)); | ||
710 | ti->source = TIME_SOURCE_MMIO64; | 749 | ti->source = TIME_SOURCE_MMIO64; |
711 | ti->shift = 10; | 750 | ti->shift = 10; |
712 | ti->addr = &hpetp->hp_hpet->hpet_mc; | 751 | ti->addr = &hpetp->hp_hpet->hpet_mc; |
713 | ti->frequency = hpet_time_div(hpets->hp_period); | 752 | ti->frequency = hpetp->hp_tick_freq; |
714 | ti->drift = HPET_DRIFT; | 753 | ti->drift = HPET_DRIFT; |
715 | ti->mask = -1; | 754 | ti->mask = -1; |
716 | 755 | ||
@@ -743,11 +782,11 @@ static unsigned long hpet_calibrate(struct hpets *hpetp) | |||
743 | if (!timer) | 782 | if (!timer) |
744 | return 0; | 783 | return 0; |
745 | 784 | ||
746 | hpet = hpets->hp_hpet; | 785 | hpet = hpetp->hp_hpet; |
747 | t = read_counter(&timer->hpet_compare); | 786 | t = read_counter(&timer->hpet_compare); |
748 | 787 | ||
749 | i = 0; | 788 | i = 0; |
750 | count = hpet_time_div(hpetp->hp_period * TICK_CALIBRATE); | 789 | count = hpet_time_div(hpetp, TICK_CALIBRATE); |
751 | 790 | ||
752 | local_irq_save(flags); | 791 | local_irq_save(flags); |
753 | 792 | ||
@@ -771,28 +810,29 @@ int hpet_alloc(struct hpet_data *hdp) | |||
771 | struct hpets *hpetp; | 810 | struct hpets *hpetp; |
772 | size_t siz; | 811 | size_t siz; |
773 | struct hpet __iomem *hpet; | 812 | struct hpet __iomem *hpet; |
774 | static struct hpets *last = (struct hpets *)0; | 813 | static struct hpets *last = NULL; |
775 | unsigned long ns; | 814 | unsigned long period; |
815 | unsigned long long temp; | ||
776 | 816 | ||
777 | /* | 817 | /* |
778 | * hpet_alloc can be called by platform dependent code. | 818 | * hpet_alloc can be called by platform dependent code. |
779 | * if platform dependent code has allocated the hpet | 819 | * If platform dependent code has allocated the hpet that |
780 | * ACPI also reports hpet, then we catch it here. | 820 | * ACPI has also reported, then we catch it here. |
781 | */ | 821 | */ |
782 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) | 822 | if (hpet_is_known(hdp)) { |
783 | if (hpetp->hp_hpet == hdp->hd_address) | 823 | printk(KERN_DEBUG "%s: duplicate HPET ignored\n", |
784 | return 0; | 824 | __FUNCTION__); |
825 | return 0; | ||
826 | } | ||
785 | 827 | ||
786 | siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) * | 828 | siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) * |
787 | sizeof(struct hpet_dev)); | 829 | sizeof(struct hpet_dev)); |
788 | 830 | ||
789 | hpetp = kmalloc(siz, GFP_KERNEL); | 831 | hpetp = kzalloc(siz, GFP_KERNEL); |
790 | 832 | ||
791 | if (!hpetp) | 833 | if (!hpetp) |
792 | return -ENOMEM; | 834 | return -ENOMEM; |
793 | 835 | ||
794 | memset(hpetp, 0, siz); | ||
795 | |||
796 | hpetp->hp_which = hpet_nhpet++; | 836 | hpetp->hp_which = hpet_nhpet++; |
797 | hpetp->hp_hpet = hdp->hd_address; | 837 | hpetp->hp_hpet = hdp->hd_address; |
798 | hpetp->hp_hpet_phys = hdp->hd_phys_address; | 838 | hpetp->hp_hpet_phys = hdp->hd_phys_address; |
@@ -822,21 +862,23 @@ int hpet_alloc(struct hpet_data *hdp) | |||
822 | 862 | ||
823 | last = hpetp; | 863 | last = hpetp; |
824 | 864 | ||
825 | hpetp->hp_period = (cap & HPET_COUNTER_CLK_PERIOD_MASK) >> | 865 | period = (cap & HPET_COUNTER_CLK_PERIOD_MASK) >> |
826 | HPET_COUNTER_CLK_PERIOD_SHIFT; | 866 | HPET_COUNTER_CLK_PERIOD_SHIFT; /* fs, 10^-15 */ |
867 | temp = 1000000000000000uLL; /* 10^15 femtoseconds per second */ | ||
868 | temp += period >> 1; /* round */ | ||
869 | do_div(temp, period); | ||
870 | hpetp->hp_tick_freq = temp; /* ticks per second */ | ||
827 | 871 | ||
828 | printk(KERN_INFO "hpet%d: at MMIO 0x%lx, IRQ%s", | 872 | printk(KERN_INFO "hpet%d: at MMIO 0x%lx (virtual 0x%p), IRQ%s", |
829 | hpetp->hp_which, hdp->hd_phys_address, | 873 | hpetp->hp_which, hdp->hd_phys_address, hdp->hd_address, |
830 | hpetp->hp_ntimer > 1 ? "s" : ""); | 874 | hpetp->hp_ntimer > 1 ? "s" : ""); |
831 | for (i = 0; i < hpetp->hp_ntimer; i++) | 875 | for (i = 0; i < hpetp->hp_ntimer; i++) |
832 | printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); | 876 | printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); |
833 | printk("\n"); | 877 | printk("\n"); |
834 | 878 | ||
835 | ns = hpetp->hp_period; /* femptoseconds, 10^-15 */ | 879 | printk(KERN_INFO "hpet%u: %u %d-bit timers, %Lu Hz\n", |
836 | ns /= 1000000; /* convert to nanoseconds, 10^-9 */ | 880 | hpetp->hp_which, hpetp->hp_ntimer, |
837 | printk(KERN_INFO "hpet%d: %ldns tick, %d %d-bit timers\n", | 881 | cap & HPET_COUNTER_SIZE_MASK ? 64 : 32, hpetp->hp_tick_freq); |
838 | hpetp->hp_which, ns, hpetp->hp_ntimer, | ||
839 | cap & HPET_COUNTER_SIZE_MASK ? 64 : 32); | ||
840 | 882 | ||
841 | mcfg = readq(&hpet->hpet_config); | 883 | mcfg = readq(&hpet->hpet_config); |
842 | if ((mcfg & HPET_ENABLE_CNF_MASK) == 0) { | 884 | if ((mcfg & HPET_ENABLE_CNF_MASK) == 0) { |
@@ -845,13 +887,10 @@ int hpet_alloc(struct hpet_data *hdp) | |||
845 | writeq(mcfg, &hpet->hpet_config); | 887 | writeq(mcfg, &hpet->hpet_config); |
846 | } | 888 | } |
847 | 889 | ||
848 | for (i = 0, devp = hpetp->hp_dev; i < hpetp->hp_ntimer; | 890 | for (i = 0, devp = hpetp->hp_dev; i < hpetp->hp_ntimer; i++, devp++) { |
849 | i++, hpet_ntimer++, devp++) { | ||
850 | unsigned long v; | ||
851 | struct hpet_timer __iomem *timer; | 891 | struct hpet_timer __iomem *timer; |
852 | 892 | ||
853 | timer = &hpet->hpet_timers[devp - hpetp->hp_dev]; | 893 | timer = &hpet->hpet_timers[devp - hpetp->hp_dev]; |
854 | v = readq(&timer->hpet_config); | ||
855 | 894 | ||
856 | devp->hd_hpets = hpetp; | 895 | devp->hd_hpets = hpetp; |
857 | devp->hd_hpet = hpet; | 896 | devp->hd_hpet = hpet; |
@@ -880,7 +919,6 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
880 | struct hpet_data *hdp; | 919 | struct hpet_data *hdp; |
881 | acpi_status status; | 920 | acpi_status status; |
882 | struct acpi_resource_address64 addr; | 921 | struct acpi_resource_address64 addr; |
883 | struct hpets *hpetp; | ||
884 | 922 | ||
885 | hdp = data; | 923 | hdp = data; |
886 | 924 | ||
@@ -893,9 +931,29 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
893 | hdp->hd_phys_address = addr.min_address_range; | 931 | hdp->hd_phys_address = addr.min_address_range; |
894 | hdp->hd_address = ioremap(addr.min_address_range, size); | 932 | hdp->hd_address = ioremap(addr.min_address_range, size); |
895 | 933 | ||
896 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) | 934 | if (hpet_is_known(hdp)) { |
897 | if (hpetp->hp_hpet == hdp->hd_address) | 935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", |
898 | return -EBUSY; | 936 | __FUNCTION__, hdp->hd_phys_address); |
937 | iounmap(hdp->hd_address); | ||
938 | return -EBUSY; | ||
939 | } | ||
940 | } else if (res->id == ACPI_RSTYPE_FIXED_MEM32) { | ||
941 | struct acpi_resource_fixed_mem32 *fixmem32; | ||
942 | |||
943 | fixmem32 = &res->data.fixed_memory32; | ||
944 | if (!fixmem32) | ||
945 | return -EINVAL; | ||
946 | |||
947 | hdp->hd_phys_address = fixmem32->range_base_address; | ||
948 | hdp->hd_address = ioremap(fixmem32->range_base_address, | ||
949 | HPET_RANGE_SIZE); | ||
950 | |||
951 | if (hpet_is_known(hdp)) { | ||
952 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | ||
953 | __FUNCTION__, hdp->hd_phys_address); | ||
954 | iounmap(hdp->hd_address); | ||
955 | return -EBUSY; | ||
956 | } | ||
899 | } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { | 957 | } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { |
900 | struct acpi_resource_ext_irq *irqp; | 958 | struct acpi_resource_ext_irq *irqp; |
901 | int i; | 959 | int i; |
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c index 78d681dc35a8..f5212eb2b41d 100644 --- a/drivers/char/hvc_vio.c +++ b/drivers/char/hvc_vio.c | |||
@@ -95,11 +95,11 @@ static int __devexit hvc_vio_remove(struct vio_dev *vdev) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static struct vio_driver hvc_vio_driver = { | 97 | static struct vio_driver hvc_vio_driver = { |
98 | .name = hvc_driver_name, | ||
99 | .id_table = hvc_driver_table, | 98 | .id_table = hvc_driver_table, |
100 | .probe = hvc_vio_probe, | 99 | .probe = hvc_vio_probe, |
101 | .remove = hvc_vio_remove, | 100 | .remove = hvc_vio_remove, |
102 | .driver = { | 101 | .driver = { |
102 | .name = hvc_driver_name, | ||
103 | .owner = THIS_MODULE, | 103 | .owner = THIS_MODULE, |
104 | } | 104 | } |
105 | }; | 105 | }; |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index f47f009f9259..53dc77c760fc 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -720,10 +720,13 @@ static int __devexit hvcs_remove(struct vio_dev *dev) | |||
720 | }; | 720 | }; |
721 | 721 | ||
722 | static struct vio_driver hvcs_vio_driver = { | 722 | static struct vio_driver hvcs_vio_driver = { |
723 | .name = hvcs_driver_name, | ||
724 | .id_table = hvcs_driver_table, | 723 | .id_table = hvcs_driver_table, |
725 | .probe = hvcs_probe, | 724 | .probe = hvcs_probe, |
726 | .remove = hvcs_remove, | 725 | .remove = hvcs_remove, |
726 | .driver = { | ||
727 | .name = hvcs_driver_name, | ||
728 | .owner = THIS_MODULE, | ||
729 | } | ||
727 | }; | 730 | }; |
728 | 731 | ||
729 | /* Only called from hvcs_get_pi please */ | 732 | /* Only called from hvcs_get_pi please */ |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 38be4b0dbd1c..91dd669273e0 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -231,9 +231,7 @@ static ssize_t write_mem(struct file * file, const char __user * buf, | |||
231 | static int mmap_mem(struct file * file, struct vm_area_struct * vma) | 231 | static int mmap_mem(struct file * file, struct vm_area_struct * vma) |
232 | { | 232 | { |
233 | #if defined(__HAVE_PHYS_MEM_ACCESS_PROT) | 233 | #if defined(__HAVE_PHYS_MEM_ACCESS_PROT) |
234 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 234 | vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff, |
235 | |||
236 | vma->vm_page_prot = phys_mem_access_prot(file, offset, | ||
237 | vma->vm_end - vma->vm_start, | 235 | vma->vm_end - vma->vm_start, |
238 | vma->vm_page_prot); | 236 | vma->vm_page_prot); |
239 | #elif defined(pgprot_noncached) | 237 | #elif defined(pgprot_noncached) |
diff --git a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c index 613aed9e1840..d1fe05e83882 100644 --- a/drivers/char/mwave/3780i.c +++ b/drivers/char/mwave/3780i.c | |||
@@ -53,6 +53,8 @@ | |||
53 | #include <linux/ioport.h> | 53 | #include <linux/ioport.h> |
54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
55 | #include <linux/bitops.h> | 55 | #include <linux/bitops.h> |
56 | #include <linux/sched.h> /* cond_resched() */ | ||
57 | |||
56 | #include <asm/io.h> | 58 | #include <asm/io.h> |
57 | #include <asm/uaccess.h> | 59 | #include <asm/uaccess.h> |
58 | #include <asm/system.h> | 60 | #include <asm/system.h> |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 5b1d3680c8ab..928b850cc679 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -256,7 +256,6 @@ static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, | |||
256 | static int sReadAiopID(ByteIO_t io); | 256 | static int sReadAiopID(ByteIO_t io); |
257 | static int sReadAiopNumChan(WordIO_t io); | 257 | static int sReadAiopNumChan(WordIO_t io); |
258 | 258 | ||
259 | #ifdef MODULE | ||
260 | MODULE_AUTHOR("Theodore Ts'o"); | 259 | MODULE_AUTHOR("Theodore Ts'o"); |
261 | MODULE_DESCRIPTION("Comtrol RocketPort driver"); | 260 | MODULE_DESCRIPTION("Comtrol RocketPort driver"); |
262 | module_param(board1, ulong, 0); | 261 | module_param(board1, ulong, 0); |
@@ -288,17 +287,14 @@ MODULE_PARM_DESC(pc104_3, "set interface types for ISA(PC104) board #3 (e.g. pc1 | |||
288 | module_param_array(pc104_4, ulong, NULL, 0); | 287 | module_param_array(pc104_4, ulong, NULL, 0); |
289 | MODULE_PARM_DESC(pc104_4, "set interface types for ISA(PC104) board #4 (e.g. pc104_4=232,232,485,485,..."); | 288 | MODULE_PARM_DESC(pc104_4, "set interface types for ISA(PC104) board #4 (e.g. pc104_4=232,232,485,485,..."); |
290 | 289 | ||
291 | int rp_init(void); | 290 | static int rp_init(void); |
292 | static void rp_cleanup_module(void); | 291 | static void rp_cleanup_module(void); |
293 | 292 | ||
294 | module_init(rp_init); | 293 | module_init(rp_init); |
295 | module_exit(rp_cleanup_module); | 294 | module_exit(rp_cleanup_module); |
296 | 295 | ||
297 | #endif | ||
298 | 296 | ||
299 | #ifdef MODULE_LICENSE | ||
300 | MODULE_LICENSE("Dual BSD/GPL"); | 297 | MODULE_LICENSE("Dual BSD/GPL"); |
301 | #endif | ||
302 | 298 | ||
303 | /*************************************************************************/ | 299 | /*************************************************************************/ |
304 | /* Module code starts here */ | 300 | /* Module code starts here */ |
@@ -2378,7 +2374,7 @@ static struct tty_operations rocket_ops = { | |||
2378 | /* | 2374 | /* |
2379 | * The module "startup" routine; it's run when the module is loaded. | 2375 | * The module "startup" routine; it's run when the module is loaded. |
2380 | */ | 2376 | */ |
2381 | int __init rp_init(void) | 2377 | static int __init rp_init(void) |
2382 | { | 2378 | { |
2383 | int retval, pci_boards_found, isa_boards_found, i; | 2379 | int retval, pci_boards_found, isa_boards_found, i; |
2384 | 2380 | ||
@@ -2502,7 +2498,6 @@ int __init rp_init(void) | |||
2502 | return 0; | 2498 | return 0; |
2503 | } | 2499 | } |
2504 | 2500 | ||
2505 | #ifdef MODULE | ||
2506 | 2501 | ||
2507 | static void rp_cleanup_module(void) | 2502 | static void rp_cleanup_module(void) |
2508 | { | 2503 | { |
@@ -2530,7 +2525,6 @@ static void rp_cleanup_module(void) | |||
2530 | if (controller) | 2525 | if (controller) |
2531 | release_region(controller, 4); | 2526 | release_region(controller, 4); |
2532 | } | 2527 | } |
2533 | #endif | ||
2534 | 2528 | ||
2535 | /*************************************************************************** | 2529 | /*************************************************************************** |
2536 | Function: sInitController | 2530 | Function: sInitController |
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index 6b4e9d155f50..dda30e42ec79 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c | |||
@@ -790,7 +790,7 @@ static int __init a2232board_init(void) | |||
790 | 790 | ||
791 | } | 791 | } |
792 | 792 | ||
793 | printk("Total: %d A2232 boards initialized.\n.", nr_a2232); /* Some status report if no card was found */ | 793 | printk("Total: %d A2232 boards initialized.\n", nr_a2232); /* Some status report if no card was found */ |
794 | 794 | ||
795 | a2232_init_portstructs(); | 795 | a2232_init_portstructs(); |
796 | 796 | ||
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 50e0b612a8a2..352547eabf7b 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -38,19 +38,19 @@ | |||
38 | * | 38 | * |
39 | * Revision 1.0: April 1st 1997. | 39 | * Revision 1.0: April 1st 1997. |
40 | * Initial release for alpha testing. | 40 | * Initial release for alpha testing. |
41 | * Revision 1.1: April 14th 1997. | 41 | * Revision 1.1: April 14th 1997. |
42 | * Incorporated Richard Hudsons suggestions, | 42 | * Incorporated Richard Hudsons suggestions, |
43 | * removed some debugging printk's. | 43 | * removed some debugging printk's. |
44 | * Revision 1.2: April 15th 1997. | 44 | * Revision 1.2: April 15th 1997. |
45 | * Ported to 2.1.x kernels. | 45 | * Ported to 2.1.x kernels. |
46 | * Revision 1.3: April 17th 1997 | 46 | * Revision 1.3: April 17th 1997 |
47 | * Backported to 2.0. (Compatibility macros). | 47 | * Backported to 2.0. (Compatibility macros). |
48 | * Revision 1.4: April 18th 1997 | 48 | * Revision 1.4: April 18th 1997 |
49 | * Fixed DTR/RTS bug that caused the card to indicate | 49 | * Fixed DTR/RTS bug that caused the card to indicate |
50 | * "don't send data" to a modem after the password prompt. | 50 | * "don't send data" to a modem after the password prompt. |
51 | * Fixed bug for premature (fake) interrupts. | 51 | * Fixed bug for premature (fake) interrupts. |
52 | * Revision 1.5: April 19th 1997 | 52 | * Revision 1.5: April 19th 1997 |
53 | * fixed a minor typo in the header file, cleanup a little. | 53 | * fixed a minor typo in the header file, cleanup a little. |
54 | * performance warnings are now MAXed at once per minute. | 54 | * performance warnings are now MAXed at once per minute. |
55 | * Revision 1.6: May 23 1997 | 55 | * Revision 1.6: May 23 1997 |
56 | * Changed the specialix=... format to include interrupt. | 56 | * Changed the specialix=... format to include interrupt. |
@@ -60,10 +60,10 @@ | |||
60 | * port to linux-2.1.43 kernel. | 60 | * port to linux-2.1.43 kernel. |
61 | * Revision 1.9: Oct 9 1998 | 61 | * Revision 1.9: Oct 9 1998 |
62 | * Added stuff for the IO8+/PCI version. | 62 | * Added stuff for the IO8+/PCI version. |
63 | * Revision 1.10: Oct 22 1999 / Jan 21 2000. | 63 | * Revision 1.10: Oct 22 1999 / Jan 21 2000. |
64 | * Added stuff for setserial. | 64 | * Added stuff for setserial. |
65 | * Nicolas Mailhot (Nicolas.Mailhot@email.enst.fr) | 65 | * Nicolas Mailhot (Nicolas.Mailhot@email.enst.fr) |
66 | * | 66 | * |
67 | */ | 67 | */ |
68 | 68 | ||
69 | #define VERSION "1.11" | 69 | #define VERSION "1.11" |
@@ -154,7 +154,7 @@ static int sx_poll = HZ; | |||
154 | 154 | ||
155 | 155 | ||
156 | 156 | ||
157 | /* | 157 | /* |
158 | * The following defines are mostly for testing purposes. But if you need | 158 | * The following defines are mostly for testing purposes. But if you need |
159 | * some nice reporting in your syslog, you can define them also. | 159 | * some nice reporting in your syslog, you can define them also. |
160 | */ | 160 | */ |
@@ -188,7 +188,7 @@ static DECLARE_MUTEX(tmp_buf_sem); | |||
188 | 188 | ||
189 | static unsigned long baud_table[] = { | 189 | static unsigned long baud_table[] = { |
190 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, | 190 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, |
191 | 9600, 19200, 38400, 57600, 115200, 0, | 191 | 9600, 19200, 38400, 57600, 115200, 0, |
192 | }; | 192 | }; |
193 | 193 | ||
194 | static struct specialix_board sx_board[SX_NBOARD] = { | 194 | static struct specialix_board sx_board[SX_NBOARD] = { |
@@ -216,7 +216,7 @@ static inline int sx_paranoia_check(struct specialix_port const * port, | |||
216 | KERN_ERR "sx: Warning: bad specialix port magic number for device %s in %s\n"; | 216 | KERN_ERR "sx: Warning: bad specialix port magic number for device %s in %s\n"; |
217 | static const char *badinfo = | 217 | static const char *badinfo = |
218 | KERN_ERR "sx: Warning: null specialix port for device %s in %s\n"; | 218 | KERN_ERR "sx: Warning: null specialix port for device %s in %s\n"; |
219 | 219 | ||
220 | if (!port) { | 220 | if (!port) { |
221 | printk(badinfo, name, routine); | 221 | printk(badinfo, name, routine); |
222 | return 1; | 222 | return 1; |
@@ -231,9 +231,9 @@ static inline int sx_paranoia_check(struct specialix_port const * port, | |||
231 | 231 | ||
232 | 232 | ||
233 | /* | 233 | /* |
234 | * | 234 | * |
235 | * Service functions for specialix IO8+ driver. | 235 | * Service functions for specialix IO8+ driver. |
236 | * | 236 | * |
237 | */ | 237 | */ |
238 | 238 | ||
239 | /* Get board number from pointer */ | 239 | /* Get board number from pointer */ |
@@ -246,7 +246,7 @@ static inline int board_No (struct specialix_board * bp) | |||
246 | /* Get port number from pointer */ | 246 | /* Get port number from pointer */ |
247 | static inline int port_No (struct specialix_port const * port) | 247 | static inline int port_No (struct specialix_port const * port) |
248 | { | 248 | { |
249 | return SX_PORT(port - sx_port); | 249 | return SX_PORT(port - sx_port); |
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
@@ -309,7 +309,7 @@ static inline void sx_wait_CCR(struct specialix_board * bp) | |||
309 | return; | 309 | return; |
310 | udelay (1); | 310 | udelay (1); |
311 | } | 311 | } |
312 | 312 | ||
313 | printk(KERN_ERR "sx%d: Timeout waiting for CCR.\n", board_No(bp)); | 313 | printk(KERN_ERR "sx%d: Timeout waiting for CCR.\n", board_No(bp)); |
314 | } | 314 | } |
315 | 315 | ||
@@ -329,7 +329,7 @@ static inline void sx_wait_CCR_off(struct specialix_board * bp) | |||
329 | return; | 329 | return; |
330 | udelay (1); | 330 | udelay (1); |
331 | } | 331 | } |
332 | 332 | ||
333 | printk(KERN_ERR "sx%d: Timeout waiting for CCR.\n", board_No(bp)); | 333 | printk(KERN_ERR "sx%d: Timeout waiting for CCR.\n", board_No(bp)); |
334 | } | 334 | } |
335 | 335 | ||
@@ -338,34 +338,28 @@ static inline void sx_wait_CCR_off(struct specialix_board * bp) | |||
338 | * specialix IO8+ IO range functions. | 338 | * specialix IO8+ IO range functions. |
339 | */ | 339 | */ |
340 | 340 | ||
341 | static inline int sx_check_io_range(struct specialix_board * bp) | 341 | static inline int sx_request_io_range(struct specialix_board * bp) |
342 | { | 342 | { |
343 | return check_region (bp->base, SX_IO_SPACE); | 343 | return request_region(bp->base, |
344 | } | 344 | bp->flags & SX_BOARD_IS_PCI ? SX_PCI_IO_SPACE : SX_IO_SPACE, |
345 | 345 | "specialix IO8+") == NULL; | |
346 | |||
347 | static inline void sx_request_io_range(struct specialix_board * bp) | ||
348 | { | ||
349 | request_region(bp->base, | ||
350 | bp->flags&SX_BOARD_IS_PCI?SX_PCI_IO_SPACE:SX_IO_SPACE, | ||
351 | "specialix IO8+" ); | ||
352 | } | 346 | } |
353 | 347 | ||
354 | 348 | ||
355 | static inline void sx_release_io_range(struct specialix_board * bp) | 349 | static inline void sx_release_io_range(struct specialix_board * bp) |
356 | { | 350 | { |
357 | release_region(bp->base, | 351 | release_region(bp->base, |
358 | bp->flags&SX_BOARD_IS_PCI?SX_PCI_IO_SPACE:SX_IO_SPACE); | 352 | bp->flags&SX_BOARD_IS_PCI?SX_PCI_IO_SPACE:SX_IO_SPACE); |
359 | } | 353 | } |
360 | 354 | ||
361 | 355 | ||
362 | /* Must be called with enabled interrupts */ | 356 | /* Must be called with enabled interrupts */ |
363 | /* Ugly. Very ugly. Don't use this for anything else than initialization | 357 | /* Ugly. Very ugly. Don't use this for anything else than initialization |
364 | code */ | 358 | code */ |
365 | static inline void sx_long_delay(unsigned long delay) | 359 | static inline void sx_long_delay(unsigned long delay) |
366 | { | 360 | { |
367 | unsigned long i; | 361 | unsigned long i; |
368 | 362 | ||
369 | for (i = jiffies + delay; time_after(i, jiffies); ) ; | 363 | for (i = jiffies + delay; time_after(i, jiffies); ) ; |
370 | } | 364 | } |
371 | 365 | ||
@@ -378,7 +372,7 @@ static int sx_set_irq ( struct specialix_board *bp) | |||
378 | int i; | 372 | int i; |
379 | unsigned long flags; | 373 | unsigned long flags; |
380 | 374 | ||
381 | if (bp->flags & SX_BOARD_IS_PCI) | 375 | if (bp->flags & SX_BOARD_IS_PCI) |
382 | return 1; | 376 | return 1; |
383 | switch (bp->irq) { | 377 | switch (bp->irq) { |
384 | /* In the same order as in the docs... */ | 378 | /* In the same order as in the docs... */ |
@@ -420,7 +414,7 @@ static int sx_init_CD186x(struct specialix_board * bp) | |||
420 | sx_out_off(bp, CD186x_PILR3, SX_ACK_RINT); /* Prio for receiver intr */ | 414 | sx_out_off(bp, CD186x_PILR3, SX_ACK_RINT); /* Prio for receiver intr */ |
421 | /* Set RegAckEn */ | 415 | /* Set RegAckEn */ |
422 | sx_out_off(bp, CD186x_SRCR, sx_in (bp, CD186x_SRCR) | SRCR_REGACKEN); | 416 | sx_out_off(bp, CD186x_SRCR, sx_in (bp, CD186x_SRCR) | SRCR_REGACKEN); |
423 | 417 | ||
424 | /* Setting up prescaler. We need 4 ticks per 1 ms */ | 418 | /* Setting up prescaler. We need 4 ticks per 1 ms */ |
425 | scaler = SX_OSCFREQ/SPECIALIX_TPS; | 419 | scaler = SX_OSCFREQ/SPECIALIX_TPS; |
426 | 420 | ||
@@ -448,7 +442,7 @@ static int read_cross_byte (struct specialix_board *bp, int reg, int bit) | |||
448 | spin_lock_irqsave(&bp->lock, flags); | 442 | spin_lock_irqsave(&bp->lock, flags); |
449 | for (i=0, t=0;i<8;i++) { | 443 | for (i=0, t=0;i<8;i++) { |
450 | sx_out_off (bp, CD186x_CAR, i); | 444 | sx_out_off (bp, CD186x_CAR, i); |
451 | if (sx_in_off (bp, reg) & bit) | 445 | if (sx_in_off (bp, reg) & bit) |
452 | t |= 1 << i; | 446 | t |= 1 << i; |
453 | } | 447 | } |
454 | spin_unlock_irqrestore(&bp->lock, flags); | 448 | spin_unlock_irqrestore(&bp->lock, flags); |
@@ -472,7 +466,7 @@ void missed_irq (unsigned long data) | |||
472 | spin_unlock_irqrestore(&bp->lock, flags); | 466 | spin_unlock_irqrestore(&bp->lock, flags); |
473 | if (irq) { | 467 | if (irq) { |
474 | printk (KERN_INFO "Missed interrupt... Calling int from timer. \n"); | 468 | printk (KERN_INFO "Missed interrupt... Calling int from timer. \n"); |
475 | sx_interrupt (((struct specialix_board *)data)->irq, | 469 | sx_interrupt (((struct specialix_board *)data)->irq, |
476 | (void*)data, NULL); | 470 | (void*)data, NULL); |
477 | } | 471 | } |
478 | missed_irq_timer.expires = jiffies + sx_poll; | 472 | missed_irq_timer.expires = jiffies + sx_poll; |
@@ -495,7 +489,7 @@ static int sx_probe(struct specialix_board *bp) | |||
495 | 489 | ||
496 | func_enter(); | 490 | func_enter(); |
497 | 491 | ||
498 | if (sx_check_io_range(bp)) { | 492 | if (sx_request_io_range(bp)) { |
499 | func_exit(); | 493 | func_exit(); |
500 | return 1; | 494 | return 1; |
501 | } | 495 | } |
@@ -509,15 +503,16 @@ static int sx_probe(struct specialix_board *bp) | |||
509 | short_pause (); | 503 | short_pause (); |
510 | val2 = sx_in_off(bp, CD186x_PPRL); | 504 | val2 = sx_in_off(bp, CD186x_PPRL); |
511 | 505 | ||
512 | 506 | ||
513 | if ((val1 != 0x5a) || (val2 != 0xa5)) { | 507 | if ((val1 != 0x5a) || (val2 != 0xa5)) { |
514 | printk(KERN_INFO "sx%d: specialix IO8+ Board at 0x%03x not found.\n", | 508 | printk(KERN_INFO "sx%d: specialix IO8+ Board at 0x%03x not found.\n", |
515 | board_No(bp), bp->base); | 509 | board_No(bp), bp->base); |
510 | sx_release_io_range(bp); | ||
516 | func_exit(); | 511 | func_exit(); |
517 | return 1; | 512 | return 1; |
518 | } | 513 | } |
519 | 514 | ||
520 | /* Check the DSR lines that Specialix uses as board | 515 | /* Check the DSR lines that Specialix uses as board |
521 | identification */ | 516 | identification */ |
522 | val1 = read_cross_byte (bp, CD186x_MSVR, MSVR_DSR); | 517 | val1 = read_cross_byte (bp, CD186x_MSVR, MSVR_DSR); |
523 | val2 = read_cross_byte (bp, CD186x_MSVR, MSVR_RTS); | 518 | val2 = read_cross_byte (bp, CD186x_MSVR, MSVR_RTS); |
@@ -532,6 +527,7 @@ static int sx_probe(struct specialix_board *bp) | |||
532 | if (val1 != val2) { | 527 | if (val1 != val2) { |
533 | printk(KERN_INFO "sx%d: specialix IO8+ ID %02x at 0x%03x not found (%02x).\n", | 528 | printk(KERN_INFO "sx%d: specialix IO8+ ID %02x at 0x%03x not found (%02x).\n", |
534 | board_No(bp), val2, bp->base, val1); | 529 | board_No(bp), val2, bp->base, val1); |
530 | sx_release_io_range(bp); | ||
535 | func_exit(); | 531 | func_exit(); |
536 | return 1; | 532 | return 1; |
537 | } | 533 | } |
@@ -546,7 +542,7 @@ static int sx_probe(struct specialix_board *bp) | |||
546 | sx_wait_CCR(bp); | 542 | sx_wait_CCR(bp); |
547 | sx_out(bp, CD186x_CCR, CCR_TXEN); /* Enable transmitter */ | 543 | sx_out(bp, CD186x_CCR, CCR_TXEN); /* Enable transmitter */ |
548 | sx_out(bp, CD186x_IER, IER_TXRDY); /* Enable tx empty intr */ | 544 | sx_out(bp, CD186x_IER, IER_TXRDY); /* Enable tx empty intr */ |
549 | sx_long_delay(HZ/20); | 545 | sx_long_delay(HZ/20); |
550 | irqs = probe_irq_off(irqs); | 546 | irqs = probe_irq_off(irqs); |
551 | 547 | ||
552 | dprintk (SX_DEBUG_INIT, "SRSR = %02x, ", sx_in(bp, CD186x_SRSR)); | 548 | dprintk (SX_DEBUG_INIT, "SRSR = %02x, ", sx_in(bp, CD186x_SRSR)); |
@@ -561,14 +557,15 @@ static int sx_probe(struct specialix_board *bp) | |||
561 | } | 557 | } |
562 | 558 | ||
563 | dprintk (SX_DEBUG_INIT "val1 = %02x, val2 = %02x, val3 = %02x.\n", | 559 | dprintk (SX_DEBUG_INIT "val1 = %02x, val2 = %02x, val3 = %02x.\n", |
564 | val1, val2, val3); | 560 | val1, val2, val3); |
565 | 561 | ||
566 | } | 562 | } |
567 | 563 | ||
568 | #if 0 | 564 | #if 0 |
569 | if (irqs <= 0) { | 565 | if (irqs <= 0) { |
570 | printk(KERN_ERR "sx%d: Can't find IRQ for specialix IO8+ board at 0x%03x.\n", | 566 | printk(KERN_ERR "sx%d: Can't find IRQ for specialix IO8+ board at 0x%03x.\n", |
571 | board_No(bp), bp->base); | 567 | board_No(bp), bp->base); |
568 | sx_release_io_range(bp); | ||
572 | func_exit(); | 569 | func_exit(); |
573 | return 1; | 570 | return 1; |
574 | } | 571 | } |
@@ -579,19 +576,20 @@ static int sx_probe(struct specialix_board *bp) | |||
579 | #endif | 576 | #endif |
580 | /* Reset CD186x again */ | 577 | /* Reset CD186x again */ |
581 | if (!sx_init_CD186x(bp)) { | 578 | if (!sx_init_CD186x(bp)) { |
579 | sx_release_io_range(bp); | ||
582 | func_exit(); | 580 | func_exit(); |
583 | return -EIO; | 581 | return 1; |
584 | } | 582 | } |
585 | 583 | ||
586 | sx_request_io_range(bp); | 584 | sx_request_io_range(bp); |
587 | bp->flags |= SX_BOARD_PRESENT; | 585 | bp->flags |= SX_BOARD_PRESENT; |
588 | 586 | ||
589 | /* Chip revcode pkgtype | 587 | /* Chip revcode pkgtype |
590 | GFRCR SRCR bit 7 | 588 | GFRCR SRCR bit 7 |
591 | CD180 rev B 0x81 0 | 589 | CD180 rev B 0x81 0 |
592 | CD180 rev C 0x82 0 | 590 | CD180 rev C 0x82 0 |
593 | CD1864 rev A 0x82 1 | 591 | CD1864 rev A 0x82 1 |
594 | CD1865 rev A 0x83 1 -- Do not use!!! Does not work. | 592 | CD1865 rev A 0x83 1 -- Do not use!!! Does not work. |
595 | CD1865 rev B 0x84 1 | 593 | CD1865 rev B 0x84 1 |
596 | -- Thanks to Gwen Wang, Cirrus Logic. | 594 | -- Thanks to Gwen Wang, Cirrus Logic. |
597 | */ | 595 | */ |
@@ -623,8 +621,8 @@ static int sx_probe(struct specialix_board *bp) | |||
623 | return 0; | 621 | return 0; |
624 | } | 622 | } |
625 | 623 | ||
626 | /* | 624 | /* |
627 | * | 625 | * |
628 | * Interrupt processing routines. | 626 | * Interrupt processing routines. |
629 | * */ | 627 | * */ |
630 | 628 | ||
@@ -657,7 +655,7 @@ static inline struct specialix_port * sx_get_port(struct specialix_board * bp, | |||
657 | return port; | 655 | return port; |
658 | } | 656 | } |
659 | } | 657 | } |
660 | printk(KERN_INFO "sx%d: %s interrupt from invalid port %d\n", | 658 | printk(KERN_INFO "sx%d: %s interrupt from invalid port %d\n", |
661 | board_No(bp), what, channel); | 659 | board_No(bp), what, channel); |
662 | return NULL; | 660 | return NULL; |
663 | } | 661 | } |
@@ -681,7 +679,7 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
681 | tty = port->tty; | 679 | tty = port->tty; |
682 | dprintk (SX_DEBUG_RX, "port: %p count: %d BUFF_SIZE: %d\n", | 680 | dprintk (SX_DEBUG_RX, "port: %p count: %d BUFF_SIZE: %d\n", |
683 | port, tty->flip.count, TTY_FLIPBUF_SIZE); | 681 | port, tty->flip.count, TTY_FLIPBUF_SIZE); |
684 | 682 | ||
685 | status = sx_in(bp, CD186x_RCSR); | 683 | status = sx_in(bp, CD186x_RCSR); |
686 | 684 | ||
687 | dprintk (SX_DEBUG_RX, "status: 0x%x\n", status); | 685 | dprintk (SX_DEBUG_RX, "status: 0x%x\n", status); |
@@ -707,30 +705,30 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
707 | return; | 705 | return; |
708 | } | 706 | } |
709 | if (status & RCSR_TOUT) { | 707 | if (status & RCSR_TOUT) { |
710 | printk(KERN_INFO "sx%d: port %d: Receiver timeout. Hardware problems ?\n", | 708 | printk(KERN_INFO "sx%d: port %d: Receiver timeout. Hardware problems ?\n", |
711 | board_No(bp), port_No(port)); | 709 | board_No(bp), port_No(port)); |
712 | func_exit(); | 710 | func_exit(); |
713 | return; | 711 | return; |
714 | 712 | ||
715 | } else if (status & RCSR_BREAK) { | 713 | } else if (status & RCSR_BREAK) { |
716 | dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", | 714 | dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", |
717 | board_No(bp), port_No(port)); | 715 | board_No(bp), port_No(port)); |
718 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 716 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; |
719 | if (port->flags & ASYNC_SAK) | 717 | if (port->flags & ASYNC_SAK) |
720 | do_SAK(tty); | 718 | do_SAK(tty); |
721 | 719 | ||
722 | } else if (status & RCSR_PE) | 720 | } else if (status & RCSR_PE) |
723 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | 721 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; |
724 | 722 | ||
725 | else if (status & RCSR_FE) | 723 | else if (status & RCSR_FE) |
726 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | 724 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; |
727 | 725 | ||
728 | else if (status & RCSR_OE) | 726 | else if (status & RCSR_OE) |
729 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 727 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; |
730 | 728 | ||
731 | else | 729 | else |
732 | *tty->flip.flag_buf_ptr++ = 0; | 730 | *tty->flip.flag_buf_ptr++ = 0; |
733 | 731 | ||
734 | *tty->flip.char_buf_ptr++ = ch; | 732 | *tty->flip.char_buf_ptr++ = ch; |
735 | tty->flip.count++; | 733 | tty->flip.count++; |
736 | schedule_delayed_work(&tty->flip.work, 1); | 734 | schedule_delayed_work(&tty->flip.work, 1); |
@@ -746,18 +744,18 @@ static inline void sx_receive(struct specialix_board * bp) | |||
746 | unsigned char count; | 744 | unsigned char count; |
747 | 745 | ||
748 | func_enter(); | 746 | func_enter(); |
749 | 747 | ||
750 | if (!(port = sx_get_port(bp, "Receive"))) { | 748 | if (!(port = sx_get_port(bp, "Receive"))) { |
751 | dprintk (SX_DEBUG_RX, "Hmm, couldn't find port.\n"); | 749 | dprintk (SX_DEBUG_RX, "Hmm, couldn't find port.\n"); |
752 | func_exit(); | 750 | func_exit(); |
753 | return; | 751 | return; |
754 | } | 752 | } |
755 | tty = port->tty; | 753 | tty = port->tty; |
756 | 754 | ||
757 | count = sx_in(bp, CD186x_RDCR); | 755 | count = sx_in(bp, CD186x_RDCR); |
758 | dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); | 756 | dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); |
759 | port->hits[count > 8 ? 9 : count]++; | 757 | port->hits[count > 8 ? 9 : count]++; |
760 | 758 | ||
761 | while (count--) { | 759 | while (count--) { |
762 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 760 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { |
763 | printk(KERN_INFO "sx%d: port %d: Working around flip buffer overflow.\n", | 761 | printk(KERN_INFO "sx%d: port %d: Working around flip buffer overflow.\n", |
@@ -787,7 +785,7 @@ static inline void sx_transmit(struct specialix_board * bp) | |||
787 | } | 785 | } |
788 | dprintk (SX_DEBUG_TX, "port: %p\n", port); | 786 | dprintk (SX_DEBUG_TX, "port: %p\n", port); |
789 | tty = port->tty; | 787 | tty = port->tty; |
790 | 788 | ||
791 | if (port->IER & IER_TXEMPTY) { | 789 | if (port->IER & IER_TXEMPTY) { |
792 | /* FIFO drained */ | 790 | /* FIFO drained */ |
793 | sx_out(bp, CD186x_CAR, port_No(port)); | 791 | sx_out(bp, CD186x_CAR, port_No(port)); |
@@ -796,7 +794,7 @@ static inline void sx_transmit(struct specialix_board * bp) | |||
796 | func_exit(); | 794 | func_exit(); |
797 | return; | 795 | return; |
798 | } | 796 | } |
799 | 797 | ||
800 | if ((port->xmit_cnt <= 0 && !port->break_length) | 798 | if ((port->xmit_cnt <= 0 && !port->break_length) |
801 | || tty->stopped || tty->hw_stopped) { | 799 | || tty->stopped || tty->hw_stopped) { |
802 | sx_out(bp, CD186x_CAR, port_No(port)); | 800 | sx_out(bp, CD186x_CAR, port_No(port)); |
@@ -805,7 +803,7 @@ static inline void sx_transmit(struct specialix_board * bp) | |||
805 | func_exit(); | 803 | func_exit(); |
806 | return; | 804 | return; |
807 | } | 805 | } |
808 | 806 | ||
809 | if (port->break_length) { | 807 | if (port->break_length) { |
810 | if (port->break_length > 0) { | 808 | if (port->break_length > 0) { |
811 | if (port->COR2 & COR2_ETC) { | 809 | if (port->COR2 & COR2_ETC) { |
@@ -831,7 +829,7 @@ static inline void sx_transmit(struct specialix_board * bp) | |||
831 | func_exit(); | 829 | func_exit(); |
832 | return; | 830 | return; |
833 | } | 831 | } |
834 | 832 | ||
835 | count = CD186x_NFIFO; | 833 | count = CD186x_NFIFO; |
836 | do { | 834 | do { |
837 | sx_out(bp, CD186x_TDR, port->xmit_buf[port->xmit_tail++]); | 835 | sx_out(bp, CD186x_TDR, port->xmit_buf[port->xmit_tail++]); |
@@ -839,7 +837,7 @@ static inline void sx_transmit(struct specialix_board * bp) | |||
839 | if (--port->xmit_cnt <= 0) | 837 | if (--port->xmit_cnt <= 0) |
840 | break; | 838 | break; |
841 | } while (--count > 0); | 839 | } while (--count > 0); |
842 | 840 | ||
843 | if (port->xmit_cnt <= 0) { | 841 | if (port->xmit_cnt <= 0) { |
844 | sx_out(bp, CD186x_CAR, port_No(port)); | 842 | sx_out(bp, CD186x_CAR, port_No(port)); |
845 | port->IER &= ~IER_TXRDY; | 843 | port->IER &= ~IER_TXRDY; |
@@ -862,9 +860,9 @@ static inline void sx_check_modem(struct specialix_board * bp) | |||
862 | dprintk (SX_DEBUG_SIGNALS, "Modem intr. "); | 860 | dprintk (SX_DEBUG_SIGNALS, "Modem intr. "); |
863 | if (!(port = sx_get_port(bp, "Modem"))) | 861 | if (!(port = sx_get_port(bp, "Modem"))) |
864 | return; | 862 | return; |
865 | 863 | ||
866 | tty = port->tty; | 864 | tty = port->tty; |
867 | 865 | ||
868 | mcr = sx_in(bp, CD186x_MCR); | 866 | mcr = sx_in(bp, CD186x_MCR); |
869 | printk ("mcr = %02x.\n", mcr); | 867 | printk ("mcr = %02x.\n", mcr); |
870 | 868 | ||
@@ -879,7 +877,7 @@ static inline void sx_check_modem(struct specialix_board * bp) | |||
879 | schedule_work(&port->tqueue_hangup); | 877 | schedule_work(&port->tqueue_hangup); |
880 | } | 878 | } |
881 | } | 879 | } |
882 | 880 | ||
883 | #ifdef SPECIALIX_BRAIN_DAMAGED_CTS | 881 | #ifdef SPECIALIX_BRAIN_DAMAGED_CTS |
884 | if (mcr & MCR_CTSCHG) { | 882 | if (mcr & MCR_CTSCHG) { |
885 | if (sx_in(bp, CD186x_MSVR) & MSVR_CTS) { | 883 | if (sx_in(bp, CD186x_MSVR) & MSVR_CTS) { |
@@ -906,7 +904,7 @@ static inline void sx_check_modem(struct specialix_board * bp) | |||
906 | sx_out(bp, CD186x_IER, port->IER); | 904 | sx_out(bp, CD186x_IER, port->IER); |
907 | } | 905 | } |
908 | #endif /* SPECIALIX_BRAIN_DAMAGED_CTS */ | 906 | #endif /* SPECIALIX_BRAIN_DAMAGED_CTS */ |
909 | 907 | ||
910 | /* Clear change bits */ | 908 | /* Clear change bits */ |
911 | sx_out(bp, CD186x_MCR, 0); | 909 | sx_out(bp, CD186x_MCR, 0); |
912 | } | 910 | } |
@@ -940,7 +938,7 @@ static irqreturn_t sx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
940 | while ((++loop < 16) && (status = (sx_in(bp, CD186x_SRSR) & | 938 | while ((++loop < 16) && (status = (sx_in(bp, CD186x_SRSR) & |
941 | (SRSR_RREQint | | 939 | (SRSR_RREQint | |
942 | SRSR_TREQint | | 940 | SRSR_TREQint | |
943 | SRSR_MREQint)))) { | 941 | SRSR_MREQint)))) { |
944 | if (status & SRSR_RREQint) { | 942 | if (status & SRSR_RREQint) { |
945 | ack = sx_in(bp, CD186x_RRAR); | 943 | ack = sx_in(bp, CD186x_RRAR); |
946 | 944 | ||
@@ -951,7 +949,7 @@ static irqreturn_t sx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
951 | else | 949 | else |
952 | printk(KERN_ERR "sx%d: status: 0x%x Bad receive ack 0x%02x.\n", | 950 | printk(KERN_ERR "sx%d: status: 0x%x Bad receive ack 0x%02x.\n", |
953 | board_No(bp), status, ack); | 951 | board_No(bp), status, ack); |
954 | 952 | ||
955 | } else if (status & SRSR_TREQint) { | 953 | } else if (status & SRSR_TREQint) { |
956 | ack = sx_in(bp, CD186x_TRAR); | 954 | ack = sx_in(bp, CD186x_TRAR); |
957 | 955 | ||
@@ -963,13 +961,13 @@ static irqreturn_t sx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
963 | } else if (status & SRSR_MREQint) { | 961 | } else if (status & SRSR_MREQint) { |
964 | ack = sx_in(bp, CD186x_MRAR); | 962 | ack = sx_in(bp, CD186x_MRAR); |
965 | 963 | ||
966 | if (ack == (SX_ID | GIVR_IT_MODEM)) | 964 | if (ack == (SX_ID | GIVR_IT_MODEM)) |
967 | sx_check_modem(bp); | 965 | sx_check_modem(bp); |
968 | else | 966 | else |
969 | printk(KERN_ERR "sx%d: status: 0x%x Bad modem ack 0x%02x.\n", | 967 | printk(KERN_ERR "sx%d: status: 0x%x Bad modem ack 0x%02x.\n", |
970 | board_No(bp), status, ack); | 968 | board_No(bp), status, ack); |
971 | 969 | ||
972 | } | 970 | } |
973 | 971 | ||
974 | sx_out(bp, CD186x_EOIR, 0); /* Mark end of interrupt */ | 972 | sx_out(bp, CD186x_EOIR, 0); /* Mark end of interrupt */ |
975 | } | 973 | } |
@@ -1026,7 +1024,7 @@ static inline int sx_setup_board(struct specialix_board * bp) | |||
1026 | { | 1024 | { |
1027 | int error; | 1025 | int error; |
1028 | 1026 | ||
1029 | if (bp->flags & SX_BOARD_ACTIVE) | 1027 | if (bp->flags & SX_BOARD_ACTIVE) |
1030 | return 0; | 1028 | return 0; |
1031 | 1029 | ||
1032 | if (bp->flags & SX_BOARD_IS_PCI) | 1030 | if (bp->flags & SX_BOARD_IS_PCI) |
@@ -1034,7 +1032,7 @@ static inline int sx_setup_board(struct specialix_board * bp) | |||
1034 | else | 1032 | else |
1035 | error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT, "specialix IO8+", bp); | 1033 | error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT, "specialix IO8+", bp); |
1036 | 1034 | ||
1037 | if (error) | 1035 | if (error) |
1038 | return error; | 1036 | return error; |
1039 | 1037 | ||
1040 | turn_ints_on (bp); | 1038 | turn_ints_on (bp); |
@@ -1055,7 +1053,7 @@ static inline void sx_shutdown_board(struct specialix_board *bp) | |||
1055 | } | 1053 | } |
1056 | 1054 | ||
1057 | bp->flags &= ~SX_BOARD_ACTIVE; | 1055 | bp->flags &= ~SX_BOARD_ACTIVE; |
1058 | 1056 | ||
1059 | dprintk (SX_DEBUG_IRQ, "Freeing IRQ%d for board %d.\n", | 1057 | dprintk (SX_DEBUG_IRQ, "Freeing IRQ%d for board %d.\n", |
1060 | bp->irq, board_No (bp)); | 1058 | bp->irq, board_No (bp)); |
1061 | free_irq(bp->irq, bp); | 1059 | free_irq(bp->irq, bp); |
@@ -1068,7 +1066,7 @@ static inline void sx_shutdown_board(struct specialix_board *bp) | |||
1068 | 1066 | ||
1069 | 1067 | ||
1070 | /* | 1068 | /* |
1071 | * Setting up port characteristics. | 1069 | * Setting up port characteristics. |
1072 | * Must be called with disabled interrupts | 1070 | * Must be called with disabled interrupts |
1073 | */ | 1071 | */ |
1074 | static void sx_change_speed(struct specialix_board *bp, struct specialix_port *port) | 1072 | static void sx_change_speed(struct specialix_board *bp, struct specialix_port *port) |
@@ -1103,10 +1101,10 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1103 | spin_unlock_irqrestore(&bp->lock, flags); | 1101 | spin_unlock_irqrestore(&bp->lock, flags); |
1104 | dprintk (SX_DEBUG_TERMIOS, "sx: got MSVR=%02x.\n", port->MSVR); | 1102 | dprintk (SX_DEBUG_TERMIOS, "sx: got MSVR=%02x.\n", port->MSVR); |
1105 | baud = C_BAUD(tty); | 1103 | baud = C_BAUD(tty); |
1106 | 1104 | ||
1107 | if (baud & CBAUDEX) { | 1105 | if (baud & CBAUDEX) { |
1108 | baud &= ~CBAUDEX; | 1106 | baud &= ~CBAUDEX; |
1109 | if (baud < 1 || baud > 2) | 1107 | if (baud < 1 || baud > 2) |
1110 | port->tty->termios->c_cflag &= ~CBAUDEX; | 1108 | port->tty->termios->c_cflag &= ~CBAUDEX; |
1111 | else | 1109 | else |
1112 | baud += 15; | 1110 | baud += 15; |
@@ -1117,8 +1115,8 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1117 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 1115 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
1118 | baud += 2; | 1116 | baud += 2; |
1119 | } | 1117 | } |
1120 | 1118 | ||
1121 | 1119 | ||
1122 | if (!baud_table[baud]) { | 1120 | if (!baud_table[baud]) { |
1123 | /* Drop DTR & exit */ | 1121 | /* Drop DTR & exit */ |
1124 | dprintk (SX_DEBUG_TERMIOS, "Dropping DTR... Hmm....\n"); | 1122 | dprintk (SX_DEBUG_TERMIOS, "Dropping DTR... Hmm....\n"); |
@@ -1127,7 +1125,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1127 | spin_lock_irqsave(&bp->lock, flags); | 1125 | spin_lock_irqsave(&bp->lock, flags); |
1128 | sx_out(bp, CD186x_MSVR, port->MSVR ); | 1126 | sx_out(bp, CD186x_MSVR, port->MSVR ); |
1129 | spin_unlock_irqrestore(&bp->lock, flags); | 1127 | spin_unlock_irqrestore(&bp->lock, flags); |
1130 | } | 1128 | } |
1131 | else | 1129 | else |
1132 | dprintk (SX_DEBUG_TERMIOS, "Can't drop DTR: no DTR.\n"); | 1130 | dprintk (SX_DEBUG_TERMIOS, "Can't drop DTR: no DTR.\n"); |
1133 | return; | 1131 | return; |
@@ -1137,9 +1135,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1137 | port ->MSVR |= MSVR_DTR; | 1135 | port ->MSVR |= MSVR_DTR; |
1138 | } | 1136 | } |
1139 | } | 1137 | } |
1140 | 1138 | ||
1141 | /* | 1139 | /* |
1142 | * Now we must calculate some speed depended things | 1140 | * Now we must calculate some speed depended things |
1143 | */ | 1141 | */ |
1144 | 1142 | ||
1145 | /* Set baud rate for port */ | 1143 | /* Set baud rate for port */ |
@@ -1152,7 +1150,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1152 | tmp = (((SX_OSCFREQ + baud_table[baud]/2) / baud_table[baud] + | 1150 | tmp = (((SX_OSCFREQ + baud_table[baud]/2) / baud_table[baud] + |
1153 | CD186x_TPC/2) / CD186x_TPC); | 1151 | CD186x_TPC/2) / CD186x_TPC); |
1154 | 1152 | ||
1155 | if ((tmp < 0x10) && time_before(again, jiffies)) { | 1153 | if ((tmp < 0x10) && time_before(again, jiffies)) { |
1156 | again = jiffies + HZ * 60; | 1154 | again = jiffies + HZ * 60; |
1157 | /* Page 48 of version 2.0 of the CL-CD1865 databook */ | 1155 | /* Page 48 of version 2.0 of the CL-CD1865 databook */ |
1158 | if (tmp >= 12) { | 1156 | if (tmp >= 12) { |
@@ -1164,27 +1162,27 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1164 | printk (KERN_INFO "sx%d: Baud rate divisor is %ld. \n" | 1162 | printk (KERN_INFO "sx%d: Baud rate divisor is %ld. \n" |
1165 | "Warning: overstressing Cirrus chip. " | 1163 | "Warning: overstressing Cirrus chip. " |
1166 | "This might not work.\n" | 1164 | "This might not work.\n" |
1167 | "Read specialix.txt for more info.\n", | 1165 | "Read specialix.txt for more info.\n", |
1168 | port_No (port), tmp); | 1166 | port_No (port), tmp); |
1169 | } | 1167 | } |
1170 | } | 1168 | } |
1171 | spin_lock_irqsave(&bp->lock, flags); | 1169 | spin_lock_irqsave(&bp->lock, flags); |
1172 | sx_out(bp, CD186x_RBPRH, (tmp >> 8) & 0xff); | 1170 | sx_out(bp, CD186x_RBPRH, (tmp >> 8) & 0xff); |
1173 | sx_out(bp, CD186x_TBPRH, (tmp >> 8) & 0xff); | 1171 | sx_out(bp, CD186x_TBPRH, (tmp >> 8) & 0xff); |
1174 | sx_out(bp, CD186x_RBPRL, tmp & 0xff); | 1172 | sx_out(bp, CD186x_RBPRL, tmp & 0xff); |
1175 | sx_out(bp, CD186x_TBPRL, tmp & 0xff); | 1173 | sx_out(bp, CD186x_TBPRL, tmp & 0xff); |
1176 | spin_unlock_irqrestore(&bp->lock, flags); | 1174 | spin_unlock_irqrestore(&bp->lock, flags); |
1177 | if (port->custom_divisor) { | 1175 | if (port->custom_divisor) { |
1178 | baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor; | 1176 | baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor; |
1179 | baud = ( baud + 5 ) / 10; | 1177 | baud = ( baud + 5 ) / 10; |
1180 | } else | 1178 | } else |
1181 | baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */ | 1179 | baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */ |
1182 | 1180 | ||
1183 | /* Two timer ticks seems enough to wakeup something like SLIP driver */ | 1181 | /* Two timer ticks seems enough to wakeup something like SLIP driver */ |
1184 | tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO; | 1182 | tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO; |
1185 | port->wakeup_chars = (tmp < 0) ? 0 : ((tmp >= SERIAL_XMIT_SIZE) ? | 1183 | port->wakeup_chars = (tmp < 0) ? 0 : ((tmp >= SERIAL_XMIT_SIZE) ? |
1186 | SERIAL_XMIT_SIZE - 1 : tmp); | 1184 | SERIAL_XMIT_SIZE - 1 : tmp); |
1187 | 1185 | ||
1188 | /* Receiver timeout will be transmission time for 1.5 chars */ | 1186 | /* Receiver timeout will be transmission time for 1.5 chars */ |
1189 | tmp = (SPECIALIX_TPS + SPECIALIX_TPS/2 + baud/2) / baud; | 1187 | tmp = (SPECIALIX_TPS + SPECIALIX_TPS/2 + baud/2) / baud; |
1190 | tmp = (tmp > 0xff) ? 0xff : tmp; | 1188 | tmp = (tmp > 0xff) ? 0xff : tmp; |
@@ -1205,29 +1203,29 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1205 | cor1 |= COR1_8BITS; | 1203 | cor1 |= COR1_8BITS; |
1206 | break; | 1204 | break; |
1207 | } | 1205 | } |
1208 | 1206 | ||
1209 | if (C_CSTOPB(tty)) | 1207 | if (C_CSTOPB(tty)) |
1210 | cor1 |= COR1_2SB; | 1208 | cor1 |= COR1_2SB; |
1211 | 1209 | ||
1212 | cor1 |= COR1_IGNORE; | 1210 | cor1 |= COR1_IGNORE; |
1213 | if (C_PARENB(tty)) { | 1211 | if (C_PARENB(tty)) { |
1214 | cor1 |= COR1_NORMPAR; | 1212 | cor1 |= COR1_NORMPAR; |
1215 | if (C_PARODD(tty)) | 1213 | if (C_PARODD(tty)) |
1216 | cor1 |= COR1_ODDP; | 1214 | cor1 |= COR1_ODDP; |
1217 | if (I_INPCK(tty)) | 1215 | if (I_INPCK(tty)) |
1218 | cor1 &= ~COR1_IGNORE; | 1216 | cor1 &= ~COR1_IGNORE; |
1219 | } | 1217 | } |
1220 | /* Set marking of some errors */ | 1218 | /* Set marking of some errors */ |
1221 | port->mark_mask = RCSR_OE | RCSR_TOUT; | 1219 | port->mark_mask = RCSR_OE | RCSR_TOUT; |
1222 | if (I_INPCK(tty)) | 1220 | if (I_INPCK(tty)) |
1223 | port->mark_mask |= RCSR_FE | RCSR_PE; | 1221 | port->mark_mask |= RCSR_FE | RCSR_PE; |
1224 | if (I_BRKINT(tty) || I_PARMRK(tty)) | 1222 | if (I_BRKINT(tty) || I_PARMRK(tty)) |
1225 | port->mark_mask |= RCSR_BREAK; | 1223 | port->mark_mask |= RCSR_BREAK; |
1226 | if (I_IGNPAR(tty)) | 1224 | if (I_IGNPAR(tty)) |
1227 | port->mark_mask &= ~(RCSR_FE | RCSR_PE); | 1225 | port->mark_mask &= ~(RCSR_FE | RCSR_PE); |
1228 | if (I_IGNBRK(tty)) { | 1226 | if (I_IGNBRK(tty)) { |
1229 | port->mark_mask &= ~RCSR_BREAK; | 1227 | port->mark_mask &= ~RCSR_BREAK; |
1230 | if (I_IGNPAR(tty)) | 1228 | if (I_IGNPAR(tty)) |
1231 | /* Real raw mode. Ignore all */ | 1229 | /* Real raw mode. Ignore all */ |
1232 | port->mark_mask &= ~RCSR_OE; | 1230 | port->mark_mask &= ~RCSR_OE; |
1233 | } | 1231 | } |
@@ -1241,7 +1239,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1241 | tty->hw_stopped = !(sx_in(bp, CD186x_MSVR) & (MSVR_CTS|MSVR_DSR)); | 1239 | tty->hw_stopped = !(sx_in(bp, CD186x_MSVR) & (MSVR_CTS|MSVR_DSR)); |
1242 | spin_unlock_irqrestore(&bp->lock, flags); | 1240 | spin_unlock_irqrestore(&bp->lock, flags); |
1243 | #else | 1241 | #else |
1244 | port->COR2 |= COR2_CTSAE; | 1242 | port->COR2 |= COR2_CTSAE; |
1245 | #endif | 1243 | #endif |
1246 | } | 1244 | } |
1247 | /* Enable Software Flow Control. FIXME: I'm not sure about this */ | 1245 | /* Enable Software Flow Control. FIXME: I'm not sure about this */ |
@@ -1264,11 +1262,11 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1264 | mcor1 |= MCOR1_CDZD; | 1262 | mcor1 |= MCOR1_CDZD; |
1265 | mcor2 |= MCOR2_CDOD; | 1263 | mcor2 |= MCOR2_CDOD; |
1266 | } | 1264 | } |
1267 | 1265 | ||
1268 | if (C_CREAD(tty)) | 1266 | if (C_CREAD(tty)) |
1269 | /* Enable receiver */ | 1267 | /* Enable receiver */ |
1270 | port->IER |= IER_RXD; | 1268 | port->IER |= IER_RXD; |
1271 | 1269 | ||
1272 | /* Set input FIFO size (1-8 bytes) */ | 1270 | /* Set input FIFO size (1-8 bytes) */ |
1273 | cor3 |= sx_rxfifo; | 1271 | cor3 |= sx_rxfifo; |
1274 | /* Setting up CD186x channel registers */ | 1272 | /* Setting up CD186x channel registers */ |
@@ -1311,11 +1309,11 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port | |||
1311 | func_exit(); | 1309 | func_exit(); |
1312 | return 0; | 1310 | return 0; |
1313 | } | 1311 | } |
1314 | 1312 | ||
1315 | if (!port->xmit_buf) { | 1313 | if (!port->xmit_buf) { |
1316 | /* We may sleep in get_zeroed_page() */ | 1314 | /* We may sleep in get_zeroed_page() */ |
1317 | unsigned long tmp; | 1315 | unsigned long tmp; |
1318 | 1316 | ||
1319 | if (!(tmp = get_zeroed_page(GFP_KERNEL))) { | 1317 | if (!(tmp = get_zeroed_page(GFP_KERNEL))) { |
1320 | func_exit(); | 1318 | func_exit(); |
1321 | return -ENOMEM; | 1319 | return -ENOMEM; |
@@ -1328,10 +1326,10 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port | |||
1328 | } | 1326 | } |
1329 | port->xmit_buf = (unsigned char *) tmp; | 1327 | port->xmit_buf = (unsigned char *) tmp; |
1330 | } | 1328 | } |
1331 | 1329 | ||
1332 | spin_lock_irqsave(&port->lock, flags); | 1330 | spin_lock_irqsave(&port->lock, flags); |
1333 | 1331 | ||
1334 | if (port->tty) | 1332 | if (port->tty) |
1335 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 1333 | clear_bit(TTY_IO_ERROR, &port->tty->flags); |
1336 | 1334 | ||
1337 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 1335 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
@@ -1340,7 +1338,7 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port | |||
1340 | 1338 | ||
1341 | spin_unlock_irqrestore(&port->lock, flags); | 1339 | spin_unlock_irqrestore(&port->lock, flags); |
1342 | 1340 | ||
1343 | 1341 | ||
1344 | func_exit(); | 1342 | func_exit(); |
1345 | return 0; | 1343 | return 0; |
1346 | } | 1344 | } |
@@ -1352,14 +1350,14 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port * | |||
1352 | struct tty_struct *tty; | 1350 | struct tty_struct *tty; |
1353 | int i; | 1351 | int i; |
1354 | unsigned long flags; | 1352 | unsigned long flags; |
1355 | 1353 | ||
1356 | func_enter(); | 1354 | func_enter(); |
1357 | 1355 | ||
1358 | if (!(port->flags & ASYNC_INITIALIZED)) { | 1356 | if (!(port->flags & ASYNC_INITIALIZED)) { |
1359 | func_exit(); | 1357 | func_exit(); |
1360 | return; | 1358 | return; |
1361 | } | 1359 | } |
1362 | 1360 | ||
1363 | if (sx_debug & SX_DEBUG_FIFO) { | 1361 | if (sx_debug & SX_DEBUG_FIFO) { |
1364 | dprintk(SX_DEBUG_FIFO, "sx%d: port %d: %ld overruns, FIFO hits [ ", | 1362 | dprintk(SX_DEBUG_FIFO, "sx%d: port %d: %ld overruns, FIFO hits [ ", |
1365 | board_No(bp), port_No(port), port->overrun); | 1363 | board_No(bp), port_No(port), port->overrun); |
@@ -1394,13 +1392,13 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port * | |||
1394 | if (tty) | 1392 | if (tty) |
1395 | set_bit(TTY_IO_ERROR, &tty->flags); | 1393 | set_bit(TTY_IO_ERROR, &tty->flags); |
1396 | port->flags &= ~ASYNC_INITIALIZED; | 1394 | port->flags &= ~ASYNC_INITIALIZED; |
1397 | 1395 | ||
1398 | if (!bp->count) | 1396 | if (!bp->count) |
1399 | sx_shutdown_board(bp); | 1397 | sx_shutdown_board(bp); |
1400 | func_exit(); | 1398 | func_exit(); |
1401 | } | 1399 | } |
1402 | 1400 | ||
1403 | 1401 | ||
1404 | static int block_til_ready(struct tty_struct *tty, struct file * filp, | 1402 | static int block_til_ready(struct tty_struct *tty, struct file * filp, |
1405 | struct specialix_port *port) | 1403 | struct specialix_port *port) |
1406 | { | 1404 | { |
@@ -1427,7 +1425,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1427 | return -ERESTARTSYS; | 1425 | return -ERESTARTSYS; |
1428 | } | 1426 | } |
1429 | } | 1427 | } |
1430 | 1428 | ||
1431 | /* | 1429 | /* |
1432 | * If non-blocking mode is set, or the port is not enabled, | 1430 | * If non-blocking mode is set, or the port is not enabled, |
1433 | * then make the check up front and then exit. | 1431 | * then make the check up front and then exit. |
@@ -1477,7 +1475,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1477 | if (port->flags & ASYNC_HUP_NOTIFY) | 1475 | if (port->flags & ASYNC_HUP_NOTIFY) |
1478 | retval = -EAGAIN; | 1476 | retval = -EAGAIN; |
1479 | else | 1477 | else |
1480 | retval = -ERESTARTSYS; | 1478 | retval = -ERESTARTSYS; |
1481 | break; | 1479 | break; |
1482 | } | 1480 | } |
1483 | if (!(port->flags & ASYNC_CLOSING) && | 1481 | if (!(port->flags & ASYNC_CLOSING) && |
@@ -1506,7 +1504,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1506 | port->flags |= ASYNC_NORMAL_ACTIVE; | 1504 | port->flags |= ASYNC_NORMAL_ACTIVE; |
1507 | func_exit(); | 1505 | func_exit(); |
1508 | return 0; | 1506 | return 0; |
1509 | } | 1507 | } |
1510 | 1508 | ||
1511 | 1509 | ||
1512 | static int sx_open(struct tty_struct * tty, struct file * filp) | 1510 | static int sx_open(struct tty_struct * tty, struct file * filp) |
@@ -1526,7 +1524,7 @@ static int sx_open(struct tty_struct * tty, struct file * filp) | |||
1526 | func_exit(); | 1524 | func_exit(); |
1527 | return -ENODEV; | 1525 | return -ENODEV; |
1528 | } | 1526 | } |
1529 | 1527 | ||
1530 | bp = &sx_board[board]; | 1528 | bp = &sx_board[board]; |
1531 | port = sx_port + board * SX_NPORT + SX_PORT(tty->index); | 1529 | port = sx_port + board * SX_NPORT + SX_PORT(tty->index); |
1532 | port->overrun = 0; | 1530 | port->overrun = 0; |
@@ -1557,7 +1555,7 @@ static int sx_open(struct tty_struct * tty, struct file * filp) | |||
1557 | func_enter(); | 1555 | func_enter(); |
1558 | return error; | 1556 | return error; |
1559 | } | 1557 | } |
1560 | 1558 | ||
1561 | if ((error = block_til_ready(tty, filp, port))) { | 1559 | if ((error = block_til_ready(tty, filp, port))) { |
1562 | func_enter(); | 1560 | func_enter(); |
1563 | return error; | 1561 | return error; |
@@ -1574,7 +1572,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1574 | struct specialix_board *bp; | 1572 | struct specialix_board *bp; |
1575 | unsigned long flags; | 1573 | unsigned long flags; |
1576 | unsigned long timeout; | 1574 | unsigned long timeout; |
1577 | 1575 | ||
1578 | func_enter(); | 1576 | func_enter(); |
1579 | if (!port || sx_paranoia_check(port, tty->name, "close")) { | 1577 | if (!port || sx_paranoia_check(port, tty->name, "close")) { |
1580 | func_exit(); | 1578 | func_exit(); |
@@ -1587,7 +1585,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1587 | func_exit(); | 1585 | func_exit(); |
1588 | return; | 1586 | return; |
1589 | } | 1587 | } |
1590 | 1588 | ||
1591 | bp = port_Board(port); | 1589 | bp = port_Board(port); |
1592 | if ((tty->count == 1) && (port->count != 1)) { | 1590 | if ((tty->count == 1) && (port->count != 1)) { |
1593 | printk(KERN_ERR "sx%d: sx_close: bad port count;" | 1591 | printk(KERN_ERR "sx%d: sx_close: bad port count;" |
@@ -1607,7 +1605,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1607 | } | 1605 | } |
1608 | port->flags |= ASYNC_CLOSING; | 1606 | port->flags |= ASYNC_CLOSING; |
1609 | /* | 1607 | /* |
1610 | * Now we wait for the transmit buffer to clear; and we notify | 1608 | * Now we wait for the transmit buffer to clear; and we notify |
1611 | * the line discipline to only process XON/XOFF characters. | 1609 | * the line discipline to only process XON/XOFF characters. |
1612 | */ | 1610 | */ |
1613 | tty->closing = 1; | 1611 | tty->closing = 1; |
@@ -1681,7 +1679,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1681 | } | 1679 | } |
1682 | 1680 | ||
1683 | 1681 | ||
1684 | static int sx_write(struct tty_struct * tty, | 1682 | static int sx_write(struct tty_struct * tty, |
1685 | const unsigned char *buf, int count) | 1683 | const unsigned char *buf, int count) |
1686 | { | 1684 | { |
1687 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; | 1685 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; |
@@ -1694,7 +1692,7 @@ static int sx_write(struct tty_struct * tty, | |||
1694 | func_exit(); | 1692 | func_exit(); |
1695 | return 0; | 1693 | return 0; |
1696 | } | 1694 | } |
1697 | 1695 | ||
1698 | bp = port_Board(port); | 1696 | bp = port_Board(port); |
1699 | 1697 | ||
1700 | if (!tty || !port->xmit_buf || !tmp_buf) { | 1698 | if (!tty || !port->xmit_buf || !tmp_buf) { |
@@ -1824,7 +1822,7 @@ static int sx_chars_in_buffer(struct tty_struct *tty) | |||
1824 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; | 1822 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; |
1825 | 1823 | ||
1826 | func_enter(); | 1824 | func_enter(); |
1827 | 1825 | ||
1828 | if (sx_paranoia_check(port, tty->name, "sx_chars_in_buffer")) { | 1826 | if (sx_paranoia_check(port, tty->name, "sx_chars_in_buffer")) { |
1829 | func_exit(); | 1827 | func_exit(); |
1830 | return 0; | 1828 | return 0; |
@@ -1881,13 +1879,13 @@ static int sx_tiocmget(struct tty_struct *tty, struct file *file) | |||
1881 | port_No(port), status, sx_in (bp, CD186x_CAR)); | 1879 | port_No(port), status, sx_in (bp, CD186x_CAR)); |
1882 | dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port); | 1880 | dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port); |
1883 | if (SX_CRTSCTS(port->tty)) { | 1881 | if (SX_CRTSCTS(port->tty)) { |
1884 | result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */ | 1882 | result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */ |
1885 | | ((status & MSVR_DTR) ? TIOCM_RTS : 0) | 1883 | | ((status & MSVR_DTR) ? TIOCM_RTS : 0) |
1886 | | ((status & MSVR_CD) ? TIOCM_CAR : 0) | 1884 | | ((status & MSVR_CD) ? TIOCM_CAR : 0) |
1887 | |/* ((status & MSVR_DSR) ? */ TIOCM_DSR /* : 0) */ | 1885 | |/* ((status & MSVR_DSR) ? */ TIOCM_DSR /* : 0) */ |
1888 | | ((status & MSVR_CTS) ? TIOCM_CTS : 0); | 1886 | | ((status & MSVR_CTS) ? TIOCM_CTS : 0); |
1889 | } else { | 1887 | } else { |
1890 | result = /* (status & MSVR_RTS) ? */ TIOCM_RTS /* : 0) */ | 1888 | result = /* (status & MSVR_RTS) ? */ TIOCM_RTS /* : 0) */ |
1891 | | ((status & MSVR_DTR) ? TIOCM_DTR : 0) | 1889 | | ((status & MSVR_DTR) ? TIOCM_DTR : 0) |
1892 | | ((status & MSVR_CD) ? TIOCM_CAR : 0) | 1890 | | ((status & MSVR_CD) ? TIOCM_CAR : 0) |
1893 | |/* ((status & MSVR_DSR) ? */ TIOCM_DSR /* : 0) */ | 1891 | |/* ((status & MSVR_DSR) ? */ TIOCM_DSR /* : 0) */ |
@@ -1955,7 +1953,7 @@ static inline void sx_send_break(struct specialix_port * port, unsigned long len | |||
1955 | { | 1953 | { |
1956 | struct specialix_board *bp = port_Board(port); | 1954 | struct specialix_board *bp = port_Board(port); |
1957 | unsigned long flags; | 1955 | unsigned long flags; |
1958 | 1956 | ||
1959 | func_enter(); | 1957 | func_enter(); |
1960 | 1958 | ||
1961 | spin_lock_irqsave (&port->lock, flags); | 1959 | spin_lock_irqsave (&port->lock, flags); |
@@ -1996,8 +1994,8 @@ static inline int sx_set_serial_info(struct specialix_port * port, | |||
1996 | func_enter(); | 1994 | func_enter(); |
1997 | return -EFAULT; | 1995 | return -EFAULT; |
1998 | } | 1996 | } |
1999 | 1997 | ||
2000 | #if 0 | 1998 | #if 0 |
2001 | if ((tmp.irq != bp->irq) || | 1999 | if ((tmp.irq != bp->irq) || |
2002 | (tmp.port != bp->base) || | 2000 | (tmp.port != bp->base) || |
2003 | (tmp.type != PORT_CIRRUS) || | 2001 | (tmp.type != PORT_CIRRUS) || |
@@ -2008,12 +2006,12 @@ static inline int sx_set_serial_info(struct specialix_port * port, | |||
2008 | func_exit(); | 2006 | func_exit(); |
2009 | return -EINVAL; | 2007 | return -EINVAL; |
2010 | } | 2008 | } |
2011 | #endif | 2009 | #endif |
2012 | 2010 | ||
2013 | change_speed = ((port->flags & ASYNC_SPD_MASK) != | 2011 | change_speed = ((port->flags & ASYNC_SPD_MASK) != |
2014 | (tmp.flags & ASYNC_SPD_MASK)); | 2012 | (tmp.flags & ASYNC_SPD_MASK)); |
2015 | change_speed |= (tmp.custom_divisor != port->custom_divisor); | 2013 | change_speed |= (tmp.custom_divisor != port->custom_divisor); |
2016 | 2014 | ||
2017 | if (!capable(CAP_SYS_ADMIN)) { | 2015 | if (!capable(CAP_SYS_ADMIN)) { |
2018 | if ((tmp.close_delay != port->close_delay) || | 2016 | if ((tmp.close_delay != port->close_delay) || |
2019 | (tmp.closing_wait != port->closing_wait) || | 2017 | (tmp.closing_wait != port->closing_wait) || |
@@ -2045,7 +2043,7 @@ static inline int sx_get_serial_info(struct specialix_port * port, | |||
2045 | { | 2043 | { |
2046 | struct serial_struct tmp; | 2044 | struct serial_struct tmp; |
2047 | struct specialix_board *bp = port_Board(port); | 2045 | struct specialix_board *bp = port_Board(port); |
2048 | 2046 | ||
2049 | func_enter(); | 2047 | func_enter(); |
2050 | 2048 | ||
2051 | /* | 2049 | /* |
@@ -2074,7 +2072,7 @@ static inline int sx_get_serial_info(struct specialix_port * port, | |||
2074 | } | 2072 | } |
2075 | 2073 | ||
2076 | 2074 | ||
2077 | static int sx_ioctl(struct tty_struct * tty, struct file * filp, | 2075 | static int sx_ioctl(struct tty_struct * tty, struct file * filp, |
2078 | unsigned int cmd, unsigned long arg) | 2076 | unsigned int cmd, unsigned long arg) |
2079 | { | 2077 | { |
2080 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; | 2078 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; |
@@ -2087,7 +2085,7 @@ static int sx_ioctl(struct tty_struct * tty, struct file * filp, | |||
2087 | func_exit(); | 2085 | func_exit(); |
2088 | return -ENODEV; | 2086 | return -ENODEV; |
2089 | } | 2087 | } |
2090 | 2088 | ||
2091 | switch (cmd) { | 2089 | switch (cmd) { |
2092 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 2090 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
2093 | retval = tty_check_change(tty); | 2091 | retval = tty_check_change(tty); |
@@ -2129,7 +2127,7 @@ static int sx_ioctl(struct tty_struct * tty, struct file * filp, | |||
2129 | case TIOCGSERIAL: | 2127 | case TIOCGSERIAL: |
2130 | func_exit(); | 2128 | func_exit(); |
2131 | return sx_get_serial_info(port, argp); | 2129 | return sx_get_serial_info(port, argp); |
2132 | case TIOCSSERIAL: | 2130 | case TIOCSSERIAL: |
2133 | func_exit(); | 2131 | func_exit(); |
2134 | return sx_set_serial_info(port, argp); | 2132 | return sx_set_serial_info(port, argp); |
2135 | default: | 2133 | default: |
@@ -2153,16 +2151,16 @@ static void sx_throttle(struct tty_struct * tty) | |||
2153 | func_exit(); | 2151 | func_exit(); |
2154 | return; | 2152 | return; |
2155 | } | 2153 | } |
2156 | 2154 | ||
2157 | bp = port_Board(port); | 2155 | bp = port_Board(port); |
2158 | 2156 | ||
2159 | /* Use DTR instead of RTS ! */ | 2157 | /* Use DTR instead of RTS ! */ |
2160 | if (SX_CRTSCTS (tty)) | 2158 | if (SX_CRTSCTS (tty)) |
2161 | port->MSVR &= ~MSVR_DTR; | 2159 | port->MSVR &= ~MSVR_DTR; |
2162 | else { | 2160 | else { |
2163 | /* Auch!!! I think the system shouldn't call this then. */ | 2161 | /* Auch!!! I think the system shouldn't call this then. */ |
2164 | /* Or maybe we're supposed (allowed?) to do our side of hw | 2162 | /* Or maybe we're supposed (allowed?) to do our side of hw |
2165 | handshake anyway, even when hardware handshake is off. | 2163 | handshake anyway, even when hardware handshake is off. |
2166 | When you see this in your logs, please report.... */ | 2164 | When you see this in your logs, please report.... */ |
2167 | printk (KERN_ERR "sx%d: Need to throttle, but can't (hardware hs is off)\n", | 2165 | printk (KERN_ERR "sx%d: Need to throttle, but can't (hardware hs is off)\n", |
2168 | port_No (port)); | 2166 | port_No (port)); |
@@ -2193,14 +2191,14 @@ static void sx_unthrottle(struct tty_struct * tty) | |||
2193 | unsigned long flags; | 2191 | unsigned long flags; |
2194 | 2192 | ||
2195 | func_enter(); | 2193 | func_enter(); |
2196 | 2194 | ||
2197 | if (sx_paranoia_check(port, tty->name, "sx_unthrottle")) { | 2195 | if (sx_paranoia_check(port, tty->name, "sx_unthrottle")) { |
2198 | func_exit(); | 2196 | func_exit(); |
2199 | return; | 2197 | return; |
2200 | } | 2198 | } |
2201 | 2199 | ||
2202 | bp = port_Board(port); | 2200 | bp = port_Board(port); |
2203 | 2201 | ||
2204 | spin_lock_irqsave(&port->lock, flags); | 2202 | spin_lock_irqsave(&port->lock, flags); |
2205 | /* XXXX Use DTR INSTEAD???? */ | 2203 | /* XXXX Use DTR INSTEAD???? */ |
2206 | if (SX_CRTSCTS(tty)) { | 2204 | if (SX_CRTSCTS(tty)) { |
@@ -2234,14 +2232,14 @@ static void sx_stop(struct tty_struct * tty) | |||
2234 | unsigned long flags; | 2232 | unsigned long flags; |
2235 | 2233 | ||
2236 | func_enter(); | 2234 | func_enter(); |
2237 | 2235 | ||
2238 | if (sx_paranoia_check(port, tty->name, "sx_stop")) { | 2236 | if (sx_paranoia_check(port, tty->name, "sx_stop")) { |
2239 | func_exit(); | 2237 | func_exit(); |
2240 | return; | 2238 | return; |
2241 | } | 2239 | } |
2242 | 2240 | ||
2243 | bp = port_Board(port); | 2241 | bp = port_Board(port); |
2244 | 2242 | ||
2245 | spin_lock_irqsave(&port->lock, flags); | 2243 | spin_lock_irqsave(&port->lock, flags); |
2246 | port->IER &= ~IER_TXRDY; | 2244 | port->IER &= ~IER_TXRDY; |
2247 | spin_lock_irqsave(&bp->lock, flags); | 2245 | spin_lock_irqsave(&bp->lock, flags); |
@@ -2261,14 +2259,14 @@ static void sx_start(struct tty_struct * tty) | |||
2261 | unsigned long flags; | 2259 | unsigned long flags; |
2262 | 2260 | ||
2263 | func_enter(); | 2261 | func_enter(); |
2264 | 2262 | ||
2265 | if (sx_paranoia_check(port, tty->name, "sx_start")) { | 2263 | if (sx_paranoia_check(port, tty->name, "sx_start")) { |
2266 | func_exit(); | 2264 | func_exit(); |
2267 | return; | 2265 | return; |
2268 | } | 2266 | } |
2269 | 2267 | ||
2270 | bp = port_Board(port); | 2268 | bp = port_Board(port); |
2271 | 2269 | ||
2272 | spin_lock_irqsave(&port->lock, flags); | 2270 | spin_lock_irqsave(&port->lock, flags); |
2273 | if (port->xmit_cnt && port->xmit_buf && !(port->IER & IER_TXRDY)) { | 2271 | if (port->xmit_cnt && port->xmit_buf && !(port->IER & IER_TXRDY)) { |
2274 | port->IER |= IER_TXRDY; | 2272 | port->IER |= IER_TXRDY; |
@@ -2290,13 +2288,13 @@ static void sx_start(struct tty_struct * tty) | |||
2290 | * | 2288 | * |
2291 | * serial interrupt routine -> (workqueue) -> | 2289 | * serial interrupt routine -> (workqueue) -> |
2292 | * do_sx_hangup() -> tty->hangup() -> sx_hangup() | 2290 | * do_sx_hangup() -> tty->hangup() -> sx_hangup() |
2293 | * | 2291 | * |
2294 | */ | 2292 | */ |
2295 | static void do_sx_hangup(void *private_) | 2293 | static void do_sx_hangup(void *private_) |
2296 | { | 2294 | { |
2297 | struct specialix_port *port = (struct specialix_port *) private_; | 2295 | struct specialix_port *port = (struct specialix_port *) private_; |
2298 | struct tty_struct *tty; | 2296 | struct tty_struct *tty; |
2299 | 2297 | ||
2300 | func_enter(); | 2298 | func_enter(); |
2301 | 2299 | ||
2302 | tty = port->tty; | 2300 | tty = port->tty; |
@@ -2319,9 +2317,9 @@ static void sx_hangup(struct tty_struct * tty) | |||
2319 | func_exit(); | 2317 | func_exit(); |
2320 | return; | 2318 | return; |
2321 | } | 2319 | } |
2322 | 2320 | ||
2323 | bp = port_Board(port); | 2321 | bp = port_Board(port); |
2324 | 2322 | ||
2325 | sx_shutdown_port(bp, port); | 2323 | sx_shutdown_port(bp, port); |
2326 | spin_lock_irqsave(&port->lock, flags); | 2324 | spin_lock_irqsave(&port->lock, flags); |
2327 | port->event = 0; | 2325 | port->event = 0; |
@@ -2346,10 +2344,10 @@ static void sx_set_termios(struct tty_struct * tty, struct termios * old_termios | |||
2346 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; | 2344 | struct specialix_port *port = (struct specialix_port *)tty->driver_data; |
2347 | unsigned long flags; | 2345 | unsigned long flags; |
2348 | struct specialix_board * bp; | 2346 | struct specialix_board * bp; |
2349 | 2347 | ||
2350 | if (sx_paranoia_check(port, tty->name, "sx_set_termios")) | 2348 | if (sx_paranoia_check(port, tty->name, "sx_set_termios")) |
2351 | return; | 2349 | return; |
2352 | 2350 | ||
2353 | if (tty->termios->c_cflag == old_termios->c_cflag && | 2351 | if (tty->termios->c_cflag == old_termios->c_cflag && |
2354 | tty->termios->c_iflag == old_termios->c_iflag) | 2352 | tty->termios->c_iflag == old_termios->c_iflag) |
2355 | return; | 2353 | return; |
@@ -2420,7 +2418,7 @@ static int sx_init_drivers(void) | |||
2420 | func_exit(); | 2418 | func_exit(); |
2421 | return 1; | 2419 | return 1; |
2422 | } | 2420 | } |
2423 | 2421 | ||
2424 | if (!(tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL))) { | 2422 | if (!(tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL))) { |
2425 | printk(KERN_ERR "sx: Couldn't get free page.\n"); | 2423 | printk(KERN_ERR "sx: Couldn't get free page.\n"); |
2426 | put_tty_driver(specialix_driver); | 2424 | put_tty_driver(specialix_driver); |
@@ -2457,7 +2455,7 @@ static int sx_init_drivers(void) | |||
2457 | init_waitqueue_head(&sx_port[i].close_wait); | 2455 | init_waitqueue_head(&sx_port[i].close_wait); |
2458 | spin_lock_init(&sx_port[i].lock); | 2456 | spin_lock_init(&sx_port[i].lock); |
2459 | } | 2457 | } |
2460 | 2458 | ||
2461 | func_exit(); | 2459 | func_exit(); |
2462 | return 0; | 2460 | return 0; |
2463 | } | 2461 | } |
@@ -2472,8 +2470,8 @@ static void sx_release_drivers(void) | |||
2472 | func_exit(); | 2470 | func_exit(); |
2473 | } | 2471 | } |
2474 | 2472 | ||
2475 | /* | 2473 | /* |
2476 | * This routine must be called by kernel at boot time | 2474 | * This routine must be called by kernel at boot time |
2477 | */ | 2475 | */ |
2478 | static int __init specialix_init(void) | 2476 | static int __init specialix_init(void) |
2479 | { | 2477 | { |
@@ -2489,7 +2487,7 @@ static int __init specialix_init(void) | |||
2489 | #else | 2487 | #else |
2490 | printk (KERN_INFO "sx: DTR/RTS pin is RTS when CRTSCTS is on.\n"); | 2488 | printk (KERN_INFO "sx: DTR/RTS pin is RTS when CRTSCTS is on.\n"); |
2491 | #endif | 2489 | #endif |
2492 | 2490 | ||
2493 | for (i = 0; i < SX_NBOARD; i++) | 2491 | for (i = 0; i < SX_NBOARD; i++) |
2494 | sx_board[i].lock = SPIN_LOCK_UNLOCKED; | 2492 | sx_board[i].lock = SPIN_LOCK_UNLOCKED; |
2495 | 2493 | ||
@@ -2498,7 +2496,7 @@ static int __init specialix_init(void) | |||
2498 | return -EIO; | 2496 | return -EIO; |
2499 | } | 2497 | } |
2500 | 2498 | ||
2501 | for (i = 0; i < SX_NBOARD; i++) | 2499 | for (i = 0; i < SX_NBOARD; i++) |
2502 | if (sx_board[i].base && !sx_probe(&sx_board[i])) | 2500 | if (sx_board[i].base && !sx_probe(&sx_board[i])) |
2503 | found++; | 2501 | found++; |
2504 | 2502 | ||
@@ -2512,8 +2510,8 @@ static int __init specialix_init(void) | |||
2512 | i++; | 2510 | i++; |
2513 | continue; | 2511 | continue; |
2514 | } | 2512 | } |
2515 | pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, | 2513 | pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, |
2516 | PCI_DEVICE_ID_SPECIALIX_IO8, | 2514 | PCI_DEVICE_ID_SPECIALIX_IO8, |
2517 | pdev); | 2515 | pdev); |
2518 | if (!pdev) break; | 2516 | if (!pdev) break; |
2519 | 2517 | ||
@@ -2557,10 +2555,10 @@ module_param(sx_poll, int, 0); | |||
2557 | /* | 2555 | /* |
2558 | * You can setup up to 4 boards. | 2556 | * You can setup up to 4 boards. |
2559 | * by specifying "iobase=0xXXX,0xXXX ..." as insmod parameter. | 2557 | * by specifying "iobase=0xXXX,0xXXX ..." as insmod parameter. |
2560 | * You should specify the IRQs too in that case "irq=....,...". | 2558 | * You should specify the IRQs too in that case "irq=....,...". |
2561 | * | 2559 | * |
2562 | * More than 4 boards in one computer is not possible, as the card can | 2560 | * More than 4 boards in one computer is not possible, as the card can |
2563 | * only use 4 different interrupts. | 2561 | * only use 4 different interrupts. |
2564 | * | 2562 | * |
2565 | */ | 2563 | */ |
2566 | static int __init specialix_init_module(void) | 2564 | static int __init specialix_init_module(void) |
@@ -2583,16 +2581,16 @@ static int __init specialix_init_module(void) | |||
2583 | 2581 | ||
2584 | return specialix_init(); | 2582 | return specialix_init(); |
2585 | } | 2583 | } |
2586 | 2584 | ||
2587 | static void __exit specialix_exit_module(void) | 2585 | static void __exit specialix_exit_module(void) |
2588 | { | 2586 | { |
2589 | int i; | 2587 | int i; |
2590 | 2588 | ||
2591 | func_enter(); | 2589 | func_enter(); |
2592 | 2590 | ||
2593 | sx_release_drivers(); | 2591 | sx_release_drivers(); |
2594 | for (i = 0; i < SX_NBOARD; i++) | 2592 | for (i = 0; i < SX_NBOARD; i++) |
2595 | if (sx_board[i].flags & SX_BOARD_PRESENT) | 2593 | if (sx_board[i].flags & SX_BOARD_PRESENT) |
2596 | sx_release_io_range(&sx_board[i]); | 2594 | sx_release_io_range(&sx_board[i]); |
2597 | #ifdef SPECIALIX_TIMER | 2595 | #ifdef SPECIALIX_TIMER |
2598 | del_timer (&missed_irq_timer); | 2596 | del_timer (&missed_irq_timer); |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index ea2d54be4843..0133dc0e25d0 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -912,6 +912,7 @@ MODULE_DEVICE_TABLE(pci, synclink_pci_tbl); | |||
912 | MODULE_LICENSE("GPL"); | 912 | MODULE_LICENSE("GPL"); |
913 | 913 | ||
914 | static struct pci_driver synclink_pci_driver = { | 914 | static struct pci_driver synclink_pci_driver = { |
915 | .owner = THIS_MODULE, | ||
915 | .name = "synclink", | 916 | .name = "synclink", |
916 | .id_table = synclink_pci_tbl, | 917 | .id_table = synclink_pci_tbl, |
917 | .probe = synclink_init_one, | 918 | .probe = synclink_init_one, |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 6fb165cf8a61..f185724448b1 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -500,6 +500,7 @@ MODULE_DEVICE_TABLE(pci, synclinkmp_pci_tbl); | |||
500 | MODULE_LICENSE("GPL"); | 500 | MODULE_LICENSE("GPL"); |
501 | 501 | ||
502 | static struct pci_driver synclinkmp_pci_driver = { | 502 | static struct pci_driver synclinkmp_pci_driver = { |
503 | .owner = THIS_MODULE, | ||
503 | .name = "synclinkmp", | 504 | .name = "synclinkmp", |
504 | .id_table = synclinkmp_pci_tbl, | 505 | .id_table = synclinkmp_pci_tbl, |
505 | .probe = synclinkmp_init_one, | 506 | .probe = synclinkmp_init_one, |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c new file mode 100644 index 000000000000..18cdd4361dc6 --- /dev/null +++ b/drivers/char/tlclk.c | |||
@@ -0,0 +1,896 @@ | |||
1 | /* | ||
2 | * Telecom Clock driver for Intel NetStructure(tm) MPCBL0010 | ||
3 | * | ||
4 | * Copyright (C) 2005 Kontron Canada | ||
5 | * | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or (at | ||
11 | * your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
16 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
17 | * details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | * | ||
23 | * Send feedback to <sebastien.bouchard@ca.kontron.com> and the current | ||
24 | * Maintainer <mark.gross@intel.com> | ||
25 | * | ||
26 | * Description : This is the TELECOM CLOCK module driver for the ATCA | ||
27 | * MPCBL0010 ATCA computer. | ||
28 | */ | ||
29 | |||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/sched.h> | ||
34 | #include <linux/kernel.h> /* printk() */ | ||
35 | #include <linux/fs.h> /* everything... */ | ||
36 | #include <linux/errno.h> /* error codes */ | ||
37 | #include <linux/delay.h> /* udelay */ | ||
38 | #include <linux/slab.h> | ||
39 | #include <linux/ioport.h> | ||
40 | #include <linux/interrupt.h> | ||
41 | #include <linux/spinlock.h> | ||
42 | #include <linux/timer.h> | ||
43 | #include <linux/sysfs.h> | ||
44 | #include <linux/device.h> | ||
45 | #include <linux/miscdevice.h> | ||
46 | #include <asm/io.h> /* inb/outb */ | ||
47 | #include <asm/uaccess.h> | ||
48 | |||
49 | MODULE_AUTHOR("Sebastien Bouchard <sebastien.bouchard@ca.kontron.com>"); | ||
50 | MODULE_LICENSE("GPL"); | ||
51 | |||
52 | /*Hardware Reset of the PLL */ | ||
53 | #define RESET_ON 0x00 | ||
54 | #define RESET_OFF 0x01 | ||
55 | |||
56 | /* MODE SELECT */ | ||
57 | #define NORMAL_MODE 0x00 | ||
58 | #define HOLDOVER_MODE 0x10 | ||
59 | #define FREERUN_MODE 0x20 | ||
60 | |||
61 | /* FILTER SELECT */ | ||
62 | #define FILTER_6HZ 0x04 | ||
63 | #define FILTER_12HZ 0x00 | ||
64 | |||
65 | /* SELECT REFERENCE FREQUENCY */ | ||
66 | #define REF_CLK1_8kHz 0x00 | ||
67 | #define REF_CLK2_19_44MHz 0x02 | ||
68 | |||
69 | /* Select primary or secondary redundant clock */ | ||
70 | #define PRIMARY_CLOCK 0x00 | ||
71 | #define SECONDARY_CLOCK 0x01 | ||
72 | |||
73 | /* CLOCK TRANSMISSION DEFINE */ | ||
74 | #define CLK_8kHz 0xff | ||
75 | #define CLK_16_384MHz 0xfb | ||
76 | |||
77 | #define CLK_1_544MHz 0x00 | ||
78 | #define CLK_2_048MHz 0x01 | ||
79 | #define CLK_4_096MHz 0x02 | ||
80 | #define CLK_6_312MHz 0x03 | ||
81 | #define CLK_8_192MHz 0x04 | ||
82 | #define CLK_19_440MHz 0x06 | ||
83 | |||
84 | #define CLK_8_592MHz 0x08 | ||
85 | #define CLK_11_184MHz 0x09 | ||
86 | #define CLK_34_368MHz 0x0b | ||
87 | #define CLK_44_736MHz 0x0a | ||
88 | |||
89 | /* RECEIVED REFERENCE */ | ||
90 | #define AMC_B1 0 | ||
91 | #define AMC_B2 1 | ||
92 | |||
93 | /* HARDWARE SWITCHING DEFINE */ | ||
94 | #define HW_ENABLE 0x80 | ||
95 | #define HW_DISABLE 0x00 | ||
96 | |||
97 | /* HARDWARE SWITCHING MODE DEFINE */ | ||
98 | #define PLL_HOLDOVER 0x40 | ||
99 | #define LOST_CLOCK 0x00 | ||
100 | |||
101 | /* ALARMS DEFINE */ | ||
102 | #define UNLOCK_MASK 0x10 | ||
103 | #define HOLDOVER_MASK 0x20 | ||
104 | #define SEC_LOST_MASK 0x40 | ||
105 | #define PRI_LOST_MASK 0x80 | ||
106 | |||
107 | /* INTERRUPT CAUSE DEFINE */ | ||
108 | |||
109 | #define PRI_LOS_01_MASK 0x01 | ||
110 | #define PRI_LOS_10_MASK 0x02 | ||
111 | |||
112 | #define SEC_LOS_01_MASK 0x04 | ||
113 | #define SEC_LOS_10_MASK 0x08 | ||
114 | |||
115 | #define HOLDOVER_01_MASK 0x10 | ||
116 | #define HOLDOVER_10_MASK 0x20 | ||
117 | |||
118 | #define UNLOCK_01_MASK 0x40 | ||
119 | #define UNLOCK_10_MASK 0x80 | ||
120 | |||
121 | struct tlclk_alarms { | ||
122 | __u32 lost_clocks; | ||
123 | __u32 lost_primary_clock; | ||
124 | __u32 lost_secondary_clock; | ||
125 | __u32 primary_clock_back; | ||
126 | __u32 secondary_clock_back; | ||
127 | __u32 switchover_primary; | ||
128 | __u32 switchover_secondary; | ||
129 | __u32 pll_holdover; | ||
130 | __u32 pll_end_holdover; | ||
131 | __u32 pll_lost_sync; | ||
132 | __u32 pll_sync; | ||
133 | }; | ||
134 | /* Telecom clock I/O register definition */ | ||
135 | #define TLCLK_BASE 0xa08 | ||
136 | #define TLCLK_REG0 TLCLK_BASE | ||
137 | #define TLCLK_REG1 (TLCLK_BASE+1) | ||
138 | #define TLCLK_REG2 (TLCLK_BASE+2) | ||
139 | #define TLCLK_REG3 (TLCLK_BASE+3) | ||
140 | #define TLCLK_REG4 (TLCLK_BASE+4) | ||
141 | #define TLCLK_REG5 (TLCLK_BASE+5) | ||
142 | #define TLCLK_REG6 (TLCLK_BASE+6) | ||
143 | #define TLCLK_REG7 (TLCLK_BASE+7) | ||
144 | |||
145 | #define SET_PORT_BITS(port, mask, val) outb(((inb(port) & mask) | val), port) | ||
146 | |||
147 | /* 0 = Dynamic allocation of the major device number */ | ||
148 | #define TLCLK_MAJOR 0 | ||
149 | |||
150 | /* sysfs interface definition: | ||
151 | Upon loading the driver will create a sysfs directory under | ||
152 | /sys/devices/platform/telco_clock. | ||
153 | |||
154 | This directory exports the following interfaces. There operation is | ||
155 | documented in the MCPBL0010 TPS under the Telecom Clock API section, 11.4. | ||
156 | alarms : | ||
157 | current_ref : | ||
158 | enable_clk3a_output : | ||
159 | enable_clk3b_output : | ||
160 | enable_clka0_output : | ||
161 | enable_clka1_output : | ||
162 | enable_clkb0_output : | ||
163 | enable_clkb1_output : | ||
164 | filter_select : | ||
165 | hardware_switching : | ||
166 | hardware_switching_mode : | ||
167 | interrupt_switch : | ||
168 | mode_select : | ||
169 | refalign : | ||
170 | reset : | ||
171 | select_amcb1_transmit_clock : | ||
172 | select_amcb2_transmit_clock : | ||
173 | select_redundant_clock : | ||
174 | select_ref_frequency : | ||
175 | test_mode : | ||
176 | |||
177 | All sysfs interfaces are integers in hex format, i.e echo 99 > refalign | ||
178 | has the same effect as echo 0x99 > refalign. | ||
179 | */ | ||
180 | |||
181 | static unsigned int telclk_interrupt; | ||
182 | |||
183 | static int int_events; /* Event that generate a interrupt */ | ||
184 | static int got_event; /* if events processing have been done */ | ||
185 | |||
186 | static void switchover_timeout(unsigned long data); | ||
187 | static struct timer_list switchover_timer = | ||
188 | TIMER_INITIALIZER(switchover_timeout , 0, 0); | ||
189 | |||
190 | static struct tlclk_alarms *alarm_events; | ||
191 | |||
192 | static DEFINE_SPINLOCK(event_lock); | ||
193 | |||
194 | static int tlclk_major = TLCLK_MAJOR; | ||
195 | |||
196 | static irqreturn_t tlclk_interrupt(int irq, void *dev_id, struct pt_regs *regs); | ||
197 | |||
198 | static DECLARE_WAIT_QUEUE_HEAD(wq); | ||
199 | |||
200 | static int tlclk_open(struct inode *inode, struct file *filp) | ||
201 | { | ||
202 | int result; | ||
203 | |||
204 | /* Make sure there is no interrupt pending while | ||
205 | * initialising interrupt handler */ | ||
206 | inb(TLCLK_REG6); | ||
207 | |||
208 | /* This device is wired through the FPGA IO space of the ATCA blade | ||
209 | * we can't share this IRQ */ | ||
210 | result = request_irq(telclk_interrupt, &tlclk_interrupt, | ||
211 | SA_INTERRUPT, "telco_clock", tlclk_interrupt); | ||
212 | if (result == -EBUSY) { | ||
213 | printk(KERN_ERR "telco_clock: Interrupt can't be reserved!\n"); | ||
214 | return -EBUSY; | ||
215 | } | ||
216 | inb(TLCLK_REG6); /* Clear interrupt events */ | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static int tlclk_release(struct inode *inode, struct file *filp) | ||
222 | { | ||
223 | free_irq(telclk_interrupt, tlclk_interrupt); | ||
224 | |||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count, | ||
229 | loff_t *f_pos) | ||
230 | { | ||
231 | if (count < sizeof(struct tlclk_alarms)) | ||
232 | return -EIO; | ||
233 | |||
234 | wait_event_interruptible(wq, got_event); | ||
235 | if (copy_to_user(buf, alarm_events, sizeof(struct tlclk_alarms))) | ||
236 | return -EFAULT; | ||
237 | |||
238 | memset(alarm_events, 0, sizeof(struct tlclk_alarms)); | ||
239 | got_event = 0; | ||
240 | |||
241 | return sizeof(struct tlclk_alarms); | ||
242 | } | ||
243 | |||
244 | ssize_t tlclk_write(struct file *filp, const char __user *buf, size_t count, | ||
245 | loff_t *f_pos) | ||
246 | { | ||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | static struct file_operations tlclk_fops = { | ||
251 | .read = tlclk_read, | ||
252 | .write = tlclk_write, | ||
253 | .open = tlclk_open, | ||
254 | .release = tlclk_release, | ||
255 | |||
256 | }; | ||
257 | |||
258 | static struct miscdevice tlclk_miscdev = { | ||
259 | .minor = MISC_DYNAMIC_MINOR, | ||
260 | .name = "telco_clock", | ||
261 | .fops = &tlclk_fops, | ||
262 | }; | ||
263 | |||
264 | static ssize_t show_current_ref(struct device *d, | ||
265 | struct device_attribute *attr, char *buf) | ||
266 | { | ||
267 | unsigned long ret_val; | ||
268 | unsigned long flags; | ||
269 | |||
270 | spin_lock_irqsave(&event_lock, flags); | ||
271 | ret_val = ((inb(TLCLK_REG1) & 0x08) >> 3); | ||
272 | spin_unlock_irqrestore(&event_lock, flags); | ||
273 | |||
274 | return sprintf(buf, "0x%lX\n", ret_val); | ||
275 | } | ||
276 | |||
277 | static DEVICE_ATTR(current_ref, S_IRUGO, show_current_ref, NULL); | ||
278 | |||
279 | |||
280 | static ssize_t show_interrupt_switch(struct device *d, | ||
281 | struct device_attribute *attr, char *buf) | ||
282 | { | ||
283 | unsigned long ret_val; | ||
284 | unsigned long flags; | ||
285 | |||
286 | spin_lock_irqsave(&event_lock, flags); | ||
287 | ret_val = inb(TLCLK_REG6); | ||
288 | spin_unlock_irqrestore(&event_lock, flags); | ||
289 | |||
290 | return sprintf(buf, "0x%lX\n", ret_val); | ||
291 | } | ||
292 | |||
293 | static DEVICE_ATTR(interrupt_switch, S_IRUGO, | ||
294 | show_interrupt_switch, NULL); | ||
295 | |||
296 | static ssize_t show_alarms(struct device *d, | ||
297 | struct device_attribute *attr, char *buf) | ||
298 | { | ||
299 | unsigned long ret_val; | ||
300 | unsigned long flags; | ||
301 | |||
302 | spin_lock_irqsave(&event_lock, flags); | ||
303 | ret_val = (inb(TLCLK_REG2) & 0xf0); | ||
304 | spin_unlock_irqrestore(&event_lock, flags); | ||
305 | |||
306 | return sprintf(buf, "0x%lX\n", ret_val); | ||
307 | } | ||
308 | |||
309 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | ||
310 | |||
311 | static ssize_t store_enable_clk3b_output(struct device *d, | ||
312 | struct device_attribute *attr, const char *buf, size_t count) | ||
313 | { | ||
314 | unsigned long tmp; | ||
315 | unsigned char val; | ||
316 | unsigned long flags; | ||
317 | |||
318 | sscanf(buf, "%lX", &tmp); | ||
319 | dev_dbg(d, ": tmp = 0x%lX\n", tmp); | ||
320 | |||
321 | val = (unsigned char)tmp; | ||
322 | spin_lock_irqsave(&event_lock, flags); | ||
323 | SET_PORT_BITS(TLCLK_REG3, 0x7f, val << 7); | ||
324 | spin_unlock_irqrestore(&event_lock, flags); | ||
325 | |||
326 | return strnlen(buf, count); | ||
327 | } | ||
328 | |||
329 | static DEVICE_ATTR(enable_clk3b_output, S_IWUGO, NULL, | ||
330 | store_enable_clk3b_output); | ||
331 | |||
332 | static ssize_t store_enable_clk3a_output(struct device *d, | ||
333 | struct device_attribute *attr, const char *buf, size_t count) | ||
334 | { | ||
335 | unsigned long flags; | ||
336 | unsigned long tmp; | ||
337 | unsigned char val; | ||
338 | |||
339 | sscanf(buf, "%lX", &tmp); | ||
340 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
341 | |||
342 | val = (unsigned char)tmp; | ||
343 | spin_lock_irqsave(&event_lock, flags); | ||
344 | SET_PORT_BITS(TLCLK_REG3, 0xbf, val << 6); | ||
345 | spin_unlock_irqrestore(&event_lock, flags); | ||
346 | |||
347 | return strnlen(buf, count); | ||
348 | } | ||
349 | |||
350 | static DEVICE_ATTR(enable_clk3a_output, S_IWUGO, NULL, | ||
351 | store_enable_clk3a_output); | ||
352 | |||
353 | static ssize_t store_enable_clkb1_output(struct device *d, | ||
354 | struct device_attribute *attr, const char *buf, size_t count) | ||
355 | { | ||
356 | unsigned long flags; | ||
357 | unsigned long tmp; | ||
358 | unsigned char val; | ||
359 | |||
360 | sscanf(buf, "%lX", &tmp); | ||
361 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
362 | |||
363 | val = (unsigned char)tmp; | ||
364 | spin_lock_irqsave(&event_lock, flags); | ||
365 | SET_PORT_BITS(TLCLK_REG2, 0xf7, val << 3); | ||
366 | spin_unlock_irqrestore(&event_lock, flags); | ||
367 | |||
368 | return strnlen(buf, count); | ||
369 | } | ||
370 | |||
371 | static DEVICE_ATTR(enable_clkb1_output, S_IWUGO, NULL, | ||
372 | store_enable_clkb1_output); | ||
373 | |||
374 | |||
375 | static ssize_t store_enable_clka1_output(struct device *d, | ||
376 | struct device_attribute *attr, const char *buf, size_t count) | ||
377 | { | ||
378 | unsigned long flags; | ||
379 | unsigned long tmp; | ||
380 | unsigned char val; | ||
381 | |||
382 | sscanf(buf, "%lX", &tmp); | ||
383 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
384 | |||
385 | val = (unsigned char)tmp; | ||
386 | spin_lock_irqsave(&event_lock, flags); | ||
387 | SET_PORT_BITS(TLCLK_REG2, 0xfb, val << 2); | ||
388 | spin_unlock_irqrestore(&event_lock, flags); | ||
389 | |||
390 | return strnlen(buf, count); | ||
391 | } | ||
392 | |||
393 | static DEVICE_ATTR(enable_clka1_output, S_IWUGO, NULL, | ||
394 | store_enable_clka1_output); | ||
395 | |||
396 | static ssize_t store_enable_clkb0_output(struct device *d, | ||
397 | struct device_attribute *attr, const char *buf, size_t count) | ||
398 | { | ||
399 | unsigned long flags; | ||
400 | unsigned long tmp; | ||
401 | unsigned char val; | ||
402 | |||
403 | sscanf(buf, "%lX", &tmp); | ||
404 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
405 | |||
406 | val = (unsigned char)tmp; | ||
407 | spin_lock_irqsave(&event_lock, flags); | ||
408 | SET_PORT_BITS(TLCLK_REG2, 0xfd, val << 1); | ||
409 | spin_unlock_irqrestore(&event_lock, flags); | ||
410 | |||
411 | return strnlen(buf, count); | ||
412 | } | ||
413 | |||
414 | static DEVICE_ATTR(enable_clkb0_output, S_IWUGO, NULL, | ||
415 | store_enable_clkb0_output); | ||
416 | |||
417 | static ssize_t store_enable_clka0_output(struct device *d, | ||
418 | struct device_attribute *attr, const char *buf, size_t count) | ||
419 | { | ||
420 | unsigned long flags; | ||
421 | unsigned long tmp; | ||
422 | unsigned char val; | ||
423 | |||
424 | sscanf(buf, "%lX", &tmp); | ||
425 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
426 | |||
427 | val = (unsigned char)tmp; | ||
428 | spin_lock_irqsave(&event_lock, flags); | ||
429 | SET_PORT_BITS(TLCLK_REG2, 0xfe, val); | ||
430 | spin_unlock_irqrestore(&event_lock, flags); | ||
431 | |||
432 | return strnlen(buf, count); | ||
433 | } | ||
434 | |||
435 | static DEVICE_ATTR(enable_clka0_output, S_IWUGO, NULL, | ||
436 | store_enable_clka0_output); | ||
437 | |||
438 | static ssize_t store_test_mode(struct device *d, | ||
439 | struct device_attribute *attr, const char *buf, size_t count) | ||
440 | { | ||
441 | unsigned long flags; | ||
442 | unsigned long tmp; | ||
443 | unsigned char val; | ||
444 | |||
445 | sscanf(buf, "%lX", &tmp); | ||
446 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
447 | |||
448 | val = (unsigned char)tmp; | ||
449 | spin_lock_irqsave(&event_lock, flags); | ||
450 | SET_PORT_BITS(TLCLK_REG4, 0xfd, 2); | ||
451 | spin_unlock_irqrestore(&event_lock, flags); | ||
452 | |||
453 | return strnlen(buf, count); | ||
454 | } | ||
455 | |||
456 | static DEVICE_ATTR(test_mode, S_IWUGO, NULL, store_test_mode); | ||
457 | |||
458 | static ssize_t store_select_amcb2_transmit_clock(struct device *d, | ||
459 | struct device_attribute *attr, const char *buf, size_t count) | ||
460 | { | ||
461 | unsigned long flags; | ||
462 | unsigned long tmp; | ||
463 | unsigned char val; | ||
464 | |||
465 | sscanf(buf, "%lX", &tmp); | ||
466 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
467 | |||
468 | val = (unsigned char)tmp; | ||
469 | spin_lock_irqsave(&event_lock, flags); | ||
470 | if ((val == CLK_8kHz) || (val == CLK_16_384MHz)) { | ||
471 | SET_PORT_BITS(TLCLK_REG3, 0xc7, 0x28); | ||
472 | SET_PORT_BITS(TLCLK_REG1, 0xfb, ~val); | ||
473 | } else if (val >= CLK_8_592MHz) { | ||
474 | SET_PORT_BITS(TLCLK_REG3, 0xc7, 0x38); | ||
475 | switch (val) { | ||
476 | case CLK_8_592MHz: | ||
477 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 1); | ||
478 | break; | ||
479 | case CLK_11_184MHz: | ||
480 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 0); | ||
481 | break; | ||
482 | case CLK_34_368MHz: | ||
483 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 3); | ||
484 | break; | ||
485 | case CLK_44_736MHz: | ||
486 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 2); | ||
487 | break; | ||
488 | } | ||
489 | } else | ||
490 | SET_PORT_BITS(TLCLK_REG3, 0xc7, val << 3); | ||
491 | |||
492 | spin_unlock_irqrestore(&event_lock, flags); | ||
493 | |||
494 | return strnlen(buf, count); | ||
495 | } | ||
496 | |||
497 | static DEVICE_ATTR(select_amcb2_transmit_clock, S_IWUGO, NULL, | ||
498 | store_select_amcb2_transmit_clock); | ||
499 | |||
500 | static ssize_t store_select_amcb1_transmit_clock(struct device *d, | ||
501 | struct device_attribute *attr, const char *buf, size_t count) | ||
502 | { | ||
503 | unsigned long tmp; | ||
504 | unsigned char val; | ||
505 | unsigned long flags; | ||
506 | |||
507 | sscanf(buf, "%lX", &tmp); | ||
508 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
509 | |||
510 | val = (unsigned char)tmp; | ||
511 | spin_lock_irqsave(&event_lock, flags); | ||
512 | if ((val == CLK_8kHz) || (val == CLK_16_384MHz)) { | ||
513 | SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x5); | ||
514 | SET_PORT_BITS(TLCLK_REG1, 0xfb, ~val); | ||
515 | } else if (val >= CLK_8_592MHz) { | ||
516 | SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x7); | ||
517 | switch (val) { | ||
518 | case CLK_8_592MHz: | ||
519 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 1); | ||
520 | break; | ||
521 | case CLK_11_184MHz: | ||
522 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 0); | ||
523 | break; | ||
524 | case CLK_34_368MHz: | ||
525 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 3); | ||
526 | break; | ||
527 | case CLK_44_736MHz: | ||
528 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 2); | ||
529 | break; | ||
530 | } | ||
531 | } else | ||
532 | SET_PORT_BITS(TLCLK_REG3, 0xf8, val); | ||
533 | spin_unlock_irqrestore(&event_lock, flags); | ||
534 | |||
535 | return strnlen(buf, count); | ||
536 | } | ||
537 | |||
538 | static DEVICE_ATTR(select_amcb1_transmit_clock, S_IWUGO, NULL, | ||
539 | store_select_amcb1_transmit_clock); | ||
540 | |||
541 | static ssize_t store_select_redundant_clock(struct device *d, | ||
542 | struct device_attribute *attr, const char *buf, size_t count) | ||
543 | { | ||
544 | unsigned long tmp; | ||
545 | unsigned char val; | ||
546 | unsigned long flags; | ||
547 | |||
548 | sscanf(buf, "%lX", &tmp); | ||
549 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
550 | |||
551 | val = (unsigned char)tmp; | ||
552 | spin_lock_irqsave(&event_lock, flags); | ||
553 | SET_PORT_BITS(TLCLK_REG1, 0xfe, val); | ||
554 | spin_unlock_irqrestore(&event_lock, flags); | ||
555 | |||
556 | return strnlen(buf, count); | ||
557 | } | ||
558 | |||
559 | static DEVICE_ATTR(select_redundant_clock, S_IWUGO, NULL, | ||
560 | store_select_redundant_clock); | ||
561 | |||
562 | static ssize_t store_select_ref_frequency(struct device *d, | ||
563 | struct device_attribute *attr, const char *buf, size_t count) | ||
564 | { | ||
565 | unsigned long tmp; | ||
566 | unsigned char val; | ||
567 | unsigned long flags; | ||
568 | |||
569 | sscanf(buf, "%lX", &tmp); | ||
570 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
571 | |||
572 | val = (unsigned char)tmp; | ||
573 | spin_lock_irqsave(&event_lock, flags); | ||
574 | SET_PORT_BITS(TLCLK_REG1, 0xfd, val); | ||
575 | spin_unlock_irqrestore(&event_lock, flags); | ||
576 | |||
577 | return strnlen(buf, count); | ||
578 | } | ||
579 | |||
580 | static DEVICE_ATTR(select_ref_frequency, S_IWUGO, NULL, | ||
581 | store_select_ref_frequency); | ||
582 | |||
583 | static ssize_t store_filter_select(struct device *d, | ||
584 | struct device_attribute *attr, const char *buf, size_t count) | ||
585 | { | ||
586 | unsigned long tmp; | ||
587 | unsigned char val; | ||
588 | unsigned long flags; | ||
589 | |||
590 | sscanf(buf, "%lX", &tmp); | ||
591 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
592 | |||
593 | val = (unsigned char)tmp; | ||
594 | spin_lock_irqsave(&event_lock, flags); | ||
595 | SET_PORT_BITS(TLCLK_REG0, 0xfb, val); | ||
596 | spin_unlock_irqrestore(&event_lock, flags); | ||
597 | |||
598 | return strnlen(buf, count); | ||
599 | } | ||
600 | |||
601 | static DEVICE_ATTR(filter_select, S_IWUGO, NULL, store_filter_select); | ||
602 | |||
603 | static ssize_t store_hardware_switching_mode(struct device *d, | ||
604 | struct device_attribute *attr, const char *buf, size_t count) | ||
605 | { | ||
606 | unsigned long tmp; | ||
607 | unsigned char val; | ||
608 | unsigned long flags; | ||
609 | |||
610 | sscanf(buf, "%lX", &tmp); | ||
611 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
612 | |||
613 | val = (unsigned char)tmp; | ||
614 | spin_lock_irqsave(&event_lock, flags); | ||
615 | SET_PORT_BITS(TLCLK_REG0, 0xbf, val); | ||
616 | spin_unlock_irqrestore(&event_lock, flags); | ||
617 | |||
618 | return strnlen(buf, count); | ||
619 | } | ||
620 | |||
621 | static DEVICE_ATTR(hardware_switching_mode, S_IWUGO, NULL, | ||
622 | store_hardware_switching_mode); | ||
623 | |||
624 | static ssize_t store_hardware_switching(struct device *d, | ||
625 | struct device_attribute *attr, const char *buf, size_t count) | ||
626 | { | ||
627 | unsigned long tmp; | ||
628 | unsigned char val; | ||
629 | unsigned long flags; | ||
630 | |||
631 | sscanf(buf, "%lX", &tmp); | ||
632 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
633 | |||
634 | val = (unsigned char)tmp; | ||
635 | spin_lock_irqsave(&event_lock, flags); | ||
636 | SET_PORT_BITS(TLCLK_REG0, 0x7f, val); | ||
637 | spin_unlock_irqrestore(&event_lock, flags); | ||
638 | |||
639 | return strnlen(buf, count); | ||
640 | } | ||
641 | |||
642 | static DEVICE_ATTR(hardware_switching, S_IWUGO, NULL, | ||
643 | store_hardware_switching); | ||
644 | |||
645 | static ssize_t store_refalign (struct device *d, | ||
646 | struct device_attribute *attr, const char *buf, size_t count) | ||
647 | { | ||
648 | unsigned long tmp; | ||
649 | unsigned long flags; | ||
650 | |||
651 | sscanf(buf, "%lX", &tmp); | ||
652 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
653 | spin_lock_irqsave(&event_lock, flags); | ||
654 | SET_PORT_BITS(TLCLK_REG0, 0xf7, 0); | ||
655 | udelay(2); | ||
656 | SET_PORT_BITS(TLCLK_REG0, 0xf7, 0x08); | ||
657 | udelay(2); | ||
658 | SET_PORT_BITS(TLCLK_REG0, 0xf7, 0); | ||
659 | spin_unlock_irqrestore(&event_lock, flags); | ||
660 | |||
661 | return strnlen(buf, count); | ||
662 | } | ||
663 | |||
664 | static DEVICE_ATTR(refalign, S_IWUGO, NULL, store_refalign); | ||
665 | |||
666 | static ssize_t store_mode_select (struct device *d, | ||
667 | struct device_attribute *attr, const char *buf, size_t count) | ||
668 | { | ||
669 | unsigned long tmp; | ||
670 | unsigned char val; | ||
671 | unsigned long flags; | ||
672 | |||
673 | sscanf(buf, "%lX", &tmp); | ||
674 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
675 | |||
676 | val = (unsigned char)tmp; | ||
677 | spin_lock_irqsave(&event_lock, flags); | ||
678 | SET_PORT_BITS(TLCLK_REG0, 0xcf, val); | ||
679 | spin_unlock_irqrestore(&event_lock, flags); | ||
680 | |||
681 | return strnlen(buf, count); | ||
682 | } | ||
683 | |||
684 | static DEVICE_ATTR(mode_select, S_IWUGO, NULL, store_mode_select); | ||
685 | |||
686 | static ssize_t store_reset (struct device *d, | ||
687 | struct device_attribute *attr, const char *buf, size_t count) | ||
688 | { | ||
689 | unsigned long tmp; | ||
690 | unsigned char val; | ||
691 | unsigned long flags; | ||
692 | |||
693 | sscanf(buf, "%lX", &tmp); | ||
694 | dev_dbg(d, "tmp = 0x%lX\n", tmp); | ||
695 | |||
696 | val = (unsigned char)tmp; | ||
697 | spin_lock_irqsave(&event_lock, flags); | ||
698 | SET_PORT_BITS(TLCLK_REG4, 0xfd, val); | ||
699 | spin_unlock_irqrestore(&event_lock, flags); | ||
700 | |||
701 | return strnlen(buf, count); | ||
702 | } | ||
703 | |||
704 | static DEVICE_ATTR(reset, S_IWUGO, NULL, store_reset); | ||
705 | |||
706 | static struct attribute *tlclk_sysfs_entries[] = { | ||
707 | &dev_attr_current_ref.attr, | ||
708 | &dev_attr_interrupt_switch.attr, | ||
709 | &dev_attr_alarms.attr, | ||
710 | &dev_attr_enable_clk3a_output.attr, | ||
711 | &dev_attr_enable_clk3b_output.attr, | ||
712 | &dev_attr_enable_clkb1_output.attr, | ||
713 | &dev_attr_enable_clka1_output.attr, | ||
714 | &dev_attr_enable_clkb0_output.attr, | ||
715 | &dev_attr_enable_clka0_output.attr, | ||
716 | &dev_attr_test_mode.attr, | ||
717 | &dev_attr_select_amcb1_transmit_clock.attr, | ||
718 | &dev_attr_select_amcb2_transmit_clock.attr, | ||
719 | &dev_attr_select_redundant_clock.attr, | ||
720 | &dev_attr_select_ref_frequency.attr, | ||
721 | &dev_attr_filter_select.attr, | ||
722 | &dev_attr_hardware_switching_mode.attr, | ||
723 | &dev_attr_hardware_switching.attr, | ||
724 | &dev_attr_refalign.attr, | ||
725 | &dev_attr_mode_select.attr, | ||
726 | &dev_attr_reset.attr, | ||
727 | NULL | ||
728 | }; | ||
729 | |||
730 | static struct attribute_group tlclk_attribute_group = { | ||
731 | .name = NULL, /* put in device directory */ | ||
732 | .attrs = tlclk_sysfs_entries, | ||
733 | }; | ||
734 | |||
735 | static struct platform_device *tlclk_device; | ||
736 | |||
737 | static int __init tlclk_init(void) | ||
738 | { | ||
739 | int ret; | ||
740 | |||
741 | ret = register_chrdev(tlclk_major, "telco_clock", &tlclk_fops); | ||
742 | if (ret < 0) { | ||
743 | printk(KERN_ERR "telco_clock: can't get major! %d\n", tlclk_major); | ||
744 | return ret; | ||
745 | } | ||
746 | alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL); | ||
747 | if (!alarm_events) | ||
748 | goto out1; | ||
749 | |||
750 | /* Read telecom clock IRQ number (Set by BIOS) */ | ||
751 | if (!request_region(TLCLK_BASE, 8, "telco_clock")) { | ||
752 | printk(KERN_ERR "tlclk: request_region failed! 0x%X\n", | ||
753 | TLCLK_BASE); | ||
754 | ret = -EBUSY; | ||
755 | goto out2; | ||
756 | } | ||
757 | telclk_interrupt = (inb(TLCLK_REG7) & 0x0f); | ||
758 | |||
759 | if (0x0F == telclk_interrupt ) { /* not MCPBL0010 ? */ | ||
760 | printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw\n", | ||
761 | telclk_interrupt); | ||
762 | ret = -ENXIO; | ||
763 | goto out3; | ||
764 | } | ||
765 | |||
766 | init_timer(&switchover_timer); | ||
767 | |||
768 | ret = misc_register(&tlclk_miscdev); | ||
769 | if (ret < 0) { | ||
770 | printk(KERN_ERR " misc_register retruns %d\n", ret); | ||
771 | ret = -EBUSY; | ||
772 | goto out3; | ||
773 | } | ||
774 | |||
775 | tlclk_device = platform_device_register_simple("telco_clock", | ||
776 | -1, NULL, 0); | ||
777 | if (!tlclk_device) { | ||
778 | printk(KERN_ERR " platform_device_register retruns 0x%X\n", | ||
779 | (unsigned int) tlclk_device); | ||
780 | ret = -EBUSY; | ||
781 | goto out4; | ||
782 | } | ||
783 | |||
784 | ret = sysfs_create_group(&tlclk_device->dev.kobj, | ||
785 | &tlclk_attribute_group); | ||
786 | if (ret) { | ||
787 | printk(KERN_ERR "failed to create sysfs device attributes\n"); | ||
788 | sysfs_remove_group(&tlclk_device->dev.kobj, | ||
789 | &tlclk_attribute_group); | ||
790 | goto out5; | ||
791 | } | ||
792 | |||
793 | return 0; | ||
794 | out5: | ||
795 | platform_device_unregister(tlclk_device); | ||
796 | out4: | ||
797 | misc_deregister(&tlclk_miscdev); | ||
798 | out3: | ||
799 | release_region(TLCLK_BASE, 8); | ||
800 | out2: | ||
801 | kfree(alarm_events); | ||
802 | out1: | ||
803 | unregister_chrdev(tlclk_major, "telco_clock"); | ||
804 | return ret; | ||
805 | } | ||
806 | |||
807 | static void __exit tlclk_cleanup(void) | ||
808 | { | ||
809 | sysfs_remove_group(&tlclk_device->dev.kobj, &tlclk_attribute_group); | ||
810 | platform_device_unregister(tlclk_device); | ||
811 | misc_deregister(&tlclk_miscdev); | ||
812 | unregister_chrdev(tlclk_major, "telco_clock"); | ||
813 | |||
814 | release_region(TLCLK_BASE, 8); | ||
815 | del_timer_sync(&switchover_timer); | ||
816 | kfree(alarm_events); | ||
817 | |||
818 | } | ||
819 | |||
820 | static void switchover_timeout(unsigned long data) | ||
821 | { | ||
822 | if ((data & 1)) { | ||
823 | if ((inb(TLCLK_REG1) & 0x08) != (data & 0x08)) | ||
824 | alarm_events->switchover_primary++; | ||
825 | } else { | ||
826 | if ((inb(TLCLK_REG1) & 0x08) != (data & 0x08)) | ||
827 | alarm_events->switchover_secondary++; | ||
828 | } | ||
829 | |||
830 | /* Alarm processing is done, wake up read task */ | ||
831 | del_timer(&switchover_timer); | ||
832 | got_event = 1; | ||
833 | wake_up(&wq); | ||
834 | } | ||
835 | |||
836 | static irqreturn_t tlclk_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
837 | { | ||
838 | unsigned long flags; | ||
839 | |||
840 | spin_lock_irqsave(&event_lock, flags); | ||
841 | /* Read and clear interrupt events */ | ||
842 | int_events = inb(TLCLK_REG6); | ||
843 | |||
844 | /* Primary_Los changed from 0 to 1 ? */ | ||
845 | if (int_events & PRI_LOS_01_MASK) { | ||
846 | if (inb(TLCLK_REG2) & SEC_LOST_MASK) | ||
847 | alarm_events->lost_clocks++; | ||
848 | else | ||
849 | alarm_events->lost_primary_clock++; | ||
850 | } | ||
851 | |||
852 | /* Primary_Los changed from 1 to 0 ? */ | ||
853 | if (int_events & PRI_LOS_10_MASK) { | ||
854 | alarm_events->primary_clock_back++; | ||
855 | SET_PORT_BITS(TLCLK_REG1, 0xFE, 1); | ||
856 | } | ||
857 | /* Secondary_Los changed from 0 to 1 ? */ | ||
858 | if (int_events & SEC_LOS_01_MASK) { | ||
859 | if (inb(TLCLK_REG2) & PRI_LOST_MASK) | ||
860 | alarm_events->lost_clocks++; | ||
861 | else | ||
862 | alarm_events->lost_secondary_clock++; | ||
863 | } | ||
864 | /* Secondary_Los changed from 1 to 0 ? */ | ||
865 | if (int_events & SEC_LOS_10_MASK) { | ||
866 | alarm_events->secondary_clock_back++; | ||
867 | SET_PORT_BITS(TLCLK_REG1, 0xFE, 0); | ||
868 | } | ||
869 | if (int_events & HOLDOVER_10_MASK) | ||
870 | alarm_events->pll_end_holdover++; | ||
871 | |||
872 | if (int_events & UNLOCK_01_MASK) | ||
873 | alarm_events->pll_lost_sync++; | ||
874 | |||
875 | if (int_events & UNLOCK_10_MASK) | ||
876 | alarm_events->pll_sync++; | ||
877 | |||
878 | /* Holdover changed from 0 to 1 ? */ | ||
879 | if (int_events & HOLDOVER_01_MASK) { | ||
880 | alarm_events->pll_holdover++; | ||
881 | |||
882 | /* TIMEOUT in ~10ms */ | ||
883 | switchover_timer.expires = jiffies + msecs_to_jiffies(10); | ||
884 | switchover_timer.data = inb(TLCLK_REG1); | ||
885 | add_timer(&switchover_timer); | ||
886 | } else { | ||
887 | got_event = 1; | ||
888 | wake_up(&wq); | ||
889 | } | ||
890 | spin_unlock_irqrestore(&event_lock, flags); | ||
891 | |||
892 | return IRQ_HANDLED; | ||
893 | } | ||
894 | |||
895 | module_init(tlclk_init); | ||
896 | module_exit(tlclk_cleanup); | ||
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 049d128ae7f0..303f15880466 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -64,7 +64,7 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | |||
64 | if (count == 0) | 64 | if (count == 0) |
65 | return -ENODATA; | 65 | return -ENODATA; |
66 | if (count > bufsiz) { | 66 | if (count > bufsiz) { |
67 | dev_err(&chip->pci_dev->dev, | 67 | dev_err(chip->dev, |
68 | "invalid count value %x %zx \n", count, bufsiz); | 68 | "invalid count value %x %zx \n", count, bufsiz); |
69 | return -E2BIG; | 69 | return -E2BIG; |
70 | } | 70 | } |
@@ -72,21 +72,21 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | |||
72 | down(&chip->tpm_mutex); | 72 | down(&chip->tpm_mutex); |
73 | 73 | ||
74 | if ((rc = chip->vendor->send(chip, (u8 *) buf, count)) < 0) { | 74 | if ((rc = chip->vendor->send(chip, (u8 *) buf, count)) < 0) { |
75 | dev_err(&chip->pci_dev->dev, | 75 | dev_err(chip->dev, |
76 | "tpm_transmit: tpm_send: error %zd\n", rc); | 76 | "tpm_transmit: tpm_send: error %zd\n", rc); |
77 | goto out; | 77 | goto out; |
78 | } | 78 | } |
79 | 79 | ||
80 | stop = jiffies + 2 * 60 * HZ; | 80 | stop = jiffies + 2 * 60 * HZ; |
81 | do { | 81 | do { |
82 | u8 status = inb(chip->vendor->base + 1); | 82 | u8 status = chip->vendor->status(chip); |
83 | if ((status & chip->vendor->req_complete_mask) == | 83 | if ((status & chip->vendor->req_complete_mask) == |
84 | chip->vendor->req_complete_val) { | 84 | chip->vendor->req_complete_val) { |
85 | goto out_recv; | 85 | goto out_recv; |
86 | } | 86 | } |
87 | 87 | ||
88 | if ((status == chip->vendor->req_canceled)) { | 88 | if ((status == chip->vendor->req_canceled)) { |
89 | dev_err(&chip->pci_dev->dev, "Operation Canceled\n"); | 89 | dev_err(chip->dev, "Operation Canceled\n"); |
90 | rc = -ECANCELED; | 90 | rc = -ECANCELED; |
91 | goto out; | 91 | goto out; |
92 | } | 92 | } |
@@ -97,14 +97,14 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | |||
97 | 97 | ||
98 | 98 | ||
99 | chip->vendor->cancel(chip); | 99 | chip->vendor->cancel(chip); |
100 | dev_err(&chip->pci_dev->dev, "Operation Timed out\n"); | 100 | dev_err(chip->dev, "Operation Timed out\n"); |
101 | rc = -ETIME; | 101 | rc = -ETIME; |
102 | goto out; | 102 | goto out; |
103 | 103 | ||
104 | out_recv: | 104 | out_recv: |
105 | rc = chip->vendor->recv(chip, (u8 *) buf, bufsiz); | 105 | rc = chip->vendor->recv(chip, (u8 *) buf, bufsiz); |
106 | if (rc < 0) | 106 | if (rc < 0) |
107 | dev_err(&chip->pci_dev->dev, | 107 | dev_err(chip->dev, |
108 | "tpm_transmit: tpm_recv: error %zd\n", rc); | 108 | "tpm_transmit: tpm_recv: error %zd\n", rc); |
109 | out: | 109 | out: |
110 | up(&chip->tpm_mutex); | 110 | up(&chip->tpm_mutex); |
@@ -139,15 +139,14 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, | |||
139 | __be32 index; | 139 | __be32 index; |
140 | char *str = buf; | 140 | char *str = buf; |
141 | 141 | ||
142 | struct tpm_chip *chip = | 142 | struct tpm_chip *chip = dev_get_drvdata(dev); |
143 | pci_get_drvdata(to_pci_dev(dev)); | ||
144 | if (chip == NULL) | 143 | if (chip == NULL) |
145 | return -ENODEV; | 144 | return -ENODEV; |
146 | 145 | ||
147 | memcpy(data, cap_pcr, sizeof(cap_pcr)); | 146 | memcpy(data, cap_pcr, sizeof(cap_pcr)); |
148 | if ((len = tpm_transmit(chip, data, sizeof(data))) | 147 | if ((len = tpm_transmit(chip, data, sizeof(data))) |
149 | < CAP_PCR_RESULT_SIZE) { | 148 | < CAP_PCR_RESULT_SIZE) { |
150 | dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred " | 149 | dev_dbg(chip->dev, "A TPM error (%d) occurred " |
151 | "attempting to determine the number of PCRS\n", | 150 | "attempting to determine the number of PCRS\n", |
152 | be32_to_cpu(*((__be32 *) (data + 6)))); | 151 | be32_to_cpu(*((__be32 *) (data + 6)))); |
153 | return 0; | 152 | return 0; |
@@ -161,9 +160,10 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, | |||
161 | memcpy(data + 10, &index, 4); | 160 | memcpy(data + 10, &index, 4); |
162 | if ((len = tpm_transmit(chip, data, sizeof(data))) | 161 | if ((len = tpm_transmit(chip, data, sizeof(data))) |
163 | < READ_PCR_RESULT_SIZE){ | 162 | < READ_PCR_RESULT_SIZE){ |
164 | dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred" | 163 | dev_dbg(chip->dev, "A TPM error (%d) occurred" |
165 | " attempting to read PCR %d of %d\n", | 164 | " attempting to read PCR %d of %d\n", |
166 | be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs); | 165 | be32_to_cpu(*((__be32 *) (data + 6))), |
166 | i, num_pcrs); | ||
167 | goto out; | 167 | goto out; |
168 | } | 168 | } |
169 | str += sprintf(str, "PCR-%02d: ", i); | 169 | str += sprintf(str, "PCR-%02d: ", i); |
@@ -191,21 +191,19 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr, | |||
191 | int i, rc; | 191 | int i, rc; |
192 | char *str = buf; | 192 | char *str = buf; |
193 | 193 | ||
194 | struct tpm_chip *chip = | 194 | struct tpm_chip *chip = dev_get_drvdata(dev); |
195 | pci_get_drvdata(to_pci_dev(dev)); | ||
196 | if (chip == NULL) | 195 | if (chip == NULL) |
197 | return -ENODEV; | 196 | return -ENODEV; |
198 | 197 | ||
199 | data = kmalloc(READ_PUBEK_RESULT_SIZE, GFP_KERNEL); | 198 | data = kzalloc(READ_PUBEK_RESULT_SIZE, GFP_KERNEL); |
200 | if (!data) | 199 | if (!data) |
201 | return -ENOMEM; | 200 | return -ENOMEM; |
202 | 201 | ||
203 | memcpy(data, readpubek, sizeof(readpubek)); | 202 | memcpy(data, readpubek, sizeof(readpubek)); |
204 | memset(data + sizeof(readpubek), 0, 20); /* zero nonce */ | ||
205 | 203 | ||
206 | if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) < | 204 | if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) < |
207 | READ_PUBEK_RESULT_SIZE) { | 205 | READ_PUBEK_RESULT_SIZE) { |
208 | dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred " | 206 | dev_dbg(chip->dev, "A TPM error (%d) occurred " |
209 | "attempting to read the PUBEK\n", | 207 | "attempting to read the PUBEK\n", |
210 | be32_to_cpu(*((__be32 *) (data + 6)))); | 208 | be32_to_cpu(*((__be32 *) (data + 6)))); |
211 | rc = 0; | 209 | rc = 0; |
@@ -245,7 +243,6 @@ out: | |||
245 | kfree(data); | 243 | kfree(data); |
246 | return rc; | 244 | return rc; |
247 | } | 245 | } |
248 | |||
249 | EXPORT_SYMBOL_GPL(tpm_show_pubek); | 246 | EXPORT_SYMBOL_GPL(tpm_show_pubek); |
250 | 247 | ||
251 | #define CAP_VER_RESULT_SIZE 18 | 248 | #define CAP_VER_RESULT_SIZE 18 |
@@ -274,8 +271,7 @@ ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr, | |||
274 | ssize_t len; | 271 | ssize_t len; |
275 | char *str = buf; | 272 | char *str = buf; |
276 | 273 | ||
277 | struct tpm_chip *chip = | 274 | struct tpm_chip *chip = dev_get_drvdata(dev); |
278 | pci_get_drvdata(to_pci_dev(dev)); | ||
279 | if (chip == NULL) | 275 | if (chip == NULL) |
280 | return -ENODEV; | 276 | return -ENODEV; |
281 | 277 | ||
@@ -315,7 +311,6 @@ ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, | |||
315 | } | 311 | } |
316 | EXPORT_SYMBOL_GPL(tpm_store_cancel); | 312 | EXPORT_SYMBOL_GPL(tpm_store_cancel); |
317 | 313 | ||
318 | |||
319 | /* | 314 | /* |
320 | * Device file system interface to the TPM | 315 | * Device file system interface to the TPM |
321 | */ | 316 | */ |
@@ -339,21 +334,20 @@ int tpm_open(struct inode *inode, struct file *file) | |||
339 | } | 334 | } |
340 | 335 | ||
341 | if (chip->num_opens) { | 336 | if (chip->num_opens) { |
342 | dev_dbg(&chip->pci_dev->dev, | 337 | dev_dbg(chip->dev, "Another process owns this TPM\n"); |
343 | "Another process owns this TPM\n"); | ||
344 | rc = -EBUSY; | 338 | rc = -EBUSY; |
345 | goto err_out; | 339 | goto err_out; |
346 | } | 340 | } |
347 | 341 | ||
348 | chip->num_opens++; | 342 | chip->num_opens++; |
349 | pci_dev_get(chip->pci_dev); | 343 | get_device(chip->dev); |
350 | 344 | ||
351 | spin_unlock(&driver_lock); | 345 | spin_unlock(&driver_lock); |
352 | 346 | ||
353 | chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL); | 347 | chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL); |
354 | if (chip->data_buffer == NULL) { | 348 | if (chip->data_buffer == NULL) { |
355 | chip->num_opens--; | 349 | chip->num_opens--; |
356 | pci_dev_put(chip->pci_dev); | 350 | put_device(chip->dev); |
357 | return -ENOMEM; | 351 | return -ENOMEM; |
358 | } | 352 | } |
359 | 353 | ||
@@ -366,7 +360,6 @@ err_out: | |||
366 | spin_unlock(&driver_lock); | 360 | spin_unlock(&driver_lock); |
367 | return rc; | 361 | return rc; |
368 | } | 362 | } |
369 | |||
370 | EXPORT_SYMBOL_GPL(tpm_open); | 363 | EXPORT_SYMBOL_GPL(tpm_open); |
371 | 364 | ||
372 | int tpm_release(struct inode *inode, struct file *file) | 365 | int tpm_release(struct inode *inode, struct file *file) |
@@ -378,15 +371,14 @@ int tpm_release(struct inode *inode, struct file *file) | |||
378 | chip->num_opens--; | 371 | chip->num_opens--; |
379 | del_singleshot_timer_sync(&chip->user_read_timer); | 372 | del_singleshot_timer_sync(&chip->user_read_timer); |
380 | atomic_set(&chip->data_pending, 0); | 373 | atomic_set(&chip->data_pending, 0); |
381 | pci_dev_put(chip->pci_dev); | 374 | put_device(chip->dev); |
382 | kfree(chip->data_buffer); | 375 | kfree(chip->data_buffer); |
383 | spin_unlock(&driver_lock); | 376 | spin_unlock(&driver_lock); |
384 | return 0; | 377 | return 0; |
385 | } | 378 | } |
386 | |||
387 | EXPORT_SYMBOL_GPL(tpm_release); | 379 | EXPORT_SYMBOL_GPL(tpm_release); |
388 | 380 | ||
389 | ssize_t tpm_write(struct file * file, const char __user * buf, | 381 | ssize_t tpm_write(struct file *file, const char __user *buf, |
390 | size_t size, loff_t * off) | 382 | size_t size, loff_t * off) |
391 | { | 383 | { |
392 | struct tpm_chip *chip = file->private_data; | 384 | struct tpm_chip *chip = file->private_data; |
@@ -422,7 +414,7 @@ ssize_t tpm_write(struct file * file, const char __user * buf, | |||
422 | 414 | ||
423 | EXPORT_SYMBOL_GPL(tpm_write); | 415 | EXPORT_SYMBOL_GPL(tpm_write); |
424 | 416 | ||
425 | ssize_t tpm_read(struct file * file, char __user * buf, | 417 | ssize_t tpm_read(struct file * file, char __user *buf, |
426 | size_t size, loff_t * off) | 418 | size_t size, loff_t * off) |
427 | { | 419 | { |
428 | struct tpm_chip *chip = file->private_data; | 420 | struct tpm_chip *chip = file->private_data; |
@@ -444,15 +436,14 @@ ssize_t tpm_read(struct file * file, char __user * buf, | |||
444 | 436 | ||
445 | return ret_size; | 437 | return ret_size; |
446 | } | 438 | } |
447 | |||
448 | EXPORT_SYMBOL_GPL(tpm_read); | 439 | EXPORT_SYMBOL_GPL(tpm_read); |
449 | 440 | ||
450 | void __devexit tpm_remove(struct pci_dev *pci_dev) | 441 | void tpm_remove_hardware(struct device *dev) |
451 | { | 442 | { |
452 | struct tpm_chip *chip = pci_get_drvdata(pci_dev); | 443 | struct tpm_chip *chip = dev_get_drvdata(dev); |
453 | 444 | ||
454 | if (chip == NULL) { | 445 | if (chip == NULL) { |
455 | dev_err(&pci_dev->dev, "No device data found\n"); | 446 | dev_err(dev, "No device data found\n"); |
456 | return; | 447 | return; |
457 | } | 448 | } |
458 | 449 | ||
@@ -462,22 +453,20 @@ void __devexit tpm_remove(struct pci_dev *pci_dev) | |||
462 | 453 | ||
463 | spin_unlock(&driver_lock); | 454 | spin_unlock(&driver_lock); |
464 | 455 | ||
465 | pci_set_drvdata(pci_dev, NULL); | 456 | dev_set_drvdata(dev, NULL); |
466 | misc_deregister(&chip->vendor->miscdev); | 457 | misc_deregister(&chip->vendor->miscdev); |
467 | kfree(chip->vendor->miscdev.name); | 458 | kfree(chip->vendor->miscdev.name); |
468 | 459 | ||
469 | sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); | 460 | sysfs_remove_group(&dev->kobj, chip->vendor->attr_group); |
470 | 461 | ||
471 | pci_disable_device(pci_dev); | 462 | dev_mask[chip->dev_num / TPM_NUM_MASK_ENTRIES ] &= |
472 | 463 | !(1 << (chip->dev_num % TPM_NUM_MASK_ENTRIES)); | |
473 | dev_mask[chip->dev_num / TPM_NUM_MASK_ENTRIES ] &= !(1 << (chip->dev_num % TPM_NUM_MASK_ENTRIES)); | ||
474 | 464 | ||
475 | kfree(chip); | 465 | kfree(chip); |
476 | 466 | ||
477 | pci_dev_put(pci_dev); | 467 | put_device(dev); |
478 | } | 468 | } |
479 | 469 | EXPORT_SYMBOL_GPL(tpm_remove_hardware); | |
480 | EXPORT_SYMBOL_GPL(tpm_remove); | ||
481 | 470 | ||
482 | static u8 savestate[] = { | 471 | static u8 savestate[] = { |
483 | 0, 193, /* TPM_TAG_RQU_COMMAND */ | 472 | 0, 193, /* TPM_TAG_RQU_COMMAND */ |
@@ -489,32 +478,30 @@ static u8 savestate[] = { | |||
489 | * We are about to suspend. Save the TPM state | 478 | * We are about to suspend. Save the TPM state |
490 | * so that it can be restored. | 479 | * so that it can be restored. |
491 | */ | 480 | */ |
492 | int tpm_pm_suspend(struct pci_dev *pci_dev, pm_message_t pm_state) | 481 | int tpm_pm_suspend(struct device *dev, pm_message_t pm_state) |
493 | { | 482 | { |
494 | struct tpm_chip *chip = pci_get_drvdata(pci_dev); | 483 | struct tpm_chip *chip = dev_get_drvdata(dev); |
495 | if (chip == NULL) | 484 | if (chip == NULL) |
496 | return -ENODEV; | 485 | return -ENODEV; |
497 | 486 | ||
498 | tpm_transmit(chip, savestate, sizeof(savestate)); | 487 | tpm_transmit(chip, savestate, sizeof(savestate)); |
499 | return 0; | 488 | return 0; |
500 | } | 489 | } |
501 | |||
502 | EXPORT_SYMBOL_GPL(tpm_pm_suspend); | 490 | EXPORT_SYMBOL_GPL(tpm_pm_suspend); |
503 | 491 | ||
504 | /* | 492 | /* |
505 | * Resume from a power safe. The BIOS already restored | 493 | * Resume from a power safe. The BIOS already restored |
506 | * the TPM state. | 494 | * the TPM state. |
507 | */ | 495 | */ |
508 | int tpm_pm_resume(struct pci_dev *pci_dev) | 496 | int tpm_pm_resume(struct device *dev) |
509 | { | 497 | { |
510 | struct tpm_chip *chip = pci_get_drvdata(pci_dev); | 498 | struct tpm_chip *chip = dev_get_drvdata(dev); |
511 | 499 | ||
512 | if (chip == NULL) | 500 | if (chip == NULL) |
513 | return -ENODEV; | 501 | return -ENODEV; |
514 | 502 | ||
515 | return 0; | 503 | return 0; |
516 | } | 504 | } |
517 | |||
518 | EXPORT_SYMBOL_GPL(tpm_pm_resume); | 505 | EXPORT_SYMBOL_GPL(tpm_pm_resume); |
519 | 506 | ||
520 | /* | 507 | /* |
@@ -524,8 +511,7 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); | |||
524 | * upon errant exit from this function specific probe function should call | 511 | * upon errant exit from this function specific probe function should call |
525 | * pci_disable_device | 512 | * pci_disable_device |
526 | */ | 513 | */ |
527 | int tpm_register_hardware(struct pci_dev *pci_dev, | 514 | int tpm_register_hardware(struct device *dev, struct tpm_vendor_specific *entry) |
528 | struct tpm_vendor_specific *entry) | ||
529 | { | 515 | { |
530 | #define DEVNAME_SIZE 7 | 516 | #define DEVNAME_SIZE 7 |
531 | 517 | ||
@@ -534,12 +520,10 @@ int tpm_register_hardware(struct pci_dev *pci_dev, | |||
534 | int i, j; | 520 | int i, j; |
535 | 521 | ||
536 | /* Driver specific per-device data */ | 522 | /* Driver specific per-device data */ |
537 | chip = kmalloc(sizeof(*chip), GFP_KERNEL); | 523 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
538 | if (chip == NULL) | 524 | if (chip == NULL) |
539 | return -ENOMEM; | 525 | return -ENOMEM; |
540 | 526 | ||
541 | memset(chip, 0, sizeof(struct tpm_chip)); | ||
542 | |||
543 | init_MUTEX(&chip->buffer_mutex); | 527 | init_MUTEX(&chip->buffer_mutex); |
544 | init_MUTEX(&chip->tpm_mutex); | 528 | init_MUTEX(&chip->tpm_mutex); |
545 | INIT_LIST_HEAD(&chip->list); | 529 | INIT_LIST_HEAD(&chip->list); |
@@ -563,8 +547,7 @@ int tpm_register_hardware(struct pci_dev *pci_dev, | |||
563 | 547 | ||
564 | dev_num_search_complete: | 548 | dev_num_search_complete: |
565 | if (chip->dev_num < 0) { | 549 | if (chip->dev_num < 0) { |
566 | dev_err(&pci_dev->dev, | 550 | dev_err(dev, "No available tpm device numbers\n"); |
567 | "No available tpm device numbers\n"); | ||
568 | kfree(chip); | 551 | kfree(chip); |
569 | return -ENODEV; | 552 | return -ENODEV; |
570 | } else if (chip->dev_num == 0) | 553 | } else if (chip->dev_num == 0) |
@@ -576,15 +559,15 @@ dev_num_search_complete: | |||
576 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); | 559 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); |
577 | chip->vendor->miscdev.name = devname; | 560 | chip->vendor->miscdev.name = devname; |
578 | 561 | ||
579 | chip->vendor->miscdev.dev = &(pci_dev->dev); | 562 | chip->vendor->miscdev.dev = dev; |
580 | chip->pci_dev = pci_dev_get(pci_dev); | 563 | chip->dev = get_device(dev); |
581 | 564 | ||
582 | if (misc_register(&chip->vendor->miscdev)) { | 565 | if (misc_register(&chip->vendor->miscdev)) { |
583 | dev_err(&chip->pci_dev->dev, | 566 | dev_err(chip->dev, |
584 | "unable to misc_register %s, minor %d\n", | 567 | "unable to misc_register %s, minor %d\n", |
585 | chip->vendor->miscdev.name, | 568 | chip->vendor->miscdev.name, |
586 | chip->vendor->miscdev.minor); | 569 | chip->vendor->miscdev.minor); |
587 | pci_dev_put(pci_dev); | 570 | put_device(dev); |
588 | kfree(chip); | 571 | kfree(chip); |
589 | dev_mask[i] &= !(1 << j); | 572 | dev_mask[i] &= !(1 << j); |
590 | return -ENODEV; | 573 | return -ENODEV; |
@@ -592,17 +575,16 @@ dev_num_search_complete: | |||
592 | 575 | ||
593 | spin_lock(&driver_lock); | 576 | spin_lock(&driver_lock); |
594 | 577 | ||
595 | pci_set_drvdata(pci_dev, chip); | 578 | dev_set_drvdata(dev, chip); |
596 | 579 | ||
597 | list_add(&chip->list, &tpm_chip_list); | 580 | list_add(&chip->list, &tpm_chip_list); |
598 | 581 | ||
599 | spin_unlock(&driver_lock); | 582 | spin_unlock(&driver_lock); |
600 | 583 | ||
601 | sysfs_create_group(&pci_dev->dev.kobj, chip->vendor->attr_group); | 584 | sysfs_create_group(&dev->kobj, chip->vendor->attr_group); |
602 | 585 | ||
603 | return 0; | 586 | return 0; |
604 | } | 587 | } |
605 | |||
606 | EXPORT_SYMBOL_GPL(tpm_register_hardware); | 588 | EXPORT_SYMBOL_GPL(tpm_register_hardware); |
607 | 589 | ||
608 | MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)"); | 590 | MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)"); |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 373b41f6b460..024814b50c3c 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -55,12 +55,13 @@ struct tpm_vendor_specific { | |||
55 | int (*recv) (struct tpm_chip *, u8 *, size_t); | 55 | int (*recv) (struct tpm_chip *, u8 *, size_t); |
56 | int (*send) (struct tpm_chip *, u8 *, size_t); | 56 | int (*send) (struct tpm_chip *, u8 *, size_t); |
57 | void (*cancel) (struct tpm_chip *); | 57 | void (*cancel) (struct tpm_chip *); |
58 | u8 (*status) (struct tpm_chip *); | ||
58 | struct miscdevice miscdev; | 59 | struct miscdevice miscdev; |
59 | struct attribute_group *attr_group; | 60 | struct attribute_group *attr_group; |
60 | }; | 61 | }; |
61 | 62 | ||
62 | struct tpm_chip { | 63 | struct tpm_chip { |
63 | struct pci_dev *pci_dev; /* PCI device stuff */ | 64 | struct device *dev; /* Device stuff */ |
64 | 65 | ||
65 | int dev_num; /* /dev/tpm# */ | 66 | int dev_num; /* /dev/tpm# */ |
66 | int num_opens; /* only one allowed */ | 67 | int num_opens; /* only one allowed */ |
@@ -91,13 +92,13 @@ static inline void tpm_write_index(int base, int index, int value) | |||
91 | outb(value & 0xFF, base+1); | 92 | outb(value & 0xFF, base+1); |
92 | } | 93 | } |
93 | 94 | ||
94 | extern int tpm_register_hardware(struct pci_dev *, | 95 | extern int tpm_register_hardware(struct device *, |
95 | struct tpm_vendor_specific *); | 96 | struct tpm_vendor_specific *); |
96 | extern int tpm_open(struct inode *, struct file *); | 97 | extern int tpm_open(struct inode *, struct file *); |
97 | extern int tpm_release(struct inode *, struct file *); | 98 | extern int tpm_release(struct inode *, struct file *); |
98 | extern ssize_t tpm_write(struct file *, const char __user *, size_t, | 99 | extern ssize_t tpm_write(struct file *, const char __user *, size_t, |
99 | loff_t *); | 100 | loff_t *); |
100 | extern ssize_t tpm_read(struct file *, char __user *, size_t, loff_t *); | 101 | extern ssize_t tpm_read(struct file *, char __user *, size_t, loff_t *); |
101 | extern void __devexit tpm_remove(struct pci_dev *); | 102 | extern void tpm_remove_hardware(struct device *); |
102 | extern int tpm_pm_suspend(struct pci_dev *, pm_message_t); | 103 | extern int tpm_pm_suspend(struct device *, pm_message_t); |
103 | extern int tpm_pm_resume(struct pci_dev *); | 104 | extern int tpm_pm_resume(struct device *); |
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index c0d64914595f..8cb42e84723c 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
@@ -40,7 +40,7 @@ enum tpm_atmel_read_status { | |||
40 | ATML_STATUS_READY = 0x08 | 40 | ATML_STATUS_READY = 0x08 |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count) | 43 | static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) |
44 | { | 44 | { |
45 | u8 status, *hdr = buf; | 45 | u8 status, *hdr = buf; |
46 | u32 size; | 46 | u32 size; |
@@ -54,7 +54,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
54 | for (i = 0; i < 6; i++) { | 54 | for (i = 0; i < 6; i++) { |
55 | status = inb(chip->vendor->base + 1); | 55 | status = inb(chip->vendor->base + 1); |
56 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 56 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
57 | dev_err(&chip->pci_dev->dev, | 57 | dev_err(chip->dev, |
58 | "error reading header\n"); | 58 | "error reading header\n"); |
59 | return -EIO; | 59 | return -EIO; |
60 | } | 60 | } |
@@ -66,12 +66,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
66 | size = be32_to_cpu(*native_size); | 66 | size = be32_to_cpu(*native_size); |
67 | 67 | ||
68 | if (count < size) { | 68 | if (count < size) { |
69 | dev_err(&chip->pci_dev->dev, | 69 | dev_err(chip->dev, |
70 | "Recv size(%d) less than available space\n", size); | 70 | "Recv size(%d) less than available space\n", size); |
71 | for (; i < size; i++) { /* clear the waiting data anyway */ | 71 | for (; i < size; i++) { /* clear the waiting data anyway */ |
72 | status = inb(chip->vendor->base + 1); | 72 | status = inb(chip->vendor->base + 1); |
73 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 73 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
74 | dev_err(&chip->pci_dev->dev, | 74 | dev_err(chip->dev, |
75 | "error reading data\n"); | 75 | "error reading data\n"); |
76 | return -EIO; | 76 | return -EIO; |
77 | } | 77 | } |
@@ -83,7 +83,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
83 | for (; i < size; i++) { | 83 | for (; i < size; i++) { |
84 | status = inb(chip->vendor->base + 1); | 84 | status = inb(chip->vendor->base + 1); |
85 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 85 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
86 | dev_err(&chip->pci_dev->dev, | 86 | dev_err(chip->dev, |
87 | "error reading data\n"); | 87 | "error reading data\n"); |
88 | return -EIO; | 88 | return -EIO; |
89 | } | 89 | } |
@@ -93,20 +93,20 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
93 | /* make sure data available is gone */ | 93 | /* make sure data available is gone */ |
94 | status = inb(chip->vendor->base + 1); | 94 | status = inb(chip->vendor->base + 1); |
95 | if (status & ATML_STATUS_DATA_AVAIL) { | 95 | if (status & ATML_STATUS_DATA_AVAIL) { |
96 | dev_err(&chip->pci_dev->dev, "data available is stuck\n"); | 96 | dev_err(chip->dev, "data available is stuck\n"); |
97 | return -EIO; | 97 | return -EIO; |
98 | } | 98 | } |
99 | 99 | ||
100 | return size; | 100 | return size; |
101 | } | 101 | } |
102 | 102 | ||
103 | static int tpm_atml_send(struct tpm_chip *chip, u8 * buf, size_t count) | 103 | static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) |
104 | { | 104 | { |
105 | int i; | 105 | int i; |
106 | 106 | ||
107 | dev_dbg(&chip->pci_dev->dev, "tpm_atml_send: "); | 107 | dev_dbg(chip->dev, "tpm_atml_send:\n"); |
108 | for (i = 0; i < count; i++) { | 108 | for (i = 0; i < count; i++) { |
109 | dev_dbg(&chip->pci_dev->dev, "0x%x(%d) ", buf[i], buf[i]); | 109 | dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); |
110 | outb(buf[i], chip->vendor->base); | 110 | outb(buf[i], chip->vendor->base); |
111 | } | 111 | } |
112 | 112 | ||
@@ -118,6 +118,11 @@ static void tpm_atml_cancel(struct tpm_chip *chip) | |||
118 | outb(ATML_STATUS_ABORT, chip->vendor->base + 1); | 118 | outb(ATML_STATUS_ABORT, chip->vendor->base + 1); |
119 | } | 119 | } |
120 | 120 | ||
121 | static u8 tpm_atml_status(struct tpm_chip *chip) | ||
122 | { | ||
123 | return inb(chip->vendor->base + 1); | ||
124 | } | ||
125 | |||
121 | static struct file_operations atmel_ops = { | 126 | static struct file_operations atmel_ops = { |
122 | .owner = THIS_MODULE, | 127 | .owner = THIS_MODULE, |
123 | .llseek = no_llseek, | 128 | .llseek = no_llseek, |
@@ -137,7 +142,7 @@ static struct attribute* atmel_attrs[] = { | |||
137 | &dev_attr_pcrs.attr, | 142 | &dev_attr_pcrs.attr, |
138 | &dev_attr_caps.attr, | 143 | &dev_attr_caps.attr, |
139 | &dev_attr_cancel.attr, | 144 | &dev_attr_cancel.attr, |
140 | 0, | 145 | NULL, |
141 | }; | 146 | }; |
142 | 147 | ||
143 | static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs }; | 148 | static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs }; |
@@ -146,6 +151,7 @@ static struct tpm_vendor_specific tpm_atmel = { | |||
146 | .recv = tpm_atml_recv, | 151 | .recv = tpm_atml_recv, |
147 | .send = tpm_atml_send, | 152 | .send = tpm_atml_send, |
148 | .cancel = tpm_atml_cancel, | 153 | .cancel = tpm_atml_cancel, |
154 | .status = tpm_atml_status, | ||
149 | .req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL, | 155 | .req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL, |
150 | .req_complete_val = ATML_STATUS_DATA_AVAIL, | 156 | .req_complete_val = ATML_STATUS_DATA_AVAIL, |
151 | .req_canceled = ATML_STATUS_READY, | 157 | .req_canceled = ATML_STATUS_READY, |
@@ -153,86 +159,94 @@ static struct tpm_vendor_specific tpm_atmel = { | |||
153 | .miscdev = { .fops = &atmel_ops, }, | 159 | .miscdev = { .fops = &atmel_ops, }, |
154 | }; | 160 | }; |
155 | 161 | ||
156 | static int __devinit tpm_atml_init(struct pci_dev *pci_dev, | 162 | static struct platform_device *pdev; |
157 | const struct pci_device_id *pci_id) | 163 | |
164 | static void __devexit tpm_atml_remove(struct device *dev) | ||
165 | { | ||
166 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
167 | if (chip) { | ||
168 | release_region(chip->vendor->base, 2); | ||
169 | tpm_remove_hardware(chip->dev); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | static struct device_driver atml_drv = { | ||
174 | .name = "tpm_atmel", | ||
175 | .bus = &platform_bus_type, | ||
176 | .owner = THIS_MODULE, | ||
177 | .suspend = tpm_pm_suspend, | ||
178 | .resume = tpm_pm_resume, | ||
179 | }; | ||
180 | |||
181 | static int __init init_atmel(void) | ||
158 | { | 182 | { |
159 | u8 version[4]; | ||
160 | int rc = 0; | 183 | int rc = 0; |
161 | int lo, hi; | 184 | int lo, hi; |
162 | 185 | ||
163 | if (pci_enable_device(pci_dev)) | 186 | driver_register(&atml_drv); |
164 | return -EIO; | ||
165 | 187 | ||
166 | lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); | 188 | lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); |
167 | hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); | 189 | hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); |
168 | 190 | ||
169 | tpm_atmel.base = (hi<<8)|lo; | 191 | tpm_atmel.base = (hi<<8)|lo; |
170 | dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base); | ||
171 | 192 | ||
172 | /* verify that it is an Atmel part */ | 193 | /* verify that it is an Atmel part */ |
173 | if (tpm_read_index(TPM_ADDR, 4) != 'A' || tpm_read_index(TPM_ADDR, 5) != 'T' | 194 | if (tpm_read_index(TPM_ADDR, 4) != 'A' || tpm_read_index(TPM_ADDR, 5) != 'T' |
174 | || tpm_read_index(TPM_ADDR, 6) != 'M' || tpm_read_index(TPM_ADDR, 7) != 'L') { | 195 | || tpm_read_index(TPM_ADDR, 6) != 'M' || tpm_read_index(TPM_ADDR, 7) != 'L') { |
175 | rc = -ENODEV; | 196 | return -ENODEV; |
176 | goto out_err; | ||
177 | } | 197 | } |
178 | 198 | ||
179 | /* query chip for its version number */ | 199 | /* verify chip version number is 1.1 */ |
180 | if ((version[0] = tpm_read_index(TPM_ADDR, 0x00)) != 0xFF) { | 200 | if ( (tpm_read_index(TPM_ADDR, 0x00) != 0x01) || |
181 | version[1] = tpm_read_index(TPM_ADDR, 0x01); | 201 | (tpm_read_index(TPM_ADDR, 0x01) != 0x01 )) |
182 | version[2] = tpm_read_index(TPM_ADDR, 0x02); | 202 | return -ENODEV; |
183 | version[3] = tpm_read_index(TPM_ADDR, 0x03); | 203 | |
184 | } else { | 204 | pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL); |
185 | dev_info(&pci_dev->dev, "version query failed\n"); | 205 | if ( !pdev ) |
186 | rc = -ENODEV; | 206 | return -ENOMEM; |
187 | goto out_err; | 207 | |
208 | pdev->name = "tpm_atmel0"; | ||
209 | pdev->id = -1; | ||
210 | pdev->num_resources = 0; | ||
211 | pdev->dev.release = tpm_atml_remove; | ||
212 | pdev->dev.driver = &atml_drv; | ||
213 | |||
214 | if ((rc = platform_device_register(pdev)) < 0) { | ||
215 | kfree(pdev); | ||
216 | pdev = NULL; | ||
217 | return rc; | ||
188 | } | 218 | } |
189 | 219 | ||
190 | if ((rc = tpm_register_hardware(pci_dev, &tpm_atmel)) < 0) | 220 | if (request_region(tpm_atmel.base, 2, "tpm_atmel0") == NULL ) { |
191 | goto out_err; | 221 | platform_device_unregister(pdev); |
222 | kfree(pdev); | ||
223 | pdev = NULL; | ||
224 | return -EBUSY; | ||
225 | } | ||
192 | 226 | ||
193 | dev_info(&pci_dev->dev, | 227 | if ((rc = tpm_register_hardware(&pdev->dev, &tpm_atmel)) < 0) { |
194 | "Atmel TPM version %d.%d.%d.%d\n", version[0], version[1], | 228 | release_region(tpm_atmel.base, 2); |
195 | version[2], version[3]); | 229 | platform_device_unregister(pdev); |
230 | kfree(pdev); | ||
231 | pdev = NULL; | ||
232 | return rc; | ||
233 | } | ||
196 | 234 | ||
235 | dev_info(&pdev->dev, "Atmel TPM 1.1, Base Address: 0x%x\n", | ||
236 | tpm_atmel.base); | ||
197 | return 0; | 237 | return 0; |
198 | out_err: | ||
199 | pci_disable_device(pci_dev); | ||
200 | return rc; | ||
201 | } | ||
202 | |||
203 | static struct pci_device_id tpm_pci_tbl[] __devinitdata = { | ||
204 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)}, | ||
205 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)}, | ||
206 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)}, | ||
207 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)}, | ||
208 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)}, | ||
209 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0)}, | ||
210 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1)}, | ||
211 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0)}, | ||
212 | {PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)}, | ||
213 | {PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6LPC)}, | ||
214 | {0,} | ||
215 | }; | ||
216 | |||
217 | MODULE_DEVICE_TABLE(pci, tpm_pci_tbl); | ||
218 | |||
219 | static struct pci_driver atmel_pci_driver = { | ||
220 | .name = "tpm_atmel", | ||
221 | .id_table = tpm_pci_tbl, | ||
222 | .probe = tpm_atml_init, | ||
223 | .remove = __devexit_p(tpm_remove), | ||
224 | .suspend = tpm_pm_suspend, | ||
225 | .resume = tpm_pm_resume, | ||
226 | }; | ||
227 | |||
228 | static int __init init_atmel(void) | ||
229 | { | ||
230 | return pci_register_driver(&atmel_pci_driver); | ||
231 | } | 238 | } |
232 | 239 | ||
233 | static void __exit cleanup_atmel(void) | 240 | static void __exit cleanup_atmel(void) |
234 | { | 241 | { |
235 | pci_unregister_driver(&atmel_pci_driver); | 242 | if (pdev) { |
243 | tpm_atml_remove(&pdev->dev); | ||
244 | platform_device_unregister(pdev); | ||
245 | kfree(pdev); | ||
246 | pdev = NULL; | ||
247 | } | ||
248 | |||
249 | driver_unregister(&atml_drv); | ||
236 | } | 250 | } |
237 | 251 | ||
238 | module_init(init_atmel); | 252 | module_init(init_atmel); |
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index 939e51e119e6..8198dbb7370f 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Specifications at www.trustedcomputinggroup.org | 5 | * Specifications at www.trustedcomputinggroup.org |
6 | * | 6 | * |
7 | * Copyright (C) 2005, Marcel Selhorst <selhorst@crypto.rub.de> | 7 | * Copyright (C) 2005, Marcel Selhorst <selhorst@crypto.rub.de> |
8 | * Sirrix AG - security technologies, http://www.sirrix.com and | ||
8 | * Applied Data Security Group, Ruhr-University Bochum, Germany | 9 | * Applied Data Security Group, Ruhr-University Bochum, Germany |
9 | * Project-Homepage: http://www.prosec.rub.de/tpm | 10 | * Project-Homepage: http://www.prosec.rub.de/tpm |
10 | * | 11 | * |
@@ -29,9 +30,10 @@ | |||
29 | #define TPM_INFINEON_DEV_VEN_VALUE 0x15D1 | 30 | #define TPM_INFINEON_DEV_VEN_VALUE 0x15D1 |
30 | 31 | ||
31 | /* These values will be filled after PnP-call */ | 32 | /* These values will be filled after PnP-call */ |
32 | static int TPM_INF_DATA = 0; | 33 | static int TPM_INF_DATA; |
33 | static int TPM_INF_ADDR = 0; | 34 | static int TPM_INF_ADDR; |
34 | static int pnp_registered = 0; | 35 | static int TPM_INF_BASE; |
36 | static int TPM_INF_PORT_LEN; | ||
35 | 37 | ||
36 | /* TPM header definitions */ | 38 | /* TPM header definitions */ |
37 | enum infineon_tpm_header { | 39 | enum infineon_tpm_header { |
@@ -143,11 +145,9 @@ static int wait(struct tpm_chip *chip, int wait_for_bit) | |||
143 | } | 145 | } |
144 | if (i == TPM_MAX_TRIES) { /* timeout occurs */ | 146 | if (i == TPM_MAX_TRIES) { /* timeout occurs */ |
145 | if (wait_for_bit == STAT_XFE) | 147 | if (wait_for_bit == STAT_XFE) |
146 | dev_err(&chip->pci_dev->dev, | 148 | dev_err(chip->dev, "Timeout in wait(STAT_XFE)\n"); |
147 | "Timeout in wait(STAT_XFE)\n"); | ||
148 | if (wait_for_bit == STAT_RDA) | 149 | if (wait_for_bit == STAT_RDA) |
149 | dev_err(&chip->pci_dev->dev, | 150 | dev_err(chip->dev, "Timeout in wait(STAT_RDA)\n"); |
150 | "Timeout in wait(STAT_RDA)\n"); | ||
151 | return -EIO; | 151 | return -EIO; |
152 | } | 152 | } |
153 | return 0; | 153 | return 0; |
@@ -170,7 +170,7 @@ static void wait_and_send(struct tpm_chip *chip, u8 sendbyte) | |||
170 | static void tpm_wtx(struct tpm_chip *chip) | 170 | static void tpm_wtx(struct tpm_chip *chip) |
171 | { | 171 | { |
172 | number_of_wtx++; | 172 | number_of_wtx++; |
173 | dev_info(&chip->pci_dev->dev, "Granting WTX (%02d / %02d)\n", | 173 | dev_info(chip->dev, "Granting WTX (%02d / %02d)\n", |
174 | number_of_wtx, TPM_MAX_WTX_PACKAGES); | 174 | number_of_wtx, TPM_MAX_WTX_PACKAGES); |
175 | wait_and_send(chip, TPM_VL_VER); | 175 | wait_and_send(chip, TPM_VL_VER); |
176 | wait_and_send(chip, TPM_CTRL_WTX); | 176 | wait_and_send(chip, TPM_CTRL_WTX); |
@@ -181,7 +181,7 @@ static void tpm_wtx(struct tpm_chip *chip) | |||
181 | 181 | ||
182 | static void tpm_wtx_abort(struct tpm_chip *chip) | 182 | static void tpm_wtx_abort(struct tpm_chip *chip) |
183 | { | 183 | { |
184 | dev_info(&chip->pci_dev->dev, "Aborting WTX\n"); | 184 | dev_info(chip->dev, "Aborting WTX\n"); |
185 | wait_and_send(chip, TPM_VL_VER); | 185 | wait_and_send(chip, TPM_VL_VER); |
186 | wait_and_send(chip, TPM_CTRL_WTX_ABORT); | 186 | wait_and_send(chip, TPM_CTRL_WTX_ABORT); |
187 | wait_and_send(chip, 0x00); | 187 | wait_and_send(chip, 0x00); |
@@ -206,7 +206,7 @@ recv_begin: | |||
206 | } | 206 | } |
207 | 207 | ||
208 | if (buf[0] != TPM_VL_VER) { | 208 | if (buf[0] != TPM_VL_VER) { |
209 | dev_err(&chip->pci_dev->dev, | 209 | dev_err(chip->dev, |
210 | "Wrong transport protocol implementation!\n"); | 210 | "Wrong transport protocol implementation!\n"); |
211 | return -EIO; | 211 | return -EIO; |
212 | } | 212 | } |
@@ -221,8 +221,7 @@ recv_begin: | |||
221 | } | 221 | } |
222 | 222 | ||
223 | if ((size == 0x6D00) && (buf[1] == 0x80)) { | 223 | if ((size == 0x6D00) && (buf[1] == 0x80)) { |
224 | dev_err(&chip->pci_dev->dev, | 224 | dev_err(chip->dev, "Error handling on vendor layer!\n"); |
225 | "Error handling on vendor layer!\n"); | ||
226 | return -EIO; | 225 | return -EIO; |
227 | } | 226 | } |
228 | 227 | ||
@@ -234,7 +233,7 @@ recv_begin: | |||
234 | } | 233 | } |
235 | 234 | ||
236 | if (buf[1] == TPM_CTRL_WTX) { | 235 | if (buf[1] == TPM_CTRL_WTX) { |
237 | dev_info(&chip->pci_dev->dev, "WTX-package received\n"); | 236 | dev_info(chip->dev, "WTX-package received\n"); |
238 | if (number_of_wtx < TPM_MAX_WTX_PACKAGES) { | 237 | if (number_of_wtx < TPM_MAX_WTX_PACKAGES) { |
239 | tpm_wtx(chip); | 238 | tpm_wtx(chip); |
240 | goto recv_begin; | 239 | goto recv_begin; |
@@ -245,14 +244,14 @@ recv_begin: | |||
245 | } | 244 | } |
246 | 245 | ||
247 | if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) { | 246 | if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) { |
248 | dev_info(&chip->pci_dev->dev, "WTX-abort acknowledged\n"); | 247 | dev_info(chip->dev, "WTX-abort acknowledged\n"); |
249 | return size; | 248 | return size; |
250 | } | 249 | } |
251 | 250 | ||
252 | if (buf[1] == TPM_CTRL_ERROR) { | 251 | if (buf[1] == TPM_CTRL_ERROR) { |
253 | dev_err(&chip->pci_dev->dev, "ERROR-package received:\n"); | 252 | dev_err(chip->dev, "ERROR-package received:\n"); |
254 | if (buf[4] == TPM_INF_NAK) | 253 | if (buf[4] == TPM_INF_NAK) |
255 | dev_err(&chip->pci_dev->dev, | 254 | dev_err(chip->dev, |
256 | "-> Negative acknowledgement" | 255 | "-> Negative acknowledgement" |
257 | " - retransmit command!\n"); | 256 | " - retransmit command!\n"); |
258 | return -EIO; | 257 | return -EIO; |
@@ -271,7 +270,7 @@ static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count) | |||
271 | 270 | ||
272 | ret = empty_fifo(chip, 1); | 271 | ret = empty_fifo(chip, 1); |
273 | if (ret) { | 272 | if (ret) { |
274 | dev_err(&chip->pci_dev->dev, "Timeout while clearing FIFO\n"); | 273 | dev_err(chip->dev, "Timeout while clearing FIFO\n"); |
275 | return -EIO; | 274 | return -EIO; |
276 | } | 275 | } |
277 | 276 | ||
@@ -316,6 +315,11 @@ static void tpm_inf_cancel(struct tpm_chip *chip) | |||
316 | */ | 315 | */ |
317 | } | 316 | } |
318 | 317 | ||
318 | static u8 tpm_inf_status(struct tpm_chip *chip) | ||
319 | { | ||
320 | return inb(chip->vendor->base + STAT); | ||
321 | } | ||
322 | |||
319 | static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); | 323 | static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); |
320 | static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL); | 324 | static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL); |
321 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL); | 325 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL); |
@@ -344,6 +348,7 @@ static struct tpm_vendor_specific tpm_inf = { | |||
344 | .recv = tpm_inf_recv, | 348 | .recv = tpm_inf_recv, |
345 | .send = tpm_inf_send, | 349 | .send = tpm_inf_send, |
346 | .cancel = tpm_inf_cancel, | 350 | .cancel = tpm_inf_cancel, |
351 | .status = tpm_inf_status, | ||
347 | .req_complete_mask = 0, | 352 | .req_complete_mask = 0, |
348 | .req_complete_val = 0, | 353 | .req_complete_val = 0, |
349 | .attr_group = &inf_attr_grp, | 354 | .attr_group = &inf_attr_grp, |
@@ -356,30 +361,11 @@ static const struct pnp_device_id tpm_pnp_tbl[] = { | |||
356 | {"IFX0102", 0}, | 361 | {"IFX0102", 0}, |
357 | {"", 0} | 362 | {"", 0} |
358 | }; | 363 | }; |
364 | |||
359 | MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl); | 365 | MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl); |
360 | 366 | ||
361 | static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | 367 | static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, |
362 | const struct pnp_device_id *dev_id) | 368 | const struct pnp_device_id *dev_id) |
363 | { | ||
364 | if (pnp_port_valid(dev, 0)) { | ||
365 | TPM_INF_ADDR = (pnp_port_start(dev, 0) & 0xff); | ||
366 | TPM_INF_DATA = ((TPM_INF_ADDR + 1) & 0xff); | ||
367 | tpm_inf.base = pnp_port_start(dev, 1); | ||
368 | dev_info(&dev->dev, "Found %s with ID %s\n", | ||
369 | dev->name, dev_id->id); | ||
370 | return 0; | ||
371 | } | ||
372 | return -ENODEV; | ||
373 | } | ||
374 | |||
375 | static struct pnp_driver tpm_inf_pnp = { | ||
376 | .name = "tpm_inf_pnp", | ||
377 | .id_table = tpm_pnp_tbl, | ||
378 | .probe = tpm_inf_pnp_probe, | ||
379 | }; | ||
380 | |||
381 | static int __devinit tpm_inf_probe(struct pci_dev *pci_dev, | ||
382 | const struct pci_device_id *pci_id) | ||
383 | { | 369 | { |
384 | int rc = 0; | 370 | int rc = 0; |
385 | u8 iol, ioh; | 371 | u8 iol, ioh; |
@@ -388,30 +374,28 @@ static int __devinit tpm_inf_probe(struct pci_dev *pci_dev, | |||
388 | int productid[2]; | 374 | int productid[2]; |
389 | char chipname[20]; | 375 | char chipname[20]; |
390 | 376 | ||
391 | rc = pci_enable_device(pci_dev); | 377 | /* read IO-ports through PnP */ |
392 | if (rc) | 378 | if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && |
393 | return rc; | 379 | !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) { |
394 | 380 | TPM_INF_ADDR = pnp_port_start(dev, 0); | |
395 | dev_info(&pci_dev->dev, "LPC-bus found at 0x%x\n", pci_id->device); | 381 | TPM_INF_DATA = (TPM_INF_ADDR + 1); |
396 | 382 | TPM_INF_BASE = pnp_port_start(dev, 1); | |
397 | /* read IO-ports from PnP */ | 383 | TPM_INF_PORT_LEN = pnp_port_len(dev, 1); |
398 | rc = pnp_register_driver(&tpm_inf_pnp); | 384 | if (!TPM_INF_PORT_LEN) |
399 | if (rc < 0) { | 385 | return -EINVAL; |
400 | dev_err(&pci_dev->dev, | 386 | dev_info(&dev->dev, "Found %s with ID %s\n", |
401 | "Error %x from pnp_register_driver!\n",rc); | 387 | dev->name, dev_id->id); |
402 | goto error2; | 388 | if (!((TPM_INF_BASE >> 8) & 0xff)) |
403 | } | 389 | return -EINVAL; |
404 | if (!rc) { | 390 | /* publish my base address and request region */ |
405 | dev_info(&pci_dev->dev, "No Infineon TPM found!\n"); | 391 | tpm_inf.base = TPM_INF_BASE; |
406 | goto error; | 392 | if (request_region |
393 | (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { | ||
394 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); | ||
395 | return -EINVAL; | ||
396 | } | ||
407 | } else { | 397 | } else { |
408 | pnp_registered = 1; | 398 | return -EINVAL; |
409 | } | ||
410 | |||
411 | /* Make sure, we have received valid config ports */ | ||
412 | if (!TPM_INF_ADDR) { | ||
413 | dev_err(&pci_dev->dev, "No valid IO-ports received!\n"); | ||
414 | goto error; | ||
415 | } | 399 | } |
416 | 400 | ||
417 | /* query chip for its vendor, its version number a.s.o. */ | 401 | /* query chip for its vendor, its version number a.s.o. */ |
@@ -443,10 +427,6 @@ static int __devinit tpm_inf_probe(struct pci_dev *pci_dev, | |||
443 | 427 | ||
444 | if ((vendorid[0] << 8 | vendorid[1]) == (TPM_INFINEON_DEV_VEN_VALUE)) { | 428 | if ((vendorid[0] << 8 | vendorid[1]) == (TPM_INFINEON_DEV_VEN_VALUE)) { |
445 | 429 | ||
446 | if (tpm_inf.base == 0) { | ||
447 | dev_err(&pci_dev->dev, "No IO-ports found!\n"); | ||
448 | goto error; | ||
449 | } | ||
450 | /* configure TPM with IO-ports */ | 430 | /* configure TPM with IO-ports */ |
451 | outb(IOLIMH, TPM_INF_ADDR); | 431 | outb(IOLIMH, TPM_INF_ADDR); |
452 | outb(((tpm_inf.base >> 8) & 0xff), TPM_INF_DATA); | 432 | outb(((tpm_inf.base >> 8) & 0xff), TPM_INF_DATA); |
@@ -460,10 +440,11 @@ static int __devinit tpm_inf_probe(struct pci_dev *pci_dev, | |||
460 | iol = inb(TPM_INF_DATA); | 440 | iol = inb(TPM_INF_DATA); |
461 | 441 | ||
462 | if ((ioh << 8 | iol) != tpm_inf.base) { | 442 | if ((ioh << 8 | iol) != tpm_inf.base) { |
463 | dev_err(&pci_dev->dev, | 443 | dev_err(&dev->dev, |
464 | "Could not set IO-ports to %04x\n", | 444 | "Could not set IO-ports to %04x\n", |
465 | tpm_inf.base); | 445 | tpm_inf.base); |
466 | goto error; | 446 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); |
447 | return -EIO; | ||
467 | } | 448 | } |
468 | 449 | ||
469 | /* activate register */ | 450 | /* activate register */ |
@@ -475,7 +456,7 @@ static int __devinit tpm_inf_probe(struct pci_dev *pci_dev, | |||
475 | outb(RESET_LP_IRQC_DISABLE, tpm_inf.base + CMD); | 456 | outb(RESET_LP_IRQC_DISABLE, tpm_inf.base + CMD); |
476 | 457 | ||
477 | /* Finally, we're done, print some infos */ | 458 | /* Finally, we're done, print some infos */ |
478 | dev_info(&pci_dev->dev, "TPM found: " | 459 | dev_info(&dev->dev, "TPM found: " |
479 | "config base 0x%x, " | 460 | "config base 0x%x, " |
480 | "io base 0x%x, " | 461 | "io base 0x%x, " |
481 | "chip version %02x%02x, " | 462 | "chip version %02x%02x, " |
@@ -483,59 +464,53 @@ static int __devinit tpm_inf_probe(struct pci_dev *pci_dev, | |||
483 | "product id %02x%02x" | 464 | "product id %02x%02x" |
484 | "%s\n", | 465 | "%s\n", |
485 | TPM_INF_ADDR, | 466 | TPM_INF_ADDR, |
486 | tpm_inf.base, | 467 | TPM_INF_BASE, |
487 | version[0], version[1], | 468 | version[0], version[1], |
488 | vendorid[0], vendorid[1], | 469 | vendorid[0], vendorid[1], |
489 | productid[0], productid[1], chipname); | 470 | productid[0], productid[1], chipname); |
490 | 471 | ||
491 | rc = tpm_register_hardware(pci_dev, &tpm_inf); | 472 | rc = tpm_register_hardware(&dev->dev, &tpm_inf); |
492 | if (rc < 0) | 473 | if (rc < 0) { |
493 | goto error; | 474 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); |
475 | return -ENODEV; | ||
476 | } | ||
494 | return 0; | 477 | return 0; |
495 | } else { | 478 | } else { |
496 | dev_info(&pci_dev->dev, "No Infineon TPM found!\n"); | 479 | dev_info(&dev->dev, "No Infineon TPM found!\n"); |
497 | error: | ||
498 | pnp_unregister_driver(&tpm_inf_pnp); | ||
499 | error2: | ||
500 | pci_disable_device(pci_dev); | ||
501 | pnp_registered = 0; | ||
502 | return -ENODEV; | 480 | return -ENODEV; |
503 | } | 481 | } |
504 | } | 482 | } |
505 | 483 | ||
506 | static struct pci_device_id tpm_pci_tbl[] __devinitdata = { | 484 | static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev) |
507 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)}, | 485 | { |
508 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)}, | 486 | struct tpm_chip *chip = pnp_get_drvdata(dev); |
509 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)}, | ||
510 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)}, | ||
511 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)}, | ||
512 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0)}, | ||
513 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1)}, | ||
514 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2)}, | ||
515 | {0,} | ||
516 | }; | ||
517 | 487 | ||
518 | MODULE_DEVICE_TABLE(pci, tpm_pci_tbl); | 488 | if (chip) { |
489 | release_region(chip->vendor->base, TPM_INF_PORT_LEN); | ||
490 | tpm_remove_hardware(chip->dev); | ||
491 | } | ||
492 | } | ||
519 | 493 | ||
520 | static struct pci_driver inf_pci_driver = { | 494 | static struct pnp_driver tpm_inf_pnp = { |
521 | .name = "tpm_inf", | 495 | .name = "tpm_inf_pnp", |
522 | .id_table = tpm_pci_tbl, | 496 | .driver = { |
523 | .probe = tpm_inf_probe, | 497 | .owner = THIS_MODULE, |
524 | .remove = __devexit_p(tpm_remove), | 498 | .suspend = tpm_pm_suspend, |
525 | .suspend = tpm_pm_suspend, | 499 | .resume = tpm_pm_resume, |
526 | .resume = tpm_pm_resume, | 500 | }, |
501 | .id_table = tpm_pnp_tbl, | ||
502 | .probe = tpm_inf_pnp_probe, | ||
503 | .remove = tpm_inf_pnp_remove, | ||
527 | }; | 504 | }; |
528 | 505 | ||
529 | static int __init init_inf(void) | 506 | static int __init init_inf(void) |
530 | { | 507 | { |
531 | return pci_register_driver(&inf_pci_driver); | 508 | return pnp_register_driver(&tpm_inf_pnp); |
532 | } | 509 | } |
533 | 510 | ||
534 | static void __exit cleanup_inf(void) | 511 | static void __exit cleanup_inf(void) |
535 | { | 512 | { |
536 | if (pnp_registered) | 513 | pnp_unregister_driver(&tpm_inf_pnp); |
537 | pnp_unregister_driver(&tpm_inf_pnp); | ||
538 | pci_unregister_driver(&inf_pci_driver); | ||
539 | } | 514 | } |
540 | 515 | ||
541 | module_init(init_inf); | 516 | module_init(init_inf); |
@@ -543,5 +518,5 @@ module_exit(cleanup_inf); | |||
543 | 518 | ||
544 | MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>"); | 519 | MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>"); |
545 | MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); | 520 | MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); |
546 | MODULE_VERSION("1.5"); | 521 | MODULE_VERSION("1.6"); |
547 | MODULE_LICENSE("GPL"); | 522 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index b4127348c063..253871b5b1e2 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c | |||
@@ -111,7 +111,7 @@ static int nsc_wait_for_ready(struct tpm_chip *chip) | |||
111 | } | 111 | } |
112 | while (time_before(jiffies, stop)); | 112 | while (time_before(jiffies, stop)); |
113 | 113 | ||
114 | dev_info(&chip->pci_dev->dev, "wait for ready failed\n"); | 114 | dev_info(chip->dev, "wait for ready failed\n"); |
115 | return -EBUSY; | 115 | return -EBUSY; |
116 | } | 116 | } |
117 | 117 | ||
@@ -127,12 +127,12 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
127 | return -EIO; | 127 | return -EIO; |
128 | 128 | ||
129 | if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) { | 129 | if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) { |
130 | dev_err(&chip->pci_dev->dev, "F0 timeout\n"); | 130 | dev_err(chip->dev, "F0 timeout\n"); |
131 | return -EIO; | 131 | return -EIO; |
132 | } | 132 | } |
133 | if ((data = | 133 | if ((data = |
134 | inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) { | 134 | inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) { |
135 | dev_err(&chip->pci_dev->dev, "not in normal mode (0x%x)\n", | 135 | dev_err(chip->dev, "not in normal mode (0x%x)\n", |
136 | data); | 136 | data); |
137 | return -EIO; | 137 | return -EIO; |
138 | } | 138 | } |
@@ -141,7 +141,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
141 | for (p = buffer; p < &buffer[count]; p++) { | 141 | for (p = buffer; p < &buffer[count]; p++) { |
142 | if (wait_for_stat | 142 | if (wait_for_stat |
143 | (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) { | 143 | (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) { |
144 | dev_err(&chip->pci_dev->dev, | 144 | dev_err(chip->dev, |
145 | "OBF timeout (while reading data)\n"); | 145 | "OBF timeout (while reading data)\n"); |
146 | return -EIO; | 146 | return -EIO; |
147 | } | 147 | } |
@@ -152,11 +152,11 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
152 | 152 | ||
153 | if ((data & NSC_STATUS_F0) == 0 && | 153 | if ((data & NSC_STATUS_F0) == 0 && |
154 | (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) { | 154 | (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) { |
155 | dev_err(&chip->pci_dev->dev, "F0 not set\n"); | 155 | dev_err(chip->dev, "F0 not set\n"); |
156 | return -EIO; | 156 | return -EIO; |
157 | } | 157 | } |
158 | if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) { | 158 | if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) { |
159 | dev_err(&chip->pci_dev->dev, | 159 | dev_err(chip->dev, |
160 | "expected end of command(0x%x)\n", data); | 160 | "expected end of command(0x%x)\n", data); |
161 | return -EIO; | 161 | return -EIO; |
162 | } | 162 | } |
@@ -187,19 +187,19 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count) | |||
187 | return -EIO; | 187 | return -EIO; |
188 | 188 | ||
189 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { | 189 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { |
190 | dev_err(&chip->pci_dev->dev, "IBF timeout\n"); | 190 | dev_err(chip->dev, "IBF timeout\n"); |
191 | return -EIO; | 191 | return -EIO; |
192 | } | 192 | } |
193 | 193 | ||
194 | outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND); | 194 | outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND); |
195 | if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { | 195 | if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { |
196 | dev_err(&chip->pci_dev->dev, "IBR timeout\n"); | 196 | dev_err(chip->dev, "IBR timeout\n"); |
197 | return -EIO; | 197 | return -EIO; |
198 | } | 198 | } |
199 | 199 | ||
200 | for (i = 0; i < count; i++) { | 200 | for (i = 0; i < count; i++) { |
201 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { | 201 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { |
202 | dev_err(&chip->pci_dev->dev, | 202 | dev_err(chip->dev, |
203 | "IBF timeout (while writing data)\n"); | 203 | "IBF timeout (while writing data)\n"); |
204 | return -EIO; | 204 | return -EIO; |
205 | } | 205 | } |
@@ -207,7 +207,7 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count) | |||
207 | } | 207 | } |
208 | 208 | ||
209 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { | 209 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { |
210 | dev_err(&chip->pci_dev->dev, "IBF timeout\n"); | 210 | dev_err(chip->dev, "IBF timeout\n"); |
211 | return -EIO; | 211 | return -EIO; |
212 | } | 212 | } |
213 | outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND); | 213 | outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND); |
@@ -220,6 +220,11 @@ static void tpm_nsc_cancel(struct tpm_chip *chip) | |||
220 | outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND); | 220 | outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND); |
221 | } | 221 | } |
222 | 222 | ||
223 | static u8 tpm_nsc_status(struct tpm_chip *chip) | ||
224 | { | ||
225 | return inb(chip->vendor->base + NSC_STATUS); | ||
226 | } | ||
227 | |||
223 | static struct file_operations nsc_ops = { | 228 | static struct file_operations nsc_ops = { |
224 | .owner = THIS_MODULE, | 229 | .owner = THIS_MODULE, |
225 | .llseek = no_llseek, | 230 | .llseek = no_llseek, |
@@ -239,7 +244,7 @@ static struct attribute * nsc_attrs[] = { | |||
239 | &dev_attr_pcrs.attr, | 244 | &dev_attr_pcrs.attr, |
240 | &dev_attr_caps.attr, | 245 | &dev_attr_caps.attr, |
241 | &dev_attr_cancel.attr, | 246 | &dev_attr_cancel.attr, |
242 | 0, | 247 | NULL, |
243 | }; | 248 | }; |
244 | 249 | ||
245 | static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs }; | 250 | static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs }; |
@@ -248,6 +253,7 @@ static struct tpm_vendor_specific tpm_nsc = { | |||
248 | .recv = tpm_nsc_recv, | 253 | .recv = tpm_nsc_recv, |
249 | .send = tpm_nsc_send, | 254 | .send = tpm_nsc_send, |
250 | .cancel = tpm_nsc_cancel, | 255 | .cancel = tpm_nsc_cancel, |
256 | .status = tpm_nsc_status, | ||
251 | .req_complete_mask = NSC_STATUS_OBF, | 257 | .req_complete_mask = NSC_STATUS_OBF, |
252 | .req_complete_val = NSC_STATUS_OBF, | 258 | .req_complete_val = NSC_STATUS_OBF, |
253 | .req_canceled = NSC_STATUS_RDY, | 259 | .req_canceled = NSC_STATUS_RDY, |
@@ -255,16 +261,32 @@ static struct tpm_vendor_specific tpm_nsc = { | |||
255 | .miscdev = { .fops = &nsc_ops, }, | 261 | .miscdev = { .fops = &nsc_ops, }, |
256 | }; | 262 | }; |
257 | 263 | ||
258 | static int __devinit tpm_nsc_init(struct pci_dev *pci_dev, | 264 | static struct platform_device *pdev = NULL; |
259 | const struct pci_device_id *pci_id) | 265 | |
266 | static void __devexit tpm_nsc_remove(struct device *dev) | ||
267 | { | ||
268 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
269 | if ( chip ) { | ||
270 | release_region(chip->vendor->base, 2); | ||
271 | tpm_remove_hardware(chip->dev); | ||
272 | } | ||
273 | } | ||
274 | |||
275 | static struct device_driver nsc_drv = { | ||
276 | .name = "tpm_nsc", | ||
277 | .bus = &platform_bus_type, | ||
278 | .owner = THIS_MODULE, | ||
279 | .suspend = tpm_pm_suspend, | ||
280 | .resume = tpm_pm_resume, | ||
281 | }; | ||
282 | |||
283 | static int __init init_nsc(void) | ||
260 | { | 284 | { |
261 | int rc = 0; | 285 | int rc = 0; |
262 | int lo, hi; | 286 | int lo, hi; |
263 | int nscAddrBase = TPM_ADDR; | 287 | int nscAddrBase = TPM_ADDR; |
264 | 288 | ||
265 | 289 | driver_register(&nsc_drv); | |
266 | if (pci_enable_device(pci_dev)) | ||
267 | return -EIO; | ||
268 | 290 | ||
269 | /* select PM channel 1 */ | 291 | /* select PM channel 1 */ |
270 | tpm_write_index(nscAddrBase,NSC_LDN_INDEX, 0x12); | 292 | tpm_write_index(nscAddrBase,NSC_LDN_INDEX, 0x12); |
@@ -273,37 +295,71 @@ static int __devinit tpm_nsc_init(struct pci_dev *pci_dev, | |||
273 | if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) { | 295 | if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) { |
274 | nscAddrBase = (tpm_read_index(TPM_SUPERIO_ADDR, 0x2C)<<8)| | 296 | nscAddrBase = (tpm_read_index(TPM_SUPERIO_ADDR, 0x2C)<<8)| |
275 | (tpm_read_index(TPM_SUPERIO_ADDR, 0x2B)&0xFE); | 297 | (tpm_read_index(TPM_SUPERIO_ADDR, 0x2B)&0xFE); |
276 | if (tpm_read_index(nscAddrBase, NSC_SID_INDEX) != 0xF6) { | 298 | if (tpm_read_index(nscAddrBase, NSC_SID_INDEX) != 0xF6) |
277 | rc = -ENODEV; | 299 | return -ENODEV; |
278 | goto out_err; | ||
279 | } | ||
280 | } | 300 | } |
281 | 301 | ||
282 | hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI); | 302 | hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI); |
283 | lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO); | 303 | lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO); |
284 | tpm_nsc.base = (hi<<8) | lo; | 304 | tpm_nsc.base = (hi<<8) | lo; |
285 | 305 | ||
286 | dev_dbg(&pci_dev->dev, "NSC TPM detected\n"); | 306 | /* enable the DPM module */ |
287 | dev_dbg(&pci_dev->dev, | 307 | tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01); |
308 | |||
309 | pdev = kmalloc(sizeof(struct platform_device), GFP_KERNEL); | ||
310 | if ( !pdev ) | ||
311 | return -ENOMEM; | ||
312 | |||
313 | memset(pdev, 0, sizeof(struct platform_device)); | ||
314 | |||
315 | pdev->name = "tpm_nscl0"; | ||
316 | pdev->id = -1; | ||
317 | pdev->num_resources = 0; | ||
318 | pdev->dev.release = tpm_nsc_remove; | ||
319 | pdev->dev.driver = &nsc_drv; | ||
320 | |||
321 | if ((rc=platform_device_register(pdev)) < 0) { | ||
322 | kfree(pdev); | ||
323 | pdev = NULL; | ||
324 | return rc; | ||
325 | } | ||
326 | |||
327 | if (request_region(tpm_nsc.base, 2, "tpm_nsc0") == NULL ) { | ||
328 | platform_device_unregister(pdev); | ||
329 | kfree(pdev); | ||
330 | pdev = NULL; | ||
331 | return -EBUSY; | ||
332 | } | ||
333 | |||
334 | if ((rc = tpm_register_hardware(&pdev->dev, &tpm_nsc)) < 0) { | ||
335 | release_region(tpm_nsc.base, 2); | ||
336 | platform_device_unregister(pdev); | ||
337 | kfree(pdev); | ||
338 | pdev = NULL; | ||
339 | return rc; | ||
340 | } | ||
341 | |||
342 | dev_dbg(&pdev->dev, "NSC TPM detected\n"); | ||
343 | dev_dbg(&pdev->dev, | ||
288 | "NSC LDN 0x%x, SID 0x%x, SRID 0x%x\n", | 344 | "NSC LDN 0x%x, SID 0x%x, SRID 0x%x\n", |
289 | tpm_read_index(nscAddrBase,0x07), tpm_read_index(nscAddrBase,0x20), | 345 | tpm_read_index(nscAddrBase,0x07), tpm_read_index(nscAddrBase,0x20), |
290 | tpm_read_index(nscAddrBase,0x27)); | 346 | tpm_read_index(nscAddrBase,0x27)); |
291 | dev_dbg(&pci_dev->dev, | 347 | dev_dbg(&pdev->dev, |
292 | "NSC SIOCF1 0x%x SIOCF5 0x%x SIOCF6 0x%x SIOCF8 0x%x\n", | 348 | "NSC SIOCF1 0x%x SIOCF5 0x%x SIOCF6 0x%x SIOCF8 0x%x\n", |
293 | tpm_read_index(nscAddrBase,0x21), tpm_read_index(nscAddrBase,0x25), | 349 | tpm_read_index(nscAddrBase,0x21), tpm_read_index(nscAddrBase,0x25), |
294 | tpm_read_index(nscAddrBase,0x26), tpm_read_index(nscAddrBase,0x28)); | 350 | tpm_read_index(nscAddrBase,0x26), tpm_read_index(nscAddrBase,0x28)); |
295 | dev_dbg(&pci_dev->dev, "NSC IO Base0 0x%x\n", | 351 | dev_dbg(&pdev->dev, "NSC IO Base0 0x%x\n", |
296 | (tpm_read_index(nscAddrBase,0x60) << 8) | tpm_read_index(nscAddrBase,0x61)); | 352 | (tpm_read_index(nscAddrBase,0x60) << 8) | tpm_read_index(nscAddrBase,0x61)); |
297 | dev_dbg(&pci_dev->dev, "NSC IO Base1 0x%x\n", | 353 | dev_dbg(&pdev->dev, "NSC IO Base1 0x%x\n", |
298 | (tpm_read_index(nscAddrBase,0x62) << 8) | tpm_read_index(nscAddrBase,0x63)); | 354 | (tpm_read_index(nscAddrBase,0x62) << 8) | tpm_read_index(nscAddrBase,0x63)); |
299 | dev_dbg(&pci_dev->dev, "NSC Interrupt number and wakeup 0x%x\n", | 355 | dev_dbg(&pdev->dev, "NSC Interrupt number and wakeup 0x%x\n", |
300 | tpm_read_index(nscAddrBase,0x70)); | 356 | tpm_read_index(nscAddrBase,0x70)); |
301 | dev_dbg(&pci_dev->dev, "NSC IRQ type select 0x%x\n", | 357 | dev_dbg(&pdev->dev, "NSC IRQ type select 0x%x\n", |
302 | tpm_read_index(nscAddrBase,0x71)); | 358 | tpm_read_index(nscAddrBase,0x71)); |
303 | dev_dbg(&pci_dev->dev, | 359 | dev_dbg(&pdev->dev, |
304 | "NSC DMA channel select0 0x%x, select1 0x%x\n", | 360 | "NSC DMA channel select0 0x%x, select1 0x%x\n", |
305 | tpm_read_index(nscAddrBase,0x74), tpm_read_index(nscAddrBase,0x75)); | 361 | tpm_read_index(nscAddrBase,0x74), tpm_read_index(nscAddrBase,0x75)); |
306 | dev_dbg(&pci_dev->dev, | 362 | dev_dbg(&pdev->dev, |
307 | "NSC Config " | 363 | "NSC Config " |
308 | "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", | 364 | "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", |
309 | tpm_read_index(nscAddrBase,0xF0), tpm_read_index(nscAddrBase,0xF1), | 365 | tpm_read_index(nscAddrBase,0xF0), tpm_read_index(nscAddrBase,0xF1), |
@@ -312,55 +368,23 @@ static int __devinit tpm_nsc_init(struct pci_dev *pci_dev, | |||
312 | tpm_read_index(nscAddrBase,0xF6), tpm_read_index(nscAddrBase,0xF7), | 368 | tpm_read_index(nscAddrBase,0xF6), tpm_read_index(nscAddrBase,0xF7), |
313 | tpm_read_index(nscAddrBase,0xF8), tpm_read_index(nscAddrBase,0xF9)); | 369 | tpm_read_index(nscAddrBase,0xF8), tpm_read_index(nscAddrBase,0xF9)); |
314 | 370 | ||
315 | dev_info(&pci_dev->dev, | 371 | dev_info(&pdev->dev, |
316 | "NSC TPM revision %d\n", | 372 | "NSC TPM revision %d\n", |
317 | tpm_read_index(nscAddrBase, 0x27) & 0x1F); | 373 | tpm_read_index(nscAddrBase, 0x27) & 0x1F); |
318 | 374 | ||
319 | /* enable the DPM module */ | ||
320 | tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01); | ||
321 | |||
322 | if ((rc = tpm_register_hardware(pci_dev, &tpm_nsc)) < 0) | ||
323 | goto out_err; | ||
324 | |||
325 | return 0; | 375 | return 0; |
326 | |||
327 | out_err: | ||
328 | pci_disable_device(pci_dev); | ||
329 | return rc; | ||
330 | } | ||
331 | |||
332 | static struct pci_device_id tpm_pci_tbl[] __devinitdata = { | ||
333 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)}, | ||
334 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)}, | ||
335 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)}, | ||
336 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)}, | ||
337 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)}, | ||
338 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0)}, | ||
339 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1)}, | ||
340 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0)}, | ||
341 | {PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)}, | ||
342 | {0,} | ||
343 | }; | ||
344 | |||
345 | MODULE_DEVICE_TABLE(pci, tpm_pci_tbl); | ||
346 | |||
347 | static struct pci_driver nsc_pci_driver = { | ||
348 | .name = "tpm_nsc", | ||
349 | .id_table = tpm_pci_tbl, | ||
350 | .probe = tpm_nsc_init, | ||
351 | .remove = __devexit_p(tpm_remove), | ||
352 | .suspend = tpm_pm_suspend, | ||
353 | .resume = tpm_pm_resume, | ||
354 | }; | ||
355 | |||
356 | static int __init init_nsc(void) | ||
357 | { | ||
358 | return pci_register_driver(&nsc_pci_driver); | ||
359 | } | 376 | } |
360 | 377 | ||
361 | static void __exit cleanup_nsc(void) | 378 | static void __exit cleanup_nsc(void) |
362 | { | 379 | { |
363 | pci_unregister_driver(&nsc_pci_driver); | 380 | if (pdev) { |
381 | tpm_nsc_remove(&pdev->dev); | ||
382 | platform_device_unregister(pdev); | ||
383 | kfree(pdev); | ||
384 | pdev = NULL; | ||
385 | } | ||
386 | |||
387 | driver_unregister(&nsc_drv); | ||
364 | } | 388 | } |
365 | 389 | ||
366 | module_init(init_nsc); | 390 | module_init(init_nsc); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index f5649a337743..c586bfa852ee 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -809,7 +809,7 @@ static void do_tty_hangup(void *data) | |||
809 | check_tty_count(tty, "do_tty_hangup"); | 809 | check_tty_count(tty, "do_tty_hangup"); |
810 | file_list_lock(); | 810 | file_list_lock(); |
811 | /* This breaks for file handles being sent over AF_UNIX sockets ? */ | 811 | /* This breaks for file handles being sent over AF_UNIX sockets ? */ |
812 | list_for_each_entry(filp, &tty->tty_files, f_list) { | 812 | list_for_each_entry(filp, &tty->tty_files, f_u.fu_list) { |
813 | if (filp->f_op->write == redirected_tty_write) | 813 | if (filp->f_op->write == redirected_tty_write) |
814 | cons_filp = filp; | 814 | cons_filp = filp; |
815 | if (filp->f_op->write != tty_write) | 815 | if (filp->f_op->write != tty_write) |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index a5e104f428f8..51abd3defc1c 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -993,13 +993,16 @@ static struct vio_device_id viotape_device_table[] __devinitdata = { | |||
993 | { "viotape", "" }, | 993 | { "viotape", "" }, |
994 | { "", "" } | 994 | { "", "" } |
995 | }; | 995 | }; |
996 | |||
997 | MODULE_DEVICE_TABLE(vio, viotape_device_table); | 996 | MODULE_DEVICE_TABLE(vio, viotape_device_table); |
997 | |||
998 | static struct vio_driver viotape_driver = { | 998 | static struct vio_driver viotape_driver = { |
999 | .name = "viotape", | ||
1000 | .id_table = viotape_device_table, | 999 | .id_table = viotape_device_table, |
1001 | .probe = viotape_probe, | 1000 | .probe = viotape_probe, |
1002 | .remove = viotape_remove | 1001 | .remove = viotape_remove, |
1002 | .driver = { | ||
1003 | .name = "viotape", | ||
1004 | .owner = THIS_MODULE, | ||
1005 | } | ||
1003 | }; | 1006 | }; |
1004 | 1007 | ||
1005 | 1008 | ||
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 1d44f69e1fda..003dda147cd0 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -192,6 +192,9 @@ do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm) | |||
192 | int i, j, k; | 192 | int i, j, k; |
193 | int ret; | 193 | int ret; |
194 | 194 | ||
195 | if (!capable(CAP_SYS_TTY_CONFIG)) | ||
196 | return -EPERM; | ||
197 | |||
195 | kbs = kmalloc(sizeof(*kbs), GFP_KERNEL); | 198 | kbs = kmalloc(sizeof(*kbs), GFP_KERNEL); |
196 | if (!kbs) { | 199 | if (!kbs) { |
197 | ret = -ENOMEM; | 200 | ret = -ENOMEM; |
diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c index 2865dac0a813..e75045fe2641 100644 --- a/drivers/char/watchdog/cpu5wdt.c +++ b/drivers/char/watchdog/cpu5wdt.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/ioport.h> | 29 | #include <linux/ioport.h> |
30 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
31 | #include <linux/jiffies.h> | ||
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | 34 | ||
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index 7fc2188386d9..d8dede575402 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c | |||
@@ -45,6 +45,8 @@ | |||
45 | #include <linux/fs.h> | 45 | #include <linux/fs.h> |
46 | #include <linux/reboot.h> | 46 | #include <linux/reboot.h> |
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/jiffies.h> | ||
49 | #include <linux/timer.h> | ||
48 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
49 | #include <asm/io.h> | 51 | #include <asm/io.h> |
50 | 52 | ||
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c index 427ad51b7a35..37c9e13ad3ac 100644 --- a/drivers/char/watchdog/pcwd.c +++ b/drivers/char/watchdog/pcwd.c | |||
@@ -66,7 +66,7 @@ | |||
66 | #include <linux/init.h> | 66 | #include <linux/init.h> |
67 | #include <linux/spinlock.h> | 67 | #include <linux/spinlock.h> |
68 | #include <linux/reboot.h> | 68 | #include <linux/reboot.h> |
69 | 69 | #include <linux/sched.h> /* TASK_INTERRUPTIBLE, set_current_state() and friends */ | |
70 | #include <asm/uaccess.h> | 70 | #include <asm/uaccess.h> |
71 | #include <asm/io.h> | 71 | #include <asm/io.h> |
72 | 72 | ||
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 0b8e493be045..5308e5c8f29a 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c | |||
@@ -753,6 +753,7 @@ static struct pci_device_id pcipcwd_pci_tbl[] = { | |||
753 | MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl); | 753 | MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl); |
754 | 754 | ||
755 | static struct pci_driver pcipcwd_driver = { | 755 | static struct pci_driver pcipcwd_driver = { |
756 | .owner = THIS_MODULE, | ||
756 | .name = WATCHDOG_NAME, | 757 | .name = WATCHDOG_NAME, |
757 | .id_table = pcipcwd_pci_tbl, | 758 | .id_table = pcipcwd_pci_tbl, |
758 | .probe = pcipcwd_card_init, | 759 | .probe = pcipcwd_card_init, |
diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c index 72501be79b0c..4ee9974ad8cb 100644 --- a/drivers/char/watchdog/sc520_wdt.c +++ b/drivers/char/watchdog/sc520_wdt.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <linux/notifier.h> | 63 | #include <linux/notifier.h> |
64 | #include <linux/reboot.h> | 64 | #include <linux/reboot.h> |
65 | #include <linux/init.h> | 65 | #include <linux/init.h> |
66 | #include <linux/jiffies.h> | ||
66 | 67 | ||
67 | #include <asm/io.h> | 68 | #include <asm/io.h> |
68 | #include <asm/uaccess.h> | 69 | #include <asm/uaccess.h> |
diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c index 20e5eb8667f2..a91edaf3a350 100644 --- a/drivers/char/watchdog/softdog.c +++ b/drivers/char/watchdog/softdog.c | |||
@@ -47,6 +47,8 @@ | |||
47 | #include <linux/notifier.h> | 47 | #include <linux/notifier.h> |
48 | #include <linux/reboot.h> | 48 | #include <linux/reboot.h> |
49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/jiffies.h> | ||
51 | |||
50 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
51 | 53 | ||
52 | #define PFX "SoftDog: " | 54 | #define PFX "SoftDog: " |
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c index 4b3311993d48..dc9370f6c348 100644 --- a/drivers/char/watchdog/wdt_pci.c +++ b/drivers/char/watchdog/wdt_pci.c | |||
@@ -711,6 +711,7 @@ MODULE_DEVICE_TABLE(pci, wdtpci_pci_tbl); | |||
711 | 711 | ||
712 | 712 | ||
713 | static struct pci_driver wdtpci_driver = { | 713 | static struct pci_driver wdtpci_driver = { |
714 | .owner = THIS_MODULE, | ||
714 | .name = "wdt_pci", | 715 | .name = "wdt_pci", |
715 | .id_table = wdtpci_pci_tbl, | 716 | .id_table = wdtpci_pci_tbl, |
716 | .probe = wdtpci_init_one, | 717 | .probe = wdtpci_init_one, |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 109d62ccf651..6c6121b85a54 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -4,6 +4,9 @@ | |||
4 | * Copyright (C) 2001 Russell King | 4 | * Copyright (C) 2001 Russell King |
5 | * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> | 5 | * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> |
6 | * | 6 | * |
7 | * Oct 2005 - Ashok Raj <ashok.raj@intel.com> | ||
8 | * Added handling for CPU hotplug | ||
9 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
9 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
@@ -36,13 +39,6 @@ static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; | |||
36 | static DEFINE_SPINLOCK(cpufreq_driver_lock); | 39 | static DEFINE_SPINLOCK(cpufreq_driver_lock); |
37 | 40 | ||
38 | 41 | ||
39 | /* we keep a copy of all ->add'ed CPU's struct sys_device here; | ||
40 | * as it is only accessed in ->add and ->remove, no lock or reference | ||
41 | * count is necessary. | ||
42 | */ | ||
43 | static struct sys_device *cpu_sys_devices[NR_CPUS]; | ||
44 | |||
45 | |||
46 | /* internal prototypes */ | 42 | /* internal prototypes */ |
47 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); | 43 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); |
48 | static void handle_update(void *data); | 44 | static void handle_update(void *data); |
@@ -574,6 +570,9 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
574 | unsigned long flags; | 570 | unsigned long flags; |
575 | unsigned int j; | 571 | unsigned int j; |
576 | 572 | ||
573 | if (cpu_is_offline(cpu)) | ||
574 | return 0; | ||
575 | |||
577 | cpufreq_debug_disable_ratelimit(); | 576 | cpufreq_debug_disable_ratelimit(); |
578 | dprintk("adding CPU %u\n", cpu); | 577 | dprintk("adding CPU %u\n", cpu); |
579 | 578 | ||
@@ -582,7 +581,6 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
582 | * CPU because it is in the same boat. */ | 581 | * CPU because it is in the same boat. */ |
583 | policy = cpufreq_cpu_get(cpu); | 582 | policy = cpufreq_cpu_get(cpu); |
584 | if (unlikely(policy)) { | 583 | if (unlikely(policy)) { |
585 | cpu_sys_devices[cpu] = sys_dev; | ||
586 | dprintk("CPU already managed, adding link\n"); | 584 | dprintk("CPU already managed, adding link\n"); |
587 | sysfs_create_link(&sys_dev->kobj, &policy->kobj, "cpufreq"); | 585 | sysfs_create_link(&sys_dev->kobj, &policy->kobj, "cpufreq"); |
588 | cpufreq_debug_enable_ratelimit(); | 586 | cpufreq_debug_enable_ratelimit(); |
@@ -657,7 +655,6 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
657 | } | 655 | } |
658 | 656 | ||
659 | module_put(cpufreq_driver->owner); | 657 | module_put(cpufreq_driver->owner); |
660 | cpu_sys_devices[cpu] = sys_dev; | ||
661 | dprintk("initialization complete\n"); | 658 | dprintk("initialization complete\n"); |
662 | cpufreq_debug_enable_ratelimit(); | 659 | cpufreq_debug_enable_ratelimit(); |
663 | 660 | ||
@@ -682,7 +679,7 @@ err_out: | |||
682 | 679 | ||
683 | nomem_out: | 680 | nomem_out: |
684 | module_put(cpufreq_driver->owner); | 681 | module_put(cpufreq_driver->owner); |
685 | module_out: | 682 | module_out: |
686 | cpufreq_debug_enable_ratelimit(); | 683 | cpufreq_debug_enable_ratelimit(); |
687 | return ret; | 684 | return ret; |
688 | } | 685 | } |
@@ -698,6 +695,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
698 | unsigned int cpu = sys_dev->id; | 695 | unsigned int cpu = sys_dev->id; |
699 | unsigned long flags; | 696 | unsigned long flags; |
700 | struct cpufreq_policy *data; | 697 | struct cpufreq_policy *data; |
698 | struct sys_device *cpu_sys_dev; | ||
701 | #ifdef CONFIG_SMP | 699 | #ifdef CONFIG_SMP |
702 | unsigned int j; | 700 | unsigned int j; |
703 | #endif | 701 | #endif |
@@ -710,7 +708,6 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
710 | 708 | ||
711 | if (!data) { | 709 | if (!data) { |
712 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 710 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
713 | cpu_sys_devices[cpu] = NULL; | ||
714 | cpufreq_debug_enable_ratelimit(); | 711 | cpufreq_debug_enable_ratelimit(); |
715 | return -EINVAL; | 712 | return -EINVAL; |
716 | } | 713 | } |
@@ -725,14 +722,12 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
725 | dprintk("removing link\n"); | 722 | dprintk("removing link\n"); |
726 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 723 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
727 | sysfs_remove_link(&sys_dev->kobj, "cpufreq"); | 724 | sysfs_remove_link(&sys_dev->kobj, "cpufreq"); |
728 | cpu_sys_devices[cpu] = NULL; | ||
729 | cpufreq_cpu_put(data); | 725 | cpufreq_cpu_put(data); |
730 | cpufreq_debug_enable_ratelimit(); | 726 | cpufreq_debug_enable_ratelimit(); |
731 | return 0; | 727 | return 0; |
732 | } | 728 | } |
733 | #endif | 729 | #endif |
734 | 730 | ||
735 | cpu_sys_devices[cpu] = NULL; | ||
736 | 731 | ||
737 | if (!kobject_get(&data->kobj)) { | 732 | if (!kobject_get(&data->kobj)) { |
738 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 733 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
@@ -761,7 +756,8 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
761 | if (j == cpu) | 756 | if (j == cpu) |
762 | continue; | 757 | continue; |
763 | dprintk("removing link for cpu %u\n", j); | 758 | dprintk("removing link for cpu %u\n", j); |
764 | sysfs_remove_link(&cpu_sys_devices[j]->kobj, "cpufreq"); | 759 | cpu_sys_dev = get_cpu_sysdev(j); |
760 | sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); | ||
765 | cpufreq_cpu_put(data); | 761 | cpufreq_cpu_put(data); |
766 | } | 762 | } |
767 | } | 763 | } |
@@ -772,7 +768,6 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
772 | down(&data->lock); | 768 | down(&data->lock); |
773 | if (cpufreq_driver->target) | 769 | if (cpufreq_driver->target) |
774 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); | 770 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); |
775 | cpufreq_driver->target = NULL; | ||
776 | up(&data->lock); | 771 | up(&data->lock); |
777 | 772 | ||
778 | kobject_unregister(&data->kobj); | 773 | kobject_unregister(&data->kobj); |
@@ -1119,17 +1114,30 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1119 | unsigned int relation) | 1114 | unsigned int relation) |
1120 | { | 1115 | { |
1121 | int retval = -EINVAL; | 1116 | int retval = -EINVAL; |
1122 | lock_cpu_hotplug(); | 1117 | |
1118 | /* | ||
1119 | * Converted the lock_cpu_hotplug to preempt_disable() | ||
1120 | * and preempt_enable(). This is a bit kludgy and relies on how cpu | ||
1121 | * hotplug works. All we need is a guarantee that cpu hotplug won't make | ||
1122 | * progress on any cpu. Once we do preempt_disable(), this would ensure | ||
1123 | * that hotplug threads don't get onto this cpu, thereby delaying | ||
1124 | * the cpu remove process. | ||
1125 | * | ||
1126 | * We removed the lock_cpu_hotplug since we need to call this function | ||
1127 | * via cpu hotplug callbacks, which result in locking the cpu hotplug | ||
1128 | * thread itself. Agree this is not very clean, cpufreq community | ||
1129 | * could improve this if required. - Ashok Raj <ashok.raj@intel.com> | ||
1130 | */ | ||
1131 | preempt_disable(); | ||
1123 | dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, | 1132 | dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, |
1124 | target_freq, relation); | 1133 | target_freq, relation); |
1125 | if (cpu_online(policy->cpu) && cpufreq_driver->target) | 1134 | if (cpu_online(policy->cpu) && cpufreq_driver->target) |
1126 | retval = cpufreq_driver->target(policy, target_freq, relation); | 1135 | retval = cpufreq_driver->target(policy, target_freq, relation); |
1127 | unlock_cpu_hotplug(); | 1136 | preempt_enable(); |
1128 | return retval; | 1137 | return retval; |
1129 | } | 1138 | } |
1130 | EXPORT_SYMBOL_GPL(__cpufreq_driver_target); | 1139 | EXPORT_SYMBOL_GPL(__cpufreq_driver_target); |
1131 | 1140 | ||
1132 | |||
1133 | int cpufreq_driver_target(struct cpufreq_policy *policy, | 1141 | int cpufreq_driver_target(struct cpufreq_policy *policy, |
1134 | unsigned int target_freq, | 1142 | unsigned int target_freq, |
1135 | unsigned int relation) | 1143 | unsigned int relation) |
@@ -1416,6 +1424,45 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1416 | } | 1424 | } |
1417 | EXPORT_SYMBOL(cpufreq_update_policy); | 1425 | EXPORT_SYMBOL(cpufreq_update_policy); |
1418 | 1426 | ||
1427 | static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, | ||
1428 | unsigned long action, void *hcpu) | ||
1429 | { | ||
1430 | unsigned int cpu = (unsigned long)hcpu; | ||
1431 | struct cpufreq_policy *policy; | ||
1432 | struct sys_device *sys_dev; | ||
1433 | |||
1434 | sys_dev = get_cpu_sysdev(cpu); | ||
1435 | |||
1436 | if (sys_dev) { | ||
1437 | switch (action) { | ||
1438 | case CPU_ONLINE: | ||
1439 | cpufreq_add_dev(sys_dev); | ||
1440 | break; | ||
1441 | case CPU_DOWN_PREPARE: | ||
1442 | /* | ||
1443 | * We attempt to put this cpu in lowest frequency | ||
1444 | * possible before going down. This will permit | ||
1445 | * hardware-managed P-State to switch other related | ||
1446 | * threads to min or higher speeds if possible. | ||
1447 | */ | ||
1448 | policy = cpufreq_cpu_data[cpu]; | ||
1449 | if (policy) { | ||
1450 | cpufreq_driver_target(policy, policy->min, | ||
1451 | CPUFREQ_RELATION_H); | ||
1452 | } | ||
1453 | break; | ||
1454 | case CPU_DEAD: | ||
1455 | cpufreq_remove_dev(sys_dev); | ||
1456 | break; | ||
1457 | } | ||
1458 | } | ||
1459 | return NOTIFY_OK; | ||
1460 | } | ||
1461 | |||
1462 | static struct notifier_block cpufreq_cpu_notifier = | ||
1463 | { | ||
1464 | .notifier_call = cpufreq_cpu_callback, | ||
1465 | }; | ||
1419 | 1466 | ||
1420 | /********************************************************************* | 1467 | /********************************************************************* |
1421 | * REGISTER / UNREGISTER CPUFREQ DRIVER * | 1468 | * REGISTER / UNREGISTER CPUFREQ DRIVER * |
@@ -1476,6 +1523,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1476 | } | 1523 | } |
1477 | 1524 | ||
1478 | if (!ret) { | 1525 | if (!ret) { |
1526 | register_cpu_notifier(&cpufreq_cpu_notifier); | ||
1479 | dprintk("driver %s up and running\n", driver_data->name); | 1527 | dprintk("driver %s up and running\n", driver_data->name); |
1480 | cpufreq_debug_enable_ratelimit(); | 1528 | cpufreq_debug_enable_ratelimit(); |
1481 | } | 1529 | } |
@@ -1507,6 +1555,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) | |||
1507 | dprintk("unregistering driver %s\n", driver->name); | 1555 | dprintk("unregistering driver %s\n", driver->name); |
1508 | 1556 | ||
1509 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); | 1557 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); |
1558 | unregister_cpu_notifier(&cpufreq_cpu_notifier); | ||
1510 | 1559 | ||
1511 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 1560 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
1512 | cpufreq_driver = NULL; | 1561 | cpufreq_driver = NULL; |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 741b6b191e6a..3597f25d5efa 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/percpu.h> | 19 | #include <linux/percpu.h> |
20 | #include <linux/kobject.h> | 20 | #include <linux/kobject.h> |
21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
22 | #include <linux/notifier.h> | ||
22 | #include <asm/cputime.h> | 23 | #include <asm/cputime.h> |
23 | 24 | ||
24 | static spinlock_t cpufreq_stats_lock; | 25 | static spinlock_t cpufreq_stats_lock; |
@@ -298,6 +299,27 @@ cpufreq_stat_notifier_trans (struct notifier_block *nb, unsigned long val, | |||
298 | return 0; | 299 | return 0; |
299 | } | 300 | } |
300 | 301 | ||
302 | static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, | ||
303 | unsigned long action, void *hcpu) | ||
304 | { | ||
305 | unsigned int cpu = (unsigned long)hcpu; | ||
306 | |||
307 | switch (action) { | ||
308 | case CPU_ONLINE: | ||
309 | cpufreq_update_policy(cpu); | ||
310 | break; | ||
311 | case CPU_DEAD: | ||
312 | cpufreq_stats_free_table(cpu); | ||
313 | break; | ||
314 | } | ||
315 | return NOTIFY_OK; | ||
316 | } | ||
317 | |||
318 | static struct notifier_block cpufreq_stat_cpu_notifier = | ||
319 | { | ||
320 | .notifier_call = cpufreq_stat_cpu_callback, | ||
321 | }; | ||
322 | |||
301 | static struct notifier_block notifier_policy_block = { | 323 | static struct notifier_block notifier_policy_block = { |
302 | .notifier_call = cpufreq_stat_notifier_policy | 324 | .notifier_call = cpufreq_stat_notifier_policy |
303 | }; | 325 | }; |
@@ -311,6 +333,7 @@ __init cpufreq_stats_init(void) | |||
311 | { | 333 | { |
312 | int ret; | 334 | int ret; |
313 | unsigned int cpu; | 335 | unsigned int cpu; |
336 | |||
314 | spin_lock_init(&cpufreq_stats_lock); | 337 | spin_lock_init(&cpufreq_stats_lock); |
315 | if ((ret = cpufreq_register_notifier(¬ifier_policy_block, | 338 | if ((ret = cpufreq_register_notifier(¬ifier_policy_block, |
316 | CPUFREQ_POLICY_NOTIFIER))) | 339 | CPUFREQ_POLICY_NOTIFIER))) |
@@ -323,20 +346,31 @@ __init cpufreq_stats_init(void) | |||
323 | return ret; | 346 | return ret; |
324 | } | 347 | } |
325 | 348 | ||
326 | for_each_cpu(cpu) | 349 | register_cpu_notifier(&cpufreq_stat_cpu_notifier); |
327 | cpufreq_update_policy(cpu); | 350 | lock_cpu_hotplug(); |
351 | for_each_online_cpu(cpu) { | ||
352 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_ONLINE, | ||
353 | (void *)(long)cpu); | ||
354 | } | ||
355 | unlock_cpu_hotplug(); | ||
328 | return 0; | 356 | return 0; |
329 | } | 357 | } |
330 | static void | 358 | static void |
331 | __exit cpufreq_stats_exit(void) | 359 | __exit cpufreq_stats_exit(void) |
332 | { | 360 | { |
333 | unsigned int cpu; | 361 | unsigned int cpu; |
362 | |||
334 | cpufreq_unregister_notifier(¬ifier_policy_block, | 363 | cpufreq_unregister_notifier(¬ifier_policy_block, |
335 | CPUFREQ_POLICY_NOTIFIER); | 364 | CPUFREQ_POLICY_NOTIFIER); |
336 | cpufreq_unregister_notifier(¬ifier_trans_block, | 365 | cpufreq_unregister_notifier(¬ifier_trans_block, |
337 | CPUFREQ_TRANSITION_NOTIFIER); | 366 | CPUFREQ_TRANSITION_NOTIFIER); |
338 | for_each_cpu(cpu) | 367 | unregister_cpu_notifier(&cpufreq_stat_cpu_notifier); |
339 | cpufreq_stats_free_table(cpu); | 368 | lock_cpu_hotplug(); |
369 | for_each_online_cpu(cpu) { | ||
370 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_DEAD, | ||
371 | (void *)(long)cpu); | ||
372 | } | ||
373 | unlock_cpu_hotplug(); | ||
340 | } | 374 | } |
341 | 375 | ||
342 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); | 376 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); |
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 094835cce321..4263935443cc 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
@@ -2,7 +2,7 @@ menu "Hardware crypto devices" | |||
2 | 2 | ||
3 | config CRYPTO_DEV_PADLOCK | 3 | config CRYPTO_DEV_PADLOCK |
4 | tristate "Support for VIA PadLock ACE" | 4 | tristate "Support for VIA PadLock ACE" |
5 | depends on CRYPTO && X86 && !X86_64 | 5 | depends on CRYPTO && X86_32 |
6 | help | 6 | help |
7 | Some VIA processors come with an integrated crypto engine | 7 | Some VIA processors come with an integrated crypto engine |
8 | (so called VIA PadLock ACE, Advanced Cryptography Engine) | 8 | (so called VIA PadLock ACE, Advanced Cryptography Engine) |
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 327b58e64875..b6815c6c29a2 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -70,8 +70,7 @@ config DELL_RBU | |||
70 | 70 | ||
71 | config DCDBAS | 71 | config DCDBAS |
72 | tristate "Dell Systems Management Base Driver" | 72 | tristate "Dell Systems Management Base Driver" |
73 | depends on X86 || X86_64 | 73 | depends on X86 |
74 | default m | ||
75 | help | 74 | help |
76 | The Dell Systems Management Base Driver provides a sysfs interface | 75 | The Dell Systems Management Base Driver provides a sysfs interface |
77 | for systems management software to perform System Management | 76 | for systems management software to perform System Management |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 74af7e074868..8b9d85526596 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -2211,13 +2211,12 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
2211 | 2211 | ||
2212 | if (toc == NULL) { | 2212 | if (toc == NULL) { |
2213 | /* Try to allocate space. */ | 2213 | /* Try to allocate space. */ |
2214 | toc = (struct atapi_toc *) kmalloc (sizeof (struct atapi_toc), | 2214 | toc = kmalloc(sizeof(struct atapi_toc), GFP_KERNEL); |
2215 | GFP_KERNEL); | ||
2216 | info->toc = toc; | ||
2217 | if (toc == NULL) { | 2215 | if (toc == NULL) { |
2218 | printk (KERN_ERR "%s: No cdrom TOC buffer!\n", drive->name); | 2216 | printk (KERN_ERR "%s: No cdrom TOC buffer!\n", drive->name); |
2219 | return -ENOMEM; | 2217 | return -ENOMEM; |
2220 | } | 2218 | } |
2219 | info->toc = toc; | ||
2221 | } | 2220 | } |
2222 | 2221 | ||
2223 | /* Check to see if the existing data is still valid. | 2222 | /* Check to see if the existing data is still valid. |
@@ -2240,7 +2239,8 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
2240 | /* First read just the header, so we know how long the TOC is. */ | 2239 | /* First read just the header, so we know how long the TOC is. */ |
2241 | stat = cdrom_read_tocentry(drive, 0, 1, 0, (char *) &toc->hdr, | 2240 | stat = cdrom_read_tocentry(drive, 0, 1, 0, (char *) &toc->hdr, |
2242 | sizeof(struct atapi_toc_header), sense); | 2241 | sizeof(struct atapi_toc_header), sense); |
2243 | if (stat) return stat; | 2242 | if (stat) |
2243 | return stat; | ||
2244 | 2244 | ||
2245 | #if ! STANDARD_ATAPI | 2245 | #if ! STANDARD_ATAPI |
2246 | if (CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd) { | 2246 | if (CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd) { |
@@ -2324,7 +2324,8 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
2324 | /* Read the multisession information. */ | 2324 | /* Read the multisession information. */ |
2325 | stat = cdrom_read_tocentry(drive, 0, 0, 1, (char *)&ms_tmp, | 2325 | stat = cdrom_read_tocentry(drive, 0, 0, 1, (char *)&ms_tmp, |
2326 | sizeof(ms_tmp), sense); | 2326 | sizeof(ms_tmp), sense); |
2327 | if (stat) return stat; | 2327 | if (stat) |
2328 | return stat; | ||
2328 | 2329 | ||
2329 | toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba); | 2330 | toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba); |
2330 | } else { | 2331 | } else { |
@@ -2460,7 +2461,7 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi, | |||
2460 | struct packet_command *cgc) | 2461 | struct packet_command *cgc) |
2461 | { | 2462 | { |
2462 | struct request req; | 2463 | struct request req; |
2463 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2464 | ide_drive_t *drive = cdi->handle; |
2464 | 2465 | ||
2465 | if (cgc->timeout <= 0) | 2466 | if (cgc->timeout <= 0) |
2466 | cgc->timeout = ATAPI_WAIT_PC; | 2467 | cgc->timeout = ATAPI_WAIT_PC; |
@@ -2537,7 +2538,7 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi, | |||
2537 | unsigned int cmd, void *arg) | 2538 | unsigned int cmd, void *arg) |
2538 | 2539 | ||
2539 | { | 2540 | { |
2540 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2541 | ide_drive_t *drive = cdi->handle; |
2541 | struct cdrom_info *info = drive->driver_data; | 2542 | struct cdrom_info *info = drive->driver_data; |
2542 | int stat; | 2543 | int stat; |
2543 | 2544 | ||
@@ -2548,7 +2549,7 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi, | |||
2548 | */ | 2549 | */ |
2549 | case CDROMPLAYTRKIND: { | 2550 | case CDROMPLAYTRKIND: { |
2550 | unsigned long lba_start, lba_end; | 2551 | unsigned long lba_start, lba_end; |
2551 | struct cdrom_ti *ti = (struct cdrom_ti *)arg; | 2552 | struct cdrom_ti *ti = arg; |
2552 | struct atapi_toc_entry *first_toc, *last_toc; | 2553 | struct atapi_toc_entry *first_toc, *last_toc; |
2553 | 2554 | ||
2554 | stat = cdrom_get_toc_entry(drive, ti->cdti_trk0, &first_toc); | 2555 | stat = cdrom_get_toc_entry(drive, ti->cdti_trk0, &first_toc); |
@@ -2571,12 +2572,13 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi, | |||
2571 | } | 2572 | } |
2572 | 2573 | ||
2573 | case CDROMREADTOCHDR: { | 2574 | case CDROMREADTOCHDR: { |
2574 | struct cdrom_tochdr *tochdr = (struct cdrom_tochdr *) arg; | 2575 | struct cdrom_tochdr *tochdr = arg; |
2575 | struct atapi_toc *toc; | 2576 | struct atapi_toc *toc; |
2576 | 2577 | ||
2577 | /* Make sure our saved TOC is valid. */ | 2578 | /* Make sure our saved TOC is valid. */ |
2578 | stat = cdrom_read_toc(drive, NULL); | 2579 | stat = cdrom_read_toc(drive, NULL); |
2579 | if (stat) return stat; | 2580 | if (stat) |
2581 | return stat; | ||
2580 | 2582 | ||
2581 | toc = info->toc; | 2583 | toc = info->toc; |
2582 | tochdr->cdth_trk0 = toc->hdr.first_track; | 2584 | tochdr->cdth_trk0 = toc->hdr.first_track; |
@@ -2586,11 +2588,12 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi, | |||
2586 | } | 2588 | } |
2587 | 2589 | ||
2588 | case CDROMREADTOCENTRY: { | 2590 | case CDROMREADTOCENTRY: { |
2589 | struct cdrom_tocentry *tocentry = (struct cdrom_tocentry*) arg; | 2591 | struct cdrom_tocentry *tocentry = arg; |
2590 | struct atapi_toc_entry *toce; | 2592 | struct atapi_toc_entry *toce; |
2591 | 2593 | ||
2592 | stat = cdrom_get_toc_entry(drive, tocentry->cdte_track, &toce); | 2594 | stat = cdrom_get_toc_entry(drive, tocentry->cdte_track, &toce); |
2593 | if (stat) return stat; | 2595 | if (stat) |
2596 | return stat; | ||
2594 | 2597 | ||
2595 | tocentry->cdte_ctrl = toce->control; | 2598 | tocentry->cdte_ctrl = toce->control; |
2596 | tocentry->cdte_adr = toce->adr; | 2599 | tocentry->cdte_adr = toce->adr; |
@@ -2613,7 +2616,7 @@ int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi, | |||
2613 | static | 2616 | static |
2614 | int ide_cdrom_reset (struct cdrom_device_info *cdi) | 2617 | int ide_cdrom_reset (struct cdrom_device_info *cdi) |
2615 | { | 2618 | { |
2616 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2619 | ide_drive_t *drive = cdi->handle; |
2617 | struct request_sense sense; | 2620 | struct request_sense sense; |
2618 | struct request req; | 2621 | struct request req; |
2619 | int ret; | 2622 | int ret; |
@@ -2636,12 +2639,13 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi) | |||
2636 | static | 2639 | static |
2637 | int ide_cdrom_tray_move (struct cdrom_device_info *cdi, int position) | 2640 | int ide_cdrom_tray_move (struct cdrom_device_info *cdi, int position) |
2638 | { | 2641 | { |
2639 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2642 | ide_drive_t *drive = cdi->handle; |
2640 | struct request_sense sense; | 2643 | struct request_sense sense; |
2641 | 2644 | ||
2642 | if (position) { | 2645 | if (position) { |
2643 | int stat = cdrom_lockdoor(drive, 0, &sense); | 2646 | int stat = cdrom_lockdoor(drive, 0, &sense); |
2644 | if (stat) return stat; | 2647 | if (stat) |
2648 | return stat; | ||
2645 | } | 2649 | } |
2646 | 2650 | ||
2647 | return cdrom_eject(drive, !position, &sense); | 2651 | return cdrom_eject(drive, !position, &sense); |
@@ -2650,7 +2654,7 @@ int ide_cdrom_tray_move (struct cdrom_device_info *cdi, int position) | |||
2650 | static | 2654 | static |
2651 | int ide_cdrom_lock_door (struct cdrom_device_info *cdi, int lock) | 2655 | int ide_cdrom_lock_door (struct cdrom_device_info *cdi, int lock) |
2652 | { | 2656 | { |
2653 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2657 | ide_drive_t *drive = cdi->handle; |
2654 | return cdrom_lockdoor(drive, lock, NULL); | 2658 | return cdrom_lockdoor(drive, lock, NULL); |
2655 | } | 2659 | } |
2656 | 2660 | ||
@@ -2700,7 +2704,7 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page | |||
2700 | static | 2704 | static |
2701 | int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) | 2705 | int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) |
2702 | { | 2706 | { |
2703 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2707 | ide_drive_t *drive = cdi->handle; |
2704 | struct request_sense sense; | 2708 | struct request_sense sense; |
2705 | struct atapi_capabilities_page cap; | 2709 | struct atapi_capabilities_page cap; |
2706 | int stat; | 2710 | int stat; |
@@ -2723,7 +2727,7 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) | |||
2723 | static | 2727 | static |
2724 | int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr) | 2728 | int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr) |
2725 | { | 2729 | { |
2726 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2730 | ide_drive_t *drive = cdi->handle; |
2727 | struct media_event_desc med; | 2731 | struct media_event_desc med; |
2728 | struct request_sense sense; | 2732 | struct request_sense sense; |
2729 | int stat; | 2733 | int stat; |
@@ -2769,7 +2773,7 @@ int ide_cdrom_get_last_session (struct cdrom_device_info *cdi, | |||
2769 | struct cdrom_multisession *ms_info) | 2773 | struct cdrom_multisession *ms_info) |
2770 | { | 2774 | { |
2771 | struct atapi_toc *toc; | 2775 | struct atapi_toc *toc; |
2772 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2776 | ide_drive_t *drive = cdi->handle; |
2773 | struct cdrom_info *info = drive->driver_data; | 2777 | struct cdrom_info *info = drive->driver_data; |
2774 | struct request_sense sense; | 2778 | struct request_sense sense; |
2775 | int ret; | 2779 | int ret; |
@@ -2791,7 +2795,7 @@ int ide_cdrom_get_mcn (struct cdrom_device_info *cdi, | |||
2791 | { | 2795 | { |
2792 | int stat; | 2796 | int stat; |
2793 | char mcnbuf[24]; | 2797 | char mcnbuf[24]; |
2794 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2798 | ide_drive_t *drive = cdi->handle; |
2795 | 2799 | ||
2796 | /* get MCN */ | 2800 | /* get MCN */ |
2797 | if ((stat = cdrom_read_subchannel(drive, 2, mcnbuf, sizeof (mcnbuf), NULL))) | 2801 | if ((stat = cdrom_read_subchannel(drive, 2, mcnbuf, sizeof (mcnbuf), NULL))) |
@@ -2815,7 +2819,7 @@ static | |||
2815 | int ide_cdrom_check_media_change_real (struct cdrom_device_info *cdi, | 2819 | int ide_cdrom_check_media_change_real (struct cdrom_device_info *cdi, |
2816 | int slot_nr) | 2820 | int slot_nr) |
2817 | { | 2821 | { |
2818 | ide_drive_t *drive = (ide_drive_t*) cdi->handle; | 2822 | ide_drive_t *drive = cdi->handle; |
2819 | int retval; | 2823 | int retval; |
2820 | 2824 | ||
2821 | if (slot_nr == CDSL_CURRENT) { | 2825 | if (slot_nr == CDSL_CURRENT) { |
@@ -2886,7 +2890,7 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots) | |||
2886 | devinfo->mask = 0; | 2890 | devinfo->mask = 0; |
2887 | devinfo->speed = CDROM_STATE_FLAGS(drive)->current_speed; | 2891 | devinfo->speed = CDROM_STATE_FLAGS(drive)->current_speed; |
2888 | devinfo->capacity = nslots; | 2892 | devinfo->capacity = nslots; |
2889 | devinfo->handle = (void *) drive; | 2893 | devinfo->handle = drive; |
2890 | strcpy(devinfo->name, drive->name); | 2894 | strcpy(devinfo->name, drive->name); |
2891 | 2895 | ||
2892 | /* set capability mask to match the probe. */ | 2896 | /* set capability mask to match the probe. */ |
@@ -2942,7 +2946,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) | |||
2942 | * registered with the Uniform layer yet, it can't do this. | 2946 | * registered with the Uniform layer yet, it can't do this. |
2943 | * Same goes for cdi->ops. | 2947 | * Same goes for cdi->ops. |
2944 | */ | 2948 | */ |
2945 | cdi->handle = (ide_drive_t *) drive; | 2949 | cdi->handle = drive; |
2946 | cdi->ops = &ide_cdrom_dops; | 2950 | cdi->ops = &ide_cdrom_dops; |
2947 | 2951 | ||
2948 | if (ide_cdrom_get_capabilities(drive, &cap)) | 2952 | if (ide_cdrom_get_capabilities(drive, &cap)) |
@@ -3254,6 +3258,7 @@ int ide_cdrom_setup (ide_drive_t *drive) | |||
3254 | return 0; | 3258 | return 0; |
3255 | } | 3259 | } |
3256 | 3260 | ||
3261 | #ifdef CONFIG_PROC_FS | ||
3257 | static | 3262 | static |
3258 | sector_t ide_cdrom_capacity (ide_drive_t *drive) | 3263 | sector_t ide_cdrom_capacity (ide_drive_t *drive) |
3259 | { | 3264 | { |
@@ -3264,6 +3269,7 @@ sector_t ide_cdrom_capacity (ide_drive_t *drive) | |||
3264 | 3269 | ||
3265 | return capacity * sectors_per_frame; | 3270 | return capacity * sectors_per_frame; |
3266 | } | 3271 | } |
3272 | #endif | ||
3267 | 3273 | ||
3268 | static int ide_cd_remove(struct device *dev) | 3274 | static int ide_cd_remove(struct device *dev) |
3269 | { | 3275 | { |
@@ -3309,7 +3315,7 @@ static int ide_cd_probe(struct device *); | |||
3309 | static int proc_idecd_read_capacity | 3315 | static int proc_idecd_read_capacity |
3310 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 3316 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
3311 | { | 3317 | { |
3312 | ide_drive_t*drive = (ide_drive_t *)data; | 3318 | ide_drive_t *drive = data; |
3313 | int len; | 3319 | int len; |
3314 | 3320 | ||
3315 | len = sprintf(page,"%llu\n", (long long)ide_cdrom_capacity(drive)); | 3321 | len = sprintf(page,"%llu\n", (long long)ide_cdrom_capacity(drive)); |
@@ -3449,7 +3455,7 @@ static int ide_cd_probe(struct device *dev) | |||
3449 | printk(KERN_INFO "ide-cd: passing drive %s to ide-scsi emulation.\n", drive->name); | 3455 | printk(KERN_INFO "ide-cd: passing drive %s to ide-scsi emulation.\n", drive->name); |
3450 | goto failed; | 3456 | goto failed; |
3451 | } | 3457 | } |
3452 | info = (struct cdrom_info *) kmalloc (sizeof (struct cdrom_info), GFP_KERNEL); | 3458 | info = kmalloc(sizeof(struct cdrom_info), GFP_KERNEL); |
3453 | if (info == NULL) { | 3459 | if (info == NULL) { |
3454 | printk(KERN_ERR "%s: Can't allocate a cdrom structure\n", drive->name); | 3460 | printk(KERN_ERR "%s: Can't allocate a cdrom structure\n", drive->name); |
3455 | goto failed; | 3461 | goto failed; |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 87d1f8a1f41e..d8c3d8ebad30 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -81,7 +81,7 @@ typedef struct pmac_ide_hwif { | |||
81 | 81 | ||
82 | } pmac_ide_hwif_t; | 82 | } pmac_ide_hwif_t; |
83 | 83 | ||
84 | static pmac_ide_hwif_t pmac_ide[MAX_HWIFS] __pmacdata; | 84 | static pmac_ide_hwif_t pmac_ide[MAX_HWIFS]; |
85 | static int pmac_ide_count; | 85 | static int pmac_ide_count; |
86 | 86 | ||
87 | enum { | 87 | enum { |
@@ -242,7 +242,7 @@ struct mdma_timings_t { | |||
242 | int cycleTime; | 242 | int cycleTime; |
243 | }; | 243 | }; |
244 | 244 | ||
245 | struct mdma_timings_t mdma_timings_33[] __pmacdata = | 245 | struct mdma_timings_t mdma_timings_33[] = |
246 | { | 246 | { |
247 | { 240, 240, 480 }, | 247 | { 240, 240, 480 }, |
248 | { 180, 180, 360 }, | 248 | { 180, 180, 360 }, |
@@ -255,7 +255,7 @@ struct mdma_timings_t mdma_timings_33[] __pmacdata = | |||
255 | { 0, 0, 0 } | 255 | { 0, 0, 0 } |
256 | }; | 256 | }; |
257 | 257 | ||
258 | struct mdma_timings_t mdma_timings_33k[] __pmacdata = | 258 | struct mdma_timings_t mdma_timings_33k[] = |
259 | { | 259 | { |
260 | { 240, 240, 480 }, | 260 | { 240, 240, 480 }, |
261 | { 180, 180, 360 }, | 261 | { 180, 180, 360 }, |
@@ -268,7 +268,7 @@ struct mdma_timings_t mdma_timings_33k[] __pmacdata = | |||
268 | { 0, 0, 0 } | 268 | { 0, 0, 0 } |
269 | }; | 269 | }; |
270 | 270 | ||
271 | struct mdma_timings_t mdma_timings_66[] __pmacdata = | 271 | struct mdma_timings_t mdma_timings_66[] = |
272 | { | 272 | { |
273 | { 240, 240, 480 }, | 273 | { 240, 240, 480 }, |
274 | { 180, 180, 360 }, | 274 | { 180, 180, 360 }, |
@@ -286,7 +286,7 @@ struct { | |||
286 | int addrSetup; /* ??? */ | 286 | int addrSetup; /* ??? */ |
287 | int rdy2pause; | 287 | int rdy2pause; |
288 | int wrDataSetup; | 288 | int wrDataSetup; |
289 | } kl66_udma_timings[] __pmacdata = | 289 | } kl66_udma_timings[] = |
290 | { | 290 | { |
291 | { 0, 180, 120 }, /* Mode 0 */ | 291 | { 0, 180, 120 }, /* Mode 0 */ |
292 | { 0, 150, 90 }, /* 1 */ | 292 | { 0, 150, 90 }, /* 1 */ |
@@ -301,7 +301,7 @@ struct kauai_timing { | |||
301 | u32 timing_reg; | 301 | u32 timing_reg; |
302 | }; | 302 | }; |
303 | 303 | ||
304 | static struct kauai_timing kauai_pio_timings[] __pmacdata = | 304 | static struct kauai_timing kauai_pio_timings[] = |
305 | { | 305 | { |
306 | { 930 , 0x08000fff }, | 306 | { 930 , 0x08000fff }, |
307 | { 600 , 0x08000a92 }, | 307 | { 600 , 0x08000a92 }, |
@@ -316,7 +316,7 @@ static struct kauai_timing kauai_pio_timings[] __pmacdata = | |||
316 | { 120 , 0x04000148 } | 316 | { 120 , 0x04000148 } |
317 | }; | 317 | }; |
318 | 318 | ||
319 | static struct kauai_timing kauai_mdma_timings[] __pmacdata = | 319 | static struct kauai_timing kauai_mdma_timings[] = |
320 | { | 320 | { |
321 | { 1260 , 0x00fff000 }, | 321 | { 1260 , 0x00fff000 }, |
322 | { 480 , 0x00618000 }, | 322 | { 480 , 0x00618000 }, |
@@ -330,7 +330,7 @@ static struct kauai_timing kauai_mdma_timings[] __pmacdata = | |||
330 | { 0 , 0 }, | 330 | { 0 , 0 }, |
331 | }; | 331 | }; |
332 | 332 | ||
333 | static struct kauai_timing kauai_udma_timings[] __pmacdata = | 333 | static struct kauai_timing kauai_udma_timings[] = |
334 | { | 334 | { |
335 | { 120 , 0x000070c0 }, | 335 | { 120 , 0x000070c0 }, |
336 | { 90 , 0x00005d80 }, | 336 | { 90 , 0x00005d80 }, |
@@ -341,7 +341,7 @@ static struct kauai_timing kauai_udma_timings[] __pmacdata = | |||
341 | { 0 , 0 }, | 341 | { 0 , 0 }, |
342 | }; | 342 | }; |
343 | 343 | ||
344 | static struct kauai_timing shasta_pio_timings[] __pmacdata = | 344 | static struct kauai_timing shasta_pio_timings[] = |
345 | { | 345 | { |
346 | { 930 , 0x08000fff }, | 346 | { 930 , 0x08000fff }, |
347 | { 600 , 0x0A000c97 }, | 347 | { 600 , 0x0A000c97 }, |
@@ -356,7 +356,7 @@ static struct kauai_timing shasta_pio_timings[] __pmacdata = | |||
356 | { 120 , 0x0400010a } | 356 | { 120 , 0x0400010a } |
357 | }; | 357 | }; |
358 | 358 | ||
359 | static struct kauai_timing shasta_mdma_timings[] __pmacdata = | 359 | static struct kauai_timing shasta_mdma_timings[] = |
360 | { | 360 | { |
361 | { 1260 , 0x00fff000 }, | 361 | { 1260 , 0x00fff000 }, |
362 | { 480 , 0x00820800 }, | 362 | { 480 , 0x00820800 }, |
@@ -370,7 +370,7 @@ static struct kauai_timing shasta_mdma_timings[] __pmacdata = | |||
370 | { 0 , 0 }, | 370 | { 0 , 0 }, |
371 | }; | 371 | }; |
372 | 372 | ||
373 | static struct kauai_timing shasta_udma133_timings[] __pmacdata = | 373 | static struct kauai_timing shasta_udma133_timings[] = |
374 | { | 374 | { |
375 | { 120 , 0x00035901, }, | 375 | { 120 , 0x00035901, }, |
376 | { 90 , 0x000348b1, }, | 376 | { 90 , 0x000348b1, }, |
@@ -522,7 +522,7 @@ pmu_hd_blink_init(void) | |||
522 | * N.B. this can't be an initfunc, because the media-bay task can | 522 | * N.B. this can't be an initfunc, because the media-bay task can |
523 | * call ide_[un]register at any time. | 523 | * call ide_[un]register at any time. |
524 | */ | 524 | */ |
525 | void __pmac | 525 | void |
526 | pmac_ide_init_hwif_ports(hw_regs_t *hw, | 526 | pmac_ide_init_hwif_ports(hw_regs_t *hw, |
527 | unsigned long data_port, unsigned long ctrl_port, | 527 | unsigned long data_port, unsigned long ctrl_port, |
528 | int *irq) | 528 | int *irq) |
@@ -559,7 +559,7 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw, | |||
559 | * timing register when selecting that unit. This version is for | 559 | * timing register when selecting that unit. This version is for |
560 | * ASICs with a single timing register | 560 | * ASICs with a single timing register |
561 | */ | 561 | */ |
562 | static void __pmac | 562 | static void |
563 | pmac_ide_selectproc(ide_drive_t *drive) | 563 | pmac_ide_selectproc(ide_drive_t *drive) |
564 | { | 564 | { |
565 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 565 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
@@ -579,7 +579,7 @@ pmac_ide_selectproc(ide_drive_t *drive) | |||
579 | * timing register when selecting that unit. This version is for | 579 | * timing register when selecting that unit. This version is for |
580 | * ASICs with a dual timing register (Kauai) | 580 | * ASICs with a dual timing register (Kauai) |
581 | */ | 581 | */ |
582 | static void __pmac | 582 | static void |
583 | pmac_ide_kauai_selectproc(ide_drive_t *drive) | 583 | pmac_ide_kauai_selectproc(ide_drive_t *drive) |
584 | { | 584 | { |
585 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 585 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
@@ -600,7 +600,7 @@ pmac_ide_kauai_selectproc(ide_drive_t *drive) | |||
600 | /* | 600 | /* |
601 | * Force an update of controller timing values for a given drive | 601 | * Force an update of controller timing values for a given drive |
602 | */ | 602 | */ |
603 | static void __pmac | 603 | static void |
604 | pmac_ide_do_update_timings(ide_drive_t *drive) | 604 | pmac_ide_do_update_timings(ide_drive_t *drive) |
605 | { | 605 | { |
606 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 606 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
@@ -633,7 +633,7 @@ pmac_outbsync(ide_drive_t *drive, u8 value, unsigned long port) | |||
633 | * to sort that out sooner or later and see if I can finally get the | 633 | * to sort that out sooner or later and see if I can finally get the |
634 | * common version to work properly in all cases | 634 | * common version to work properly in all cases |
635 | */ | 635 | */ |
636 | static int __pmac | 636 | static int |
637 | pmac_ide_do_setfeature(ide_drive_t *drive, u8 command) | 637 | pmac_ide_do_setfeature(ide_drive_t *drive, u8 command) |
638 | { | 638 | { |
639 | ide_hwif_t *hwif = HWIF(drive); | 639 | ide_hwif_t *hwif = HWIF(drive); |
@@ -710,7 +710,7 @@ out: | |||
710 | /* | 710 | /* |
711 | * Old tuning functions (called on hdparm -p), sets up drive PIO timings | 711 | * Old tuning functions (called on hdparm -p), sets up drive PIO timings |
712 | */ | 712 | */ |
713 | static void __pmac | 713 | static void |
714 | pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) | 714 | pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) |
715 | { | 715 | { |
716 | ide_pio_data_t d; | 716 | ide_pio_data_t d; |
@@ -801,7 +801,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) | |||
801 | /* | 801 | /* |
802 | * Calculate KeyLargo ATA/66 UDMA timings | 802 | * Calculate KeyLargo ATA/66 UDMA timings |
803 | */ | 803 | */ |
804 | static int __pmac | 804 | static int |
805 | set_timings_udma_ata4(u32 *timings, u8 speed) | 805 | set_timings_udma_ata4(u32 *timings, u8 speed) |
806 | { | 806 | { |
807 | unsigned rdyToPauseTicks, wrDataSetupTicks, addrTicks; | 807 | unsigned rdyToPauseTicks, wrDataSetupTicks, addrTicks; |
@@ -829,7 +829,7 @@ set_timings_udma_ata4(u32 *timings, u8 speed) | |||
829 | /* | 829 | /* |
830 | * Calculate Kauai ATA/100 UDMA timings | 830 | * Calculate Kauai ATA/100 UDMA timings |
831 | */ | 831 | */ |
832 | static int __pmac | 832 | static int |
833 | set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed) | 833 | set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed) |
834 | { | 834 | { |
835 | struct ide_timing *t = ide_timing_find_mode(speed); | 835 | struct ide_timing *t = ide_timing_find_mode(speed); |
@@ -849,7 +849,7 @@ set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed) | |||
849 | /* | 849 | /* |
850 | * Calculate Shasta ATA/133 UDMA timings | 850 | * Calculate Shasta ATA/133 UDMA timings |
851 | */ | 851 | */ |
852 | static int __pmac | 852 | static int |
853 | set_timings_udma_shasta(u32 *pio_timings, u32 *ultra_timings, u8 speed) | 853 | set_timings_udma_shasta(u32 *pio_timings, u32 *ultra_timings, u8 speed) |
854 | { | 854 | { |
855 | struct ide_timing *t = ide_timing_find_mode(speed); | 855 | struct ide_timing *t = ide_timing_find_mode(speed); |
@@ -869,7 +869,7 @@ set_timings_udma_shasta(u32 *pio_timings, u32 *ultra_timings, u8 speed) | |||
869 | /* | 869 | /* |
870 | * Calculate MDMA timings for all cells | 870 | * Calculate MDMA timings for all cells |
871 | */ | 871 | */ |
872 | static int __pmac | 872 | static int |
873 | set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, | 873 | set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, |
874 | u8 speed, int drive_cycle_time) | 874 | u8 speed, int drive_cycle_time) |
875 | { | 875 | { |
@@ -1014,7 +1014,7 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, | |||
1014 | * our dedicated function is more precise as it uses the drive provided | 1014 | * our dedicated function is more precise as it uses the drive provided |
1015 | * cycle time value. We should probably fix this one to deal with that too... | 1015 | * cycle time value. We should probably fix this one to deal with that too... |
1016 | */ | 1016 | */ |
1017 | static int __pmac | 1017 | static int |
1018 | pmac_ide_tune_chipset (ide_drive_t *drive, byte speed) | 1018 | pmac_ide_tune_chipset (ide_drive_t *drive, byte speed) |
1019 | { | 1019 | { |
1020 | int unit = (drive->select.b.unit & 0x01); | 1020 | int unit = (drive->select.b.unit & 0x01); |
@@ -1092,7 +1092,7 @@ pmac_ide_tune_chipset (ide_drive_t *drive, byte speed) | |||
1092 | * Blast some well known "safe" values to the timing registers at init or | 1092 | * Blast some well known "safe" values to the timing registers at init or |
1093 | * wakeup from sleep time, before we do real calculation | 1093 | * wakeup from sleep time, before we do real calculation |
1094 | */ | 1094 | */ |
1095 | static void __pmac | 1095 | static void |
1096 | sanitize_timings(pmac_ide_hwif_t *pmif) | 1096 | sanitize_timings(pmac_ide_hwif_t *pmif) |
1097 | { | 1097 | { |
1098 | unsigned int value, value2 = 0; | 1098 | unsigned int value, value2 = 0; |
@@ -1123,13 +1123,13 @@ sanitize_timings(pmac_ide_hwif_t *pmif) | |||
1123 | pmif->timings[2] = pmif->timings[3] = value2; | 1123 | pmif->timings[2] = pmif->timings[3] = value2; |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | unsigned long __pmac | 1126 | unsigned long |
1127 | pmac_ide_get_base(int index) | 1127 | pmac_ide_get_base(int index) |
1128 | { | 1128 | { |
1129 | return pmac_ide[index].regbase; | 1129 | return pmac_ide[index].regbase; |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | int __pmac | 1132 | int |
1133 | pmac_ide_check_base(unsigned long base) | 1133 | pmac_ide_check_base(unsigned long base) |
1134 | { | 1134 | { |
1135 | int ix; | 1135 | int ix; |
@@ -1140,7 +1140,7 @@ pmac_ide_check_base(unsigned long base) | |||
1140 | return -1; | 1140 | return -1; |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | int __pmac | 1143 | int |
1144 | pmac_ide_get_irq(unsigned long base) | 1144 | pmac_ide_get_irq(unsigned long base) |
1145 | { | 1145 | { |
1146 | int ix; | 1146 | int ix; |
@@ -1151,7 +1151,7 @@ pmac_ide_get_irq(unsigned long base) | |||
1151 | return 0; | 1151 | return 0; |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | static int ide_majors[] __pmacdata = { 3, 22, 33, 34, 56, 57 }; | 1154 | static int ide_majors[] = { 3, 22, 33, 34, 56, 57 }; |
1155 | 1155 | ||
1156 | dev_t __init | 1156 | dev_t __init |
1157 | pmac_find_ide_boot(char *bootdevice, int n) | 1157 | pmac_find_ide_boot(char *bootdevice, int n) |
@@ -1701,7 +1701,7 @@ pmac_ide_probe(void) | |||
1701 | * pmac_ide_build_dmatable builds the DBDMA command list | 1701 | * pmac_ide_build_dmatable builds the DBDMA command list |
1702 | * for a transfer and sets the DBDMA channel to point to it. | 1702 | * for a transfer and sets the DBDMA channel to point to it. |
1703 | */ | 1703 | */ |
1704 | static int __pmac | 1704 | static int |
1705 | pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) | 1705 | pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) |
1706 | { | 1706 | { |
1707 | struct dbdma_cmd *table; | 1707 | struct dbdma_cmd *table; |
@@ -1785,7 +1785,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | /* Teardown mappings after DMA has completed. */ | 1787 | /* Teardown mappings after DMA has completed. */ |
1788 | static void __pmac | 1788 | static void |
1789 | pmac_ide_destroy_dmatable (ide_drive_t *drive) | 1789 | pmac_ide_destroy_dmatable (ide_drive_t *drive) |
1790 | { | 1790 | { |
1791 | ide_hwif_t *hwif = drive->hwif; | 1791 | ide_hwif_t *hwif = drive->hwif; |
@@ -1802,7 +1802,7 @@ pmac_ide_destroy_dmatable (ide_drive_t *drive) | |||
1802 | /* | 1802 | /* |
1803 | * Pick up best MDMA timing for the drive and apply it | 1803 | * Pick up best MDMA timing for the drive and apply it |
1804 | */ | 1804 | */ |
1805 | static int __pmac | 1805 | static int |
1806 | pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode) | 1806 | pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode) |
1807 | { | 1807 | { |
1808 | ide_hwif_t *hwif = HWIF(drive); | 1808 | ide_hwif_t *hwif = HWIF(drive); |
@@ -1859,7 +1859,7 @@ pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode) | |||
1859 | /* | 1859 | /* |
1860 | * Pick up best UDMA timing for the drive and apply it | 1860 | * Pick up best UDMA timing for the drive and apply it |
1861 | */ | 1861 | */ |
1862 | static int __pmac | 1862 | static int |
1863 | pmac_ide_udma_enable(ide_drive_t *drive, u16 mode) | 1863 | pmac_ide_udma_enable(ide_drive_t *drive, u16 mode) |
1864 | { | 1864 | { |
1865 | ide_hwif_t *hwif = HWIF(drive); | 1865 | ide_hwif_t *hwif = HWIF(drive); |
@@ -1915,7 +1915,7 @@ pmac_ide_udma_enable(ide_drive_t *drive, u16 mode) | |||
1915 | * Check what is the best DMA timing setting for the drive and | 1915 | * Check what is the best DMA timing setting for the drive and |
1916 | * call appropriate functions to apply it. | 1916 | * call appropriate functions to apply it. |
1917 | */ | 1917 | */ |
1918 | static int __pmac | 1918 | static int |
1919 | pmac_ide_dma_check(ide_drive_t *drive) | 1919 | pmac_ide_dma_check(ide_drive_t *drive) |
1920 | { | 1920 | { |
1921 | struct hd_driveid *id = drive->id; | 1921 | struct hd_driveid *id = drive->id; |
@@ -1967,7 +1967,7 @@ pmac_ide_dma_check(ide_drive_t *drive) | |||
1967 | * Prepare a DMA transfer. We build the DMA table, adjust the timings for | 1967 | * Prepare a DMA transfer. We build the DMA table, adjust the timings for |
1968 | * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion | 1968 | * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion |
1969 | */ | 1969 | */ |
1970 | static int __pmac | 1970 | static int |
1971 | pmac_ide_dma_setup(ide_drive_t *drive) | 1971 | pmac_ide_dma_setup(ide_drive_t *drive) |
1972 | { | 1972 | { |
1973 | ide_hwif_t *hwif = HWIF(drive); | 1973 | ide_hwif_t *hwif = HWIF(drive); |
@@ -1997,7 +1997,7 @@ pmac_ide_dma_setup(ide_drive_t *drive) | |||
1997 | return 0; | 1997 | return 0; |
1998 | } | 1998 | } |
1999 | 1999 | ||
2000 | static void __pmac | 2000 | static void |
2001 | pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) | 2001 | pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) |
2002 | { | 2002 | { |
2003 | /* issue cmd to drive */ | 2003 | /* issue cmd to drive */ |
@@ -2008,7 +2008,7 @@ pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) | |||
2008 | * Kick the DMA controller into life after the DMA command has been issued | 2008 | * Kick the DMA controller into life after the DMA command has been issued |
2009 | * to the drive. | 2009 | * to the drive. |
2010 | */ | 2010 | */ |
2011 | static void __pmac | 2011 | static void |
2012 | pmac_ide_dma_start(ide_drive_t *drive) | 2012 | pmac_ide_dma_start(ide_drive_t *drive) |
2013 | { | 2013 | { |
2014 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 2014 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
@@ -2024,7 +2024,7 @@ pmac_ide_dma_start(ide_drive_t *drive) | |||
2024 | /* | 2024 | /* |
2025 | * After a DMA transfer, make sure the controller is stopped | 2025 | * After a DMA transfer, make sure the controller is stopped |
2026 | */ | 2026 | */ |
2027 | static int __pmac | 2027 | static int |
2028 | pmac_ide_dma_end (ide_drive_t *drive) | 2028 | pmac_ide_dma_end (ide_drive_t *drive) |
2029 | { | 2029 | { |
2030 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 2030 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
@@ -2052,7 +2052,7 @@ pmac_ide_dma_end (ide_drive_t *drive) | |||
2052 | * that's not implemented yet), on the other hand, we don't have shared interrupts | 2052 | * that's not implemented yet), on the other hand, we don't have shared interrupts |
2053 | * so it's not really a problem | 2053 | * so it's not really a problem |
2054 | */ | 2054 | */ |
2055 | static int __pmac | 2055 | static int |
2056 | pmac_ide_dma_test_irq (ide_drive_t *drive) | 2056 | pmac_ide_dma_test_irq (ide_drive_t *drive) |
2057 | { | 2057 | { |
2058 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 2058 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
@@ -2108,19 +2108,19 @@ pmac_ide_dma_test_irq (ide_drive_t *drive) | |||
2108 | return 1; | 2108 | return 1; |
2109 | } | 2109 | } |
2110 | 2110 | ||
2111 | static int __pmac | 2111 | static int |
2112 | pmac_ide_dma_host_off (ide_drive_t *drive) | 2112 | pmac_ide_dma_host_off (ide_drive_t *drive) |
2113 | { | 2113 | { |
2114 | return 0; | 2114 | return 0; |
2115 | } | 2115 | } |
2116 | 2116 | ||
2117 | static int __pmac | 2117 | static int |
2118 | pmac_ide_dma_host_on (ide_drive_t *drive) | 2118 | pmac_ide_dma_host_on (ide_drive_t *drive) |
2119 | { | 2119 | { |
2120 | return 0; | 2120 | return 0; |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | static int __pmac | 2123 | static int |
2124 | pmac_ide_dma_lostirq (ide_drive_t *drive) | 2124 | pmac_ide_dma_lostirq (ide_drive_t *drive) |
2125 | { | 2125 | { |
2126 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 2126 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index f014e639088c..c57a3871184c 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
39 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/sched.h> /* INIT_WORK, schedule_work(), flush_scheduled_work() */ | ||
41 | 42 | ||
42 | #include <rdma/ib_cache.h> | 43 | #include <rdma/ib_cache.h> |
43 | 44 | ||
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 89ce9dc210d4..acda7d63d6fe 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/dma-mapping.h> | 43 | #include <linux/dma-mapping.h> |
44 | #include <linux/kref.h> | 44 | #include <linux/kref.h> |
45 | #include <linux/idr.h> | 45 | #include <linux/idr.h> |
46 | #include <linux/workqueue.h> | ||
46 | 47 | ||
47 | #include <rdma/ib_pack.h> | 48 | #include <rdma/ib_pack.h> |
48 | #include <rdma/ib_sa.h> | 49 | #include <rdma/ib_sa.h> |
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index 889e85096736..22fdc446f25c 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -34,6 +34,8 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/string.h> | ||
38 | #include <linux/slab.h> | ||
37 | 39 | ||
38 | #include <rdma/ib_verbs.h> | 40 | #include <rdma/ib_verbs.h> |
39 | #include <rdma/ib_cache.h> | 41 | #include <rdma/ib_cache.h> |
diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c index 8561b297a19b..1229c604c6e0 100644 --- a/drivers/infiniband/hw/mthca/mthca_mad.c +++ b/drivers/infiniband/hw/mthca/mthca_mad.c | |||
@@ -34,6 +34,9 @@ | |||
34 | * $Id: mthca_mad.c 1349 2004-12-16 21:09:43Z roland $ | 34 | * $Id: mthca_mad.c 1349 2004-12-16 21:09:43Z roland $ |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/string.h> | ||
38 | #include <linux/slab.h> | ||
39 | |||
37 | #include <rdma/ib_verbs.h> | 40 | #include <rdma/ib_verbs.h> |
38 | #include <rdma/ib_mad.h> | 41 | #include <rdma/ib_mad.h> |
39 | #include <rdma/ib_smi.h> | 42 | #include <rdma/ib_smi.h> |
diff --git a/drivers/infiniband/hw/mthca/mthca_mcg.c b/drivers/infiniband/hw/mthca/mthca_mcg.c index b47ea7daf088..2fc449da418d 100644 --- a/drivers/infiniband/hw/mthca/mthca_mcg.c +++ b/drivers/infiniband/hw/mthca/mthca_mcg.c | |||
@@ -33,6 +33,8 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/string.h> | ||
37 | #include <linux/slab.h> | ||
36 | 38 | ||
37 | #include "mthca_dev.h" | 39 | #include "mthca_dev.h" |
38 | #include "mthca_cmd.h" | 40 | #include "mthca_cmd.h" |
diff --git a/drivers/infiniband/hw/mthca/mthca_profile.c b/drivers/infiniband/hw/mthca/mthca_profile.c index 0576056b34f4..bd1338682074 100644 --- a/drivers/infiniband/hw/mthca/mthca_profile.c +++ b/drivers/infiniband/hw/mthca/mthca_profile.c | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/moduleparam.h> | 37 | #include <linux/moduleparam.h> |
38 | #include <linux/string.h> | ||
39 | #include <linux/slab.h> | ||
38 | 40 | ||
39 | #include "mthca_profile.h" | 41 | #include "mthca_profile.h" |
40 | 42 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 62ff091505da..7c9afde5ace5 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -36,6 +36,8 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/string.h> | ||
40 | #include <linux/slab.h> | ||
39 | 41 | ||
40 | #include <rdma/ib_verbs.h> | 42 | #include <rdma/ib_verbs.h> |
41 | #include <rdma/ib_cache.h> | 43 | #include <rdma/ib_cache.h> |
diff --git a/drivers/infiniband/hw/mthca/mthca_reset.c b/drivers/infiniband/hw/mthca/mthca_reset.c index 4f995391dd1d..df5e494a9d38 100644 --- a/drivers/infiniband/hw/mthca/mthca_reset.c +++ b/drivers/infiniband/hw/mthca/mthca_reset.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/slab.h> | ||
40 | 41 | ||
41 | #include "mthca_dev.h" | 42 | #include "mthca_dev.h" |
42 | #include "mthca_cmd.h" | 43 | #include "mthca_cmd.h" |
diff --git a/drivers/infiniband/hw/mthca/mthca_uar.c b/drivers/infiniband/hw/mthca/mthca_uar.c index 1c8791ded6ff..8e9219842be4 100644 --- a/drivers/infiniband/hw/mthca/mthca_uar.c +++ b/drivers/infiniband/hw/mthca/mthca_uar.c | |||
@@ -32,6 +32,8 @@ | |||
32 | * $Id$ | 32 | * $Id$ |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <asm/page.h> /* PAGE_SHIFT */ | ||
36 | |||
35 | #include "mthca_dev.h" | 37 | #include "mthca_dev.h" |
36 | #include "mthca_memfree.h" | 38 | #include "mthca_memfree.h" |
37 | 39 | ||
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index ab09cf4093e3..0506934244f0 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
24 | #include <linux/sched.h> /* HZ */ | ||
24 | 25 | ||
25 | /*#include <asm/io.h>*/ | 26 | /*#include <asm/io.h>*/ |
26 | 27 | ||
diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c index bf65430181fa..4571ea3a4b92 100644 --- a/drivers/input/joystick/a3d.c +++ b/drivers/input/joystick/a3d.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/gameport.h> | 35 | #include <linux/gameport.h> |
36 | #include <linux/input.h> | 36 | #include <linux/input.h> |
37 | #include <linux/jiffies.h> | ||
37 | 38 | ||
38 | #define DRIVER_DESC "FP-Gaming Assasin 3D joystick driver" | 39 | #define DRIVER_DESC "FP-Gaming Assasin 3D joystick driver" |
39 | 40 | ||
diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c index 9d95459f4bcb..704bf70f1db7 100644 --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/input.h> | 34 | #include <linux/input.h> |
35 | #include <linux/gameport.h> | 35 | #include <linux/gameport.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/jiffies.h> | ||
37 | 38 | ||
38 | #define DRIVER_DESC "Logitech ADI joystick family driver" | 39 | #define DRIVER_DESC "Logitech ADI joystick family driver" |
39 | 40 | ||
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index c75ac6eb1ffb..3121961e3e7c 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/input.h> | 39 | #include <linux/input.h> |
40 | #include <linux/gameport.h> | 40 | #include <linux/gameport.h> |
41 | #include <linux/jiffies.h> | ||
41 | #include <asm/timex.h> | 42 | #include <asm/timex.h> |
42 | 43 | ||
43 | #define DRIVER_DESC "Analog joystick and gamepad driver" | 44 | #define DRIVER_DESC "Analog joystick and gamepad driver" |
diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c index 9a3dfc724a41..1909f7ef340c 100644 --- a/drivers/input/joystick/cobra.c +++ b/drivers/input/joystick/cobra.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/gameport.h> | 35 | #include <linux/gameport.h> |
36 | #include <linux/input.h> | 36 | #include <linux/input.h> |
37 | #include <linux/jiffies.h> | ||
37 | 38 | ||
38 | #define DRIVER_DESC "Creative Labs Blaster GamePad Cobra driver" | 39 | #define DRIVER_DESC "Creative Labs Blaster GamePad Cobra driver" |
39 | 40 | ||
diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c index e151f8c5bcb9..8a3ad455eb38 100644 --- a/drivers/input/joystick/gf2k.c +++ b/drivers/input/joystick/gf2k.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/input.h> | 36 | #include <linux/input.h> |
37 | #include <linux/gameport.h> | 37 | #include <linux/gameport.h> |
38 | #include <linux/jiffies.h> | ||
38 | 39 | ||
39 | #define DRIVER_DESC "Genius Flight 2000 joystick driver" | 40 | #define DRIVER_DESC "Genius Flight 2000 joystick driver" |
40 | 41 | ||
diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c index e206bb56e53c..a936e7aedb10 100644 --- a/drivers/input/joystick/grip.c +++ b/drivers/input/joystick/grip.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/gameport.h> | 35 | #include <linux/gameport.h> |
36 | #include <linux/input.h> | 36 | #include <linux/input.h> |
37 | #include <linux/jiffies.h> | ||
37 | 38 | ||
38 | #define DRIVER_DESC "Gravis GrIP protocol joystick driver" | 39 | #define DRIVER_DESC "Gravis GrIP protocol joystick driver" |
39 | 40 | ||
diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c index a0ba93ccac72..51a912222e85 100644 --- a/drivers/input/joystick/grip_mp.c +++ b/drivers/input/joystick/grip_mp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/input.h> | 19 | #include <linux/input.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/proc_fs.h> | 21 | #include <linux/proc_fs.h> |
22 | #include <linux/jiffies.h> | ||
22 | 23 | ||
23 | #define DRIVER_DESC "Gravis Grip Multiport driver" | 24 | #define DRIVER_DESC "Gravis Grip Multiport driver" |
24 | 25 | ||
diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c index c528473c09d8..6e2c721c26ba 100644 --- a/drivers/input/joystick/guillemot.c +++ b/drivers/input/joystick/guillemot.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/gameport.h> | 36 | #include <linux/gameport.h> |
37 | #include <linux/input.h> | 37 | #include <linux/input.h> |
38 | #include <linux/jiffies.h> | ||
38 | 39 | ||
39 | #define DRIVER_DESC "Guillemot Digital joystick driver" | 40 | #define DRIVER_DESC "Guillemot Digital joystick driver" |
40 | 41 | ||
diff --git a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c index 8511ee7bb263..c4ed01758226 100644 --- a/drivers/input/joystick/interact.c +++ b/drivers/input/joystick/interact.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/gameport.h> | 39 | #include <linux/gameport.h> |
40 | #include <linux/input.h> | 40 | #include <linux/input.h> |
41 | #include <linux/jiffies.h> | ||
41 | 42 | ||
42 | #define DRIVER_DESC "InterAct digital joystick driver" | 43 | #define DRIVER_DESC "InterAct digital joystick driver" |
43 | 44 | ||
diff --git a/drivers/input/joystick/joydump.c b/drivers/input/joystick/joydump.c index 4234ccaf9146..88ec5a918f2e 100644 --- a/drivers/input/joystick/joydump.c +++ b/drivers/input/joystick/joydump.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/slab.h> | ||
37 | 38 | ||
38 | #define DRIVER_DESC "Gameport data dumper module" | 39 | #define DRIVER_DESC "Gameport data dumper module" |
39 | 40 | ||
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c index eaaad45cc750..78dd163cd702 100644 --- a/drivers/input/joystick/sidewinder.c +++ b/drivers/input/joystick/sidewinder.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/input.h> | 34 | #include <linux/input.h> |
35 | #include <linux/gameport.h> | 35 | #include <linux/gameport.h> |
36 | #include <linux/jiffies.h> | ||
36 | 37 | ||
37 | #define DRIVER_DESC "Microsoft SideWinder joystick family driver" | 38 | #define DRIVER_DESC "Microsoft SideWinder joystick family driver" |
38 | 39 | ||
diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c index 3a7d1bb46472..60e2aac7d06e 100644 --- a/drivers/input/joystick/tmdc.c +++ b/drivers/input/joystick/tmdc.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/gameport.h> | 39 | #include <linux/gameport.h> |
40 | #include <linux/input.h> | 40 | #include <linux/input.h> |
41 | #include <linux/jiffies.h> | ||
41 | 42 | ||
42 | #define DRIVER_DESC "ThrustMaster DirectConnect joystick driver" | 43 | #define DRIVER_DESC "ThrustMaster DirectConnect joystick driver" |
43 | 44 | ||
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index bb934e6d9636..b3eaac1b35b6 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -14,7 +14,7 @@ if INPUT_MISC | |||
14 | 14 | ||
15 | config INPUT_PCSPKR | 15 | config INPUT_PCSPKR |
16 | tristate "PC Speaker support" | 16 | tristate "PC Speaker support" |
17 | depends on ALPHA || X86 || X86_64 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES | 17 | depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES |
18 | help | 18 | help |
19 | Say Y here if you want the standard PC Speaker to be used for | 19 | Say Y here if you want the standard PC Speaker to be used for |
20 | bells and whistles. | 20 | bells and whistles. |
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c index e3c44ffae674..1c9426fd5205 100644 --- a/drivers/input/serio/hp_sdc_mlc.c +++ b/drivers/input/serio/hp_sdc_mlc.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/module.h> | 40 | #include <linux/module.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/string.h> | 42 | #include <linux/string.h> |
43 | #include <asm/semaphore.h> | ||
43 | 44 | ||
44 | #define PREFIX "HP SDC MLC: " | 45 | #define PREFIX "HP SDC MLC: " |
45 | 46 | ||
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c index 3abd7fc6e5ef..7b564c0dd996 100644 --- a/drivers/isdn/capi/capifs.c +++ b/drivers/isdn/capi/capifs.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/ctype.h> | 17 | #include <linux/ctype.h> |
18 | #include <linux/sched.h> /* current */ | ||
18 | 19 | ||
19 | MODULE_DESCRIPTION("CAPI4Linux: /dev/capi/ filesystem"); | 20 | MODULE_DESCRIPTION("CAPI4Linux: /dev/capi/ filesystem"); |
20 | MODULE_AUTHOR("Carsten Paeth"); | 21 | MODULE_AUTHOR("Carsten Paeth"); |
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c index 7333377ab31d..e3866b0a97fd 100644 --- a/drivers/isdn/hisax/hfc4s8s_l1.c +++ b/drivers/isdn/hisax/hfc4s8s_l1.c | |||
@@ -1063,7 +1063,7 @@ tx_b_frame(struct hfc4s8s_btype *bch) | |||
1063 | Write_hfc8(l1->hw, A_INC_RES_FIFO, 1); | 1063 | Write_hfc8(l1->hw, A_INC_RES_FIFO, 1); |
1064 | } | 1064 | } |
1065 | ack_len += skb->truesize; | 1065 | ack_len += skb->truesize; |
1066 | bch->tx_skb = 0; | 1066 | bch->tx_skb = NULL; |
1067 | bch->tx_cnt = 0; | 1067 | bch->tx_cnt = 0; |
1068 | dev_kfree_skb(skb); | 1068 | dev_kfree_skb(skb); |
1069 | } else | 1069 | } else |
@@ -1659,10 +1659,10 @@ hfc4s8s_remove(struct pci_dev *pdev) | |||
1659 | } | 1659 | } |
1660 | 1660 | ||
1661 | static struct pci_driver hfc4s8s_driver = { | 1661 | static struct pci_driver hfc4s8s_driver = { |
1662 | name:"hfc4s8s_l1", | 1662 | .name = "hfc4s8s_l1", |
1663 | probe:hfc4s8s_probe, | 1663 | .probe = hfc4s8s_probe, |
1664 | remove:__devexit_p(hfc4s8s_remove), | 1664 | .remove = __devexit_p(hfc4s8s_remove), |
1665 | id_table:hfc4s8s_ids, | 1665 | .id_table = hfc4s8s_ids, |
1666 | }; | 1666 | }; |
1667 | 1667 | ||
1668 | /**********************/ | 1668 | /**********************/ |
diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c index 5e0811dc6536..2b8a6e821d44 100644 --- a/drivers/macintosh/ans-lcd.c +++ b/drivers/macintosh/ans-lcd.c | |||
@@ -27,7 +27,7 @@ static volatile unsigned char __iomem *anslcd_ptr; | |||
27 | 27 | ||
28 | #undef DEBUG | 28 | #undef DEBUG |
29 | 29 | ||
30 | static void __pmac | 30 | static void |
31 | anslcd_write_byte_ctrl ( unsigned char c ) | 31 | anslcd_write_byte_ctrl ( unsigned char c ) |
32 | { | 32 | { |
33 | #ifdef DEBUG | 33 | #ifdef DEBUG |
@@ -43,14 +43,14 @@ anslcd_write_byte_ctrl ( unsigned char c ) | |||
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | static void __pmac | 46 | static void |
47 | anslcd_write_byte_data ( unsigned char c ) | 47 | anslcd_write_byte_data ( unsigned char c ) |
48 | { | 48 | { |
49 | out_8(anslcd_ptr + ANSLCD_DATA_IX, c); | 49 | out_8(anslcd_ptr + ANSLCD_DATA_IX, c); |
50 | udelay(anslcd_short_delay); | 50 | udelay(anslcd_short_delay); |
51 | } | 51 | } |
52 | 52 | ||
53 | static ssize_t __pmac | 53 | static ssize_t |
54 | anslcd_write( struct file * file, const char __user * buf, | 54 | anslcd_write( struct file * file, const char __user * buf, |
55 | size_t count, loff_t *ppos ) | 55 | size_t count, loff_t *ppos ) |
56 | { | 56 | { |
@@ -73,7 +73,7 @@ anslcd_write( struct file * file, const char __user * buf, | |||
73 | return p - buf; | 73 | return p - buf; |
74 | } | 74 | } |
75 | 75 | ||
76 | static int __pmac | 76 | static int |
77 | anslcd_ioctl( struct inode * inode, struct file * file, | 77 | anslcd_ioctl( struct inode * inode, struct file * file, |
78 | unsigned int cmd, unsigned long arg ) | 78 | unsigned int cmd, unsigned long arg ) |
79 | { | 79 | { |
@@ -115,7 +115,7 @@ anslcd_ioctl( struct inode * inode, struct file * file, | |||
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | static int __pmac | 118 | static int |
119 | anslcd_open( struct inode * inode, struct file * file ) | 119 | anslcd_open( struct inode * inode, struct file * file ) |
120 | { | 120 | { |
121 | return 0; | 121 | return 0; |
diff --git a/drivers/macintosh/apm_emu.c b/drivers/macintosh/apm_emu.c index 19d3e05d6825..e5a2bbf99399 100644 --- a/drivers/macintosh/apm_emu.c +++ b/drivers/macintosh/apm_emu.c | |||
@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) | |||
430 | -1: Unknown | 430 | -1: Unknown |
431 | 8) min = minutes; sec = seconds */ | 431 | 8) min = minutes; sec = seconds */ |
432 | 432 | ||
433 | unsigned short ac_line_status = 0xff; | 433 | unsigned short ac_line_status; |
434 | unsigned short battery_status = 0xff; | 434 | unsigned short battery_status = 0; |
435 | unsigned short battery_flag = 0xff; | 435 | unsigned short battery_flag = 0xff; |
436 | int percentage = -1; | 436 | int percentage = -1; |
437 | int time_units = -1; | 437 | int time_units = -1; |
@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) | |||
446 | ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0); | 446 | ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0); |
447 | for (i=0; i<pmu_battery_count; i++) { | 447 | for (i=0; i<pmu_battery_count; i++) { |
448 | if (pmu_batteries[i].flags & PMU_BATT_PRESENT) { | 448 | if (pmu_batteries[i].flags & PMU_BATT_PRESENT) { |
449 | battery_status++; | ||
449 | if (percentage < 0) | 450 | if (percentage < 0) |
450 | percentage = 0; | 451 | percentage = 0; |
451 | if (charge < 0) | 452 | if (charge < 0) |
@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) | |||
461 | charging++; | 462 | charging++; |
462 | } | 463 | } |
463 | } | 464 | } |
465 | if (0 == battery_status) | ||
466 | ac_line_status = 1; | ||
467 | battery_status = 0xff; | ||
464 | if (real_count) { | 468 | if (real_count) { |
465 | if (amperage < 0) { | 469 | if (amperage < 0) { |
466 | if (btype == PMU_BATT_TYPE_SMART) | 470 | if (btype == PMU_BATT_TYPE_SMART) |
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 1ee003346923..c34c96d18907 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/pci_ids.h> | 17 | #include <linux/pci_ids.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/slab.h> | ||
21 | |||
20 | #include <asm/machdep.h> | 22 | #include <asm/machdep.h> |
21 | #include <asm/macio.h> | 23 | #include <asm/macio.h> |
22 | #include <asm/pmac_feature.h> | 24 | #include <asm/pmac_feature.h> |
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index 97d22bb4516a..7f7d4eaca870 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c | |||
@@ -39,6 +39,31 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf) | |||
39 | return length; | 39 | return length; |
40 | } | 40 | } |
41 | 41 | ||
42 | static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | ||
43 | char *buf) | ||
44 | { | ||
45 | struct of_device *of; | ||
46 | char *compat; | ||
47 | int cplen; | ||
48 | int length; | ||
49 | |||
50 | of = &to_macio_device (dev)->ofdev; | ||
51 | compat = (char *) get_property (of->node, "compatible", &cplen); | ||
52 | if (!compat) compat = "", cplen = 1; | ||
53 | length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type); | ||
54 | buf += length; | ||
55 | while (cplen > 0) { | ||
56 | int l; | ||
57 | length += sprintf (buf, "C%s", compat); | ||
58 | buf += length; | ||
59 | l = strlen (compat) + 1; | ||
60 | compat += l; | ||
61 | cplen -= l; | ||
62 | } | ||
63 | |||
64 | return length; | ||
65 | } | ||
66 | |||
42 | macio_config_of_attr (name, "%s\n"); | 67 | macio_config_of_attr (name, "%s\n"); |
43 | macio_config_of_attr (type, "%s\n"); | 68 | macio_config_of_attr (type, "%s\n"); |
44 | 69 | ||
@@ -46,5 +71,6 @@ struct device_attribute macio_dev_attrs[] = { | |||
46 | __ATTR_RO(name), | 71 | __ATTR_RO(name), |
47 | __ATTR_RO(type), | 72 | __ATTR_RO(type), |
48 | __ATTR_RO(compatible), | 73 | __ATTR_RO(compatible), |
74 | __ATTR_RO(modalias), | ||
49 | __ATTR_NULL | 75 | __ATTR_NULL |
50 | }; | 76 | }; |
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index c0712a1ea5af..b856bb67169c 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
@@ -167,19 +167,19 @@ enum { | |||
167 | * Functions for polling content of media bay | 167 | * Functions for polling content of media bay |
168 | */ | 168 | */ |
169 | 169 | ||
170 | static u8 __pmac | 170 | static u8 |
171 | ohare_mb_content(struct media_bay_info *bay) | 171 | ohare_mb_content(struct media_bay_info *bay) |
172 | { | 172 | { |
173 | return (MB_IN32(bay, OHARE_MBCR) >> 12) & 7; | 173 | return (MB_IN32(bay, OHARE_MBCR) >> 12) & 7; |
174 | } | 174 | } |
175 | 175 | ||
176 | static u8 __pmac | 176 | static u8 |
177 | heathrow_mb_content(struct media_bay_info *bay) | 177 | heathrow_mb_content(struct media_bay_info *bay) |
178 | { | 178 | { |
179 | return (MB_IN32(bay, HEATHROW_MBCR) >> 12) & 7; | 179 | return (MB_IN32(bay, HEATHROW_MBCR) >> 12) & 7; |
180 | } | 180 | } |
181 | 181 | ||
182 | static u8 __pmac | 182 | static u8 |
183 | keylargo_mb_content(struct media_bay_info *bay) | 183 | keylargo_mb_content(struct media_bay_info *bay) |
184 | { | 184 | { |
185 | int new_gpio; | 185 | int new_gpio; |
@@ -205,7 +205,7 @@ keylargo_mb_content(struct media_bay_info *bay) | |||
205 | * into reset state as well | 205 | * into reset state as well |
206 | */ | 206 | */ |
207 | 207 | ||
208 | static void __pmac | 208 | static void |
209 | ohare_mb_power(struct media_bay_info* bay, int on_off) | 209 | ohare_mb_power(struct media_bay_info* bay, int on_off) |
210 | { | 210 | { |
211 | if (on_off) { | 211 | if (on_off) { |
@@ -224,7 +224,7 @@ ohare_mb_power(struct media_bay_info* bay, int on_off) | |||
224 | MB_BIC(bay, OHARE_MBCR, 0x00000F00); | 224 | MB_BIC(bay, OHARE_MBCR, 0x00000F00); |
225 | } | 225 | } |
226 | 226 | ||
227 | static void __pmac | 227 | static void |
228 | heathrow_mb_power(struct media_bay_info* bay, int on_off) | 228 | heathrow_mb_power(struct media_bay_info* bay, int on_off) |
229 | { | 229 | { |
230 | if (on_off) { | 230 | if (on_off) { |
@@ -243,7 +243,7 @@ heathrow_mb_power(struct media_bay_info* bay, int on_off) | |||
243 | MB_BIC(bay, HEATHROW_MBCR, 0x00000F00); | 243 | MB_BIC(bay, HEATHROW_MBCR, 0x00000F00); |
244 | } | 244 | } |
245 | 245 | ||
246 | static void __pmac | 246 | static void |
247 | keylargo_mb_power(struct media_bay_info* bay, int on_off) | 247 | keylargo_mb_power(struct media_bay_info* bay, int on_off) |
248 | { | 248 | { |
249 | if (on_off) { | 249 | if (on_off) { |
@@ -267,7 +267,7 @@ keylargo_mb_power(struct media_bay_info* bay, int on_off) | |||
267 | * enable the related busses | 267 | * enable the related busses |
268 | */ | 268 | */ |
269 | 269 | ||
270 | static int __pmac | 270 | static int |
271 | ohare_mb_setup_bus(struct media_bay_info* bay, u8 device_id) | 271 | ohare_mb_setup_bus(struct media_bay_info* bay, u8 device_id) |
272 | { | 272 | { |
273 | switch(device_id) { | 273 | switch(device_id) { |
@@ -287,7 +287,7 @@ ohare_mb_setup_bus(struct media_bay_info* bay, u8 device_id) | |||
287 | return -ENODEV; | 287 | return -ENODEV; |
288 | } | 288 | } |
289 | 289 | ||
290 | static int __pmac | 290 | static int |
291 | heathrow_mb_setup_bus(struct media_bay_info* bay, u8 device_id) | 291 | heathrow_mb_setup_bus(struct media_bay_info* bay, u8 device_id) |
292 | { | 292 | { |
293 | switch(device_id) { | 293 | switch(device_id) { |
@@ -307,7 +307,7 @@ heathrow_mb_setup_bus(struct media_bay_info* bay, u8 device_id) | |||
307 | return -ENODEV; | 307 | return -ENODEV; |
308 | } | 308 | } |
309 | 309 | ||
310 | static int __pmac | 310 | static int |
311 | keylargo_mb_setup_bus(struct media_bay_info* bay, u8 device_id) | 311 | keylargo_mb_setup_bus(struct media_bay_info* bay, u8 device_id) |
312 | { | 312 | { |
313 | switch(device_id) { | 313 | switch(device_id) { |
@@ -330,43 +330,43 @@ keylargo_mb_setup_bus(struct media_bay_info* bay, u8 device_id) | |||
330 | * Functions for tweaking resets | 330 | * Functions for tweaking resets |
331 | */ | 331 | */ |
332 | 332 | ||
333 | static void __pmac | 333 | static void |
334 | ohare_mb_un_reset(struct media_bay_info* bay) | 334 | ohare_mb_un_reset(struct media_bay_info* bay) |
335 | { | 335 | { |
336 | MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N); | 336 | MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N); |
337 | } | 337 | } |
338 | 338 | ||
339 | static void __pmac keylargo_mb_init(struct media_bay_info *bay) | 339 | static void keylargo_mb_init(struct media_bay_info *bay) |
340 | { | 340 | { |
341 | MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE); | 341 | MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE); |
342 | } | 342 | } |
343 | 343 | ||
344 | static void __pmac heathrow_mb_un_reset(struct media_bay_info* bay) | 344 | static void heathrow_mb_un_reset(struct media_bay_info* bay) |
345 | { | 345 | { |
346 | MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N); | 346 | MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N); |
347 | } | 347 | } |
348 | 348 | ||
349 | static void __pmac keylargo_mb_un_reset(struct media_bay_info* bay) | 349 | static void keylargo_mb_un_reset(struct media_bay_info* bay) |
350 | { | 350 | { |
351 | MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET); | 351 | MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET); |
352 | } | 352 | } |
353 | 353 | ||
354 | static void __pmac ohare_mb_un_reset_ide(struct media_bay_info* bay) | 354 | static void ohare_mb_un_reset_ide(struct media_bay_info* bay) |
355 | { | 355 | { |
356 | MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N); | 356 | MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N); |
357 | } | 357 | } |
358 | 358 | ||
359 | static void __pmac heathrow_mb_un_reset_ide(struct media_bay_info* bay) | 359 | static void heathrow_mb_un_reset_ide(struct media_bay_info* bay) |
360 | { | 360 | { |
361 | MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N); | 361 | MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N); |
362 | } | 362 | } |
363 | 363 | ||
364 | static void __pmac keylargo_mb_un_reset_ide(struct media_bay_info* bay) | 364 | static void keylargo_mb_un_reset_ide(struct media_bay_info* bay) |
365 | { | 365 | { |
366 | MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N); | 366 | MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N); |
367 | } | 367 | } |
368 | 368 | ||
369 | static inline void __pmac set_mb_power(struct media_bay_info* bay, int onoff) | 369 | static inline void set_mb_power(struct media_bay_info* bay, int onoff) |
370 | { | 370 | { |
371 | /* Power up up and assert the bay reset line */ | 371 | /* Power up up and assert the bay reset line */ |
372 | if (onoff) { | 372 | if (onoff) { |
@@ -382,7 +382,7 @@ static inline void __pmac set_mb_power(struct media_bay_info* bay, int onoff) | |||
382 | bay->timer = msecs_to_jiffies(MB_POWER_DELAY); | 382 | bay->timer = msecs_to_jiffies(MB_POWER_DELAY); |
383 | } | 383 | } |
384 | 384 | ||
385 | static void __pmac poll_media_bay(struct media_bay_info* bay) | 385 | static void poll_media_bay(struct media_bay_info* bay) |
386 | { | 386 | { |
387 | int id = bay->ops->content(bay); | 387 | int id = bay->ops->content(bay); |
388 | 388 | ||
@@ -415,7 +415,7 @@ static void __pmac poll_media_bay(struct media_bay_info* bay) | |||
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | int __pmac check_media_bay(struct device_node *which_bay, int what) | 418 | int check_media_bay(struct device_node *which_bay, int what) |
419 | { | 419 | { |
420 | #ifdef CONFIG_BLK_DEV_IDE | 420 | #ifdef CONFIG_BLK_DEV_IDE |
421 | int i; | 421 | int i; |
@@ -432,7 +432,7 @@ int __pmac check_media_bay(struct device_node *which_bay, int what) | |||
432 | } | 432 | } |
433 | EXPORT_SYMBOL(check_media_bay); | 433 | EXPORT_SYMBOL(check_media_bay); |
434 | 434 | ||
435 | int __pmac check_media_bay_by_base(unsigned long base, int what) | 435 | int check_media_bay_by_base(unsigned long base, int what) |
436 | { | 436 | { |
437 | #ifdef CONFIG_BLK_DEV_IDE | 437 | #ifdef CONFIG_BLK_DEV_IDE |
438 | int i; | 438 | int i; |
@@ -449,7 +449,7 @@ int __pmac check_media_bay_by_base(unsigned long base, int what) | |||
449 | return -ENODEV; | 449 | return -ENODEV; |
450 | } | 450 | } |
451 | 451 | ||
452 | int __pmac media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, | 452 | int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, |
453 | int irq, int index) | 453 | int irq, int index) |
454 | { | 454 | { |
455 | #ifdef CONFIG_BLK_DEV_IDE | 455 | #ifdef CONFIG_BLK_DEV_IDE |
@@ -489,7 +489,7 @@ int __pmac media_bay_set_ide_infos(struct device_node* which_bay, unsigned long | |||
489 | return -ENODEV; | 489 | return -ENODEV; |
490 | } | 490 | } |
491 | 491 | ||
492 | static void __pmac media_bay_step(int i) | 492 | static void media_bay_step(int i) |
493 | { | 493 | { |
494 | struct media_bay_info* bay = &media_bays[i]; | 494 | struct media_bay_info* bay = &media_bays[i]; |
495 | 495 | ||
@@ -619,7 +619,7 @@ static void __pmac media_bay_step(int i) | |||
619 | * with the IDE driver. It needs to be a thread because | 619 | * with the IDE driver. It needs to be a thread because |
620 | * ide_register can't be called from interrupt context. | 620 | * ide_register can't be called from interrupt context. |
621 | */ | 621 | */ |
622 | static int __pmac media_bay_task(void *x) | 622 | static int media_bay_task(void *x) |
623 | { | 623 | { |
624 | int i; | 624 | int i; |
625 | 625 | ||
@@ -704,7 +704,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de | |||
704 | 704 | ||
705 | } | 705 | } |
706 | 706 | ||
707 | static int __pmac media_bay_suspend(struct macio_dev *mdev, pm_message_t state) | 707 | static int media_bay_suspend(struct macio_dev *mdev, pm_message_t state) |
708 | { | 708 | { |
709 | struct media_bay_info *bay = macio_get_drvdata(mdev); | 709 | struct media_bay_info *bay = macio_get_drvdata(mdev); |
710 | 710 | ||
@@ -719,7 +719,7 @@ static int __pmac media_bay_suspend(struct macio_dev *mdev, pm_message_t state) | |||
719 | return 0; | 719 | return 0; |
720 | } | 720 | } |
721 | 721 | ||
722 | static int __pmac media_bay_resume(struct macio_dev *mdev) | 722 | static int media_bay_resume(struct macio_dev *mdev) |
723 | { | 723 | { |
724 | struct media_bay_info *bay = macio_get_drvdata(mdev); | 724 | struct media_bay_info *bay = macio_get_drvdata(mdev); |
725 | 725 | ||
@@ -760,7 +760,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev) | |||
760 | 760 | ||
761 | /* Definitions of "ops" structures. | 761 | /* Definitions of "ops" structures. |
762 | */ | 762 | */ |
763 | static struct mb_ops ohare_mb_ops __pmacdata = { | 763 | static struct mb_ops ohare_mb_ops = { |
764 | .name = "Ohare", | 764 | .name = "Ohare", |
765 | .content = ohare_mb_content, | 765 | .content = ohare_mb_content, |
766 | .power = ohare_mb_power, | 766 | .power = ohare_mb_power, |
@@ -769,7 +769,7 @@ static struct mb_ops ohare_mb_ops __pmacdata = { | |||
769 | .un_reset_ide = ohare_mb_un_reset_ide, | 769 | .un_reset_ide = ohare_mb_un_reset_ide, |
770 | }; | 770 | }; |
771 | 771 | ||
772 | static struct mb_ops heathrow_mb_ops __pmacdata = { | 772 | static struct mb_ops heathrow_mb_ops = { |
773 | .name = "Heathrow", | 773 | .name = "Heathrow", |
774 | .content = heathrow_mb_content, | 774 | .content = heathrow_mb_content, |
775 | .power = heathrow_mb_power, | 775 | .power = heathrow_mb_power, |
@@ -778,7 +778,7 @@ static struct mb_ops heathrow_mb_ops __pmacdata = { | |||
778 | .un_reset_ide = heathrow_mb_un_reset_ide, | 778 | .un_reset_ide = heathrow_mb_un_reset_ide, |
779 | }; | 779 | }; |
780 | 780 | ||
781 | static struct mb_ops keylargo_mb_ops __pmacdata = { | 781 | static struct mb_ops keylargo_mb_ops = { |
782 | .name = "KeyLargo", | 782 | .name = "KeyLargo", |
783 | .init = keylargo_mb_init, | 783 | .init = keylargo_mb_init, |
784 | .content = keylargo_mb_content, | 784 | .content = keylargo_mb_content, |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 9b38674fbf75..34f3c7e2d832 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -1094,7 +1094,7 @@ static int smu_release(struct inode *inode, struct file *file) | |||
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | 1096 | ||
1097 | static struct file_operations smu_device_fops __pmacdata = { | 1097 | static struct file_operations smu_device_fops = { |
1098 | .llseek = no_llseek, | 1098 | .llseek = no_llseek, |
1099 | .read = smu_read, | 1099 | .read = smu_read, |
1100 | .write = smu_write, | 1100 | .write = smu_write, |
@@ -1103,7 +1103,7 @@ static struct file_operations smu_device_fops __pmacdata = { | |||
1103 | .release = smu_release, | 1103 | .release = smu_release, |
1104 | }; | 1104 | }; |
1105 | 1105 | ||
1106 | static struct miscdevice pmu_device __pmacdata = { | 1106 | static struct miscdevice pmu_device = { |
1107 | MISC_DYNAMIC_MINOR, "smu", &smu_device_fops | 1107 | MISC_DYNAMIC_MINOR, "smu", &smu_device_fops |
1108 | }; | 1108 | }; |
1109 | 1109 | ||
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index 417deb5de108..d843a6c9c6df 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c | |||
@@ -37,7 +37,6 @@ static DEFINE_SPINLOCK(cuda_lock); | |||
37 | 37 | ||
38 | #ifdef CONFIG_MAC | 38 | #ifdef CONFIG_MAC |
39 | #define CUDA_IRQ IRQ_MAC_ADB | 39 | #define CUDA_IRQ IRQ_MAC_ADB |
40 | #define __openfirmware | ||
41 | #define eieio() | 40 | #define eieio() |
42 | #else | 41 | #else |
43 | #define CUDA_IRQ vias->intrs[0].line | 42 | #define CUDA_IRQ vias->intrs[0].line |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 645a2e5c70ab..91920a1140fa 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -244,7 +244,7 @@ int pmu_wink(struct adb_request *req); | |||
244 | * - the number of response bytes which the PMU will return, or | 244 | * - the number of response bytes which the PMU will return, or |
245 | * -1 if it will send a length byte. | 245 | * -1 if it will send a length byte. |
246 | */ | 246 | */ |
247 | static const s8 pmu_data_len[256][2] __openfirmwaredata = { | 247 | static const s8 pmu_data_len[256][2] = { |
248 | /* 0 1 2 3 4 5 6 7 */ | 248 | /* 0 1 2 3 4 5 6 7 */ |
249 | /*00*/ {-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0}, | 249 | /*00*/ {-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0},{-1, 0}, |
250 | /*08*/ {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1}, | 250 | /*08*/ {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1}, |
@@ -295,7 +295,7 @@ static struct backlight_controller pmu_backlight_controller = { | |||
295 | }; | 295 | }; |
296 | #endif /* CONFIG_PMAC_BACKLIGHT */ | 296 | #endif /* CONFIG_PMAC_BACKLIGHT */ |
297 | 297 | ||
298 | int __openfirmware | 298 | int |
299 | find_via_pmu(void) | 299 | find_via_pmu(void) |
300 | { | 300 | { |
301 | if (via != 0) | 301 | if (via != 0) |
@@ -374,7 +374,7 @@ find_via_pmu(void) | |||
374 | } | 374 | } |
375 | 375 | ||
376 | #ifdef CONFIG_ADB | 376 | #ifdef CONFIG_ADB |
377 | static int __openfirmware | 377 | static int |
378 | pmu_probe(void) | 378 | pmu_probe(void) |
379 | { | 379 | { |
380 | return vias == NULL? -ENODEV: 0; | 380 | return vias == NULL? -ENODEV: 0; |
@@ -405,7 +405,7 @@ static int __init via_pmu_start(void) | |||
405 | bright_req_2.complete = 1; | 405 | bright_req_2.complete = 1; |
406 | batt_req.complete = 1; | 406 | batt_req.complete = 1; |
407 | 407 | ||
408 | #ifdef CONFIG_PPC32 | 408 | #if defined(CONFIG_PPC32) && !defined(CONFIG_PPC_MERGE) |
409 | if (pmu_kind == PMU_KEYLARGO_BASED) | 409 | if (pmu_kind == PMU_KEYLARGO_BASED) |
410 | openpic_set_irq_priority(vias->intrs[0].line, | 410 | openpic_set_irq_priority(vias->intrs[0].line, |
411 | OPENPIC_PRIORITY_DEFAULT + 1); | 411 | OPENPIC_PRIORITY_DEFAULT + 1); |
@@ -520,7 +520,7 @@ static int __init via_pmu_dev_init(void) | |||
520 | 520 | ||
521 | device_initcall(via_pmu_dev_init); | 521 | device_initcall(via_pmu_dev_init); |
522 | 522 | ||
523 | static int __openfirmware | 523 | static int |
524 | init_pmu(void) | 524 | init_pmu(void) |
525 | { | 525 | { |
526 | int timeout; | 526 | int timeout; |
@@ -588,17 +588,6 @@ pmu_get_model(void) | |||
588 | return pmu_kind; | 588 | return pmu_kind; |
589 | } | 589 | } |
590 | 590 | ||
591 | #ifndef CONFIG_PPC64 | ||
592 | static inline void wakeup_decrementer(void) | ||
593 | { | ||
594 | set_dec(tb_ticks_per_jiffy); | ||
595 | /* No currently-supported powerbook has a 601, | ||
596 | * so use get_tbl, not native | ||
597 | */ | ||
598 | last_jiffy_stamp(0) = tb_last_stamp = get_tbl(); | ||
599 | } | ||
600 | #endif | ||
601 | |||
602 | static void pmu_set_server_mode(int server_mode) | 591 | static void pmu_set_server_mode(int server_mode) |
603 | { | 592 | { |
604 | struct adb_request req; | 593 | struct adb_request req; |
@@ -625,7 +614,7 @@ static void pmu_set_server_mode(int server_mode) | |||
625 | /* This new version of the code for 2400/3400/3500 powerbooks | 614 | /* This new version of the code for 2400/3400/3500 powerbooks |
626 | * is inspired from the implementation in gkrellm-pmu | 615 | * is inspired from the implementation in gkrellm-pmu |
627 | */ | 616 | */ |
628 | static void __pmac | 617 | static void |
629 | done_battery_state_ohare(struct adb_request* req) | 618 | done_battery_state_ohare(struct adb_request* req) |
630 | { | 619 | { |
631 | /* format: | 620 | /* format: |
@@ -713,7 +702,7 @@ done_battery_state_ohare(struct adb_request* req) | |||
713 | clear_bit(0, &async_req_locks); | 702 | clear_bit(0, &async_req_locks); |
714 | } | 703 | } |
715 | 704 | ||
716 | static void __pmac | 705 | static void |
717 | done_battery_state_smart(struct adb_request* req) | 706 | done_battery_state_smart(struct adb_request* req) |
718 | { | 707 | { |
719 | /* format: | 708 | /* format: |
@@ -791,7 +780,7 @@ done_battery_state_smart(struct adb_request* req) | |||
791 | clear_bit(0, &async_req_locks); | 780 | clear_bit(0, &async_req_locks); |
792 | } | 781 | } |
793 | 782 | ||
794 | static void __pmac | 783 | static void |
795 | query_battery_state(void) | 784 | query_battery_state(void) |
796 | { | 785 | { |
797 | if (test_and_set_bit(0, &async_req_locks)) | 786 | if (test_and_set_bit(0, &async_req_locks)) |
@@ -804,7 +793,7 @@ query_battery_state(void) | |||
804 | 2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1); | 793 | 2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1); |
805 | } | 794 | } |
806 | 795 | ||
807 | static int __pmac | 796 | static int |
808 | proc_get_info(char *page, char **start, off_t off, | 797 | proc_get_info(char *page, char **start, off_t off, |
809 | int count, int *eof, void *data) | 798 | int count, int *eof, void *data) |
810 | { | 799 | { |
@@ -819,7 +808,7 @@ proc_get_info(char *page, char **start, off_t off, | |||
819 | return p - page; | 808 | return p - page; |
820 | } | 809 | } |
821 | 810 | ||
822 | static int __pmac | 811 | static int |
823 | proc_get_irqstats(char *page, char **start, off_t off, | 812 | proc_get_irqstats(char *page, char **start, off_t off, |
824 | int count, int *eof, void *data) | 813 | int count, int *eof, void *data) |
825 | { | 814 | { |
@@ -846,7 +835,7 @@ proc_get_irqstats(char *page, char **start, off_t off, | |||
846 | return p - page; | 835 | return p - page; |
847 | } | 836 | } |
848 | 837 | ||
849 | static int __pmac | 838 | static int |
850 | proc_get_batt(char *page, char **start, off_t off, | 839 | proc_get_batt(char *page, char **start, off_t off, |
851 | int count, int *eof, void *data) | 840 | int count, int *eof, void *data) |
852 | { | 841 | { |
@@ -870,7 +859,7 @@ proc_get_batt(char *page, char **start, off_t off, | |||
870 | return p - page; | 859 | return p - page; |
871 | } | 860 | } |
872 | 861 | ||
873 | static int __pmac | 862 | static int |
874 | proc_read_options(char *page, char **start, off_t off, | 863 | proc_read_options(char *page, char **start, off_t off, |
875 | int count, int *eof, void *data) | 864 | int count, int *eof, void *data) |
876 | { | 865 | { |
@@ -887,7 +876,7 @@ proc_read_options(char *page, char **start, off_t off, | |||
887 | return p - page; | 876 | return p - page; |
888 | } | 877 | } |
889 | 878 | ||
890 | static int __pmac | 879 | static int |
891 | proc_write_options(struct file *file, const char __user *buffer, | 880 | proc_write_options(struct file *file, const char __user *buffer, |
892 | unsigned long count, void *data) | 881 | unsigned long count, void *data) |
893 | { | 882 | { |
@@ -934,7 +923,7 @@ proc_write_options(struct file *file, const char __user *buffer, | |||
934 | 923 | ||
935 | #ifdef CONFIG_ADB | 924 | #ifdef CONFIG_ADB |
936 | /* Send an ADB command */ | 925 | /* Send an ADB command */ |
937 | static int __pmac | 926 | static int |
938 | pmu_send_request(struct adb_request *req, int sync) | 927 | pmu_send_request(struct adb_request *req, int sync) |
939 | { | 928 | { |
940 | int i, ret; | 929 | int i, ret; |
@@ -1014,7 +1003,7 @@ pmu_send_request(struct adb_request *req, int sync) | |||
1014 | } | 1003 | } |
1015 | 1004 | ||
1016 | /* Enable/disable autopolling */ | 1005 | /* Enable/disable autopolling */ |
1017 | static int __pmac | 1006 | static int |
1018 | pmu_adb_autopoll(int devs) | 1007 | pmu_adb_autopoll(int devs) |
1019 | { | 1008 | { |
1020 | struct adb_request req; | 1009 | struct adb_request req; |
@@ -1037,7 +1026,7 @@ pmu_adb_autopoll(int devs) | |||
1037 | } | 1026 | } |
1038 | 1027 | ||
1039 | /* Reset the ADB bus */ | 1028 | /* Reset the ADB bus */ |
1040 | static int __pmac | 1029 | static int |
1041 | pmu_adb_reset_bus(void) | 1030 | pmu_adb_reset_bus(void) |
1042 | { | 1031 | { |
1043 | struct adb_request req; | 1032 | struct adb_request req; |
@@ -1072,7 +1061,7 @@ pmu_adb_reset_bus(void) | |||
1072 | #endif /* CONFIG_ADB */ | 1061 | #endif /* CONFIG_ADB */ |
1073 | 1062 | ||
1074 | /* Construct and send a pmu request */ | 1063 | /* Construct and send a pmu request */ |
1075 | int __openfirmware | 1064 | int |
1076 | pmu_request(struct adb_request *req, void (*done)(struct adb_request *), | 1065 | pmu_request(struct adb_request *req, void (*done)(struct adb_request *), |
1077 | int nbytes, ...) | 1066 | int nbytes, ...) |
1078 | { | 1067 | { |
@@ -1098,7 +1087,7 @@ pmu_request(struct adb_request *req, void (*done)(struct adb_request *), | |||
1098 | return pmu_queue_request(req); | 1087 | return pmu_queue_request(req); |
1099 | } | 1088 | } |
1100 | 1089 | ||
1101 | int __pmac | 1090 | int |
1102 | pmu_queue_request(struct adb_request *req) | 1091 | pmu_queue_request(struct adb_request *req) |
1103 | { | 1092 | { |
1104 | unsigned long flags; | 1093 | unsigned long flags; |
@@ -1190,7 +1179,7 @@ pmu_done(struct adb_request *req) | |||
1190 | (*done)(req); | 1179 | (*done)(req); |
1191 | } | 1180 | } |
1192 | 1181 | ||
1193 | static void __pmac | 1182 | static void |
1194 | pmu_start(void) | 1183 | pmu_start(void) |
1195 | { | 1184 | { |
1196 | struct adb_request *req; | 1185 | struct adb_request *req; |
@@ -1214,7 +1203,7 @@ pmu_start(void) | |||
1214 | send_byte(req->data[0]); | 1203 | send_byte(req->data[0]); |
1215 | } | 1204 | } |
1216 | 1205 | ||
1217 | void __openfirmware | 1206 | void |
1218 | pmu_poll(void) | 1207 | pmu_poll(void) |
1219 | { | 1208 | { |
1220 | if (!via) | 1209 | if (!via) |
@@ -1224,7 +1213,7 @@ pmu_poll(void) | |||
1224 | via_pmu_interrupt(0, NULL, NULL); | 1213 | via_pmu_interrupt(0, NULL, NULL); |
1225 | } | 1214 | } |
1226 | 1215 | ||
1227 | void __openfirmware | 1216 | void |
1228 | pmu_poll_adb(void) | 1217 | pmu_poll_adb(void) |
1229 | { | 1218 | { |
1230 | if (!via) | 1219 | if (!via) |
@@ -1239,7 +1228,7 @@ pmu_poll_adb(void) | |||
1239 | || req_awaiting_reply)); | 1228 | || req_awaiting_reply)); |
1240 | } | 1229 | } |
1241 | 1230 | ||
1242 | void __openfirmware | 1231 | void |
1243 | pmu_wait_complete(struct adb_request *req) | 1232 | pmu_wait_complete(struct adb_request *req) |
1244 | { | 1233 | { |
1245 | if (!via) | 1234 | if (!via) |
@@ -1253,7 +1242,7 @@ pmu_wait_complete(struct adb_request *req) | |||
1253 | * This is done to avoid spurrious shutdowns when we know we'll have | 1242 | * This is done to avoid spurrious shutdowns when we know we'll have |
1254 | * interrupts switched off for a long time | 1243 | * interrupts switched off for a long time |
1255 | */ | 1244 | */ |
1256 | void __openfirmware | 1245 | void |
1257 | pmu_suspend(void) | 1246 | pmu_suspend(void) |
1258 | { | 1247 | { |
1259 | unsigned long flags; | 1248 | unsigned long flags; |
@@ -1293,7 +1282,7 @@ pmu_suspend(void) | |||
1293 | } while (1); | 1282 | } while (1); |
1294 | } | 1283 | } |
1295 | 1284 | ||
1296 | void __openfirmware | 1285 | void |
1297 | pmu_resume(void) | 1286 | pmu_resume(void) |
1298 | { | 1287 | { |
1299 | unsigned long flags; | 1288 | unsigned long flags; |
@@ -1323,7 +1312,7 @@ pmu_resume(void) | |||
1323 | } | 1312 | } |
1324 | 1313 | ||
1325 | /* Interrupt data could be the result data from an ADB cmd */ | 1314 | /* Interrupt data could be the result data from an ADB cmd */ |
1326 | static void __pmac | 1315 | static void |
1327 | pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs) | 1316 | pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs) |
1328 | { | 1317 | { |
1329 | unsigned char ints, pirq; | 1318 | unsigned char ints, pirq; |
@@ -1435,7 +1424,7 @@ next: | |||
1435 | goto next; | 1424 | goto next; |
1436 | } | 1425 | } |
1437 | 1426 | ||
1438 | static struct adb_request* __pmac | 1427 | static struct adb_request* |
1439 | pmu_sr_intr(struct pt_regs *regs) | 1428 | pmu_sr_intr(struct pt_regs *regs) |
1440 | { | 1429 | { |
1441 | struct adb_request *req; | 1430 | struct adb_request *req; |
@@ -1541,7 +1530,7 @@ pmu_sr_intr(struct pt_regs *regs) | |||
1541 | return NULL; | 1530 | return NULL; |
1542 | } | 1531 | } |
1543 | 1532 | ||
1544 | static irqreturn_t __pmac | 1533 | static irqreturn_t |
1545 | via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs) | 1534 | via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs) |
1546 | { | 1535 | { |
1547 | unsigned long flags; | 1536 | unsigned long flags; |
@@ -1629,7 +1618,7 @@ no_free_slot: | |||
1629 | return IRQ_RETVAL(handled); | 1618 | return IRQ_RETVAL(handled); |
1630 | } | 1619 | } |
1631 | 1620 | ||
1632 | void __pmac | 1621 | void |
1633 | pmu_unlock(void) | 1622 | pmu_unlock(void) |
1634 | { | 1623 | { |
1635 | unsigned long flags; | 1624 | unsigned long flags; |
@@ -1642,7 +1631,7 @@ pmu_unlock(void) | |||
1642 | } | 1631 | } |
1643 | 1632 | ||
1644 | 1633 | ||
1645 | static irqreturn_t __pmac | 1634 | static irqreturn_t |
1646 | gpio1_interrupt(int irq, void *arg, struct pt_regs *regs) | 1635 | gpio1_interrupt(int irq, void *arg, struct pt_regs *regs) |
1647 | { | 1636 | { |
1648 | unsigned long flags; | 1637 | unsigned long flags; |
@@ -1663,12 +1652,12 @@ gpio1_interrupt(int irq, void *arg, struct pt_regs *regs) | |||
1663 | } | 1652 | } |
1664 | 1653 | ||
1665 | #ifdef CONFIG_PMAC_BACKLIGHT | 1654 | #ifdef CONFIG_PMAC_BACKLIGHT |
1666 | static int backlight_to_bright[] __pmacdata = { | 1655 | static int backlight_to_bright[] = { |
1667 | 0x7f, 0x46, 0x42, 0x3e, 0x3a, 0x36, 0x32, 0x2e, | 1656 | 0x7f, 0x46, 0x42, 0x3e, 0x3a, 0x36, 0x32, 0x2e, |
1668 | 0x2a, 0x26, 0x22, 0x1e, 0x1a, 0x16, 0x12, 0x0e | 1657 | 0x2a, 0x26, 0x22, 0x1e, 0x1a, 0x16, 0x12, 0x0e |
1669 | }; | 1658 | }; |
1670 | 1659 | ||
1671 | static int __openfirmware | 1660 | static int |
1672 | pmu_set_backlight_enable(int on, int level, void* data) | 1661 | pmu_set_backlight_enable(int on, int level, void* data) |
1673 | { | 1662 | { |
1674 | struct adb_request req; | 1663 | struct adb_request req; |
@@ -1688,7 +1677,7 @@ pmu_set_backlight_enable(int on, int level, void* data) | |||
1688 | return 0; | 1677 | return 0; |
1689 | } | 1678 | } |
1690 | 1679 | ||
1691 | static void __openfirmware | 1680 | static void |
1692 | pmu_bright_complete(struct adb_request *req) | 1681 | pmu_bright_complete(struct adb_request *req) |
1693 | { | 1682 | { |
1694 | if (req == &bright_req_1) | 1683 | if (req == &bright_req_1) |
@@ -1697,7 +1686,7 @@ pmu_bright_complete(struct adb_request *req) | |||
1697 | clear_bit(2, &async_req_locks); | 1686 | clear_bit(2, &async_req_locks); |
1698 | } | 1687 | } |
1699 | 1688 | ||
1700 | static int __openfirmware | 1689 | static int |
1701 | pmu_set_backlight_level(int level, void* data) | 1690 | pmu_set_backlight_level(int level, void* data) |
1702 | { | 1691 | { |
1703 | if (vias == NULL) | 1692 | if (vias == NULL) |
@@ -1717,7 +1706,7 @@ pmu_set_backlight_level(int level, void* data) | |||
1717 | } | 1706 | } |
1718 | #endif /* CONFIG_PMAC_BACKLIGHT */ | 1707 | #endif /* CONFIG_PMAC_BACKLIGHT */ |
1719 | 1708 | ||
1720 | void __pmac | 1709 | void |
1721 | pmu_enable_irled(int on) | 1710 | pmu_enable_irled(int on) |
1722 | { | 1711 | { |
1723 | struct adb_request req; | 1712 | struct adb_request req; |
@@ -1732,7 +1721,7 @@ pmu_enable_irled(int on) | |||
1732 | pmu_wait_complete(&req); | 1721 | pmu_wait_complete(&req); |
1733 | } | 1722 | } |
1734 | 1723 | ||
1735 | void __pmac | 1724 | void |
1736 | pmu_restart(void) | 1725 | pmu_restart(void) |
1737 | { | 1726 | { |
1738 | struct adb_request req; | 1727 | struct adb_request req; |
@@ -1757,7 +1746,7 @@ pmu_restart(void) | |||
1757 | ; | 1746 | ; |
1758 | } | 1747 | } |
1759 | 1748 | ||
1760 | void __pmac | 1749 | void |
1761 | pmu_shutdown(void) | 1750 | pmu_shutdown(void) |
1762 | { | 1751 | { |
1763 | struct adb_request req; | 1752 | struct adb_request req; |
@@ -2076,7 +2065,7 @@ pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n) | |||
2076 | } | 2065 | } |
2077 | 2066 | ||
2078 | /* Sleep is broadcast last-to-first */ | 2067 | /* Sleep is broadcast last-to-first */ |
2079 | static int __pmac | 2068 | static int |
2080 | broadcast_sleep(int when, int fallback) | 2069 | broadcast_sleep(int when, int fallback) |
2081 | { | 2070 | { |
2082 | int ret = PBOOK_SLEEP_OK; | 2071 | int ret = PBOOK_SLEEP_OK; |
@@ -2101,7 +2090,7 @@ broadcast_sleep(int when, int fallback) | |||
2101 | } | 2090 | } |
2102 | 2091 | ||
2103 | /* Wake is broadcast first-to-last */ | 2092 | /* Wake is broadcast first-to-last */ |
2104 | static int __pmac | 2093 | static int |
2105 | broadcast_wake(void) | 2094 | broadcast_wake(void) |
2106 | { | 2095 | { |
2107 | int ret = PBOOK_SLEEP_OK; | 2096 | int ret = PBOOK_SLEEP_OK; |
@@ -2132,7 +2121,7 @@ static struct pci_save { | |||
2132 | } *pbook_pci_saves; | 2121 | } *pbook_pci_saves; |
2133 | static int pbook_npci_saves; | 2122 | static int pbook_npci_saves; |
2134 | 2123 | ||
2135 | static void __pmac | 2124 | static void |
2136 | pbook_alloc_pci_save(void) | 2125 | pbook_alloc_pci_save(void) |
2137 | { | 2126 | { |
2138 | int npci; | 2127 | int npci; |
@@ -2149,7 +2138,7 @@ pbook_alloc_pci_save(void) | |||
2149 | pbook_npci_saves = npci; | 2138 | pbook_npci_saves = npci; |
2150 | } | 2139 | } |
2151 | 2140 | ||
2152 | static void __pmac | 2141 | static void |
2153 | pbook_free_pci_save(void) | 2142 | pbook_free_pci_save(void) |
2154 | { | 2143 | { |
2155 | if (pbook_pci_saves == NULL) | 2144 | if (pbook_pci_saves == NULL) |
@@ -2159,7 +2148,7 @@ pbook_free_pci_save(void) | |||
2159 | pbook_npci_saves = 0; | 2148 | pbook_npci_saves = 0; |
2160 | } | 2149 | } |
2161 | 2150 | ||
2162 | static void __pmac | 2151 | static void |
2163 | pbook_pci_save(void) | 2152 | pbook_pci_save(void) |
2164 | { | 2153 | { |
2165 | struct pci_save *ps = pbook_pci_saves; | 2154 | struct pci_save *ps = pbook_pci_saves; |
@@ -2190,7 +2179,7 @@ pbook_pci_save(void) | |||
2190 | * during boot, it will be in the pci dev list. If it's disabled at this point | 2179 | * during boot, it will be in the pci dev list. If it's disabled at this point |
2191 | * (and it will probably be), then you can't access it's config space. | 2180 | * (and it will probably be), then you can't access it's config space. |
2192 | */ | 2181 | */ |
2193 | static void __pmac | 2182 | static void |
2194 | pbook_pci_restore(void) | 2183 | pbook_pci_restore(void) |
2195 | { | 2184 | { |
2196 | u16 cmd; | 2185 | u16 cmd; |
@@ -2238,7 +2227,7 @@ pbook_pci_restore(void) | |||
2238 | 2227 | ||
2239 | #ifdef DEBUG_SLEEP | 2228 | #ifdef DEBUG_SLEEP |
2240 | /* N.B. This doesn't work on the 3400 */ | 2229 | /* N.B. This doesn't work on the 3400 */ |
2241 | void __pmac | 2230 | void |
2242 | pmu_blink(int n) | 2231 | pmu_blink(int n) |
2243 | { | 2232 | { |
2244 | struct adb_request req; | 2233 | struct adb_request req; |
@@ -2277,9 +2266,9 @@ pmu_blink(int n) | |||
2277 | * Put the powerbook to sleep. | 2266 | * Put the powerbook to sleep. |
2278 | */ | 2267 | */ |
2279 | 2268 | ||
2280 | static u32 save_via[8] __pmacdata; | 2269 | static u32 save_via[8]; |
2281 | 2270 | ||
2282 | static void __pmac | 2271 | static void |
2283 | save_via_state(void) | 2272 | save_via_state(void) |
2284 | { | 2273 | { |
2285 | save_via[0] = in_8(&via[ANH]); | 2274 | save_via[0] = in_8(&via[ANH]); |
@@ -2291,7 +2280,7 @@ save_via_state(void) | |||
2291 | save_via[6] = in_8(&via[T1CL]); | 2280 | save_via[6] = in_8(&via[T1CL]); |
2292 | save_via[7] = in_8(&via[T1CH]); | 2281 | save_via[7] = in_8(&via[T1CH]); |
2293 | } | 2282 | } |
2294 | static void __pmac | 2283 | static void |
2295 | restore_via_state(void) | 2284 | restore_via_state(void) |
2296 | { | 2285 | { |
2297 | out_8(&via[ANH], save_via[0]); | 2286 | out_8(&via[ANH], save_via[0]); |
@@ -2307,7 +2296,7 @@ restore_via_state(void) | |||
2307 | out_8(&via[IER], IER_SET | SR_INT | CB1_INT); | 2296 | out_8(&via[IER], IER_SET | SR_INT | CB1_INT); |
2308 | } | 2297 | } |
2309 | 2298 | ||
2310 | static int __pmac | 2299 | static int |
2311 | pmac_suspend_devices(void) | 2300 | pmac_suspend_devices(void) |
2312 | { | 2301 | { |
2313 | int ret; | 2302 | int ret; |
@@ -2397,7 +2386,7 @@ pmac_suspend_devices(void) | |||
2397 | return 0; | 2386 | return 0; |
2398 | } | 2387 | } |
2399 | 2388 | ||
2400 | static int __pmac | 2389 | static int |
2401 | pmac_wakeup_devices(void) | 2390 | pmac_wakeup_devices(void) |
2402 | { | 2391 | { |
2403 | mdelay(100); | 2392 | mdelay(100); |
@@ -2436,7 +2425,7 @@ pmac_wakeup_devices(void) | |||
2436 | #define GRACKLE_NAP (1<<4) | 2425 | #define GRACKLE_NAP (1<<4) |
2437 | #define GRACKLE_SLEEP (1<<3) | 2426 | #define GRACKLE_SLEEP (1<<3) |
2438 | 2427 | ||
2439 | int __pmac | 2428 | int |
2440 | powerbook_sleep_grackle(void) | 2429 | powerbook_sleep_grackle(void) |
2441 | { | 2430 | { |
2442 | unsigned long save_l2cr; | 2431 | unsigned long save_l2cr; |
@@ -2520,7 +2509,7 @@ powerbook_sleep_grackle(void) | |||
2520 | return 0; | 2509 | return 0; |
2521 | } | 2510 | } |
2522 | 2511 | ||
2523 | static int __pmac | 2512 | static int |
2524 | powerbook_sleep_Core99(void) | 2513 | powerbook_sleep_Core99(void) |
2525 | { | 2514 | { |
2526 | unsigned long save_l2cr; | 2515 | unsigned long save_l2cr; |
@@ -2620,7 +2609,7 @@ powerbook_sleep_Core99(void) | |||
2620 | #define PB3400_MEM_CTRL 0xf8000000 | 2609 | #define PB3400_MEM_CTRL 0xf8000000 |
2621 | #define PB3400_MEM_CTRL_SLEEP 0x70 | 2610 | #define PB3400_MEM_CTRL_SLEEP 0x70 |
2622 | 2611 | ||
2623 | static int __pmac | 2612 | static int |
2624 | powerbook_sleep_3400(void) | 2613 | powerbook_sleep_3400(void) |
2625 | { | 2614 | { |
2626 | int ret, i, x; | 2615 | int ret, i, x; |
@@ -2720,9 +2709,9 @@ struct pmu_private { | |||
2720 | }; | 2709 | }; |
2721 | 2710 | ||
2722 | static LIST_HEAD(all_pmu_pvt); | 2711 | static LIST_HEAD(all_pmu_pvt); |
2723 | static DEFINE_SPINLOCK(all_pvt_lock __pmacdata); | 2712 | static DEFINE_SPINLOCK(all_pvt_lock); |
2724 | 2713 | ||
2725 | static void __pmac | 2714 | static void |
2726 | pmu_pass_intr(unsigned char *data, int len) | 2715 | pmu_pass_intr(unsigned char *data, int len) |
2727 | { | 2716 | { |
2728 | struct pmu_private *pp; | 2717 | struct pmu_private *pp; |
@@ -2751,7 +2740,7 @@ pmu_pass_intr(unsigned char *data, int len) | |||
2751 | spin_unlock_irqrestore(&all_pvt_lock, flags); | 2740 | spin_unlock_irqrestore(&all_pvt_lock, flags); |
2752 | } | 2741 | } |
2753 | 2742 | ||
2754 | static int __pmac | 2743 | static int |
2755 | pmu_open(struct inode *inode, struct file *file) | 2744 | pmu_open(struct inode *inode, struct file *file) |
2756 | { | 2745 | { |
2757 | struct pmu_private *pp; | 2746 | struct pmu_private *pp; |
@@ -2773,7 +2762,7 @@ pmu_open(struct inode *inode, struct file *file) | |||
2773 | return 0; | 2762 | return 0; |
2774 | } | 2763 | } |
2775 | 2764 | ||
2776 | static ssize_t __pmac | 2765 | static ssize_t |
2777 | pmu_read(struct file *file, char __user *buf, | 2766 | pmu_read(struct file *file, char __user *buf, |
2778 | size_t count, loff_t *ppos) | 2767 | size_t count, loff_t *ppos) |
2779 | { | 2768 | { |
@@ -2825,14 +2814,14 @@ pmu_read(struct file *file, char __user *buf, | |||
2825 | return ret; | 2814 | return ret; |
2826 | } | 2815 | } |
2827 | 2816 | ||
2828 | static ssize_t __pmac | 2817 | static ssize_t |
2829 | pmu_write(struct file *file, const char __user *buf, | 2818 | pmu_write(struct file *file, const char __user *buf, |
2830 | size_t count, loff_t *ppos) | 2819 | size_t count, loff_t *ppos) |
2831 | { | 2820 | { |
2832 | return 0; | 2821 | return 0; |
2833 | } | 2822 | } |
2834 | 2823 | ||
2835 | static unsigned int __pmac | 2824 | static unsigned int |
2836 | pmu_fpoll(struct file *filp, poll_table *wait) | 2825 | pmu_fpoll(struct file *filp, poll_table *wait) |
2837 | { | 2826 | { |
2838 | struct pmu_private *pp = filp->private_data; | 2827 | struct pmu_private *pp = filp->private_data; |
@@ -2849,7 +2838,7 @@ pmu_fpoll(struct file *filp, poll_table *wait) | |||
2849 | return mask; | 2838 | return mask; |
2850 | } | 2839 | } |
2851 | 2840 | ||
2852 | static int __pmac | 2841 | static int |
2853 | pmu_release(struct inode *inode, struct file *file) | 2842 | pmu_release(struct inode *inode, struct file *file) |
2854 | { | 2843 | { |
2855 | struct pmu_private *pp = file->private_data; | 2844 | struct pmu_private *pp = file->private_data; |
@@ -2874,8 +2863,7 @@ pmu_release(struct inode *inode, struct file *file) | |||
2874 | return 0; | 2863 | return 0; |
2875 | } | 2864 | } |
2876 | 2865 | ||
2877 | /* Note: removed __openfirmware here since it causes link errors */ | 2866 | static int |
2878 | static int __pmac | ||
2879 | pmu_ioctl(struct inode * inode, struct file *filp, | 2867 | pmu_ioctl(struct inode * inode, struct file *filp, |
2880 | u_int cmd, u_long arg) | 2868 | u_int cmd, u_long arg) |
2881 | { | 2869 | { |
@@ -2957,7 +2945,7 @@ pmu_ioctl(struct inode * inode, struct file *filp, | |||
2957 | return error; | 2945 | return error; |
2958 | } | 2946 | } |
2959 | 2947 | ||
2960 | static struct file_operations pmu_device_fops __pmacdata = { | 2948 | static struct file_operations pmu_device_fops = { |
2961 | .read = pmu_read, | 2949 | .read = pmu_read, |
2962 | .write = pmu_write, | 2950 | .write = pmu_write, |
2963 | .poll = pmu_fpoll, | 2951 | .poll = pmu_fpoll, |
@@ -2966,7 +2954,7 @@ static struct file_operations pmu_device_fops __pmacdata = { | |||
2966 | .release = pmu_release, | 2954 | .release = pmu_release, |
2967 | }; | 2955 | }; |
2968 | 2956 | ||
2969 | static struct miscdevice pmu_device __pmacdata = { | 2957 | static struct miscdevice pmu_device = { |
2970 | PMU_MINOR, "pmu", &pmu_device_fops | 2958 | PMU_MINOR, "pmu", &pmu_device_fops |
2971 | }; | 2959 | }; |
2972 | 2960 | ||
@@ -2982,7 +2970,7 @@ device_initcall(pmu_device_init); | |||
2982 | 2970 | ||
2983 | 2971 | ||
2984 | #ifdef DEBUG_SLEEP | 2972 | #ifdef DEBUG_SLEEP |
2985 | static inline void __pmac | 2973 | static inline void |
2986 | polled_handshake(volatile unsigned char __iomem *via) | 2974 | polled_handshake(volatile unsigned char __iomem *via) |
2987 | { | 2975 | { |
2988 | via[B] &= ~TREQ; eieio(); | 2976 | via[B] &= ~TREQ; eieio(); |
@@ -2993,7 +2981,7 @@ polled_handshake(volatile unsigned char __iomem *via) | |||
2993 | ; | 2981 | ; |
2994 | } | 2982 | } |
2995 | 2983 | ||
2996 | static inline void __pmac | 2984 | static inline void |
2997 | polled_send_byte(volatile unsigned char __iomem *via, int x) | 2985 | polled_send_byte(volatile unsigned char __iomem *via, int x) |
2998 | { | 2986 | { |
2999 | via[ACR] |= SR_OUT | SR_EXT; eieio(); | 2987 | via[ACR] |= SR_OUT | SR_EXT; eieio(); |
@@ -3001,7 +2989,7 @@ polled_send_byte(volatile unsigned char __iomem *via, int x) | |||
3001 | polled_handshake(via); | 2989 | polled_handshake(via); |
3002 | } | 2990 | } |
3003 | 2991 | ||
3004 | static inline int __pmac | 2992 | static inline int |
3005 | polled_recv_byte(volatile unsigned char __iomem *via) | 2993 | polled_recv_byte(volatile unsigned char __iomem *via) |
3006 | { | 2994 | { |
3007 | int x; | 2995 | int x; |
@@ -3013,7 +3001,7 @@ polled_recv_byte(volatile unsigned char __iomem *via) | |||
3013 | return x; | 3001 | return x; |
3014 | } | 3002 | } |
3015 | 3003 | ||
3016 | int __pmac | 3004 | int |
3017 | pmu_polled_request(struct adb_request *req) | 3005 | pmu_polled_request(struct adb_request *req) |
3018 | { | 3006 | { |
3019 | unsigned long flags; | 3007 | unsigned long flags; |
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c index 820dc52e30bc..6f80d76ac17c 100644 --- a/drivers/macintosh/via-pmu68k.c +++ b/drivers/macintosh/via-pmu68k.c | |||
@@ -835,7 +835,7 @@ static struct pci_save { | |||
835 | } *pbook_pci_saves; | 835 | } *pbook_pci_saves; |
836 | static int n_pbook_pci_saves; | 836 | static int n_pbook_pci_saves; |
837 | 837 | ||
838 | static inline void __openfirmware | 838 | static inline void |
839 | pbook_pci_save(void) | 839 | pbook_pci_save(void) |
840 | { | 840 | { |
841 | int npci; | 841 | int npci; |
@@ -863,7 +863,7 @@ pbook_pci_save(void) | |||
863 | } | 863 | } |
864 | } | 864 | } |
865 | 865 | ||
866 | static inline void __openfirmware | 866 | static inline void |
867 | pbook_pci_restore(void) | 867 | pbook_pci_restore(void) |
868 | { | 868 | { |
869 | u16 cmd; | 869 | u16 cmd; |
@@ -902,7 +902,7 @@ pbook_pci_restore(void) | |||
902 | #define IRQ_ENABLE ((unsigned int *)0xf3000024) | 902 | #define IRQ_ENABLE ((unsigned int *)0xf3000024) |
903 | #define MEM_CTRL ((unsigned int *)0xf8000070) | 903 | #define MEM_CTRL ((unsigned int *)0xf8000070) |
904 | 904 | ||
905 | int __openfirmware powerbook_sleep(void) | 905 | int powerbook_sleep(void) |
906 | { | 906 | { |
907 | int ret, i, x; | 907 | int ret, i, x; |
908 | static int save_backlight; | 908 | static int save_backlight; |
@@ -1001,25 +1001,24 @@ int __openfirmware powerbook_sleep(void) | |||
1001 | /* | 1001 | /* |
1002 | * Support for /dev/pmu device | 1002 | * Support for /dev/pmu device |
1003 | */ | 1003 | */ |
1004 | static int __openfirmware pmu_open(struct inode *inode, struct file *file) | 1004 | static int pmu_open(struct inode *inode, struct file *file) |
1005 | { | 1005 | { |
1006 | return 0; | 1006 | return 0; |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | static ssize_t __openfirmware pmu_read(struct file *file, char *buf, | 1009 | static ssize_t pmu_read(struct file *file, char *buf, |
1010 | size_t count, loff_t *ppos) | 1010 | size_t count, loff_t *ppos) |
1011 | { | 1011 | { |
1012 | return 0; | 1012 | return 0; |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | static ssize_t __openfirmware pmu_write(struct file *file, const char *buf, | 1015 | static ssize_t pmu_write(struct file *file, const char *buf, |
1016 | size_t count, loff_t *ppos) | 1016 | size_t count, loff_t *ppos) |
1017 | { | 1017 | { |
1018 | return 0; | 1018 | return 0; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | /* Note: removed __openfirmware here since it causes link errors */ | 1021 | static int pmu_ioctl(struct inode * inode, struct file *filp, |
1022 | static int /*__openfirmware*/ pmu_ioctl(struct inode * inode, struct file *filp, | ||
1023 | u_int cmd, u_long arg) | 1022 | u_int cmd, u_long arg) |
1024 | { | 1023 | { |
1025 | int error; | 1024 | int error; |
diff --git a/drivers/mca/mca-device.c b/drivers/mca/mca-device.c index 76d430aa243f..e7adf89fae41 100644 --- a/drivers/mca/mca-device.c +++ b/drivers/mca/mca-device.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/mca.h> | 31 | #include <linux/mca.h> |
32 | #include <linux/string.h> | ||
32 | 33 | ||
33 | /** | 34 | /** |
34 | * mca_device_read_stored_pos - read POS register from stored data | 35 | * mca_device_read_stored_pos - read POS register from stored data |
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index 06f4d4686a6c..31fccb4f05d6 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | 24 | #include <linux/moduleparam.h> |
25 | #include <linux/string.h> | ||
25 | #include <media/ir-common.h> | 26 | #include <media/ir-common.h> |
26 | 27 | ||
27 | /* -------------------------------------------------------------------------- */ | 28 | /* -------------------------------------------------------------------------- */ |
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 88757e2634e5..2aa767f9bd7d 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/vmalloc.h> | 36 | #include <linux/vmalloc.h> |
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/rwsem.h> | 38 | #include <linux/rwsem.h> |
39 | #include <linux/sched.h> | ||
39 | 40 | ||
40 | #include "dvb_ca_en50221.h" | 41 | #include "dvb_ca_en50221.h" |
41 | #include "dvb_ringbuffer.h" | 42 | #include "dvb_ringbuffer.h" |
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index 5aa12ebab34f..b595476332cd 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c | |||
@@ -151,7 +151,7 @@ static struct dvb_usb_properties dtt200u_properties = { | |||
151 | .cold_ids = { &dtt200u_usb_table[0], NULL }, | 151 | .cold_ids = { &dtt200u_usb_table[0], NULL }, |
152 | .warm_ids = { &dtt200u_usb_table[1], NULL }, | 152 | .warm_ids = { &dtt200u_usb_table[1], NULL }, |
153 | }, | 153 | }, |
154 | { 0 }, | 154 | { NULL }, |
155 | } | 155 | } |
156 | }; | 156 | }; |
157 | 157 | ||
@@ -192,7 +192,7 @@ static struct dvb_usb_properties wt220u_properties = { | |||
192 | .cold_ids = { &dtt200u_usb_table[2], NULL }, | 192 | .cold_ids = { &dtt200u_usb_table[2], NULL }, |
193 | .warm_ids = { &dtt200u_usb_table[3], NULL }, | 193 | .warm_ids = { &dtt200u_usb_table[3], NULL }, |
194 | }, | 194 | }, |
195 | { 0 }, | 195 | { NULL }, |
196 | } | 196 | } |
197 | }; | 197 | }; |
198 | 198 | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index 0f57abeb6d6b..75765e3a569c 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
@@ -247,7 +247,7 @@ static struct dvb_usb_properties vp7045_properties = { | |||
247 | .cold_ids = { &vp7045_usb_table[2], NULL }, | 247 | .cold_ids = { &vp7045_usb_table[2], NULL }, |
248 | .warm_ids = { &vp7045_usb_table[3], NULL }, | 248 | .warm_ids = { &vp7045_usb_table[3], NULL }, |
249 | }, | 249 | }, |
250 | { 0 }, | 250 | { NULL }, |
251 | } | 251 | } |
252 | }; | 252 | }; |
253 | 253 | ||
diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c index f5fdc5c3e605..f6d4ee78bdd4 100644 --- a/drivers/media/dvb/frontends/bcm3510.c +++ b/drivers/media/dvb/frontends/bcm3510.c | |||
@@ -36,6 +36,9 @@ | |||
36 | #include <linux/moduleparam.h> | 36 | #include <linux/moduleparam.h> |
37 | #include <linux/device.h> | 37 | #include <linux/device.h> |
38 | #include <linux/firmware.h> | 38 | #include <linux/firmware.h> |
39 | #include <linux/jiffies.h> | ||
40 | #include <linux/string.h> | ||
41 | #include <linux/slab.h> | ||
39 | 42 | ||
40 | #include "dvb_frontend.h" | 43 | #include "dvb_frontend.h" |
41 | #include "bcm3510.h" | 44 | #include "bcm3510.h" |
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index 21433e1831e7..6b0553608610 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/string.h> | ||
31 | #include <linux/slab.h> | ||
30 | 32 | ||
31 | #include "dib3000-common.h" | 33 | #include "dib3000-common.h" |
32 | #include "dib3000mb_priv.h" | 34 | #include "dib3000mb_priv.h" |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 441de665fec3..c024fad17337 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/string.h> | ||
30 | #include <linux/slab.h> | ||
29 | 31 | ||
30 | #include "dib3000-common.h" | 32 | #include "dib3000-common.h" |
31 | #include "dib3000mc_priv.h" | 33 | #include "dib3000mc_priv.h" |
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c index cff93b9d8ab2..794be520d590 100644 --- a/drivers/media/dvb/frontends/dvb_dummy_fe.c +++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/string.h> | ||
26 | #include <linux/slab.h> | ||
25 | 27 | ||
26 | #include "dvb_frontend.h" | 28 | #include "dvb_frontend.h" |
27 | #include "dvb_dummy_fe.h" | 29 | #include "dvb_dummy_fe.h" |
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 7142b9c51dd2..8dde72bd1046 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <linux/moduleparam.h> | 37 | #include <linux/moduleparam.h> |
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/string.h> | ||
41 | #include <linux/slab.h> | ||
40 | #include <asm/byteorder.h> | 42 | #include <asm/byteorder.h> |
41 | 43 | ||
42 | #include "dvb_frontend.h" | 44 | #include "dvb_frontend.h" |
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c index e455aecd76b2..e38454901dd1 100644 --- a/drivers/media/dvb/frontends/mt312.c +++ b/drivers/media/dvb/frontends/mt312.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
32 | #include <linux/string.h> | ||
33 | #include <linux/slab.h> | ||
32 | 34 | ||
33 | #include "dvb_frontend.h" | 35 | #include "dvb_frontend.h" |
34 | #include "mt312_priv.h" | 36 | #include "mt312_priv.h" |
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c index cc1bc0edd65e..f0c610f2c2df 100644 --- a/drivers/media/dvb/frontends/mt352.c +++ b/drivers/media/dvb/frontends/mt352.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/string.h> | ||
39 | #include <linux/slab.h> | ||
38 | 40 | ||
39 | #include "dvb_frontend.h" | 41 | #include "dvb_frontend.h" |
40 | #include "mt352_priv.h" | 42 | #include "mt352_priv.h" |
diff --git a/drivers/media/dvb/frontends/nxt2002.c b/drivers/media/dvb/frontends/nxt2002.c index 35a1d60f1927..30786b1911bd 100644 --- a/drivers/media/dvb/frontends/nxt2002.c +++ b/drivers/media/dvb/frontends/nxt2002.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/firmware.h> | 34 | #include <linux/firmware.h> |
35 | #include <linux/string.h> | ||
36 | #include <linux/slab.h> | ||
35 | 37 | ||
36 | #include "dvb_frontend.h" | 38 | #include "dvb_frontend.h" |
37 | #include "nxt2002.h" | 39 | #include "nxt2002.h" |
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index b6d0eecc59eb..817b044c7fd1 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <linux/moduleparam.h> | 36 | #include <linux/moduleparam.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/string.h> | ||
40 | #include <linux/slab.h> | ||
39 | #include <asm/byteorder.h> | 41 | #include <asm/byteorder.h> |
40 | 42 | ||
41 | #include "dvb_frontend.h" | 43 | #include "dvb_frontend.h" |
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c index ad56a9958404..8a9db23dd1b7 100644 --- a/drivers/media/dvb/frontends/or51211.c +++ b/drivers/media/dvb/frontends/or51211.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/firmware.h> | 36 | #include <linux/firmware.h> |
37 | #include <linux/string.h> | ||
38 | #include <linux/slab.h> | ||
37 | #include <asm/byteorder.h> | 39 | #include <asm/byteorder.h> |
38 | 40 | ||
39 | #include "dvb_frontend.h" | 41 | #include "dvb_frontend.h" |
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c index c7fe27fd530c..f265418e3261 100644 --- a/drivers/media/dvb/frontends/s5h1420.c +++ b/drivers/media/dvb/frontends/s5h1420.c | |||
@@ -26,6 +26,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/jiffies.h> | ||
30 | #include <asm/div64.h> | ||
29 | 31 | ||
30 | #include "dvb_frontend.h" | 32 | #include "dvb_frontend.h" |
31 | #include "s5h1420.h" | 33 | #include "s5h1420.h" |
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c index 764a95a2e212..1c6b2e9264bc 100644 --- a/drivers/media/dvb/frontends/sp8870.c +++ b/drivers/media/dvb/frontends/sp8870.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/string.h> | ||
36 | #include <linux/slab.h> | ||
35 | 37 | ||
36 | #include "dvb_frontend.h" | 38 | #include "dvb_frontend.h" |
37 | #include "sp8870.h" | 39 | #include "sp8870.h" |
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index d868a6927a16..73384e75625e 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/firmware.h> | 16 | #include <linux/firmware.h> |
17 | #include <linux/string.h> | ||
18 | #include <linux/slab.h> | ||
17 | 19 | ||
18 | #include "dvb_frontend.h" | 20 | #include "dvb_frontend.h" |
19 | #include "sp887x.h" | 21 | #include "sp887x.h" |
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 8d09afd7545d..6122ba754bc5 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/jiffies.h> | ||
28 | #include <linux/slab.h> | ||
27 | 29 | ||
28 | #include "dvb_frontend.h" | 30 | #include "dvb_frontend.h" |
29 | #include "stv0297.h" | 31 | #include "stv0297.h" |
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 2d62931f20b5..889d9257215d 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/moduleparam.h> | 48 | #include <linux/moduleparam.h> |
49 | #include <linux/string.h> | 49 | #include <linux/string.h> |
50 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
51 | #include <linux/jiffies.h> | ||
51 | #include <asm/div64.h> | 52 | #include <asm/div64.h> |
52 | 53 | ||
53 | #include "dvb_frontend.h" | 54 | #include "dvb_frontend.h" |
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 74cea9f8d721..3529c618f828 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -32,6 +32,10 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/moduleparam.h> | 33 | #include <linux/moduleparam.h> |
34 | #include <linux/device.h> | 34 | #include <linux/device.h> |
35 | #include <linux/jiffies.h> | ||
36 | #include <linux/string.h> | ||
37 | #include <linux/slab.h> | ||
38 | |||
35 | #include "dvb_frontend.h" | 39 | #include "dvb_frontend.h" |
36 | #include "tda1004x.h" | 40 | #include "tda1004x.h" |
37 | 41 | ||
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c index 168e013d23bd..c05cf1861051 100644 --- a/drivers/media/dvb/frontends/tda8083.c +++ b/drivers/media/dvb/frontends/tda8083.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/jiffies.h> | ||
33 | #include "dvb_frontend.h" | 34 | #include "dvb_frontend.h" |
34 | #include "tda8083.h" | 35 | #include "tda8083.h" |
35 | 36 | ||
diff --git a/drivers/media/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c index df79d5e0aaed..e09214082e01 100644 --- a/drivers/media/radio/miropcm20-rds.c +++ b/drivers/media/radio/miropcm20-rds.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
17 | #include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ | ||
17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
18 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
19 | #include "miropcm20-rds-core.h" | 20 | #include "miropcm20-rds-core.h" |
diff --git a/drivers/message/i2o/debug.c b/drivers/message/i2o/debug.c index 018ca887ca85..40d4ea898dbc 100644 --- a/drivers/message/i2o/debug.c +++ b/drivers/message/i2o/debug.c | |||
@@ -90,7 +90,7 @@ static void i2o_report_fail_status(u8 req_status, u32 * msg) | |||
90 | }; | 90 | }; |
91 | 91 | ||
92 | if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE) | 92 | if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE) |
93 | printk(KERN_DEBUG "TRANSPORT_UNKNOWN_FAILURE (%0#2x)\n.", | 93 | printk(KERN_DEBUG "TRANSPORT_UNKNOWN_FAILURE (%0#2x).\n", |
94 | req_status); | 94 | req_status); |
95 | else | 95 | else |
96 | printk(KERN_DEBUG "TRANSPORT_%s.\n", | 96 | printk(KERN_DEBUG "TRANSPORT_%s.\n", |
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c index d9879965eb50..8eb50cdb8ae1 100644 --- a/drivers/message/i2o/device.c +++ b/drivers/message/i2o/device.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/i2o.h> | 17 | #include <linux/i2o.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/string.h> | ||
20 | #include <linux/slab.h> | ||
19 | #include "core.h" | 21 | #include "core.h" |
20 | 22 | ||
21 | /** | 23 | /** |
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index 0079a4be0af2..0fb9c4e2ad4c 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c | |||
@@ -17,6 +17,9 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/rwsem.h> | 18 | #include <linux/rwsem.h> |
19 | #include <linux/i2o.h> | 19 | #include <linux/i2o.h> |
20 | #include <linux/workqueue.h> | ||
21 | #include <linux/string.h> | ||
22 | #include <linux/slab.h> | ||
20 | #include "core.h" | 23 | #include "core.h" |
21 | 24 | ||
22 | #define OSM_NAME "i2o" | 25 | #define OSM_NAME "i2o" |
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index bda2c62648ba..b675b4ebbebd 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c | |||
@@ -30,6 +30,10 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/i2o.h> | 31 | #include <linux/i2o.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/workqueue.h> | ||
34 | #include <linux/string.h> | ||
35 | #include <linux/slab.h> | ||
36 | #include <asm/param.h> /* HZ */ | ||
33 | #include "core.h" | 37 | #include "core.h" |
34 | 38 | ||
35 | #define OSM_NAME "exec-osm" | 39 | #define OSM_NAME "exec-osm" |
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 361da8d1d5e7..61b837de4b6a 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/i2o.h> | 29 | #include <linux/i2o.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/sched.h> | ||
31 | #include "core.h" | 32 | #include "core.h" |
32 | 33 | ||
33 | #define OSM_NAME "i2o" | 34 | #define OSM_NAME "i2o" |
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c index 585cded3d365..a984c0efabf0 100644 --- a/drivers/mfd/ucb1x00-ts.c +++ b/drivers/mfd/ucb1x00-ts.c | |||
@@ -32,9 +32,12 @@ | |||
32 | #include <linux/suspend.h> | 32 | #include <linux/suspend.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/kthread.h> | 34 | #include <linux/kthread.h> |
35 | #include <linux/delay.h> | ||
35 | 36 | ||
36 | #include <asm/dma.h> | 37 | #include <asm/dma.h> |
37 | #include <asm/semaphore.h> | 38 | #include <asm/semaphore.h> |
39 | #include <asm/arch/collie.h> | ||
40 | #include <asm/mach-types.h> | ||
38 | 41 | ||
39 | #include "ucb1x00.h" | 42 | #include "ucb1x00.h" |
40 | 43 | ||
@@ -85,12 +88,23 @@ static inline void ucb1x00_ts_mode_int(struct ucb1x00_ts *ts) | |||
85 | */ | 88 | */ |
86 | static inline unsigned int ucb1x00_ts_read_pressure(struct ucb1x00_ts *ts) | 89 | static inline unsigned int ucb1x00_ts_read_pressure(struct ucb1x00_ts *ts) |
87 | { | 90 | { |
88 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | 91 | if (machine_is_collie()) { |
89 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | | 92 | ucb1x00_io_write(ts->ucb, COLLIE_TC35143_GPIO_TBL_CHK, 0); |
90 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | | 93 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, |
91 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | 94 | UCB_TS_CR_TSPX_POW | UCB_TS_CR_TSMX_POW | |
95 | UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); | ||
92 | 96 | ||
93 | return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync); | 97 | udelay(55); |
98 | |||
99 | return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_AD2, ts->adcsync); | ||
100 | } else { | ||
101 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | ||
102 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | | ||
103 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | | ||
104 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | ||
105 | |||
106 | return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync); | ||
107 | } | ||
94 | } | 108 | } |
95 | 109 | ||
96 | /* | 110 | /* |
@@ -101,12 +115,16 @@ static inline unsigned int ucb1x00_ts_read_pressure(struct ucb1x00_ts *ts) | |||
101 | */ | 115 | */ |
102 | static inline unsigned int ucb1x00_ts_read_xpos(struct ucb1x00_ts *ts) | 116 | static inline unsigned int ucb1x00_ts_read_xpos(struct ucb1x00_ts *ts) |
103 | { | 117 | { |
104 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | 118 | if (machine_is_collie()) |
105 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | 119 | ucb1x00_io_write(ts->ucb, 0, COLLIE_TC35143_GPIO_TBL_CHK); |
106 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | 120 | else { |
107 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | 121 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, |
108 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | 122 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | |
109 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | 123 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); |
124 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | ||
125 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | ||
126 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | ||
127 | } | ||
110 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | 128 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, |
111 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | 129 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | |
112 | UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); | 130 | UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); |
@@ -124,12 +142,17 @@ static inline unsigned int ucb1x00_ts_read_xpos(struct ucb1x00_ts *ts) | |||
124 | */ | 142 | */ |
125 | static inline unsigned int ucb1x00_ts_read_ypos(struct ucb1x00_ts *ts) | 143 | static inline unsigned int ucb1x00_ts_read_ypos(struct ucb1x00_ts *ts) |
126 | { | 144 | { |
127 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | 145 | if (machine_is_collie()) |
128 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | 146 | ucb1x00_io_write(ts->ucb, 0, COLLIE_TC35143_GPIO_TBL_CHK); |
129 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | 147 | else { |
130 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | 148 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, |
131 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | 149 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | |
132 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | 150 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); |
151 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | ||
152 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | ||
153 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | ||
154 | } | ||
155 | |||
133 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, | 156 | ucb1x00_reg_write(ts->ucb, UCB_TS_CR, |
134 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | 157 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | |
135 | UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); | 158 | UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA); |
@@ -163,6 +186,15 @@ static inline unsigned int ucb1x00_ts_read_yres(struct ucb1x00_ts *ts) | |||
163 | return ucb1x00_adc_read(ts->ucb, 0, ts->adcsync); | 186 | return ucb1x00_adc_read(ts->ucb, 0, ts->adcsync); |
164 | } | 187 | } |
165 | 188 | ||
189 | static inline int ucb1x00_ts_pen_down(struct ucb1x00_ts *ts) | ||
190 | { | ||
191 | unsigned int val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR); | ||
192 | if (machine_is_collie()) | ||
193 | return (!(val & (UCB_TS_CR_TSPX_LOW))); | ||
194 | else | ||
195 | return (val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW)); | ||
196 | } | ||
197 | |||
166 | /* | 198 | /* |
167 | * This is a RT kernel thread that handles the ADC accesses | 199 | * This is a RT kernel thread that handles the ADC accesses |
168 | * (mainly so we can use semaphores in the UCB1200 core code | 200 | * (mainly so we can use semaphores in the UCB1200 core code |
@@ -186,7 +218,7 @@ static int ucb1x00_thread(void *_ts) | |||
186 | 218 | ||
187 | add_wait_queue(&ts->irq_wait, &wait); | 219 | add_wait_queue(&ts->irq_wait, &wait); |
188 | while (!kthread_should_stop()) { | 220 | while (!kthread_should_stop()) { |
189 | unsigned int x, y, p, val; | 221 | unsigned int x, y, p; |
190 | signed long timeout; | 222 | signed long timeout; |
191 | 223 | ||
192 | ts->restart = 0; | 224 | ts->restart = 0; |
@@ -206,12 +238,12 @@ static int ucb1x00_thread(void *_ts) | |||
206 | msleep(10); | 238 | msleep(10); |
207 | 239 | ||
208 | ucb1x00_enable(ts->ucb); | 240 | ucb1x00_enable(ts->ucb); |
209 | val = ucb1x00_reg_read(ts->ucb, UCB_TS_CR); | ||
210 | 241 | ||
211 | if (val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW)) { | 242 | |
243 | if (ucb1x00_ts_pen_down(ts)) { | ||
212 | set_task_state(tsk, TASK_INTERRUPTIBLE); | 244 | set_task_state(tsk, TASK_INTERRUPTIBLE); |
213 | 245 | ||
214 | ucb1x00_enable_irq(ts->ucb, UCB_IRQ_TSPX, UCB_FALLING); | 246 | ucb1x00_enable_irq(ts->ucb, UCB_IRQ_TSPX, machine_is_collie() ? UCB_RISING : UCB_FALLING); |
215 | ucb1x00_disable(ts->ucb); | 247 | ucb1x00_disable(ts->ucb); |
216 | 248 | ||
217 | /* | 249 | /* |
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index fa83f15fdf16..9b629856c735 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -85,6 +85,12 @@ static void mmc_blk_put(struct mmc_blk_data *md) | |||
85 | up(&open_lock); | 85 | up(&open_lock); |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline int mmc_blk_readonly(struct mmc_card *card) | ||
89 | { | ||
90 | return mmc_card_readonly(card) || | ||
91 | !(card->csd.cmdclass & CCC_BLOCK_WRITE); | ||
92 | } | ||
93 | |||
88 | static int mmc_blk_open(struct inode *inode, struct file *filp) | 94 | static int mmc_blk_open(struct inode *inode, struct file *filp) |
89 | { | 95 | { |
90 | struct mmc_blk_data *md; | 96 | struct mmc_blk_data *md; |
@@ -97,7 +103,7 @@ static int mmc_blk_open(struct inode *inode, struct file *filp) | |||
97 | ret = 0; | 103 | ret = 0; |
98 | 104 | ||
99 | if ((filp->f_mode & FMODE_WRITE) && | 105 | if ((filp->f_mode & FMODE_WRITE) && |
100 | mmc_card_readonly(md->queue.card)) | 106 | mmc_blk_readonly(md->queue.card)) |
101 | ret = -EROFS; | 107 | ret = -EROFS; |
102 | } | 108 | } |
103 | 109 | ||
@@ -410,7 +416,7 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
410 | printk(KERN_INFO "%s: %s %s %dKiB %s\n", | 416 | printk(KERN_INFO "%s: %s %s %dKiB %s\n", |
411 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), | 417 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), |
412 | (card->csd.capacity << card->csd.read_blkbits) / 1024, | 418 | (card->csd.capacity << card->csd.read_blkbits) / 1024, |
413 | mmc_card_readonly(card)?"(ro)":""); | 419 | mmc_blk_readonly(card)?"(ro)":""); |
414 | 420 | ||
415 | mmc_set_drvdata(card, md); | 421 | mmc_set_drvdata(card, md); |
416 | add_disk(md->disk); | 422 | add_disk(md->disk); |
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index 8eba373d42d7..d575e3a018bc 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #include <asm/dma.h> | 30 | #include <asm/dma.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | #include <asm/irq.h> | ||
33 | #include <asm/scatterlist.h> | 32 | #include <asm/scatterlist.h> |
34 | #include <asm/sizes.h> | 33 | #include <asm/sizes.h> |
35 | 34 | ||
diff --git a/drivers/mtd/chips/jedec.c b/drivers/mtd/chips/jedec.c index 62d235a9a4e2..4f6778f3ee3e 100644 --- a/drivers/mtd/chips/jedec.c +++ b/drivers/mtd/chips/jedec.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/mtd/jedec.h> | 21 | #include <linux/mtd/jedec.h> |
21 | #include <linux/mtd/map.h> | 22 | #include <linux/mtd/map.h> |
22 | #include <linux/mtd/mtd.h> | 23 | #include <linux/mtd/mtd.h> |
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c index dfd335e4a2a8..df987a53ed9c 100644 --- a/drivers/mtd/devices/lart.c +++ b/drivers/mtd/devices/lart.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/types.h> | 44 | #include <linux/types.h> |
45 | #include <linux/init.h> | 45 | #include <linux/init.h> |
46 | #include <linux/errno.h> | 46 | #include <linux/errno.h> |
47 | #include <linux/string.h> | ||
47 | #include <linux/mtd/mtd.h> | 48 | #include <linux/mtd/mtd.h> |
48 | #ifdef HAVE_PARTITIONS | 49 | #ifdef HAVE_PARTITIONS |
49 | #include <linux/mtd/partitions.h> | 50 | #include <linux/mtd/partitions.h> |
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index a423a382095a..765c0179c8df 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | 24 | #include <linux/moduleparam.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/mtd/mtd.h> | 26 | #include <linux/mtd/mtd.h> |
26 | 27 | ||
27 | #define ERROR(fmt, args...) printk(KERN_ERR "phram: " fmt , ## args) | 28 | #define ERROR(fmt, args...) printk(KERN_ERR "phram: " fmt , ## args) |
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c index 0ba0ff7d43b9..63104c73ca3c 100644 --- a/drivers/mtd/maps/bast-flash.c +++ b/drivers/mtd/maps/bast-flash.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/slab.h> | ||
36 | 37 | ||
37 | #include <linux/mtd/mtd.h> | 38 | #include <linux/mtd/mtd.h> |
38 | #include <linux/mtd/map.h> | 39 | #include <linux/mtd/map.h> |
diff --git a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c index da8584a662f4..c68b31dc7e6d 100644 --- a/drivers/mtd/maps/ceiva.c +++ b/drivers/mtd/maps/ceiva.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/ioport.h> | 20 | #include <linux/ioport.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/slab.h> | ||
23 | 24 | ||
24 | #include <linux/mtd/mtd.h> | 25 | #include <linux/mtd/mtd.h> |
25 | #include <linux/mtd/map.h> | 26 | #include <linux/mtd/map.h> |
diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c index 938c41f2f056..e5b74169fde6 100644 --- a/drivers/mtd/maps/dc21285.c +++ b/drivers/mtd/maps/dc21285.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/slab.h> | ||
16 | 17 | ||
17 | #include <linux/mtd/mtd.h> | 18 | #include <linux/mtd/mtd.h> |
18 | #include <linux/mtd/map.h> | 19 | #include <linux/mtd/map.h> |
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c index 0bc79c93a584..f99519692cb7 100644 --- a/drivers/mtd/maps/dilnetpc.c +++ b/drivers/mtd/maps/dilnetpc.c | |||
@@ -30,12 +30,15 @@ | |||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <asm/io.h> | 33 | #include <linux/string.h> |
34 | |||
34 | #include <linux/mtd/mtd.h> | 35 | #include <linux/mtd/mtd.h> |
35 | #include <linux/mtd/map.h> | 36 | #include <linux/mtd/map.h> |
36 | #include <linux/mtd/partitions.h> | 37 | #include <linux/mtd/partitions.h> |
37 | #include <linux/mtd/concat.h> | 38 | #include <linux/mtd/concat.h> |
38 | 39 | ||
40 | #include <asm/io.h> | ||
41 | |||
39 | /* | 42 | /* |
40 | ** The DIL/NetPC keeps its BIOS in two distinct flash blocks. | 43 | ** The DIL/NetPC keeps its BIOS in two distinct flash blocks. |
41 | ** Destroying any of these blocks transforms the DNPC into | 44 | ** Destroying any of these blocks transforms the DNPC into |
diff --git a/drivers/mtd/maps/epxa10db-flash.c b/drivers/mtd/maps/epxa10db-flash.c index ab6dbe2b8cce..1df6188926b3 100644 --- a/drivers/mtd/maps/epxa10db-flash.c +++ b/drivers/mtd/maps/epxa10db-flash.c | |||
@@ -27,12 +27,15 @@ | |||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <asm/io.h> | 30 | #include <linux/slab.h> |
31 | |||
31 | #include <linux/mtd/mtd.h> | 32 | #include <linux/mtd/mtd.h> |
32 | #include <linux/mtd/map.h> | 33 | #include <linux/mtd/map.h> |
33 | #include <linux/mtd/partitions.h> | 34 | #include <linux/mtd/partitions.h> |
34 | 35 | ||
36 | #include <asm/io.h> | ||
35 | #include <asm/hardware.h> | 37 | #include <asm/hardware.h> |
38 | |||
36 | #ifdef CONFIG_EPXA10DB | 39 | #ifdef CONFIG_EPXA10DB |
37 | #define BOARD_NAME "EPXA10DB" | 40 | #define BOARD_NAME "EPXA10DB" |
38 | #else | 41 | #else |
diff --git a/drivers/mtd/maps/fortunet.c b/drivers/mtd/maps/fortunet.c index 068bb6a54520..00f7bbe5479e 100644 --- a/drivers/mtd/maps/fortunet.c +++ b/drivers/mtd/maps/fortunet.c | |||
@@ -7,11 +7,14 @@ | |||
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <asm/io.h> | 10 | #include <linux/string.h> |
11 | |||
11 | #include <linux/mtd/mtd.h> | 12 | #include <linux/mtd/mtd.h> |
12 | #include <linux/mtd/map.h> | 13 | #include <linux/mtd/map.h> |
13 | #include <linux/mtd/partitions.h> | 14 | #include <linux/mtd/partitions.h> |
14 | 15 | ||
16 | #include <asm/io.h> | ||
17 | |||
15 | #define MAX_NUM_REGIONS 4 | 18 | #define MAX_NUM_REGIONS 4 |
16 | #define MAX_NUM_PARTITIONS 8 | 19 | #define MAX_NUM_PARTITIONS 8 |
17 | 20 | ||
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index a9f86c7fbd52..1e5d6e1d05f3 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -22,11 +22,13 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
25 | #include <linux/slab.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/device.h> | ||
28 | |||
25 | #include <linux/mtd/mtd.h> | 29 | #include <linux/mtd/mtd.h> |
26 | #include <linux/mtd/map.h> | 30 | #include <linux/mtd/map.h> |
27 | #include <linux/mtd/partitions.h> | 31 | #include <linux/mtd/partitions.h> |
28 | #include <linux/ioport.h> | ||
29 | #include <linux/device.h> | ||
30 | 32 | ||
31 | #include <asm/io.h> | 33 | #include <asm/io.h> |
32 | #include <asm/hardware.h> | 34 | #include <asm/hardware.h> |
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 3fcc32884074..da316e543237 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -20,11 +20,14 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/slab.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/device.h> | ||
26 | |||
23 | #include <linux/mtd/mtd.h> | 27 | #include <linux/mtd/mtd.h> |
24 | #include <linux/mtd/map.h> | 28 | #include <linux/mtd/map.h> |
25 | #include <linux/mtd/partitions.h> | 29 | #include <linux/mtd/partitions.h> |
26 | #include <linux/ioport.h> | 30 | |
27 | #include <linux/device.h> | ||
28 | #include <asm/io.h> | 31 | #include <asm/io.h> |
29 | #include <asm/mach/flash.h> | 32 | #include <asm/mach/flash.h> |
30 | 33 | ||
diff --git a/drivers/mtd/maps/lubbock-flash.c b/drivers/mtd/maps/lubbock-flash.c index 1298de475c9a..2337e0c46750 100644 --- a/drivers/mtd/maps/lubbock-flash.c +++ b/drivers/mtd/maps/lubbock-flash.c | |||
@@ -15,10 +15,13 @@ | |||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/slab.h> | ||
19 | |||
18 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
19 | #include <linux/mtd/mtd.h> | 21 | #include <linux/mtd/mtd.h> |
20 | #include <linux/mtd/map.h> | 22 | #include <linux/mtd/map.h> |
21 | #include <linux/mtd/partitions.h> | 23 | #include <linux/mtd/partitions.h> |
24 | |||
22 | #include <asm/io.h> | 25 | #include <asm/io.h> |
23 | #include <asm/hardware.h> | 26 | #include <asm/hardware.h> |
24 | #include <asm/arch/pxa-regs.h> | 27 | #include <asm/arch/pxa-regs.h> |
diff --git a/drivers/mtd/maps/mainstone-flash.c b/drivers/mtd/maps/mainstone-flash.c index 87e93fa60588..da0f8a692628 100644 --- a/drivers/mtd/maps/mainstone-flash.c +++ b/drivers/mtd/maps/mainstone-flash.c | |||
@@ -16,9 +16,12 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/dma-mapping.h> | 18 | #include <linux/dma-mapping.h> |
19 | #include <linux/slab.h> | ||
20 | |||
19 | #include <linux/mtd/mtd.h> | 21 | #include <linux/mtd/mtd.h> |
20 | #include <linux/mtd/map.h> | 22 | #include <linux/mtd/map.h> |
21 | #include <linux/mtd/partitions.h> | 23 | #include <linux/mtd/partitions.h> |
24 | |||
22 | #include <asm/io.h> | 25 | #include <asm/io.h> |
23 | #include <asm/hardware.h> | 26 | #include <asm/hardware.h> |
24 | #include <asm/arch/pxa-regs.h> | 27 | #include <asm/arch/pxa-regs.h> |
diff --git a/drivers/mtd/maps/omap-toto-flash.c b/drivers/mtd/maps/omap-toto-flash.c index 496109071cb1..da36e8dddd17 100644 --- a/drivers/mtd/maps/omap-toto-flash.c +++ b/drivers/mtd/maps/omap-toto-flash.c | |||
@@ -12,9 +12,9 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | |||
16 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/slab.h> | ||
18 | 18 | ||
19 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
20 | #include <linux/mtd/map.h> | 20 | #include <linux/mtd/map.h> |
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index b17bca657daf..fa84566245a7 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/ioport.h> | 38 | #include <linux/ioport.h> |
39 | #include <linux/slab.h> | ||
40 | |||
39 | #include <linux/mtd/mtd.h> | 41 | #include <linux/mtd/mtd.h> |
40 | #include <linux/mtd/map.h> | 42 | #include <linux/mtd/map.h> |
41 | #include <linux/mtd/partitions.h> | 43 | #include <linux/mtd/partitions.h> |
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c index 18dbd3af1eaa..d9c64e99ee32 100644 --- a/drivers/mtd/maps/pci.c +++ b/drivers/mtd/maps/pci.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | #include <linux/mtd/mtd.h> | 22 | #include <linux/mtd/mtd.h> |
22 | #include <linux/mtd/map.h> | 23 | #include <linux/mtd/map.h> |
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 118b04544cad..a0577ea00c3c 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/string.h> | 30 | #include <linux/string.h> |
31 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/slab.h> | ||
33 | 34 | ||
34 | #include <linux/mtd/mtd.h> | 35 | #include <linux/mtd/mtd.h> |
35 | #include <linux/mtd/map.h> | 36 | #include <linux/mtd/map.h> |
diff --git a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c index 995e9991cb8d..4e28b977f224 100644 --- a/drivers/mtd/maps/tqm8xxl.c +++ b/drivers/mtd/maps/tqm8xxl.c | |||
@@ -27,12 +27,14 @@ | |||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <asm/io.h> | 30 | #include <linux/slab.h> |
31 | 31 | ||
32 | #include <linux/mtd/mtd.h> | 32 | #include <linux/mtd/mtd.h> |
33 | #include <linux/mtd/map.h> | 33 | #include <linux/mtd/map.h> |
34 | #include <linux/mtd/partitions.h> | 34 | #include <linux/mtd/partitions.h> |
35 | 35 | ||
36 | #include <asm/io.h> | ||
37 | |||
36 | #define FLASH_ADDR 0x40000000 | 38 | #define FLASH_ADDR 0x40000000 |
37 | #define FLASH_SIZE 0x00800000 | 39 | #define FLASH_SIZE 0x00800000 |
38 | #define FLASH_BANK_MAX 4 | 40 | #define FLASH_BANK_MAX 4 |
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index b7c32c242bc7..400dd9c89883 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/vmalloc.h> | 17 | #include <linux/vmalloc.h> |
18 | #include <linux/sched.h> /* TASK_* */ | ||
18 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/blktrans.h> | 20 | #include <linux/mtd/blktrans.h> |
20 | 21 | ||
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index c534fd5d95cb..16df1e4fb0e9 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/sched.h> /* TASK_* */ | ||
16 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
17 | 18 | ||
18 | #include <linux/device.h> | 19 | #include <linux/device.h> |
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 8f66d093c80d..f3e65af33a9c 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | 17 | #include <linux/sched.h> /* TASK_* */ | |
18 | #include <linux/mtd/mtd.h> | 18 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/concat.h> | 19 | #include <linux/mtd/concat.h> |
20 | 20 | ||
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index b47ebcb31e0f..b58ba236a9eb 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/device.h> | 51 | #include <linux/device.h> |
52 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
53 | #include <linux/err.h> | 53 | #include <linux/err.h> |
54 | #include <linux/slab.h> | ||
54 | 55 | ||
55 | #include <linux/mtd/mtd.h> | 56 | #include <linux/mtd/mtd.h> |
56 | #include <linux/mtd/nand.h> | 57 | #include <linux/mtd/nand.h> |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 73f2fcfc557f..bbca8ae8018c 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -1658,6 +1658,7 @@ static struct of_device_id bmac_match[] = | |||
1658 | }, | 1658 | }, |
1659 | {}, | 1659 | {}, |
1660 | }; | 1660 | }; |
1661 | MODULE_DEVICE_TABLE (of, bmac_match); | ||
1661 | 1662 | ||
1662 | static struct macio_driver bmac_driver = | 1663 | static struct macio_driver bmac_driver = |
1663 | { | 1664 | { |
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 1ce2c675b8a7..a806dfe54d23 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -552,8 +552,7 @@ static int __init do_eepro_probe(struct net_device *dev) | |||
552 | { | 552 | { |
553 | unsigned short int WS[32]=WakeupSeq; | 553 | unsigned short int WS[32]=WakeupSeq; |
554 | 554 | ||
555 | if (check_region(WakeupPort, 2)==0) { | 555 | if (request_region(WakeupPort, 2, "eepro wakeup")) { |
556 | |||
557 | if (net_debug>5) | 556 | if (net_debug>5) |
558 | printk(KERN_DEBUG "Waking UP\n"); | 557 | printk(KERN_DEBUG "Waking UP\n"); |
559 | 558 | ||
@@ -563,7 +562,10 @@ static int __init do_eepro_probe(struct net_device *dev) | |||
563 | outb_p(WS[i],WakeupPort); | 562 | outb_p(WS[i],WakeupPort); |
564 | if (net_debug>5) printk(KERN_DEBUG ": %#x ",WS[i]); | 563 | if (net_debug>5) printk(KERN_DEBUG ": %#x ",WS[i]); |
565 | } | 564 | } |
566 | } else printk(KERN_WARNING "Checkregion Failed!\n"); | 565 | |
566 | release_region(WakeupPort, 2); | ||
567 | } else | ||
568 | printk(KERN_WARNING "PnP wakeup region busy!\n"); | ||
567 | } | 569 | } |
568 | #endif | 570 | #endif |
569 | 571 | ||
@@ -705,7 +707,7 @@ static void __init eepro_print_info (struct net_device *dev) | |||
705 | dev->name, (unsigned)dev->base_addr); | 707 | dev->name, (unsigned)dev->base_addr); |
706 | break; | 708 | break; |
707 | case LAN595FX: | 709 | case LAN595FX: |
708 | printk("%s: Intel EtherExpress Pro/10+ ISA\n at %#x,", | 710 | printk("%s: Intel EtherExpress Pro/10+ ISA\n at %#x,", |
709 | dev->name, (unsigned)dev->base_addr); | 711 | dev->name, (unsigned)dev->base_addr); |
710 | break; | 712 | break; |
711 | case LAN595TX: | 713 | case LAN595TX: |
@@ -713,7 +715,7 @@ static void __init eepro_print_info (struct net_device *dev) | |||
713 | dev->name, (unsigned)dev->base_addr); | 715 | dev->name, (unsigned)dev->base_addr); |
714 | break; | 716 | break; |
715 | case LAN595: | 717 | case LAN595: |
716 | printk("%s: Intel 82595-based lan card at %#x,", | 718 | printk("%s: Intel 82595-based lan card at %#x,", |
717 | dev->name, (unsigned)dev->base_addr); | 719 | dev->name, (unsigned)dev->base_addr); |
718 | } | 720 | } |
719 | 721 | ||
@@ -726,7 +728,7 @@ static void __init eepro_print_info (struct net_device *dev) | |||
726 | 728 | ||
727 | if (dev->irq > 2) | 729 | if (dev->irq > 2) |
728 | printk(", IRQ %d, %s.\n", dev->irq, ifmap[dev->if_port]); | 730 | printk(", IRQ %d, %s.\n", dev->irq, ifmap[dev->if_port]); |
729 | else | 731 | else |
730 | printk(", %s.\n", ifmap[dev->if_port]); | 732 | printk(", %s.\n", ifmap[dev->if_port]); |
731 | 733 | ||
732 | if (net_debug > 3) { | 734 | if (net_debug > 3) { |
@@ -756,7 +758,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
756 | int err; | 758 | int err; |
757 | 759 | ||
758 | /* Grab the region so we can find another board if autoIRQ fails. */ | 760 | /* Grab the region so we can find another board if autoIRQ fails. */ |
759 | if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) { | 761 | if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) { |
760 | if (!autoprobe) | 762 | if (!autoprobe) |
761 | printk(KERN_WARNING "EEPRO: io-port 0x%04x in use \n", | 763 | printk(KERN_WARNING "EEPRO: io-port 0x%04x in use \n", |
762 | ioaddr); | 764 | ioaddr); |
@@ -838,15 +840,15 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
838 | /* Mask off INT number */ | 840 | /* Mask off INT number */ |
839 | int count = lp->word[1] & 7; | 841 | int count = lp->word[1] & 7; |
840 | unsigned irqMask = lp->word[7]; | 842 | unsigned irqMask = lp->word[7]; |
841 | 843 | ||
842 | while (count--) | 844 | while (count--) |
843 | irqMask &= irqMask - 1; | 845 | irqMask &= irqMask - 1; |
844 | 846 | ||
845 | count = ffs(irqMask); | 847 | count = ffs(irqMask); |
846 | 848 | ||
847 | if (count) | 849 | if (count) |
848 | dev->irq = count - 1; | 850 | dev->irq = count - 1; |
849 | 851 | ||
850 | if (dev->irq < 2) { | 852 | if (dev->irq < 2) { |
851 | printk(KERN_ERR " Duh! illegal interrupt vector stored in EEPROM.\n"); | 853 | printk(KERN_ERR " Duh! illegal interrupt vector stored in EEPROM.\n"); |
852 | goto exit; | 854 | goto exit; |
@@ -854,7 +856,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
854 | dev->irq = 9; | 856 | dev->irq = 9; |
855 | } | 857 | } |
856 | } | 858 | } |
857 | 859 | ||
858 | dev->open = eepro_open; | 860 | dev->open = eepro_open; |
859 | dev->stop = eepro_close; | 861 | dev->stop = eepro_close; |
860 | dev->hard_start_xmit = eepro_send_packet; | 862 | dev->hard_start_xmit = eepro_send_packet; |
@@ -863,7 +865,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
863 | dev->tx_timeout = eepro_tx_timeout; | 865 | dev->tx_timeout = eepro_tx_timeout; |
864 | dev->watchdog_timeo = TX_TIMEOUT; | 866 | dev->watchdog_timeo = TX_TIMEOUT; |
865 | dev->ethtool_ops = &eepro_ethtool_ops; | 867 | dev->ethtool_ops = &eepro_ethtool_ops; |
866 | 868 | ||
867 | /* print boot time info */ | 869 | /* print boot time info */ |
868 | eepro_print_info(dev); | 870 | eepro_print_info(dev); |
869 | 871 | ||
@@ -1047,8 +1049,8 @@ static int eepro_open(struct net_device *dev) | |||
1047 | 1049 | ||
1048 | 1050 | ||
1049 | /* Initialize the RCV and XMT upper and lower limits */ | 1051 | /* Initialize the RCV and XMT upper and lower limits */ |
1050 | outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); | 1052 | outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); |
1051 | outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); | 1053 | outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); |
1052 | outb(lp->xmt_lower_limit >> 8, ioaddr + lp->xmt_lower_limit_reg); | 1054 | outb(lp->xmt_lower_limit >> 8, ioaddr + lp->xmt_lower_limit_reg); |
1053 | outb(lp->xmt_upper_limit >> 8, ioaddr + lp->xmt_upper_limit_reg); | 1055 | outb(lp->xmt_upper_limit >> 8, ioaddr + lp->xmt_upper_limit_reg); |
1054 | 1056 | ||
@@ -1065,12 +1067,12 @@ static int eepro_open(struct net_device *dev) | |||
1065 | eepro_clear_int(ioaddr); | 1067 | eepro_clear_int(ioaddr); |
1066 | 1068 | ||
1067 | /* Initialize RCV */ | 1069 | /* Initialize RCV */ |
1068 | outw(lp->rcv_lower_limit, ioaddr + RCV_BAR); | 1070 | outw(lp->rcv_lower_limit, ioaddr + RCV_BAR); |
1069 | lp->rx_start = lp->rcv_lower_limit; | 1071 | lp->rx_start = lp->rcv_lower_limit; |
1070 | outw(lp->rcv_upper_limit | 0xfe, ioaddr + RCV_STOP); | 1072 | outw(lp->rcv_upper_limit | 0xfe, ioaddr + RCV_STOP); |
1071 | 1073 | ||
1072 | /* Initialize XMT */ | 1074 | /* Initialize XMT */ |
1073 | outw(lp->xmt_lower_limit, ioaddr + lp->xmt_bar); | 1075 | outw(lp->xmt_lower_limit, ioaddr + lp->xmt_bar); |
1074 | lp->tx_start = lp->tx_end = lp->xmt_lower_limit; | 1076 | lp->tx_start = lp->tx_end = lp->xmt_lower_limit; |
1075 | lp->tx_last = 0; | 1077 | lp->tx_last = 0; |
1076 | 1078 | ||
@@ -1411,7 +1413,7 @@ set_multicast_list(struct net_device *dev) | |||
1411 | outb(0x08, ioaddr + STATUS_REG); | 1413 | outb(0x08, ioaddr + STATUS_REG); |
1412 | 1414 | ||
1413 | if (i & 0x20) { /* command ABORTed */ | 1415 | if (i & 0x20) { /* command ABORTed */ |
1414 | printk(KERN_NOTICE "%s: multicast setup failed.\n", | 1416 | printk(KERN_NOTICE "%s: multicast setup failed.\n", |
1415 | dev->name); | 1417 | dev->name); |
1416 | break; | 1418 | break; |
1417 | } else if ((i & 0x0f) == 0x03) { /* MC-Done */ | 1419 | } else if ((i & 0x0f) == 0x03) { /* MC-Done */ |
@@ -1512,7 +1514,7 @@ hardware_send_packet(struct net_device *dev, void *buf, short length) | |||
1512 | end = last + (((length + 3) >> 1) << 1) + XMT_HEADER; | 1514 | end = last + (((length + 3) >> 1) << 1) + XMT_HEADER; |
1513 | 1515 | ||
1514 | if (end >= lp->xmt_upper_limit + 2) { /* the transmit buffer is wrapped around */ | 1516 | if (end >= lp->xmt_upper_limit + 2) { /* the transmit buffer is wrapped around */ |
1515 | if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) { | 1517 | if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) { |
1516 | /* Arrrr!!!, must keep the xmt header together, | 1518 | /* Arrrr!!!, must keep the xmt header together, |
1517 | several days were lost to chase this one down. */ | 1519 | several days were lost to chase this one down. */ |
1518 | last = lp->xmt_lower_limit; | 1520 | last = lp->xmt_lower_limit; |
@@ -1643,7 +1645,7 @@ eepro_rx(struct net_device *dev) | |||
1643 | else if (rcv_status & 0x0800) | 1645 | else if (rcv_status & 0x0800) |
1644 | lp->stats.rx_crc_errors++; | 1646 | lp->stats.rx_crc_errors++; |
1645 | 1647 | ||
1646 | printk(KERN_DEBUG "%s: event = %#x, status = %#x, next = %#x, size = %#x\n", | 1648 | printk(KERN_DEBUG "%s: event = %#x, status = %#x, next = %#x, size = %#x\n", |
1647 | dev->name, rcv_event, rcv_status, rcv_next_frame, rcv_size); | 1649 | dev->name, rcv_event, rcv_status, rcv_next_frame, rcv_size); |
1648 | } | 1650 | } |
1649 | 1651 | ||
@@ -1674,10 +1676,10 @@ eepro_transmit_interrupt(struct net_device *dev) | |||
1674 | { | 1676 | { |
1675 | struct eepro_local *lp = netdev_priv(dev); | 1677 | struct eepro_local *lp = netdev_priv(dev); |
1676 | short ioaddr = dev->base_addr; | 1678 | short ioaddr = dev->base_addr; |
1677 | short boguscount = 25; | 1679 | short boguscount = 25; |
1678 | short xmt_status; | 1680 | short xmt_status; |
1679 | 1681 | ||
1680 | while ((lp->tx_start != lp->tx_end) && boguscount--) { | 1682 | while ((lp->tx_start != lp->tx_end) && boguscount--) { |
1681 | 1683 | ||
1682 | outw(lp->tx_start, ioaddr + HOST_ADDRESS_REG); | 1684 | outw(lp->tx_start, ioaddr + HOST_ADDRESS_REG); |
1683 | xmt_status = inw(ioaddr+IO_PORT); | 1685 | xmt_status = inw(ioaddr+IO_PORT); |
@@ -1723,7 +1725,7 @@ static int eepro_ethtool_get_settings(struct net_device *dev, | |||
1723 | { | 1725 | { |
1724 | struct eepro_local *lp = (struct eepro_local *)dev->priv; | 1726 | struct eepro_local *lp = (struct eepro_local *)dev->priv; |
1725 | 1727 | ||
1726 | cmd->supported = SUPPORTED_10baseT_Half | | 1728 | cmd->supported = SUPPORTED_10baseT_Half | |
1727 | SUPPORTED_10baseT_Full | | 1729 | SUPPORTED_10baseT_Full | |
1728 | SUPPORTED_Autoneg; | 1730 | SUPPORTED_Autoneg; |
1729 | cmd->advertising = ADVERTISED_10baseT_Half | | 1731 | cmd->advertising = ADVERTISED_10baseT_Half | |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 36da54ad2b7b..e5246f227c98 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -514,7 +514,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
514 | 514 | ||
515 | if(lpar_rc != H_Success) { | 515 | if(lpar_rc != H_Success) { |
516 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); | 516 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); |
517 | ibmveth_error_printk("buffer TCE:0x%x filter TCE:0x%x rxq desc:0x%lx MAC:0x%lx\n", | 517 | ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n", |
518 | adapter->buffer_list_dma, | 518 | adapter->buffer_list_dma, |
519 | adapter->filter_list_dma, | 519 | adapter->filter_list_dma, |
520 | rxq_desc.desc, | 520 | rxq_desc.desc, |
@@ -1174,14 +1174,16 @@ static struct vio_device_id ibmveth_device_table[] __devinitdata= { | |||
1174 | { "network", "IBM,l-lan"}, | 1174 | { "network", "IBM,l-lan"}, |
1175 | { "", "" } | 1175 | { "", "" } |
1176 | }; | 1176 | }; |
1177 | |||
1178 | MODULE_DEVICE_TABLE(vio, ibmveth_device_table); | 1177 | MODULE_DEVICE_TABLE(vio, ibmveth_device_table); |
1179 | 1178 | ||
1180 | static struct vio_driver ibmveth_driver = { | 1179 | static struct vio_driver ibmveth_driver = { |
1181 | .name = (char *)ibmveth_driver_name, | 1180 | .id_table = ibmveth_device_table, |
1182 | .id_table = ibmveth_device_table, | 1181 | .probe = ibmveth_probe, |
1183 | .probe = ibmveth_probe, | 1182 | .remove = ibmveth_remove, |
1184 | .remove = ibmveth_remove | 1183 | .driver = { |
1184 | .name = ibmveth_driver_name, | ||
1185 | .owner = THIS_MODULE, | ||
1186 | } | ||
1185 | }; | 1187 | }; |
1186 | 1188 | ||
1187 | static int __init ibmveth_module_init(void) | 1189 | static int __init ibmveth_module_init(void) |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index aef80f5e7c9c..b886b07412a6 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -704,15 +704,12 @@ static int pxa_irda_stop(struct net_device *dev) | |||
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
707 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) | 707 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state) |
708 | { | 708 | { |
709 | struct net_device *dev = dev_get_drvdata(_dev); | 709 | struct net_device *dev = dev_get_drvdata(_dev); |
710 | struct pxa_irda *si; | 710 | struct pxa_irda *si; |
711 | 711 | ||
712 | if (!dev || level != SUSPEND_DISABLE) | 712 | if (dev && netif_running(dev)) { |
713 | return 0; | ||
714 | |||
715 | if (netif_running(dev)) { | ||
716 | si = netdev_priv(dev); | 713 | si = netdev_priv(dev); |
717 | netif_device_detach(dev); | 714 | netif_device_detach(dev); |
718 | pxa_irda_shutdown(si); | 715 | pxa_irda_shutdown(si); |
@@ -721,15 +718,12 @@ static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) | |||
721 | return 0; | 718 | return 0; |
722 | } | 719 | } |
723 | 720 | ||
724 | static int pxa_irda_resume(struct device *_dev, u32 level) | 721 | static int pxa_irda_resume(struct device *_dev) |
725 | { | 722 | { |
726 | struct net_device *dev = dev_get_drvdata(_dev); | 723 | struct net_device *dev = dev_get_drvdata(_dev); |
727 | struct pxa_irda *si; | 724 | struct pxa_irda *si; |
728 | 725 | ||
729 | if (!dev || level != RESUME_ENABLE) | 726 | if (dev && netif_running(dev)) { |
730 | return 0; | ||
731 | |||
732 | if (netif_running(dev)) { | ||
733 | si = netdev_priv(dev); | 727 | si = netdev_priv(dev); |
734 | pxa_irda_startup(si); | 728 | pxa_irda_startup(si); |
735 | netif_device_attach(dev); | 729 | netif_device_attach(dev); |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index bbac720cca63..140b7cdb1f7e 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -638,21 +638,14 @@ static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self) | |||
638 | */ | 638 | */ |
639 | static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) | 639 | static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) |
640 | { | 640 | { |
641 | int iobase, ir_mode, ctrl, fast; | 641 | int iobase = self->io.fir_base; |
642 | |||
643 | IRDA_ASSERT(self != NULL, return;); | ||
644 | |||
645 | iobase = self->io.fir_base; | ||
646 | ir_mode = IRCC_CFGA_IRDA_SIR_A; | ||
647 | ctrl = 0; | ||
648 | fast = 0; | ||
649 | 642 | ||
650 | register_bank(iobase, 0); | 643 | register_bank(iobase, 0); |
651 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | 644 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); |
652 | outb(0x00, iobase + IRCC_MASTER); | 645 | outb(0x00, iobase + IRCC_MASTER); |
653 | 646 | ||
654 | register_bank(iobase, 1); | 647 | register_bank(iobase, 1); |
655 | outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | ir_mode), | 648 | outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | IRCC_CFGA_IRDA_SIR_A), |
656 | iobase + IRCC_SCE_CFGA); | 649 | iobase + IRCC_SCE_CFGA); |
657 | 650 | ||
658 | #ifdef smsc_669 /* Uses pin 88/89 for Rx/Tx */ | 651 | #ifdef smsc_669 /* Uses pin 88/89 for Rx/Tx */ |
@@ -666,10 +659,10 @@ static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) | |||
666 | outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD); | 659 | outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD); |
667 | 660 | ||
668 | register_bank(iobase, 4); | 661 | register_bank(iobase, 4); |
669 | outb((inb(iobase + IRCC_CONTROL) & 0x30) | ctrl, iobase + IRCC_CONTROL); | 662 | outb((inb(iobase + IRCC_CONTROL) & 0x30), iobase + IRCC_CONTROL); |
670 | 663 | ||
671 | register_bank(iobase, 0); | 664 | register_bank(iobase, 0); |
672 | outb(fast, iobase + IRCC_LCR_A); | 665 | outb(0, iobase + IRCC_LCR_A); |
673 | 666 | ||
674 | smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | 667 | smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); |
675 | 668 | ||
@@ -1556,6 +1549,46 @@ static int ircc_is_receiving(struct smsc_ircc_cb *self) | |||
1556 | } | 1549 | } |
1557 | #endif /* unused */ | 1550 | #endif /* unused */ |
1558 | 1551 | ||
1552 | static int smsc_ircc_request_irq(struct smsc_ircc_cb *self) | ||
1553 | { | ||
1554 | int error; | ||
1555 | |||
1556 | error = request_irq(self->io.irq, smsc_ircc_interrupt, 0, | ||
1557 | self->netdev->name, self->netdev); | ||
1558 | if (error) | ||
1559 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d, err=%d\n", | ||
1560 | __FUNCTION__, self->io.irq, error); | ||
1561 | |||
1562 | return error; | ||
1563 | } | ||
1564 | |||
1565 | static void smsc_ircc_start_interrupts(struct smsc_ircc_cb *self) | ||
1566 | { | ||
1567 | unsigned long flags; | ||
1568 | |||
1569 | spin_lock_irqsave(&self->lock, flags); | ||
1570 | |||
1571 | self->io.speed = 0; | ||
1572 | smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | ||
1573 | |||
1574 | spin_unlock_irqrestore(&self->lock, flags); | ||
1575 | } | ||
1576 | |||
1577 | static void smsc_ircc_stop_interrupts(struct smsc_ircc_cb *self) | ||
1578 | { | ||
1579 | int iobase = self->io.fir_base; | ||
1580 | unsigned long flags; | ||
1581 | |||
1582 | spin_lock_irqsave(&self->lock, flags); | ||
1583 | |||
1584 | register_bank(iobase, 0); | ||
1585 | outb(0, iobase + IRCC_IER); | ||
1586 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | ||
1587 | outb(0x00, iobase + IRCC_MASTER); | ||
1588 | |||
1589 | spin_unlock_irqrestore(&self->lock, flags); | ||
1590 | } | ||
1591 | |||
1559 | 1592 | ||
1560 | /* | 1593 | /* |
1561 | * Function smsc_ircc_net_open (dev) | 1594 | * Function smsc_ircc_net_open (dev) |
@@ -1567,7 +1600,6 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1567 | { | 1600 | { |
1568 | struct smsc_ircc_cb *self; | 1601 | struct smsc_ircc_cb *self; |
1569 | char hwname[16]; | 1602 | char hwname[16]; |
1570 | unsigned long flags; | ||
1571 | 1603 | ||
1572 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 1604 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
1573 | 1605 | ||
@@ -1575,6 +1607,11 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1575 | self = netdev_priv(dev); | 1607 | self = netdev_priv(dev); |
1576 | IRDA_ASSERT(self != NULL, return 0;); | 1608 | IRDA_ASSERT(self != NULL, return 0;); |
1577 | 1609 | ||
1610 | if (self->io.suspended) { | ||
1611 | IRDA_DEBUG(0, "%s(), device is suspended\n", __FUNCTION__); | ||
1612 | return -EAGAIN; | ||
1613 | } | ||
1614 | |||
1578 | if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, | 1615 | if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, |
1579 | (void *) dev)) { | 1616 | (void *) dev)) { |
1580 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", | 1617 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", |
@@ -1582,11 +1619,7 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1582 | return -EAGAIN; | 1619 | return -EAGAIN; |
1583 | } | 1620 | } |
1584 | 1621 | ||
1585 | spin_lock_irqsave(&self->lock, flags); | 1622 | smsc_ircc_start_interrupts(self); |
1586 | /*smsc_ircc_sir_start(self);*/ | ||
1587 | self->io.speed = 0; | ||
1588 | smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | ||
1589 | spin_unlock_irqrestore(&self->lock, flags); | ||
1590 | 1623 | ||
1591 | /* Give self a hardware name */ | 1624 | /* Give self a hardware name */ |
1592 | /* It would be cool to offer the chip revision here - Jean II */ | 1625 | /* It would be cool to offer the chip revision here - Jean II */ |
@@ -1639,7 +1672,12 @@ static int smsc_ircc_net_close(struct net_device *dev) | |||
1639 | irlap_close(self->irlap); | 1672 | irlap_close(self->irlap); |
1640 | self->irlap = NULL; | 1673 | self->irlap = NULL; |
1641 | 1674 | ||
1642 | free_irq(self->io.irq, dev); | 1675 | smsc_ircc_stop_interrupts(self); |
1676 | |||
1677 | /* if we are called from smsc_ircc_resume we don't have IRQ reserved */ | ||
1678 | if (!self->io.suspended) | ||
1679 | free_irq(self->io.irq, dev); | ||
1680 | |||
1643 | disable_dma(self->io.dma); | 1681 | disable_dma(self->io.dma); |
1644 | free_dma(self->io.dma); | 1682 | free_dma(self->io.dma); |
1645 | 1683 | ||
@@ -1650,11 +1688,18 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | |||
1650 | { | 1688 | { |
1651 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1689 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); |
1652 | 1690 | ||
1653 | IRDA_MESSAGE("%s, Suspending\n", driver_name); | ||
1654 | |||
1655 | if (!self->io.suspended) { | 1691 | if (!self->io.suspended) { |
1656 | smsc_ircc_net_close(self->netdev); | 1692 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); |
1693 | |||
1694 | rtnl_lock(); | ||
1695 | if (netif_running(self->netdev)) { | ||
1696 | netif_device_detach(self->netdev); | ||
1697 | smsc_ircc_stop_interrupts(self); | ||
1698 | free_irq(self->io.irq, self->netdev); | ||
1699 | disable_dma(self->io.dma); | ||
1700 | } | ||
1657 | self->io.suspended = 1; | 1701 | self->io.suspended = 1; |
1702 | rtnl_unlock(); | ||
1658 | } | 1703 | } |
1659 | 1704 | ||
1660 | return 0; | 1705 | return 0; |
@@ -1665,11 +1710,25 @@ static int smsc_ircc_resume(struct device *dev) | |||
1665 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1710 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); |
1666 | 1711 | ||
1667 | if (self->io.suspended) { | 1712 | if (self->io.suspended) { |
1668 | 1713 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); | |
1669 | smsc_ircc_net_open(self->netdev); | 1714 | |
1715 | rtnl_lock(); | ||
1716 | smsc_ircc_init_chip(self); | ||
1717 | if (netif_running(self->netdev)) { | ||
1718 | if (smsc_ircc_request_irq(self)) { | ||
1719 | /* | ||
1720 | * Don't fail resume process, just kill this | ||
1721 | * network interface | ||
1722 | */ | ||
1723 | unregister_netdevice(self->netdev); | ||
1724 | } else { | ||
1725 | enable_dma(self->io.dma); | ||
1726 | smsc_ircc_start_interrupts(self); | ||
1727 | netif_device_attach(self->netdev); | ||
1728 | } | ||
1729 | } | ||
1670 | self->io.suspended = 0; | 1730 | self->io.suspended = 0; |
1671 | 1731 | rtnl_unlock(); | |
1672 | IRDA_MESSAGE("%s, Waking up\n", driver_name); | ||
1673 | } | 1732 | } |
1674 | return 0; | 1733 | return 0; |
1675 | } | 1734 | } |
@@ -1682,9 +1741,6 @@ static int smsc_ircc_resume(struct device *dev) | |||
1682 | */ | 1741 | */ |
1683 | static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) | 1742 | static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) |
1684 | { | 1743 | { |
1685 | int iobase; | ||
1686 | unsigned long flags; | ||
1687 | |||
1688 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 1744 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
1689 | 1745 | ||
1690 | IRDA_ASSERT(self != NULL, return -1;); | 1746 | IRDA_ASSERT(self != NULL, return -1;); |
@@ -1694,22 +1750,7 @@ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) | |||
1694 | /* Remove netdevice */ | 1750 | /* Remove netdevice */ |
1695 | unregister_netdev(self->netdev); | 1751 | unregister_netdev(self->netdev); |
1696 | 1752 | ||
1697 | /* Make sure the irq handler is not exectuting */ | 1753 | smsc_ircc_stop_interrupts(self); |
1698 | spin_lock_irqsave(&self->lock, flags); | ||
1699 | |||
1700 | /* Stop interrupts */ | ||
1701 | iobase = self->io.fir_base; | ||
1702 | register_bank(iobase, 0); | ||
1703 | outb(0, iobase + IRCC_IER); | ||
1704 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | ||
1705 | outb(0x00, iobase + IRCC_MASTER); | ||
1706 | #if 0 | ||
1707 | /* Reset to SIR mode */ | ||
1708 | register_bank(iobase, 1); | ||
1709 | outb(IRCC_CFGA_IRDA_SIR_A|IRCC_CFGA_TX_POLARITY, iobase + IRCC_SCE_CFGA); | ||
1710 | outb(IRCC_CFGB_IR, iobase + IRCC_SCE_CFGB); | ||
1711 | #endif | ||
1712 | spin_unlock_irqrestore(&self->lock, flags); | ||
1713 | 1754 | ||
1714 | /* Release the PORTS that this driver is using */ | 1755 | /* Release the PORTS that this driver is using */ |
1715 | IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, | 1756 | IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 3d56cf5a4e23..f5ea39ff1017 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -70,8 +70,9 @@ | |||
70 | #include <linux/delay.h> | 70 | #include <linux/delay.h> |
71 | #include <linux/mm.h> | 71 | #include <linux/mm.h> |
72 | #include <linux/ethtool.h> | 72 | #include <linux/ethtool.h> |
73 | |||
74 | #include <asm/abs_addr.h> | ||
73 | #include <asm/iSeries/mf.h> | 75 | #include <asm/iSeries/mf.h> |
74 | #include <asm/iSeries/iSeries_pci.h> | ||
75 | #include <asm/uaccess.h> | 76 | #include <asm/uaccess.h> |
76 | 77 | ||
77 | #include <asm/iSeries/HvLpConfig.h> | 78 | #include <asm/iSeries/HvLpConfig.h> |
@@ -1397,13 +1398,13 @@ static inline void veth_build_dma_list(struct dma_chunk *list, | |||
1397 | * it just at the granularity of iSeries real->absolute | 1398 | * it just at the granularity of iSeries real->absolute |
1398 | * mapping? Indeed, given the way the allocator works, can we | 1399 | * mapping? Indeed, given the way the allocator works, can we |
1399 | * count on them being absolutely contiguous? */ | 1400 | * count on them being absolutely contiguous? */ |
1400 | list[0].addr = ISERIES_HV_ADDR(p); | 1401 | list[0].addr = iseries_hv_addr(p); |
1401 | list[0].size = min(length, | 1402 | list[0].size = min(length, |
1402 | PAGE_SIZE - ((unsigned long)p & ~PAGE_MASK)); | 1403 | PAGE_SIZE - ((unsigned long)p & ~PAGE_MASK)); |
1403 | 1404 | ||
1404 | done = list[0].size; | 1405 | done = list[0].size; |
1405 | while (done < length) { | 1406 | while (done < length) { |
1406 | list[i].addr = ISERIES_HV_ADDR(p + done); | 1407 | list[i].addr = iseries_hv_addr(p + done); |
1407 | list[i].size = min(length-done, PAGE_SIZE); | 1408 | list[i].size = min(length-done, PAGE_SIZE); |
1408 | done += list[i].size; | 1409 | done += list[i].size; |
1409 | i++; | 1410 | i++; |
@@ -1496,8 +1497,8 @@ static void veth_receive(struct veth_lpar_connection *cnx, | |||
1496 | cnx->dst_inst, | 1497 | cnx->dst_inst, |
1497 | HvLpDma_AddressType_RealAddress, | 1498 | HvLpDma_AddressType_RealAddress, |
1498 | HvLpDma_AddressType_TceIndex, | 1499 | HvLpDma_AddressType_TceIndex, |
1499 | ISERIES_HV_ADDR(&local_list), | 1500 | iseries_hv_addr(&local_list), |
1500 | ISERIES_HV_ADDR(&remote_list), | 1501 | iseries_hv_addr(&remote_list), |
1501 | length); | 1502 | length); |
1502 | if (rc != HvLpDma_Rc_Good) { | 1503 | if (rc != HvLpDma_Rc_Good) { |
1503 | dev_kfree_skb_irq(skb); | 1504 | dev_kfree_skb_irq(skb); |
@@ -1647,10 +1648,13 @@ static struct vio_device_id veth_device_table[] __devinitdata = { | |||
1647 | MODULE_DEVICE_TABLE(vio, veth_device_table); | 1648 | MODULE_DEVICE_TABLE(vio, veth_device_table); |
1648 | 1649 | ||
1649 | static struct vio_driver veth_driver = { | 1650 | static struct vio_driver veth_driver = { |
1650 | .name = DRV_NAME, | ||
1651 | .id_table = veth_device_table, | 1651 | .id_table = veth_device_table, |
1652 | .probe = veth_probe, | 1652 | .probe = veth_probe, |
1653 | .remove = veth_remove | 1653 | .remove = veth_remove, |
1654 | .driver = { | ||
1655 | .name = DRV_NAME, | ||
1656 | .owner = THIS_MODULE, | ||
1657 | } | ||
1654 | }; | 1658 | }; |
1655 | 1659 | ||
1656 | /* | 1660 | /* |
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 09b1e7b364e5..2a5add257b8f 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -1016,6 +1016,7 @@ static struct of_device_id mace_match[] = | |||
1016 | }, | 1016 | }, |
1017 | {}, | 1017 | {}, |
1018 | }; | 1018 | }; |
1019 | MODULE_DEVICE_TABLE (of, mace_match); | ||
1019 | 1020 | ||
1020 | static struct macio_driver mace_driver = | 1021 | static struct macio_driver mace_driver = |
1021 | { | 1022 | { |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 25c9a99c377b..8fbba21d975b 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1533,6 +1533,9 @@ static int mv643xx_eth_probe(struct device *ddev) | |||
1533 | printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name); | 1533 | printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name); |
1534 | #endif | 1534 | #endif |
1535 | 1535 | ||
1536 | if (mp->tx_sram_size > 0) | ||
1537 | printk(KERN_NOTICE "%s: Using SRAM\n", dev->name); | ||
1538 | |||
1536 | return 0; | 1539 | return 0; |
1537 | 1540 | ||
1538 | out: | 1541 | out: |
diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c index f17c05cbe44b..99a776a51fb5 100644 --- a/drivers/net/skfp/smt.c +++ b/drivers/net/skfp/smt.c | |||
@@ -1896,7 +1896,7 @@ void smt_swap_para(struct smt_header *sm, int len, int direction) | |||
1896 | 1896 | ||
1897 | static void smt_string_swap(char *data, const char *format, int len) | 1897 | static void smt_string_swap(char *data, const char *format, int len) |
1898 | { | 1898 | { |
1899 | const char *open_paren = 0 ; | 1899 | const char *open_paren = NULL ; |
1900 | int x ; | 1900 | int x ; |
1901 | 1901 | ||
1902 | while (len > 0 && *format) { | 1902 | while (len > 0 && *format) { |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index ac9ce6509eee..817f200742c3 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -230,12 +230,12 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
230 | #define SMC_CAN_USE_16BIT 1 | 230 | #define SMC_CAN_USE_16BIT 1 |
231 | #define SMC_CAN_USE_32BIT 0 | 231 | #define SMC_CAN_USE_32BIT 0 |
232 | 232 | ||
233 | #define SMC_inb(a, r) inb((a) + (r) - 0xa0000000) | 233 | #define SMC_inb(a, r) inb((u32)a) + (r)) |
234 | #define SMC_inw(a, r) inw((a) + (r) - 0xa0000000) | 234 | #define SMC_inw(a, r) inw(((u32)a) + (r)) |
235 | #define SMC_outb(v, a, r) outb(v, (a) + (r) - 0xa0000000) | 235 | #define SMC_outb(v, a, r) outb(v, ((u32)a) + (r)) |
236 | #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000) | 236 | #define SMC_outw(v, a, r) outw(v, ((u32)a) + (r)) |
237 | #define SMC_insw(a, r, p, l) insw((a) + (r) - 0xa0000000, p, l) | 237 | #define SMC_insw(a, r, p, l) insw(((u32)a) + (r), p, l) |
238 | #define SMC_outsw(a, r, p, l) outsw((a) + (r) - 0xa0000000, p, l) | 238 | #define SMC_outsw(a, r, p, l) outsw(((u32)a) + (r), p, l) |
239 | 239 | ||
240 | #define set_irq_type(irq, type) do {} while(0) | 240 | #define set_irq_type(irq, type) do {} while(0) |
241 | 241 | ||
diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c index 4937a5ad4b2c..6a60c5970cb5 100644 --- a/drivers/net/wireless/prism54/islpci_mgt.c +++ b/drivers/net/wireless/prism54/islpci_mgt.c | |||
@@ -137,7 +137,7 @@ islpci_mgmt_rx_fill(struct net_device *ndev) | |||
137 | PCI_DMA_FROMDEVICE); | 137 | PCI_DMA_FROMDEVICE); |
138 | if (!buf->pci_addr) { | 138 | if (!buf->pci_addr) { |
139 | printk(KERN_WARNING | 139 | printk(KERN_WARNING |
140 | "Failed to make memory DMA'able\n."); | 140 | "Failed to make memory DMA'able.\n"); |
141 | return -ENOMEM; | 141 | return -ENOMEM; |
142 | } | 142 | } |
143 | } | 143 | } |
diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c index a62a4345b466..2d4639d6841f 100644 --- a/drivers/pci/hotplug/cpcihp_generic.c +++ b/drivers/pci/hotplug/cpcihp_generic.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
42 | #include <linux/string.h> | ||
42 | #include "cpci_hotplug.h" | 43 | #include "cpci_hotplug.h" |
43 | 44 | ||
44 | #define DRIVER_VERSION "0.1" | 45 | #define DRIVER_VERSION "0.1" |
diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c index 790abadd816c..f7cb00da38df 100644 --- a/drivers/pci/hotplug/cpcihp_zt5550.c +++ b/drivers/pci/hotplug/cpcihp_zt5550.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/signal.h> /* SA_SHIRQ */ | ||
39 | #include "cpci_hotplug.h" | 40 | #include "cpci_hotplug.h" |
40 | #include "cpcihp_zt5550.h" | 41 | #include "cpcihp_zt5550.h" |
41 | 42 | ||
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c index 8e47fa66e25e..060d74775d7b 100644 --- a/drivers/pci/hotplug/fakephp.c +++ b/drivers/pci/hotplug/fakephp.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/string.h> | ||
41 | #include <linux/slab.h> | ||
40 | #include "pci_hotplug.h" | 42 | #include "pci_hotplug.h" |
41 | #include "../pci.h" | 43 | #include "../pci.h" |
42 | 44 | ||
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 0392e004258f..aabf1e70b528 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
@@ -1077,7 +1077,7 @@ static int enable_slot(struct hotplug_slot *hs) | |||
1077 | if (rc) { | 1077 | if (rc) { |
1078 | err("Adding this card exceeds the limitations of this bus.\n"); | 1078 | err("Adding this card exceeds the limitations of this bus.\n"); |
1079 | err("(i.e., >1 133MHz cards running on same bus, or " | 1079 | err("(i.e., >1 133MHz cards running on same bus, or " |
1080 | ">2 66 PCI cards running on same bus\n."); | 1080 | ">2 66 PCI cards running on same bus.\n"); |
1081 | err("Try hot-adding into another bus\n"); | 1081 | err("Try hot-adding into another bus\n"); |
1082 | rc = -EINVAL; | 1082 | rc = -EINVAL; |
1083 | goto error_nopower; | 1083 | goto error_nopower; |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 33b539b34f7e..ff17d8e07e94 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -113,7 +113,7 @@ int pciehp_unconfigure_device(struct pci_func* func) | |||
113 | */ | 113 | */ |
114 | int pciehp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) | 114 | int pciehp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) |
115 | { | 115 | { |
116 | #if defined(CONFIG_X86) && !defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_64) | 116 | #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_IO_APIC) |
117 | int rc; | 117 | int rc; |
118 | u16 temp_word; | 118 | u16 temp_word; |
119 | struct pci_dev fakedev; | 119 | struct pci_dev fakedev; |
diff --git a/drivers/pci/hotplug/pciehprm_nonacpi.c b/drivers/pci/hotplug/pciehprm_nonacpi.c index 3622965f8961..33b2c69a0829 100644 --- a/drivers/pci/hotplug/pciehprm_nonacpi.c +++ b/drivers/pci/hotplug/pciehprm_nonacpi.c | |||
@@ -33,10 +33,13 @@ | |||
33 | #include <linux/types.h> | 33 | #include <linux/types.h> |
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/slab.h> | ||
37 | |||
36 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
37 | #ifdef CONFIG_IA64 | 39 | #ifdef CONFIG_IA64 |
38 | #include <asm/iosapic.h> | 40 | #include <asm/iosapic.h> |
39 | #endif | 41 | #endif |
42 | |||
40 | #include "pciehp.h" | 43 | #include "pciehp.h" |
41 | #include "pciehprm.h" | 44 | #include "pciehprm.h" |
42 | #include "pciehprm_nonacpi.h" | 45 | #include "pciehprm_nonacpi.h" |
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index ad1017da8656..fcb66b9a0e28 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -16,10 +16,13 @@ | |||
16 | */ | 16 | */ |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/string.h> | ||
20 | |||
19 | #include <asm/pci-bridge.h> | 21 | #include <asm/pci-bridge.h> |
20 | #include <asm/semaphore.h> | 22 | #include <asm/semaphore.h> |
21 | #include <asm/rtas.h> | 23 | #include <asm/rtas.h> |
22 | #include <asm/vio.h> | 24 | #include <asm/vio.h> |
25 | |||
23 | #include "../pci.h" | 26 | #include "../pci.h" |
24 | #include "rpaphp.h" | 27 | #include "rpaphp.h" |
25 | #include "rpadlpar.h" | 28 | #include "rpadlpar.h" |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 46c157d26a2f..f7c12d7dfcfc 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -23,11 +23,13 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/string.h> | ||
27 | |||
26 | #include <asm/pci-bridge.h> | 28 | #include <asm/pci-bridge.h> |
27 | #include <asm/rtas.h> | 29 | #include <asm/rtas.h> |
28 | #include <asm/machdep.h> | 30 | #include <asm/machdep.h> |
29 | #include "../pci.h" /* for pci_add_new_bus */ | ||
30 | 31 | ||
32 | #include "../pci.h" /* for pci_add_new_bus */ | ||
31 | #include "rpaphp.h" | 33 | #include "rpaphp.h" |
32 | 34 | ||
33 | static struct pci_bus *find_bus_among_children(struct pci_bus *bus, | 35 | static struct pci_bus *find_bus_among_children(struct pci_bus *bus, |
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 0e8815495083..daa89ae57123 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c | |||
@@ -27,6 +27,9 @@ | |||
27 | #include <linux/kobject.h> | 27 | #include <linux/kobject.h> |
28 | #include <linux/sysfs.h> | 28 | #include <linux/sysfs.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/string.h> | ||
31 | #include <linux/slab.h> | ||
32 | |||
30 | #include <asm/rtas.h> | 33 | #include <asm/rtas.h> |
31 | #include "rpaphp.h" | 34 | #include "rpaphp.h" |
32 | 35 | ||
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index abe2cf411e68..08ad26a0cae7 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/sched.h> /* signal_pending(), struct timer_list */ | ||
36 | |||
35 | #include "pci_hotplug.h" | 37 | #include "pci_hotplug.h" |
36 | 38 | ||
37 | #if !defined(MODULE) | 39 | #if !defined(MODULE) |
diff --git a/drivers/pci/hotplug/shpchprm_nonacpi.c b/drivers/pci/hotplug/shpchprm_nonacpi.c index d70fe5408417..c6b40998eeb3 100644 --- a/drivers/pci/hotplug/shpchprm_nonacpi.c +++ b/drivers/pci/hotplug/shpchprm_nonacpi.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/types.h> | 33 | #include <linux/types.h> |
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <linux/slab.h> | ||
36 | |||
35 | #include "shpchp.h" | 37 | #include "shpchp.h" |
36 | 38 | ||
37 | int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) | 39 | int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 8972e6a3aac0..ae986e590b48 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/device.h> | 9 | #include <linux/device.h> |
10 | #include <linux/mempolicy.h> | 10 | #include <linux/mempolicy.h> |
11 | #include <linux/string.h> | ||
12 | #include <linux/slab.h> | ||
11 | #include "pci.h" | 13 | #include "pci.h" |
12 | 14 | ||
13 | /* | 15 | /* |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 61b855c99e39..e74d75843047 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <linux/string.h> | ||
18 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ | 19 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ |
19 | #include "pci.h" | 20 | #include "pci.h" |
20 | 21 | ||
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 14f05d22bb70..467a4ceccf10 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
14 | #include <linux/string.h> | ||
15 | #include <linux/slab.h> | ||
14 | #include <linux/pcieport_if.h> | 16 | #include <linux/pcieport_if.h> |
15 | 17 | ||
16 | #include "portdrv.h" | 18 | #include "portdrv.h" |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 3c565ce7f77b..02260141dc81 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/pcieport_if.h> | 16 | #include <linux/pcieport_if.h> |
16 | 17 | ||
17 | #include "portdrv.h" | 18 | #include "portdrv.h" |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index bbd9c2323d8c..5627ce1d2b32 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -356,7 +356,7 @@ static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int | |||
356 | /* | 356 | /* |
357 | * PIIX4 ACPI: Two IO regions pointed to by longwords at | 357 | * PIIX4 ACPI: Two IO regions pointed to by longwords at |
358 | * 0x40 (64 bytes of ACPI registers) | 358 | * 0x40 (64 bytes of ACPI registers) |
359 | * 0x90 (32 bytes of SMB registers) | 359 | * 0x90 (16 bytes of SMB registers) |
360 | * and a few strange programmable PIIX4 device resources. | 360 | * and a few strange programmable PIIX4 device resources. |
361 | */ | 361 | */ |
362 | static void __devinit quirk_piix4_acpi(struct pci_dev *dev) | 362 | static void __devinit quirk_piix4_acpi(struct pci_dev *dev) |
@@ -366,7 +366,7 @@ static void __devinit quirk_piix4_acpi(struct pci_dev *dev) | |||
366 | pci_read_config_dword(dev, 0x40, ®ion); | 366 | pci_read_config_dword(dev, 0x40, ®ion); |
367 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI"); | 367 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI"); |
368 | pci_read_config_dword(dev, 0x90, ®ion); | 368 | pci_read_config_dword(dev, 0x90, ®ion); |
369 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB"); | 369 | quirk_io_region(dev, region, 16, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB"); |
370 | 370 | ||
371 | /* Device resource A has enables for some of the other ones */ | 371 | /* Device resource A has enables for some of the other ones */ |
372 | pci_read_config_dword(dev, 0x5c, &res_a); | 372 | pci_read_config_dword(dev, 0x5c, &res_a); |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 49bd21702314..598a115cd00e 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/config.h> | 9 | #include <linux/config.h> |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
12 | #include <linux/slab.h> | ||
12 | 13 | ||
13 | #include "pci.h" | 14 | #include "pci.h" |
14 | 15 | ||
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 36cc9a96a338..ccf20039e909 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -154,6 +154,16 @@ config TCIC | |||
154 | "Bridge" is the name used for the hardware inside your computer that | 154 | "Bridge" is the name used for the hardware inside your computer that |
155 | PCMCIA cards are plugged into. If unsure, say N. | 155 | PCMCIA cards are plugged into. If unsure, say N. |
156 | 156 | ||
157 | config PCMCIA_M8XX | ||
158 | tristate "MPC8xx PCMCIA support" | ||
159 | depends on PCMCIA && PPC | ||
160 | select PCCARD_NONSTATIC | ||
161 | help | ||
162 | Say Y here to include support for PowerPC 8xx series PCMCIA | ||
163 | controller. | ||
164 | |||
165 | This driver is also available as a module called m8xx_pcmcia. | ||
166 | |||
157 | config HD64465_PCMCIA | 167 | config HD64465_PCMCIA |
158 | tristate "HD64465 host bridge support" | 168 | tristate "HD64465 host bridge support" |
159 | depends on HD64465 && PCMCIA | 169 | depends on HD64465 && PCMCIA |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 77ecee7f987b..fe37541abbfe 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -25,6 +25,7 @@ obj-$(CONFIG_PD6729) += pd6729.o | |||
25 | obj-$(CONFIG_I82365) += i82365.o | 25 | obj-$(CONFIG_I82365) += i82365.o |
26 | obj-$(CONFIG_I82092) += i82092.o | 26 | obj-$(CONFIG_I82092) += i82092.o |
27 | obj-$(CONFIG_TCIC) += tcic.o | 27 | obj-$(CONFIG_TCIC) += tcic.o |
28 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o | ||
28 | obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o | 29 | obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o |
29 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o | 30 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o |
30 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o | 31 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o |
@@ -59,6 +60,7 @@ sa1111_cs-$(CONFIG_SA1100_JORNADA720) += sa1100_jornada720.o | |||
59 | sa1100_cs-y += sa1100_generic.o | 60 | sa1100_cs-y += sa1100_generic.o |
60 | sa1100_cs-$(CONFIG_SA1100_ASSABET) += sa1100_assabet.o | 61 | sa1100_cs-$(CONFIG_SA1100_ASSABET) += sa1100_assabet.o |
61 | sa1100_cs-$(CONFIG_SA1100_CERF) += sa1100_cerf.o | 62 | sa1100_cs-$(CONFIG_SA1100_CERF) += sa1100_cerf.o |
63 | sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o | ||
62 | sa1100_cs-$(CONFIG_SA1100_H3600) += sa1100_h3600.o | 64 | sa1100_cs-$(CONFIG_SA1100_H3600) += sa1100_h3600.o |
63 | sa1100_cs-$(CONFIG_SA1100_SHANNON) += sa1100_shannon.o | 65 | sa1100_cs-$(CONFIG_SA1100_SHANNON) += sa1100_shannon.o |
64 | sa1100_cs-$(CONFIG_SA1100_SIMPAD) += sa1100_simpad.o | 66 | sa1100_cs-$(CONFIG_SA1100_SIMPAD) += sa1100_simpad.o |
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c new file mode 100644 index 000000000000..f8bed87cf2f1 --- /dev/null +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -0,0 +1,1290 @@ | |||
1 | /* | ||
2 | * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series. | ||
3 | * | ||
4 | * (C) 1999-2000 Magnus Damm <damm@bitsmart.com> | ||
5 | * (C) 2001-2002 Montavista Software, Inc. | ||
6 | * <mlocke@mvista.com> | ||
7 | * | ||
8 | * Support for two slots by Cyclades Corporation | ||
9 | * <oliver.kurth@cyclades.de> | ||
10 | * Further fixes, v2.6 kernel port | ||
11 | * <marcelo.tosatti@cyclades.com> | ||
12 | * | ||
13 | * "The ExCA standard specifies that socket controllers should provide | ||
14 | * two IO and five memory windows per socket, which can be independently | ||
15 | * configured and positioned in the host address space and mapped to | ||
16 | * arbitrary segments of card address space. " - David A Hinds. 1999 | ||
17 | * | ||
18 | * This controller does _not_ meet the ExCA standard. | ||
19 | * | ||
20 | * m8xx pcmcia controller brief info: | ||
21 | * + 8 windows (attrib, mem, i/o) | ||
22 | * + up to two slots (SLOT_A and SLOT_B) | ||
23 | * + inputpins, outputpins, event and mask registers. | ||
24 | * - no offset register. sigh. | ||
25 | * | ||
26 | * Because of the lacking offset register we must map the whole card. | ||
27 | * We assign each memory window PCMCIA_MEM_WIN_SIZE address space. | ||
28 | * Make sure there is (PCMCIA_MEM_WIN_SIZE * PCMCIA_MEM_WIN_NO | ||
29 | * * PCMCIA_SOCKETS_NO) bytes at PCMCIA_MEM_WIN_BASE. | ||
30 | * The i/o windows are dynamically allocated at PCMCIA_IO_WIN_BASE. | ||
31 | * They are maximum 64KByte each... | ||
32 | */ | ||
33 | |||
34 | #include <linux/module.h> | ||
35 | #include <linux/init.h> | ||
36 | #include <linux/types.h> | ||
37 | #include <linux/fcntl.h> | ||
38 | #include <linux/string.h> | ||
39 | |||
40 | #include <asm/io.h> | ||
41 | #include <asm/bitops.h> | ||
42 | #include <asm/segment.h> | ||
43 | #include <asm/system.h> | ||
44 | |||
45 | #include <linux/kernel.h> | ||
46 | #include <linux/errno.h> | ||
47 | #include <linux/sched.h> | ||
48 | #include <linux/slab.h> | ||
49 | #include <linux/timer.h> | ||
50 | #include <linux/ioport.h> | ||
51 | #include <linux/delay.h> | ||
52 | #include <linux/interrupt.h> | ||
53 | |||
54 | #include <asm/mpc8xx.h> | ||
55 | #include <asm/8xx_immap.h> | ||
56 | #include <asm/irq.h> | ||
57 | |||
58 | #include <pcmcia/version.h> | ||
59 | #include <pcmcia/cs_types.h> | ||
60 | #include <pcmcia/cs.h> | ||
61 | #include <pcmcia/ss.h> | ||
62 | |||
63 | #ifdef PCMCIA_DEBUG | ||
64 | static int pc_debug = PCMCIA_DEBUG; | ||
65 | module_param(pc_debug, int, 0); | ||
66 | #define dprintk(args...) printk(KERN_DEBUG "m8xx_pcmcia: " args); | ||
67 | #else | ||
68 | #define dprintk(args...) | ||
69 | #endif | ||
70 | |||
71 | #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args) | ||
72 | #define pcmcia_error(args...) printk(KERN_ERR "m8xx_pcmcia: "args) | ||
73 | |||
74 | static const char *version = "Version 0.06, Aug 2005"; | ||
75 | MODULE_LICENSE("Dual MPL/GPL"); | ||
76 | |||
77 | #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) | ||
78 | |||
79 | /* The RPX series use SLOT_B */ | ||
80 | #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE) | ||
81 | #define CONFIG_PCMCIA_SLOT_B | ||
82 | #define CONFIG_BD_IS_MHZ | ||
83 | #endif | ||
84 | |||
85 | /* The ADS board use SLOT_A */ | ||
86 | #ifdef CONFIG_ADS | ||
87 | #define CONFIG_PCMCIA_SLOT_A | ||
88 | #define CONFIG_BD_IS_MHZ | ||
89 | #endif | ||
90 | |||
91 | /* The FADS series are a mess */ | ||
92 | #ifdef CONFIG_FADS | ||
93 | #if defined(CONFIG_MPC860T) || defined(CONFIG_MPC860) || defined(CONFIG_MPC821) | ||
94 | #define CONFIG_PCMCIA_SLOT_A | ||
95 | #else | ||
96 | #define CONFIG_PCMCIA_SLOT_B | ||
97 | #endif | ||
98 | #endif | ||
99 | |||
100 | /* Cyclades ACS uses both slots */ | ||
101 | #ifdef CONFIG_PRxK | ||
102 | #define CONFIG_PCMCIA_SLOT_A | ||
103 | #define CONFIG_PCMCIA_SLOT_B | ||
104 | #endif | ||
105 | |||
106 | #endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ | ||
107 | |||
108 | #if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B) | ||
109 | |||
110 | #define PCMCIA_SOCKETS_NO 2 | ||
111 | /* We have only 8 windows, dualsocket support will be limited. */ | ||
112 | #define PCMCIA_MEM_WIN_NO 2 | ||
113 | #define PCMCIA_IO_WIN_NO 2 | ||
114 | #define PCMCIA_SLOT_MSG "SLOT_A and SLOT_B" | ||
115 | |||
116 | #elif defined(CONFIG_PCMCIA_SLOT_A) || defined(CONFIG_PCMCIA_SLOT_B) | ||
117 | |||
118 | #define PCMCIA_SOCKETS_NO 1 | ||
119 | /* full support for one slot */ | ||
120 | #define PCMCIA_MEM_WIN_NO 5 | ||
121 | #define PCMCIA_IO_WIN_NO 2 | ||
122 | |||
123 | /* define _slot_ to be able to optimize macros */ | ||
124 | |||
125 | #ifdef CONFIG_PCMCIA_SLOT_A | ||
126 | #define _slot_ 0 | ||
127 | #define PCMCIA_SLOT_MSG "SLOT_A" | ||
128 | #else | ||
129 | #define _slot_ 1 | ||
130 | #define PCMCIA_SLOT_MSG "SLOT_B" | ||
131 | #endif | ||
132 | |||
133 | #else | ||
134 | #error m8xx_pcmcia: Bad configuration! | ||
135 | #endif | ||
136 | |||
137 | /* ------------------------------------------------------------------------- */ | ||
138 | |||
139 | #define PCMCIA_MEM_WIN_BASE 0xe0000000 /* base address for memory window 0 */ | ||
140 | #define PCMCIA_MEM_WIN_SIZE 0x04000000 /* each memory window is 64 MByte */ | ||
141 | #define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */ | ||
142 | |||
143 | #define PCMCIA_SCHLVL PCMCIA_INTERRUPT /* Status Change Interrupt Level */ | ||
144 | |||
145 | /* ------------------------------------------------------------------------- */ | ||
146 | |||
147 | /* 2.4.x and newer has this always in HZ */ | ||
148 | #define M8XX_BUSFREQ ((((bd_t *)&(__res))->bi_busfreq)) | ||
149 | |||
150 | static int pcmcia_schlvl = PCMCIA_SCHLVL; | ||
151 | |||
152 | static spinlock_t events_lock = SPIN_LOCK_UNLOCKED; | ||
153 | |||
154 | |||
155 | #define PCMCIA_SOCKET_KEY_5V 1 | ||
156 | #define PCMCIA_SOCKET_KEY_LV 2 | ||
157 | |||
158 | /* look up table for pgcrx registers */ | ||
159 | static u32 *m8xx_pgcrx[2] = { | ||
160 | &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pgcra, | ||
161 | &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pgcrb | ||
162 | }; | ||
163 | |||
164 | /* | ||
165 | * This structure is used to address each window in the PCMCIA controller. | ||
166 | * | ||
167 | * Keep in mind that we assume that pcmcia_win[n+1] is mapped directly | ||
168 | * after pcmcia_win[n]... | ||
169 | */ | ||
170 | |||
171 | struct pcmcia_win { | ||
172 | u32 br; | ||
173 | u32 or; | ||
174 | }; | ||
175 | |||
176 | /* | ||
177 | * For some reason the hardware guys decided to make both slots share | ||
178 | * some registers. | ||
179 | * | ||
180 | * Could someone invent object oriented hardware ? | ||
181 | * | ||
182 | * The macros are used to get the right bit from the registers. | ||
183 | * SLOT_A : slot = 0 | ||
184 | * SLOT_B : slot = 1 | ||
185 | */ | ||
186 | |||
187 | #define M8XX_PCMCIA_VS1(slot) (0x80000000 >> (slot << 4)) | ||
188 | #define M8XX_PCMCIA_VS2(slot) (0x40000000 >> (slot << 4)) | ||
189 | #define M8XX_PCMCIA_VS_MASK(slot) (0xc0000000 >> (slot << 4)) | ||
190 | #define M8XX_PCMCIA_VS_SHIFT(slot) (30 - (slot << 4)) | ||
191 | |||
192 | #define M8XX_PCMCIA_WP(slot) (0x20000000 >> (slot << 4)) | ||
193 | #define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4)) | ||
194 | #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4)) | ||
195 | #define M8XX_PCMCIA_BVD2(slot) (0x04000000 >> (slot << 4)) | ||
196 | #define M8XX_PCMCIA_BVD1(slot) (0x02000000 >> (slot << 4)) | ||
197 | #define M8XX_PCMCIA_RDY(slot) (0x01000000 >> (slot << 4)) | ||
198 | #define M8XX_PCMCIA_RDY_L(slot) (0x00800000 >> (slot << 4)) | ||
199 | #define M8XX_PCMCIA_RDY_H(slot) (0x00400000 >> (slot << 4)) | ||
200 | #define M8XX_PCMCIA_RDY_R(slot) (0x00200000 >> (slot << 4)) | ||
201 | #define M8XX_PCMCIA_RDY_F(slot) (0x00100000 >> (slot << 4)) | ||
202 | #define M8XX_PCMCIA_MASK(slot) (0xFFFF0000 >> (slot << 4)) | ||
203 | |||
204 | #define M8XX_PCMCIA_POR_VALID 0x00000001 | ||
205 | #define M8XX_PCMCIA_POR_WRPROT 0x00000002 | ||
206 | #define M8XX_PCMCIA_POR_ATTRMEM 0x00000010 | ||
207 | #define M8XX_PCMCIA_POR_IO 0x00000018 | ||
208 | #define M8XX_PCMCIA_POR_16BIT 0x00000040 | ||
209 | |||
210 | #define M8XX_PGCRX(slot) m8xx_pgcrx[slot] | ||
211 | |||
212 | #define M8XX_PGCRX_CXOE 0x00000080 | ||
213 | #define M8XX_PGCRX_CXRESET 0x00000040 | ||
214 | |||
215 | /* we keep one lookup table per socket to check flags */ | ||
216 | |||
217 | #define PCMCIA_EVENTS_MAX 5 /* 4 max at a time + termination */ | ||
218 | |||
219 | struct event_table { | ||
220 | u32 regbit; | ||
221 | u32 eventbit; | ||
222 | }; | ||
223 | |||
224 | struct socket_info { | ||
225 | void (*handler)(void *info, u32 events); | ||
226 | void *info; | ||
227 | |||
228 | u32 slot; | ||
229 | |||
230 | socket_state_t state; | ||
231 | struct pccard_mem_map mem_win[PCMCIA_MEM_WIN_NO]; | ||
232 | struct pccard_io_map io_win[PCMCIA_IO_WIN_NO]; | ||
233 | struct event_table events[PCMCIA_EVENTS_MAX]; | ||
234 | struct pcmcia_socket socket; | ||
235 | }; | ||
236 | |||
237 | static struct socket_info socket[PCMCIA_SOCKETS_NO]; | ||
238 | |||
239 | /* | ||
240 | * Search this table to see if the windowsize is | ||
241 | * supported... | ||
242 | */ | ||
243 | |||
244 | #define M8XX_SIZES_NO 32 | ||
245 | |||
246 | static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = | ||
247 | { | ||
248 | 0x00000001, 0x00000002, 0x00000008, 0x00000004, | ||
249 | 0x00000080, 0x00000040, 0x00000010, 0x00000020, | ||
250 | 0x00008000, 0x00004000, 0x00001000, 0x00002000, | ||
251 | 0x00000100, 0x00000200, 0x00000800, 0x00000400, | ||
252 | |||
253 | 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff, | ||
254 | 0x01000000, 0x02000000, 0xffffffff, 0x04000000, | ||
255 | 0x00010000, 0x00020000, 0x00080000, 0x00040000, | ||
256 | 0x00800000, 0x00400000, 0x00100000, 0x00200000 | ||
257 | }; | ||
258 | |||
259 | /* ------------------------------------------------------------------------- */ | ||
260 | |||
261 | static irqreturn_t m8xx_interrupt(int irq, void *dev, struct pt_regs *regs); | ||
262 | |||
263 | #define PCMCIA_BMT_LIMIT (15*4) /* Bus Monitor Timeout value */ | ||
264 | |||
265 | /* ------------------------------------------------------------------------- */ | ||
266 | /* board specific stuff: */ | ||
267 | /* voltage_set(), hardware_enable() and hardware_disable() */ | ||
268 | /* ------------------------------------------------------------------------- */ | ||
269 | /* RPX Boards from Embedded Planet */ | ||
270 | |||
271 | #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE) | ||
272 | |||
273 | /* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks. | ||
274 | * SYPCR is write once only, therefore must the slowest memory be faster | ||
275 | * than the bus monitor or we will get a machine check due to the bus timeout. | ||
276 | */ | ||
277 | |||
278 | #define PCMCIA_BOARD_MSG "RPX CLASSIC or RPX LITE" | ||
279 | |||
280 | #undef PCMCIA_BMT_LIMIT | ||
281 | #define PCMCIA_BMT_LIMIT (6*8) | ||
282 | |||
283 | static int voltage_set(int slot, int vcc, int vpp) | ||
284 | { | ||
285 | u32 reg = 0; | ||
286 | |||
287 | switch(vcc) { | ||
288 | case 0: break; | ||
289 | case 33: | ||
290 | reg |= BCSR1_PCVCTL4; | ||
291 | break; | ||
292 | case 50: | ||
293 | reg |= BCSR1_PCVCTL5; | ||
294 | break; | ||
295 | default: | ||
296 | return 1; | ||
297 | } | ||
298 | |||
299 | switch(vpp) { | ||
300 | case 0: break; | ||
301 | case 33: | ||
302 | case 50: | ||
303 | if(vcc == vpp) | ||
304 | reg |= BCSR1_PCVCTL6; | ||
305 | else | ||
306 | return 1; | ||
307 | break; | ||
308 | case 120: | ||
309 | reg |= BCSR1_PCVCTL7; | ||
310 | default: | ||
311 | return 1; | ||
312 | } | ||
313 | |||
314 | if(!((vcc == 50) || (vcc == 0))) | ||
315 | return 1; | ||
316 | |||
317 | /* first, turn off all power */ | ||
318 | |||
319 | out_be32(((u32 *)RPX_CSR_ADDR), in_be32(((u32 *)RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7)); | ||
320 | |||
321 | /* enable new powersettings */ | ||
322 | |||
323 | out_be32(((u32 *)RPX_CSR_ADDR), in_be32(((u32 *)RPX_CSR_ADDR)) | reg); | ||
324 | |||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V | ||
329 | #define hardware_enable(_slot_) /* No hardware to enable */ | ||
330 | #define hardware_disable(_slot_) /* No hardware to disable */ | ||
331 | |||
332 | #endif /* CONFIG_RPXCLASSIC */ | ||
333 | |||
334 | /* FADS Boards from Motorola */ | ||
335 | |||
336 | #if defined(CONFIG_FADS) | ||
337 | |||
338 | #define PCMCIA_BOARD_MSG "FADS" | ||
339 | |||
340 | static int voltage_set(int slot, int vcc, int vpp) | ||
341 | { | ||
342 | u32 reg = 0; | ||
343 | |||
344 | switch(vcc) { | ||
345 | case 0: | ||
346 | break; | ||
347 | case 33: | ||
348 | reg |= BCSR1_PCCVCC0; | ||
349 | break; | ||
350 | case 50: | ||
351 | reg |= BCSR1_PCCVCC1; | ||
352 | break; | ||
353 | default: | ||
354 | return 1; | ||
355 | } | ||
356 | |||
357 | switch(vpp) { | ||
358 | case 0: | ||
359 | break; | ||
360 | case 33: | ||
361 | case 50: | ||
362 | if(vcc == vpp) | ||
363 | reg |= BCSR1_PCCVPP1; | ||
364 | else | ||
365 | return 1; | ||
366 | break; | ||
367 | case 120: | ||
368 | if ((vcc == 33) || (vcc == 50)) | ||
369 | reg |= BCSR1_PCCVPP0; | ||
370 | else | ||
371 | return 1; | ||
372 | default: | ||
373 | return 1; | ||
374 | } | ||
375 | |||
376 | /* first, turn off all power */ | ||
377 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK)); | ||
378 | |||
379 | /* enable new powersettings */ | ||
380 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | reg); | ||
381 | |||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V | ||
386 | |||
387 | static void hardware_enable(int slot) | ||
388 | { | ||
389 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~BCSR1_PCCEN); | ||
390 | } | ||
391 | |||
392 | static void hardware_disable(int slot) | ||
393 | { | ||
394 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | BCSR1_PCCEN); | ||
395 | } | ||
396 | |||
397 | #endif | ||
398 | |||
399 | /* ------------------------------------------------------------------------- */ | ||
400 | /* Motorola MBX860 */ | ||
401 | |||
402 | #if defined(CONFIG_MBX) | ||
403 | |||
404 | #define PCMCIA_BOARD_MSG "MBX" | ||
405 | |||
406 | static int voltage_set(int slot, int vcc, int vpp) | ||
407 | { | ||
408 | u8 reg = 0; | ||
409 | |||
410 | switch(vcc) { | ||
411 | case 0: | ||
412 | break; | ||
413 | case 33: | ||
414 | reg |= CSR2_VCC_33; | ||
415 | break; | ||
416 | case 50: | ||
417 | reg |= CSR2_VCC_50; | ||
418 | break; | ||
419 | default: | ||
420 | return 1; | ||
421 | } | ||
422 | |||
423 | switch(vpp) { | ||
424 | case 0: | ||
425 | break; | ||
426 | case 33: | ||
427 | case 50: | ||
428 | if(vcc == vpp) | ||
429 | reg |= CSR2_VPP_VCC; | ||
430 | else | ||
431 | return 1; | ||
432 | break; | ||
433 | case 120: | ||
434 | if ((vcc == 33) || (vcc == 50)) | ||
435 | reg |= CSR2_VPP_12; | ||
436 | else | ||
437 | return 1; | ||
438 | default: | ||
439 | return 1; | ||
440 | } | ||
441 | |||
442 | /* first, turn off all power */ | ||
443 | out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) & ~(CSR2_VCC_MASK | CSR2_VPP_MASK)); | ||
444 | |||
445 | /* enable new powersettings */ | ||
446 | out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) | reg); | ||
447 | |||
448 | return 0; | ||
449 | } | ||
450 | |||
451 | #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V | ||
452 | #define hardware_enable(_slot_) /* No hardware to enable */ | ||
453 | #define hardware_disable(_slot_) /* No hardware to disable */ | ||
454 | |||
455 | #endif /* CONFIG_MBX */ | ||
456 | |||
457 | #if defined(CONFIG_PRxK) | ||
458 | #include <asm/cpld.h> | ||
459 | extern volatile fpga_pc_regs *fpga_pc; | ||
460 | |||
461 | #define PCMCIA_BOARD_MSG "MPC855T" | ||
462 | |||
463 | static int voltage_set(int slot, int vcc, int vpp) | ||
464 | { | ||
465 | u8 reg = 0; | ||
466 | u8 regread; | ||
467 | cpld_regs *ccpld = get_cpld(); | ||
468 | |||
469 | switch(vcc) { | ||
470 | case 0: | ||
471 | break; | ||
472 | case 33: | ||
473 | reg |= PCMCIA_VCC_33; | ||
474 | break; | ||
475 | case 50: | ||
476 | reg |= PCMCIA_VCC_50; | ||
477 | break; | ||
478 | default: | ||
479 | return 1; | ||
480 | } | ||
481 | |||
482 | switch(vpp) { | ||
483 | case 0: | ||
484 | break; | ||
485 | case 33: | ||
486 | case 50: | ||
487 | if(vcc == vpp) | ||
488 | reg |= PCMCIA_VPP_VCC; | ||
489 | else | ||
490 | return 1; | ||
491 | break; | ||
492 | case 120: | ||
493 | if ((vcc == 33) || (vcc == 50)) | ||
494 | reg |= PCMCIA_VPP_12; | ||
495 | else | ||
496 | return 1; | ||
497 | default: | ||
498 | return 1; | ||
499 | } | ||
500 | |||
501 | reg = reg >> (slot << 2); | ||
502 | regread = in_8(&ccpld->fpga_pc_ctl); | ||
503 | if (reg != (regread & ((PCMCIA_VCC_MASK | PCMCIA_VPP_MASK) >> (slot << 2)))) { | ||
504 | /* enable new powersettings */ | ||
505 | regread = regread & ~((PCMCIA_VCC_MASK | PCMCIA_VPP_MASK) >> (slot << 2)); | ||
506 | out_8(&ccpld->fpga_pc_ctl, reg | regread); | ||
507 | msleep(100); | ||
508 | } | ||
509 | |||
510 | return 0; | ||
511 | } | ||
512 | |||
513 | #define socket_get(_slot_) PCMCIA_SOCKET_KEY_LV | ||
514 | #define hardware_enable(_slot_) /* No hardware to enable */ | ||
515 | #define hardware_disable(_slot_) /* No hardware to disable */ | ||
516 | |||
517 | #endif /* CONFIG_PRxK */ | ||
518 | |||
519 | static void m8xx_shutdown(void) | ||
520 | { | ||
521 | u32 m, i; | ||
522 | struct pcmcia_win *w; | ||
523 | |||
524 | for(i = 0; i < PCMCIA_SOCKETS_NO; i++){ | ||
525 | w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0; | ||
526 | |||
527 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr, M8XX_PCMCIA_MASK(i)); | ||
528 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per, in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per) & ~M8XX_PCMCIA_MASK(i)); | ||
529 | |||
530 | /* turn off interrupt and disable CxOE */ | ||
531 | out_be32(M8XX_PGCRX(i), M8XX_PGCRX_CXOE); | ||
532 | |||
533 | /* turn off memory windows */ | ||
534 | for(m = 0; m < PCMCIA_MEM_WIN_NO; m++) { | ||
535 | out_be32(&w->or, 0); /* set to not valid */ | ||
536 | w++; | ||
537 | } | ||
538 | |||
539 | /* turn off voltage */ | ||
540 | voltage_set(i, 0, 0); | ||
541 | |||
542 | /* disable external hardware */ | ||
543 | hardware_disable(i); | ||
544 | } | ||
545 | |||
546 | free_irq(pcmcia_schlvl, NULL); | ||
547 | } | ||
548 | |||
549 | /* copied from tcic.c */ | ||
550 | |||
551 | static int m8xx_drv_suspend(struct device *dev, pm_message_t state, u32 level) | ||
552 | { | ||
553 | int ret = 0; | ||
554 | if (level == SUSPEND_SAVE_STATE) | ||
555 | ret = pcmcia_socket_dev_suspend(dev, state); | ||
556 | return ret; | ||
557 | } | ||
558 | |||
559 | static int m8xx_drv_resume(struct device *dev, u32 level) | ||
560 | { | ||
561 | int ret = 0; | ||
562 | if (level == RESUME_RESTORE_STATE) | ||
563 | ret = pcmcia_socket_dev_resume(dev); | ||
564 | return ret; | ||
565 | } | ||
566 | |||
567 | static struct device_driver m8xx_driver = { | ||
568 | .name = "m8xx-pcmcia", | ||
569 | .bus = &platform_bus_type, | ||
570 | .suspend = m8xx_drv_suspend, | ||
571 | .resume = m8xx_drv_resume, | ||
572 | }; | ||
573 | |||
574 | static struct platform_device m8xx_device = { | ||
575 | .name = "m8xx-pcmcia", | ||
576 | .id = 0, | ||
577 | }; | ||
578 | |||
579 | static u32 pending_events[PCMCIA_SOCKETS_NO]; | ||
580 | static spinlock_t pending_event_lock = SPIN_LOCK_UNLOCKED; | ||
581 | |||
582 | static irqreturn_t m8xx_interrupt(int irq, void *dev, struct pt_regs *regs) | ||
583 | { | ||
584 | struct socket_info *s; | ||
585 | struct event_table *e; | ||
586 | unsigned int i, events, pscr, pipr, per; | ||
587 | |||
588 | dprintk("Interrupt!\n"); | ||
589 | /* get interrupt sources */ | ||
590 | |||
591 | pscr = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr); | ||
592 | pipr = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pipr); | ||
593 | per = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per); | ||
594 | |||
595 | for(i = 0; i < PCMCIA_SOCKETS_NO; i++) { | ||
596 | s = &socket[i]; | ||
597 | e = &s->events[0]; | ||
598 | events = 0; | ||
599 | |||
600 | while(e->regbit) { | ||
601 | if(pscr & e->regbit) | ||
602 | events |= e->eventbit; | ||
603 | |||
604 | e++; | ||
605 | } | ||
606 | |||
607 | /* | ||
608 | * report only if both card detect signals are the same | ||
609 | * not too nice done, | ||
610 | * we depend on that CD2 is the bit to the left of CD1... | ||
611 | */ | ||
612 | if(events & SS_DETECT) | ||
613 | if(((pipr & M8XX_PCMCIA_CD2(i)) >> 1) ^ | ||
614 | (pipr & M8XX_PCMCIA_CD1(i))) | ||
615 | { | ||
616 | events &= ~SS_DETECT; | ||
617 | } | ||
618 | |||
619 | #ifdef PCMCIA_GLITCHY_CD | ||
620 | /* | ||
621 | * I've experienced CD problems with my ADS board. | ||
622 | * We make an extra check to see if there was a | ||
623 | * real change of Card detection. | ||
624 | */ | ||
625 | |||
626 | if((events & SS_DETECT) && | ||
627 | ((pipr & | ||
628 | (M8XX_PCMCIA_CD2(i) | M8XX_PCMCIA_CD1(i))) == 0) && | ||
629 | (s->state.Vcc | s->state.Vpp)) { | ||
630 | events &= ~SS_DETECT; | ||
631 | /*printk( "CD glitch workaround - CD = 0x%08x!\n", | ||
632 | (pipr & (M8XX_PCMCIA_CD2(i) | ||
633 | | M8XX_PCMCIA_CD1(i))));*/ | ||
634 | } | ||
635 | #endif | ||
636 | |||
637 | /* call the handler */ | ||
638 | |||
639 | dprintk("slot %u: events = 0x%02x, pscr = 0x%08x, " | ||
640 | "pipr = 0x%08x\n", | ||
641 | i, events, pscr, pipr); | ||
642 | |||
643 | if(events) { | ||
644 | spin_lock(&pending_event_lock); | ||
645 | pending_events[i] |= events; | ||
646 | spin_unlock(&pending_event_lock); | ||
647 | /* | ||
648 | * Turn off RDY_L bits in the PER mask on | ||
649 | * CD interrupt receival. | ||
650 | * | ||
651 | * They can generate bad interrupts on the | ||
652 | * ACS4,8,16,32. - marcelo | ||
653 | */ | ||
654 | per &= ~M8XX_PCMCIA_RDY_L(0); | ||
655 | per &= ~M8XX_PCMCIA_RDY_L(1); | ||
656 | |||
657 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per, per); | ||
658 | |||
659 | if (events) | ||
660 | pcmcia_parse_events(&socket[i].socket, events); | ||
661 | } | ||
662 | } | ||
663 | |||
664 | /* clear the interrupt sources */ | ||
665 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr, pscr); | ||
666 | |||
667 | dprintk("Interrupt done.\n"); | ||
668 | |||
669 | return IRQ_HANDLED; | ||
670 | } | ||
671 | |||
672 | static u32 m8xx_get_graycode(u32 size) | ||
673 | { | ||
674 | u32 k; | ||
675 | |||
676 | for(k = 0; k < M8XX_SIZES_NO; k++) | ||
677 | if(m8xx_size_to_gray[k] == size) | ||
678 | break; | ||
679 | |||
680 | if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1)) | ||
681 | k = -1; | ||
682 | |||
683 | return k; | ||
684 | } | ||
685 | |||
686 | static u32 m8xx_get_speed(u32 ns, u32 is_io) | ||
687 | { | ||
688 | u32 reg, clocks, psst, psl, psht; | ||
689 | |||
690 | if(!ns) { | ||
691 | |||
692 | /* | ||
693 | * We get called with IO maps setup to 0ns | ||
694 | * if not specified by the user. | ||
695 | * They should be 255ns. | ||
696 | */ | ||
697 | |||
698 | if(is_io) | ||
699 | ns = 255; | ||
700 | else | ||
701 | ns = 100; /* fast memory if 0 */ | ||
702 | } | ||
703 | |||
704 | /* | ||
705 | * In PSST, PSL, PSHT fields we tell the controller | ||
706 | * timing parameters in CLKOUT clock cycles. | ||
707 | * CLKOUT is the same as GCLK2_50. | ||
708 | */ | ||
709 | |||
710 | /* how we want to adjust the timing - in percent */ | ||
711 | |||
712 | #define ADJ 180 /* 80 % longer accesstime - to be sure */ | ||
713 | |||
714 | clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000; | ||
715 | clocks = (clocks * ADJ) / (100*1000); | ||
716 | if(clocks >= PCMCIA_BMT_LIMIT) { | ||
717 | printk( "Max access time limit reached\n"); | ||
718 | clocks = PCMCIA_BMT_LIMIT-1; | ||
719 | } | ||
720 | |||
721 | psst = clocks / 7; /* setup time */ | ||
722 | psht = clocks / 7; /* hold time */ | ||
723 | psl = (clocks * 5) / 7; /* strobe length */ | ||
724 | |||
725 | psst += clocks - (psst + psht + psl); | ||
726 | |||
727 | reg = psst << 12; | ||
728 | reg |= psl << 7; | ||
729 | reg |= psht << 16; | ||
730 | |||
731 | return reg; | ||
732 | } | ||
733 | |||
734 | static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value) | ||
735 | { | ||
736 | int lsock = container_of(sock, struct socket_info, socket)->slot; | ||
737 | struct socket_info *s = &socket[lsock]; | ||
738 | unsigned int pipr, reg; | ||
739 | |||
740 | pipr = in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pipr); | ||
741 | |||
742 | *value = ((pipr & (M8XX_PCMCIA_CD1(lsock) | ||
743 | | M8XX_PCMCIA_CD2(lsock))) == 0) ? SS_DETECT : 0; | ||
744 | *value |= (pipr & M8XX_PCMCIA_WP(lsock)) ? SS_WRPROT : 0; | ||
745 | |||
746 | if (s->state.flags & SS_IOCARD) | ||
747 | *value |= (pipr & M8XX_PCMCIA_BVD1(lsock)) ? SS_STSCHG : 0; | ||
748 | else { | ||
749 | *value |= (pipr & M8XX_PCMCIA_RDY(lsock)) ? SS_READY : 0; | ||
750 | *value |= (pipr & M8XX_PCMCIA_BVD1(lsock)) ? SS_BATDEAD : 0; | ||
751 | *value |= (pipr & M8XX_PCMCIA_BVD2(lsock)) ? SS_BATWARN : 0; | ||
752 | } | ||
753 | |||
754 | if (s->state.Vcc | s->state.Vpp) | ||
755 | *value |= SS_POWERON; | ||
756 | |||
757 | /* | ||
758 | * Voltage detection: | ||
759 | * This driver only supports 16-Bit pc-cards. | ||
760 | * Cardbus is not handled here. | ||
761 | * | ||
762 | * To determine what voltage to use we must read the VS1 and VS2 pin. | ||
763 | * Depending on what socket type is present, | ||
764 | * different combinations mean different things. | ||
765 | * | ||
766 | * Card Key Socket Key VS1 VS2 Card Vcc for CIS parse | ||
767 | * | ||
768 | * 5V 5V, LV* NC NC 5V only 5V (if available) | ||
769 | * | ||
770 | * 5V 5V, LV* GND NC 5 or 3.3V as low as possible | ||
771 | * | ||
772 | * 5V 5V, LV* GND GND 5, 3.3, x.xV as low as possible | ||
773 | * | ||
774 | * LV* 5V - - shall not fit into socket | ||
775 | * | ||
776 | * LV* LV* GND NC 3.3V only 3.3V | ||
777 | * | ||
778 | * LV* LV* NC GND x.xV x.xV (if avail.) | ||
779 | * | ||
780 | * LV* LV* GND GND 3.3 or x.xV as low as possible | ||
781 | * | ||
782 | * *LV means Low Voltage | ||
783 | * | ||
784 | * | ||
785 | * That gives us the following table: | ||
786 | * | ||
787 | * Socket VS1 VS2 Voltage | ||
788 | * | ||
789 | * 5V NC NC 5V | ||
790 | * 5V NC GND none (should not be possible) | ||
791 | * 5V GND NC >= 3.3V | ||
792 | * 5V GND GND >= x.xV | ||
793 | * | ||
794 | * LV NC NC 5V (if available) | ||
795 | * LV NC GND x.xV (if available) | ||
796 | * LV GND NC 3.3V | ||
797 | * LV GND GND >= x.xV | ||
798 | * | ||
799 | * So, how do I determine if I have a 5V or a LV | ||
800 | * socket on my board? Look at the socket! | ||
801 | * | ||
802 | * | ||
803 | * Socket with 5V key: | ||
804 | * ++--------------------------------------------+ | ||
805 | * || | | ||
806 | * || || | ||
807 | * || || | ||
808 | * | | | ||
809 | * +---------------------------------------------+ | ||
810 | * | ||
811 | * Socket with LV key: | ||
812 | * ++--------------------------------------------+ | ||
813 | * || | | ||
814 | * | || | ||
815 | * | || | ||
816 | * | | | ||
817 | * +---------------------------------------------+ | ||
818 | * | ||
819 | * | ||
820 | * With other words - LV only cards does not fit | ||
821 | * into the 5V socket! | ||
822 | */ | ||
823 | |||
824 | /* read out VS1 and VS2 */ | ||
825 | |||
826 | reg = (pipr & M8XX_PCMCIA_VS_MASK(lsock)) | ||
827 | >> M8XX_PCMCIA_VS_SHIFT(lsock); | ||
828 | |||
829 | if(socket_get(lsock) == PCMCIA_SOCKET_KEY_LV) { | ||
830 | switch(reg) { | ||
831 | case 1: | ||
832 | *value |= SS_3VCARD; | ||
833 | break; /* GND, NC - 3.3V only */ | ||
834 | case 2: | ||
835 | *value |= SS_XVCARD; | ||
836 | break; /* NC. GND - x.xV only */ | ||
837 | }; | ||
838 | } | ||
839 | |||
840 | dprintk("GetStatus(%d) = %#2.2x\n", lsock, *value); | ||
841 | return 0; | ||
842 | } | ||
843 | |||
844 | static int m8xx_get_socket(struct pcmcia_socket *sock, socket_state_t *state) | ||
845 | { | ||
846 | int lsock = container_of(sock, struct socket_info, socket)->slot; | ||
847 | *state = socket[lsock].state; /* copy the whole structure */ | ||
848 | |||
849 | dprintk("GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " | ||
850 | "io_irq %d, csc_mask %#2.2x\n", lsock, state->flags, | ||
851 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | ||
852 | return 0; | ||
853 | } | ||
854 | |||
855 | static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | ||
856 | { | ||
857 | int lsock = container_of(sock, struct socket_info, socket)->slot; | ||
858 | struct socket_info *s = &socket[lsock]; | ||
859 | struct event_table *e; | ||
860 | unsigned int reg; | ||
861 | unsigned long flags; | ||
862 | |||
863 | dprintk( "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | ||
864 | "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags, | ||
865 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | ||
866 | |||
867 | /* First, set voltage - bail out if invalid */ | ||
868 | if(voltage_set(lsock, state->Vcc, state->Vpp)) | ||
869 | return -EINVAL; | ||
870 | |||
871 | /* Take care of reset... */ | ||
872 | if(state->flags & SS_RESET) | ||
873 | out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) | M8XX_PGCRX_CXRESET); /* active high */ | ||
874 | else | ||
875 | out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) & ~M8XX_PGCRX_CXRESET); | ||
876 | |||
877 | /* ... and output enable. */ | ||
878 | |||
879 | /* The CxOE signal is connected to a 74541 on the ADS. | ||
880 | I guess most other boards used the ADS as a reference. | ||
881 | I tried to control the CxOE signal with SS_OUTPUT_ENA, | ||
882 | but the reset signal seems connected via the 541. | ||
883 | If the CxOE is left high are some signals tristated and | ||
884 | no pullups are present -> the cards act wierd. | ||
885 | So right now the buffers are enabled if the power is on. */ | ||
886 | |||
887 | if(state->Vcc || state->Vpp) | ||
888 | out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) & ~M8XX_PGCRX_CXOE); /* active low */ | ||
889 | else | ||
890 | out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) | M8XX_PGCRX_CXOE); | ||
891 | |||
892 | /* | ||
893 | * We'd better turn off interrupts before | ||
894 | * we mess with the events-table.. | ||
895 | */ | ||
896 | |||
897 | spin_lock_irqsave(&events_lock, flags); | ||
898 | |||
899 | /* | ||
900 | * Play around with the interrupt mask to be able to | ||
901 | * give the events the generic pcmcia driver wants us to. | ||
902 | */ | ||
903 | |||
904 | e = &s->events[0]; | ||
905 | reg = 0; | ||
906 | |||
907 | if(state->csc_mask & SS_DETECT) { | ||
908 | e->eventbit = SS_DETECT; | ||
909 | reg |= e->regbit = (M8XX_PCMCIA_CD2(lsock) | ||
910 | | M8XX_PCMCIA_CD1(lsock)); | ||
911 | e++; | ||
912 | } | ||
913 | if(state->flags & SS_IOCARD) { | ||
914 | /* | ||
915 | * I/O card | ||
916 | */ | ||
917 | if(state->csc_mask & SS_STSCHG) { | ||
918 | e->eventbit = SS_STSCHG; | ||
919 | reg |= e->regbit = M8XX_PCMCIA_BVD1(lsock); | ||
920 | e++; | ||
921 | } | ||
922 | /* | ||
923 | * If io_irq is non-zero we should enable irq. | ||
924 | */ | ||
925 | if(state->io_irq) { | ||
926 | out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) | mk_int_int_mask(state->io_irq) << 24); | ||
927 | /* | ||
928 | * Strange thing here: | ||
929 | * The manual does not tell us which interrupt | ||
930 | * the sources generate. | ||
931 | * Anyhow, I found out that RDY_L generates IREQLVL. | ||
932 | * | ||
933 | * We use level triggerd interrupts, and they don't | ||
934 | * have to be cleared in PSCR in the interrupt handler. | ||
935 | */ | ||
936 | reg |= M8XX_PCMCIA_RDY_L(lsock); | ||
937 | } | ||
938 | else | ||
939 | out_be32(M8XX_PGCRX(lsock), in_be32(M8XX_PGCRX(lsock)) & 0x00ffffff); | ||
940 | } | ||
941 | else { | ||
942 | /* | ||
943 | * Memory card | ||
944 | */ | ||
945 | if(state->csc_mask & SS_BATDEAD) { | ||
946 | e->eventbit = SS_BATDEAD; | ||
947 | reg |= e->regbit = M8XX_PCMCIA_BVD1(lsock); | ||
948 | e++; | ||
949 | } | ||
950 | if(state->csc_mask & SS_BATWARN) { | ||
951 | e->eventbit = SS_BATWARN; | ||
952 | reg |= e->regbit = M8XX_PCMCIA_BVD2(lsock); | ||
953 | e++; | ||
954 | } | ||
955 | /* What should I trigger on - low/high,raise,fall? */ | ||
956 | if(state->csc_mask & SS_READY) { | ||
957 | e->eventbit = SS_READY; | ||
958 | reg |= e->regbit = 0; //?? | ||
959 | e++; | ||
960 | } | ||
961 | } | ||
962 | |||
963 | e->regbit = 0; /* terminate list */ | ||
964 | |||
965 | /* | ||
966 | * Clear the status changed . | ||
967 | * Port A and Port B share the same port. | ||
968 | * Writing ones will clear the bits. | ||
969 | */ | ||
970 | |||
971 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr, reg); | ||
972 | |||
973 | /* | ||
974 | * Write the mask. | ||
975 | * Port A and Port B share the same port. | ||
976 | * Need for read-modify-write. | ||
977 | * Ones will enable the interrupt. | ||
978 | */ | ||
979 | |||
980 | /* | ||
981 | reg |= ((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per | ||
982 | & M8XX_PCMCIA_MASK(lsock); | ||
983 | */ | ||
984 | |||
985 | reg |= in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per) & | ||
986 | (M8XX_PCMCIA_MASK(0) | M8XX_PCMCIA_MASK(1)); | ||
987 | |||
988 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per, reg); | ||
989 | |||
990 | spin_unlock_irqrestore(&events_lock, flags); | ||
991 | |||
992 | /* copy the struct and modify the copy */ | ||
993 | |||
994 | s->state = *state; | ||
995 | |||
996 | return 0; | ||
997 | } | ||
998 | |||
999 | static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | ||
1000 | { | ||
1001 | int lsock = container_of(sock, struct socket_info, socket)->slot; | ||
1002 | |||
1003 | struct socket_info *s = &socket[lsock]; | ||
1004 | struct pcmcia_win *w; | ||
1005 | unsigned int reg, winnr; | ||
1006 | |||
1007 | #define M8XX_SIZE (io->stop - io->start + 1) | ||
1008 | #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) | ||
1009 | |||
1010 | dprintk( "SetIOMap(%d, %d, %#2.2x, %d ns, " | ||
1011 | "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags, | ||
1012 | io->speed, io->start, io->stop); | ||
1013 | |||
1014 | if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff) | ||
1015 | || (io->stop > 0xffff) || (io->stop < io->start)) | ||
1016 | return -EINVAL; | ||
1017 | |||
1018 | if((reg = m8xx_get_graycode(M8XX_SIZE)) == -1) | ||
1019 | return -EINVAL; | ||
1020 | |||
1021 | if(io->flags & MAP_ACTIVE) { | ||
1022 | |||
1023 | dprintk( "io->flags & MAP_ACTIVE\n"); | ||
1024 | |||
1025 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) | ||
1026 | + (lsock * PCMCIA_IO_WIN_NO) + io->map; | ||
1027 | |||
1028 | /* setup registers */ | ||
1029 | |||
1030 | w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0; | ||
1031 | w += winnr; | ||
1032 | |||
1033 | out_be32(&w->or, 0); /* turn off window first */ | ||
1034 | out_be32(&w->br, M8XX_BASE); | ||
1035 | |||
1036 | reg <<= 27; | ||
1037 | reg |= M8XX_PCMCIA_POR_IO |(lsock << 2); | ||
1038 | |||
1039 | reg |= m8xx_get_speed(io->speed, 1); | ||
1040 | |||
1041 | if(io->flags & MAP_WRPROT) | ||
1042 | reg |= M8XX_PCMCIA_POR_WRPROT; | ||
1043 | |||
1044 | /*if(io->flags & (MAP_16BIT | MAP_AUTOSZ))*/ | ||
1045 | if(io->flags & MAP_16BIT) | ||
1046 | reg |= M8XX_PCMCIA_POR_16BIT; | ||
1047 | |||
1048 | if(io->flags & MAP_ACTIVE) | ||
1049 | reg |= M8XX_PCMCIA_POR_VALID; | ||
1050 | |||
1051 | out_be32(&w->or, reg); | ||
1052 | |||
1053 | dprintk("Socket %u: Mapped io window %u at %#8.8x, " | ||
1054 | "OR = %#8.8x.\n", lsock, io->map, w->br, w->or); | ||
1055 | } else { | ||
1056 | /* shutdown IO window */ | ||
1057 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) | ||
1058 | + (lsock * PCMCIA_IO_WIN_NO) + io->map; | ||
1059 | |||
1060 | /* setup registers */ | ||
1061 | |||
1062 | w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0; | ||
1063 | w += winnr; | ||
1064 | |||
1065 | out_be32(&w->or, 0); /* turn off window */ | ||
1066 | out_be32(&w->br, 0); /* turn off base address */ | ||
1067 | |||
1068 | dprintk("Socket %u: Unmapped io window %u at %#8.8x, " | ||
1069 | "OR = %#8.8x.\n", lsock, io->map, w->br, w->or); | ||
1070 | } | ||
1071 | |||
1072 | /* copy the struct and modify the copy */ | ||
1073 | s->io_win[io->map] = *io; | ||
1074 | s->io_win[io->map].flags &= (MAP_WRPROT | ||
1075 | | MAP_16BIT | ||
1076 | | MAP_ACTIVE); | ||
1077 | dprintk("SetIOMap exit\n"); | ||
1078 | |||
1079 | return 0; | ||
1080 | } | ||
1081 | |||
1082 | static int m8xx_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem) | ||
1083 | { | ||
1084 | int lsock = container_of(sock, struct socket_info, socket)->slot; | ||
1085 | struct socket_info *s = &socket[lsock]; | ||
1086 | struct pcmcia_win *w; | ||
1087 | struct pccard_mem_map *old; | ||
1088 | unsigned int reg, winnr; | ||
1089 | |||
1090 | dprintk( "SetMemMap(%d, %d, %#2.2x, %d ns, " | ||
1091 | "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, | ||
1092 | mem->speed, mem->static_start, mem->card_start); | ||
1093 | |||
1094 | if ((mem->map >= PCMCIA_MEM_WIN_NO) | ||
1095 | // || ((mem->s) >= PCMCIA_MEM_WIN_SIZE) | ||
1096 | || (mem->card_start >= 0x04000000) | ||
1097 | || (mem->static_start & 0xfff) /* 4KByte resolution */ | ||
1098 | || (mem->card_start & 0xfff)) | ||
1099 | return -EINVAL; | ||
1100 | |||
1101 | if((reg = m8xx_get_graycode(PCMCIA_MEM_WIN_SIZE)) == -1) { | ||
1102 | printk( "Cannot set size to 0x%08x.\n", PCMCIA_MEM_WIN_SIZE); | ||
1103 | return -EINVAL; | ||
1104 | } | ||
1105 | reg <<= 27; | ||
1106 | |||
1107 | winnr = (lsock * PCMCIA_MEM_WIN_NO) + mem->map; | ||
1108 | |||
1109 | /* Setup the window in the pcmcia controller */ | ||
1110 | |||
1111 | w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0; | ||
1112 | w += winnr; | ||
1113 | |||
1114 | reg |= lsock << 2; | ||
1115 | |||
1116 | reg |= m8xx_get_speed(mem->speed, 0); | ||
1117 | |||
1118 | if(mem->flags & MAP_ATTRIB) | ||
1119 | reg |= M8XX_PCMCIA_POR_ATTRMEM; | ||
1120 | |||
1121 | if(mem->flags & MAP_WRPROT) | ||
1122 | reg |= M8XX_PCMCIA_POR_WRPROT; | ||
1123 | |||
1124 | if(mem->flags & MAP_16BIT) | ||
1125 | reg |= M8XX_PCMCIA_POR_16BIT; | ||
1126 | |||
1127 | if(mem->flags & MAP_ACTIVE) | ||
1128 | reg |= M8XX_PCMCIA_POR_VALID; | ||
1129 | |||
1130 | out_be32(&w->or, reg); | ||
1131 | |||
1132 | dprintk("Socket %u: Mapped memory window %u at %#8.8x, " | ||
1133 | "OR = %#8.8x.\n", lsock, mem->map, w->br, w->or); | ||
1134 | |||
1135 | if(mem->flags & MAP_ACTIVE) { | ||
1136 | /* get the new base address */ | ||
1137 | mem->static_start = PCMCIA_MEM_WIN_BASE + | ||
1138 | (PCMCIA_MEM_WIN_SIZE * winnr) | ||
1139 | + mem->card_start; | ||
1140 | } | ||
1141 | |||
1142 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " | ||
1143 | "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, | ||
1144 | mem->speed, mem->static_start, mem->card_start); | ||
1145 | |||
1146 | /* copy the struct and modify the copy */ | ||
1147 | |||
1148 | old = &s->mem_win[mem->map]; | ||
1149 | |||
1150 | *old = *mem; | ||
1151 | old->flags &= (MAP_ATTRIB | ||
1152 | | MAP_WRPROT | ||
1153 | | MAP_16BIT | ||
1154 | | MAP_ACTIVE); | ||
1155 | |||
1156 | return 0; | ||
1157 | } | ||
1158 | |||
1159 | static int m8xx_sock_init(struct pcmcia_socket *sock) | ||
1160 | { | ||
1161 | int i; | ||
1162 | pccard_io_map io = { 0, 0, 0, 0, 1 }; | ||
1163 | pccard_mem_map mem = { 0, 0, 0, 0, 0, 0 }; | ||
1164 | |||
1165 | dprintk( "sock_init(%d)\n", s); | ||
1166 | |||
1167 | m8xx_set_socket(sock, &dead_socket); | ||
1168 | for (i = 0; i < PCMCIA_IO_WIN_NO; i++) { | ||
1169 | io.map = i; | ||
1170 | m8xx_set_io_map(sock, &io); | ||
1171 | } | ||
1172 | for (i = 0; i < PCMCIA_MEM_WIN_NO; i++) { | ||
1173 | mem.map = i; | ||
1174 | m8xx_set_mem_map(sock, &mem); | ||
1175 | } | ||
1176 | |||
1177 | return 0; | ||
1178 | |||
1179 | } | ||
1180 | |||
1181 | static int m8xx_suspend(struct pcmcia_socket *sock) | ||
1182 | { | ||
1183 | return m8xx_set_socket(sock, &dead_socket); | ||
1184 | } | ||
1185 | |||
1186 | static struct pccard_operations m8xx_services = { | ||
1187 | .init = m8xx_sock_init, | ||
1188 | .suspend = m8xx_suspend, | ||
1189 | .get_status = m8xx_get_status, | ||
1190 | .get_socket = m8xx_get_socket, | ||
1191 | .set_socket = m8xx_set_socket, | ||
1192 | .set_io_map = m8xx_set_io_map, | ||
1193 | .set_mem_map = m8xx_set_mem_map, | ||
1194 | }; | ||
1195 | |||
1196 | static int __init m8xx_init(void) | ||
1197 | { | ||
1198 | struct pcmcia_win *w; | ||
1199 | unsigned int i,m; | ||
1200 | |||
1201 | pcmcia_info("%s\n", version); | ||
1202 | |||
1203 | if (driver_register(&m8xx_driver)) | ||
1204 | return -1; | ||
1205 | |||
1206 | pcmcia_info(PCMCIA_BOARD_MSG " using " PCMCIA_SLOT_MSG | ||
1207 | " with IRQ %u.\n", pcmcia_schlvl); | ||
1208 | |||
1209 | /* Configure Status change interrupt */ | ||
1210 | |||
1211 | if(request_irq(pcmcia_schlvl, m8xx_interrupt, 0, | ||
1212 | "m8xx_pcmcia", NULL)) { | ||
1213 | pcmcia_error("Cannot allocate IRQ %u for SCHLVL!\n", | ||
1214 | pcmcia_schlvl); | ||
1215 | return -1; | ||
1216 | } | ||
1217 | |||
1218 | w = (void *) &((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0; | ||
1219 | |||
1220 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr, | ||
1221 | M8XX_PCMCIA_MASK(0)| M8XX_PCMCIA_MASK(1)); | ||
1222 | |||
1223 | out_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per, | ||
1224 | in_be32(&((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_per) & | ||
1225 | ~(M8XX_PCMCIA_MASK(0)| M8XX_PCMCIA_MASK(1))); | ||
1226 | |||
1227 | /* connect interrupt and disable CxOE */ | ||
1228 | |||
1229 | out_be32(M8XX_PGCRX(0), M8XX_PGCRX_CXOE | (mk_int_int_mask(pcmcia_schlvl) << 16)); | ||
1230 | out_be32(M8XX_PGCRX(1), M8XX_PGCRX_CXOE | (mk_int_int_mask(pcmcia_schlvl) << 16)); | ||
1231 | |||
1232 | /* intialize the fixed memory windows */ | ||
1233 | |||
1234 | for(i = 0; i < PCMCIA_SOCKETS_NO; i++){ | ||
1235 | for(m = 0; m < PCMCIA_MEM_WIN_NO; m++) { | ||
1236 | out_be32(&w->br, PCMCIA_MEM_WIN_BASE + | ||
1237 | (PCMCIA_MEM_WIN_SIZE | ||
1238 | * (m + i * PCMCIA_MEM_WIN_NO))); | ||
1239 | |||
1240 | out_be32(&w->or, 0); /* set to not valid */ | ||
1241 | |||
1242 | w++; | ||
1243 | } | ||
1244 | } | ||
1245 | |||
1246 | /* turn off voltage */ | ||
1247 | voltage_set(0, 0, 0); | ||
1248 | voltage_set(1, 0, 0); | ||
1249 | |||
1250 | /* Enable external hardware */ | ||
1251 | hardware_enable(0); | ||
1252 | hardware_enable(1); | ||
1253 | |||
1254 | platform_device_register(&m8xx_device); | ||
1255 | |||
1256 | for (i = 0 ; i < PCMCIA_SOCKETS_NO; i++) { | ||
1257 | socket[i].slot = i; | ||
1258 | socket[i].socket.owner = THIS_MODULE; | ||
1259 | socket[i].socket.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN | SS_CAP_STATIC_MAP; | ||
1260 | socket[i].socket.irq_mask = 0x000; | ||
1261 | socket[i].socket.map_size = 0x1000; | ||
1262 | socket[i].socket.io_offset = 0; | ||
1263 | socket[i].socket.pci_irq = i ? 7 : 9; | ||
1264 | socket[i].socket.ops = &m8xx_services; | ||
1265 | socket[i].socket.resource_ops = &pccard_nonstatic_ops; | ||
1266 | socket[i].socket.cb_dev = NULL; | ||
1267 | socket[i].socket.dev.dev = &m8xx_device.dev; | ||
1268 | } | ||
1269 | |||
1270 | for (i = 0; i < PCMCIA_SOCKETS_NO; i++) | ||
1271 | pcmcia_register_socket(&socket[i].socket); | ||
1272 | |||
1273 | return 0; | ||
1274 | } | ||
1275 | |||
1276 | static void __exit m8xx_exit(void) | ||
1277 | { | ||
1278 | int i; | ||
1279 | |||
1280 | for (i = 0; i < PCMCIA_SOCKETS_NO; i++) | ||
1281 | pcmcia_unregister_socket(&socket[i].socket); | ||
1282 | |||
1283 | m8xx_shutdown(); | ||
1284 | |||
1285 | platform_device_unregister(&m8xx_device); | ||
1286 | driver_unregister(&m8xx_driver); | ||
1287 | } | ||
1288 | |||
1289 | module_init(m8xx_init); | ||
1290 | module_exit(m8xx_exit); | ||
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index a1178a600e3c..bd924336a49f 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c | |||
@@ -18,10 +18,15 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/device.h> | 19 | #include <linux/device.h> |
20 | 20 | ||
21 | #include <asm/mach-types.h> | ||
21 | #include <asm/hardware.h> | 22 | #include <asm/hardware.h> |
22 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
23 | #include <asm/hardware/scoop.h> | 24 | #include <asm/hardware/scoop.h> |
24 | #include <asm/arch/pxa-regs.h> | 25 | #ifdef CONFIG_SA1100_COLLIE |
26 | #include <asm/arch-sa1100/collie.h> | ||
27 | #else | ||
28 | #include <asm/arch-pxa/pxa-regs.h> | ||
29 | #endif | ||
25 | 30 | ||
26 | #include "soc_common.h" | 31 | #include "soc_common.h" |
27 | 32 | ||
@@ -38,6 +43,7 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
38 | { | 43 | { |
39 | int ret; | 44 | int ret; |
40 | 45 | ||
46 | #ifndef CONFIG_SA1100_COLLIE | ||
41 | /* | 47 | /* |
42 | * Setup default state of GPIO outputs | 48 | * Setup default state of GPIO outputs |
43 | * before we enable them as outputs. | 49 | * before we enable them as outputs. |
@@ -60,6 +66,7 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
60 | pxa_gpio_mode(GPIO55_nPREG_MD); | 66 | pxa_gpio_mode(GPIO55_nPREG_MD); |
61 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | 67 | pxa_gpio_mode(GPIO56_nPWAIT_MD); |
62 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | 68 | pxa_gpio_mode(GPIO57_nIOIS16_MD); |
69 | #endif | ||
63 | 70 | ||
64 | /* Register interrupts */ | 71 | /* Register interrupts */ |
65 | if (scoop_devs[skt->nr].cd_irq >= 0) { | 72 | if (scoop_devs[skt->nr].cd_irq >= 0) { |
@@ -213,12 +220,20 @@ static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | |||
213 | write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_IMR, 0x00C0); | 220 | write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_IMR, 0x00C0); |
214 | write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_MCR, 0x0101); | 221 | write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_MCR, 0x0101); |
215 | scoop_devs[skt->nr].keep_vs = NO_KEEP_VS; | 222 | scoop_devs[skt->nr].keep_vs = NO_KEEP_VS; |
223 | |||
224 | if (machine_is_collie()) | ||
225 | /* We need to disable SS_OUTPUT_ENA here. */ | ||
226 | write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080); | ||
216 | } | 227 | } |
217 | 228 | ||
218 | static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | 229 | static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) |
219 | { | 230 | { |
220 | /* CF_BUS_OFF */ | 231 | /* CF_BUS_OFF */ |
221 | sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]); | 232 | sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]); |
233 | |||
234 | if (machine_is_collie()) | ||
235 | /* We need to disable SS_OUTPUT_ENA here. */ | ||
236 | write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080); | ||
222 | } | 237 | } |
223 | 238 | ||
224 | static struct pcmcia_low_level sharpsl_pcmcia_ops = { | 239 | static struct pcmcia_low_level sharpsl_pcmcia_ops = { |
@@ -235,6 +250,19 @@ static struct pcmcia_low_level sharpsl_pcmcia_ops = { | |||
235 | 250 | ||
236 | static struct platform_device *sharpsl_pcmcia_device; | 251 | static struct platform_device *sharpsl_pcmcia_device; |
237 | 252 | ||
253 | #ifdef CONFIG_SA1100_COLLIE | ||
254 | int __init pcmcia_collie_init(struct device *dev) | ||
255 | { | ||
256 | int ret = -ENODEV; | ||
257 | |||
258 | if (machine_is_collie()) | ||
259 | ret = sa11xx_drv_pcmcia_probe(dev, &sharpsl_pcmcia_ops, 0, 1); | ||
260 | |||
261 | return ret; | ||
262 | } | ||
263 | |||
264 | #else | ||
265 | |||
238 | static int __init sharpsl_pcmcia_init(void) | 266 | static int __init sharpsl_pcmcia_init(void) |
239 | { | 267 | { |
240 | int ret; | 268 | int ret; |
@@ -269,6 +297,7 @@ static void __exit sharpsl_pcmcia_exit(void) | |||
269 | 297 | ||
270 | fs_initcall(sharpsl_pcmcia_init); | 298 | fs_initcall(sharpsl_pcmcia_init); |
271 | module_exit(sharpsl_pcmcia_exit); | 299 | module_exit(sharpsl_pcmcia_exit); |
300 | #endif | ||
272 | 301 | ||
273 | MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support"); | 302 | MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support"); |
274 | MODULE_LICENSE("GPL"); | 303 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index fc87e7e2b6b8..00960a379b9c 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -779,7 +779,7 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s) | |||
779 | if (!s->cb_dev || !s->cb_dev->bus) | 779 | if (!s->cb_dev || !s->cb_dev->bus) |
780 | return -ENODEV; | 780 | return -ENODEV; |
781 | 781 | ||
782 | #if defined(CONFIG_X86) || defined(CONFIG_X86_64) | 782 | #if defined(CONFIG_X86) |
783 | /* If this is the root bus, the risk of hitting | 783 | /* If this is the root bus, the risk of hitting |
784 | * some strange system devices which aren't protected | 784 | * some strange system devices which aren't protected |
785 | * by either ACPI resource tables or properly requested | 785 | * by either ACPI resource tables or properly requested |
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index b768fa81f043..acf60ffc8a12 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
@@ -38,8 +38,12 @@ | |||
38 | #include <pcmcia/cs.h> | 38 | #include <pcmcia/cs.h> |
39 | #include <pcmcia/ss.h> | 39 | #include <pcmcia/ss.h> |
40 | 40 | ||
41 | #include <asm/hardware/scoop.h> | ||
42 | |||
41 | #include "sa1100_generic.h" | 43 | #include "sa1100_generic.h" |
42 | 44 | ||
45 | int __init pcmcia_collie_init(struct device *dev); | ||
46 | |||
43 | static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { | 47 | static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { |
44 | #ifdef CONFIG_SA1100_ASSABET | 48 | #ifdef CONFIG_SA1100_ASSABET |
45 | pcmcia_assabet_init, | 49 | pcmcia_assabet_init, |
@@ -56,6 +60,9 @@ static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { | |||
56 | #ifdef CONFIG_SA1100_SIMPAD | 60 | #ifdef CONFIG_SA1100_SIMPAD |
57 | pcmcia_simpad_init, | 61 | pcmcia_simpad_init, |
58 | #endif | 62 | #endif |
63 | #ifdef CONFIG_SA1100_COLLIE | ||
64 | pcmcia_collie_init, | ||
65 | #endif | ||
59 | }; | 66 | }; |
60 | 67 | ||
61 | static int sa11x0_drv_pcmcia_probe(struct device *dev) | 68 | static int sa11x0_drv_pcmcia_probe(struct device *dev) |
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 94442ffd4aed..cbb2749db178 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/pnp.h> | 14 | #include <linux/pnp.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/bitmap.h> | ||
15 | #include "base.h" | 17 | #include "base.h" |
16 | 18 | ||
17 | DECLARE_MUTEX(pnp_res_mutex); | 19 | DECLARE_MUTEX(pnp_res_mutex); |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index b0ca65b68645..5e38cd7335f7 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -7,6 +7,8 @@ | |||
7 | #include <linux/ctype.h> | 7 | #include <linux/ctype.h> |
8 | #include <linux/pnp.h> | 8 | #include <linux/pnp.h> |
9 | #include <linux/pnpbios.h> | 9 | #include <linux/pnpbios.h> |
10 | #include <linux/string.h> | ||
11 | #include <linux/slab.h> | ||
10 | 12 | ||
11 | #ifdef CONFIG_PCI | 13 | #ifdef CONFIG_PCI |
12 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c index fc7a213e591f..c570a9f6ce9c 100644 --- a/drivers/s390/char/con3270.c +++ b/drivers/s390/char/con3270.c | |||
@@ -213,6 +213,9 @@ con3270_update(struct con3270 *cp) | |||
213 | struct string *s, *n; | 213 | struct string *s, *n; |
214 | int rc; | 214 | int rc; |
215 | 215 | ||
216 | if (cp->view.dev) | ||
217 | raw3270_activate_view(&cp->view); | ||
218 | |||
216 | wrq = xchg(&cp->write, 0); | 219 | wrq = xchg(&cp->write, 0); |
217 | if (!wrq) { | 220 | if (!wrq) { |
218 | con3270_set_timer(cp, 1); | 221 | con3270_set_timer(cp, 1); |
@@ -489,8 +492,6 @@ con3270_write(struct console *co, const char *str, unsigned int count) | |||
489 | unsigned char c; | 492 | unsigned char c; |
490 | 493 | ||
491 | cp = condev; | 494 | cp = condev; |
492 | if (cp->view.dev) | ||
493 | raw3270_activate_view(&cp->view); | ||
494 | spin_lock_irqsave(&cp->view.lock, flags); | 495 | spin_lock_irqsave(&cp->view.lock, flags); |
495 | while (count-- > 0) { | 496 | while (count-- > 0) { |
496 | c = *str++; | 497 | c = *str++; |
@@ -620,7 +621,7 @@ con3270_init(void) | |||
620 | (void (*)(unsigned long)) con3270_read_tasklet, | 621 | (void (*)(unsigned long)) con3270_read_tasklet, |
621 | (unsigned long) condev->read); | 622 | (unsigned long) condev->read); |
622 | 623 | ||
623 | raw3270_add_view(&condev->view, &con3270_fn, 0); | 624 | raw3270_add_view(&condev->view, &con3270_fn, 1); |
624 | 625 | ||
625 | INIT_LIST_HEAD(&condev->freemem); | 626 | INIT_LIST_HEAD(&condev->freemem); |
626 | for (i = 0; i < CON3270_STRING_PAGES; i++) { | 627 | for (i = 0; i < CON3270_STRING_PAGES; i++) { |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 60afcdcf91c2..735a7fcdeff5 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -33,8 +33,11 @@ struct fs3270 { | |||
33 | int read_command; /* ccw command to use for reads. */ | 33 | int read_command; /* ccw command to use for reads. */ |
34 | int write_command; /* ccw command to use for writes. */ | 34 | int write_command; /* ccw command to use for writes. */ |
35 | int attention; /* Got attention. */ | 35 | int attention; /* Got attention. */ |
36 | struct raw3270_request *clear; /* single clear request. */ | 36 | int active; /* Fullscreen view is active. */ |
37 | wait_queue_head_t attn_wait; /* Attention wait queue. */ | 37 | struct raw3270_request *init; /* single init request. */ |
38 | wait_queue_head_t wait; /* Init & attention wait queue. */ | ||
39 | struct idal_buffer *rdbuf; /* full-screen-deactivate buffer */ | ||
40 | size_t rdbuf_size; /* size of data returned by RDBUF */ | ||
38 | }; | 41 | }; |
39 | 42 | ||
40 | static void | 43 | static void |
@@ -43,58 +46,172 @@ fs3270_wake_up(struct raw3270_request *rq, void *data) | |||
43 | wake_up((wait_queue_head_t *) data); | 46 | wake_up((wait_queue_head_t *) data); |
44 | } | 47 | } |
45 | 48 | ||
49 | static inline int | ||
50 | fs3270_working(struct fs3270 *fp) | ||
51 | { | ||
52 | /* | ||
53 | * The fullscreen view is in working order if the view | ||
54 | * has been activated AND the initial request is finished. | ||
55 | */ | ||
56 | return fp->active && raw3270_request_final(fp->init); | ||
57 | } | ||
58 | |||
46 | static int | 59 | static int |
47 | fs3270_do_io(struct raw3270_view *view, struct raw3270_request *rq) | 60 | fs3270_do_io(struct raw3270_view *view, struct raw3270_request *rq) |
48 | { | 61 | { |
49 | wait_queue_head_t wq; | 62 | struct fs3270 *fp; |
50 | int rc; | 63 | int rc; |
51 | 64 | ||
52 | init_waitqueue_head(&wq); | 65 | fp = (struct fs3270 *) view; |
53 | rq->callback = fs3270_wake_up; | 66 | rq->callback = fs3270_wake_up; |
54 | rq->callback_data = &wq; | 67 | rq->callback_data = &fp->wait; |
55 | rc = raw3270_start(view, rq); | 68 | |
56 | if (rc) | 69 | do { |
57 | return rc; | 70 | if (!fs3270_working(fp)) { |
58 | /* Started sucessfully. Now wait for completion. */ | 71 | /* Fullscreen view isn't ready yet. */ |
59 | wait_event(wq, raw3270_request_final(rq)); | 72 | rc = wait_event_interruptible(fp->wait, |
60 | return rq->rc; | 73 | fs3270_working(fp)); |
74 | if (rc != 0) | ||
75 | break; | ||
76 | } | ||
77 | rc = raw3270_start(view, rq); | ||
78 | if (rc == 0) { | ||
79 | /* Started sucessfully. Now wait for completion. */ | ||
80 | wait_event(fp->wait, raw3270_request_final(rq)); | ||
81 | } | ||
82 | } while (rc == -EACCES); | ||
83 | return rc; | ||
61 | } | 84 | } |
62 | 85 | ||
86 | /* | ||
87 | * Switch to the fullscreen view. | ||
88 | */ | ||
63 | static void | 89 | static void |
64 | fs3270_reset_callback(struct raw3270_request *rq, void *data) | 90 | fs3270_reset_callback(struct raw3270_request *rq, void *data) |
65 | { | 91 | { |
92 | struct fs3270 *fp; | ||
93 | |||
94 | fp = (struct fs3270 *) rq->view; | ||
66 | raw3270_request_reset(rq); | 95 | raw3270_request_reset(rq); |
96 | wake_up(&fp->wait); | ||
97 | } | ||
98 | |||
99 | static void | ||
100 | fs3270_restore_callback(struct raw3270_request *rq, void *data) | ||
101 | { | ||
102 | struct fs3270 *fp; | ||
103 | |||
104 | fp = (struct fs3270 *) rq->view; | ||
105 | if (rq->rc != 0 || rq->rescnt != 0) { | ||
106 | if (fp->fs_pid) | ||
107 | kill_proc(fp->fs_pid, SIGHUP, 1); | ||
108 | } | ||
109 | fp->rdbuf_size = 0; | ||
110 | raw3270_request_reset(rq); | ||
111 | wake_up(&fp->wait); | ||
67 | } | 112 | } |
68 | 113 | ||
69 | /* | ||
70 | * Switch to the fullscreen view. | ||
71 | */ | ||
72 | static int | 114 | static int |
73 | fs3270_activate(struct raw3270_view *view) | 115 | fs3270_activate(struct raw3270_view *view) |
74 | { | 116 | { |
75 | struct fs3270 *fp; | 117 | struct fs3270 *fp; |
118 | char *cp; | ||
119 | int rc; | ||
76 | 120 | ||
77 | fp = (struct fs3270 *) view; | 121 | fp = (struct fs3270 *) view; |
78 | raw3270_request_set_cmd(fp->clear, TC_EWRITEA); | 122 | |
79 | fp->clear->callback = fs3270_reset_callback; | 123 | /* If an old init command is still running just return. */ |
80 | return raw3270_start(view, fp->clear); | 124 | if (!raw3270_request_final(fp->init)) |
125 | return 0; | ||
126 | |||
127 | if (fp->rdbuf_size == 0) { | ||
128 | /* No saved buffer. Just clear the screen. */ | ||
129 | raw3270_request_set_cmd(fp->init, TC_EWRITEA); | ||
130 | fp->init->callback = fs3270_reset_callback; | ||
131 | } else { | ||
132 | /* Restore fullscreen buffer saved by fs3270_deactivate. */ | ||
133 | raw3270_request_set_cmd(fp->init, TC_EWRITEA); | ||
134 | raw3270_request_set_idal(fp->init, fp->rdbuf); | ||
135 | fp->init->ccw.count = fp->rdbuf_size; | ||
136 | cp = fp->rdbuf->data[0]; | ||
137 | cp[0] = TW_KR; | ||
138 | cp[1] = TO_SBA; | ||
139 | cp[2] = cp[6]; | ||
140 | cp[3] = cp[7]; | ||
141 | cp[4] = TO_IC; | ||
142 | cp[5] = TO_SBA; | ||
143 | cp[6] = 0x40; | ||
144 | cp[7] = 0x40; | ||
145 | fp->init->rescnt = 0; | ||
146 | fp->init->callback = fs3270_restore_callback; | ||
147 | } | ||
148 | rc = fp->init->rc = raw3270_start_locked(view, fp->init); | ||
149 | if (rc) | ||
150 | fp->init->callback(fp->init, NULL); | ||
151 | else | ||
152 | fp->active = 1; | ||
153 | return rc; | ||
81 | } | 154 | } |
82 | 155 | ||
83 | /* | 156 | /* |
84 | * Shutdown fullscreen view. | 157 | * Shutdown fullscreen view. |
85 | */ | 158 | */ |
86 | static void | 159 | static void |
160 | fs3270_save_callback(struct raw3270_request *rq, void *data) | ||
161 | { | ||
162 | struct fs3270 *fp; | ||
163 | |||
164 | fp = (struct fs3270 *) rq->view; | ||
165 | |||
166 | /* Correct idal buffer element 0 address. */ | ||
167 | fp->rdbuf->data[0] -= 5; | ||
168 | fp->rdbuf->size += 5; | ||
169 | |||
170 | /* | ||
171 | * If the rdbuf command failed or the idal buffer is | ||
172 | * to small for the amount of data returned by the | ||
173 | * rdbuf command, then we have no choice but to send | ||
174 | * a SIGHUP to the application. | ||
175 | */ | ||
176 | if (rq->rc != 0 || rq->rescnt == 0) { | ||
177 | if (fp->fs_pid) | ||
178 | kill_proc(fp->fs_pid, SIGHUP, 1); | ||
179 | fp->rdbuf_size = 0; | ||
180 | } else | ||
181 | fp->rdbuf_size = fp->rdbuf->size - rq->rescnt; | ||
182 | raw3270_request_reset(rq); | ||
183 | wake_up(&fp->wait); | ||
184 | } | ||
185 | |||
186 | static void | ||
87 | fs3270_deactivate(struct raw3270_view *view) | 187 | fs3270_deactivate(struct raw3270_view *view) |
88 | { | 188 | { |
89 | // FIXME: is this a good idea? The user program using fullscreen 3270 | ||
90 | // will die just because a console message appeared. On the other | ||
91 | // hand the fullscreen device is unoperational now. | ||
92 | struct fs3270 *fp; | 189 | struct fs3270 *fp; |
93 | 190 | ||
94 | fp = (struct fs3270 *) view; | 191 | fp = (struct fs3270 *) view; |
95 | if (fp->fs_pid != 0) | 192 | fp->active = 0; |
96 | kill_proc(fp->fs_pid, SIGHUP, 1); | 193 | |
97 | fp->fs_pid = 0; | 194 | /* If an old init command is still running just return. */ |
195 | if (!raw3270_request_final(fp->init)) | ||
196 | return; | ||
197 | |||
198 | /* Prepare read-buffer request. */ | ||
199 | raw3270_request_set_cmd(fp->init, TC_RDBUF); | ||
200 | /* | ||
201 | * Hackish: skip first 5 bytes of the idal buffer to make | ||
202 | * room for the TW_KR/TO_SBA/<address>/<address>/TO_IC sequence | ||
203 | * in the activation command. | ||
204 | */ | ||
205 | fp->rdbuf->data[0] += 5; | ||
206 | fp->rdbuf->size -= 5; | ||
207 | raw3270_request_set_idal(fp->init, fp->rdbuf); | ||
208 | fp->init->rescnt = 0; | ||
209 | fp->init->callback = fs3270_save_callback; | ||
210 | |||
211 | /* Start I/O to read in the 3270 buffer. */ | ||
212 | fp->init->rc = raw3270_start_locked(view, fp->init); | ||
213 | if (fp->init->rc) | ||
214 | fp->init->callback(fp->init, NULL); | ||
98 | } | 215 | } |
99 | 216 | ||
100 | static int | 217 | static int |
@@ -103,7 +220,7 @@ fs3270_irq(struct fs3270 *fp, struct raw3270_request *rq, struct irb *irb) | |||
103 | /* Handle ATTN. Set indication and wake waiters for attention. */ | 220 | /* Handle ATTN. Set indication and wake waiters for attention. */ |
104 | if (irb->scsw.dstat & DEV_STAT_ATTENTION) { | 221 | if (irb->scsw.dstat & DEV_STAT_ATTENTION) { |
105 | fp->attention = 1; | 222 | fp->attention = 1; |
106 | wake_up(&fp->attn_wait); | 223 | wake_up(&fp->wait); |
107 | } | 224 | } |
108 | 225 | ||
109 | if (rq) { | 226 | if (rq) { |
@@ -125,7 +242,7 @@ fs3270_read(struct file *filp, char *data, size_t count, loff_t *off) | |||
125 | struct fs3270 *fp; | 242 | struct fs3270 *fp; |
126 | struct raw3270_request *rq; | 243 | struct raw3270_request *rq; |
127 | struct idal_buffer *ib; | 244 | struct idal_buffer *ib; |
128 | int rc; | 245 | ssize_t rc; |
129 | 246 | ||
130 | if (count == 0 || count > 65535) | 247 | if (count == 0 || count > 65535) |
131 | return -EINVAL; | 248 | return -EINVAL; |
@@ -133,7 +250,7 @@ fs3270_read(struct file *filp, char *data, size_t count, loff_t *off) | |||
133 | if (!fp) | 250 | if (!fp) |
134 | return -ENODEV; | 251 | return -ENODEV; |
135 | ib = idal_buffer_alloc(count, 0); | 252 | ib = idal_buffer_alloc(count, 0); |
136 | if (!ib) | 253 | if (IS_ERR(ib)) |
137 | return -ENOMEM; | 254 | return -ENOMEM; |
138 | rq = raw3270_request_alloc(0); | 255 | rq = raw3270_request_alloc(0); |
139 | if (!IS_ERR(rq)) { | 256 | if (!IS_ERR(rq)) { |
@@ -141,10 +258,19 @@ fs3270_read(struct file *filp, char *data, size_t count, loff_t *off) | |||
141 | fp->read_command = 6; | 258 | fp->read_command = 6; |
142 | raw3270_request_set_cmd(rq, fp->read_command ? : 2); | 259 | raw3270_request_set_cmd(rq, fp->read_command ? : 2); |
143 | raw3270_request_set_idal(rq, ib); | 260 | raw3270_request_set_idal(rq, ib); |
144 | wait_event(fp->attn_wait, fp->attention); | 261 | rc = wait_event_interruptible(fp->wait, fp->attention); |
145 | rc = fs3270_do_io(&fp->view, rq); | 262 | fp->attention = 0; |
146 | if (rc == 0 && idal_buffer_to_user(ib, data, count)) | 263 | if (rc == 0) { |
147 | rc = -EFAULT; | 264 | rc = fs3270_do_io(&fp->view, rq); |
265 | if (rc == 0) { | ||
266 | count -= rq->rescnt; | ||
267 | if (idal_buffer_to_user(ib, data, count) != 0) | ||
268 | rc = -EFAULT; | ||
269 | else | ||
270 | rc = count; | ||
271 | |||
272 | } | ||
273 | } | ||
148 | raw3270_request_free(rq); | 274 | raw3270_request_free(rq); |
149 | } else | 275 | } else |
150 | rc = PTR_ERR(rq); | 276 | rc = PTR_ERR(rq); |
@@ -162,13 +288,13 @@ fs3270_write(struct file *filp, const char *data, size_t count, loff_t *off) | |||
162 | struct raw3270_request *rq; | 288 | struct raw3270_request *rq; |
163 | struct idal_buffer *ib; | 289 | struct idal_buffer *ib; |
164 | int write_command; | 290 | int write_command; |
165 | int rc; | 291 | ssize_t rc; |
166 | 292 | ||
167 | fp = filp->private_data; | 293 | fp = filp->private_data; |
168 | if (!fp) | 294 | if (!fp) |
169 | return -ENODEV; | 295 | return -ENODEV; |
170 | ib = idal_buffer_alloc(count, 0); | 296 | ib = idal_buffer_alloc(count, 0); |
171 | if (!ib) | 297 | if (IS_ERR(ib)) |
172 | return -ENOMEM; | 298 | return -ENOMEM; |
173 | rq = raw3270_request_alloc(0); | 299 | rq = raw3270_request_alloc(0); |
174 | if (!IS_ERR(rq)) { | 300 | if (!IS_ERR(rq)) { |
@@ -179,6 +305,8 @@ fs3270_write(struct file *filp, const char *data, size_t count, loff_t *off) | |||
179 | raw3270_request_set_cmd(rq, write_command); | 305 | raw3270_request_set_cmd(rq, write_command); |
180 | raw3270_request_set_idal(rq, ib); | 306 | raw3270_request_set_idal(rq, ib); |
181 | rc = fs3270_do_io(&fp->view, rq); | 307 | rc = fs3270_do_io(&fp->view, rq); |
308 | if (rc == 0) | ||
309 | rc = count - rq->rescnt; | ||
182 | } else | 310 | } else |
183 | rc = -EFAULT; | 311 | rc = -EFAULT; |
184 | raw3270_request_free(rq); | 312 | raw3270_request_free(rq); |
@@ -232,7 +360,7 @@ fs3270_ioctl(struct inode *inode, struct file *filp, | |||
232 | } | 360 | } |
233 | 361 | ||
234 | /* | 362 | /* |
235 | * Allocate tty3270 structure. | 363 | * Allocate fs3270 structure. |
236 | */ | 364 | */ |
237 | static struct fs3270 * | 365 | static struct fs3270 * |
238 | fs3270_alloc_view(void) | 366 | fs3270_alloc_view(void) |
@@ -243,8 +371,8 @@ fs3270_alloc_view(void) | |||
243 | if (!fp) | 371 | if (!fp) |
244 | return ERR_PTR(-ENOMEM); | 372 | return ERR_PTR(-ENOMEM); |
245 | memset(fp, 0, sizeof(struct fs3270)); | 373 | memset(fp, 0, sizeof(struct fs3270)); |
246 | fp->clear = raw3270_request_alloc(0); | 374 | fp->init = raw3270_request_alloc(0); |
247 | if (!IS_ERR(fp->clear)) { | 375 | if (IS_ERR(fp->init)) { |
248 | kfree(fp); | 376 | kfree(fp); |
249 | return ERR_PTR(-ENOMEM); | 377 | return ERR_PTR(-ENOMEM); |
250 | } | 378 | } |
@@ -252,12 +380,17 @@ fs3270_alloc_view(void) | |||
252 | } | 380 | } |
253 | 381 | ||
254 | /* | 382 | /* |
255 | * Free tty3270 structure. | 383 | * Free fs3270 structure. |
256 | */ | 384 | */ |
257 | static void | 385 | static void |
258 | fs3270_free_view(struct raw3270_view *view) | 386 | fs3270_free_view(struct raw3270_view *view) |
259 | { | 387 | { |
260 | raw3270_request_free(((struct fs3270 *) view)->clear); | 388 | struct fs3270 *fp; |
389 | |||
390 | fp = (struct fs3270 *) view; | ||
391 | if (fp->rdbuf) | ||
392 | idal_buffer_free(fp->rdbuf); | ||
393 | raw3270_request_free(((struct fs3270 *) view)->init); | ||
261 | kfree(view); | 394 | kfree(view); |
262 | } | 395 | } |
263 | 396 | ||
@@ -285,11 +418,20 @@ static int | |||
285 | fs3270_open(struct inode *inode, struct file *filp) | 418 | fs3270_open(struct inode *inode, struct file *filp) |
286 | { | 419 | { |
287 | struct fs3270 *fp; | 420 | struct fs3270 *fp; |
421 | struct idal_buffer *ib; | ||
288 | int minor, rc; | 422 | int minor, rc; |
289 | 423 | ||
290 | if (imajor(filp->f_dentry->d_inode) != IBM_FS3270_MAJOR) | 424 | if (imajor(filp->f_dentry->d_inode) != IBM_FS3270_MAJOR) |
291 | return -ENODEV; | 425 | return -ENODEV; |
292 | minor = iminor(filp->f_dentry->d_inode); | 426 | minor = iminor(filp->f_dentry->d_inode); |
427 | /* Check for minor 0 multiplexer. */ | ||
428 | if (minor == 0) { | ||
429 | if (!current->signal->tty) | ||
430 | return -ENODEV; | ||
431 | if (current->signal->tty->driver->major != IBM_TTY3270_MAJOR) | ||
432 | return -ENODEV; | ||
433 | minor = current->signal->tty->index + RAW3270_FIRSTMINOR; | ||
434 | } | ||
293 | /* Check if some other program is already using fullscreen mode. */ | 435 | /* Check if some other program is already using fullscreen mode. */ |
294 | fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor); | 436 | fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor); |
295 | if (!IS_ERR(fp)) { | 437 | if (!IS_ERR(fp)) { |
@@ -301,7 +443,7 @@ fs3270_open(struct inode *inode, struct file *filp) | |||
301 | if (IS_ERR(fp)) | 443 | if (IS_ERR(fp)) |
302 | return PTR_ERR(fp); | 444 | return PTR_ERR(fp); |
303 | 445 | ||
304 | init_waitqueue_head(&fp->attn_wait); | 446 | init_waitqueue_head(&fp->wait); |
305 | fp->fs_pid = current->pid; | 447 | fp->fs_pid = current->pid; |
306 | rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); | 448 | rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); |
307 | if (rc) { | 449 | if (rc) { |
@@ -309,8 +451,18 @@ fs3270_open(struct inode *inode, struct file *filp) | |||
309 | return rc; | 451 | return rc; |
310 | } | 452 | } |
311 | 453 | ||
454 | /* Allocate idal-buffer. */ | ||
455 | ib = idal_buffer_alloc(2*fp->view.rows*fp->view.cols + 5, 0); | ||
456 | if (IS_ERR(ib)) { | ||
457 | raw3270_put_view(&fp->view); | ||
458 | raw3270_del_view(&fp->view); | ||
459 | return PTR_ERR(fp); | ||
460 | } | ||
461 | fp->rdbuf = ib; | ||
462 | |||
312 | rc = raw3270_activate_view(&fp->view); | 463 | rc = raw3270_activate_view(&fp->view); |
313 | if (rc) { | 464 | if (rc) { |
465 | raw3270_put_view(&fp->view); | ||
314 | raw3270_del_view(&fp->view); | 466 | raw3270_del_view(&fp->view); |
315 | return rc; | 467 | return rc; |
316 | } | 468 | } |
@@ -329,8 +481,12 @@ fs3270_close(struct inode *inode, struct file *filp) | |||
329 | 481 | ||
330 | fp = filp->private_data; | 482 | fp = filp->private_data; |
331 | filp->private_data = 0; | 483 | filp->private_data = 0; |
332 | if (fp) | 484 | if (fp) { |
485 | fp->fs_pid = 0; | ||
486 | raw3270_reset(&fp->view); | ||
487 | raw3270_put_view(&fp->view); | ||
333 | raw3270_del_view(&fp->view); | 488 | raw3270_del_view(&fp->view); |
489 | } | ||
334 | return 0; | 490 | return 0; |
335 | } | 491 | } |
336 | 492 | ||
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 328d9cbc56a3..d66946443dfc 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -25,6 +25,12 @@ | |||
25 | 25 | ||
26 | #include "raw3270.h" | 26 | #include "raw3270.h" |
27 | 27 | ||
28 | #include <linux/major.h> | ||
29 | #include <linux/kdev_t.h> | ||
30 | #include <linux/device.h> | ||
31 | |||
32 | struct class *class3270; | ||
33 | |||
28 | /* The main 3270 data structure. */ | 34 | /* The main 3270 data structure. */ |
29 | struct raw3270 { | 35 | struct raw3270 { |
30 | struct list_head list; | 36 | struct list_head list; |
@@ -41,6 +47,8 @@ struct raw3270 { | |||
41 | struct timer_list timer; /* Device timer. */ | 47 | struct timer_list timer; /* Device timer. */ |
42 | 48 | ||
43 | unsigned char *ascebc; /* ascii -> ebcdic table */ | 49 | unsigned char *ascebc; /* ascii -> ebcdic table */ |
50 | struct class_device *clttydev; /* 3270-class tty device ptr */ | ||
51 | struct class_device *cltubdev; /* 3270-class tub device ptr */ | ||
44 | }; | 52 | }; |
45 | 53 | ||
46 | /* raw3270->flags */ | 54 | /* raw3270->flags */ |
@@ -317,6 +325,22 @@ raw3270_start(struct raw3270_view *view, struct raw3270_request *rq) | |||
317 | } | 325 | } |
318 | 326 | ||
319 | int | 327 | int |
328 | raw3270_start_locked(struct raw3270_view *view, struct raw3270_request *rq) | ||
329 | { | ||
330 | struct raw3270 *rp; | ||
331 | int rc; | ||
332 | |||
333 | rp = view->dev; | ||
334 | if (!rp || rp->view != view) | ||
335 | rc = -EACCES; | ||
336 | else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) | ||
337 | rc = -ENODEV; | ||
338 | else | ||
339 | rc = __raw3270_start(rp, view, rq); | ||
340 | return rc; | ||
341 | } | ||
342 | |||
343 | int | ||
320 | raw3270_start_irq(struct raw3270_view *view, struct raw3270_request *rq) | 344 | raw3270_start_irq(struct raw3270_view *view, struct raw3270_request *rq) |
321 | { | 345 | { |
322 | struct raw3270 *rp; | 346 | struct raw3270 *rp; |
@@ -744,6 +768,22 @@ raw3270_reset_device(struct raw3270 *rp) | |||
744 | return rc; | 768 | return rc; |
745 | } | 769 | } |
746 | 770 | ||
771 | int | ||
772 | raw3270_reset(struct raw3270_view *view) | ||
773 | { | ||
774 | struct raw3270 *rp; | ||
775 | int rc; | ||
776 | |||
777 | rp = view->dev; | ||
778 | if (!rp || rp->view != view) | ||
779 | rc = -EACCES; | ||
780 | else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) | ||
781 | rc = -ENODEV; | ||
782 | else | ||
783 | rc = raw3270_reset_device(view->dev); | ||
784 | return rc; | ||
785 | } | ||
786 | |||
747 | /* | 787 | /* |
748 | * Setup new 3270 device. | 788 | * Setup new 3270 device. |
749 | */ | 789 | */ |
@@ -774,11 +814,12 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc) | |||
774 | 814 | ||
775 | /* | 815 | /* |
776 | * Add device to list and find the smallest unused minor | 816 | * Add device to list and find the smallest unused minor |
777 | * number for it. | 817 | * number for it. Note: there is no device with minor 0, |
818 | * see special case for fs3270.c:fs3270_open(). | ||
778 | */ | 819 | */ |
779 | down(&raw3270_sem); | 820 | down(&raw3270_sem); |
780 | /* Keep the list sorted. */ | 821 | /* Keep the list sorted. */ |
781 | minor = 0; | 822 | minor = RAW3270_FIRSTMINOR; |
782 | rp->minor = -1; | 823 | rp->minor = -1; |
783 | list_for_each(l, &raw3270_devices) { | 824 | list_for_each(l, &raw3270_devices) { |
784 | tmp = list_entry(l, struct raw3270, list); | 825 | tmp = list_entry(l, struct raw3270, list); |
@@ -789,7 +830,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc) | |||
789 | } | 830 | } |
790 | minor++; | 831 | minor++; |
791 | } | 832 | } |
792 | if (rp->minor == -1 && minor < RAW3270_MAXDEVS) { | 833 | if (rp->minor == -1 && minor < RAW3270_MAXDEVS + RAW3270_FIRSTMINOR) { |
793 | rp->minor = minor; | 834 | rp->minor = minor; |
794 | list_add_tail(&rp->list, &raw3270_devices); | 835 | list_add_tail(&rp->list, &raw3270_devices); |
795 | } | 836 | } |
@@ -941,11 +982,12 @@ raw3270_deactivate_view(struct raw3270_view *view) | |||
941 | list_add_tail(&view->list, &rp->view_list); | 982 | list_add_tail(&view->list, &rp->view_list); |
942 | /* Try to activate another view. */ | 983 | /* Try to activate another view. */ |
943 | if (test_bit(RAW3270_FLAGS_READY, &rp->flags)) { | 984 | if (test_bit(RAW3270_FLAGS_READY, &rp->flags)) { |
944 | list_for_each_entry(view, &rp->view_list, list) | 985 | list_for_each_entry(view, &rp->view_list, list) { |
945 | if (view->fn->activate(view) == 0) { | 986 | rp->view = view; |
946 | rp->view = view; | 987 | if (view->fn->activate(view) == 0) |
947 | break; | 988 | break; |
948 | } | 989 | rp->view = 0; |
990 | } | ||
949 | } | 991 | } |
950 | } | 992 | } |
951 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); | 993 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); |
@@ -961,6 +1003,8 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) | |||
961 | struct raw3270 *rp; | 1003 | struct raw3270 *rp; |
962 | int rc; | 1004 | int rc; |
963 | 1005 | ||
1006 | if (minor <= 0) | ||
1007 | return -ENODEV; | ||
964 | down(&raw3270_sem); | 1008 | down(&raw3270_sem); |
965 | rc = -ENODEV; | 1009 | rc = -ENODEV; |
966 | list_for_each_entry(rp, &raw3270_devices, list) { | 1010 | list_for_each_entry(rp, &raw3270_devices, list) { |
@@ -976,7 +1020,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) | |||
976 | view->cols = rp->cols; | 1020 | view->cols = rp->cols; |
977 | view->ascebc = rp->ascebc; | 1021 | view->ascebc = rp->ascebc; |
978 | spin_lock_init(&view->lock); | 1022 | spin_lock_init(&view->lock); |
979 | list_add_tail(&view->list, &rp->view_list); | 1023 | list_add(&view->list, &rp->view_list); |
980 | rc = 0; | 1024 | rc = 0; |
981 | } | 1025 | } |
982 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); | 1026 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); |
@@ -1039,7 +1083,7 @@ raw3270_del_view(struct raw3270_view *view) | |||
1039 | if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags)) { | 1083 | if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags)) { |
1040 | /* Try to activate another view. */ | 1084 | /* Try to activate another view. */ |
1041 | list_for_each_entry(nv, &rp->view_list, list) { | 1085 | list_for_each_entry(nv, &rp->view_list, list) { |
1042 | if (nv->fn->activate(view) == 0) { | 1086 | if (nv->fn->activate(nv) == 0) { |
1043 | rp->view = nv; | 1087 | rp->view = nv; |
1044 | break; | 1088 | break; |
1045 | } | 1089 | } |
@@ -1063,6 +1107,12 @@ raw3270_delete_device(struct raw3270 *rp) | |||
1063 | 1107 | ||
1064 | /* Remove from device chain. */ | 1108 | /* Remove from device chain. */ |
1065 | down(&raw3270_sem); | 1109 | down(&raw3270_sem); |
1110 | if (rp->clttydev) | ||
1111 | class_device_destroy(class3270, | ||
1112 | MKDEV(IBM_TTY3270_MAJOR, rp->minor)); | ||
1113 | if (rp->cltubdev) | ||
1114 | class_device_destroy(class3270, | ||
1115 | MKDEV(IBM_FS3270_MAJOR, rp->minor)); | ||
1066 | list_del_init(&rp->list); | 1116 | list_del_init(&rp->list); |
1067 | up(&raw3270_sem); | 1117 | up(&raw3270_sem); |
1068 | 1118 | ||
@@ -1129,6 +1179,16 @@ raw3270_create_attributes(struct raw3270 *rp) | |||
1129 | { | 1179 | { |
1130 | //FIXME: check return code | 1180 | //FIXME: check return code |
1131 | sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); | 1181 | sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); |
1182 | rp->clttydev = | ||
1183 | class_device_create(class3270, | ||
1184 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), | ||
1185 | &rp->cdev->dev, "tty%s", | ||
1186 | rp->cdev->dev.bus_id); | ||
1187 | rp->cltubdev = | ||
1188 | class_device_create(class3270, | ||
1189 | MKDEV(IBM_FS3270_MAJOR, rp->minor), | ||
1190 | &rp->cdev->dev, "tub%s", | ||
1191 | rp->cdev->dev.bus_id); | ||
1132 | } | 1192 | } |
1133 | 1193 | ||
1134 | /* | 1194 | /* |
@@ -1189,13 +1249,13 @@ raw3270_set_online (struct ccw_device *cdev) | |||
1189 | return PTR_ERR(rp); | 1249 | return PTR_ERR(rp); |
1190 | rc = raw3270_reset_device(rp); | 1250 | rc = raw3270_reset_device(rp); |
1191 | if (rc) | 1251 | if (rc) |
1192 | return rc; | 1252 | goto failure; |
1193 | rc = raw3270_size_device(rp); | 1253 | rc = raw3270_size_device(rp); |
1194 | if (rc) | 1254 | if (rc) |
1195 | return rc; | 1255 | goto failure; |
1196 | rc = raw3270_reset_device(rp); | 1256 | rc = raw3270_reset_device(rp); |
1197 | if (rc) | 1257 | if (rc) |
1198 | return rc; | 1258 | goto failure; |
1199 | raw3270_create_attributes(rp); | 1259 | raw3270_create_attributes(rp); |
1200 | set_bit(RAW3270_FLAGS_READY, &rp->flags); | 1260 | set_bit(RAW3270_FLAGS_READY, &rp->flags); |
1201 | down(&raw3270_sem); | 1261 | down(&raw3270_sem); |
@@ -1203,6 +1263,10 @@ raw3270_set_online (struct ccw_device *cdev) | |||
1203 | np->notifier(rp->minor, 1); | 1263 | np->notifier(rp->minor, 1); |
1204 | up(&raw3270_sem); | 1264 | up(&raw3270_sem); |
1205 | return 0; | 1265 | return 0; |
1266 | |||
1267 | failure: | ||
1268 | raw3270_delete_device(rp); | ||
1269 | return rc; | ||
1206 | } | 1270 | } |
1207 | 1271 | ||
1208 | /* | 1272 | /* |
@@ -1217,6 +1281,14 @@ raw3270_remove (struct ccw_device *cdev) | |||
1217 | struct raw3270_notifier *np; | 1281 | struct raw3270_notifier *np; |
1218 | 1282 | ||
1219 | rp = cdev->dev.driver_data; | 1283 | rp = cdev->dev.driver_data; |
1284 | /* | ||
1285 | * _remove is the opposite of _probe; it's probe that | ||
1286 | * should set up rp. raw3270_remove gets entered for | ||
1287 | * devices even if they haven't been varied online. | ||
1288 | * Thus, rp may validly be NULL here. | ||
1289 | */ | ||
1290 | if (rp == NULL) | ||
1291 | return; | ||
1220 | clear_bit(RAW3270_FLAGS_READY, &rp->flags); | 1292 | clear_bit(RAW3270_FLAGS_READY, &rp->flags); |
1221 | 1293 | ||
1222 | sysfs_remove_group(&cdev->dev.kobj, &raw3270_attr_group); | 1294 | sysfs_remove_group(&cdev->dev.kobj, &raw3270_attr_group); |
@@ -1301,6 +1373,7 @@ raw3270_init(void) | |||
1301 | if (rc == 0) { | 1373 | if (rc == 0) { |
1302 | /* Create attributes for early (= console) device. */ | 1374 | /* Create attributes for early (= console) device. */ |
1303 | down(&raw3270_sem); | 1375 | down(&raw3270_sem); |
1376 | class3270 = class_create(THIS_MODULE, "3270"); | ||
1304 | list_for_each_entry(rp, &raw3270_devices, list) { | 1377 | list_for_each_entry(rp, &raw3270_devices, list) { |
1305 | get_device(&rp->cdev->dev); | 1378 | get_device(&rp->cdev->dev); |
1306 | raw3270_create_attributes(rp); | 1379 | raw3270_create_attributes(rp); |
@@ -1314,6 +1387,7 @@ static void | |||
1314 | raw3270_exit(void) | 1387 | raw3270_exit(void) |
1315 | { | 1388 | { |
1316 | ccw_driver_unregister(&raw3270_ccw_driver); | 1389 | ccw_driver_unregister(&raw3270_ccw_driver); |
1390 | class_destroy(class3270); | ||
1317 | } | 1391 | } |
1318 | 1392 | ||
1319 | MODULE_LICENSE("GPL"); | 1393 | MODULE_LICENSE("GPL"); |
@@ -1335,7 +1409,9 @@ EXPORT_SYMBOL(raw3270_find_view); | |||
1335 | EXPORT_SYMBOL(raw3270_activate_view); | 1409 | EXPORT_SYMBOL(raw3270_activate_view); |
1336 | EXPORT_SYMBOL(raw3270_deactivate_view); | 1410 | EXPORT_SYMBOL(raw3270_deactivate_view); |
1337 | EXPORT_SYMBOL(raw3270_start); | 1411 | EXPORT_SYMBOL(raw3270_start); |
1412 | EXPORT_SYMBOL(raw3270_start_locked); | ||
1338 | EXPORT_SYMBOL(raw3270_start_irq); | 1413 | EXPORT_SYMBOL(raw3270_start_irq); |
1414 | EXPORT_SYMBOL(raw3270_reset); | ||
1339 | EXPORT_SYMBOL(raw3270_register_notifier); | 1415 | EXPORT_SYMBOL(raw3270_register_notifier); |
1340 | EXPORT_SYMBOL(raw3270_unregister_notifier); | 1416 | EXPORT_SYMBOL(raw3270_unregister_notifier); |
1341 | EXPORT_SYMBOL(raw3270_wait_queue); | 1417 | EXPORT_SYMBOL(raw3270_wait_queue); |
diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h index ed5d4eb9f623..b635bf8e7775 100644 --- a/drivers/s390/char/raw3270.h +++ b/drivers/s390/char/raw3270.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | /* Local Channel Commands */ | 22 | /* Local Channel Commands */ |
23 | #define TC_WRITE 0x01 /* Write */ | 23 | #define TC_WRITE 0x01 /* Write */ |
24 | #define TC_RDBUF 0x02 /* Read Buffer */ | ||
24 | #define TC_EWRITE 0x05 /* Erase write */ | 25 | #define TC_EWRITE 0x05 /* Erase write */ |
25 | #define TC_READMOD 0x06 /* Read modified */ | 26 | #define TC_READMOD 0x06 /* Read modified */ |
26 | #define TC_EWRITEA 0x0d /* Erase write alternate */ | 27 | #define TC_EWRITEA 0x0d /* Erase write alternate */ |
@@ -76,7 +77,8 @@ | |||
76 | #define TW_KR 0xc2 /* Keyboard restore */ | 77 | #define TW_KR 0xc2 /* Keyboard restore */ |
77 | #define TW_PLUSALARM 0x04 /* Add this bit for alarm */ | 78 | #define TW_PLUSALARM 0x04 /* Add this bit for alarm */ |
78 | 79 | ||
79 | #define RAW3270_MAXDEVS 256 | 80 | #define RAW3270_FIRSTMINOR 1 /* First minor number */ |
81 | #define RAW3270_MAXDEVS 255 /* Max number of 3270 devices */ | ||
80 | 82 | ||
81 | /* For TUBGETMOD and TUBSETMOD. Should include. */ | 83 | /* For TUBGETMOD and TUBSETMOD. Should include. */ |
82 | struct raw3270_iocb { | 84 | struct raw3270_iocb { |
@@ -166,7 +168,10 @@ void raw3270_del_view(struct raw3270_view *); | |||
166 | void raw3270_deactivate_view(struct raw3270_view *); | 168 | void raw3270_deactivate_view(struct raw3270_view *); |
167 | struct raw3270_view *raw3270_find_view(struct raw3270_fn *, int); | 169 | struct raw3270_view *raw3270_find_view(struct raw3270_fn *, int); |
168 | int raw3270_start(struct raw3270_view *, struct raw3270_request *); | 170 | int raw3270_start(struct raw3270_view *, struct raw3270_request *); |
171 | int raw3270_start_locked(struct raw3270_view *, struct raw3270_request *); | ||
169 | int raw3270_start_irq(struct raw3270_view *, struct raw3270_request *); | 172 | int raw3270_start_irq(struct raw3270_view *, struct raw3270_request *); |
173 | int raw3270_reset(struct raw3270_view *); | ||
174 | struct raw3270_view *raw3270_view(struct raw3270_view *); | ||
170 | 175 | ||
171 | /* Reference count inliner for view structures. */ | 176 | /* Reference count inliner for view structures. */ |
172 | static inline void | 177 | static inline void |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 7db5ebce7f0f..4b9069370388 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -653,18 +653,12 @@ tty3270_activate(struct raw3270_view *view) | |||
653 | tp->update_flags = TTY_UPDATE_ALL; | 653 | tp->update_flags = TTY_UPDATE_ALL; |
654 | tty3270_set_timer(tp, 1); | 654 | tty3270_set_timer(tp, 1); |
655 | spin_unlock_irqrestore(&tp->view.lock, flags); | 655 | spin_unlock_irqrestore(&tp->view.lock, flags); |
656 | start_tty(tp->tty); | ||
657 | return 0; | 656 | return 0; |
658 | } | 657 | } |
659 | 658 | ||
660 | static void | 659 | static void |
661 | tty3270_deactivate(struct raw3270_view *view) | 660 | tty3270_deactivate(struct raw3270_view *view) |
662 | { | 661 | { |
663 | struct tty3270 *tp; | ||
664 | |||
665 | tp = (struct tty3270 *) view; | ||
666 | if (tp && tp->tty) | ||
667 | stop_tty(tp->tty); | ||
668 | } | 662 | } |
669 | 663 | ||
670 | static int | 664 | static int |
@@ -716,13 +710,13 @@ tty3270_alloc_view(void) | |||
716 | tp->freemem_pages[pages], PAGE_SIZE); | 710 | tp->freemem_pages[pages], PAGE_SIZE); |
717 | } | 711 | } |
718 | tp->write = raw3270_request_alloc(TTY3270_OUTPUT_BUFFER_SIZE); | 712 | tp->write = raw3270_request_alloc(TTY3270_OUTPUT_BUFFER_SIZE); |
719 | if (!tp->write) | 713 | if (IS_ERR(tp->write)) |
720 | goto out_pages; | 714 | goto out_pages; |
721 | tp->read = raw3270_request_alloc(0); | 715 | tp->read = raw3270_request_alloc(0); |
722 | if (!tp->read) | 716 | if (IS_ERR(tp->read)) |
723 | goto out_write; | 717 | goto out_write; |
724 | tp->kreset = raw3270_request_alloc(1); | 718 | tp->kreset = raw3270_request_alloc(1); |
725 | if (!tp->kreset) | 719 | if (IS_ERR(tp->kreset)) |
726 | goto out_read; | 720 | goto out_read; |
727 | tp->kbd = kbd_alloc(); | 721 | tp->kbd = kbd_alloc(); |
728 | if (!tp->kbd) | 722 | if (!tp->kbd) |
@@ -845,7 +839,8 @@ tty3270_del_views(void) | |||
845 | int i; | 839 | int i; |
846 | 840 | ||
847 | for (i = 0; i < tty3270_max_index; i++) { | 841 | for (i = 0; i < tty3270_max_index; i++) { |
848 | tp = (struct tty3270 *) raw3270_find_view(&tty3270_fn, i); | 842 | tp = (struct tty3270 *) |
843 | raw3270_find_view(&tty3270_fn, i + RAW3270_FIRSTMINOR); | ||
849 | if (!IS_ERR(tp)) | 844 | if (!IS_ERR(tp)) |
850 | raw3270_del_view(&tp->view); | 845 | raw3270_del_view(&tp->view); |
851 | } | 846 | } |
@@ -871,7 +866,9 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
871 | if (tty->count > 1) | 866 | if (tty->count > 1) |
872 | return 0; | 867 | return 0; |
873 | /* Check if the tty3270 is already there. */ | 868 | /* Check if the tty3270 is already there. */ |
874 | tp = (struct tty3270 *) raw3270_find_view(&tty3270_fn, tty->index); | 869 | tp = (struct tty3270 *) |
870 | raw3270_find_view(&tty3270_fn, | ||
871 | tty->index + RAW3270_FIRSTMINOR); | ||
875 | if (!IS_ERR(tp)) { | 872 | if (!IS_ERR(tp)) { |
876 | tty->driver_data = tp; | 873 | tty->driver_data = tp; |
877 | tty->winsize.ws_row = tp->view.rows - 2; | 874 | tty->winsize.ws_row = tp->view.rows - 2; |
@@ -903,7 +900,8 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
903 | (void (*)(unsigned long)) tty3270_read_tasklet, | 900 | (void (*)(unsigned long)) tty3270_read_tasklet, |
904 | (unsigned long) tp->read); | 901 | (unsigned long) tp->read); |
905 | 902 | ||
906 | rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index); | 903 | rc = raw3270_add_view(&tp->view, &tty3270_fn, |
904 | tty->index + RAW3270_FIRSTMINOR); | ||
907 | if (rc) { | 905 | if (rc) { |
908 | tty3270_free_view(tp); | 906 | tty3270_free_view(tp); |
909 | return rc; | 907 | return rc; |
@@ -911,8 +909,8 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
911 | 909 | ||
912 | rc = tty3270_alloc_screen(tp); | 910 | rc = tty3270_alloc_screen(tp); |
913 | if (rc) { | 911 | if (rc) { |
914 | raw3270_del_view(&tp->view); | ||
915 | raw3270_put_view(&tp->view); | 912 | raw3270_put_view(&tp->view); |
913 | raw3270_del_view(&tp->view); | ||
916 | return rc; | 914 | return rc; |
917 | } | 915 | } |
918 | 916 | ||
@@ -1780,7 +1778,7 @@ tty3270_init(void) | |||
1780 | struct tty_driver *driver; | 1778 | struct tty_driver *driver; |
1781 | int ret; | 1779 | int ret; |
1782 | 1780 | ||
1783 | driver = alloc_tty_driver(256); | 1781 | driver = alloc_tty_driver(RAW3270_MAXDEVS); |
1784 | if (!driver) | 1782 | if (!driver) |
1785 | return -ENOMEM; | 1783 | return -ENOMEM; |
1786 | 1784 | ||
@@ -1794,6 +1792,7 @@ tty3270_init(void) | |||
1794 | driver->driver_name = "ttyTUB"; | 1792 | driver->driver_name = "ttyTUB"; |
1795 | driver->name = "ttyTUB"; | 1793 | driver->name = "ttyTUB"; |
1796 | driver->major = IBM_TTY3270_MAJOR; | 1794 | driver->major = IBM_TTY3270_MAJOR; |
1795 | driver->minor_start = RAW3270_FIRSTMINOR; | ||
1797 | driver->type = TTY_DRIVER_TYPE_SYSTEM; | 1796 | driver->type = TTY_DRIVER_TYPE_SYSTEM; |
1798 | driver->subtype = SYSTEM_TYPE_TTY; | 1797 | driver->subtype = SYSTEM_TYPE_TTY; |
1799 | driver->init_termios = tty_std_termios; | 1798 | driver->init_termios = tty_std_termios; |
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 8cc4f1a940dc..c05b069c2996 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c | |||
@@ -30,10 +30,13 @@ | |||
30 | #include <linux/list.h> | 30 | #include <linux/list.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
33 | #include <linux/slab.h> | ||
34 | #include <linux/timex.h> /* get_clock() */ | ||
33 | 35 | ||
34 | #include <asm/ccwdev.h> | 36 | #include <asm/ccwdev.h> |
35 | #include <asm/cio.h> | 37 | #include <asm/cio.h> |
36 | #include <asm/cmb.h> | 38 | #include <asm/cmb.h> |
39 | #include <asm/div64.h> | ||
37 | 40 | ||
38 | #include "cio.h" | 41 | #include "cio.h" |
39 | #include "css.h" | 42 | #include "css.h" |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 9adc11e8b8bc..811c9d150637 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <asm/ccwdev.h> | 23 | #include <asm/ccwdev.h> |
24 | #include <asm/cio.h> | 24 | #include <asm/cio.h> |
25 | #include <asm/param.h> /* HZ */ | ||
25 | 26 | ||
26 | #include "cio.h" | 27 | #include "cio.h" |
27 | #include "css.h" | 28 | #include "css.h" |
@@ -252,6 +253,23 @@ cutype_show (struct device *dev, struct device_attribute *attr, char *buf) | |||
252 | } | 253 | } |
253 | 254 | ||
254 | static ssize_t | 255 | static ssize_t |
256 | modalias_show (struct device *dev, struct device_attribute *attr, char *buf) | ||
257 | { | ||
258 | struct ccw_device *cdev = to_ccwdev(dev); | ||
259 | struct ccw_device_id *id = &(cdev->id); | ||
260 | int ret; | ||
261 | |||
262 | ret = sprintf(buf, "ccw:t%04Xm%02x", | ||
263 | id->cu_type, id->cu_model); | ||
264 | if (id->dev_type != 0) | ||
265 | ret += sprintf(buf + ret, "dt%04Xdm%02X\n", | ||
266 | id->dev_type, id->dev_model); | ||
267 | else | ||
268 | ret += sprintf(buf + ret, "dtdm\n"); | ||
269 | return ret; | ||
270 | } | ||
271 | |||
272 | static ssize_t | ||
255 | online_show (struct device *dev, struct device_attribute *attr, char *buf) | 273 | online_show (struct device *dev, struct device_attribute *attr, char *buf) |
256 | { | 274 | { |
257 | struct ccw_device *cdev = to_ccwdev(dev); | 275 | struct ccw_device *cdev = to_ccwdev(dev); |
@@ -448,6 +466,7 @@ static DEVICE_ATTR(chpids, 0444, chpids_show, NULL); | |||
448 | static DEVICE_ATTR(pimpampom, 0444, pimpampom_show, NULL); | 466 | static DEVICE_ATTR(pimpampom, 0444, pimpampom_show, NULL); |
449 | static DEVICE_ATTR(devtype, 0444, devtype_show, NULL); | 467 | static DEVICE_ATTR(devtype, 0444, devtype_show, NULL); |
450 | static DEVICE_ATTR(cutype, 0444, cutype_show, NULL); | 468 | static DEVICE_ATTR(cutype, 0444, cutype_show, NULL); |
469 | static DEVICE_ATTR(modalias, 0444, modalias_show, NULL); | ||
451 | static DEVICE_ATTR(online, 0644, online_show, online_store); | 470 | static DEVICE_ATTR(online, 0644, online_show, online_store); |
452 | extern struct device_attribute dev_attr_cmb_enable; | 471 | extern struct device_attribute dev_attr_cmb_enable; |
453 | static DEVICE_ATTR(availability, 0444, available_show, NULL); | 472 | static DEVICE_ATTR(availability, 0444, available_show, NULL); |
@@ -471,6 +490,7 @@ subchannel_add_files (struct device *dev) | |||
471 | static struct attribute * ccwdev_attrs[] = { | 490 | static struct attribute * ccwdev_attrs[] = { |
472 | &dev_attr_devtype.attr, | 491 | &dev_attr_devtype.attr, |
473 | &dev_attr_cutype.attr, | 492 | &dev_attr_cutype.attr, |
493 | &dev_attr_modalias.attr, | ||
474 | &dev_attr_online.attr, | 494 | &dev_attr_online.attr, |
475 | &dev_attr_cmb_enable.attr, | 495 | &dev_attr_cmb_enable.attr, |
476 | &dev_attr_availability.attr, | 496 | &dev_attr_availability.attr, |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index fbe4202a3f6f..c1c89f4fd4e3 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/jiffies.h> | ||
15 | #include <linux/string.h> | ||
14 | 16 | ||
15 | #include <asm/ccwdev.h> | 17 | #include <asm/ccwdev.h> |
16 | #include <asm/cio.h> | 18 | #include <asm/cio.h> |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index fe8187d6f58b..e2a5657d5fdb 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
42 | #include <linux/sched.h> | 42 | #include <linux/sched.h> |
43 | #include <linux/dma-mapping.h> | 43 | #include <linux/dma-mapping.h> |
44 | #include <linux/device.h> | ||
44 | #include "scsi.h" | 45 | #include "scsi.h" |
45 | #include <scsi/scsi_host.h> | 46 | #include <scsi/scsi_host.h> |
46 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
@@ -192,7 +193,6 @@ static void ahci_port_stop(struct ata_port *ap); | |||
192 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 193 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
193 | static void ahci_qc_prep(struct ata_queued_cmd *qc); | 194 | static void ahci_qc_prep(struct ata_queued_cmd *qc); |
194 | static u8 ahci_check_status(struct ata_port *ap); | 195 | static u8 ahci_check_status(struct ata_port *ap); |
195 | static u8 ahci_check_err(struct ata_port *ap); | ||
196 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 196 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
197 | static void ahci_remove_one (struct pci_dev *pdev); | 197 | static void ahci_remove_one (struct pci_dev *pdev); |
198 | 198 | ||
@@ -221,7 +221,6 @@ static const struct ata_port_operations ahci_ops = { | |||
221 | 221 | ||
222 | .check_status = ahci_check_status, | 222 | .check_status = ahci_check_status, |
223 | .check_altstatus = ahci_check_status, | 223 | .check_altstatus = ahci_check_status, |
224 | .check_err = ahci_check_err, | ||
225 | .dev_select = ata_noop_dev_select, | 224 | .dev_select = ata_noop_dev_select, |
226 | 225 | ||
227 | .tf_read = ahci_tf_read, | 226 | .tf_read = ahci_tf_read, |
@@ -458,13 +457,6 @@ static u8 ahci_check_status(struct ata_port *ap) | |||
458 | return readl(mmio + PORT_TFDATA) & 0xFF; | 457 | return readl(mmio + PORT_TFDATA) & 0xFF; |
459 | } | 458 | } |
460 | 459 | ||
461 | static u8 ahci_check_err(struct ata_port *ap) | ||
462 | { | ||
463 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; | ||
464 | |||
465 | return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF; | ||
466 | } | ||
467 | |||
468 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | 460 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) |
469 | { | 461 | { |
470 | struct ahci_port_priv *pp = ap->private_data; | 462 | struct ahci_port_priv *pp = ap->private_data; |
@@ -609,7 +601,7 @@ static void ahci_eng_timeout(struct ata_port *ap) | |||
609 | * not being called from the SCSI EH. | 601 | * not being called from the SCSI EH. |
610 | */ | 602 | */ |
611 | qc->scsidone = scsi_finish_command; | 603 | qc->scsidone = scsi_finish_command; |
612 | ata_qc_complete(qc, ATA_ERR); | 604 | ata_qc_complete(qc, AC_ERR_OTHER); |
613 | } | 605 | } |
614 | 606 | ||
615 | spin_unlock_irqrestore(&host_set->lock, flags); | 607 | spin_unlock_irqrestore(&host_set->lock, flags); |
@@ -638,7 +630,7 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
638 | if (status & PORT_IRQ_FATAL) { | 630 | if (status & PORT_IRQ_FATAL) { |
639 | ahci_intr_error(ap, status); | 631 | ahci_intr_error(ap, status); |
640 | if (qc) | 632 | if (qc) |
641 | ata_qc_complete(qc, ATA_ERR); | 633 | ata_qc_complete(qc, AC_ERR_OTHER); |
642 | } | 634 | } |
643 | 635 | ||
644 | return 1; | 636 | return 1; |
@@ -683,10 +675,10 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * | |||
683 | if (!ahci_host_intr(ap, qc)) | 675 | if (!ahci_host_intr(ap, qc)) |
684 | if (ata_ratelimit()) { | 676 | if (ata_ratelimit()) { |
685 | struct pci_dev *pdev = | 677 | struct pci_dev *pdev = |
686 | to_pci_dev(ap->host_set->dev); | 678 | to_pci_dev(ap->host_set->dev); |
687 | printk(KERN_WARNING | 679 | dev_printk(KERN_WARNING, &pdev->dev, |
688 | "ahci(%s): unhandled interrupt on port %u\n", | 680 | "unhandled interrupt on port %u\n", |
689 | pci_name(pdev), i); | 681 | i); |
690 | } | 682 | } |
691 | 683 | ||
692 | VPRINTK("port %u\n", i); | 684 | VPRINTK("port %u\n", i); |
@@ -694,10 +686,9 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * | |||
694 | VPRINTK("port %u (no irq)\n", i); | 686 | VPRINTK("port %u (no irq)\n", i); |
695 | if (ata_ratelimit()) { | 687 | if (ata_ratelimit()) { |
696 | struct pci_dev *pdev = | 688 | struct pci_dev *pdev = |
697 | to_pci_dev(ap->host_set->dev); | 689 | to_pci_dev(ap->host_set->dev); |
698 | printk(KERN_WARNING | 690 | dev_printk(KERN_WARNING, &pdev->dev, |
699 | "ahci(%s): interrupt on disabled port %u\n", | 691 | "interrupt on disabled port %u\n", i); |
700 | pci_name(pdev), i); | ||
701 | } | 692 | } |
702 | } | 693 | } |
703 | 694 | ||
@@ -769,8 +760,8 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
769 | 760 | ||
770 | tmp = readl(mmio + HOST_CTL); | 761 | tmp = readl(mmio + HOST_CTL); |
771 | if (tmp & HOST_RESET) { | 762 | if (tmp & HOST_RESET) { |
772 | printk(KERN_ERR DRV_NAME "(%s): controller reset failed (0x%x)\n", | 763 | dev_printk(KERN_ERR, &pdev->dev, |
773 | pci_name(pdev), tmp); | 764 | "controller reset failed (0x%x)\n", tmp); |
774 | return -EIO; | 765 | return -EIO; |
775 | } | 766 | } |
776 | 767 | ||
@@ -798,22 +789,22 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
798 | if (rc) { | 789 | if (rc) { |
799 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 790 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
800 | if (rc) { | 791 | if (rc) { |
801 | printk(KERN_ERR DRV_NAME "(%s): 64-bit DMA enable failed\n", | 792 | dev_printk(KERN_ERR, &pdev->dev, |
802 | pci_name(pdev)); | 793 | "64-bit DMA enable failed\n"); |
803 | return rc; | 794 | return rc; |
804 | } | 795 | } |
805 | } | 796 | } |
806 | } else { | 797 | } else { |
807 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 798 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
808 | if (rc) { | 799 | if (rc) { |
809 | printk(KERN_ERR DRV_NAME "(%s): 32-bit DMA enable failed\n", | 800 | dev_printk(KERN_ERR, &pdev->dev, |
810 | pci_name(pdev)); | 801 | "32-bit DMA enable failed\n"); |
811 | return rc; | 802 | return rc; |
812 | } | 803 | } |
813 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 804 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
814 | if (rc) { | 805 | if (rc) { |
815 | printk(KERN_ERR DRV_NAME "(%s): 32-bit consistent DMA enable failed\n", | 806 | dev_printk(KERN_ERR, &pdev->dev, |
816 | pci_name(pdev)); | 807 | "32-bit consistent DMA enable failed\n"); |
817 | return rc; | 808 | return rc; |
818 | } | 809 | } |
819 | } | 810 | } |
@@ -916,10 +907,10 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent) | |||
916 | else | 907 | else |
917 | scc_s = "unknown"; | 908 | scc_s = "unknown"; |
918 | 909 | ||
919 | printk(KERN_INFO DRV_NAME "(%s) AHCI %02x%02x.%02x%02x " | 910 | dev_printk(KERN_INFO, &pdev->dev, |
911 | "AHCI %02x%02x.%02x%02x " | ||
920 | "%u slots %u ports %s Gbps 0x%x impl %s mode\n" | 912 | "%u slots %u ports %s Gbps 0x%x impl %s mode\n" |
921 | , | 913 | , |
922 | pci_name(pdev), | ||
923 | 914 | ||
924 | (vers >> 24) & 0xff, | 915 | (vers >> 24) & 0xff, |
925 | (vers >> 16) & 0xff, | 916 | (vers >> 16) & 0xff, |
@@ -932,11 +923,11 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent) | |||
932 | impl, | 923 | impl, |
933 | scc_s); | 924 | scc_s); |
934 | 925 | ||
935 | printk(KERN_INFO DRV_NAME "(%s) flags: " | 926 | dev_printk(KERN_INFO, &pdev->dev, |
927 | "flags: " | ||
936 | "%s%s%s%s%s%s" | 928 | "%s%s%s%s%s%s" |
937 | "%s%s%s%s%s%s%s\n" | 929 | "%s%s%s%s%s%s%s\n" |
938 | , | 930 | , |
939 | pci_name(pdev), | ||
940 | 931 | ||
941 | cap & (1 << 31) ? "64bit " : "", | 932 | cap & (1 << 31) ? "64bit " : "", |
942 | cap & (1 << 30) ? "ncq " : "", | 933 | cap & (1 << 30) ? "ncq " : "", |
@@ -969,7 +960,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
969 | VPRINTK("ENTER\n"); | 960 | VPRINTK("ENTER\n"); |
970 | 961 | ||
971 | if (!printed_version++) | 962 | if (!printed_version++) |
972 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 963 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
973 | 964 | ||
974 | rc = pci_enable_device(pdev); | 965 | rc = pci_enable_device(pdev); |
975 | if (rc) | 966 | if (rc) |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index be021478f416..7f8aa1b552ce 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/init.h> | 45 | #include <linux/init.h> |
46 | #include <linux/blkdev.h> | 46 | #include <linux/blkdev.h> |
47 | #include <linux/delay.h> | 47 | #include <linux/delay.h> |
48 | #include <linux/device.h> | ||
48 | #include "scsi.h" | 49 | #include "scsi.h" |
49 | #include <scsi/scsi_host.h> | 50 | #include <scsi/scsi_host.h> |
50 | #include <linux/libata.h> | 51 | #include <linux/libata.h> |
@@ -621,18 +622,19 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
621 | { | 622 | { |
622 | static int printed_version; | 623 | static int printed_version; |
623 | struct ata_port_info *port_info[2]; | 624 | struct ata_port_info *port_info[2]; |
624 | unsigned int combined = 0, n_ports = 1; | 625 | unsigned int combined = 0; |
625 | unsigned int pata_chan = 0, sata_chan = 0; | 626 | unsigned int pata_chan = 0, sata_chan = 0; |
626 | 627 | ||
627 | if (!printed_version++) | 628 | if (!printed_version++) |
628 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 629 | dev_printk(KERN_DEBUG, &pdev->dev, |
630 | "version " DRV_VERSION "\n"); | ||
629 | 631 | ||
630 | /* no hotplugging support (FIXME) */ | 632 | /* no hotplugging support (FIXME) */ |
631 | if (!in_module_init) | 633 | if (!in_module_init) |
632 | return -ENODEV; | 634 | return -ENODEV; |
633 | 635 | ||
634 | port_info[0] = &piix_port_info[ent->driver_data]; | 636 | port_info[0] = &piix_port_info[ent->driver_data]; |
635 | port_info[1] = NULL; | 637 | port_info[1] = &piix_port_info[ent->driver_data]; |
636 | 638 | ||
637 | if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { | 639 | if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { |
638 | u8 tmp; | 640 | u8 tmp; |
@@ -670,12 +672,13 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
670 | port_info[sata_chan] = &piix_port_info[ent->driver_data]; | 672 | port_info[sata_chan] = &piix_port_info[ent->driver_data]; |
671 | port_info[sata_chan]->host_flags |= ATA_FLAG_SLAVE_POSS; | 673 | port_info[sata_chan]->host_flags |= ATA_FLAG_SLAVE_POSS; |
672 | port_info[pata_chan] = &piix_port_info[ich5_pata]; | 674 | port_info[pata_chan] = &piix_port_info[ich5_pata]; |
673 | n_ports++; | ||
674 | 675 | ||
675 | printk(KERN_WARNING DRV_NAME ": combined mode detected\n"); | 676 | dev_printk(KERN_WARNING, &pdev->dev, |
677 | "combined mode detected (p=%u, s=%u)\n", | ||
678 | pata_chan, sata_chan); | ||
676 | } | 679 | } |
677 | 680 | ||
678 | return ata_pci_init_one(pdev, port_info, n_ports); | 681 | return ata_pci_init_one(pdev, port_info, 2); |
679 | } | 682 | } |
680 | 683 | ||
681 | static int __init piix_init(void) | 684 | static int __init piix_init(void) |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index ff25210b00ba..822b9fa706f3 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1543,13 +1543,16 @@ static struct vio_device_id ibmvscsi_device_table[] __devinitdata = { | |||
1543 | {"vscsi", "IBM,v-scsi"}, | 1543 | {"vscsi", "IBM,v-scsi"}, |
1544 | { "", "" } | 1544 | { "", "" } |
1545 | }; | 1545 | }; |
1546 | |||
1547 | MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table); | 1546 | MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table); |
1547 | |||
1548 | static struct vio_driver ibmvscsi_driver = { | 1548 | static struct vio_driver ibmvscsi_driver = { |
1549 | .name = "ibmvscsi", | ||
1550 | .id_table = ibmvscsi_device_table, | 1549 | .id_table = ibmvscsi_device_table, |
1551 | .probe = ibmvscsi_probe, | 1550 | .probe = ibmvscsi_probe, |
1552 | .remove = ibmvscsi_remove | 1551 | .remove = ibmvscsi_remove, |
1552 | .driver = { | ||
1553 | .name = "ibmvscsi", | ||
1554 | .owner = THIS_MODULE, | ||
1555 | } | ||
1553 | }; | 1556 | }; |
1554 | 1557 | ||
1555 | int __init ibmvscsi_module_init(void) | 1558 | int __init ibmvscsi_module_init(void) |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 3d62c9bcbff7..00d6a6657ebc 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -180,19 +180,12 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne | |||
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | count = min(pc->sg->length - pc->b_count, bcount); | 182 | count = min(pc->sg->length - pc->b_count, bcount); |
183 | if (PageHighMem(pc->sg->page)) { | 183 | buf = kmap_atomic(pc->sg->page, KM_IRQ0); |
184 | unsigned long flags; | 184 | drive->hwif->atapi_input_bytes(drive, |
185 | 185 | buf + pc->b_count + pc->sg->offset, count); | |
186 | local_irq_save(flags); | 186 | kunmap_atomic(buf, KM_IRQ0); |
187 | buf = kmap_atomic(pc->sg->page, KM_IRQ0) + pc->sg->offset; | 187 | bcount -= count; |
188 | drive->hwif->atapi_input_bytes(drive, buf + pc->b_count, count); | 188 | pc->b_count += count; |
189 | kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); | ||
190 | local_irq_restore(flags); | ||
191 | } else { | ||
192 | buf = page_address(pc->sg->page) + pc->sg->offset; | ||
193 | drive->hwif->atapi_input_bytes(drive, buf + pc->b_count, count); | ||
194 | } | ||
195 | bcount -= count; pc->b_count += count; | ||
196 | if (pc->b_count == pc->sg->length) { | 189 | if (pc->b_count == pc->sg->length) { |
197 | pc->sg++; | 190 | pc->sg++; |
198 | pc->b_count = 0; | 191 | pc->b_count = 0; |
@@ -212,19 +205,12 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign | |||
212 | return; | 205 | return; |
213 | } | 206 | } |
214 | count = min(pc->sg->length - pc->b_count, bcount); | 207 | count = min(pc->sg->length - pc->b_count, bcount); |
215 | if (PageHighMem(pc->sg->page)) { | 208 | buf = kmap_atomic(pc->sg->page, KM_IRQ0); |
216 | unsigned long flags; | 209 | drive->hwif->atapi_output_bytes(drive, |
217 | 210 | buf + pc->b_count + pc->sg->offset, count); | |
218 | local_irq_save(flags); | 211 | kunmap_atomic(buf, KM_IRQ0); |
219 | buf = kmap_atomic(pc->sg->page, KM_IRQ0) + pc->sg->offset; | 212 | bcount -= count; |
220 | drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count); | 213 | pc->b_count += count; |
221 | kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); | ||
222 | local_irq_restore(flags); | ||
223 | } else { | ||
224 | buf = page_address(pc->sg->page) + pc->sg->offset; | ||
225 | drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count); | ||
226 | } | ||
227 | bcount -= count; pc->b_count += count; | ||
228 | if (pc->b_count == pc->sg->length) { | 214 | if (pc->b_count == pc->sg->length) { |
229 | pc->sg++; | 215 | pc->sg++; |
230 | pc->b_count = 0; | 216 | pc->b_count = 0; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 5ca97605ff35..8be7dc0b47b8 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -372,7 +372,7 @@ static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) | |||
372 | struct ata_ioports *ioaddr = &ap->ioaddr; | 372 | struct ata_ioports *ioaddr = &ap->ioaddr; |
373 | 373 | ||
374 | tf->command = ata_check_status(ap); | 374 | tf->command = ata_check_status(ap); |
375 | tf->feature = ata_chk_err(ap); | 375 | tf->feature = inb(ioaddr->error_addr); |
376 | tf->nsect = inb(ioaddr->nsect_addr); | 376 | tf->nsect = inb(ioaddr->nsect_addr); |
377 | tf->lbal = inb(ioaddr->lbal_addr); | 377 | tf->lbal = inb(ioaddr->lbal_addr); |
378 | tf->lbam = inb(ioaddr->lbam_addr); | 378 | tf->lbam = inb(ioaddr->lbam_addr); |
@@ -406,7 +406,7 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
406 | struct ata_ioports *ioaddr = &ap->ioaddr; | 406 | struct ata_ioports *ioaddr = &ap->ioaddr; |
407 | 407 | ||
408 | tf->command = ata_check_status(ap); | 408 | tf->command = ata_check_status(ap); |
409 | tf->feature = ata_chk_err(ap); | 409 | tf->feature = readb((void __iomem *)ioaddr->error_addr); |
410 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); | 410 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); |
411 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); | 411 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); |
412 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); | 412 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); |
@@ -527,30 +527,6 @@ u8 ata_altstatus(struct ata_port *ap) | |||
527 | 527 | ||
528 | 528 | ||
529 | /** | 529 | /** |
530 | * ata_chk_err - Read device error reg | ||
531 | * @ap: port where the device is | ||
532 | * | ||
533 | * Reads ATA taskfile error register for | ||
534 | * currently-selected device and return its value. | ||
535 | * | ||
536 | * Note: may NOT be used as the check_err() entry in | ||
537 | * ata_port_operations. | ||
538 | * | ||
539 | * LOCKING: | ||
540 | * Inherited from caller. | ||
541 | */ | ||
542 | u8 ata_chk_err(struct ata_port *ap) | ||
543 | { | ||
544 | if (ap->ops->check_err) | ||
545 | return ap->ops->check_err(ap); | ||
546 | |||
547 | if (ap->flags & ATA_FLAG_MMIO) { | ||
548 | return readb((void __iomem *) ap->ioaddr.error_addr); | ||
549 | } | ||
550 | return inb(ap->ioaddr.error_addr); | ||
551 | } | ||
552 | |||
553 | /** | ||
554 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure | 530 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure |
555 | * @tf: Taskfile to convert | 531 | * @tf: Taskfile to convert |
556 | * @fis: Buffer into which data will output | 532 | * @fis: Buffer into which data will output |
@@ -902,8 +878,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) | |||
902 | 878 | ||
903 | memset(&tf, 0, sizeof(tf)); | 879 | memset(&tf, 0, sizeof(tf)); |
904 | 880 | ||
905 | err = ata_chk_err(ap); | ||
906 | ap->ops->tf_read(ap, &tf); | 881 | ap->ops->tf_read(ap, &tf); |
882 | err = tf.feature; | ||
907 | 883 | ||
908 | dev->class = ATA_DEV_NONE; | 884 | dev->class = ATA_DEV_NONE; |
909 | 885 | ||
@@ -1140,7 +1116,6 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) | |||
1140 | unsigned int major_version; | 1116 | unsigned int major_version; |
1141 | u16 tmp; | 1117 | u16 tmp; |
1142 | unsigned long xfer_modes; | 1118 | unsigned long xfer_modes; |
1143 | u8 status; | ||
1144 | unsigned int using_edd; | 1119 | unsigned int using_edd; |
1145 | DECLARE_COMPLETION(wait); | 1120 | DECLARE_COMPLETION(wait); |
1146 | struct ata_queued_cmd *qc; | 1121 | struct ata_queued_cmd *qc; |
@@ -1194,8 +1169,11 @@ retry: | |||
1194 | else | 1169 | else |
1195 | wait_for_completion(&wait); | 1170 | wait_for_completion(&wait); |
1196 | 1171 | ||
1197 | status = ata_chk_status(ap); | 1172 | spin_lock_irqsave(&ap->host_set->lock, flags); |
1198 | if (status & ATA_ERR) { | 1173 | ap->ops->tf_read(ap, &qc->tf); |
1174 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
1175 | |||
1176 | if (qc->tf.command & ATA_ERR) { | ||
1199 | /* | 1177 | /* |
1200 | * arg! EDD works for all test cases, but seems to return | 1178 | * arg! EDD works for all test cases, but seems to return |
1201 | * the ATA signature for some ATAPI devices. Until the | 1179 | * the ATA signature for some ATAPI devices. Until the |
@@ -1208,7 +1186,7 @@ retry: | |||
1208 | * to have this problem. | 1186 | * to have this problem. |
1209 | */ | 1187 | */ |
1210 | if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { | 1188 | if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { |
1211 | u8 err = ata_chk_err(ap); | 1189 | u8 err = qc->tf.feature; |
1212 | if (err & ATA_ABORTED) { | 1190 | if (err & ATA_ABORTED) { |
1213 | dev->class = ATA_DEV_ATAPI; | 1191 | dev->class = ATA_DEV_ATAPI; |
1214 | qc->cursg = 0; | 1192 | qc->cursg = 0; |
@@ -2685,7 +2663,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
2685 | * None. (grabs host lock) | 2663 | * None. (grabs host lock) |
2686 | */ | 2664 | */ |
2687 | 2665 | ||
2688 | void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 2666 | void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) |
2689 | { | 2667 | { |
2690 | struct ata_port *ap = qc->ap; | 2668 | struct ata_port *ap = qc->ap; |
2691 | unsigned long flags; | 2669 | unsigned long flags; |
@@ -2693,7 +2671,7 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
2693 | spin_lock_irqsave(&ap->host_set->lock, flags); | 2671 | spin_lock_irqsave(&ap->host_set->lock, flags); |
2694 | ap->flags &= ~ATA_FLAG_NOINTR; | 2672 | ap->flags &= ~ATA_FLAG_NOINTR; |
2695 | ata_irq_on(ap); | 2673 | ata_irq_on(ap); |
2696 | ata_qc_complete(qc, drv_stat); | 2674 | ata_qc_complete(qc, err_mask); |
2697 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 2675 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
2698 | } | 2676 | } |
2699 | 2677 | ||
@@ -2790,7 +2768,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
2790 | 2768 | ||
2791 | ap->hsm_task_state = HSM_ST_IDLE; | 2769 | ap->hsm_task_state = HSM_ST_IDLE; |
2792 | 2770 | ||
2793 | ata_poll_qc_complete(qc, drv_stat); | 2771 | ata_poll_qc_complete(qc, 0); |
2794 | 2772 | ||
2795 | /* another command may start at this point */ | 2773 | /* another command may start at this point */ |
2796 | 2774 | ||
@@ -3158,18 +3136,15 @@ static void ata_pio_block(struct ata_port *ap) | |||
3158 | static void ata_pio_error(struct ata_port *ap) | 3136 | static void ata_pio_error(struct ata_port *ap) |
3159 | { | 3137 | { |
3160 | struct ata_queued_cmd *qc; | 3138 | struct ata_queued_cmd *qc; |
3161 | u8 drv_stat; | 3139 | |
3140 | printk(KERN_WARNING "ata%u: PIO error\n", ap->id); | ||
3162 | 3141 | ||
3163 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3142 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3164 | assert(qc != NULL); | 3143 | assert(qc != NULL); |
3165 | 3144 | ||
3166 | drv_stat = ata_chk_status(ap); | ||
3167 | printk(KERN_WARNING "ata%u: PIO error, drv_stat 0x%x\n", | ||
3168 | ap->id, drv_stat); | ||
3169 | |||
3170 | ap->hsm_task_state = HSM_ST_IDLE; | 3145 | ap->hsm_task_state = HSM_ST_IDLE; |
3171 | 3146 | ||
3172 | ata_poll_qc_complete(qc, drv_stat | ATA_ERR); | 3147 | ata_poll_qc_complete(qc, AC_ERR_ATA_BUS); |
3173 | } | 3148 | } |
3174 | 3149 | ||
3175 | static void ata_pio_task(void *_data) | 3150 | static void ata_pio_task(void *_data) |
@@ -3292,7 +3267,7 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3292 | ap->id, qc->tf.command, drv_stat, host_stat); | 3267 | ap->id, qc->tf.command, drv_stat, host_stat); |
3293 | 3268 | ||
3294 | /* complete taskfile transaction */ | 3269 | /* complete taskfile transaction */ |
3295 | ata_qc_complete(qc, drv_stat); | 3270 | ata_qc_complete(qc, ac_err_mask(drv_stat)); |
3296 | break; | 3271 | break; |
3297 | } | 3272 | } |
3298 | 3273 | ||
@@ -3397,7 +3372,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
3397 | return qc; | 3372 | return qc; |
3398 | } | 3373 | } |
3399 | 3374 | ||
3400 | int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat) | 3375 | int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask) |
3401 | { | 3376 | { |
3402 | return 0; | 3377 | return 0; |
3403 | } | 3378 | } |
@@ -3456,7 +3431,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
3456 | * spin_lock_irqsave(host_set lock) | 3431 | * spin_lock_irqsave(host_set lock) |
3457 | */ | 3432 | */ |
3458 | 3433 | ||
3459 | void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 3434 | void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) |
3460 | { | 3435 | { |
3461 | int rc; | 3436 | int rc; |
3462 | 3437 | ||
@@ -3473,7 +3448,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
3473 | qc->flags &= ~ATA_QCFLAG_ACTIVE; | 3448 | qc->flags &= ~ATA_QCFLAG_ACTIVE; |
3474 | 3449 | ||
3475 | /* call completion callback */ | 3450 | /* call completion callback */ |
3476 | rc = qc->complete_fn(qc, drv_stat); | 3451 | rc = qc->complete_fn(qc, err_mask); |
3477 | 3452 | ||
3478 | /* if callback indicates not to complete command (non-zero), | 3453 | /* if callback indicates not to complete command (non-zero), |
3479 | * return immediately | 3454 | * return immediately |
@@ -3911,7 +3886,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap, | |||
3911 | ap->ops->irq_clear(ap); | 3886 | ap->ops->irq_clear(ap); |
3912 | 3887 | ||
3913 | /* complete taskfile transaction */ | 3888 | /* complete taskfile transaction */ |
3914 | ata_qc_complete(qc, status); | 3889 | ata_qc_complete(qc, ac_err_mask(status)); |
3915 | break; | 3890 | break; |
3916 | 3891 | ||
3917 | default: | 3892 | default: |
@@ -4006,7 +3981,7 @@ static void atapi_packet_task(void *_data) | |||
4006 | /* sleep-wait for BSY to clear */ | 3981 | /* sleep-wait for BSY to clear */ |
4007 | DPRINTK("busy wait\n"); | 3982 | DPRINTK("busy wait\n"); |
4008 | if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) | 3983 | if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) |
4009 | goto err_out; | 3984 | goto err_out_status; |
4010 | 3985 | ||
4011 | /* make sure DRQ is set */ | 3986 | /* make sure DRQ is set */ |
4012 | status = ata_chk_status(ap); | 3987 | status = ata_chk_status(ap); |
@@ -4043,8 +4018,10 @@ static void atapi_packet_task(void *_data) | |||
4043 | 4018 | ||
4044 | return; | 4019 | return; |
4045 | 4020 | ||
4021 | err_out_status: | ||
4022 | status = ata_chk_status(ap); | ||
4046 | err_out: | 4023 | err_out: |
4047 | ata_poll_qc_complete(qc, ATA_ERR); | 4024 | ata_poll_qc_complete(qc, __ac_err_mask(status)); |
4048 | } | 4025 | } |
4049 | 4026 | ||
4050 | 4027 | ||
@@ -4550,11 +4527,11 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
4550 | return probe_ent; | 4527 | return probe_ent; |
4551 | } | 4528 | } |
4552 | 4529 | ||
4553 | static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, struct ata_port_info **port, int port_num) | 4530 | static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, struct ata_port_info *port, int port_num) |
4554 | { | 4531 | { |
4555 | struct ata_probe_ent *probe_ent; | 4532 | struct ata_probe_ent *probe_ent; |
4556 | 4533 | ||
4557 | probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); | 4534 | probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port); |
4558 | if (!probe_ent) | 4535 | if (!probe_ent) |
4559 | return NULL; | 4536 | return NULL; |
4560 | 4537 | ||
@@ -4701,9 +4678,9 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
4701 | 4678 | ||
4702 | if (legacy_mode) { | 4679 | if (legacy_mode) { |
4703 | if (legacy_mode & (1 << 0)) | 4680 | if (legacy_mode & (1 << 0)) |
4704 | probe_ent = ata_pci_init_legacy_port(pdev, port, 0); | 4681 | probe_ent = ata_pci_init_legacy_port(pdev, port[0], 0); |
4705 | if (legacy_mode & (1 << 1)) | 4682 | if (legacy_mode & (1 << 1)) |
4706 | probe_ent2 = ata_pci_init_legacy_port(pdev, port, 1); | 4683 | probe_ent2 = ata_pci_init_legacy_port(pdev, port[1], 1); |
4707 | } else { | 4684 | } else { |
4708 | if (n_ports == 2) | 4685 | if (n_ports == 2) |
4709 | probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); | 4686 | probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); |
@@ -4867,7 +4844,6 @@ EXPORT_SYMBOL_GPL(ata_tf_to_fis); | |||
4867 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); | 4844 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); |
4868 | EXPORT_SYMBOL_GPL(ata_check_status); | 4845 | EXPORT_SYMBOL_GPL(ata_check_status); |
4869 | EXPORT_SYMBOL_GPL(ata_altstatus); | 4846 | EXPORT_SYMBOL_GPL(ata_altstatus); |
4870 | EXPORT_SYMBOL_GPL(ata_chk_err); | ||
4871 | EXPORT_SYMBOL_GPL(ata_exec_command); | 4847 | EXPORT_SYMBOL_GPL(ata_exec_command); |
4872 | EXPORT_SYMBOL_GPL(ata_port_start); | 4848 | EXPORT_SYMBOL_GPL(ata_port_start); |
4873 | EXPORT_SYMBOL_GPL(ata_port_stop); | 4849 | EXPORT_SYMBOL_GPL(ata_port_stop); |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 89a04b1a5a0e..1e3792f86fcf 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -560,7 +560,7 @@ void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc) | |||
560 | * Use ata_to_sense_error() to map status register bits | 560 | * Use ata_to_sense_error() to map status register bits |
561 | * onto sense key, asc & ascq. | 561 | * onto sense key, asc & ascq. |
562 | */ | 562 | */ |
563 | if (unlikely(tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ))) { | 563 | if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { |
564 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, | 564 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, |
565 | &sb[1], &sb[2], &sb[3]); | 565 | &sb[1], &sb[2], &sb[3]); |
566 | sb[1] &= 0x0f; | 566 | sb[1] &= 0x0f; |
@@ -635,7 +635,7 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
635 | * Use ata_to_sense_error() to map status register bits | 635 | * Use ata_to_sense_error() to map status register bits |
636 | * onto sense key, asc & ascq. | 636 | * onto sense key, asc & ascq. |
637 | */ | 637 | */ |
638 | if (unlikely(tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ))) { | 638 | if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { |
639 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, | 639 | ata_to_sense_error(qc->ap->id, tf->command, tf->feature, |
640 | &sb[2], &sb[12], &sb[13]); | 640 | &sb[2], &sb[12], &sb[13]); |
641 | sb[2] &= 0x0f; | 641 | sb[2] &= 0x0f; |
@@ -644,7 +644,11 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
644 | sb[0] = 0x70; | 644 | sb[0] = 0x70; |
645 | sb[7] = 0x0a; | 645 | sb[7] = 0x0a; |
646 | 646 | ||
647 | if (tf->flags & ATA_TFLAG_LBA && !(tf->flags & ATA_TFLAG_LBA48)) { | 647 | if (tf->flags & ATA_TFLAG_LBA48) { |
648 | /* TODO: find solution for LBA48 descriptors */ | ||
649 | } | ||
650 | |||
651 | else if (tf->flags & ATA_TFLAG_LBA) { | ||
648 | /* A small (28b) LBA will fit in the 32b info field */ | 652 | /* A small (28b) LBA will fit in the 32b info field */ |
649 | sb[0] |= 0x80; /* set valid bit */ | 653 | sb[0] |= 0x80; /* set valid bit */ |
650 | sb[3] = tf->device & 0x0f; | 654 | sb[3] = tf->device & 0x0f; |
@@ -652,6 +656,10 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
652 | sb[5] = tf->lbam; | 656 | sb[5] = tf->lbam; |
653 | sb[6] = tf->lbal; | 657 | sb[6] = tf->lbal; |
654 | } | 658 | } |
659 | |||
660 | else { | ||
661 | /* TODO: C/H/S */ | ||
662 | } | ||
655 | } | 663 | } |
656 | 664 | ||
657 | /** | 665 | /** |
@@ -1199,10 +1207,12 @@ nothing_to_do: | |||
1199 | return 1; | 1207 | return 1; |
1200 | } | 1208 | } |
1201 | 1209 | ||
1202 | static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 1210 | static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, |
1211 | unsigned int err_mask) | ||
1203 | { | 1212 | { |
1204 | struct scsi_cmnd *cmd = qc->scsicmd; | 1213 | struct scsi_cmnd *cmd = qc->scsicmd; |
1205 | int need_sense = drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ); | 1214 | u8 *cdb = cmd->cmnd; |
1215 | int need_sense = (err_mask != 0); | ||
1206 | 1216 | ||
1207 | /* For ATA pass thru (SAT) commands, generate a sense block if | 1217 | /* For ATA pass thru (SAT) commands, generate a sense block if |
1208 | * user mandated it or if there's an error. Note that if we | 1218 | * user mandated it or if there's an error. Note that if we |
@@ -1211,8 +1221,8 @@ static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
1211 | * whether the command completed successfully or not. If there | 1221 | * whether the command completed successfully or not. If there |
1212 | * was no error, SK, ASC and ASCQ will all be zero. | 1222 | * was no error, SK, ASC and ASCQ will all be zero. |
1213 | */ | 1223 | */ |
1214 | if (((cmd->cmnd[0] == ATA_16) || (cmd->cmnd[0] == ATA_12)) && | 1224 | if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) && |
1215 | ((cmd->cmnd[2] & 0x20) || need_sense)) { | 1225 | ((cdb[2] & 0x20) || need_sense)) { |
1216 | ata_gen_ata_desc_sense(qc); | 1226 | ata_gen_ata_desc_sense(qc); |
1217 | } else { | 1227 | } else { |
1218 | if (!need_sense) { | 1228 | if (!need_sense) { |
@@ -1995,21 +2005,13 @@ void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, | |||
1995 | DPRINTK("EXIT\n"); | 2005 | DPRINTK("EXIT\n"); |
1996 | } | 2006 | } |
1997 | 2007 | ||
1998 | static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 2008 | static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) |
1999 | { | 2009 | { |
2000 | struct scsi_cmnd *cmd = qc->scsicmd; | 2010 | struct scsi_cmnd *cmd = qc->scsicmd; |
2001 | 2011 | ||
2002 | VPRINTK("ENTER, drv_stat == 0x%x\n", drv_stat); | 2012 | VPRINTK("ENTER, err_mask 0x%X\n", err_mask); |
2003 | |||
2004 | if (unlikely(drv_stat & (ATA_BUSY | ATA_DRQ))) | ||
2005 | /* FIXME: not quite right; we don't want the | ||
2006 | * translation of taskfile registers into | ||
2007 | * a sense descriptors, since that's only | ||
2008 | * correct for ATA, not ATAPI | ||
2009 | */ | ||
2010 | ata_gen_ata_desc_sense(qc); | ||
2011 | 2013 | ||
2012 | else if (unlikely(drv_stat & ATA_ERR)) { | 2014 | if (unlikely(err_mask & AC_ERR_DEV)) { |
2013 | DPRINTK("request check condition\n"); | 2015 | DPRINTK("request check condition\n"); |
2014 | 2016 | ||
2015 | /* FIXME: command completion with check condition | 2017 | /* FIXME: command completion with check condition |
@@ -2026,6 +2028,14 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
2026 | return 1; | 2028 | return 1; |
2027 | } | 2029 | } |
2028 | 2030 | ||
2031 | else if (unlikely(err_mask)) | ||
2032 | /* FIXME: not quite right; we don't want the | ||
2033 | * translation of taskfile registers into | ||
2034 | * a sense descriptors, since that's only | ||
2035 | * correct for ATA, not ATAPI | ||
2036 | */ | ||
2037 | ata_gen_ata_desc_sense(qc); | ||
2038 | |||
2029 | else { | 2039 | else { |
2030 | u8 *scsicmd = cmd->cmnd; | 2040 | u8 *scsicmd = cmd->cmnd; |
2031 | 2041 | ||
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 65c264b91136..10ecd9e15e4f 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -39,7 +39,7 @@ struct ata_scsi_args { | |||
39 | 39 | ||
40 | /* libata-core.c */ | 40 | /* libata-core.c */ |
41 | extern int atapi_enabled; | 41 | extern int atapi_enabled; |
42 | extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat); | 42 | extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask); |
43 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 43 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, |
44 | struct ata_device *dev); | 44 | struct ata_device *dev); |
45 | extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 45 | extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index b235556b7b65..bdccf73cf9fe 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -730,7 +730,7 @@ static void start_phase(struct mesh_state *ms) | |||
730 | * issue a SEQ_MSGOUT to get the mesh to drop ACK. | 730 | * issue a SEQ_MSGOUT to get the mesh to drop ACK. |
731 | */ | 731 | */ |
732 | if ((in_8(&mr->bus_status0) & BS0_ATN) == 0) { | 732 | if ((in_8(&mr->bus_status0) & BS0_ATN) == 0) { |
733 | dlog(ms, "bus0 was %.2x explictly asserting ATN", mr->bus_status0); | 733 | dlog(ms, "bus0 was %.2x explicitly asserting ATN", mr->bus_status0); |
734 | out_8(&mr->bus_status0, BS0_ATN); /* explicit ATN */ | 734 | out_8(&mr->bus_status0, BS0_ATN); /* explicit ATN */ |
735 | mesh_flush_io(mr); | 735 | mesh_flush_io(mr); |
736 | udelay(1); | 736 | udelay(1); |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index af99feb9d237..665017eda8a6 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
42 | #include <linux/sched.h> | 42 | #include <linux/sched.h> |
43 | #include <linux/device.h> | ||
43 | #include "scsi.h" | 44 | #include "scsi.h" |
44 | #include <scsi/scsi_host.h> | 45 | #include <scsi/scsi_host.h> |
45 | #include <asm/io.h> | 46 | #include <asm/io.h> |
@@ -451,7 +452,7 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) | |||
451 | struct adma_port_priv *pp; | 452 | struct adma_port_priv *pp; |
452 | struct ata_queued_cmd *qc; | 453 | struct ata_queued_cmd *qc; |
453 | void __iomem *chan = ADMA_REGS(mmio_base, port_no); | 454 | void __iomem *chan = ADMA_REGS(mmio_base, port_no); |
454 | u8 drv_stat = 0, status = readb(chan + ADMA_STATUS); | 455 | u8 status = readb(chan + ADMA_STATUS); |
455 | 456 | ||
456 | if (status == 0) | 457 | if (status == 0) |
457 | continue; | 458 | continue; |
@@ -464,11 +465,14 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) | |||
464 | continue; | 465 | continue; |
465 | qc = ata_qc_from_tag(ap, ap->active_tag); | 466 | qc = ata_qc_from_tag(ap, ap->active_tag); |
466 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 467 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { |
468 | unsigned int err_mask = 0; | ||
469 | |||
467 | if ((status & (aPERR | aPSD | aUIRQ))) | 470 | if ((status & (aPERR | aPSD | aUIRQ))) |
468 | drv_stat = ATA_ERR; | 471 | err_mask = AC_ERR_OTHER; |
469 | else if (pp->pkt[0] != cDONE) | 472 | else if (pp->pkt[0] != cDONE) |
470 | drv_stat = ATA_ERR; | 473 | err_mask = AC_ERR_OTHER; |
471 | ata_qc_complete(qc, drv_stat); | 474 | |
475 | ata_qc_complete(qc, err_mask); | ||
472 | } | 476 | } |
473 | } | 477 | } |
474 | return handled; | 478 | return handled; |
@@ -498,7 +502,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) | |||
498 | 502 | ||
499 | /* complete taskfile transaction */ | 503 | /* complete taskfile transaction */ |
500 | pp->state = adma_state_idle; | 504 | pp->state = adma_state_idle; |
501 | ata_qc_complete(qc, status); | 505 | ata_qc_complete(qc, ac_err_mask(status)); |
502 | handled = 1; | 506 | handled = 1; |
503 | } | 507 | } |
504 | } | 508 | } |
@@ -623,16 +627,14 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) | |||
623 | 627 | ||
624 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 628 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
625 | if (rc) { | 629 | if (rc) { |
626 | printk(KERN_ERR DRV_NAME | 630 | dev_printk(KERN_ERR, &pdev->dev, |
627 | "(%s): 32-bit DMA enable failed\n", | 631 | "32-bit DMA enable failed\n"); |
628 | pci_name(pdev)); | ||
629 | return rc; | 632 | return rc; |
630 | } | 633 | } |
631 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 634 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
632 | if (rc) { | 635 | if (rc) { |
633 | printk(KERN_ERR DRV_NAME | 636 | dev_printk(KERN_ERR, &pdev->dev, |
634 | "(%s): 32-bit consistent DMA enable failed\n", | 637 | "32-bit consistent DMA enable failed\n"); |
635 | pci_name(pdev)); | ||
636 | return rc; | 638 | return rc; |
637 | } | 639 | } |
638 | return 0; | 640 | return 0; |
@@ -648,7 +650,7 @@ static int adma_ata_init_one(struct pci_dev *pdev, | |||
648 | int rc, port_no; | 650 | int rc, port_no; |
649 | 651 | ||
650 | if (!printed_version++) | 652 | if (!printed_version++) |
651 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 653 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
652 | 654 | ||
653 | rc = pci_enable_device(pdev); | 655 | rc = pci_enable_device(pdev); |
654 | if (rc) | 656 | if (rc) |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 422e0b6f603a..46dbdee79f77 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
32 | #include <linux/device.h> | ||
32 | #include "scsi.h" | 33 | #include "scsi.h" |
33 | #include <scsi/scsi_host.h> | 34 | #include <scsi/scsi_host.h> |
34 | #include <linux/libata.h> | 35 | #include <linux/libata.h> |
@@ -258,7 +259,6 @@ struct mv_host_priv { | |||
258 | static void mv_irq_clear(struct ata_port *ap); | 259 | static void mv_irq_clear(struct ata_port *ap); |
259 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); | 260 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); |
260 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | 261 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); |
261 | static u8 mv_check_err(struct ata_port *ap); | ||
262 | static void mv_phy_reset(struct ata_port *ap); | 262 | static void mv_phy_reset(struct ata_port *ap); |
263 | static void mv_host_stop(struct ata_host_set *host_set); | 263 | static void mv_host_stop(struct ata_host_set *host_set); |
264 | static int mv_port_start(struct ata_port *ap); | 264 | static int mv_port_start(struct ata_port *ap); |
@@ -296,7 +296,6 @@ static const struct ata_port_operations mv_ops = { | |||
296 | .tf_load = ata_tf_load, | 296 | .tf_load = ata_tf_load, |
297 | .tf_read = ata_tf_read, | 297 | .tf_read = ata_tf_read, |
298 | .check_status = ata_check_status, | 298 | .check_status = ata_check_status, |
299 | .check_err = mv_check_err, | ||
300 | .exec_command = ata_exec_command, | 299 | .exec_command = ata_exec_command, |
301 | .dev_select = ata_std_dev_select, | 300 | .dev_select = ata_std_dev_select, |
302 | 301 | ||
@@ -1067,6 +1066,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1067 | struct ata_queued_cmd *qc; | 1066 | struct ata_queued_cmd *qc; |
1068 | u32 hc_irq_cause; | 1067 | u32 hc_irq_cause; |
1069 | int shift, port, port0, hard_port, handled; | 1068 | int shift, port, port0, hard_port, handled; |
1069 | unsigned int err_mask; | ||
1070 | u8 ata_status = 0; | 1070 | u8 ata_status = 0; |
1071 | 1071 | ||
1072 | if (hc == 0) { | 1072 | if (hc == 0) { |
@@ -1102,15 +1102,15 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1102 | handled++; | 1102 | handled++; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | err_mask = ac_err_mask(ata_status); | ||
1106 | |||
1105 | shift = port << 1; /* (port * 2) */ | 1107 | shift = port << 1; /* (port * 2) */ |
1106 | if (port >= MV_PORTS_PER_HC) { | 1108 | if (port >= MV_PORTS_PER_HC) { |
1107 | shift++; /* skip bit 8 in the HC Main IRQ reg */ | 1109 | shift++; /* skip bit 8 in the HC Main IRQ reg */ |
1108 | } | 1110 | } |
1109 | if ((PORT0_ERR << shift) & relevant) { | 1111 | if ((PORT0_ERR << shift) & relevant) { |
1110 | mv_err_intr(ap); | 1112 | mv_err_intr(ap); |
1111 | /* OR in ATA_ERR to ensure libata knows we took one */ | 1113 | err_mask |= AC_ERR_OTHER; |
1112 | ata_status = readb((void __iomem *) | ||
1113 | ap->ioaddr.status_addr) | ATA_ERR; | ||
1114 | handled++; | 1114 | handled++; |
1115 | } | 1115 | } |
1116 | 1116 | ||
@@ -1120,7 +1120,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1120 | VPRINTK("port %u IRQ found for qc, " | 1120 | VPRINTK("port %u IRQ found for qc, " |
1121 | "ata_status 0x%x\n", port,ata_status); | 1121 | "ata_status 0x%x\n", port,ata_status); |
1122 | /* mark qc status appropriately */ | 1122 | /* mark qc status appropriately */ |
1123 | ata_qc_complete(qc, ata_status); | 1123 | ata_qc_complete(qc, err_mask); |
1124 | } | 1124 | } |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
@@ -1185,22 +1185,6 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | /** | 1187 | /** |
1188 | * mv_check_err - Return the error shadow register to caller. | ||
1189 | * @ap: ATA channel to manipulate | ||
1190 | * | ||
1191 | * Marvell requires DMA to be stopped before accessing shadow | ||
1192 | * registers. So we do that, then return the needed register. | ||
1193 | * | ||
1194 | * LOCKING: | ||
1195 | * Inherited from caller. FIXME: protect mv_stop_dma with lock? | ||
1196 | */ | ||
1197 | static u8 mv_check_err(struct ata_port *ap) | ||
1198 | { | ||
1199 | mv_stop_dma(ap); /* can't read shadow regs if DMA on */ | ||
1200 | return readb((void __iomem *) ap->ioaddr.error_addr); | ||
1201 | } | ||
1202 | |||
1203 | /** | ||
1204 | * mv_phy_reset - Perform eDMA reset followed by COMRESET | 1188 | * mv_phy_reset - Perform eDMA reset followed by COMRESET |
1205 | * @ap: ATA channel to manipulate | 1189 | * @ap: ATA channel to manipulate |
1206 | * | 1190 | * |
@@ -1312,7 +1296,7 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
1312 | */ | 1296 | */ |
1313 | spin_lock_irqsave(&ap->host_set->lock, flags); | 1297 | spin_lock_irqsave(&ap->host_set->lock, flags); |
1314 | qc->scsidone = scsi_finish_command; | 1298 | qc->scsidone = scsi_finish_command; |
1315 | ata_qc_complete(qc, ATA_ERR); | 1299 | ata_qc_complete(qc, AC_ERR_OTHER); |
1316 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 1300 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
1317 | } | 1301 | } |
1318 | } | 1302 | } |
@@ -1454,9 +1438,9 @@ static void mv_print_info(struct ata_probe_ent *probe_ent) | |||
1454 | else | 1438 | else |
1455 | scc_s = "unknown"; | 1439 | scc_s = "unknown"; |
1456 | 1440 | ||
1457 | printk(KERN_INFO DRV_NAME | 1441 | dev_printk(KERN_INFO, &pdev->dev, |
1458 | "(%s) %u slots %u ports %s mode IRQ via %s\n", | 1442 | "%u slots %u ports %s mode IRQ via %s\n", |
1459 | pci_name(pdev), (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, | 1443 | (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, |
1460 | scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); | 1444 | scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); |
1461 | } | 1445 | } |
1462 | 1446 | ||
@@ -1477,9 +1461,8 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1477 | void __iomem *mmio_base; | 1461 | void __iomem *mmio_base; |
1478 | int pci_dev_busy = 0, rc; | 1462 | int pci_dev_busy = 0, rc; |
1479 | 1463 | ||
1480 | if (!printed_version++) { | 1464 | if (!printed_version++) |
1481 | printk(KERN_INFO DRV_NAME " version " DRV_VERSION "\n"); | 1465 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); |
1482 | } | ||
1483 | 1466 | ||
1484 | rc = pci_enable_device(pdev); | 1467 | rc = pci_enable_device(pdev); |
1485 | if (rc) { | 1468 | if (rc) { |
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 1a56d6c79ddd..d573888eda76 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/blkdev.h> | 61 | #include <linux/blkdev.h> |
62 | #include <linux/delay.h> | 62 | #include <linux/delay.h> |
63 | #include <linux/interrupt.h> | 63 | #include <linux/interrupt.h> |
64 | #include <linux/device.h> | ||
64 | #include "scsi.h" | 65 | #include "scsi.h" |
65 | #include <scsi/scsi_host.h> | 66 | #include <scsi/scsi_host.h> |
66 | #include <linux/libata.h> | 67 | #include <linux/libata.h> |
@@ -383,7 +384,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
383 | return -ENODEV; | 384 | return -ENODEV; |
384 | 385 | ||
385 | if (!printed_version++) | 386 | if (!printed_version++) |
386 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 387 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
387 | 388 | ||
388 | rc = pci_enable_device(pdev); | 389 | rc = pci_enable_device(pdev); |
389 | if (rc) | 390 | if (rc) |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 63911f16b6ec..b41c977d6fab 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/sched.h> | 40 | #include <linux/sched.h> |
41 | #include <linux/device.h> | ||
41 | #include "scsi.h" | 42 | #include "scsi.h" |
42 | #include <scsi/scsi_host.h> | 43 | #include <scsi/scsi_host.h> |
43 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
@@ -399,7 +400,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
399 | case ATA_PROT_DMA: | 400 | case ATA_PROT_DMA: |
400 | case ATA_PROT_NODATA: | 401 | case ATA_PROT_NODATA: |
401 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 402 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
402 | ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR); | 403 | drv_stat = ata_wait_idle(ap); |
404 | ata_qc_complete(qc, __ac_err_mask(drv_stat)); | ||
403 | break; | 405 | break; |
404 | 406 | ||
405 | default: | 407 | default: |
@@ -408,7 +410,7 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
408 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 410 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", |
409 | ap->id, qc->tf.command, drv_stat); | 411 | ap->id, qc->tf.command, drv_stat); |
410 | 412 | ||
411 | ata_qc_complete(qc, drv_stat); | 413 | ata_qc_complete(qc, ac_err_mask(drv_stat)); |
412 | break; | 414 | break; |
413 | } | 415 | } |
414 | 416 | ||
@@ -420,24 +422,21 @@ out: | |||
420 | static inline unsigned int pdc_host_intr( struct ata_port *ap, | 422 | static inline unsigned int pdc_host_intr( struct ata_port *ap, |
421 | struct ata_queued_cmd *qc) | 423 | struct ata_queued_cmd *qc) |
422 | { | 424 | { |
423 | u8 status; | 425 | unsigned int handled = 0, err_mask = 0; |
424 | unsigned int handled = 0, have_err = 0; | ||
425 | u32 tmp; | 426 | u32 tmp; |
426 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; | 427 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; |
427 | 428 | ||
428 | tmp = readl(mmio); | 429 | tmp = readl(mmio); |
429 | if (tmp & PDC_ERR_MASK) { | 430 | if (tmp & PDC_ERR_MASK) { |
430 | have_err = 1; | 431 | err_mask = AC_ERR_DEV; |
431 | pdc_reset_port(ap); | 432 | pdc_reset_port(ap); |
432 | } | 433 | } |
433 | 434 | ||
434 | switch (qc->tf.protocol) { | 435 | switch (qc->tf.protocol) { |
435 | case ATA_PROT_DMA: | 436 | case ATA_PROT_DMA: |
436 | case ATA_PROT_NODATA: | 437 | case ATA_PROT_NODATA: |
437 | status = ata_wait_idle(ap); | 438 | err_mask |= ac_err_mask(ata_wait_idle(ap)); |
438 | if (have_err) | 439 | ata_qc_complete(qc, err_mask); |
439 | status |= ATA_ERR; | ||
440 | ata_qc_complete(qc, status); | ||
441 | handled = 1; | 440 | handled = 1; |
442 | break; | 441 | break; |
443 | 442 | ||
@@ -635,7 +634,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
635 | int rc; | 634 | int rc; |
636 | 635 | ||
637 | if (!printed_version++) | 636 | if (!printed_version++) |
638 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 637 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
639 | 638 | ||
640 | /* | 639 | /* |
641 | * If this driver happens to only be useful on Apple's K2, then | 640 | * If this driver happens to only be useful on Apple's K2, then |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 1aaf3304d397..9938dae782b6 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <linux/device.h> | ||
38 | #include "scsi.h" | 39 | #include "scsi.h" |
39 | #include <scsi/scsi_host.h> | 40 | #include <scsi/scsi_host.h> |
40 | #include <asm/io.h> | 41 | #include <asm/io.h> |
@@ -400,11 +401,12 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set) | |||
400 | qc = ata_qc_from_tag(ap, ap->active_tag); | 401 | qc = ata_qc_from_tag(ap, ap->active_tag); |
401 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 402 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { |
402 | switch (sHST) { | 403 | switch (sHST) { |
403 | case 0: /* sucessful CPB */ | 404 | case 0: /* successful CPB */ |
404 | case 3: /* device error */ | 405 | case 3: /* device error */ |
405 | pp->state = qs_state_idle; | 406 | pp->state = qs_state_idle; |
406 | qs_enter_reg_mode(qc->ap); | 407 | qs_enter_reg_mode(qc->ap); |
407 | ata_qc_complete(qc, sDST); | 408 | ata_qc_complete(qc, |
409 | ac_err_mask(sDST)); | ||
408 | break; | 410 | break; |
409 | default: | 411 | default: |
410 | break; | 412 | break; |
@@ -441,7 +443,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set) | |||
441 | 443 | ||
442 | /* complete taskfile transaction */ | 444 | /* complete taskfile transaction */ |
443 | pp->state = qs_state_idle; | 445 | pp->state = qs_state_idle; |
444 | ata_qc_complete(qc, status); | 446 | ata_qc_complete(qc, ac_err_mask(status)); |
445 | handled = 1; | 447 | handled = 1; |
446 | } | 448 | } |
447 | } | 449 | } |
@@ -599,25 +601,22 @@ static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) | |||
599 | if (rc) { | 601 | if (rc) { |
600 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 602 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
601 | if (rc) { | 603 | if (rc) { |
602 | printk(KERN_ERR DRV_NAME | 604 | dev_printk(KERN_ERR, &pdev->dev, |
603 | "(%s): 64-bit DMA enable failed\n", | 605 | "64-bit DMA enable failed\n"); |
604 | pci_name(pdev)); | ||
605 | return rc; | 606 | return rc; |
606 | } | 607 | } |
607 | } | 608 | } |
608 | } else { | 609 | } else { |
609 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 610 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
610 | if (rc) { | 611 | if (rc) { |
611 | printk(KERN_ERR DRV_NAME | 612 | dev_printk(KERN_ERR, &pdev->dev, |
612 | "(%s): 32-bit DMA enable failed\n", | 613 | "32-bit DMA enable failed\n"); |
613 | pci_name(pdev)); | ||
614 | return rc; | 614 | return rc; |
615 | } | 615 | } |
616 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 616 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
617 | if (rc) { | 617 | if (rc) { |
618 | printk(KERN_ERR DRV_NAME | 618 | dev_printk(KERN_ERR, &pdev->dev, |
619 | "(%s): 32-bit consistent DMA enable failed\n", | 619 | "32-bit consistent DMA enable failed\n"); |
620 | pci_name(pdev)); | ||
621 | return rc; | 620 | return rc; |
622 | } | 621 | } |
623 | } | 622 | } |
@@ -634,7 +633,7 @@ static int qs_ata_init_one(struct pci_dev *pdev, | |||
634 | int rc, port_no; | 633 | int rc, port_no; |
635 | 634 | ||
636 | if (!printed_version++) | 635 | if (!printed_version++) |
637 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 636 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
638 | 637 | ||
639 | rc = pci_enable_device(pdev); | 638 | rc = pci_enable_device(pdev); |
640 | if (rc) | 639 | if (rc) |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index 3a056173fb95..435f7e0085ec 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/blkdev.h> | 41 | #include <linux/blkdev.h> |
42 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
43 | #include <linux/interrupt.h> | 43 | #include <linux/interrupt.h> |
44 | #include <linux/device.h> | ||
44 | #include "scsi.h" | 45 | #include "scsi.h" |
45 | #include <scsi/scsi_host.h> | 46 | #include <scsi/scsi_host.h> |
46 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
@@ -386,7 +387,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
386 | u8 cls; | 387 | u8 cls; |
387 | 388 | ||
388 | if (!printed_version++) | 389 | if (!printed_version++) |
389 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 390 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
390 | 391 | ||
391 | /* | 392 | /* |
392 | * If this driver happens to only be useful on Apple's K2, then | 393 | * If this driver happens to only be useful on Apple's K2, then |
@@ -463,8 +464,8 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
463 | writeb(cls, mmio_base + SIL_FIFO_W3); | 464 | writeb(cls, mmio_base + SIL_FIFO_W3); |
464 | } | 465 | } |
465 | } else | 466 | } else |
466 | printk(KERN_WARNING DRV_NAME "(%s): cache line size not set. Driver may not function\n", | 467 | dev_printk(KERN_WARNING, &pdev->dev, |
467 | pci_name(pdev)); | 468 | "cache line size not set. Driver may not function\n"); |
468 | 469 | ||
469 | if (ent->driver_data == sil_3114) { | 470 | if (ent->driver_data == sil_3114) { |
470 | irq_mask = SIL_MASK_4PORT; | 471 | irq_mask = SIL_MASK_4PORT; |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 51855d3bac64..c66548025657 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/dma-mapping.h> | 37 | #include <linux/dma-mapping.h> |
38 | #include <linux/device.h> | ||
38 | #include <scsi/scsi_host.h> | 39 | #include <scsi/scsi_host.h> |
39 | #include "scsi.h" | 40 | #include "scsi.h" |
40 | #include <linux/libata.h> | 41 | #include <linux/libata.h> |
@@ -225,7 +226,6 @@ struct sil24_host_priv { | |||
225 | }; | 226 | }; |
226 | 227 | ||
227 | static u8 sil24_check_status(struct ata_port *ap); | 228 | static u8 sil24_check_status(struct ata_port *ap); |
228 | static u8 sil24_check_err(struct ata_port *ap); | ||
229 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); | 229 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); |
230 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); | 230 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); |
231 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 231 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
@@ -280,7 +280,6 @@ static const struct ata_port_operations sil24_ops = { | |||
280 | 280 | ||
281 | .check_status = sil24_check_status, | 281 | .check_status = sil24_check_status, |
282 | .check_altstatus = sil24_check_status, | 282 | .check_altstatus = sil24_check_status, |
283 | .check_err = sil24_check_err, | ||
284 | .dev_select = ata_noop_dev_select, | 283 | .dev_select = ata_noop_dev_select, |
285 | 284 | ||
286 | .tf_read = sil24_tf_read, | 285 | .tf_read = sil24_tf_read, |
@@ -363,12 +362,6 @@ static u8 sil24_check_status(struct ata_port *ap) | |||
363 | return pp->tf.command; | 362 | return pp->tf.command; |
364 | } | 363 | } |
365 | 364 | ||
366 | static u8 sil24_check_err(struct ata_port *ap) | ||
367 | { | ||
368 | struct sil24_port_priv *pp = ap->private_data; | ||
369 | return pp->tf.feature; | ||
370 | } | ||
371 | |||
372 | static int sil24_scr_map[] = { | 365 | static int sil24_scr_map[] = { |
373 | [SCR_CONTROL] = 0, | 366 | [SCR_CONTROL] = 0, |
374 | [SCR_STATUS] = 1, | 367 | [SCR_STATUS] = 1, |
@@ -506,7 +499,7 @@ static void sil24_eng_timeout(struct ata_port *ap) | |||
506 | 499 | ||
507 | qc = ata_qc_from_tag(ap, ap->active_tag); | 500 | qc = ata_qc_from_tag(ap, ap->active_tag); |
508 | if (!qc) { | 501 | if (!qc) { |
509 | printk(KERN_ERR "ata%u: BUG: tiemout without command\n", | 502 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
510 | ap->id); | 503 | ap->id); |
511 | return; | 504 | return; |
512 | } | 505 | } |
@@ -520,7 +513,7 @@ static void sil24_eng_timeout(struct ata_port *ap) | |||
520 | */ | 513 | */ |
521 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 514 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
522 | qc->scsidone = scsi_finish_command; | 515 | qc->scsidone = scsi_finish_command; |
523 | ata_qc_complete(qc, ATA_ERR); | 516 | ata_qc_complete(qc, AC_ERR_OTHER); |
524 | 517 | ||
525 | sil24_reset_controller(ap); | 518 | sil24_reset_controller(ap); |
526 | } | 519 | } |
@@ -531,6 +524,7 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
531 | struct sil24_port_priv *pp = ap->private_data; | 524 | struct sil24_port_priv *pp = ap->private_data; |
532 | void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; | 525 | void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; |
533 | u32 irq_stat, cmd_err, sstatus, serror; | 526 | u32 irq_stat, cmd_err, sstatus, serror; |
527 | unsigned int err_mask; | ||
534 | 528 | ||
535 | irq_stat = readl(port + PORT_IRQ_STAT); | 529 | irq_stat = readl(port + PORT_IRQ_STAT); |
536 | writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */ | 530 | writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */ |
@@ -558,17 +552,18 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
558 | * Device is reporting error, tf registers are valid. | 552 | * Device is reporting error, tf registers are valid. |
559 | */ | 553 | */ |
560 | sil24_update_tf(ap); | 554 | sil24_update_tf(ap); |
555 | err_mask = ac_err_mask(pp->tf.command); | ||
561 | } else { | 556 | } else { |
562 | /* | 557 | /* |
563 | * Other errors. libata currently doesn't have any | 558 | * Other errors. libata currently doesn't have any |
564 | * mechanism to report these errors. Just turn on | 559 | * mechanism to report these errors. Just turn on |
565 | * ATA_ERR. | 560 | * ATA_ERR. |
566 | */ | 561 | */ |
567 | pp->tf.command = ATA_ERR; | 562 | err_mask = AC_ERR_OTHER; |
568 | } | 563 | } |
569 | 564 | ||
570 | if (qc) | 565 | if (qc) |
571 | ata_qc_complete(qc, pp->tf.command); | 566 | ata_qc_complete(qc, err_mask); |
572 | 567 | ||
573 | sil24_reset_controller(ap); | 568 | sil24_reset_controller(ap); |
574 | } | 569 | } |
@@ -593,7 +588,7 @@ static inline void sil24_host_intr(struct ata_port *ap) | |||
593 | sil24_update_tf(ap); | 588 | sil24_update_tf(ap); |
594 | 589 | ||
595 | if (qc) | 590 | if (qc) |
596 | ata_qc_complete(qc, pp->tf.command); | 591 | ata_qc_complete(qc, ac_err_mask(pp->tf.command)); |
597 | } else | 592 | } else |
598 | sil24_error_intr(ap, slot_stat); | 593 | sil24_error_intr(ap, slot_stat); |
599 | } | 594 | } |
@@ -696,7 +691,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
696 | int i, rc; | 691 | int i, rc; |
697 | 692 | ||
698 | if (!printed_version++) | 693 | if (!printed_version++) |
699 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 694 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
700 | 695 | ||
701 | rc = pci_enable_device(pdev); | 696 | rc = pci_enable_device(pdev); |
702 | if (rc) | 697 | if (rc) |
@@ -756,14 +751,14 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
756 | */ | 751 | */ |
757 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 752 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
758 | if (rc) { | 753 | if (rc) { |
759 | printk(KERN_ERR DRV_NAME "(%s): 32-bit DMA enable failed\n", | 754 | dev_printk(KERN_ERR, &pdev->dev, |
760 | pci_name(pdev)); | 755 | "32-bit DMA enable failed\n"); |
761 | goto out_free; | 756 | goto out_free; |
762 | } | 757 | } |
763 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 758 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
764 | if (rc) { | 759 | if (rc) { |
765 | printk(KERN_ERR DRV_NAME "(%s): 32-bit consistent DMA enable failed\n", | 760 | dev_printk(KERN_ERR, &pdev->dev, |
766 | pci_name(pdev)); | 761 | "32-bit consistent DMA enable failed\n"); |
767 | goto out_free; | 762 | goto out_free; |
768 | } | 763 | } |
769 | 764 | ||
@@ -799,9 +794,8 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
799 | break; | 794 | break; |
800 | } | 795 | } |
801 | if (tmp & PORT_CS_PORT_RST) | 796 | if (tmp & PORT_CS_PORT_RST) |
802 | printk(KERN_ERR DRV_NAME | 797 | dev_printk(KERN_ERR, &pdev->dev, |
803 | "(%s): failed to clear port RST\n", | 798 | "failed to clear port RST\n"); |
804 | pci_name(pdev)); | ||
805 | } | 799 | } |
806 | 800 | ||
807 | /* Zero error counters. */ | 801 | /* Zero error counters. */ |
@@ -830,9 +824,8 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
830 | 824 | ||
831 | /* Reset itself */ | 825 | /* Reset itself */ |
832 | if (__sil24_reset_controller(port)) | 826 | if (__sil24_reset_controller(port)) |
833 | printk(KERN_ERR DRV_NAME | 827 | dev_printk(KERN_ERR, &pdev->dev, |
834 | "(%s): failed to reset controller\n", | 828 | "failed to reset controller\n"); |
835 | pci_name(pdev)); | ||
836 | } | 829 | } |
837 | 830 | ||
838 | /* Turn on interrupts */ | 831 | /* Turn on interrupts */ |
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c index 057f7b98b6c4..42288be0e561 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/scsi/sata_sis.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/blkdev.h> | 38 | #include <linux/blkdev.h> |
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/interrupt.h> | 40 | #include <linux/interrupt.h> |
41 | #include <linux/device.h> | ||
41 | #include "scsi.h" | 42 | #include "scsi.h" |
42 | #include <scsi/scsi_host.h> | 43 | #include <scsi/scsi_host.h> |
43 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
@@ -237,6 +238,7 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
237 | 238 | ||
238 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 239 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
239 | { | 240 | { |
241 | static int printed_version; | ||
240 | struct ata_probe_ent *probe_ent = NULL; | 242 | struct ata_probe_ent *probe_ent = NULL; |
241 | int rc; | 243 | int rc; |
242 | u32 genctl; | 244 | u32 genctl; |
@@ -245,6 +247,9 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
245 | u8 pmr; | 247 | u8 pmr; |
246 | u8 port2_start; | 248 | u8 port2_start; |
247 | 249 | ||
250 | if (!printed_version++) | ||
251 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); | ||
252 | |||
248 | rc = pci_enable_device(pdev); | 253 | rc = pci_enable_device(pdev); |
249 | if (rc) | 254 | if (rc) |
250 | return rc; | 255 | return rc; |
@@ -288,16 +293,18 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
288 | pci_read_config_byte(pdev, SIS_PMR, &pmr); | 293 | pci_read_config_byte(pdev, SIS_PMR, &pmr); |
289 | if (ent->device != 0x182) { | 294 | if (ent->device != 0x182) { |
290 | if ((pmr & SIS_PMR_COMBINED) == 0) { | 295 | if ((pmr & SIS_PMR_COMBINED) == 0) { |
291 | printk(KERN_INFO "sata_sis: Detected SiS 180/181 chipset in SATA mode\n"); | 296 | dev_printk(KERN_INFO, &pdev->dev, |
297 | "Detected SiS 180/181 chipset in SATA mode\n"); | ||
292 | port2_start = 64; | 298 | port2_start = 64; |
293 | } | 299 | } |
294 | else { | 300 | else { |
295 | printk(KERN_INFO "sata_sis: Detected SiS 180/181 chipset in combined mode\n"); | 301 | dev_printk(KERN_INFO, &pdev->dev, |
302 | "Detected SiS 180/181 chipset in combined mode\n"); | ||
296 | port2_start=0; | 303 | port2_start=0; |
297 | } | 304 | } |
298 | } | 305 | } |
299 | else { | 306 | else { |
300 | printk(KERN_INFO "sata_sis: Detected SiS 182 chipset\n"); | 307 | dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182 chipset\n"); |
301 | port2_start = 0x20; | 308 | port2_start = 0x20; |
302 | } | 309 | } |
303 | 310 | ||
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 46208f52d0e1..db615ff794d8 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/blkdev.h> | 44 | #include <linux/blkdev.h> |
45 | #include <linux/delay.h> | 45 | #include <linux/delay.h> |
46 | #include <linux/interrupt.h> | 46 | #include <linux/interrupt.h> |
47 | #include <linux/device.h> | ||
47 | #include "scsi.h" | 48 | #include "scsi.h" |
48 | #include <scsi/scsi_host.h> | 49 | #include <scsi/scsi_host.h> |
49 | #include <linux/libata.h> | 50 | #include <linux/libata.h> |
@@ -362,7 +363,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
362 | int i; | 363 | int i; |
363 | 364 | ||
364 | if (!printed_version++) | 365 | if (!printed_version++) |
365 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 366 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
366 | 367 | ||
367 | /* | 368 | /* |
368 | * If this driver happens to only be useful on Apple's K2, then | 369 | * If this driver happens to only be useful on Apple's K2, then |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index af08f4f650c1..0ec21e09f5d8 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/sched.h> | 40 | #include <linux/sched.h> |
41 | #include <linux/device.h> | ||
41 | #include "scsi.h" | 42 | #include "scsi.h" |
42 | #include <scsi/scsi_host.h> | 43 | #include <scsi/scsi_host.h> |
43 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
@@ -718,7 +719,7 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
718 | VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id, | 719 | VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id, |
719 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); | 720 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); |
720 | /* get drive status; clear intr; complete txn */ | 721 | /* get drive status; clear intr; complete txn */ |
721 | ata_qc_complete(qc, ata_wait_idle(ap)); | 722 | ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); |
722 | pdc20621_pop_hdma(qc); | 723 | pdc20621_pop_hdma(qc); |
723 | } | 724 | } |
724 | 725 | ||
@@ -756,7 +757,7 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
756 | VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id, | 757 | VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id, |
757 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); | 758 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); |
758 | /* get drive status; clear intr; complete txn */ | 759 | /* get drive status; clear intr; complete txn */ |
759 | ata_qc_complete(qc, ata_wait_idle(ap)); | 760 | ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); |
760 | pdc20621_pop_hdma(qc); | 761 | pdc20621_pop_hdma(qc); |
761 | } | 762 | } |
762 | handled = 1; | 763 | handled = 1; |
@@ -766,7 +767,7 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
766 | 767 | ||
767 | status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 768 | status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
768 | DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); | 769 | DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); |
769 | ata_qc_complete(qc, status); | 770 | ata_qc_complete(qc, ac_err_mask(status)); |
770 | handled = 1; | 771 | handled = 1; |
771 | 772 | ||
772 | } else { | 773 | } else { |
@@ -881,7 +882,7 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
881 | case ATA_PROT_DMA: | 882 | case ATA_PROT_DMA: |
882 | case ATA_PROT_NODATA: | 883 | case ATA_PROT_NODATA: |
883 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 884 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
884 | ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR); | 885 | ata_qc_complete(qc, __ac_err_mask(ata_wait_idle(ap))); |
885 | break; | 886 | break; |
886 | 887 | ||
887 | default: | 888 | default: |
@@ -890,7 +891,7 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
890 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 891 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", |
891 | ap->id, qc->tf.command, drv_stat); | 892 | ap->id, qc->tf.command, drv_stat); |
892 | 893 | ||
893 | ata_qc_complete(qc, drv_stat); | 894 | ata_qc_complete(qc, ac_err_mask(drv_stat)); |
894 | break; | 895 | break; |
895 | } | 896 | } |
896 | 897 | ||
@@ -1385,7 +1386,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * | |||
1385 | int rc; | 1386 | int rc; |
1386 | 1387 | ||
1387 | if (!printed_version++) | 1388 | if (!printed_version++) |
1388 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 1389 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
1389 | 1390 | ||
1390 | /* | 1391 | /* |
1391 | * If this driver happens to only be useful on Apple's K2, then | 1392 | * If this driver happens to only be useful on Apple's K2, then |
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c index d68dc7d3422c..a5e245c098e1 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/scsi/sata_uli.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/blkdev.h> | 32 | #include <linux/blkdev.h> |
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
35 | #include <linux/device.h> | ||
35 | #include "scsi.h" | 36 | #include "scsi.h" |
36 | #include <scsi/scsi_host.h> | 37 | #include <scsi/scsi_host.h> |
37 | #include <linux/libata.h> | 38 | #include <linux/libata.h> |
@@ -178,12 +179,16 @@ static void uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
178 | 179 | ||
179 | static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 180 | static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
180 | { | 181 | { |
182 | static int printed_version; | ||
181 | struct ata_probe_ent *probe_ent; | 183 | struct ata_probe_ent *probe_ent; |
182 | struct ata_port_info *ppi; | 184 | struct ata_port_info *ppi; |
183 | int rc; | 185 | int rc; |
184 | unsigned int board_idx = (unsigned int) ent->driver_data; | 186 | unsigned int board_idx = (unsigned int) ent->driver_data; |
185 | int pci_dev_busy = 0; | 187 | int pci_dev_busy = 0; |
186 | 188 | ||
189 | if (!printed_version++) | ||
190 | dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); | ||
191 | |||
187 | rc = pci_enable_device(pdev); | 192 | rc = pci_enable_device(pdev); |
188 | if (rc) | 193 | if (rc) |
189 | return rc; | 194 | return rc; |
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c index 80e291a909a9..b3ecdbe400e9 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/scsi/sata_via.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/blkdev.h> | 42 | #include <linux/blkdev.h> |
43 | #include <linux/delay.h> | 43 | #include <linux/delay.h> |
44 | #include <linux/device.h> | ||
44 | #include "scsi.h" | 45 | #include "scsi.h" |
45 | #include <scsi/scsi_host.h> | 46 | #include <scsi/scsi_host.h> |
46 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
@@ -259,15 +260,15 @@ static void svia_configure(struct pci_dev *pdev) | |||
259 | u8 tmp8; | 260 | u8 tmp8; |
260 | 261 | ||
261 | pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8); | 262 | pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8); |
262 | printk(KERN_INFO DRV_NAME "(%s): routed to hard irq line %d\n", | 263 | dev_printk(KERN_INFO, &pdev->dev, "routed to hard irq line %d\n", |
263 | pci_name(pdev), | ||
264 | (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f); | 264 | (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f); |
265 | 265 | ||
266 | /* make sure SATA channels are enabled */ | 266 | /* make sure SATA channels are enabled */ |
267 | pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8); | 267 | pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8); |
268 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { | 268 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { |
269 | printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channels (0x%x)\n", | 269 | dev_printk(KERN_DEBUG, &pdev->dev, |
270 | pci_name(pdev), (int) tmp8); | 270 | "enabling SATA channels (0x%x)\n", |
271 | (int) tmp8); | ||
271 | tmp8 |= ALL_PORTS; | 272 | tmp8 |= ALL_PORTS; |
272 | pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8); | 273 | pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8); |
273 | } | 274 | } |
@@ -275,8 +276,9 @@ static void svia_configure(struct pci_dev *pdev) | |||
275 | /* make sure interrupts for each channel sent to us */ | 276 | /* make sure interrupts for each channel sent to us */ |
276 | pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8); | 277 | pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8); |
277 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { | 278 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { |
278 | printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channel interrupts (0x%x)\n", | 279 | dev_printk(KERN_DEBUG, &pdev->dev, |
279 | pci_name(pdev), (int) tmp8); | 280 | "enabling SATA channel interrupts (0x%x)\n", |
281 | (int) tmp8); | ||
280 | tmp8 |= ALL_PORTS; | 282 | tmp8 |= ALL_PORTS; |
281 | pci_write_config_byte(pdev, SATA_INT_GATE, tmp8); | 283 | pci_write_config_byte(pdev, SATA_INT_GATE, tmp8); |
282 | } | 284 | } |
@@ -284,8 +286,9 @@ static void svia_configure(struct pci_dev *pdev) | |||
284 | /* make sure native mode is enabled */ | 286 | /* make sure native mode is enabled */ |
285 | pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8); | 287 | pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8); |
286 | if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) { | 288 | if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) { |
287 | printk(KERN_DEBUG DRV_NAME "(%s): enabling SATA channel native mode (0x%x)\n", | 289 | dev_printk(KERN_DEBUG, &pdev->dev, |
288 | pci_name(pdev), (int) tmp8); | 290 | "enabling SATA channel native mode (0x%x)\n", |
291 | (int) tmp8); | ||
289 | tmp8 |= NATIVE_MODE_ALL; | 292 | tmp8 |= NATIVE_MODE_ALL; |
290 | pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8); | 293 | pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8); |
291 | } | 294 | } |
@@ -303,7 +306,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
303 | u8 tmp8; | 306 | u8 tmp8; |
304 | 307 | ||
305 | if (!printed_version++) | 308 | if (!printed_version++) |
306 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 309 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
307 | 310 | ||
308 | rc = pci_enable_device(pdev); | 311 | rc = pci_enable_device(pdev); |
309 | if (rc) | 312 | if (rc) |
@@ -318,8 +321,9 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
318 | if (board_id == vt6420) { | 321 | if (board_id == vt6420) { |
319 | pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8); | 322 | pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8); |
320 | if (tmp8 & SATA_2DEV) { | 323 | if (tmp8 & SATA_2DEV) { |
321 | printk(KERN_ERR DRV_NAME "(%s): SATA master/slave not supported (0x%x)\n", | 324 | dev_printk(KERN_ERR, &pdev->dev, |
322 | pci_name(pdev), (int) tmp8); | 325 | "SATA master/slave not supported (0x%x)\n", |
326 | (int) tmp8); | ||
323 | rc = -EIO; | 327 | rc = -EIO; |
324 | goto err_out_regions; | 328 | goto err_out_regions; |
325 | } | 329 | } |
@@ -332,10 +336,11 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
332 | for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) | 336 | for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) |
333 | if ((pci_resource_start(pdev, i) == 0) || | 337 | if ((pci_resource_start(pdev, i) == 0) || |
334 | (pci_resource_len(pdev, i) < bar_sizes[i])) { | 338 | (pci_resource_len(pdev, i) < bar_sizes[i])) { |
335 | printk(KERN_ERR DRV_NAME "(%s): invalid PCI BAR %u (sz 0x%lx, val 0x%lx)\n", | 339 | dev_printk(KERN_ERR, &pdev->dev, |
336 | pci_name(pdev), i, | 340 | "invalid PCI BAR %u (sz 0x%lx, val 0x%lx)\n", |
337 | pci_resource_start(pdev, i), | 341 | i, |
338 | pci_resource_len(pdev, i)); | 342 | pci_resource_start(pdev, i), |
343 | pci_resource_len(pdev, i)); | ||
339 | rc = -ENODEV; | 344 | rc = -ENODEV; |
340 | goto err_out_regions; | 345 | goto err_out_regions; |
341 | } | 346 | } |
@@ -353,8 +358,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
353 | probe_ent = vt6421_init_probe_ent(pdev); | 358 | probe_ent = vt6421_init_probe_ent(pdev); |
354 | 359 | ||
355 | if (!probe_ent) { | 360 | if (!probe_ent) { |
356 | printk(KERN_ERR DRV_NAME "(%s): out of memory\n", | 361 | dev_printk(KERN_ERR, &pdev->dev, "out of memory\n"); |
357 | pci_name(pdev)); | ||
358 | rc = -ENOMEM; | 362 | rc = -ENOMEM; |
359 | goto err_out_regions; | 363 | goto err_out_regions; |
360 | } | 364 | } |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 54273e0063c7..bb84ba0c7e83 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
43 | #include <linux/interrupt.h> | 43 | #include <linux/interrupt.h> |
44 | #include <linux/dma-mapping.h> | 44 | #include <linux/dma-mapping.h> |
45 | #include <linux/device.h> | ||
45 | #include "scsi.h" | 46 | #include "scsi.h" |
46 | #include <scsi/scsi_host.h> | 47 | #include <scsi/scsi_host.h> |
47 | #include <linux/libata.h> | 48 | #include <linux/libata.h> |
@@ -295,7 +296,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d | |||
295 | int rc; | 296 | int rc; |
296 | 297 | ||
297 | if (!printed_version++) | 298 | if (!printed_version++) |
298 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 299 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
299 | 300 | ||
300 | rc = pci_enable_device(pdev); | 301 | rc = pci_enable_device(pdev); |
301 | if (rc) | 302 | if (rc) |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 771e97ef136e..b856e140e65f 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/sched.h> /* workqueue stuff, HZ */ | ||
29 | #include <scsi/scsi_device.h> | 30 | #include <scsi/scsi_device.h> |
30 | #include <scsi/scsi_host.h> | 31 | #include <scsi/scsi_host.h> |
31 | #include <scsi/scsi_transport.h> | 32 | #include <scsi/scsi_transport.h> |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 8bb8222ea589..d2caa35059d9 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -19,6 +19,9 @@ | |||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/string.h> | ||
23 | #include <linux/slab.h> | ||
24 | |||
22 | #include <scsi/scsi.h> | 25 | #include <scsi/scsi.h> |
23 | #include <scsi/scsi_host.h> | 26 | #include <scsi/scsi_host.h> |
24 | #include <scsi/scsi_device.h> | 27 | #include <scsi/scsi_device.h> |
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index e753ba27dc59..a1a58e1d5ad3 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c | |||
@@ -37,6 +37,9 @@ | |||
37 | * along with this program; if not, write to the Free Software | 37 | * along with this program; if not, write to the Free Software |
38 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 38 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
39 | */ | 39 | */ |
40 | |||
41 | #include <linux/slab.h> | ||
42 | |||
40 | #include "sym_glue.h" | 43 | #include "sym_glue.h" |
41 | #include "sym_nvram.h" | 44 | #include "sym_nvram.h" |
42 | 45 | ||
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h index 3131a6bf7ab7..3a264a408216 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h | |||
@@ -37,6 +37,8 @@ | |||
37 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 37 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #include <linux/gfp.h> | ||
41 | |||
40 | #ifndef SYM_HIPD_H | 42 | #ifndef SYM_HIPD_H |
41 | #define SYM_HIPD_H | 43 | #define SYM_HIPD_H |
42 | 44 | ||
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index f88fdd480685..771676abee60 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c | |||
@@ -308,6 +308,8 @@ struct ioc4_serial { | |||
308 | typedef void ioc4_intr_func_f(void *, uint32_t); | 308 | typedef void ioc4_intr_func_f(void *, uint32_t); |
309 | typedef ioc4_intr_func_f *ioc4_intr_func_t; | 309 | typedef ioc4_intr_func_f *ioc4_intr_func_t; |
310 | 310 | ||
311 | static unsigned int Num_of_ioc4_cards; | ||
312 | |||
311 | /* defining this will get you LOTS of great debug info */ | 313 | /* defining this will get you LOTS of great debug info */ |
312 | //#define DEBUG_INTERRUPTS | 314 | //#define DEBUG_INTERRUPTS |
313 | #define DPRINT_CONFIG(_x...) ; | 315 | #define DPRINT_CONFIG(_x...) ; |
@@ -317,7 +319,8 @@ typedef ioc4_intr_func_f *ioc4_intr_func_t; | |||
317 | #define WAKEUP_CHARS 256 | 319 | #define WAKEUP_CHARS 256 |
318 | 320 | ||
319 | /* number of characters we want to transmit to the lower level at a time */ | 321 | /* number of characters we want to transmit to the lower level at a time */ |
320 | #define IOC4_MAX_CHARS 128 | 322 | #define IOC4_MAX_CHARS 256 |
323 | #define IOC4_FIFO_CHARS 255 | ||
321 | 324 | ||
322 | /* Device name we're using */ | 325 | /* Device name we're using */ |
323 | #define DEVICE_NAME "ttyIOC" | 326 | #define DEVICE_NAME "ttyIOC" |
@@ -1038,6 +1041,7 @@ static int inline ioc4_attach_local(struct ioc4_driver_data *idd) | |||
1038 | return -ENOMEM; | 1041 | return -ENOMEM; |
1039 | } | 1042 | } |
1040 | memset(port, 0, sizeof(struct ioc4_port)); | 1043 | memset(port, 0, sizeof(struct ioc4_port)); |
1044 | spin_lock_init(&port->ip_lock); | ||
1041 | 1045 | ||
1042 | /* we need to remember the previous ones, to point back to | 1046 | /* we need to remember the previous ones, to point back to |
1043 | * them farther down - setting up the ring buffers. | 1047 | * them farther down - setting up the ring buffers. |
@@ -1691,12 +1695,14 @@ ioc4_change_speed(struct uart_port *the_port, | |||
1691 | baud = 9600; | 1695 | baud = 9600; |
1692 | 1696 | ||
1693 | if (!the_port->fifosize) | 1697 | if (!the_port->fifosize) |
1694 | the_port->fifosize = IOC4_MAX_CHARS; | 1698 | the_port->fifosize = IOC4_FIFO_CHARS; |
1695 | the_port->timeout = ((the_port->fifosize * HZ * bits) / (baud / 10)); | 1699 | the_port->timeout = ((the_port->fifosize * HZ * bits) / (baud / 10)); |
1696 | the_port->timeout += HZ / 50; /* Add .02 seconds of slop */ | 1700 | the_port->timeout += HZ / 50; /* Add .02 seconds of slop */ |
1697 | 1701 | ||
1698 | the_port->ignore_status_mask = N_ALL_INPUT; | 1702 | the_port->ignore_status_mask = N_ALL_INPUT; |
1699 | 1703 | ||
1704 | info->tty->low_latency = 1; | ||
1705 | |||
1700 | if (I_IGNPAR(info->tty)) | 1706 | if (I_IGNPAR(info->tty)) |
1701 | the_port->ignore_status_mask &= ~(N_PARITY_ERROR | 1707 | the_port->ignore_status_mask &= ~(N_PARITY_ERROR |
1702 | | N_FRAMING_ERROR); | 1708 | | N_FRAMING_ERROR); |
@@ -1742,7 +1748,6 @@ ioc4_change_speed(struct uart_port *the_port, | |||
1742 | */ | 1748 | */ |
1743 | static inline int ic4_startup_local(struct uart_port *the_port) | 1749 | static inline int ic4_startup_local(struct uart_port *the_port) |
1744 | { | 1750 | { |
1745 | int retval = 0; | ||
1746 | struct ioc4_port *port; | 1751 | struct ioc4_port *port; |
1747 | struct uart_info *info; | 1752 | struct uart_info *info; |
1748 | 1753 | ||
@@ -1754,9 +1759,6 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1754 | return -1; | 1759 | return -1; |
1755 | 1760 | ||
1756 | info = the_port->info; | 1761 | info = the_port->info; |
1757 | if (info->flags & UIF_INITIALIZED) { | ||
1758 | return retval; | ||
1759 | } | ||
1760 | 1762 | ||
1761 | if (info->tty) { | 1763 | if (info->tty) { |
1762 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 1764 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
@@ -1775,7 +1777,6 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1775 | /* set the speed of the serial port */ | 1777 | /* set the speed of the serial port */ |
1776 | ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); | 1778 | ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); |
1777 | 1779 | ||
1778 | info->flags |= UIF_INITIALIZED; | ||
1779 | return 0; | 1780 | return 0; |
1780 | } | 1781 | } |
1781 | 1782 | ||
@@ -1785,9 +1786,13 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1785 | */ | 1786 | */ |
1786 | static void ioc4_cb_output_lowat(struct ioc4_port *port) | 1787 | static void ioc4_cb_output_lowat(struct ioc4_port *port) |
1787 | { | 1788 | { |
1789 | unsigned long pflags; | ||
1790 | |||
1788 | /* ip_lock is set on the call here */ | 1791 | /* ip_lock is set on the call here */ |
1789 | if (port->ip_port) { | 1792 | if (port->ip_port) { |
1793 | spin_lock_irqsave(&port->ip_port->lock, pflags); | ||
1790 | transmit_chars(port->ip_port); | 1794 | transmit_chars(port->ip_port); |
1795 | spin_unlock_irqrestore(&port->ip_port->lock, pflags); | ||
1791 | } | 1796 | } |
1792 | } | 1797 | } |
1793 | 1798 | ||
@@ -2064,8 +2069,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf, | |||
2064 | * available data as long as it returns some. | 2069 | * available data as long as it returns some. |
2065 | */ | 2070 | */ |
2066 | /* Re-arm the timer */ | 2071 | /* Re-arm the timer */ |
2067 | writel(port->ip_rx_cons | IOC4_SRCIR_ARM, | 2072 | writel(port->ip_rx_cons | IOC4_SRCIR_ARM, &port->ip_serial_regs->srcir); |
2068 | &port->ip_serial_regs->srcir); | ||
2069 | 2073 | ||
2070 | prod_ptr = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK; | 2074 | prod_ptr = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK; |
2071 | cons_ptr = port->ip_rx_cons; | 2075 | cons_ptr = port->ip_rx_cons; |
@@ -2299,6 +2303,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf, | |||
2299 | } | 2303 | } |
2300 | return total; | 2304 | return total; |
2301 | } | 2305 | } |
2306 | |||
2302 | /** | 2307 | /** |
2303 | * receive_chars - upper level read. Called with ip_lock. | 2308 | * receive_chars - upper level read. Called with ip_lock. |
2304 | * @the_port: port to read from | 2309 | * @the_port: port to read from |
@@ -2307,9 +2312,11 @@ static void receive_chars(struct uart_port *the_port) | |||
2307 | { | 2312 | { |
2308 | struct tty_struct *tty; | 2313 | struct tty_struct *tty; |
2309 | unsigned char ch[IOC4_MAX_CHARS]; | 2314 | unsigned char ch[IOC4_MAX_CHARS]; |
2310 | int read_count, request_count; | 2315 | int read_count, request_count = IOC4_MAX_CHARS; |
2311 | struct uart_icount *icount; | 2316 | struct uart_icount *icount; |
2312 | struct uart_info *info = the_port->info; | 2317 | struct uart_info *info = the_port->info; |
2318 | int flip = 0; | ||
2319 | unsigned long pflags; | ||
2313 | 2320 | ||
2314 | /* Make sure all the pointers are "good" ones */ | 2321 | /* Make sure all the pointers are "good" ones */ |
2315 | if (!info) | 2322 | if (!info) |
@@ -2317,16 +2324,17 @@ static void receive_chars(struct uart_port *the_port) | |||
2317 | if (!info->tty) | 2324 | if (!info->tty) |
2318 | return; | 2325 | return; |
2319 | 2326 | ||
2327 | spin_lock_irqsave(&the_port->lock, pflags); | ||
2320 | tty = info->tty; | 2328 | tty = info->tty; |
2321 | 2329 | ||
2322 | request_count = TTY_FLIPBUF_SIZE - tty->flip.count - 1; | 2330 | if (request_count > TTY_FLIPBUF_SIZE - tty->flip.count) |
2331 | request_count = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
2323 | 2332 | ||
2324 | if (request_count > 0) { | 2333 | if (request_count > 0) { |
2325 | if (request_count > IOC4_MAX_CHARS - 2) | ||
2326 | request_count = IOC4_MAX_CHARS - 2; | ||
2327 | icount = &the_port->icount; | 2334 | icount = &the_port->icount; |
2328 | read_count = do_read(the_port, ch, request_count); | 2335 | read_count = do_read(the_port, ch, request_count); |
2329 | if (read_count > 0) { | 2336 | if (read_count > 0) { |
2337 | flip = 1; | ||
2330 | memcpy(tty->flip.char_buf_ptr, ch, read_count); | 2338 | memcpy(tty->flip.char_buf_ptr, ch, read_count); |
2331 | memset(tty->flip.flag_buf_ptr, TTY_NORMAL, read_count); | 2339 | memset(tty->flip.flag_buf_ptr, TTY_NORMAL, read_count); |
2332 | tty->flip.char_buf_ptr += read_count; | 2340 | tty->flip.char_buf_ptr += read_count; |
@@ -2335,7 +2343,11 @@ static void receive_chars(struct uart_port *the_port) | |||
2335 | icount->rx += read_count; | 2343 | icount->rx += read_count; |
2336 | } | 2344 | } |
2337 | } | 2345 | } |
2338 | tty_flip_buffer_push(tty); | 2346 | |
2347 | spin_unlock_irqrestore(&the_port->lock, pflags); | ||
2348 | |||
2349 | if (flip) | ||
2350 | tty_flip_buffer_push(tty); | ||
2339 | } | 2351 | } |
2340 | 2352 | ||
2341 | /** | 2353 | /** |
@@ -2393,18 +2405,14 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2393 | 2405 | ||
2394 | info = the_port->info; | 2406 | info = the_port->info; |
2395 | 2407 | ||
2396 | if (!(info->flags & UIF_INITIALIZED)) | ||
2397 | return; | ||
2398 | |||
2399 | wake_up_interruptible(&info->delta_msr_wait); | 2408 | wake_up_interruptible(&info->delta_msr_wait); |
2400 | 2409 | ||
2401 | if (info->tty) | 2410 | if (info->tty) |
2402 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2411 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
2403 | 2412 | ||
2404 | spin_lock_irqsave(&port->ip_lock, port_flags); | 2413 | spin_lock_irqsave(&the_port->lock, port_flags); |
2405 | set_notification(port, N_ALL, 0); | 2414 | set_notification(port, N_ALL, 0); |
2406 | info->flags &= ~UIF_INITIALIZED; | 2415 | spin_unlock_irqrestore(&the_port->lock, port_flags); |
2407 | spin_unlock_irqrestore(&port->ip_lock, port_flags); | ||
2408 | } | 2416 | } |
2409 | 2417 | ||
2410 | /** | 2418 | /** |
@@ -2463,12 +2471,10 @@ static unsigned int ic4_get_mctrl(struct uart_port *the_port) | |||
2463 | static void ic4_start_tx(struct uart_port *the_port) | 2471 | static void ic4_start_tx(struct uart_port *the_port) |
2464 | { | 2472 | { |
2465 | struct ioc4_port *port = get_ioc4_port(the_port); | 2473 | struct ioc4_port *port = get_ioc4_port(the_port); |
2466 | unsigned long flags; | ||
2467 | 2474 | ||
2468 | if (port) { | 2475 | if (port) { |
2469 | spin_lock_irqsave(&port->ip_lock, flags); | 2476 | set_notification(port, N_OUTPUT_LOWAT, 1); |
2470 | transmit_chars(the_port); | 2477 | enable_intrs(port, port->ip_hooks->intr_tx_mt); |
2471 | spin_unlock_irqrestore(&port->ip_lock, flags); | ||
2472 | } | 2478 | } |
2473 | } | 2479 | } |
2474 | 2480 | ||
@@ -2510,9 +2516,9 @@ static int ic4_startup(struct uart_port *the_port) | |||
2510 | } | 2516 | } |
2511 | 2517 | ||
2512 | /* Start up the serial port */ | 2518 | /* Start up the serial port */ |
2513 | spin_lock_irqsave(&port->ip_lock, port_flags); | 2519 | spin_lock_irqsave(&the_port->lock, port_flags); |
2514 | retval = ic4_startup_local(the_port); | 2520 | retval = ic4_startup_local(the_port); |
2515 | spin_unlock_irqrestore(&port->ip_lock, port_flags); | 2521 | spin_unlock_irqrestore(&the_port->lock, port_flags); |
2516 | return retval; | 2522 | return retval; |
2517 | } | 2523 | } |
2518 | 2524 | ||
@@ -2527,12 +2533,11 @@ static void | |||
2527 | ic4_set_termios(struct uart_port *the_port, | 2533 | ic4_set_termios(struct uart_port *the_port, |
2528 | struct termios *termios, struct termios *old_termios) | 2534 | struct termios *termios, struct termios *old_termios) |
2529 | { | 2535 | { |
2530 | struct ioc4_port *port = get_ioc4_port(the_port); | ||
2531 | unsigned long port_flags; | 2536 | unsigned long port_flags; |
2532 | 2537 | ||
2533 | spin_lock_irqsave(&port->ip_lock, port_flags); | 2538 | spin_lock_irqsave(&the_port->lock, port_flags); |
2534 | ioc4_change_speed(the_port, termios, old_termios); | 2539 | ioc4_change_speed(the_port, termios, old_termios); |
2535 | spin_unlock_irqrestore(&port->ip_lock, port_flags); | 2540 | spin_unlock_irqrestore(&the_port->lock, port_flags); |
2536 | } | 2541 | } |
2537 | 2542 | ||
2538 | /** | 2543 | /** |
@@ -2607,24 +2612,25 @@ ioc4_serial_core_attach(struct pci_dev *pdev) | |||
2607 | __FUNCTION__, (void *)the_port, | 2612 | __FUNCTION__, (void *)the_port, |
2608 | (void *)port)); | 2613 | (void *)port)); |
2609 | 2614 | ||
2610 | spin_lock_init(&the_port->lock); | ||
2611 | /* membase, iobase and mapbase just need to be non-0 */ | 2615 | /* membase, iobase and mapbase just need to be non-0 */ |
2612 | the_port->membase = (unsigned char __iomem *)1; | 2616 | the_port->membase = (unsigned char __iomem *)1; |
2613 | the_port->line = the_port->iobase = ii; | 2617 | the_port->iobase = (pdev->bus->number << 16) | ii; |
2618 | the_port->line = (Num_of_ioc4_cards << 2) | ii; | ||
2614 | the_port->mapbase = 1; | 2619 | the_port->mapbase = 1; |
2615 | the_port->type = PORT_16550A; | 2620 | the_port->type = PORT_16550A; |
2616 | the_port->fifosize = IOC4_MAX_CHARS; | 2621 | the_port->fifosize = IOC4_FIFO_CHARS; |
2617 | the_port->ops = &ioc4_ops; | 2622 | the_port->ops = &ioc4_ops; |
2618 | the_port->irq = control->ic_irq; | 2623 | the_port->irq = control->ic_irq; |
2619 | the_port->dev = &pdev->dev; | 2624 | the_port->dev = &pdev->dev; |
2625 | spin_lock_init(&the_port->lock); | ||
2620 | if (uart_add_one_port(&ioc4_uart, the_port) < 0) { | 2626 | if (uart_add_one_port(&ioc4_uart, the_port) < 0) { |
2621 | printk(KERN_WARNING | 2627 | printk(KERN_WARNING |
2622 | "%s: unable to add port %d\n", | 2628 | "%s: unable to add port %d bus %d\n", |
2623 | __FUNCTION__, the_port->line); | 2629 | __FUNCTION__, the_port->line, pdev->bus->number); |
2624 | } else { | 2630 | } else { |
2625 | DPRINT_CONFIG( | 2631 | DPRINT_CONFIG( |
2626 | ("IOC4 serial driver port %d irq = %d\n", | 2632 | ("IOC4 serial port %d irq = %d, bus %d\n", |
2627 | the_port->line, the_port->irq)); | 2633 | the_port->line, the_port->irq, pdev->bus->number)); |
2628 | } | 2634 | } |
2629 | /* all ports are rs232 for now */ | 2635 | /* all ports are rs232 for now */ |
2630 | ioc4_set_proto(port, PROTO_RS232); | 2636 | ioc4_set_proto(port, PROTO_RS232); |
@@ -2734,6 +2740,8 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2734 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev))) | 2740 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev))) |
2735 | goto out4; | 2741 | goto out4; |
2736 | 2742 | ||
2743 | Num_of_ioc4_cards++; | ||
2744 | |||
2737 | return ret; | 2745 | return ret; |
2738 | 2746 | ||
2739 | /* error exits that give back resources */ | 2747 | /* error exits that give back resources */ |
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index efe79b1fd431..aec83f577ce6 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -1100,6 +1100,8 @@ mpsc_start_rx(struct mpsc_port_info *pi) | |||
1100 | { | 1100 | { |
1101 | pr_debug("mpsc_start_rx[%d]: Starting...\n", pi->port.line); | 1101 | pr_debug("mpsc_start_rx[%d]: Starting...\n", pi->port.line); |
1102 | 1102 | ||
1103 | /* Issue a Receive Abort to clear any receive errors */ | ||
1104 | writel(MPSC_CHR_2_RA, pi->mpsc_base + MPSC_CHR_2); | ||
1103 | if (pi->rcv_data) { | 1105 | if (pi->rcv_data) { |
1104 | mpsc_enter_hunt(pi); | 1106 | mpsc_enter_hunt(pi); |
1105 | mpsc_sdma_cmd(pi, SDMA_SDCM_ERD); | 1107 | mpsc_sdma_cmd(pi, SDMA_SDCM_ERD); |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 2d8622eef701..401d94a7fe2e 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -147,8 +147,7 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
147 | * once we have successfully opened the port. Also set | 147 | * once we have successfully opened the port. Also set |
148 | * up the tty->alt_speed kludge | 148 | * up the tty->alt_speed kludge |
149 | */ | 149 | */ |
150 | if (info->tty) | 150 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
151 | set_bit(TTY_IO_ERROR, &info->tty->flags); | ||
152 | 151 | ||
153 | if (port->type == PORT_UNKNOWN) | 152 | if (port->type == PORT_UNKNOWN) |
154 | return 0; | 153 | return 0; |
diff --git a/drivers/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c index f056276b08a1..28757cb9d246 100644 --- a/drivers/sh/superhyway/superhyway.c +++ b/drivers/sh/superhyway/superhyway.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/superhyway.h> | 18 | #include <linux/superhyway.h> |
19 | #include <linux/string.h> | ||
20 | #include <linux/slab.h> | ||
19 | 21 | ||
20 | static int superhyway_devices; | 22 | static int superhyway_devices; |
21 | 23 | ||
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 45efeed1fcc3..49815ec4b842 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -14,6 +14,9 @@ | |||
14 | * This file is licenced under the GPL. | 14 | * This file is licenced under the GPL. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/signal.h> /* SA_INTERRUPT */ | ||
18 | #include <linux/jiffies.h> | ||
19 | |||
17 | #include <asm/hardware.h> | 20 | #include <asm/hardware.h> |
18 | #include <asm/io.h> | 21 | #include <asm/io.h> |
19 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index bf1d5ab4aa3a..7ce1d9ef0289 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * This file is licenced under the GPL. | 14 | * This file is licenced under the GPL. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/jiffies.h> | ||
18 | |||
17 | #ifdef CONFIG_PPC_PMAC | 19 | #ifdef CONFIG_PPC_PMAC |
18 | #include <asm/machdep.h> | 20 | #include <asm/machdep.h> |
19 | #include <asm/pmac_feature.h> | 21 | #include <asm/pmac_feature.h> |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index d287dcccd415..f4a4aeda40b7 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/signal.h> | ||
23 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
24 | #include <asm/hardware.h> | 25 | #include <asm/hardware.h> |
25 | #include <asm/arch/pxa-regs.h> | 26 | #include <asm/arch/pxa-regs.h> |
diff --git a/drivers/usb/input/pid.c b/drivers/usb/input/pid.c index a00672c96644..dca5ee93a4ef 100644 --- a/drivers/usb/input/pid.c +++ b/drivers/usb/input/pid.c | |||
@@ -198,7 +198,7 @@ static int hid_pid_upload_effect(struct input_dev *dev, | |||
198 | } | 198 | } |
199 | 199 | ||
200 | effect->id = id; | 200 | effect->id = id; |
201 | dev_dbg(&pid_private->hid->dev->dev, "effect ID is %d\n.", id); | 201 | dev_dbg(&pid_private->hid->dev->dev, "effect ID is %d.\n", id); |
202 | pid_private->effects[id].owner = current->pid; | 202 | pid_private->effects[id].owner = current->pid; |
203 | pid_private->effects[id].flags = (1 << FF_PID_FLAGS_USED); | 203 | pid_private->effects[id].flags = (1 << FF_PID_FLAGS_USED); |
204 | spin_unlock_irqrestore(&pid_private->lock, flags); | 204 | spin_unlock_irqrestore(&pid_private->lock, flags); |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7e297947a2b2..7192b770bfb6 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -494,7 +494,7 @@ config FB_TGA | |||
494 | 494 | ||
495 | config FB_VESA | 495 | config FB_VESA |
496 | bool "VESA VGA graphics support" | 496 | bool "VESA VGA graphics support" |
497 | depends on (FB = y) && (X86 || X86_64) | 497 | depends on (FB = y) && X86 |
498 | select FB_CFB_FILLRECT | 498 | select FB_CFB_FILLRECT |
499 | select FB_CFB_COPYAREA | 499 | select FB_CFB_COPYAREA |
500 | select FB_CFB_IMAGEBLIT | 500 | select FB_CFB_IMAGEBLIT |
@@ -712,7 +712,7 @@ config FB_RIVA_DEBUG | |||
712 | 712 | ||
713 | config FB_I810 | 713 | config FB_I810 |
714 | tristate "Intel 810/815 support (EXPERIMENTAL)" | 714 | tristate "Intel 810/815 support (EXPERIMENTAL)" |
715 | depends on FB && EXPERIMENTAL && PCI && X86 && !X86_64 | 715 | depends on FB && EXPERIMENTAL && PCI && X86_32 |
716 | select AGP | 716 | select AGP |
717 | select AGP_INTEL | 717 | select AGP_INTEL |
718 | select FB_MODE_HELPERS | 718 | select FB_MODE_HELPERS |
@@ -761,7 +761,7 @@ config FB_I810_I2C | |||
761 | 761 | ||
762 | config FB_INTEL | 762 | config FB_INTEL |
763 | tristate "Intel 830M/845G/852GM/855GM/865G support (EXPERIMENTAL)" | 763 | tristate "Intel 830M/845G/852GM/855GM/865G support (EXPERIMENTAL)" |
764 | depends on FB && EXPERIMENTAL && PCI && X86 && !X86_64 | 764 | depends on FB && EXPERIMENTAL && PCI && X86_32 |
765 | select AGP | 765 | select AGP |
766 | select AGP_INTEL | 766 | select AGP_INTEL |
767 | select FB_MODE_HELPERS | 767 | select FB_MODE_HELPERS |
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 7e731691e2a9..6a9ae2b3d1ab 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig | |||
@@ -28,7 +28,7 @@ config VGA_CONSOLE | |||
28 | 28 | ||
29 | config VIDEO_SELECT | 29 | config VIDEO_SELECT |
30 | bool "Video mode selection support" | 30 | bool "Video mode selection support" |
31 | depends on (X86 || X86_64) && VGA_CONSOLE | 31 | depends on X86 && VGA_CONSOLE |
32 | ---help--- | 32 | ---help--- |
33 | This enables support for text mode selection on kernel startup. If | 33 | This enables support for text mode selection on kernel startup. If |
34 | you want to take advantage of some high-resolution text mode your | 34 | you want to take advantage of some high-resolution text mode your |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 809fee2140ac..56cd199605f4 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -579,6 +579,7 @@ static void vga_set_palette(struct vc_data *vc, unsigned char *table) | |||
579 | { | 579 | { |
580 | int i, j; | 580 | int i, j; |
581 | 581 | ||
582 | vga_w(state.vgabase, VGA_PEL_MSK, 0xff); | ||
582 | for (i = j = 0; i < 16; i++) { | 583 | for (i = j = 0; i < 16; i++) { |
583 | vga_w(state.vgabase, VGA_PEL_IW, table[i]); | 584 | vga_w(state.vgabase, VGA_PEL_IW, table[i]); |
584 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); | 585 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); |
@@ -721,6 +722,7 @@ static void vga_pal_blank(struct vgastate *state) | |||
721 | { | 722 | { |
722 | int i; | 723 | int i; |
723 | 724 | ||
725 | vga_w(state->vgabase, VGA_PEL_MSK, 0xff); | ||
724 | for (i = 0; i < 16; i++) { | 726 | for (i = 0; i < 16; i++) { |
725 | vga_w(state->vgabase, VGA_PEL_IW, i); | 727 | vga_w(state->vgabase, VGA_PEL_IW, i); |
726 | vga_w(state->vgabase, VGA_PEL_D, 0); | 728 | vga_w(state->vgabase, VGA_PEL_D, 0); |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 9073be4221a8..e2667ddab3f1 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -918,7 +918,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) | |||
918 | } | 918 | } |
919 | #endif | 919 | #endif |
920 | #elif defined(__powerpc__) | 920 | #elif defined(__powerpc__) |
921 | vma->vm_page_prot = phys_mem_access_prot(file, off, | 921 | vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT, |
922 | vma->vm_end - vma->vm_start, | 922 | vma->vm_end - vma->vm_start, |
923 | vma->vm_page_prot); | 923 | vma->vm_page_prot); |
924 | #elif defined(__alpha__) | 924 | #elif defined(__alpha__) |
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c index 88c517a4c178..9e293e139a0e 100644 --- a/drivers/w1/w1_family.c +++ b/drivers/w1/w1_family.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/sched.h> /* schedule_timeout() */ | ||
24 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
25 | 26 | ||
26 | #include "w1_family.h" | 27 | #include "w1_family.h" |
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index 04ca8840acf1..87c29d7b6c17 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/zorro.h> | 15 | #include <linux/zorro.h> |
16 | #include <linux/stat.h> | 16 | #include <linux/stat.h> |
17 | #include <linux/string.h> | ||
17 | 18 | ||
18 | #include "zorro.h" | 19 | #include "zorro.h" |
19 | 20 | ||
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c index d3c05dfe20d2..0f2b40605b06 100644 --- a/drivers/zorro/zorro.c +++ b/drivers/zorro/zorro.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/zorro.h> | 17 | #include <linux/zorro.h> |
18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
19 | #include <linux/string.h> | ||
20 | |||
19 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
20 | #include <asm/amigahw.h> | 22 | #include <asm/amigahw.h> |
21 | 23 | ||