[style] mass reformat all the non external code to 4 space indents
Ran everything through scripts/codestyle.space, which uses astyle to generally follow K&R style. Biggest non whitespace change is pulling brackets down on function declarations, which I'm pretty ambivalent about, but astyle insists on taking a stance
This commit is contained in:
120
dev/driver.c
120
dev/driver.c
@@ -31,103 +31,103 @@ extern struct device __devices_end[];
|
||||
|
||||
status_t device_init_all(void)
|
||||
{
|
||||
status_t res = NO_ERROR;
|
||||
status_t res = NO_ERROR;
|
||||
|
||||
struct device *dev = __devices;
|
||||
while (dev != __devices_end) {
|
||||
status_t code = device_init(dev);
|
||||
struct device *dev = __devices;
|
||||
while (dev != __devices_end) {
|
||||
status_t code = device_init(dev);
|
||||
|
||||
if (code < 0) {
|
||||
TRACEF("Driver init failed for driver \"%s\", device \"%s\", reason %d\n",
|
||||
dev->driver->type, dev->name, code);
|
||||
if (code < 0) {
|
||||
TRACEF("Driver init failed for driver \"%s\", device \"%s\", reason %d\n",
|
||||
dev->driver->type, dev->name, code);
|
||||
|
||||
res = code;
|
||||
}
|
||||
res = code;
|
||||
}
|
||||
|
||||
dev++;
|
||||
}
|
||||
dev++;
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
status_t device_fini_all(void)
|
||||
{
|
||||
status_t res = NO_ERROR;
|
||||
status_t res = NO_ERROR;
|
||||
|
||||
struct device *dev = __devices;
|
||||
while (dev != __devices_end) {
|
||||
status_t code = device_fini(dev);
|
||||
struct device *dev = __devices;
|
||||
while (dev != __devices_end) {
|
||||
status_t code = device_fini(dev);
|
||||
|
||||
if (code < 0) {
|
||||
TRACEF("Driver fini failed for driver \"%s\", device \"%s\", reason %d\n",
|
||||
dev->driver->type, dev->name, code);
|
||||
if (code < 0) {
|
||||
TRACEF("Driver fini failed for driver \"%s\", device \"%s\", reason %d\n",
|
||||
dev->driver->type, dev->name, code);
|
||||
|
||||
res = code;
|
||||
}
|
||||
res = code;
|
||||
}
|
||||
|
||||
dev++;
|
||||
}
|
||||
dev++;
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
status_t device_init(struct device *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return ERR_INVALID_ARGS;
|
||||
if (!dev)
|
||||
return ERR_INVALID_ARGS;
|
||||
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
|
||||
if (ops && ops->init)
|
||||
return ops->init(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
|
||||
if (ops && ops->init)
|
||||
return ops->init(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
status_t device_fini(struct device *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return ERR_INVALID_ARGS;
|
||||
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
if (!dev)
|
||||
return ERR_INVALID_ARGS;
|
||||
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
|
||||
if (ops && ops->fini)
|
||||
return ops->fini(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
|
||||
if (ops && ops->fini)
|
||||
return ops->fini(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
status_t device_suspend(struct device *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return ERR_NOT_SUPPORTED;
|
||||
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
if (!dev)
|
||||
return ERR_NOT_SUPPORTED;
|
||||
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
|
||||
if (ops && ops->suspend)
|
||||
return ops->suspend(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
|
||||
if (ops && ops->suspend)
|
||||
return ops->suspend(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
status_t device_resume(struct device *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return ERR_NOT_SUPPORTED;
|
||||
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
if (!dev)
|
||||
return ERR_NOT_SUPPORTED;
|
||||
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
DEBUG_ASSERT(dev->driver);
|
||||
|
||||
if (ops && ops->resume)
|
||||
return ops->resume(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
|
||||
if (ops && ops->resume)
|
||||
return ops->resume(dev);
|
||||
else
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user