All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Laszczak <pawell@cadence.com>
To: Joe Perches <joe@perches.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"rogerq@ti.com" <rogerq@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Alan Douglas <adouglas@cadence.com>,
	"jbergsagel@ti.com" <jbergsagel@ti.com>,
	"peter.chen@nxp.com" <peter.chen@nxp.com>,
	Pawel Jez <pjez@cadence.com>, Rahul Kumar <kurahul@cadence.com>
Subject: RE: [RFC PATCH v1 13/14] usb:cdns3: Adds debugging function.
Date: Mon, 5 Nov 2018 06:17:51 +0000	[thread overview]
Message-ID: <BYAPR07MB47098D7A1CF7941A6043F37CDDCA0@BYAPR07MB4709.namprd07.prod.outlook.com> (raw)
In-Reply-To: <63f0e18c8335b6431f0f7dcf0895c73d85b11fa4.camel@perches.com>

>> Patch implements some function used for debugging driver.
>[]
>> +static inline char *cdns3_decode_ep_irq(u32 ep_sts, const char *ep_name)
>> +{
>> +	static char str[256];
>> +	int ret;
>> +
>> +	ret = sprintf(str, "IRQ for %s: %08x ", ep_name, ep_sts);
>> +
>> +	if (ep_sts & EP_STS_SETUP)
>> +		ret += sprintf(str + ret, "SETUP ");
>> +	if (ep_sts & EP_STS_IOC)
>> +		ret += sprintf(str + ret, "IOC ");
>> +	if (ep_sts & EP_STS_ISP)
>> +		ret += sprintf(str + ret, "ISP ");
>> +	if (ep_sts & EP_STS_DESCMIS)
>> +		ret += sprintf(str + ret, "DESCMIS ");
>> +	if (ep_sts & EP_STS_STREAMR)
>> +		ret += sprintf(str + ret, "STREAMR ");
>> +	if (ep_sts & EP_STS_MD_EXIT)
>> +		ret += sprintf(str + ret, "MD_EXIT ");
>> +	if (ep_sts & EP_STS_TRBERR)
>> +		ret += sprintf(str + ret, "TRBERR ");
>> +	if (ep_sts & EP_STS_NRDY)
>> +		ret += sprintf(str + ret, "NRDY ");
>> +	if (ep_sts & EP_STS_PRIME)
>> +		ret += sprintf(str + ret, "PRIME ");
>> +	if (ep_sts & EP_STS_SIDERR)
>> +		ret += sprintf(str + ret, "SIDERRT ");
>> +	if (ep_sts & EP_STS_OUTSMM)
>> +		ret += sprintf(str + ret, "OUTSMM ");
>> +	if (ep_sts & EP_STS_ISOERR)
>> +		ret += sprintf(str + ret, "ISOERR ");
>> +	if (ep_sts & EP_STS_IOT)
>> +		ret += sprintf(str + ret, "IOT ");
>> +
>> +	return str;
>> +}
>
>This bit is pretty unsightly.
>Especially the static in each inline

Hi Joe.

I understood that you mean line 
static char str[256];
This array will be defined several times. 

I will remove inline form function definition. 
It's not necessary. 

>> +
>> +char *cdns3_decode_epx_irq(struct cdns3_endpoint *priv_ep)
>> +{
>> +	struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
>> +
>> +	return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts),
>> +				   priv_ep->name);
>> +}
>> +
>> +char *cdns3_decode_ep0_irq(struct cdns3_device *priv_dev, int dir)
>> +{
>> +	if (dir)
>> +		return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts),
>> +					   "ep0IN");
>> +	else
>> +		return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts),
>> +					   "ep0OUT");
>> +}
>> +
>[]
>> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
>[]
>> @@ -604,12 +604,15 @@ void cdns3_check_ep0_interrupt_proceed(struct cdns3_device *priv_dev, int dir)
>>  	cdns3_select_ep(priv_dev, 0 | (dir ? USB_DIR_IN : USB_DIR_OUT));
>>  	ep_sts_reg = readl(&regs->ep_sts);
>>
>> +	dev_dbg(&priv_dev->dev, "%s\n", cdns3_decode_ep0_irq(priv_dev, dir));
>[]
>> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
>[]
>> @@ -537,6 +547,8 @@ static int cdns3_check_ep_interrupt_proceed(struct cdns3_endpoint *priv_ep)
>>  	cdns3_select_ep(priv_dev, priv_ep->endpoint.address);
>>  	ep_sts_reg = readl(&regs->ep_sts);
>>
>> +	dev_dbg(&priv_dev->dev, "%s\n", cdns3_decode_epx_irq(priv_ep));
>>

