linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_fs: Use stream_open() for endpoint files
@ 2021-11-11 11:11 Pavankumar Kondeti
  2021-11-11 11:38 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Pavankumar Kondeti @ 2021-11-11 11:11 UTC (permalink / raw)
  To: linux-kernel, linux-usb
  Cc: Pavankumar Kondeti, Felipe Balbi, Greg Kroah-Hartman, Jens Axboe,
	Peter Chen, Jack Pham, Dean Anderson, Salah Triki,
	Andrew Gabbasov, kernel test robot

Function fs endpoint files does not have the notion of file position.
So switch to stream like functionality. This allows concurrent threads
to be blocked in the ffs read/write operations which use ffs_mutex_lock().
The ffs mutex lock deploys interruptible wait. Otherwise, threads are
blocking for the mutex lock in __fdget_pos(). For whatever reason, ff the
host does not send/receive data for longer time, hung task warnings
are observed.

Change-Id: I602fa56fb5ed4c8c46e19df68c3335c4b12cae81
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
---
 drivers/usb/gadget/function/f_fs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index e20c19a..3c584da 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -614,7 +614,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file)
 	file->private_data = ffs;
 	ffs_data_opened(ffs);
 
-	return 0;
+	return stream_open(inode, file);
 }
 
 static int ffs_ep0_release(struct inode *inode, struct file *file)
@@ -1154,7 +1154,7 @@ ffs_epfile_open(struct inode *inode, struct file *file)
 	file->private_data = epfile;
 	ffs_data_opened(epfile->ffs);
 
-	return 0;
+	return stream_open(inode, file);
 }
 
 static int ffs_aio_cancel(struct kiocb *kiocb)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-15 13:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 11:11 [PATCH] usb: gadget: f_fs: Use stream_open() for endpoint files Pavankumar Kondeti
2021-11-11 11:38 ` Greg Kroah-Hartman
2021-11-11 12:06   ` Pavan Kondeti
2021-11-11 12:15     ` [PATCH v2] " Pavankumar Kondeti
2021-11-11 13:12       ` Greg Kroah-Hartman
2021-11-12  3:17         ` Pavan Kondeti
2021-11-12  6:48           ` Greg Kroah-Hartman
2021-11-12 10:24             ` [PATCH v3] " Pavankumar Kondeti
2021-11-15 13:04               ` John Keeping

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).