All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tanya Brokhman" <tlinder@codeaurora.org>
To: 'Sebastian Andrzej Siewior' <bigeasy@linutronix.de>
Cc: greg@kroah.com, linux-usb@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, balbi@ti.com,
	ablay@codeaurora.org, 'open list' <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v9 7/7] usb: Adding SuperSpeed support to dummy_hcd
Date: Thu, 12 May 2011 08:19:53 +0300	[thread overview]
Message-ID: <000b01cc1064$3b7e51d0$b27af570$@org> (raw)
In-Reply-To: <20110509174910.GA7025@linutronix.de>

> > static int dummy_hcd_probe(struct platform_device *pdev)
> > {
> >-	struct usb_hcd		*hcd;
> >+	struct usb_hcd		*hs_hcd;
> >+	struct usb_hcd		*ss_hcd;
> > 	int			retval;
> >
> > 	dev_info(&pdev->dev, "%s, driver " DRIVER_VERSION "\n",
> driver_desc);
> >
> >-	hcd = usb_create_hcd(&dummy_hcd, &pdev->dev, dev_name(&pdev-
> >dev));
> >-	if (!hcd)
> >+	hs_hcd = usb_create_hcd(&dummy_hcd, &pdev->dev, dev_name(&pdev-
> >dev));
> >+	if (!hs_hcd)
> > 		return -ENOMEM;
> >-	the_controller = hcd_to_dummy (hcd);
> >
> >-	retval = usb_add_hcd(hcd, 0, 0);
> >-	if (retval != 0) {
> >-		usb_put_hcd (hcd);
> >-		the_controller = NULL;
> >+	hs_hcd->speed = HCD_USB2;
> Why do you overwrite the speed here and in ->reset()?

You're right. No need for this. I'll remove the above line and the speed
will be set at dummy_setup (->reset())

> >+
> >+	retval = usb_add_hcd(hs_hcd, 0, IRQF_DISABLED | IRQF_SHARED);
> Why IRQF_DISABLED | IRQF_SHARED? you don't interrupts at all.

I used xhci as reference for this patch. This is the way xhci driver adds
the hcds. You can find it in xhci_pci_probe(). 
I'm not very familiar with how this two hcds (main and shared shcd) will
work together so I thought these flags are needed for their co-operation. 
Was my assumption mistaken? What flags should I use? 

Also, Sergei pointed out that IRQF_DISABLED is deprecated so it seems to me
that xhci needs an update as well....

> >+	if (retval != 0)
> >+		usb_put_hcd(hs_hcd);
> Your error recovery is broken here. You have to leave instead of
> continue with SS.
> 

Thanks for catching that!


Best regards,
Tanya Brokhman
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

WARNING: multiple messages have this Message-ID (diff)
From: "Tanya Brokhman" <tlinder@codeaurora.org>
To: "'Sebastian Andrzej Siewior'" <bigeasy@linutronix.de>
Cc: <greg@kroah.com>, <linux-usb@vger.kernel.org>,
	<linux-arm-msm@vger.kernel.org>, <balbi@ti.com>,
	<ablay@codeaurora.org>,
	"'open list'" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v9 7/7] usb: Adding SuperSpeed support to dummy_hcd
Date: Thu, 12 May 2011 08:19:53 +0300	[thread overview]
Message-ID: <000b01cc1064$3b7e51d0$b27af570$@org> (raw)
In-Reply-To: <20110509174910.GA7025@linutronix.de>

> > static int dummy_hcd_probe(struct platform_device *pdev)
> > {
> >-	struct usb_hcd		*hcd;
> >+	struct usb_hcd		*hs_hcd;
> >+	struct usb_hcd		*ss_hcd;
> > 	int			retval;
> >
> > 	dev_info(&pdev->dev, "%s, driver " DRIVER_VERSION "\n",
> driver_desc);
> >
> >-	hcd = usb_create_hcd(&dummy_hcd, &pdev->dev, dev_name(&pdev-
> >dev));
> >-	if (!hcd)
> >+	hs_hcd = usb_create_hcd(&dummy_hcd, &pdev->dev, dev_name(&pdev-
> >dev));
> >+	if (!hs_hcd)
> > 		return -ENOMEM;
> >-	the_controller = hcd_to_dummy (hcd);
> >
> >-	retval = usb_add_hcd(hcd, 0, 0);
> >-	if (retval != 0) {
> >-		usb_put_hcd (hcd);
> >-		the_controller = NULL;
> >+	hs_hcd->speed = HCD_USB2;
> Why do you overwrite the speed here and in ->reset()?

You're right. No need for this. I'll remove the above line and the speed
will be set at dummy_setup (->reset())

> >+
> >+	retval = usb_add_hcd(hs_hcd, 0, IRQF_DISABLED | IRQF_SHARED);
> Why IRQF_DISABLED | IRQF_SHARED? you don't interrupts at all.

I used xhci as reference for this patch. This is the way xhci driver adds
the hcds. You can find it in xhci_pci_probe(). 
I'm not very familiar with how this two hcds (main and shared shcd) will
work together so I thought these flags are needed for their co-operation. 
Was my assumption mistaken? What flags should I use? 

Also, Sergei pointed out that IRQF_DISABLED is deprecated so it seems to me
that xhci needs an update as well....

> >+	if (retval != 0)
> >+		usb_put_hcd(hs_hcd);
> Your error recovery is broken here. You have to leave instead of
> continue with SS.
> 

Thanks for catching that!


Best regards,
Tanya Brokhman
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum





  parent reply	other threads:[~2011-05-12  5:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-08 11:16 [PATCH v9 0/7] usb gadget: Add SuperSpeed support to the Gadget Framework Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 1/7] usb: Add usb_endpoint_descriptor to be part of the struct usb_ep Tatyana Brokhman
2011-05-08 11:16   ` Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 2/7] usb: Configure endpoint according to gadget speed Tatyana Brokhman
2011-05-08 11:16   ` Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 3/7] usb: Modify existing gadget drivers to use config_ep_by_speed() instead of ep_choose Tatyana Brokhman
2011-05-08 11:16   ` Tatyana Brokhman
2011-05-08 11:16 ` [PATCH v9 4/7] usb:gadget: Add SuperSpeed support to the Gadget Framework Tatyana Brokhman
2011-05-08 11:16   ` Tatyana Brokhman
2011-05-09  9:19   ` Felipe Balbi
2011-05-11 13:00     ` Tanya Brokhman
2011-05-11 13:00       ` Tanya Brokhman
     [not found] ` <1304853414-10234-1-git-send-email-tlinder-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-08 11:16   ` [PATCH v9 5/7] usb: Add streams support to the gadget framework Tatyana Brokhman
2011-05-08 11:16     ` Tatyana Brokhman
2011-05-09  9:25     ` Felipe Balbi
2011-05-11 13:29       ` Tanya Brokhman
2011-05-11 13:29         ` Tanya Brokhman
2011-05-11 20:54         ` Felipe Balbi
2011-05-08 11:16   ` [PATCH v9 6/7] usb:gadget: Introduce usb_generate_ss_descriptors() Tatyana Brokhman
2011-05-08 11:16     ` Tatyana Brokhman
2011-05-08 11:16   ` [PATCH v9 7/7] usb: Adding SuperSpeed support to dummy_hcd Tatyana Brokhman
2011-05-08 11:16     ` Tatyana Brokhman
2011-05-09 17:49     ` Sebastian Andrzej Siewior
2011-05-10 11:24       ` Sergei Shtylyov
2011-05-12  5:19       ` Tanya Brokhman [this message]
2011-05-12  5:19         ` Tanya Brokhman
2011-05-12 14:45         ` Alan Stern
2011-05-12 14:45           ` Alan Stern

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='000b01cc1064$3b7e51d0$b27af570$@org' \
    --to=tlinder@codeaurora.org \
    --cc=ablay@codeaurora.org \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=greg@kroah.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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.