Skip to content

Commit b6f6728

Browse files
GuEe-GUIRbb666
authored andcommitted
[DM/FIXUP] remove OFW switch macros
The drivers will support OFW and name probe both. We should make build OK when OFW is disable. Signed-off-by: GuEe-GUI <[email protected]>
1 parent 3b22dbd commit b6f6728

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

components/drivers/core/platform.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,21 @@ static rt_bool_t platform_match(rt_driver_t drv, rt_device_t dev)
7878
{
7979
struct rt_platform_driver *pdrv = rt_container_of(drv, struct rt_platform_driver, parent);
8080
struct rt_platform_device *pdev = rt_container_of(dev, struct rt_platform_device, parent);
81-
82-
#ifdef RT_USING_OFW
8381
struct rt_ofw_node *np = dev->ofw_node;
8482

8583
/* 1、match with ofw node */
8684
if (np)
8785
{
86+
#ifdef RT_USING_OFW
8887
pdev->id = rt_ofw_node_match(np, pdrv->ids);
89-
88+
#else
89+
pdev->id = RT_NULL;
90+
#endif
9091
if (pdev->id)
9192
{
9293
return RT_TRUE;
9394
}
9495
}
95-
#endif
9696

9797
/* 2、match with name */
9898
if (pdev->name && pdrv->name)
@@ -123,7 +123,13 @@ static rt_err_t platform_probe(rt_device_t dev)
123123

124124
if (err && err != -RT_EEMPTY)
125125
{
126-
LOG_E("Attach power domain error = %s in device %s", pdev->name, rt_strerror(err));
126+
LOG_E("Attach power domain error = %s in device %s", rt_strerror(err),
127+
#ifdef RT_USING_OFW
128+
(pdev->name && pdev->name[0]) ? pdev->name : rt_ofw_node_full_name(np)
129+
#else
130+
pdev->name
131+
#endif
132+
);
127133

128134
return err;
129135
}

components/drivers/include/drivers/platform.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
#ifndef __PLATFORM_H__
1313
#define __PLATFORM_H__
1414

15-
#ifdef RT_USING_OFW
1615
#include <drivers/ofw.h>
17-
#endif
18-
1916
#include <drivers/core/driver.h>
2017

2118
struct rt_platform_device
@@ -25,10 +22,7 @@ struct rt_platform_device
2522
int dev_id;
2623

2724
const char *name;
28-
29-
#ifdef RT_USING_OFW
3025
const struct rt_ofw_node_id *id;
31-
#endif
3226

3327
void *priv;
3428
};
@@ -38,10 +32,7 @@ struct rt_platform_driver
3832
struct rt_driver parent;
3933

4034
const char *name;
41-
42-
#ifdef RT_USING_OFW
4335
const struct rt_ofw_node_id *ids;
44-
#endif
4536

4637
rt_err_t (*probe)(struct rt_platform_device *pdev);
4738
rt_err_t (*remove)(struct rt_platform_device *pdev);

0 commit comments

Comments
 (0)