From 7e159dfb763d4d2c961f281bbcc4eb4880a1de41 Mon Sep 17 00:00:00 2001 From: "dzzxzz@gmail.com" Date: Thu, 20 Dec 2012 07:48:59 +0000 Subject: [PATCH] fixed the coding style in device.c git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2502 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- src/device.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/device.c b/src/device.c index 58eda6140..e55e21930 100644 --- a/src/device.c +++ b/src/device.c @@ -79,10 +79,14 @@ rt_err_t rt_device_init_all(void) information = &rt_object_container[RT_Object_Class_Device]; /* for each device */ - for (node = information->object_list.next; node != &(information->object_list); node = node->next) + for (node = information->object_list.next; + node != &(information->object_list); + node = node->next) { rt_err_t (*init)(rt_device_t dev); - device = (struct rt_device *)rt_list_entry(node, struct rt_object, list); + device = (struct rt_device *)rt_list_entry(node, + struct rt_object, + list); /* get device init handler */ init = device->init; @@ -125,7 +129,9 @@ rt_device_t rt_device_find(const char *name) /* try to find device object */ information = &rt_object_container[RT_Object_Class_Device]; - for (node = information->object_list.next; node != &(information->object_list); node = node->next) + for (node = information->object_list.next; + node != &(information->object_list); + node = node->next) { object = rt_list_entry(node, struct rt_object, list); if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0) @@ -158,7 +164,7 @@ rt_err_t rt_device_init(rt_device_t dev) { rt_err_t result = RT_EOK; rt_err_t (*init)(rt_device_t dev); - + RT_ASSERT(dev != RT_NULL); /* get device init handler */ @@ -221,8 +227,11 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag) } /* device is a stand alone device and opened */ - if ((dev->flag & RT_DEVICE_FLAG_STANDALONE) && (dev->open_flag & RT_DEVICE_OFLAG_OPEN)) + if ((dev->flag & RT_DEVICE_FLAG_STANDALONE) && + (dev->open_flag & RT_DEVICE_OFLAG_OPEN)) + { return -RT_EBUSY; + } /* call device open interface */ open = dev->open; -- GitLab