[PATCH]mdc800: proper memory barriers
Oliver Neukum <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Organization | Novell |
| Message-ID | <[email protected]> |
Hi, some drivers were indeed written before the days of out of order execution and it shows. This adds the barriers that make sure that the flags are set in the proper order. Regards Oliver Signed-off-by: Oliver Neukum <[email protected]> -- --- a/drivers/usb/image/mdc800.c 2007-03-30 12:17:06.000000000 +0200 +++ b/drivers/usb/image/mdc800.c 2007-03-30 12:17:11.000000000 +0200 @@ -280,7 +280,7 @@ /* * USB IRQ Handler for InputLine */ -static void mdc800_usb_irq (struct urb *urb) +static void mdc800_usb_irq(struct urb *urb) { int data_received=0, wake_up; unsigned char* b=urb->transfer_buffer; @@ -330,7 +330,9 @@ if (wake_up) { + smp_mb(); mdc800->camera_request_ready=0; + smp_wmb(); mdc800->irq_woken=1; wake_up (&mdc800->irq_wait); } @@ -349,6 +351,7 @@ static int mdc800_usb_waitForIRQ (int mode, int msec) { mdc800->camera_request_ready=1+mode; + smp_mb(); wait_event_timeout(mdc800->irq_wait, mdc800->irq_woken, msec*HZ/1000); mdc800->irq_woken = 0; @@ -374,7 +377,7 @@ /* * The write_urb callback function */ -static void mdc800_usb_write_notify (struct urb *urb) +static void mdc800_usb_write_notify(struct urb *urb) { struct mdc800_data* mdc800=urb->context; @@ -386,6 +389,7 @@ { mdc800->state=READY; } + smp_mb(); mdc800->written = 1; wake_up (&mdc800->write_wait); } @@ -394,7 +398,7 @@ /* * The download_urb callback function */ -static void mdc800_usb_download_notify (struct urb *urb) +static void mdc800_usb_download_notify(struct urb *urb) { struct mdc800_data* mdc800=urb->context; @@ -414,6 +418,7 @@ { err ("request bytes fails (status:%i)", urb->status); } + smp_mb(); mdc800->downloaded = 1; wake_up (&mdc800->download_wait); } ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel