9
0
Fork 0

replace 8 spaces with tabs

This commit is contained in:
Sascha Hauer 2007-10-11 20:56:18 +02:00
parent ac8a1f064e
commit 22c0e805ea
3 changed files with 103 additions and 103 deletions

View File

@ -63,16 +63,16 @@ int get_free_deviceid(char *id, char *id_template)
static int match(struct driver_d *drv, struct device_d *dev)
{
if (strcmp(dev->name, drv->name))
return -1;
if (dev->type != drv->type)
return -1;
if(drv->probe(dev))
return -1;
if (strcmp(dev->name, drv->name))
return -1;
if (dev->type != drv->type)
return -1;
if(drv->probe(dev))
return -1;
dev->driver = drv;
dev->driver = drv;
return 0;
return 0;
}
int register_device(struct device_d *new_device)
@ -88,9 +88,9 @@ int register_device(struct device_d *new_device)
list_add_tail(&new_device->list, &device_list);
for_each_driver(drv) {
if (!match(drv, new_device))
break;
}
if (!match(drv, new_device))
break;
}
return 0;
}
@ -121,7 +121,7 @@ struct driver_d *get_driver_by_name(const char *name)
static void noinfo(struct device_d *dev)
{
printf("no info available for %s\n", dev->id);
printf("no info available for %s\n", dev->id);
}
static void noshortinfo(struct device_d *dev)
@ -130,19 +130,19 @@ static void noshortinfo(struct device_d *dev)
int register_driver(struct driver_d *drv)
{
struct device_d *dev = NULL;
struct device_d *dev = NULL;
debug("register_driver: %s\n",new_driver->name);
list_add_tail(&drv->list, &driver_list);
if (!drv->info)
drv->info = noinfo;
if (!drv->shortinfo)
drv->shortinfo = noshortinfo;
if (!drv->info)
drv->info = noinfo;
if (!drv->shortinfo)
drv->shortinfo = noshortinfo;
for_each_device(dev)
match(drv, dev);
match(drv, dev);
return 0;
}
@ -152,35 +152,35 @@ static char devicename_from_spec_str_buf[PATH_MAX];
char *deviceid_from_spec_str(const char *str, char **endp)
{
char *buf = devicename_from_spec_str_buf;
const char *end;
char *buf = devicename_from_spec_str_buf;
const char *end;
int i = 0;
if (isdigit(*str)) {
/* No device name given, use default driver mem */
sprintf(buf, "mem");
end = str;
} else {
/* OK, we have a device name, parse it */
while (*str) {
if (*str == ':') {
str++;
buf[i] = 0;
break;
}
if (isdigit(*str)) {
/* No device name given, use default driver mem */
sprintf(buf, "mem");
end = str;
} else {
/* OK, we have a device name, parse it */
while (*str) {
if (*str == ':') {
str++;
buf[i] = 0;
break;
}
buf[i++] = *str++;
buf[i] = 0;
if (i == MAX_DRIVER_NAME)
return NULL;
}
end = str;
}
buf[i++] = *str++;
buf[i] = 0;
if (i == MAX_DRIVER_NAME)
return NULL;
}
end = str;
}
if (endp)
*endp = (char *)end;
if (endp)
*endp = (char *)end;
return buf;
return buf;
}
/* Get a device struct from the beginning of the string. Default to mem if no
@ -190,49 +190,49 @@ char *deviceid_from_spec_str(const char *str, char **endp)
*/
struct device_d *device_from_spec_str(const char *str, char **endp)
{
char *name;
name = deviceid_from_spec_str(str, endp);
return get_device_by_id(name);
char *name;
name = deviceid_from_spec_str(str, endp);
return get_device_by_id(name);
}
ssize_t dev_read(struct device_d *dev, void *buf, size_t count, unsigned long offset, ulong flags)
{
if (dev->driver->read)
return dev->driver->read(dev, buf, count, offset, flags);
if (dev->driver->read)
return dev->driver->read(dev, buf, count, offset, flags);
errno = -ENOSYS;
return -ENOSYS;
return -ENOSYS;
}
ssize_t dev_write(struct device_d *dev, const void *buf, size_t count, unsigned long offset, ulong flags)
{
if (dev->driver->write)
return dev->driver->write(dev, buf, count, offset, flags);
if (dev->driver->write)
return dev->driver->write(dev, buf, count, offset, flags);
errno = -ENOSYS;
return -ENOSYS;
return -ENOSYS;
}
ssize_t dev_erase(struct device_d *dev, size_t count, unsigned long offset)
{
if (dev->driver->erase)
return dev->driver->erase(dev, count, offset);
if (dev->driver->erase)
return dev->driver->erase(dev, count, offset);
errno = -ENOSYS;
return -ENOSYS;
return -ENOSYS;
}
int dev_protect(struct device_d *dev, size_t count, unsigned long offset, int prot)
{
if (dev->driver->protect)
return dev->driver->protect(dev, count, offset, prot);
if (dev->driver->protect)
return dev->driver->protect(dev, count, offset, prot);
errno = -ENOSYS;
return -ENOSYS;
return -ENOSYS;
}
ssize_t dev_memmap(struct device_d *dev, void **map, int flags)
{
if (dev->driver->memmap)
return dev->driver->memmap(dev, map, flags);
if (dev->driver->memmap)
return dev->driver->memmap(dev, map, flags);
errno = -ENOSYS;
return -ENOSYS;
return -ENOSYS;
}
int generic_memmap_ro(struct device_d *dev, void **map, int flags)
@ -251,7 +251,7 @@ int generic_memmap_rw(struct device_d *dev, void **map, int flags)
int dummy_probe(struct device_d *dev)
{
return 0;
return 0;
}
static int do_devinfo ( cmd_tbl_t *cmdtp, int argc, char *argv[])

