Skip to content

Commit

Permalink
[WATCHDOG] use mutex instead of semaphore in Berkshire USB-PC Watchdo…
Browse files Browse the repository at this point in the history
…g driver

The Berkshire USB-PC Watchdog driver uses a semaphore as mutex.  Use the mutex
API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Matthias Kaehlcke authored and Wim Van Sebroeck committed May 4, 2007
1 parent dbf379e commit 9f7afa6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/char/watchdog/pcwd_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ struct usb_pcwd_private {
atomic_t cmd_received; /* true if we received a report after a command */

int exists; /* Wether or not the device exists */
struct semaphore sem; /* locks this structure */
struct mutex mtx; /* locks this structure */
};
static struct usb_pcwd_private *usb_pcwd_device;

Expand Down Expand Up @@ -635,7 +635,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi

usb_pcwd_device = usb_pcwd;

init_MUTEX (&usb_pcwd->sem);
mutex_init(&usb_pcwd->mtx);
usb_pcwd->udev = udev;
usb_pcwd->interface = interface;
usb_pcwd->interface_number = iface_desc->desc.bInterfaceNumber;
Expand Down Expand Up @@ -763,7 +763,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
usb_pcwd = usb_get_intfdata (interface);
usb_set_intfdata (interface, NULL);

down (&usb_pcwd->sem);
mutex_lock(&usb_pcwd->mtx);

/* Stop the timer before we leave */
if (!nowayout)
Expand All @@ -777,7 +777,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
misc_deregister(&usb_pcwd_temperature_miscdev);
unregister_reboot_notifier(&usb_pcwd_notifier);

up (&usb_pcwd->sem);
mutex_unlock(&usb_pcwd->mtx);

/* Delete the USB PCWD device */
usb_pcwd_delete(usb_pcwd);
Expand Down

0 comments on commit 9f7afa6

Please sign in to comment.