On 3/26/2023 2:29 PM, Greg Kroah-Hartman wrote:
On Sun, Mar 26, 2023 at 10:55:18AM +0800, Linyu Yuan wrote:
On 3/25/2023 5:00 PM, Greg Kroah-Hartman wrote:
On Fri, Mar 24, 2023 at 02:10:27PM +0800, Linyu Yuan wrote:
when multiple instances in use, the debug message is hard to understand
as there is no instance name show.
this change will show each instance name for debug messages.
Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
---
v2: split to several changes according to v1 comments
v1: https://lore.kernel.org/linux-usb/1679481369-30094-1-git-send-email-quic_linyyuan@xxxxxxxxxxx/
drivers/usb/gadget/function/f_fs.c | 136 +++++++++++++++++++------------------
1 file changed, 69 insertions(+), 67 deletions(-)
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index a4051c8..df67ab5 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -317,12 +317,12 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)
static int __ffs_ep0_stall(struct ffs_data *ffs)
{
if (ffs->ev.can_stall) {
- pr_vdebug("ep0 stall\n");
+ pr_vdebug("%s: ep0 stall\n", ffs->dev_name);
Again, no, please use dev_dbg() instead. Do NOT roll your own debugging
macros. You have access to a struct device pointer for this device that
the driver is controlling, so please always use that instead.
thanks for your suggestion, i didn't know dev_dbg can accept NULL dev
pointer
as this driver have no real struct device.
That is not true, you have access to a struct usb_gadget, which is a
struct device. Use that please.
but this is not good, as for gadget/udc, from my view, there are two layer,
one configfs driver, one lower UDC, only after bind, there will be a
reference to usb_gadget.
but configuration to driver can happen before bind, if so the usb_gadget
will be NULL.
will change to dev_dbg with NULL dev pointer.
No, that is pointless, please do not do that.
thanks,
greg k-h