Thank you for comment.
Cheers Pawel

WARNING: multiple messages have this Message-ID (diff)
From: Pawel Laszczak <pawell@cadence.com>
To: Joe Perches <joe@perches.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"rogerq@ti.com" <rogerq@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Alan Douglas <adouglas@cadence.com>,
	"jbergsagel@ti.com" <jbergsagel@ti.com>,
	"peter.chen@nxp.com" <peter.chen@nxp.com>,
	Pawel Jez <pjez@cadence.com>, Rahul Kumar <kurahul@cadence.com>
Subject: [RFC,v1,13/14] usb:cdns3: Adds debugging function.
Date: Mon, 5 Nov 2018 06:17:51 +0000	[thread overview]
Message-ID: <BYAPR07MB47098D7A1CF7941A6043F37CDDCA0@BYAPR07MB4709.namprd07.prod.outlook.com> (raw)

>> Patch implements some function used for debugging driver.
>[]
>> +static inline char *cdns3_decode_ep_irq(u32 ep_sts, const char *ep_name)
>> +{
>> +	static char str[256];
>> +	int ret;
>> +
>> +	ret = sprintf(str, "IRQ for %s: %08x ", ep_name, ep_sts);
>> +
>> +	if (ep_sts & EP_STS_SETUP)
>> +		ret += sprintf(str + ret, "SETUP ");
>> +	if (ep_sts & EP_STS_IOC)
>> +		ret += sprintf(str + ret, "IOC ");
>> +	if (ep_sts & EP_STS_ISP)
>> +		ret += sprintf(str + ret, "ISP ");
>> +	if (ep_sts & EP_STS_DESCMIS)
>> +		ret += sprintf(str + ret, "DESCMIS ");
>> +	if (ep_sts & EP_STS_STREAMR)
>> +		ret += sprintf(str + ret, "STREAMR ");
>> +	if (ep_sts & EP_STS_MD_EXIT)
>> +		ret += sprintf(str + ret, "MD_EXIT ");
>> +	if (ep_sts & EP_STS_TRBERR)
>> +		ret += sprintf(str + ret, "TRBERR ");
>> +	if (ep_sts & EP_STS_NRDY)
>> +		ret += sprintf(str + ret, "NRDY ");
>> +	if (ep_sts & EP_STS_PRIME)
>> +		ret += sprintf(str + ret, "PRIME ");
>> +	if (ep_sts & EP_STS_SIDERR)
>> +		ret += sprintf(str + ret, "SIDERRT ");
>> +	if (ep_sts & EP_STS_OUTSMM)
>> +		ret += sprintf(str + ret, "OUTSMM ");
>> +	if (ep_sts & EP_STS_ISOERR)
>> +		ret += sprintf(str + ret, "ISOERR ");
>> +	if (ep_sts & EP_STS_IOT)
>> +		ret += sprintf(str + ret, "IOT ");
>> +
>> +	return str;
>> +}
>
>This bit is pretty unsightly.
>Especially the static in each inline

Hi Joe.

I understood that you mean line 
static char str[256];
This array will be defined several times. 

I will remove inline form function definition. 
It's not necessary. 

>> +
>> +char *cdns3_decode_epx_irq(struct cdns3_endpoint *priv_ep)
>> +{
>> +	struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
>> +
>> +	return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts),
>> +				   priv_ep->name);
>> +}
>> +
>> +char *cdns3_decode_ep0_irq(struct cdns3_device *priv_dev, int dir)
>> +{
>> +	if (dir)
>> +		return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts),
>> +					   "ep0IN");
>> +	else
>> +		return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts),
>> +					   "ep0OUT");
>> +}
>> +
>[]
>> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
>[]
>> @@ -604,12 +604,15 @@ void cdns3_check_ep0_interrupt_proceed(struct cdns3_device *priv_dev, int dir)
>>  	cdns3_select_ep(priv_dev, 0 | (dir ? USB_DIR_IN : USB_DIR_OUT));
>>  	ep_sts_reg = readl(&regs->ep_sts);
>>
>> +	dev_dbg(&priv_dev->dev, "%s\n", cdns3_decode_ep0_irq(priv_dev, dir));
>[]
>> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
>[]
>> @@ -537,6 +547,8 @@ static int cdns3_check_ep_interrupt_proceed(struct cdns3_endpoint *priv_ep)
>>  	cdns3_select_ep(priv_dev, priv_ep->endpoint.address);
>>  	ep_sts_reg = readl(&regs->ep_sts);
>>
>> +	dev_dbg(&priv_dev->dev, "%s\n", cdns3_decode_epx_irq(priv_ep));
>>

