25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: device.c,v 1.14 2005/06/22 08:13:38 debug Exp $ |
* $Id: device.c,v 1.16 2005/08/10 22:25:50 debug Exp $ |
29 |
* |
* |
30 |
* Device registry framework. |
* Device registry framework. |
31 |
*/ |
*/ |
181 |
*/ |
*/ |
182 |
int device_unregister(char *name) |
int device_unregister(char *name) |
183 |
{ |
{ |
184 |
size_t i; |
ssize_t i; |
185 |
struct device_entry *p = device_lookup(name); |
struct device_entry *p = device_lookup(name); |
186 |
|
|
187 |
if (p == NULL) { |
if (p == NULL) { |
233 |
|
|
234 |
/* Default values: */ |
/* Default values: */ |
235 |
devinit.addr_mult = 1; |
devinit.addr_mult = 1; |
236 |
|
devinit.in_use = 1; |
237 |
|
|
238 |
/* Get the device name first: */ |
/* Get the device name first: */ |
239 |
s2 = name_and_params; |
s2 = name_and_params; |
291 |
devinit.addr_mult = mystrtoull(s3, NULL, 0); |
devinit.addr_mult = mystrtoull(s3, NULL, 0); |
292 |
} else if (strncmp(s2, "irq=", 4) == 0) { |
} else if (strncmp(s2, "irq=", 4) == 0) { |
293 |
devinit.irq_nr = mystrtoull(s3, NULL, 0); |
devinit.irq_nr = mystrtoull(s3, NULL, 0); |
294 |
|
} else if (strncmp(s2, "in_use=", 7) == 0) { |
295 |
|
devinit.in_use = mystrtoull(s3, NULL, 0); |
296 |
|
} else if (strncmp(s2, "name2=", 6) == 0) { |
297 |
|
char *h = s2 + 6; |
298 |
|
size_t len = 0; |
299 |
|
while (*h && *h != ' ') |
300 |
|
h++, len++; |
301 |
|
devinit.name2 = malloc(len + 1); |
302 |
|
if (devinit.name2 == NULL) { |
303 |
|
fprintf(stderr, "out of memory\n"); |
304 |
|
exit(1); |
305 |
|
} |
306 |
|
snprintf(devinit.name2, len + 1, s2 + 6); |
307 |
} else { |
} else { |
308 |
fatal("unknown param: %s\n", s2); |
fatal("unknown param: %s\n", s2); |
309 |
if (device_exit_on_error) |
if (device_exit_on_error) |