summaryrefslogtreecommitdiff
path: root/components/drivers
diff options
context:
space:
mode:
authorWayne Lin <[email protected]>2021-12-07 22:40:26 +0800
committerBernard Xiong <[email protected]>2021-12-24 05:36:12 +0800
commit28f91a86f5efff1d8d642097ec1b7ccfef6520bb (patch)
treed9182de9f275c71ddcb1faf794fc1b19a05ab6c7 /components/drivers
parentf508d58c055907ecee68f7e2102af4a3c353b39f (diff)
Correct sem's name of sd block device.
Diffstat (limited to 'components/drivers')
-rw-r--r--components/drivers/sdio/block_dev.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/components/drivers/sdio/block_dev.c b/components/drivers/sdio/block_dev.c
index 3a51cc558d..444c96e145 100644
--- a/components/drivers/sdio/block_dev.c
+++ b/components/drivers/sdio/block_dev.c
@@ -352,7 +352,7 @@ const static struct rt_device_ops mmcsd_blk_ops =
#endif
-static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *card, const char* dname, struct dfs_partition* psPart, rt_bool_t bMount)
+static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *card, const char* dname, struct dfs_partition* psPart)
{
struct mmcsd_blk_device *blk_dev;
char sname[12];
@@ -379,6 +379,7 @@ static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *ca
blk_dev->geometry.bytes_per_sector = 1<<9;
blk_dev->geometry.block_size = card->card_blksize;
+ rt_snprintf(sname, sizeof(sname), "sem_%s", dname);
blk_dev->part.lock = rt_sem_create(sname, 1, RT_IPC_FLAG_FIFO);
blk_dev->max_req_size = BLK_MIN((card->host->max_dma_segs *
@@ -386,8 +387,6 @@ static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *ca
(card->host->max_blk_count *
card->host->max_blk_size) >> 9);
- rt_snprintf(sname, sizeof(sname), "sem_%s", dname);
-
/* register mmcsd device */
blk_dev->dev.type = RT_Device_Class_Block;
#ifdef RT_USING_DEVICE_OPS
@@ -404,7 +403,6 @@ static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *ca
blk_dev->card = card;
-
rt_device_register(&blk_dev->dev, dname,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
@@ -412,7 +410,7 @@ static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *ca
rt_list_insert_after(&card->blk_devices, &blk_dev->list);
#ifdef RT_USING_DFS_MNTTABLE
- if ( bMount && blk_dev )
+ if ( blk_dev )
{
LOG_I("try to mount file system!");
/* try to mount file system on this block device */
@@ -466,7 +464,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
{
/* Given name is with allocated host id and its partition index. */
rt_snprintf(dname, sizeof(dname), "sd%dp%d", host_id, i);
- blk_dev = rt_mmcsd_create_blkdev(card, (const char*)dname, &part, RT_TRUE);
+ blk_dev = rt_mmcsd_create_blkdev(card, (const char*)dname, &part);
if ( blk_dev == RT_NULL )
{
err = -RT_ENOMEM;
@@ -481,7 +479,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
/* Always create the super node, given name is with allocated host id. */
rt_snprintf(dname, sizeof(dname), "sd%d", host_id);
- blk_dev = rt_mmcsd_create_blkdev(card, (const char*)dname, RT_NULL, RT_TRUE /*(i==0)?RT_TRUE:RT_FALSE*/);
+ blk_dev = rt_mmcsd_create_blkdev(card, (const char*)dname, RT_NULL);
if ( blk_dev == RT_NULL )
{
err = -RT_ENOMEM;