aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-08-04 20:26:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-04 20:26:15 -0400
commit2e1e9212ed8c532c6b324de77d3cafef5d2bc846 (patch)
tree15097a99d03679f2c95ea2fdc0eb3c3ebcc474b8 /drivers
parent2acb802b0c5485aedb46e23b2b45e49573454c09 (diff)
parentf5663f5bded3364158e2d31904173cb1debc2ecd (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (29 commits) sh: enable maple_keyb in dreamcast_defconfig. SH2(A) cache update nommu: Provide vmalloc_exec(). add addrespace definition for sh2a. sh: Kill off ARCH_SUPPORTS_AOUT and remnants of a.out support. sh: define GENERIC_HARDIRQS_NO__DO_IRQ. sh: define GENERIC_LOCKBREAK. sh: Save NUMA node data in vmcore for crash dumps. sh: module_alloc() should be using vmalloc_exec(). sh: Fix up __bug_table handling in module loader. sh: Add documentation and integrate into docbook build. sh: Fix up broken kerneldoc comments. maple: Kill useless private_data pointer. maple: Clean up maple_driver_register/unregister routines. input: Clean up maple keyboard driver maple: allow removal and reinsertion of keyboard driver module sh: /proc/asids depends on MMU. arch/sh/boards/mach-se/7343/irq.c: removed duplicated #include arch/sh/boards/board-ap325rxa.c: removed duplicated #include sh/boards/Makefile typo fix ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/keyboard/maple_keyb.c172
-rw-r--r--drivers/net/stnic.c2
-rw-r--r--drivers/sh/maple/maple.c65
3 files changed, 129 insertions, 110 deletions
diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c
index 7797ef6e5e64..22f17a593be7 100644
--- a/drivers/input/keyboard/maple_keyb.c
+++ b/drivers/input/keyboard/maple_keyb.c
@@ -2,7 +2,7 @@
2 * SEGA Dreamcast keyboard driver 2 * SEGA Dreamcast keyboard driver
3 * Based on drivers/usb/usbkbd.c 3 * Based on drivers/usb/usbkbd.c
4 * Copyright YAEGASHI Takeshi, 2001 4 * Copyright YAEGASHI Takeshi, 2001
5 * Porting to 2.6 Copyright Adrian McMenamin, 2007 5 * Porting to 2.6 Copyright Adrian McMenamin, 2007, 2008
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -45,39 +45,51 @@ struct dc_kbd {
45}; 45};
46 46
47static const unsigned short dc_kbd_keycode[NR_SCANCODES] = { 47static const unsigned short dc_kbd_keycode[NR_SCANCODES] = {
48 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_A, KEY_B, KEY_C, KEY_D, 48 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_A, KEY_B,
49 KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, 49 KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L,
50 KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, 50 KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V,
51 KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_1, KEY_2, 51 KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
52 KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, 52 KEY_7, KEY_8, KEY_9, KEY_0, KEY_ENTER, KEY_ESC, KEY_BACKSPACE,
53 KEY_ENTER, KEY_ESC, KEY_BACKSPACE, KEY_TAB, KEY_SPACE, KEY_MINUS, KEY_EQUAL, KEY_LEFTBRACE, 53 KEY_TAB, KEY_SPACE, KEY_MINUS, KEY_EQUAL, KEY_LEFTBRACE,
54 KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, 54 KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON,
55 KEY_DOT, KEY_SLASH, KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, 55 KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT, KEY_SLASH,
56 KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6,
56 KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_SYSRQ, 57 KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_SYSRQ,
57 KEY_SCROLLLOCK, KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP, KEY_DELETE, 58 KEY_SCROLLLOCK, KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP,
58 KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP, 59 KEY_DELETE, KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN,
59 KEY_NUMLOCK, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS, KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2, 60 KEY_UP, KEY_NUMLOCK, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS,
60 KEY_KP3, KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KP0, KEY_KPDOT, 61 KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2, KEY_KP3, KEY_KP4, KEY_KP5,
61 KEY_102ND, KEY_COMPOSE, KEY_POWER, KEY_KPEQUAL, KEY_F13, KEY_F14, KEY_F15, 62 KEY_KP6, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KP0, KEY_KPDOT, KEY_102ND,
62 KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20, 63 KEY_COMPOSE, KEY_POWER, KEY_KPEQUAL, KEY_F13, KEY_F14, KEY_F15,
63 KEY_F21, KEY_F22, KEY_F23, KEY_F24, KEY_OPEN, KEY_HELP, KEY_PROPS, KEY_FRONT, 64 KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20, KEY_F21, KEY_F22,
64 KEY_STOP, KEY_AGAIN, KEY_UNDO, KEY_CUT, KEY_COPY, KEY_PASTE, KEY_FIND, KEY_MUTE, 65 KEY_F23, KEY_F24, KEY_OPEN, KEY_HELP, KEY_PROPS, KEY_FRONT, KEY_STOP,
65 KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_KPCOMMA, KEY_RESERVED, KEY_RO, KEY_KATAKANAHIRAGANA , KEY_YEN, 66 KEY_AGAIN, KEY_UNDO, KEY_CUT, KEY_COPY, KEY_PASTE, KEY_FIND, KEY_MUTE,
66 KEY_HENKAN, KEY_MUHENKAN, KEY_KPJPCOMMA, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 67 KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
67 KEY_HANGEUL, KEY_HANJA, KEY_KATAKANA, KEY_HIRAGANA, KEY_ZENKAKUHANKAKU, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 68 KEY_KPCOMMA, KEY_RESERVED, KEY_RO, KEY_KATAKANAHIRAGANA , KEY_YEN,
68 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 69 KEY_HENKAN, KEY_MUHENKAN, KEY_KPJPCOMMA, KEY_RESERVED, KEY_RESERVED,
69 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 70 KEY_RESERVED, KEY_HANGEUL, KEY_HANJA, KEY_KATAKANA, KEY_HIRAGANA,
70 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 71 KEY_ZENKAKUHANKAKU, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
71 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 72 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
72 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 73 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
73 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 74 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
74 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 75 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
75 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 76 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
76 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, 77 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
77 KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT, KEY_LEFTMETA, KEY_RIGHTCTRL, KEY_RIGHTSHIFT, KEY_RIGHTALT, KEY_RIGHTMETA, 78 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
78 KEY_PLAYPAUSE, KEY_STOPCD, KEY_PREVIOUSSONG, KEY_NEXTSONG, KEY_EJECTCD, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE, 79 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
79 KEY_WWW, KEY_BACK, KEY_FORWARD, KEY_STOP, KEY_FIND, KEY_SCROLLUP, KEY_SCROLLDOWN, KEY_EDIT, KEY_SLEEP, 80 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
80 KEY_SCREENLOCK, KEY_REFRESH, KEY_CALC, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED 81 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
82 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
83 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
84 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
85 KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
86 KEY_RESERVED, KEY_RESERVED, KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT,
87 KEY_LEFTMETA, KEY_RIGHTCTRL, KEY_RIGHTSHIFT, KEY_RIGHTALT,
88 KEY_RIGHTMETA, KEY_PLAYPAUSE, KEY_STOPCD, KEY_PREVIOUSSONG,
89 KEY_NEXTSONG, KEY_EJECTCD, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE,
90 KEY_WWW, KEY_BACK, KEY_FORWARD, KEY_STOP, KEY_FIND, KEY_SCROLLUP,
91 KEY_SCROLLDOWN, KEY_EDIT, KEY_SLEEP, KEY_SCREENLOCK, KEY_REFRESH,
92 KEY_CALC, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED
81}; 93};
82 94
83static void dc_scan_kbd(struct dc_kbd *kbd) 95static void dc_scan_kbd(struct dc_kbd *kbd)
@@ -127,12 +139,12 @@ static void dc_scan_kbd(struct dc_kbd *kbd)
127static void dc_kbd_callback(struct mapleq *mq) 139static void dc_kbd_callback(struct mapleq *mq)
128{ 140{
129 struct maple_device *mapledev = mq->dev; 141 struct maple_device *mapledev = mq->dev;
130 struct dc_kbd *kbd = mapledev->private_data; 142 struct dc_kbd *kbd = maple_get_drvdata(mapledev);
131 unsigned long *buf = mq->recvbuf; 143 unsigned long *buf = mq->recvbuf;
132 144
133 /* 145 /*
134 * We should always be getting the lock because the only 146 * We should always get the lock because the only
135 * time it may be locked if driver is in cleanup phase. 147 * time it may be locked is if the driver is in the cleanup phase.
136 */ 148 */
137 if (likely(mutex_trylock(&maple_keyb_mutex))) { 149 if (likely(mutex_trylock(&maple_keyb_mutex))) {
138 150
@@ -145,106 +157,96 @@ static void dc_kbd_callback(struct mapleq *mq)
145 } 157 }
146} 158}
147 159
148static int dc_kbd_connect(struct maple_device *mdev) 160static int probe_maple_kbd(struct device *dev)
149{ 161{
162 struct maple_device *mdev = to_maple_dev(dev);
163 struct maple_driver *mdrv = to_maple_driver(dev->driver);
150 int i, error; 164 int i, error;
151 struct dc_kbd *kbd; 165 struct dc_kbd *kbd;
152 struct input_dev *dev; 166 struct input_dev *idev;
153 167
154 if (!(mdev->function & MAPLE_FUNC_KEYBOARD)) 168 if (!(mdev->function & MAPLE_FUNC_KEYBOARD))
155 return -EINVAL; 169 return -EINVAL;
156 170
157 kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL); 171 kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
158 dev = input_allocate_device(); 172 idev = input_allocate_device();
159 if (!kbd || !dev) { 173 if (!kbd || !idev) {
160 error = -ENOMEM; 174 error = -ENOMEM;
161 goto fail; 175 goto fail;
162 } 176 }
163 177
164 mdev->private_data = kbd; 178 kbd->dev = idev;
165
166 kbd->dev = dev;
167 memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); 179 memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode));
168 180
169 dev->name = mdev->product_name; 181 idev->name = mdev->product_name;
170 dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 182 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
171 dev->keycode = kbd->keycode; 183 idev->keycode = kbd->keycode;
172 dev->keycodesize = sizeof (unsigned short); 184 idev->keycodesize = sizeof(unsigned short);
173 dev->keycodemax = ARRAY_SIZE(kbd->keycode); 185 idev->keycodemax = ARRAY_SIZE(kbd->keycode);
174 dev->id.bustype = BUS_HOST; 186 idev->id.bustype = BUS_HOST;
175 dev->dev.parent = &mdev->dev; 187 idev->dev.parent = &mdev->dev;
176 188
177 for (i = 0; i < NR_SCANCODES; i++) 189 for (i = 0; i < NR_SCANCODES; i++)
178 __set_bit(dc_kbd_keycode[i], dev->keybit); 190 __set_bit(dc_kbd_keycode[i], idev->keybit);
179 __clear_bit(KEY_RESERVED, dev->keybit); 191 __clear_bit(KEY_RESERVED, idev->keybit);
180 192
181 input_set_capability(dev, EV_MSC, MSC_SCAN); 193 input_set_capability(idev, EV_MSC, MSC_SCAN);
182 input_set_drvdata(dev, kbd); 194 input_set_drvdata(idev, kbd);
183 195
184 error = input_register_device(dev); 196 error = input_register_device(idev);
185 if (error) 197 if (error)
186 goto fail; 198 goto fail;
187 199
188 /* Maple polling is locked to VBLANK - which may be just 50/s */ 200 /* Maple polling is locked to VBLANK - which may be just 50/s */
189 maple_getcond_callback(mdev, dc_kbd_callback, HZ/50, MAPLE_FUNC_KEYBOARD); 201 maple_getcond_callback(mdev, dc_kbd_callback, HZ/50,
190 return 0; 202 MAPLE_FUNC_KEYBOARD);
191 203
192 fail: 204 mdev->driver = mdrv;
193 input_free_device(dev); 205
206 maple_set_drvdata(mdev, kbd);
207
208 return error;
209
210fail:
211 input_free_device(idev);
194 kfree(kbd); 212 kfree(kbd);
195 mdev->private_data = NULL; 213 maple_set_drvdata(mdev, NULL);
196 return error; 214 return error;
197} 215}
198 216
199static void dc_kbd_disconnect(struct maple_device *mdev) 217static int remove_maple_kbd(struct device *dev)
200{ 218{
201 struct dc_kbd *kbd; 219 struct maple_device *mdev = to_maple_dev(dev);
220 struct dc_kbd *kbd = maple_get_drvdata(mdev);
202 221
203 mutex_lock(&maple_keyb_mutex); 222 mutex_lock(&maple_keyb_mutex);
204 223
205 kbd = mdev->private_data;
206 mdev->private_data = NULL;
207 input_unregister_device(kbd->dev); 224 input_unregister_device(kbd->dev);
208 kfree(kbd); 225 kfree(kbd);
209 226
210 mutex_unlock(&maple_keyb_mutex); 227 maple_set_drvdata(mdev, NULL);
211}
212
213/* allow the keyboard to be used */
214static int probe_maple_kbd(struct device *dev)
215{
216 struct maple_device *mdev = to_maple_dev(dev);
217 struct maple_driver *mdrv = to_maple_driver(dev->driver);
218 int error;
219
220 error = dc_kbd_connect(mdev);
221 if (error)
222 return error;
223
224 mdev->driver = mdrv;
225 mdev->registered = 1;
226 228
229 mutex_unlock(&maple_keyb_mutex);
227 return 0; 230 return 0;
228} 231}
229 232
230static struct maple_driver dc_kbd_driver = { 233static struct maple_driver dc_kbd_driver = {
231 .function = MAPLE_FUNC_KEYBOARD, 234 .function = MAPLE_FUNC_KEYBOARD,
232 .connect = dc_kbd_connect,
233 .disconnect = dc_kbd_disconnect,
234 .drv = { 235 .drv = {
235 .name = "Dreamcast_keyboard", 236 .name = "Dreamcast_keyboard",
236 .probe = probe_maple_kbd, 237 .probe = probe_maple_kbd,
237 }, 238 .remove = remove_maple_kbd,
239 },
238}; 240};
239 241
240static int __init dc_kbd_init(void) 242static int __init dc_kbd_init(void)
241{ 243{
242 return maple_driver_register(&dc_kbd_driver.drv); 244 return maple_driver_register(&dc_kbd_driver);
243} 245}
244 246
245static void __exit dc_kbd_exit(void) 247static void __exit dc_kbd_exit(void)
246{ 248{
247 driver_unregister(&dc_kbd_driver.drv); 249 maple_driver_unregister(&dc_kbd_driver);
248} 250}
249 251
250module_init(dc_kbd_init); 252module_init(dc_kbd_init);
diff --git a/drivers/net/stnic.c b/drivers/net/stnic.c
index b65be5d70fec..2ed0bd596815 100644
--- a/drivers/net/stnic.c
+++ b/drivers/net/stnic.c
@@ -19,7 +19,7 @@
19 19
20#include <asm/system.h> 20#include <asm/system.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/se.h> 22#include <mach-se/mach/se.h>
23#include <asm/machvec.h> 23#include <asm/machvec.h>
24#ifdef CONFIG_SH_STANDARD_BIOS 24#ifdef CONFIG_SH_STANDARD_BIOS
25#include <asm/sh_bios.h> 25#include <asm/sh_bios.h>
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index be97789fa5fd..d1812d32f47d 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -2,6 +2,7 @@
2 * Core maple bus functionality 2 * Core maple bus functionality
3 * 3 *
4 * Copyright (C) 2007, 2008 Adrian McMenamin 4 * Copyright (C) 2007, 2008 Adrian McMenamin
5 * Copyright (C) 2001 - 2008 Paul Mundt
5 * 6 *
6 * Based on 2.4 code by: 7 * Based on 2.4 code by:
7 * 8 *
@@ -31,7 +32,7 @@
31#include <mach/dma.h> 32#include <mach/dma.h>
32#include <mach/sysasic.h> 33#include <mach/sysasic.h>
33 34
34MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin"); 35MODULE_AUTHOR("Yaegashi Takeshi, Paul Mundt, M. R. Brown, Adrian McMenamin");
35MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); 36MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
36MODULE_LICENSE("GPL v2"); 37MODULE_LICENSE("GPL v2");
37MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}"); 38MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}");
@@ -65,19 +66,36 @@ static bool checked[4];
65static struct maple_device *baseunits[4]; 66static struct maple_device *baseunits[4];
66 67
67/** 68/**
68 * maple_driver_register - register a device driver 69 * maple_driver_register - register a maple driver
69 * automatically makes the driver bus a maple bus 70 * @drv: maple driver to be registered.
70 * @drv: the driver to be registered 71 *
72 * Registers the passed in @drv, while updating the bus type.
73 * Devices with matching function IDs will be automatically probed.
71 */ 74 */
72int maple_driver_register(struct device_driver *drv) 75int maple_driver_register(struct maple_driver *drv)
73{ 76{
74 if (!drv) 77 if (!drv)
75 return -EINVAL; 78 return -EINVAL;
76 drv->bus = &maple_bus_type; 79
77 return driver_register(drv); 80 drv->drv.bus = &maple_bus_type;
81
82 return driver_register(&drv->drv);
78} 83}
79EXPORT_SYMBOL_GPL(maple_driver_register); 84EXPORT_SYMBOL_GPL(maple_driver_register);
80 85
86/**
87 * maple_driver_unregister - unregister a maple driver.
88 * @drv: maple driver to unregister.
89 *
90 * Cleans up after maple_driver_register(). To be invoked in the exit
91 * path of any module drivers.
92 */
93void maple_driver_unregister(struct maple_driver *drv)
94{
95 driver_unregister(&drv->drv);
96}
97EXPORT_SYMBOL_GPL(maple_driver_unregister);
98
81/* set hardware registers to enable next round of dma */ 99/* set hardware registers to enable next round of dma */
82static void maplebus_dma_reset(void) 100static void maplebus_dma_reset(void)
83{ 101{
@@ -129,13 +147,13 @@ static void maple_release_device(struct device *dev)
129 kfree(mdev); 147 kfree(mdev);
130} 148}
131 149
132/* 150/**
133 * maple_add_packet - add a single instruction to the queue 151 * maple_add_packet - add a single instruction to the queue
134 * @mdev - maple device 152 * @mdev: maple device
135 * @function - function on device being queried 153 * @function: function on device being queried
136 * @command - maple command to add 154 * @command: maple command to add
137 * @length - length of command string (in 32 bit words) 155 * @length: length of command string (in 32 bit words)
138 * @data - remainder of command string 156 * @data: remainder of command string
139 */ 157 */
140int maple_add_packet(struct maple_device *mdev, u32 function, u32 command, 158int maple_add_packet(struct maple_device *mdev, u32 function, u32 command,
141 size_t length, void *data) 159 size_t length, void *data)
@@ -176,14 +194,15 @@ out:
176} 194}
177EXPORT_SYMBOL_GPL(maple_add_packet); 195EXPORT_SYMBOL_GPL(maple_add_packet);
178 196
179/* 197/**
180 * maple_add_packet_sleeps - add a single instruction to the queue 198 * maple_add_packet_sleeps - add a single instruction to the queue
181 * - waits for lock to be free 199 * @mdev: maple device
182 * @mdev - maple device 200 * @function: function on device being queried
183 * @function - function on device being queried 201 * @command: maple command to add
184 * @command - maple command to add 202 * @length: length of command string (in 32 bit words)
185 * @length - length of command string (in 32 bit words) 203 * @data: remainder of command string
186 * @data - remainder of command string 204 *
205 * Same as maple_add_packet(), but waits for the lock to become free.
187 */ 206 */
188int maple_add_packet_sleeps(struct maple_device *mdev, u32 function, 207int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
189 u32 command, size_t length, void *data) 208 u32 command, size_t length, void *data)
@@ -724,11 +743,9 @@ static int maple_get_dma_buffer(void)
724static int match_maple_bus_driver(struct device *devptr, 743static int match_maple_bus_driver(struct device *devptr,
725 struct device_driver *drvptr) 744 struct device_driver *drvptr)
726{ 745{
727 struct maple_driver *maple_drv; 746 struct maple_driver *maple_drv = to_maple_driver(drvptr);
728 struct maple_device *maple_dev; 747 struct maple_device *maple_dev = to_maple_dev(devptr);
729 748
730 maple_drv = container_of(drvptr, struct maple_driver, drv);
731 maple_dev = container_of(devptr, struct maple_device, dev);
732 /* Trap empty port case */ 749 /* Trap empty port case */
733 if (maple_dev->devinfo.function == 0xFFFFFFFF) 750 if (maple_dev->devinfo.function == 0xFFFFFFFF)
734 return 0; 751 return 0;