Thank you for comment.
Cheers Pawel

  reply	other threads:[~2018-11-05  6:18 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03 17:51 [RFC PATCH v1 00/14] Introduced new Cadence USBSS DRD Driver Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 01/14] usb:cdns3: add pci to platform driver wrapper Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,01/14] " Pawel Laszczak
2018-11-06 13:48   ` [RFC PATCH v1 01/14] " Roger Quadros
2018-11-06 13:48     ` [RFC,v1,01/14] " Roger Quadros
2018-11-07  8:42     ` [RFC PATCH v1 01/14] " Pawel Laszczak
2018-11-07  8:42       ` [RFC,v1,01/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 02/14] usb:cdns3: Device side header file Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,02/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 03/14] usb:cdns3: Driver initialization code Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,03/14] " Pawel Laszczak
2018-11-06 14:18   ` [RFC PATCH v1 03/14] " Roger Quadros
2018-11-06 14:18     ` [RFC,v1,03/14] " Roger Quadros
2018-11-07 13:14     ` [RFC PATCH v1 03/14] " Pawel Laszczak
2018-11-07 13:14       ` [RFC,v1,03/14] " Pawel Laszczak
2018-11-06 14:44   ` [RFC PATCH v1 03/14] " Roger Quadros
2018-11-06 14:44     ` [RFC,v1,03/14] " Roger Quadros
2018-11-08 11:38     ` [RFC PATCH v1 03/14] " Pawel Laszczak
2018-11-08 11:38       ` [RFC,v1,03/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 04/14] usb:cdns3: Added DRD support Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,04/14] " Pawel Laszczak
2018-11-06 14:32   ` [RFC PATCH v1 04/14] " Roger Quadros
2018-11-06 14:32     ` [RFC,v1,04/14] " Roger Quadros
2018-11-08 11:33     ` [RFC PATCH v1 04/14] " Pawel Laszczak
2018-11-08 11:33       ` [RFC,v1,04/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 05/14] usb:cdns3: Added Wrapper to XCHI driver Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,05/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 06/14] usb:cdns3: Initialization code for Device side Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,06/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 07/14] usb:cdns3: Implements device operations part of the API Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,07/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 08/14] usb:cdns3: EpX " Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,08/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 09/14] usb:cdns3: Ep0 " Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,09/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 10/14] usb:cdns3: Implements ISR functionality Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,10/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 11/14] usb:cdns3: Adds enumeration related function Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,11/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 12/14] usb:cdns3: Adds transfer " Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,12/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 13/14] usb:cdns3: Adds debugging function Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,13/14] " Pawel Laszczak
2018-11-03 19:14   ` [RFC PATCH v1 13/14] " Joe Perches
2018-11-03 19:14     ` [RFC,v1,13/14] " Joe Perches
2018-11-05  6:17     ` Pawel Laszczak [this message]
2018-11-05  6:17       ` Pawel Laszczak
2018-11-08  9:34   ` [RFC PATCH v1 13/14] " Roger Quadros
2018-11-08  9:34     ` [RFC,v1,13/14] " Roger Quadros
2018-11-08 12:03     ` [RFC PATCH v1 13/14] " Pawel Laszczak
2018-11-08 12:03       ` [RFC,v1,13/14] " Pawel Laszczak
2018-11-03 17:51 ` [RFC PATCH v1 14/14] usb:cdns3: Feature for changing role Pawel Laszczak
2018-11-03 17:51   ` [RFC,v1,14/14] " Pawel Laszczak
2018-11-06 14:51   ` [RFC PATCH v1 14/14] " Roger Quadros
2018-11-06 14:51     ` [RFC,v1,14/14] " Roger Quadros
2018-11-08 11:51     ` [RFC PATCH v1 14/14] " Pawel Laszczak
2018-11-08 11:51       ` [RFC,v1,14/14] " Pawel Laszczak
2018-11-08 14:22       ` [RFC PATCH v1 14/14] " Roger Quadros
2018-11-08 14:22         ` [RFC,v1,14/14] " Roger Quadros

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=BYAPR07MB47098D7A1CF7941A6043F37CDDCA0@BYAPR07MB4709.namprd07.prod.outlook.com \
    --to=pawell@cadence.com \
    --cc=adouglas@cadence.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbergsagel@ti.com \
    --cc=joe@perches.com \
    --cc=kurahul@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@nxp.com \
    --cc=pjez@cadence.com \
    --cc=rogerq@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.