public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: randy.dunlap@intel.com, david-b@pacbell.net
Cc: linux-kernel@vger.kernel.org, zaitcev@redhat.com, teg@redhat.com
Subject: Fix to khubd oops, hellooo?
Date: Tue, 13 Mar 2001 15:44:58 -0500	[thread overview]
Message-ID: <20010313154458.A2362@devserv.devel.redhat.com> (raw)

Is my fix to khubd going anywhere? Randy, David?
I have an actual, reproducible bug that I need to close.
Here's my message to linux-usb-devel with explanations:
  http://marc.theaimsgroup.com/?l=linux-usb-devel&m=98411157628404&w=2

-- Pete

diff -ur -X ../dontdiff linux-2.4.2-ac12/drivers/usb/hub.c linux-2.4.2-ac12-p3/drivers/usb/hub.c
--- linux-2.4.2-ac12/drivers/usb/hub.c	Wed Mar  7 12:17:02 2001
+++ linux-2.4.2-ac12-p3/drivers/usb/hub.c	Thu Mar  8 19:43:14 2001
@@ -357,6 +357,7 @@
 
 	INIT_LIST_HEAD(&hub->event_list);
 	hub->dev = dev;
+	init_MUTEX(&hub->khubd_sem);
 
 	/* Record the new hub's existence */
 	spin_lock_irqsave(&hub_event_lock, flags);
@@ -400,6 +399,9 @@
 
 	spin_unlock_irqrestore(&hub_event_lock, flags);
 
+	down(&hub->khubd_sem);	/* Wait for khubd to leave this hub alone. */
+	up(&hub->khubd_sem);
+
 	if (hub->urb) {
 		usb_unlink_urb(hub->urb);
 		usb_free_urb(hub->urb);
@@ -709,7 +717,7 @@
 		spin_lock_irqsave(&hub_event_lock, flags);
 
 		if (list_empty(&hub_event_list))
-			goto he_unlock;
+			break;
 
 		/* Grab the next entry from the beginning of the list */
 		tmp = hub_event_list.next;
@@ -720,6 +728,7 @@
 		list_del(tmp);
 		INIT_LIST_HEAD(tmp);
 
+		down(&hub->khubd_sem);	/* never blocks, we were on list */
 		spin_unlock_irqrestore(&hub_event_lock, flags);
 
 		if (hub->error) {
@@ -728,6 +737,7 @@
 			if (usb_hub_reset(hub)) {
 				err("error resetting hub %d - disconnecting", dev->devnum);
 				usb_hub_disconnect(dev);
+				up(&hub->khubd_sem);
 				continue;
 			}
 
@@ -742,6 +752,7 @@
 			ret = usb_get_port_status(dev, i + 1, &portsts);
 			if (ret < 0) {
 				err("get_port_status failed (err = %d)", ret);
+				up(&hub->khubd_sem);
 				continue;
 			}
 
@@ -803,9 +814,9 @@
                         	usb_hub_power_on(hub);
 			}
 		}
+		up(&hub->khubd_sem);
         } /* end while (1) */
 
-he_unlock:
 	spin_unlock_irqrestore(&hub_event_lock, flags);
 }
 
diff -ur -X ../dontdiff linux-2.4.2-ac12/drivers/usb/hub.h linux-2.4.2-ac12-p3/drivers/usb/hub.h
--- linux-2.4.2-ac12/drivers/usb/hub.h	Wed Mar  7 12:17:02 2001
+++ linux-2.4.2-ac12-p3/drivers/usb/hub.h	Thu Mar  8 19:17:38 2001
@@ -134,6 +134,8 @@
 	struct list_head event_list;
 
 	struct usb_hub_descriptor *descriptor;
+
+	struct semaphore khubd_sem;
 };
 
 #endif /* __LINUX_HUB_H */

                 reply	other threads:[~2001-03-13 21:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20010313154458.A2362@devserv.devel.redhat.com \
    --to=zaitcev@redhat.com \
    --cc=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@intel.com \
    --cc=teg@redhat.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