[DeviceDrivers] uart configure issue.

uart configure shall not been performed if uart is not open.
This commit is contained in:
Bernard Xiong 2016-06-13 13:31:13 +08:00
parent 45c7f03035
commit 99481cd0ac

View File

@ -603,8 +603,18 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
break;
case RT_DEVICE_CTRL_CONFIG:
/* configure device */
if (args)
{
/* set serial configure */
serial->config = *(struct serial_configure *)args;
if (dev->ref_count)
{
/* serial device has been opened, to configure it */
serial->ops->configure(serial, (struct serial_configure *)args);
}
}
break;
default :