View File

@ -32,28 +32,28 @@
*/
unsigned long strtoul_suffix(const char *str, char **endp, int base)
{
unsigned long val;
char *end;
unsigned long val;
char *end;
val = simple_strtoul(str, &end, base);
val = simple_strtoul(str, &end, base);
switch (*end) {
case 'G':
val *= 1024;
case 'M':
switch (*end) {
case 'G':
val *= 1024;
case 'k':
case 'K':
val *= 1024;
end++;
case 'M':
val *= 1024;
case 'k':
case 'K':
val *= 1024;
end++;
default:
break;
}
}
if (endp)
*endp = (char *)end;
if (endp)
*endp = (char *)end;
return val;
return val;
}
EXPORT_SYMBOL(strtoul_suffix);
@ -88,7 +88,7 @@ int parse_area_spec(const char *str, ulong *start, ulong *size)
}
if (*str == '-') {
/* beginning and end given */
/* beginning and end given */
end = strtoul_suffix(str + 1, NULL, 0);
if (end < *start) {
printf("end < start\n");
@ -99,7 +99,7 @@ int parse_area_spec(const char *str, ulong *start, ulong *size)
}
if (*str == '+') {
/* beginning and size given */
/* beginning and size given */
*size = strtoul_suffix(str + 1, NULL, 0);
return 0;
}

View File

@ -29,30 +29,30 @@
struct param_d *get_param_by_name(struct device_d *dev, const char *name)
{
struct param_d *param = dev->param;
struct param_d *param = dev->param;
while (param) {
if (!strcmp(param->name, name))
return param;
param = param->next;
}
while (param) {
if (!strcmp(param->name, name))
return param;
param = param->next;
}
return NULL;
return NULL;
}
const char *dev_get_param(struct device_d *dev, const char *name)
{
struct param_d *param = get_param_by_name(dev, name);
struct param_d *param = get_param_by_name(dev, name);
if (!param) {
errno = -EINVAL;
return NULL;
}
if (param->get)
return param->get(dev, param);
if (param->get)
return param->get(dev, param);
return param->value;
return param->value;
}
#ifdef CONFIG_NET
@ -72,7 +72,7 @@ int dev_set_param_ip(struct device_d *dev, char *name, IPaddr_t ip)
int dev_set_param(struct device_d *dev, const char *name, const char *val)
{
struct param_d *param;
struct param_d *param;
if (!dev) {
errno = -ENODEV;
@ -91,29 +91,29 @@ int dev_set_param(struct device_d *dev, const char *name, const char *val)
return -EACCES;
}
if (param->set)
return param->set(dev, param, val);
if (param->set)
return param->set(dev, param, val);
if (param->value)
free(param->value);
param->value = strdup(val);
param->value = strdup(val);
return 0;
}
int dev_add_param(struct device_d *dev, struct param_d *newparam)
{
struct param_d *param = dev->param;
struct param_d *param = dev->param;
newparam->next = 0;
newparam->next = 0;
if (param) {
while (param->next)
param = param->next;
param->next = newparam;
} else {
dev->param = newparam;
}
if (param) {
while (param->next)
param = param->next;
param->next = newparam;
} else {
dev->param = newparam;
}
return 0;
return 0;
}