Skip to content

Commit 5397e18

Browse files
committed
[DeviceDrivers] Fix compiling warning.
1 parent 582aff8 commit 5397e18

File tree

3 files changed

+5
-44
lines changed

3 files changed

+5
-44
lines changed

components/drivers/i2c/i2c-bit-ops.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,6 @@ static const struct rt_i2c_bus_device_ops i2c_bit_bus_ops =
451451
rt_err_t rt_i2c_bit_add_bus(struct rt_i2c_bus_device *bus,
452452
const char *bus_name)
453453
{
454-
struct rt_i2c_bit_ops *bit_ops = bus->priv;
455-
RT_ASSERT(bit_ops != RT_NULL);
456-
457454
bus->ops = &i2c_bit_bus_ops;
458455

459456
return rt_i2c_bus_device_register(bus, bus_name);

components/drivers/i2c/i2c_dev.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,11 @@
2020
* Change Logs:
2121
* Date Author Notes
2222
* 2012-04-25 weety first version
23+
* 2014-08-03 bernard fix some compiling warning
2324
*/
2425

2526
#include <rtdevice.h>
2627

27-
static rt_err_t i2c_bus_device_init(rt_device_t dev)
28-
{
29-
struct rt_i2c_bus_device *bus = (struct rt_i2c_bus_device *)dev->user_data;
30-
RT_ASSERT(bus != RT_NULL);
31-
32-
return RT_EOK;
33-
}
34-
3528
static rt_size_t i2c_bus_device_read(rt_device_t dev,
3629
rt_off_t pos,
3730
void *buffer,
@@ -122,7 +115,7 @@ rt_err_t rt_i2c_bus_device_device_init(struct rt_i2c_bus_device *bus,
122115
/* set device type */
123116
device->type = RT_Device_Class_I2CBUS;
124117
/* initialize device interface */
125-
device->init = i2c_bus_device_init;
118+
device->init = RT_NULL;
126119
device->open = RT_NULL;
127120
device->close = RT_NULL;
128121
device->read = i2c_bus_device_read;

components/drivers/spi/spi_dev.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@
2525
#include <drivers/spi.h>
2626

2727
/* SPI bus device interface, compatible with RT-Thread 0.3.x/1.0.x */
28-
static rt_err_t _spi_bus_device_init(rt_device_t dev)
29-
{
30-
struct rt_spi_bus *bus;
31-
32-
bus = (struct rt_spi_bus *)dev;
33-
RT_ASSERT(bus != RT_NULL);
34-
35-
return RT_EOK;
36-
}
37-
3828
static rt_size_t _spi_bus_device_read(rt_device_t dev,
3929
rt_off_t pos,
4030
void *buffer,
@@ -67,11 +57,7 @@ static rt_err_t _spi_bus_device_control(rt_device_t dev,
6757
rt_uint8_t cmd,
6858
void *args)
6959
{
70-
struct rt_spi_bus *bus;
71-
72-
bus = (struct rt_spi_bus *)dev;
73-
RT_ASSERT(bus != RT_NULL);
74-
60+
/* TODO: add control command handle */
7561
switch (cmd)
7662
{
7763
case 0: /* set device */
@@ -93,7 +79,7 @@ rt_err_t rt_spi_bus_device_init(struct rt_spi_bus *bus, const char *name)
9379
/* set device type */
9480
device->type = RT_Device_Class_SPIBUS;
9581
/* initialize device interface */
96-
device->init = _spi_bus_device_init;
82+
device->init = RT_NULL;
9783
device->open = RT_NULL;
9884
device->close = RT_NULL;
9985
device->read = _spi_bus_device_read;
@@ -105,16 +91,6 @@ rt_err_t rt_spi_bus_device_init(struct rt_spi_bus *bus, const char *name)
10591
}
10692

10793
/* SPI Dev device interface, compatible with RT-Thread 0.3.x/1.0.x */
108-
static rt_err_t _spidev_device_init(rt_device_t dev)
109-
{
110-
struct rt_spi_device *device;
111-
112-
device = (struct rt_spi_device *)dev;
113-
RT_ASSERT(device != RT_NULL);
114-
115-
return RT_EOK;
116-
}
117-
11894
static rt_size_t _spidev_device_read(rt_device_t dev,
11995
rt_off_t pos,
12096
void *buffer,
@@ -147,11 +123,6 @@ static rt_err_t _spidev_device_control(rt_device_t dev,
147123
rt_uint8_t cmd,
148124
void *args)
149125
{
150-
struct rt_spi_device *device;
151-
152-
device = (struct rt_spi_device *)dev;
153-
RT_ASSERT(device != RT_NULL);
154-
155126
switch (cmd)
156127
{
157128
case 0: /* set device */
@@ -172,7 +143,7 @@ rt_err_t rt_spidev_device_init(struct rt_spi_device *dev, const char *name)
172143

173144
/* set device type */
174145
device->type = RT_Device_Class_SPIDevice;
175-
device->init = _spidev_device_init;
146+
device->init = RT_NULL;
176147
device->open = RT_NULL;
177148
device->close = RT_NULL;
178149
device->read = _spidev_device_read;

0 commit comments

Comments
 (0)