Commit ea90ef43 authored by Komal Shah's avatar Komal Shah Committed by Tony Lindgren

[PATCH] ARM: OMAP: tahvo usb: sem2mutex conversion

sem2mutex conversion
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 06563a86
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/mutex.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/semaphore.h>
#include <asm/arch/usb.h> #include <asm/arch/usb.h>
#include "cbus.h" #include "cbus.h"
...@@ -92,7 +92,7 @@ struct tahvo_usb { ...@@ -92,7 +92,7 @@ struct tahvo_usb {
struct otg_transceiver otg; struct otg_transceiver otg;
int vbus_state; int vbus_state;
struct work_struct irq_work; struct work_struct irq_work;
struct semaphore serialize; struct mutex serialize;
#ifdef CONFIG_USB_OTG #ifdef CONFIG_USB_OTG
int tahvo_mode; int tahvo_mode;
#endif #endif
...@@ -414,13 +414,13 @@ static int tahvo_usb_set_host(struct otg_transceiver *otg, struct usb_bus *host) ...@@ -414,13 +414,13 @@ static int tahvo_usb_set_host(struct otg_transceiver *otg, struct usb_bus *host)
#if defined(CONFIG_USB_OTG) || !defined(CONFIG_USB_GADGET_OMAP) #if defined(CONFIG_USB_OTG) || !defined(CONFIG_USB_GADGET_OMAP)
down(&tu->serialize); mutex_lock(&tu->serialize);
if (!host) { if (!host) {
if (TAHVO_MODE(tu) == TAHVO_MODE_HOST) if (TAHVO_MODE(tu) == TAHVO_MODE_HOST)
tahvo_usb_power_off(tu); tahvo_usb_power_off(tu);
tu->otg.host = 0; tu->otg.host = 0;
up(&tu->serialize); mutex_unlock(&tu->serialize);
return 0; return 0;
} }
...@@ -432,7 +432,7 @@ static int tahvo_usb_set_host(struct otg_transceiver *otg, struct usb_bus *host) ...@@ -432,7 +432,7 @@ static int tahvo_usb_set_host(struct otg_transceiver *otg, struct usb_bus *host)
tu->otg.host = host; tu->otg.host = host;
up(&tu->serialize); mutex_unlock(&tu->serialize);
#else #else
/* No host mode configured, so do not allow host controlled to be set */ /* No host mode configured, so do not allow host controlled to be set */
return -EINVAL; return -EINVAL;
...@@ -450,13 +450,13 @@ static int tahvo_usb_set_peripheral(struct otg_transceiver *otg, struct usb_gadg ...@@ -450,13 +450,13 @@ static int tahvo_usb_set_peripheral(struct otg_transceiver *otg, struct usb_gadg
#if defined(CONFIG_USB_OTG) || defined(CONFIG_USB_GADGET_OMAP) #if defined(CONFIG_USB_OTG) || defined(CONFIG_USB_GADGET_OMAP)
down(&tu->serialize); mutex_lock(&tu->serialize);
if (!gadget) { if (!gadget) {
if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL) if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
tahvo_usb_power_off(tu); tahvo_usb_power_off(tu);
tu->otg.gadget = 0; tu->otg.gadget = 0;
up(&tu->serialize); mutex_unlock(&tu->serialize);
return 0; return 0;
} }
...@@ -464,7 +464,7 @@ static int tahvo_usb_set_peripheral(struct otg_transceiver *otg, struct usb_gadg ...@@ -464,7 +464,7 @@ static int tahvo_usb_set_peripheral(struct otg_transceiver *otg, struct usb_gadg
if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL) if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
tahvo_usb_become_peripheral(tu); tahvo_usb_become_peripheral(tu);
up(&tu->serialize); mutex_unlock(&tu->serialize);
#else #else
/* No gadget mode configured, so do not allow host controlled to be set */ /* No gadget mode configured, so do not allow host controlled to be set */
return -EINVAL; return -EINVAL;
...@@ -477,9 +477,9 @@ static void tahvo_usb_irq_work(void *data) ...@@ -477,9 +477,9 @@ static void tahvo_usb_irq_work(void *data)
{ {
struct tahvo_usb *tu = (struct tahvo_usb *)data; struct tahvo_usb *tu = (struct tahvo_usb *)data;
down(&tu->serialize); mutex_lock(&tu->serialize);
check_vbus_state(tu); check_vbus_state(tu);
up(&tu->serialize); mutex_unlock(&tu->serialize);
} }
static void tahvo_usb_vbus_interrupt(unsigned long arg) static void tahvo_usb_vbus_interrupt(unsigned long arg)
...@@ -514,7 +514,7 @@ static ssize_t otg_mode_store(struct device *device, ...@@ -514,7 +514,7 @@ static ssize_t otg_mode_store(struct device *device,
int r; int r;
r = strlen(buf); r = strlen(buf);
down(&tu->serialize); mutex_lock(&tu->serialize);
if (strncmp(buf, "host", 4) == 0) { if (strncmp(buf, "host", 4) == 0) {
if (tu->tahvo_mode == TAHVO_MODE_PERIPHERAL) if (tu->tahvo_mode == TAHVO_MODE_PERIPHERAL)
tahvo_usb_stop_peripheral(tu); tahvo_usb_stop_peripheral(tu);
...@@ -540,7 +540,7 @@ static ssize_t otg_mode_store(struct device *device, ...@@ -540,7 +540,7 @@ static ssize_t otg_mode_store(struct device *device,
} else } else
r = -EINVAL; r = -EINVAL;
up(&tu->serialize); mutex_unlock(&tu->serialize);
return r; return r;
} }
...@@ -568,7 +568,7 @@ static int tahvo_usb_probe(struct device *dev) ...@@ -568,7 +568,7 @@ static int tahvo_usb_probe(struct device *dev)
#endif #endif
INIT_WORK(&tu->irq_work, tahvo_usb_irq_work, tu); 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 /* Set initial state, so that we generate kevents only on
* state changes */ * state changes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment