aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig12
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/dell-laptop.c436
-rw-r--r--drivers/misc/ibmasm/event.c2
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c2
-rw-r--r--drivers/misc/ibmasm/module.c3
-rw-r--r--drivers/misc/ioc4.c36
-rw-r--r--drivers/misc/phantom.c2
-rw-r--r--drivers/misc/sgi-gru/grumain.c2
-rw-r--r--drivers/misc/sgi-xp/xp_main.c2
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c8
-rw-r--r--drivers/misc/sgi-xp/xpnet.c70
-rw-r--r--drivers/misc/tifm_7xx1.c5
-rw-r--r--drivers/misc/tifm_core.c7
14 files changed, 520 insertions, 68 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index fee7304102af..3949a1c73451 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -498,6 +498,18 @@ config SGI_GRU_DEBUG
498 This option enables addition debugging code for the SGI GRU driver. If 498 This option enables addition debugging code for the SGI GRU driver. If
499 you are unsure, say N. 499 you are unsure, say N.
500 500
501config DELL_LAPTOP
502 tristate "Dell Laptop Extras (EXPERIMENTAL)"
503 depends on X86
504 depends on DCDBAS
505 depends on EXPERIMENTAL
506 depends on BACKLIGHT_CLASS_DEVICE
507 depends on RFKILL
508 default n
509 ---help---
510 This driver adds support for rfkill and backlight control to Dell
511 laptops.
512
501source "drivers/misc/c2port/Kconfig" 513source "drivers/misc/c2port/Kconfig"
502 514
503endif # MISC_DEVICES 515endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 817f7f5ab3bd..5de863a0e395 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_ICS932S401) += ics932s401.o
18obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o 18obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
19obj-$(CONFIG_LKDTM) += lkdtm.o 19obj-$(CONFIG_LKDTM) += lkdtm.o
20obj-$(CONFIG_TIFM_CORE) += tifm_core.o 20obj-$(CONFIG_TIFM_CORE) += tifm_core.o
21obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
21obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o 22obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
22obj-$(CONFIG_PHANTOM) += phantom.o 23obj-$(CONFIG_PHANTOM) += phantom.o
23obj-$(CONFIG_SGI_IOC4) += ioc4.o 24obj-$(CONFIG_SGI_IOC4) += ioc4.o
diff --git a/drivers/misc/dell-laptop.c b/drivers/misc/dell-laptop.c
new file mode 100644
index 000000000000..4d33a2068b7a
--- /dev/null
+++ b/drivers/misc/dell-laptop.c
@@ -0,0 +1,436 @@
1/*
2 * Driver for Dell laptop extras
3 *
4 * Copyright (c) Red Hat <mjg@redhat.com>
5 *
6 * Based on documentation in the libsmbios package, Copyright (C) 2005 Dell
7 * Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/backlight.h>
19#include <linux/err.h>
20#include <linux/dmi.h>
21#include <linux/io.h>
22#include <linux/rfkill.h>
23#include <linux/power_supply.h>
24#include <linux/acpi.h>
25#include "../firmware/dcdbas.h"
26
27#define BRIGHTNESS_TOKEN 0x7d
28
29/* This structure will be modified by the firmware when we enter
30 * system management mode, hence the volatiles */
31
32struct calling_interface_buffer {
33 u16 class;
34 u16 select;
35 volatile u32 input[4];
36 volatile u32 output[4];
37} __packed;
38
39struct calling_interface_token {
40 u16 tokenID;
41 u16 location;
42 union {
43 u16 value;
44 u16 stringlength;
45 };
46};
47
48struct calling_interface_structure {
49 struct dmi_header header;
50 u16 cmdIOAddress;
51 u8 cmdIOCode;
52 u32 supportedCmds;
53 struct calling_interface_token tokens[];
54} __packed;
55
56static int da_command_address;
57static int da_command_code;
58static int da_num_tokens;
59static struct calling_interface_token *da_tokens;
60
61static struct backlight_device *dell_backlight_device;
62static struct rfkill *wifi_rfkill;
63static struct rfkill *bluetooth_rfkill;
64static struct rfkill *wwan_rfkill;
65
66static const struct dmi_system_id __initdata dell_device_table[] = {
67 {
68 .ident = "Dell laptop",
69 .matches = {
70 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
71 DMI_MATCH(DMI_CHASSIS_TYPE, "8"),
72 },
73 },
74 { }
75};
76
77static void parse_da_table(const struct dmi_header *dm)
78{
79 /* Final token is a terminator, so we don't want to copy it */
80 int tokens = (dm->length-11)/sizeof(struct calling_interface_token)-1;
81 struct calling_interface_structure *table =
82 container_of(dm, struct calling_interface_structure, header);
83
84 /* 4 bytes of table header, plus 7 bytes of Dell header, plus at least
85 6 bytes of entry */
86
87 if (dm->length < 17)
88 return;
89
90 da_command_address = table->cmdIOAddress;
91 da_command_code = table->cmdIOCode;
92
93 da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
94 sizeof(struct calling_interface_token),
95 GFP_KERNEL);
96
97 if (!da_tokens)
98 return;
99
100 memcpy(da_tokens+da_num_tokens, table->tokens,
101 sizeof(struct calling_interface_token) * tokens);
102
103 da_num_tokens += tokens;
104}
105
106static void find_tokens(const struct dmi_header *dm)
107{
108 switch (dm->type) {
109 case 0xd4: /* Indexed IO */
110 break;
111 case 0xd5: /* Protected Area Type 1 */
112 break;
113 case 0xd6: /* Protected Area Type 2 */
114 break;
115 case 0xda: /* Calling interface */
116 parse_da_table(dm);
117 break;
118 }
119}
120
121static int find_token_location(int tokenid)
122{
123 int i;
124 for (i = 0; i < da_num_tokens; i++) {
125 if (da_tokens[i].tokenID == tokenid)
126 return da_tokens[i].location;
127 }
128
129 return -1;
130}
131
132static struct calling_interface_buffer *
133dell_send_request(struct calling_interface_buffer *buffer, int class,
134 int select)
135{
136 struct smi_cmd command;
137
138 command.magic = SMI_CMD_MAGIC;
139 command.command_address = da_command_address;
140 command.command_code = da_command_code;
141 command.ebx = virt_to_phys(buffer);
142 command.ecx = 0x42534931;
143
144 buffer->class = class;
145 buffer->select = select;
146
147 dcdbas_smi_request(&command);
148
149 return buffer;
150}
151
152/* Derived from information in DellWirelessCtl.cpp:
153 Class 17, select 11 is radio control. It returns an array of 32-bit values.
154
155 result[0]: return code
156 result[1]:
157 Bit 0: Hardware switch supported
158 Bit 1: Wifi locator supported
159 Bit 2: Wifi is supported
160 Bit 3: Bluetooth is supported
161 Bit 4: WWAN is supported
162 Bit 5: Wireless keyboard supported
163 Bits 6-7: Reserved
164 Bit 8: Wifi is installed
165 Bit 9: Bluetooth is installed
166 Bit 10: WWAN is installed
167 Bits 11-15: Reserved
168 Bit 16: Hardware switch is on
169 Bit 17: Wifi is blocked
170 Bit 18: Bluetooth is blocked
171 Bit 19: WWAN is blocked
172 Bits 20-31: Reserved
173 result[2]: NVRAM size in bytes
174 result[3]: NVRAM format version number
175*/
176
177static int dell_rfkill_set(int radio, enum rfkill_state state)
178{
179 struct calling_interface_buffer buffer;
180 int disable = (state == RFKILL_STATE_UNBLOCKED) ? 0 : 1;
181
182 memset(&buffer, 0, sizeof(struct calling_interface_buffer));
183 buffer.input[0] = (1 | (radio<<8) | (disable << 16));
184 dell_send_request(&buffer, 17, 11);
185
186 return 0;
187}
188
189static int dell_wifi_set(void *data, enum rfkill_state state)
190{
191 return dell_rfkill_set(1, state);
192}
193
194static int dell_bluetooth_set(void *data, enum rfkill_state state)
195{
196 return dell_rfkill_set(2, state);
197}
198
199static int dell_wwan_set(void *data, enum rfkill_state state)
200{
201 return dell_rfkill_set(3, state);
202}
203
204static int dell_rfkill_get(int bit, enum rfkill_state *state)
205{
206 struct calling_interface_buffer buffer;
207 int status;
208 int new_state = RFKILL_STATE_HARD_BLOCKED;
209
210 memset(&buffer, 0, sizeof(struct calling_interface_buffer));
211 dell_send_request(&buffer, 17, 11);
212 status = buffer.output[1];
213
214 if (status & (1<<16))
215 new_state = RFKILL_STATE_SOFT_BLOCKED;
216
217 if (status & (1<<bit))
218 *state = new_state;
219 else
220 *state = RFKILL_STATE_UNBLOCKED;
221
222 return 0;
223}
224
225static int dell_wifi_get(void *data, enum rfkill_state *state)
226{
227 return dell_rfkill_get(17, state);
228}
229
230static int dell_bluetooth_get(void *data, enum rfkill_state *state)
231{
232 return dell_rfkill_get(18, state);
233}
234
235static int dell_wwan_get(void *data, enum rfkill_state *state)
236{
237 return dell_rfkill_get(19, state);
238}
239
240static int dell_setup_rfkill(void)
241{
242 struct calling_interface_buffer buffer;
243 int status;
244 int ret;
245
246 memset(&buffer, 0, sizeof(struct calling_interface_buffer));
247 dell_send_request(&buffer, 17, 11);
248 status = buffer.output[1];
249
250 if ((status & (1<<2|1<<8)) == (1<<2|1<<8)) {
251 wifi_rfkill = rfkill_allocate(NULL, RFKILL_TYPE_WLAN);
252 if (!wifi_rfkill)
253 goto err_wifi;
254 wifi_rfkill->name = "dell-wifi";
255 wifi_rfkill->toggle_radio = dell_wifi_set;
256 wifi_rfkill->get_state = dell_wifi_get;
257 ret = rfkill_register(wifi_rfkill);
258 if (ret)
259 goto err_wifi;
260 }
261
262 if ((status & (1<<3|1<<9)) == (1<<3|1<<9)) {
263 bluetooth_rfkill = rfkill_allocate(NULL, RFKILL_TYPE_BLUETOOTH);
264 if (!bluetooth_rfkill)
265 goto err_bluetooth;
266 bluetooth_rfkill->name = "dell-bluetooth";
267 bluetooth_rfkill->toggle_radio = dell_bluetooth_set;
268 bluetooth_rfkill->get_state = dell_bluetooth_get;
269 ret = rfkill_register(bluetooth_rfkill);
270 if (ret)
271 goto err_bluetooth;
272 }
273
274 if ((status & (1<<4|1<<10)) == (1<<4|1<<10)) {
275 wwan_rfkill = rfkill_allocate(NULL, RFKILL_TYPE_WWAN);
276 if (!wwan_rfkill)
277 goto err_wwan;
278 wwan_rfkill->name = "dell-wwan";
279 wwan_rfkill->toggle_radio = dell_wwan_set;
280 wwan_rfkill->get_state = dell_wwan_get;
281 ret = rfkill_register(wwan_rfkill);
282 if (ret)
283 goto err_wwan;
284 }
285
286 return 0;
287err_wwan:
288 if (wwan_rfkill)
289 rfkill_free(wwan_rfkill);
290 if (bluetooth_rfkill) {
291 rfkill_unregister(bluetooth_rfkill);
292 bluetooth_rfkill = NULL;
293 }
294err_bluetooth:
295 if (bluetooth_rfkill)
296 rfkill_free(bluetooth_rfkill);
297 if (wifi_rfkill) {
298 rfkill_unregister(wifi_rfkill);
299 wifi_rfkill = NULL;
300 }
301err_wifi:
302 if (wifi_rfkill)
303 rfkill_free(wifi_rfkill);
304
305 return ret;
306}
307
308static int dell_send_intensity(struct backlight_device *bd)
309{
310 struct calling_interface_buffer buffer;
311
312 memset(&buffer, 0, sizeof(struct calling_interface_buffer));
313 buffer.input[0] = find_token_location(BRIGHTNESS_TOKEN);
314 buffer.input[1] = bd->props.brightness;
315
316 if (buffer.input[0] == -1)
317 return -ENODEV;
318
319 if (power_supply_is_system_supplied() > 0)
320 dell_send_request(&buffer, 1, 2);
321 else
322 dell_send_request(&buffer, 1, 1);
323
324 return 0;
325}
326
327static int dell_get_intensity(struct backlight_device *bd)
328{
329 struct calling_interface_buffer buffer;
330
331 memset(&buffer, 0, sizeof(struct calling_interface_buffer));
332 buffer.input[0] = find_token_location(BRIGHTNESS_TOKEN);
333
334 if (buffer.input[0] == -1)
335 return -ENODEV;
336
337 if (power_supply_is_system_supplied() > 0)
338 dell_send_request(&buffer, 0, 2);
339 else
340 dell_send_request(&buffer, 0, 1);
341
342 return buffer.output[1];
343}
344
345static struct backlight_ops dell_ops = {
346 .get_brightness = dell_get_intensity,
347 .update_status = dell_send_intensity,
348};
349
350static int __init dell_init(void)
351{
352 struct calling_interface_buffer buffer;
353 int max_intensity = 0;
354 int ret;
355
356 if (!dmi_check_system(dell_device_table))
357 return -ENODEV;
358
359 dmi_walk(find_tokens);
360
361 if (!da_tokens) {
362 printk(KERN_INFO "dell-laptop: Unable to find dmi tokens\n");
363 return -ENODEV;
364 }
365
366 ret = dell_setup_rfkill();
367
368 if (ret) {
369 printk(KERN_WARNING "dell-laptop: Unable to setup rfkill\n");
370 goto out;
371 }
372
373#ifdef CONFIG_ACPI
374 /* In the event of an ACPI backlight being available, don't
375 * register the platform controller.
376 */
377 if (acpi_video_backlight_support())
378 return 0;
379#endif
380
381 memset(&buffer, 0, sizeof(struct calling_interface_buffer));
382 buffer.input[0] = find_token_location(BRIGHTNESS_TOKEN);
383
384 if (buffer.input[0] != -1) {
385 dell_send_request(&buffer, 0, 2);
386 max_intensity = buffer.output[3];
387 }
388
389 if (max_intensity) {
390 dell_backlight_device = backlight_device_register(
391 "dell_backlight",
392 NULL, NULL,
393 &dell_ops);
394
395 if (IS_ERR(dell_backlight_device)) {
396 ret = PTR_ERR(dell_backlight_device);
397 dell_backlight_device = NULL;
398 goto out;
399 }
400
401 dell_backlight_device->props.max_brightness = max_intensity;
402 dell_backlight_device->props.brightness =
403 dell_get_intensity(dell_backlight_device);
404 backlight_update_status(dell_backlight_device);
405 }
406
407 return 0;
408out:
409 if (wifi_rfkill)
410 rfkill_unregister(wifi_rfkill);
411 if (bluetooth_rfkill)
412 rfkill_unregister(bluetooth_rfkill);
413 if (wwan_rfkill)
414 rfkill_unregister(wwan_rfkill);
415 kfree(da_tokens);
416 return ret;
417}
418
419static void __exit dell_exit(void)
420{
421 backlight_device_unregister(dell_backlight_device);
422 if (wifi_rfkill)
423 rfkill_unregister(wifi_rfkill);
424 if (bluetooth_rfkill)
425 rfkill_unregister(bluetooth_rfkill);
426 if (wwan_rfkill)
427 rfkill_unregister(wwan_rfkill);
428}
429
430module_init(dell_init);
431module_exit(dell_exit);
432
433MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
434MODULE_DESCRIPTION("Dell laptop driver");
435MODULE_LICENSE("GPL");
436MODULE_ALIAS("dmi:*svnDellInc.:*:ct8:*");
diff --git a/drivers/misc/ibmasm/event.c b/drivers/misc/ibmasm/event.c
index fda6a4d3bf23..68a0a5b94795 100644
--- a/drivers/misc/ibmasm/event.c
+++ b/drivers/misc/ibmasm/event.c
@@ -50,7 +50,7 @@ static void wake_up_event_readers(struct service_processor *sp)
50 * Store the event in the circular event buffer, wake up any sleeping 50 * Store the event in the circular event buffer, wake up any sleeping
51 * event readers. 51 * event readers.
52 * There is no reader marker in the buffer, therefore readers are 52 * There is no reader marker in the buffer, therefore readers are
53 * responsible for keeping up with the writer, or they will loose events. 53 * responsible for keeping up with the writer, or they will lose events.
54 */ 54 */
55void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size) 55void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size)
56{ 56{
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 22a7e8ba211d..de966a6fb7e6 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -146,8 +146,6 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
146 146
147 if (ret) { 147 if (ret) {
148 ret->i_mode = mode; 148 ret->i_mode = mode;
149 ret->i_uid = ret->i_gid = 0;
150 ret->i_blocks = 0;
151 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 149 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
152 } 150 }
153 return ret; 151 return ret;
diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index b5f6add34b0b..dc14b0b9cbfa 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -104,8 +104,7 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi
104 } 104 }
105 105
106 sp->irq = pdev->irq; 106 sp->irq = pdev->irq;
107 sp->base_address = ioremap(pci_resource_start(pdev, 0), 107 sp->base_address = pci_ioremap_bar(pdev, 0);
108 pci_resource_len(pdev, 0));
109 if (!sp->base_address) { 108 if (!sp->base_address) {
110 dev_err(sp->dev, "Failed to ioremap pci memory\n"); 109 dev_err(sp->dev, "Failed to ioremap pci memory\n");
111 result = -ENODEV; 110 result = -ENODEV;
diff --git a/drivers/misc/ioc4.c b/drivers/misc/ioc4.c
index 6f76573e7c8a..60b0b1a4fb3a 100644
--- a/drivers/misc/ioc4.c
+++ b/drivers/misc/ioc4.c
@@ -269,6 +269,16 @@ ioc4_variant(struct ioc4_driver_data *idd)
269 return IOC4_VARIANT_PCI_RT; 269 return IOC4_VARIANT_PCI_RT;
270} 270}
271 271
272static void
273ioc4_load_modules(struct work_struct *work)
274{
275 /* arg just has to be freed */
276
277 request_module("sgiioc4");
278
279 kfree(work);
280}
281
272/* Adds a new instance of an IOC4 card */ 282/* Adds a new instance of an IOC4 card */
273static int 283static int
274ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) 284ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
@@ -378,6 +388,30 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
378 } 388 }
379 mutex_unlock(&ioc4_mutex); 389 mutex_unlock(&ioc4_mutex);
380 390
391 /* Request sgiioc4 IDE driver on boards that bring that functionality
392 * off of IOC4. The root filesystem may be hosted on a drive connected
393 * to IOC4, so we need to make sure the sgiioc4 driver is loaded as it
394 * won't be picked up by modprobes due to the ioc4 module owning the
395 * PCI device.
396 */
397 if (idd->idd_variant != IOC4_VARIANT_PCI_RT) {
398 struct work_struct *work;
399 work = kzalloc(sizeof(struct work_struct), GFP_KERNEL);
400 if (!work) {
401 printk(KERN_WARNING
402 "%s: IOC4 unable to allocate memory for "
403 "load of sub-modules.\n", __func__);
404 } else {
405 /* Request the module from a work procedure as the
406 * modprobe goes out to a userland helper and that
407 * will hang if done directly from ioc4_probe().
408 */
409 printk(KERN_INFO "IOC4 loading sgiioc4 submodule\n");
410 INIT_WORK(work, ioc4_load_modules);
411 schedule_work(work);
412 }
413 }
414
381 return 0; 415 return 0;
382 416
383out_misc_region: 417out_misc_region:
@@ -462,6 +496,8 @@ ioc4_init(void)
462static void __devexit 496static void __devexit
463ioc4_exit(void) 497ioc4_exit(void)
464{ 498{
499 /* Ensure ioc4_load_modules() has completed before exiting */
500 flush_scheduled_work();
465 pci_unregister_driver(&ioc4_driver); 501 pci_unregister_driver(&ioc4_driver);
466} 502}
467 503
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index abdebe347383..fa57b67593ae 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -6,7 +6,7 @@
6 * the Free Software Foundation; either version 2 of the License, or 6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * You need an userspace library to cooperate with this driver. It (and other 9 * You need a userspace library to cooperate with this driver. It (and other
10 * info) may be obtained here: 10 * info) may be obtained here:
11 * http://www.fi.muni.cz/~xslaby/phantom.html 11 * http://www.fi.muni.cz/~xslaby/phantom.html
12 * or alternatively, you might use OpenHaptics provided by Sensable. 12 * or alternatively, you might use OpenHaptics provided by Sensable.
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index e11e1ac50900..3d2fc216bae5 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -29,7 +29,7 @@ static struct device_driver gru_driver = {
29}; 29};
30 30
31static struct device gru_device = { 31static struct device gru_device = {
32 .bus_id = {0}, 32 .init_name = "",
33 .driver = &gru_driver, 33 .driver = &gru_driver,
34}; 34};
35 35
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c
index 9a2e77172d94..16f8dcab2da4 100644
--- a/drivers/misc/sgi-xp/xp_main.c
+++ b/drivers/misc/sgi-xp/xp_main.c
@@ -25,7 +25,7 @@ struct device_driver xp_dbg_name = {
25}; 25};
26 26
27struct device xp_dbg_subname = { 27struct device xp_dbg_subname = {
28 .bus_id = {0}, /* set to "" */ 28 .init_name = "", /* set to "" */
29 .driver = &xp_dbg_name 29 .driver = &xp_dbg_name
30}; 30};
31 31
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index e8d5cfbd32c2..89218f7cfaa7 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -59,12 +59,12 @@ struct device_driver xpc_dbg_name = {
59}; 59};
60 60
61struct device xpc_part_dbg_subname = { 61struct device xpc_part_dbg_subname = {
62 .bus_id = {0}, /* set to "part" at xpc_init() time */ 62 .init_name = "", /* set to "part" at xpc_init() time */
63 .driver = &xpc_dbg_name 63 .driver = &xpc_dbg_name
64}; 64};
65 65
66struct device xpc_chan_dbg_subname = { 66struct device xpc_chan_dbg_subname = {
67 .bus_id = {0}, /* set to "chan" at xpc_init() time */ 67 .init_name = "", /* set to "chan" at xpc_init() time */
68 .driver = &xpc_dbg_name 68 .driver = &xpc_dbg_name
69}; 69};
70 70
@@ -1258,8 +1258,8 @@ xpc_init(void)
1258 int ret; 1258 int ret;
1259 struct task_struct *kthread; 1259 struct task_struct *kthread;
1260 1260
1261 snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part"); 1261 dev_set_name(xpc_part, "part");
1262 snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan"); 1262 dev_set_name(xpc_chan, "chan");
1263 1263
1264 if (is_shub()) { 1264 if (is_shub()) {
1265 /* 1265 /*
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 8e6aa9508f46..7957f525b2f4 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -95,11 +95,6 @@ struct xpnet_pending_msg {
95 atomic_t use_count; 95 atomic_t use_count;
96}; 96};
97 97
98/* driver specific structure pointed to by the device structure */
99struct xpnet_dev_private {
100 struct net_device_stats stats;
101};
102
103struct net_device *xpnet_device; 98struct net_device *xpnet_device;
104 99
105/* 100/*
@@ -138,7 +133,7 @@ struct device_driver xpnet_dbg_name = {
138}; 133};
139 134
140struct device xpnet_dbg_subname = { 135struct device xpnet_dbg_subname = {
141 .bus_id = {0}, /* set to "" */ 136 .init_name = "", /* set to "" */
142 .driver = &xpnet_dbg_name 137 .driver = &xpnet_dbg_name
143}; 138};
144 139
@@ -153,7 +148,6 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
153 struct sk_buff *skb; 148 struct sk_buff *skb;
154 void *dst; 149 void *dst;
155 enum xp_retval ret; 150 enum xp_retval ret;
156 struct xpnet_dev_private *priv = netdev_priv(xpnet_device);
157 151
158 if (!XPNET_VALID_MSG(msg)) { 152 if (!XPNET_VALID_MSG(msg)) {
159 /* 153 /*
@@ -161,7 +155,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
161 */ 155 */
162 xpc_received(partid, channel, (void *)msg); 156 xpc_received(partid, channel, (void *)msg);
163 157
164 priv->stats.rx_errors++; 158 xpnet_device->stats.rx_errors++;
165 159
166 return; 160 return;
167 } 161 }
@@ -176,7 +170,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
176 170
177 xpc_received(partid, channel, (void *)msg); 171 xpc_received(partid, channel, (void *)msg);
178 172
179 priv->stats.rx_errors++; 173 xpnet_device->stats.rx_errors++;
180 174
181 return; 175 return;
182 } 176 }
@@ -226,7 +220,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
226 220
227 xpc_received(partid, channel, (void *)msg); 221 xpc_received(partid, channel, (void *)msg);
228 222
229 priv->stats.rx_errors++; 223 xpnet_device->stats.rx_errors++;
230 224
231 return; 225 return;
232 } 226 }
@@ -247,8 +241,8 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
247 skb_end_pointer(skb), skb->len); 241 skb_end_pointer(skb), skb->len);
248 242
249 xpnet_device->last_rx = jiffies; 243 xpnet_device->last_rx = jiffies;
250 priv->stats.rx_packets++; 244 xpnet_device->stats.rx_packets++;
251 priv->stats.rx_bytes += skb->len + ETH_HLEN; 245 xpnet_device->stats.rx_bytes += skb->len + ETH_HLEN;
252 246
253 netif_rx_ni(skb); 247 netif_rx_ni(skb);
254 xpc_received(partid, channel, (void *)msg); 248 xpc_received(partid, channel, (void *)msg);
@@ -353,26 +347,6 @@ xpnet_dev_change_mtu(struct net_device *dev, int new_mtu)
353} 347}
354 348
355/* 349/*
356 * Required for the net_device structure.
357 */
358static int
359xpnet_dev_set_config(struct net_device *dev, struct ifmap *new_map)
360{
361 return 0;
362}
363
364/*
365 * Return statistics to the caller.
366 */
367static struct net_device_stats *
368xpnet_dev_get_stats(struct net_device *dev)
369{
370 struct xpnet_dev_private *priv = netdev_priv(dev);
371
372 return &priv->stats;
373}
374
375/*
376 * Notification that the other end has received the message and 350 * Notification that the other end has received the message and
377 * DMA'd the skb information. At this point, they are done with 351 * DMA'd the skb information. At this point, they are done with
378 * our side. When all recipients are done processing, we 352 * our side. When all recipients are done processing, we
@@ -453,7 +427,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
453 struct xpnet_pending_msg *queued_msg; 427 struct xpnet_pending_msg *queued_msg;
454 u64 start_addr, end_addr; 428 u64 start_addr, end_addr;
455 short dest_partid; 429 short dest_partid;
456 struct xpnet_dev_private *priv = netdev_priv(dev);
457 u16 embedded_bytes = 0; 430 u16 embedded_bytes = 0;
458 431
459 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " 432 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
@@ -476,7 +449,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
476 dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping " 449 dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping "
477 "packet\n", sizeof(struct xpnet_pending_msg)); 450 "packet\n", sizeof(struct xpnet_pending_msg));
478 451
479 priv->stats.tx_errors++; 452 dev->stats.tx_errors++;
480 return -ENOMEM; 453 return -ENOMEM;
481 } 454 }
482 455
@@ -526,8 +499,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
526 kfree(queued_msg); 499 kfree(queued_msg);
527 } 500 }
528 501
529 priv->stats.tx_packets++; 502 dev->stats.tx_packets++;
530 priv->stats.tx_bytes += skb->len; 503 dev->stats.tx_bytes += skb->len;
531 504
532 return 0; 505 return 0;
533} 506}
@@ -538,12 +511,19 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
538static void 511static void
539xpnet_dev_tx_timeout(struct net_device *dev) 512xpnet_dev_tx_timeout(struct net_device *dev)
540{ 513{
541 struct xpnet_dev_private *priv = netdev_priv(dev); 514 dev->stats.tx_errors++;
542
543 priv->stats.tx_errors++;
544 return;
545} 515}
546 516
517static const struct net_device_ops xpnet_netdev_ops = {
518 .ndo_open = xpnet_dev_open,
519 .ndo_stop = xpnet_dev_stop,
520 .ndo_start_xmit = xpnet_dev_hard_start_xmit,
521 .ndo_change_mtu = xpnet_dev_change_mtu,
522 .ndo_tx_timeout = xpnet_dev_tx_timeout,
523 .ndo_set_mac_address = eth_mac_addr,
524 .ndo_validate_addr = eth_validate_addr,
525};
526
547static int __init 527static int __init
548xpnet_init(void) 528xpnet_init(void)
549{ 529{
@@ -563,8 +543,7 @@ xpnet_init(void)
563 * use ether_setup() to init the majority of our device 543 * use ether_setup() to init the majority of our device
564 * structure and then override the necessary pieces. 544 * structure and then override the necessary pieces.
565 */ 545 */
566 xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private), 546 xpnet_device = alloc_netdev(0, XPNET_DEVICE_NAME, ether_setup);
567 XPNET_DEVICE_NAME, ether_setup);
568 if (xpnet_device == NULL) { 547 if (xpnet_device == NULL) {
569 kfree(xpnet_broadcast_partitions); 548 kfree(xpnet_broadcast_partitions);
570 return -ENOMEM; 549 return -ENOMEM;
@@ -573,13 +552,6 @@ xpnet_init(void)
573 netif_carrier_off(xpnet_device); 552 netif_carrier_off(xpnet_device);
574 553
575 xpnet_device->mtu = XPNET_DEF_MTU; 554 xpnet_device->mtu = XPNET_DEF_MTU;
576 xpnet_device->change_mtu = xpnet_dev_change_mtu;
577 xpnet_device->open = xpnet_dev_open;
578 xpnet_device->get_stats = xpnet_dev_get_stats;
579 xpnet_device->stop = xpnet_dev_stop;
580 xpnet_device->hard_start_xmit = xpnet_dev_hard_start_xmit;
581 xpnet_device->tx_timeout = xpnet_dev_tx_timeout;
582 xpnet_device->set_config = xpnet_dev_set_config;
583 555
584 /* 556 /*
585 * Multicast assumes the LSB of the first octet is set for multicast 557 * Multicast assumes the LSB of the first octet is set for multicast
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index 67503ea71d21..be5672a98702 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -164,7 +164,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
164 if (sock) { 164 if (sock) {
165 printk(KERN_INFO 165 printk(KERN_INFO
166 "%s : demand removing card from socket %u:%u\n", 166 "%s : demand removing card from socket %u:%u\n",
167 fm->dev.bus_id, fm->id, cnt); 167 dev_name(&fm->dev), fm->id, cnt);
168 fm->sockets[cnt] = NULL; 168 fm->sockets[cnt] = NULL;
169 sock_addr = sock->addr; 169 sock_addr = sock->addr;
170 spin_unlock_irqrestore(&fm->lock, flags); 170 spin_unlock_irqrestore(&fm->lock, flags);
@@ -354,8 +354,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
354 fm->has_ms_pif = tifm_7xx1_has_ms_pif; 354 fm->has_ms_pif = tifm_7xx1_has_ms_pif;
355 pci_set_drvdata(dev, fm); 355 pci_set_drvdata(dev, fm);
356 356
357 fm->addr = ioremap(pci_resource_start(dev, 0), 357 fm->addr = pci_ioremap_bar(dev, 0);
358 pci_resource_len(dev, 0));
359 if (!fm->addr) 358 if (!fm->addr)
360 goto err_out_free; 359 goto err_out_free;
361 360
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 82dc72a1484f..98bcba521da2 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -203,7 +203,7 @@ int tifm_add_adapter(struct tifm_adapter *fm)
203 if (rc) 203 if (rc)
204 return rc; 204 return rc;
205 205
206 snprintf(fm->dev.bus_id, BUS_ID_SIZE, "tifm%u", fm->id); 206 dev_set_name(&fm->dev, "tifm%u", fm->id);
207 rc = device_add(&fm->dev); 207 rc = device_add(&fm->dev);
208 if (rc) { 208 if (rc) {
209 spin_lock(&tifm_adapter_lock); 209 spin_lock(&tifm_adapter_lock);
@@ -266,9 +266,8 @@ struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id,
266 sock->dev.dma_mask = fm->dev.parent->dma_mask; 266 sock->dev.dma_mask = fm->dev.parent->dma_mask;
267 sock->dev.release = tifm_free_device; 267 sock->dev.release = tifm_free_device;
268 268
269 snprintf(sock->dev.bus_id, BUS_ID_SIZE, 269 dev_set_name(&sock->dev, "tifm_%s%u:%u",
270 "tifm_%s%u:%u", tifm_media_type_name(type, 2), 270 tifm_media_type_name(type, 2), fm->id, id);
271 fm->id, id);
272 printk(KERN_INFO DRIVER_NAME 271 printk(KERN_INFO DRIVER_NAME
273 ": %s card detected in socket %u:%u\n", 272 ": %s card detected in socket %u:%u\n",
274 tifm_media_type_name(type, 0), fm->id, id); 273 tifm_media_type_name(type, 0), fm->id, id);