net: usb: hso: use swap macro in hso_kick_transmit
Make use of the swap macro and remove unnecessary variable *temp*. This makes the code easier to read and maintain. Also, slightly refactor some code due to the removal of *temp*. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2a6deb6a57
commit
ae85467ccc
@ -1732,7 +1732,6 @@ static int hso_serial_ioctl(struct tty_struct *tty,
|
|||||||
/* starts a transmit */
|
/* starts a transmit */
|
||||||
static void hso_kick_transmit(struct hso_serial *serial)
|
static void hso_kick_transmit(struct hso_serial *serial)
|
||||||
{
|
{
|
||||||
u8 *temp;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -1748,14 +1747,12 @@ static void hso_kick_transmit(struct hso_serial *serial)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* Switch pointers around to avoid memcpy */
|
/* Switch pointers around to avoid memcpy */
|
||||||
temp = serial->tx_buffer;
|
swap(serial->tx_buffer, serial->tx_data);
|
||||||
serial->tx_buffer = serial->tx_data;
|
|
||||||
serial->tx_data = temp;
|
|
||||||
serial->tx_data_count = serial->tx_buffer_count;
|
serial->tx_data_count = serial->tx_buffer_count;
|
||||||
serial->tx_buffer_count = 0;
|
serial->tx_buffer_count = 0;
|
||||||
|
|
||||||
/* If temp is set, it means we switched buffers */
|
/* If serial->tx_data is set, it means we switched buffers */
|
||||||
if (temp && serial->write_data) {
|
if (serial->tx_data && serial->write_data) {
|
||||||
res = serial->write_data(serial);
|
res = serial->write_data(serial);
|
||||||
if (res >= 0)
|
if (res >= 0)
|
||||||
serial->tx_urb_used = 1;
|
serial->tx_urb_used = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user