From 875892f0735c1ffb789c705e86824ae09824c30a Mon Sep 17 00:00:00 2001 From: Hemant Gupta Date: Tue, 27 Sep 2011 18:46:46 +0530 Subject: mfd/cg2900: Error opening HCI Raw Channel This patch fixes the corner case issue in driver, due to which if the port is closed while data is being read, the driver state is not correct next time the port is re-opened. ST-Ericsson Linux next: Not tested, ER356425 ST-Ericsson ID: 356425 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I82090c25ce7dd3aea07bacd96856d62361bcd741 Signed-off-by: Hemant Gupta Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32208 Reviewed-by: Henrik POSSUNG Reviewed-by: Par-Gunnar HJALMDAHL --- drivers/staging/cg2900/bluetooth/cg2900_uart.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/cg2900/bluetooth/cg2900_uart.c b/drivers/staging/cg2900/bluetooth/cg2900_uart.c index fb175309685..5b6cd0feeae 100644 --- a/drivers/staging/cg2900/bluetooth/cg2900_uart.c +++ b/drivers/staging/cg2900/bluetooth/cg2900_uart.c @@ -1395,6 +1395,16 @@ static void uart_set_chip_power(struct cg2900_chip_dev *dev, bool chip_on) "New sleep_state: CHIP_POWERED_DOWN\n"); uart_info->sleep_state = CHIP_POWERED_DOWN; } + + /* + * Reset the uart_info state so that + * next packet can be handled + * correctly by driver. + */ + uart_info->rx_state = W4_PACKET_TYPE; + uart_info->rx_count = 0; + kfree_skb(uart_info->rx_skb); + uart_info->rx_skb = NULL; cg2900_disable_regulator(uart_info); /* * Setting baud rate to 0 will tell UART driver to shut off its -- cgit v1.2.3