From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
Jassi Brar <jaswinder.singh@linaro.org>,
alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 4.14 42/64] mailbox: mailbox-test: don't rely on rx_buffer content to signal data ready
Date: Sat, 2 Dec 2017 15:51:34 +0000 [thread overview]
Message-ID: <20171202155101.7573-42-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171202155101.7573-1-alexander.levin@verizon.com>
From: Sudeep Holla <sudeep.holla@arm.com>
[ Upstream commit e339c80af95e14de3712d69ddea09a3868fa14cd ]
Currently we rely on the first byte of the Rx buffer to check if there's
any data available to be read. If the first byte of the received buffer
is zero (i.e. null character), then we fail to signal that data is
available even when it's available.
Instead introduce a boolean variable to track the data availability and
update it in the channel receive callback as ready and clear it when the
data is read.
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
drivers/mailbox/mailbox-test.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index 97fb956bb6e0..93f3d4d61fa7 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -30,6 +30,7 @@
#define MBOX_HEXDUMP_MAX_LEN (MBOX_HEXDUMP_LINE_LEN * \
(MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE))
+static bool mbox_data_ready;
static struct dentry *root_debugfs_dir;
struct mbox_test_device {
@@ -152,16 +153,14 @@ out:
static bool mbox_test_message_data_ready(struct mbox_test_device *tdev)
{
- unsigned char data;
+ bool data_ready;
unsigned long flags;
spin_lock_irqsave(&tdev->lock, flags);
- data = tdev->rx_buffer[0];
+ data_ready = mbox_data_ready;
spin_unlock_irqrestore(&tdev->lock, flags);
- if (data != '\0')
- return true;
- return false;
+ return data_ready;
}
static ssize_t mbox_test_message_read(struct file *filp, char __user *userbuf,
@@ -223,6 +222,7 @@ static ssize_t mbox_test_message_read(struct file *filp, char __user *userbuf,
*(touser + l) = '\0';
memset(tdev->rx_buffer, 0, MBOX_MAX_MSG_LEN);
+ mbox_data_ready = false;
spin_unlock_irqrestore(&tdev->lock, flags);
@@ -292,6 +292,7 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message)
message, MBOX_MAX_MSG_LEN);
memcpy(tdev->rx_buffer, message, MBOX_MAX_MSG_LEN);
}
+ mbox_data_ready = true;
spin_unlock_irqrestore(&tdev->lock, flags);
wake_up_interruptible(&tdev->waitq);
--
2.11.0
next prev parent reply other threads:[~2017-12-02 16:18 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-02 15:51 [PATCH AUTOSEL for 4.14 01/64] irqchip/qcom: Fix u32 comparison with value less than zero alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 02/64] net: ipv6: Fixup device for anycast routes during copy alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 03/64] net/smc: use sk_rcvbuf as start for rmb creation alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 04/64] kbuild: pkg: use --transform option to prefix paths in tar alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 08/64] apparmor: fix leak of null profile name if profile allocation fails alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 06/64] powerpc/perf: Fix pmu_count to count only nest imc pmus alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 07/64] net: qmi_wwan: add Quectel BG96 2c7c:0296 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 05/64] coccinelle: fix parallel build with CHECK=scripts/coccicheck alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 09/64] x86/mpx/selftests: Fix up weird arrays alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 11/64] tun: fix rcu_read_lock imbalance in tun_build_skb alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 10/64] mac80211_hwsim: Fix memory leak in hwsim_new_radio_nl() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 13/64] tcp: when scheduling TLP, time of RTO should account for current ACK alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 12/64] gre6: use log_ecn_error module parameter in ip6_tnl_rcv() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 14/64] route: also update fnhe_genid when updating a route cache alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 15/64] route: update fnhe_expires for redirect when the fnhe exists alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 16/64] rsi: fix memory leak on buf and usb_reg_buf alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 17/64] drivers/rapidio/devices/rio_mport_cdev.c: fix resource leak in error handling path in 'rio_dma_transfer()' alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 18/64] pipe: match pipe_max_size data type with procfs alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 19/64] lib/genalloc.c: make the avail variable an atomic_long_t alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 20/64] dynamic-debug-howto: fix optional/omitted ending line number to be LARGE instead of 0 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 21/64] NFS: Fix a typo in nfs_rename() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 22/64] sunrpc: Fix rpc_task_begin trace point alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 23/64] nfp: inherit the max_mtu from the PF netdev alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 25/64] xfs: fix forgotten rcu read unlock when skipping inode reclaim alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 24/64] nfp: fix flower offload metadata flag usage alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 28/64] sparc64/mm: set fields in deferred pages alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 26/64] dt-bindings: usb: fix reg-property port-number range alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 27/64] block: wake up all tasks blocked in get_request() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 30/64] slub: fix sysfs duplicate filename creation when slub_debug=O alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 31/64] sctp: do not free asoc when it is already dead in sctp_sendmsg alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 29/64] zsmalloc: calling zs_map_object() from irq is a bug alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 32/64] sctp: use the right sk after waking up from wait_buf sleep alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 33/64] fcntl: don't leak fd reference when fixup_compat_flock fails alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 34/64] geneve: fix fill_info when link down alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 35/64] bpf: fix lockdep splat alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 36/64] ipv6: set all.accept_dad to 0 by default alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 37/64] clk: stm32h7: fix test of clock config alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 38/64] clk: sunxi-ng: a83t: Fix i2c buses bits alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 40/64] clk: uniphier: fix DAPLL2 clock rate of Pro5 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 39/64] clk: qcom: common: fix legacy board-clock registration alexander.levin
2017-12-02 15:51 ` alexander.levin [this message]
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 41/64] clk: hi3660: fix incorrect uart3 clock freqency alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 45/64] jump_label: Invoke jump_label_test() via early_initcall() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 43/64] kbuild: rpm-pkg: fix jobserver unavailable warning alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 46/64] tls: Use kzalloc for aead_request allocation alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 44/64] atm: horizon: Fix irq release error alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 47/64] xfrm: Copy policy family in clone_policy alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 49/64] bnxt_re: changing the ip address shouldn't affect new connections alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 50/64] IB/mlx4: Increase maximal message size under UD QP alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 48/64] f2fs: fix to clear FI_NO_PREALLOC alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 52/64] afs: Fix total-length calculation for multiple-page send alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 51/64] IB/mlx5: Assign send CQ and recv CQ of UMR QP alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 53/64] afs: Connect up the CB.ProbeUuid alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 55/64] powerpc/powernv/idle: Round up latency and residency values alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 54/64] kbuild: do not call cc-option before KBUILD_CFLAGS initialization alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 57/64] ide: ide-atapi: fix compile error with defining macro DEBUG alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 56/64] ipvlan: fix ipv6 outbound device alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 59/64] nvmet-rdma: update queue list during ib_device removal alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 58/64] blk-mq: Avoid that request queue removal can trigger list corruption alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 60/64] audit: Allow auditd to set pid to 0 to end auditing alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 62/64] dm raid: fix panic when attempting to force a raid to sync alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 61/64] audit: ensure that 'audit=1' actually enables audit for PID 1 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 63/64] md: free unused memory after bitmap resize alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 64/64] RDMA/cxgb4: Annotate r2 and stag as __be32 alexander.levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171202155101.7573-42-alexander.levin@verizon.com \
--to=alexander.levin@verizon.com \
--cc=jaswinder.singh@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®