sem2mutex conversion
Signed-off-by: Komal Shah <komal_shah802003@yahoo.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
#include <linux/workqueue.h>
#include <linux/kobject.h>
#include <linux/clk.h>
#include <linux/workqueue.h>
#include <linux/kobject.h>
#include <linux/clk.h>
+#include <linux/mutex.h>
-#include <asm/semaphore.h>
#include <asm/arch/usb.h>
#include "cbus.h"
#include <asm/arch/usb.h>
#include "cbus.h"
struct otg_transceiver otg;
int vbus_state;
struct work_struct irq_work;
struct otg_transceiver otg;
int vbus_state;
struct work_struct irq_work;
- struct semaphore serialize;
+ struct mutex serialize;
#ifdef CONFIG_USB_OTG
int tahvo_mode;
#endif
#ifdef CONFIG_USB_OTG
int tahvo_mode;
#endif
#if defined(CONFIG_USB_OTG) || !defined(CONFIG_USB_GADGET_OMAP)
#if defined(CONFIG_USB_OTG) || !defined(CONFIG_USB_GADGET_OMAP)
+ mutex_lock(&tu->serialize);
if (!host) {
if (TAHVO_MODE(tu) == TAHVO_MODE_HOST)
tahvo_usb_power_off(tu);
tu->otg.host = 0;
if (!host) {
if (TAHVO_MODE(tu) == TAHVO_MODE_HOST)
tahvo_usb_power_off(tu);
tu->otg.host = 0;
+ mutex_unlock(&tu->serialize);
+ mutex_unlock(&tu->serialize);
#else
/* No host mode configured, so do not allow host controlled to be set */
return -EINVAL;
#else
/* No host mode configured, so do not allow host controlled to be set */
return -EINVAL;
#if defined(CONFIG_USB_OTG) || defined(CONFIG_USB_GADGET_OMAP)
#if defined(CONFIG_USB_OTG) || defined(CONFIG_USB_GADGET_OMAP)
+ mutex_lock(&tu->serialize);
if (!gadget) {
if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
tahvo_usb_power_off(tu);
tu->otg.gadget = 0;
if (!gadget) {
if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
tahvo_usb_power_off(tu);
tu->otg.gadget = 0;
+ mutex_unlock(&tu->serialize);
if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
tahvo_usb_become_peripheral(tu);
if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
tahvo_usb_become_peripheral(tu);
+ mutex_unlock(&tu->serialize);
#else
/* No gadget mode configured, so do not allow host controlled to be set */
return -EINVAL;
#else
/* No gadget mode configured, so do not allow host controlled to be set */
return -EINVAL;
{
struct tahvo_usb *tu = (struct tahvo_usb *)data;
{
struct tahvo_usb *tu = (struct tahvo_usb *)data;
+ mutex_lock(&tu->serialize);
+ mutex_unlock(&tu->serialize);
}
static void tahvo_usb_vbus_interrupt(unsigned long arg)
}
static void tahvo_usb_vbus_interrupt(unsigned long arg)
+ mutex_lock(&tu->serialize);
if (strncmp(buf, "host", 4) == 0) {
if (tu->tahvo_mode == TAHVO_MODE_PERIPHERAL)
tahvo_usb_stop_peripheral(tu);
if (strncmp(buf, "host", 4) == 0) {
if (tu->tahvo_mode == TAHVO_MODE_PERIPHERAL)
tahvo_usb_stop_peripheral(tu);
+ mutex_unlock(&tu->serialize);
#endif
INIT_WORK(&tu->irq_work, tahvo_usb_irq_work, tu);
#endif
INIT_WORK(&tu->irq_work, tahvo_usb_irq_work, tu);
- init_MUTEX(&tu->serialize);
+ mutex_init(&tu->serialize);
/* Set initial state, so that we generate kevents only on
* state changes */
/* Set initial state, so that we generate kevents only on
* state changes */