Skip to content

Commit 6cf3256

Browse files
committed
[device.c] fix the comment, add RT_DEBUG_LOG
1 parent a2b1757 commit 6cf3256

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

include/rtdebug.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
#define RT_DEBUG_IPC 0
5353
#endif
5454

55+
#ifndef RT_DEBUG_DEVICE
56+
#define RT_DEBUG_DEVICE 0
57+
#endif
58+
5559
#ifndef RT_DEBUG_INIT
5660
#define RT_DEBUG_INIT 0
5761
#endif

src/device.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ rt_err_t rt_device_init(rt_device_t dev)
178178
result = device_init(dev);
179179
if (result != RT_EOK)
180180
{
181-
rt_kprintf("To initialize device:%s failed. The error code is %d\n",
182-
dev->parent.name, result);
181+
RT_DEBUG_LOG(RT_DEBUG_DEVICE, ("To initialize device:%s failed. The error code is %d\n",
182+
dev->parent.name, result));
183183
}
184184
else
185185
{
@@ -216,8 +216,8 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
216216
result = device_init(dev);
217217
if (result != RT_EOK)
218218
{
219-
rt_kprintf("To initialize device:%s failed. The error code is %d\n",
220-
dev->parent.name, result);
219+
RT_DEBUG_LOG(RT_DEBUG_DEVICE, ("To initialize device:%s failed. The error code is %d\n",
220+
dev->parent.name, result));
221221

222222
return result;
223223
}
@@ -307,9 +307,9 @@ RTM_EXPORT(rt_device_close);
307307
*
308308
* @param size is the size of buffer.
309309
*
310-
* @return the actually read size on successful, otherwise negative returned.
310+
* @return the actually read size on successful, otherwise 0 will be returned.
311311
*
312-
* @note since 0.4.0, the unit of size/pos is a block for block device.
312+
* @note the unit of size/pos is a block for block device.
313313
*/
314314
rt_size_t rt_device_read(rt_device_t dev,
315315
rt_off_t pos,
@@ -350,9 +350,9 @@ RTM_EXPORT(rt_device_read);
350350
*
351351
* @param size is the size of buffer.
352352
*
353-
* @return the actually written size on successful, otherwise negative returned.
353+
* @return the actually written size on successful, otherwise 0 will be returned.
354354
*
355-
* @note since 0.4.0, the unit of size/pos is a block for block device.
355+
* @note the unit of size/pos is a block for block device.
356356
*/
357357
rt_size_t rt_device_write(rt_device_t dev,
358358
rt_off_t pos,

0 commit comments

Comments
 (0)