Commit 29ef8a53 authored by Rashika Kheria's avatar Rashika Kheria Committed by Greg Kroah-Hartman

Staging: gdm724x: Use ALIGN() macro for dummy_cnt in gdm_mux.c

As suggested in TODO list, this patch uses ALIGN() macro for variable
dummy_cnt in functions up_to_host() and gdm_mux_send() in file
gdm_mux.c.
The macro has already been defined in include/linux/kernel.h, hence is
not defined again.
Signed-off-by: default avatarRashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent abb40c11
...@@ -158,7 +158,6 @@ static int up_to_host(struct mux_rx *r) ...@@ -158,7 +158,6 @@ static int up_to_host(struct mux_rx *r)
unsigned int start_flag; unsigned int start_flag;
unsigned int payload_size; unsigned int payload_size;
unsigned short packet_type; unsigned short packet_type;
int remain;
int dummy_cnt; int dummy_cnt;
u32 packet_size_sum = r->offset; u32 packet_size_sum = r->offset;
int index; int index;
...@@ -176,8 +175,7 @@ static int up_to_host(struct mux_rx *r) ...@@ -176,8 +175,7 @@ static int up_to_host(struct mux_rx *r)
break; break;
} }
remain = (MUX_HEADER_SIZE + payload_size) % 4; dummy_cnt = ALIGN(MUX_HEADER_SIZE + payload_size, 4);
dummy_cnt = remain ? (4-remain) : 0;
if (len - packet_size_sum < if (len - packet_size_sum <
MUX_HEADER_SIZE + payload_size + dummy_cnt) { MUX_HEADER_SIZE + payload_size + dummy_cnt) {
...@@ -361,7 +359,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, ...@@ -361,7 +359,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index,
struct mux_pkt_header *mux_header; struct mux_pkt_header *mux_header;
struct mux_tx *t = NULL; struct mux_tx *t = NULL;
static u32 seq_num = 1; static u32 seq_num = 1;
int remain;
int dummy_cnt; int dummy_cnt;
int total_len; int total_len;
int ret; int ret;
...@@ -375,8 +372,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, ...@@ -375,8 +372,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index,
spin_lock_irqsave(&mux_dev->write_lock, flags); spin_lock_irqsave(&mux_dev->write_lock, flags);
remain = (MUX_HEADER_SIZE + len) % 4; dummy_cnt = ALIGN(MUX_HEADER_SIZE + len, 4);
dummy_cnt = remain ? (4 - remain) : 0;
total_len = len + MUX_HEADER_SIZE + dummy_cnt; total_len = len + MUX_HEADER_SIZE + dummy_cnt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment