linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pawel Laszczak <pawell@cadence.com>
To: Peter Chen <peter.chen@nxp.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"balbi@kernel.org" <balbi@kernel.org>,
	"colin.king@canonical.com" <colin.king@canonical.com>,
	"rogerq@ti.com" <rogerq@ti.com>,
	Jayshri Dajiram Pawar <jpawar@cadence.com>,
	Rahul Kumar <kurahul@cadence.com>,
	Sanket Parmar <sparmar@cadence.com>,
	"nsekhar@ti.com" <nsekhar@ti.com>,
	"heikki.krogerus@linux.intel.com"
	<heikki.krogerus@linux.intel.com>,
	"chunfeng.yun@mediatek.com" <chunfeng.yun@mediatek.com>,
	"yanaijie@huawei.com" <yanaijie@huawei.com>
Subject: RE: [PATCH 5/8] usb: cdns3: Changed type of gadget_dev in cdns structure
Date: Mon, 5 Oct 2020 06:15:33 +0000	[thread overview]
Message-ID: <DM6PR07MB5529DD806756B5EB36A2B6B4DD0C0@DM6PR07MB5529.namprd07.prod.outlook.com> (raw)
In-Reply-To: <DM6PR07MB55293E7DAC48DBB3000AE6EEDD300@DM6PR07MB5529.namprd07.prod.outlook.com>

>>
>>On 20-09-28 14:27:38, Pawel Laszczak wrote:
>>> Patch changes the type for gadget_dev pointer in cdns structure from
>>> pointer to cdns3_device structure to void pointer.
>>> This filed is in reusable code and after this change it will be used to
>>> point to both cdns3_device or cdnsp_device objects.
>>>
>>> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
>>> ---
>>>  drivers/usb/cdns3/core.h   | 4 ++--
>>>  drivers/usb/cdns3/gadget.c | 6 ++++++
>>>  2 files changed, 8 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h
>>> index 0c6e14683b36..267923904a37 100644
>>> --- a/drivers/usb/cdns3/core.h
>>> +++ b/drivers/usb/cdns3/core.h
>>> @@ -55,7 +55,7 @@ struct cdns_role_driver {
>>>   * @roles: array of supported roles for this controller
>>>   * @role: current role
>>>   * @host_dev: the child host device pointer for cdns core
>>> - * @gadget_dev: the child gadget device pointer for cdns3 core
>>> + * @gadget_dev: the child gadget device pointer
>>>   * @usb2_phy: pointer to USB2 PHY
>>>   * @usb3_phy: pointer to USB3 PHY
>>>   * @mutex: the mutex for concurrent code at driver
>>> @@ -87,7 +87,7 @@ struct cdns {
>>>  	struct cdns_role_driver	*roles[USB_ROLE_DEVICE + 1];
>>>  	enum usb_role			role;
>>>  	struct platform_device		*host_dev;
>>> -	struct cdns3_device		*gadget_dev;
>>> +	void				*gadget_dev;
>>>  	struct phy			*usb2_phy;
>>>  	struct phy			*usb3_phy;
>>>  	/* mutext used in workqueue*/
>>> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
>>> index 26f68182e65e..f9cbc84bbfb8 100644
>>> --- a/drivers/usb/cdns3/gadget.c
>>> +++ b/drivers/usb/cdns3/gadget.c
>>> @@ -3177,7 +3177,9 @@ static int __cdns3_gadget_init(struct cdns *cdns)
>>>  static int cdns3_gadget_suspend(struct cdns *cdns, bool do_wakeup)
>>>  {
>>>  	struct cdns3_device *priv_dev = cdns->gadget_dev;
>>> +	unsigned long flags;
>>>
>>> +	spin_lock_irqsave(&priv_dev->lock, flags);
>>
>>unrelated changes?
>
>It's needed but this patch has missing removing this line from:
>cdns3_suspend/cdns3_resume from core.c file.
>It exists in patch 2 (usb: cdns3: Split core.c into cdns3-plat and core.c file).
>I will correct this patch.
>
>I had to move this spin_lock because in core.c we don't know the
>cdns->gadget_dev type (void * gadget_dev).
>

You have right, after merging  the latest patches from Felipe 
repository this changes are not need.

Regards,
Pawel,

>
>>
>>>  	cdns3_disconnect_gadget(priv_dev);
>>>
>>>  	priv_dev->gadget.speed = USB_SPEED_UNKNOWN;
>>> @@ -3186,6 +3188,7 @@ static int cdns3_gadget_suspend(struct cdns *cdns, bool do_wakeup)
>>>
>>>  	/* disable interrupt for device */
>>>  	writel(0, &priv_dev->regs->usb_ien);
>>> +	spin_unlock_irqrestore(&priv_dev->lock, flags);
>>>
>>>  	return 0;
>>>  }
>>> @@ -3193,11 +3196,14 @@ static int cdns3_gadget_suspend(struct cdns *cdns, bool do_wakeup)
>>>  static int cdns3_gadget_resume(struct cdns *cdns, bool hibernated)
>>>  {
>>>  	struct cdns3_device *priv_dev = cdns->gadget_dev;
>>> +	unsigned long flags;
>>>
>>>  	if (!priv_dev->gadget_driver)
>>>  		return 0;
>>>
>>> +	spin_lock_irqsave(&priv_dev->lock, flags);
>>
>>ditto
>>
>>>  	cdns3_gadget_config(priv_dev);
>>> +	spin_unlock_irqrestore(&priv_dev->lock, flags);
>>>
>>>  	return 0;
>>>  }
>>> --
>>> 2.17.1
>>>
>>
>>--
>>
>>Thanks,
>>Peter Chen

  reply	other threads:[~2020-10-05  6:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 12:27 [PATCH 0/8] Introduced new Cadence USBSSP DRD Driver Pawel Laszczak
2020-09-28 12:27 ` [PATCH 1/8] usb: cdns3: Add support for DRD CDNSP Pawel Laszczak
2020-09-28 12:27 ` [PATCH 2/8] usb: cdns3: Split core.c into cdns3-plat and core.c file Pawel Laszczak
2020-09-29  1:46   ` Chunfeng Yun
2020-09-30  5:22     ` Pawel Laszczak
2020-09-30  7:38       ` Pawel Laszczak
2020-09-29  3:37   ` Peter Chen
2020-09-30  9:35     ` Pawel Laszczak
2020-09-28 12:27 ` [PATCH 3/8] usb: cdns3: Moves reusable code to separate module Pawel Laszczak
2020-09-28 12:27 ` [PATCH 4/8] usb: cdns3: Refactoring names in reusable code Pawel Laszczak
2020-09-28 12:27 ` [PATCH 5/8] usb: cdns3: Changed type of gadget_dev in cdns structure Pawel Laszczak
2020-09-29  4:36   ` Peter Chen
2020-10-01  4:40     ` Pawel Laszczak
2020-10-05  6:15       ` Pawel Laszczak [this message]
2020-09-28 12:27 ` [PATCH 6/8] usb: cdnsp: Device side header file for CDNSP driver Pawel Laszczak
2020-09-29  2:26   ` Chunfeng Yun
2020-09-30  8:55     ` Pawel Laszczak
2020-09-29  4:37   ` Peter Chen
2020-09-30  9:22     ` Pawel Laszczak
2020-09-28 12:27 ` [PATCH 7/8] usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver Pawel Laszczak
2020-09-29  4:27   ` Chunfeng Yun
2020-09-30 11:58     ` Pawel Laszczak
2020-09-29  4:46   ` Peter Chen
2020-09-30 13:01     ` Pawel Laszczak
2020-09-28 12:27 ` [PATCH 8/8] usb: cdnsp: Add tracepoints for CDNSP driver Pawel Laszczak
2020-09-29  3:24 ` [PATCH 0/8] Introduced new Cadence USBSSP DRD Driver Peter Chen
2020-09-30  7:43   ` Pawel Laszczak

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=DM6PR07MB5529DD806756B5EB36A2B6B4DD0C0@DM6PR07MB5529.namprd07.prod.outlook.com \
    --to=pawell@cadence.com \
    --cc=balbi@kernel.org \
    --cc=chunfeng.yun@mediatek.com \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jpawar@cadence.com \
    --cc=kurahul@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=peter.chen@nxp.com \
    --cc=rogerq@ti.com \
    --cc=sparmar@cadence.com \
    --cc=yanaijie@huawei.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;
as well as URLs for NNTP newsgroup(s).