summaryrefslogtreecommitdiff
path: root/components/drivers/wlan/wlan_dev.c
diff options
context:
space:
mode:
authorarmink <[email protected]>2019-01-18 20:41:39 +0800
committerarmink <[email protected]>2019-01-18 20:41:39 +0800
commit59a4e4b2b7ecb167b9736cbf38fccc7720b2a10a (patch)
treeecb12f4d2c632fe657e29816d8e0b3913be86e5c /components/drivers/wlan/wlan_dev.c
parent8859b7b6251c6cc81f81e2a9650c478440199122 (diff)
[DeviceDriver][wlan] Add device ops to wlan.
Diffstat (limited to 'components/drivers/wlan/wlan_dev.c')
-rw-r--r--components/drivers/wlan/wlan_dev.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/components/drivers/wlan/wlan_dev.c b/components/drivers/wlan/wlan_dev.c
index 0beac52aae..eac1d0f975 100644
--- a/components/drivers/wlan/wlan_dev.c
+++ b/components/drivers/wlan/wlan_dev.c
@@ -754,6 +754,18 @@ static rt_err_t _rt_wlan_dev_control(rt_device_t dev, int cmd, void *args)
return err;
}
+#ifdef RT_USING_DEVICE_OPS
+const static struct rt_device_ops wlan_ops =
+{
+ _rt_wlan_dev_init,
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ _rt_wlan_dev_control
+};
+#endif
+
rt_err_t rt_wlan_dev_register(struct rt_wlan_device *wlan, const char *name, const struct rt_wlan_dev_ops *ops, rt_uint32_t flag, void *user_data)
{
rt_err_t err = RT_EOK;
@@ -765,13 +777,18 @@ rt_err_t rt_wlan_dev_register(struct rt_wlan_device *wlan, const char *name, con
}
rt_memset(wlan, 0, sizeof(struct rt_wlan_device));
-
+
+#ifdef RT_USING_DEVICE_OPS
+ wlan->device.ops = &wlan_ops;
+#else
wlan->device.init = _rt_wlan_dev_init;
wlan->device.open = RT_NULL;
wlan->device.close = RT_NULL;
wlan->device.read = RT_NULL;
wlan->device.write = RT_NULL;
wlan->device.control = _rt_wlan_dev_control;
+#endif
+
wlan->device.user_data = RT_NULL;
wlan->device.type = RT_Device_Class_NetIf;