diff mbox series

usb: gadget: f_fs: Use stream_open() for endpoint files

Message ID 1636629117-2206-1-git-send-email-quic_pkondeti@quicinc.com (mailing list archive)
State Superseded
Headers show
Series usb: gadget: f_fs: Use stream_open() for endpoint files | expand

Commit Message

Pavan Kondeti Nov. 11, 2021, 11:11 a.m. UTC
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(-)

Comments

Greg Kroah-Hartman Nov. 11, 2021, 11:38 a.m. UTC | #1
On Thu, Nov 11, 2021 at 04:41:55PM +0530, Pavankumar Kondeti wrote:
> 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

Always run scripts/checkpatch.pl on your patches so you do not get
grumpy maintainers asking you to run scripts/checkpatch.pl on them...

thanks,

greg k-h
Pavan Kondeti Nov. 11, 2021, 12:06 p.m. UTC | #2
Hi Greg,

On Thu, Nov 11, 2021 at 12:38:26PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Nov 11, 2021 at 04:41:55PM +0530, Pavankumar Kondeti wrote:
> > 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
> 
> Always run scripts/checkpatch.pl on your patches so you do not get
> grumpy maintainers asking you to run scripts/checkpatch.pl on them...
> 
Thanks for taking a look at the patch. My bad, I have applied the patch
from a recent android tree and carry forwarded this tag. I will fix it.

Thanks,
Pavan
diff mbox series

Patch

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)