summaryrefslogtreecommitdiff
path: root/components/drivers
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-04-17 15:18:50 +0000
committer[email protected] <[email protected]>2012-04-17 15:18:50 +0000
commit06d45f0c42f2aa3678d509403fcf9cd82be106e6 (patch)
tree1a3a3a8f1a22f02e67c7947d1277df535fa3f5ca /components/drivers
parent5b80e102e0f3223dc892efd88f3560b58818270e (diff)
use rt_list in rtservice.h
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2091 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/drivers')
-rw-r--r--components/drivers/sdio/block_dev.c11
-rw-r--r--components/drivers/sdio/list.h106
-rw-r--r--components/drivers/sdio/sdio.c25
3 files changed, 17 insertions, 125 deletions
diff --git a/components/drivers/sdio/block_dev.c b/components/drivers/sdio/block_dev.c
index d9f3793649..4a5a514b93 100644
--- a/components/drivers/sdio/block_dev.c
+++ b/components/drivers/sdio/block_dev.c
@@ -14,7 +14,6 @@
#include <rtthread.h>
#include <dfs_fs.h>
-#include "list.h"
#include "mmcsd_core.h"
#include "mmcsd_cmd.h"
@@ -359,7 +358,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
rt_device_register(&blk_dev->dev, dname,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
- list_insert_after(&blk_devices, &blk_dev->list);
+ rt_list_insert_after(&blk_devices, &blk_dev->list);
}
else
{
@@ -396,7 +395,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
rt_device_register(&blk_dev->dev, "sd0",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
- list_insert_after(&blk_devices, &blk_dev->list);
+ rt_list_insert_after(&blk_devices, &blk_dev->list);
break;
}
@@ -428,11 +427,11 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card)
for (l = (&blk_devices)->next; l != &blk_devices; l = l->next)
{
- blk_dev = (struct mmcsd_blk_device *)list_entry(l, struct mmcsd_blk_device, list);
+ blk_dev = (struct mmcsd_blk_device *)rt_list_entry(l, struct mmcsd_blk_device, list);
if (blk_dev->card == card)
{
rt_device_unregister(&blk_dev->dev);
- list_remove(&blk_dev->list);
+ rt_list_remove(&blk_dev->list);
rt_free(blk_dev);
}
}
@@ -440,5 +439,5 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card)
void rt_mmcsd_blk_init(void)
{
- list_init(&blk_devices);
+ rt_list_init(&blk_devices);
}
diff --git a/components/drivers/sdio/list.h b/components/drivers/sdio/list.h
deleted file mode 100644
index c68246dadf..0000000000
--- a/components/drivers/sdio/list.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * File : list.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2011-01-15 weety copy from kservice APIs
- */
-
-#ifndef __RT_LIST_H__
-#define __RT_LIST_H__
-
-#include <rtthread.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup list
- */
-/*@{*/
-
-/**
- * @brief initialize a list
- *
- * @param l list to be initialized
- */
-rt_inline void list_init(rt_list_t *l)
-{
- l->next = l->prev = l;
-}
-
-/**
- * @brief insert a node after a list
- *
- * @param l list to insert it
- * @param n new node to be inserted
- */
-rt_inline void list_insert_after(rt_list_t *l, rt_list_t *n)
-{
- l->next->prev = n;
- n->next = l->next;
-
- l->next = n;
- n->prev = l;
-}
-
-/**
- * @brief insert a node before a list
- *
- * @param n new node to be inserted
- * @param l list to insert it
- */
-rt_inline void list_insert_before(rt_list_t *l, rt_list_t *n)
-{
- l->prev->next = n;
- n->prev = l->prev;
-
- l->prev = n;
- n->next = l;
-}
-
-/**
- * @brief remove node from list.
- * @param n the node to remove from the list.
- */
-rt_inline void list_remove(rt_list_t *n)
-{
- n->next->prev = n->prev;
- n->prev->next = n->next;
-
- n->next = n->prev = n;
-}
-
-/**
- * @brief tests whether a list is empty
- * @param l the list to test.
- */
-rt_inline int list_isempty(const rt_list_t *l)
-{
- return l->next == l;
-}
-
-/**
- * @brief get the struct for this entry
- * @param node the entry point
- * @param type the type of structure
- * @param member the name of list in structure
- */
-#define list_entry(node, type, member) \
- ((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
-
-/*@}*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/components/drivers/sdio/sdio.c b/components/drivers/sdio/sdio.c
index 9cde15fbca..8a1d9aa199 100644
--- a/components/drivers/sdio/sdio.c
+++ b/components/drivers/sdio/sdio.c
@@ -14,7 +14,6 @@
#include "mmcsd_core.h"
#include "mmcsd_cmd.h"
-#include "list.h"
#ifndef RT_SDIO_STACK_SIZE
#define RT_SDIO_STACK_SIZE 512
@@ -743,16 +742,16 @@ static rt_int32_t sdio_register_card(struct rt_mmcsd_card *card)
}
sc->card = card;
- list_insert_after(&sdio_cards, &sc->list);
+ rt_list_insert_after(&sdio_cards, &sc->list);
- if (list_isempty(&sdio_drivers))
+ if (rt_list_isempty(&sdio_drivers))
{
goto out;
}
for (l = (&sdio_drivers)->next; l != &sdio_drivers; l = l->next)
{
- sd = (struct sdio_driver *)list_entry(l, struct sdio_driver, list);
+ sd = (struct sdio_driver *)rt_list_entry(l, struct sdio_driver, list);
if (sdio_match_card(card, sd->drv->id))
{
sd->drv->probe(card);
@@ -1260,7 +1259,7 @@ static struct rt_mmcsd_card *sdio_match_driver(struct rt_sdio_device_id *id)
for (l = (&sdio_cards)->next; l != &sdio_cards; l = l->next)
{
- sc = (struct sdio_card *)list_entry(l, struct sdio_card, list);
+ sc = (struct sdio_card *)rt_list_entry(l, struct sdio_card, list);
card = sc->card;
if (sdio_match_card(card, id))
@@ -1284,9 +1283,9 @@ rt_int32_t sdio_register_driver(struct rt_sdio_driver *driver)
return -RT_ENOMEM;
}
- list_insert_after(&sdio_drivers, &sd->list);
+ rt_list_insert_after(&sdio_drivers, &sd->list);
- if (!list_isempty(&sdio_cards))
+ if (!rt_list_isempty(&sdio_cards))
{
card = sdio_match_driver(driver->id);
if (card != RT_NULL)
@@ -1305,11 +1304,11 @@ rt_int32_t sdio_unregister_driver(struct rt_sdio_driver *driver)
struct rt_mmcsd_card *card;
- list_insert_after(&sdio_drivers, &sd->list);
+ rt_list_insert_after(&sdio_drivers, &sd->list);
for (l = (&sdio_drivers)->next; l != &sdio_drivers; l = l->next)
{
- sd = (struct sdio_driver *)list_entry(l, struct sdio_driver, list);
+ sd = (struct sdio_driver *)rt_list_entry(l, struct sdio_driver, list);
if (sd->drv != driver)
{
sd = RT_NULL;
@@ -1322,13 +1321,13 @@ rt_int32_t sdio_unregister_driver(struct rt_sdio_driver *driver)
return -RT_ERROR;
}
- if (!list_isempty(&sdio_cards))
+ if (!rt_list_isempty(&sdio_cards))
{
card = sdio_match_driver(driver->id);
if (card != RT_NULL)
{
driver->remove(card);
- list_remove(&sd->list);
+ rt_list_remove(&sd->list);
rt_free(sd);
}
}
@@ -1339,7 +1338,7 @@ rt_int32_t sdio_unregister_driver(struct rt_sdio_driver *driver)
void rt_sdio_init(void)
{
- list_init(&sdio_cards);
- list_init(&sdio_drivers);
+ rt_list_init(&sdio_cards);
+ rt_list_init(&sdio_drivers);
}