#include <linux/init.h>
#include <linux/slab.h>
#include <linux/lp.h>
-#include <linux/mutex.h>
#undef DEBUG
#include <linux/usb.h>
/* forward reference to make our lives easier */
static struct usb_driver usblp_driver;
-static DEFINE_MUTEX(usblp_mutex); /* locks the existence of usblp's */
+static DECLARE_MUTEX(usblp_sem); /* locks the existence of usblp's */
/*
* Functions for usblp control messages.
if (minor < 0)
return -ENODEV;
- mutex_lock (&usblp_mutex);
+ down (&usblp_sem);
retval = -ENODEV;
intf = usb_find_interface(&usblp_driver, minor);
}
}
out:
- mutex_unlock (&usblp_mutex);
+ up (&usblp_sem);
return retval;
}
{
struct usblp *usblp = file->private_data;
- mutex_lock (&usblp_mutex);
+ down (&usblp_sem);
usblp->used = 0;
if (usblp->present) {
usblp_unlink_urbs(usblp);
} else /* finish cleanup from disconnect */
usblp_cleanup (usblp);
- mutex_unlock (&usblp_mutex);
+ up (&usblp_sem);
return 0;
}
device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
- mutex_lock (&usblp_mutex);
+ down (&usblp_sem);
down (&usblp->sem);
usblp->present = 0;
usb_set_intfdata (intf, NULL);
if (!usblp->used)
usblp_cleanup (usblp);
- mutex_unlock (&usblp_mutex);
+ up (&usblp_sem);
}
static struct usb_device_id usblp_ids [] = {