summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-04-28 16:41:14 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-29 17:24:34 -0700
commitbc57381e634782009b1cb2e86b18013699ada576 (patch)
tree2ff4b5937d810ef04aa1960745f06c4e0c99f939
parent5ea68d541df200d10a373c06f945f98225c2486b (diff)
downloadblackbird-op-linux-bc57381e634782009b1cb2e86b18013699ada576.tar.gz
blackbird-op-linux-bc57381e634782009b1cb2e86b18013699ada576.zip
usb: renesas_usbhs: use delayed_work instead of work_struct
This delay is used to overjump debounce. And, this patch also move usbhsc_drvcllbck_notify_hotplug to global, because it will be called from other files. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/renesas_usbhs/common.c9
-rw-r--r--drivers/usb/renesas_usbhs/common.h3
-rw-r--r--include/linux/usb/renesas_usbhs.h7
3 files changed, 14 insertions, 5 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index db13cef9effe..9a75a45687bb 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -178,7 +178,7 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
{
struct usbhs_priv *priv = container_of(work,
struct usbhs_priv,
- notify_hotplug_work);
+ notify_hotplug_work.work);
struct platform_device *pdev = usbhs_priv_to_pdev(priv);
struct usbhs_mod *mod = usbhs_mod_get_current(priv);
int id;
@@ -224,16 +224,17 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
}
}
-static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
+int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
{
struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
+ int delay = usbhs_get_dparam(priv, detection_delay);
/*
* This functions will be called in interrupt.
* To make sure safety context,
* use workqueue for usbhs_notify_hotplug
*/
- schedule_work(&priv->notify_hotplug_work);
+ schedule_delayed_work(&priv->notify_hotplug_work, delay);
return 0;
}
@@ -300,7 +301,7 @@ static int __devinit usbhs_probe(struct platform_device *pdev)
*/
priv->irq = irq;
priv->pdev = pdev;
- INIT_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug);
+ INIT_DELAYED_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug);
spin_lock_init(usbhs_priv_to_lock(priv));
/* call pipe and module init */
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index f3b907d26082..0157eb805cf6 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -177,7 +177,7 @@ struct usbhs_priv {
struct renesas_usbhs_platform_callback *pfunc;
struct renesas_usbhs_driver_param *dparam;
- struct work_struct notify_hotplug_work;
+ struct delayed_work notify_hotplug_work;
struct platform_device *pdev;
spinlock_t lock;
@@ -200,6 +200,7 @@ u16 usbhs_read(struct usbhs_priv *priv, u32 reg);
void usbhs_write(struct usbhs_priv *priv, u32 reg, u16 data);
void usbhs_bset(struct usbhs_priv *priv, u32 reg, u16 mask, u16 data);
+int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev);
/*
* sysconfig
*/
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 66bbdd12d153..3a7f1d982dd6 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -103,6 +103,13 @@ struct renesas_usbhs_driver_param {
* for BUSWAIT :: BWAIT
* */
int buswait_bwait;
+
+ /*
+ * option:
+ *
+ * delay time from notify_hotplug callback
+ */
+ int detection_delay;
};
/*
OpenPOWER on IntegriCloud