diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-04-28 03:41:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-29 20:24:34 -0400 |
commit | bc57381e634782009b1cb2e86b18013699ada576 (patch) | |
tree | 2ff4b5937d810ef04aa1960745f06c4e0c99f939 | |
parent | 5ea68d541df200d10a373c06f945f98225c2486b (diff) |
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.c | 9 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/common.h | 3 | ||||
-rw-r--r-- | include/linux/usb/renesas_usbhs.h | 7 |
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) | |||
178 | { | 178 | { |
179 | struct usbhs_priv *priv = container_of(work, | 179 | struct usbhs_priv *priv = container_of(work, |
180 | struct usbhs_priv, | 180 | struct usbhs_priv, |
181 | notify_hotplug_work); | 181 | notify_hotplug_work.work); |
182 | struct platform_device *pdev = usbhs_priv_to_pdev(priv); | 182 | struct platform_device *pdev = usbhs_priv_to_pdev(priv); |
183 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); | 183 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); |
184 | int id; | 184 | int id; |
@@ -224,16 +224,17 @@ static void usbhsc_notify_hotplug(struct work_struct *work) | |||
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) | 227 | int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) |
228 | { | 228 | { |
229 | struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); | 229 | struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); |
230 | int delay = usbhs_get_dparam(priv, detection_delay); | ||
230 | 231 | ||
231 | /* | 232 | /* |
232 | * This functions will be called in interrupt. | 233 | * This functions will be called in interrupt. |
233 | * To make sure safety context, | 234 | * To make sure safety context, |
234 | * use workqueue for usbhs_notify_hotplug | 235 | * use workqueue for usbhs_notify_hotplug |
235 | */ | 236 | */ |
236 | schedule_work(&priv->notify_hotplug_work); | 237 | schedule_delayed_work(&priv->notify_hotplug_work, delay); |
237 | return 0; | 238 | return 0; |
238 | } | 239 | } |
239 | 240 | ||
@@ -300,7 +301,7 @@ static int __devinit usbhs_probe(struct platform_device *pdev) | |||
300 | */ | 301 | */ |
301 | priv->irq = irq; | 302 | priv->irq = irq; |
302 | priv->pdev = pdev; | 303 | priv->pdev = pdev; |
303 | INIT_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug); | 304 | INIT_DELAYED_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug); |
304 | spin_lock_init(usbhs_priv_to_lock(priv)); | 305 | spin_lock_init(usbhs_priv_to_lock(priv)); |
305 | 306 | ||
306 | /* call pipe and module init */ | 307 | /* 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 { | |||
177 | struct renesas_usbhs_platform_callback *pfunc; | 177 | struct renesas_usbhs_platform_callback *pfunc; |
178 | struct renesas_usbhs_driver_param *dparam; | 178 | struct renesas_usbhs_driver_param *dparam; |
179 | 179 | ||
180 | struct work_struct notify_hotplug_work; | 180 | struct delayed_work notify_hotplug_work; |
181 | struct platform_device *pdev; | 181 | struct platform_device *pdev; |
182 | 182 | ||
183 | spinlock_t lock; | 183 | spinlock_t lock; |
@@ -200,6 +200,7 @@ u16 usbhs_read(struct usbhs_priv *priv, u32 reg); | |||
200 | void usbhs_write(struct usbhs_priv *priv, u32 reg, u16 data); | 200 | void usbhs_write(struct usbhs_priv *priv, u32 reg, u16 data); |
201 | void usbhs_bset(struct usbhs_priv *priv, u32 reg, u16 mask, u16 data); | 201 | void usbhs_bset(struct usbhs_priv *priv, u32 reg, u16 mask, u16 data); |
202 | 202 | ||
203 | int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev); | ||
203 | /* | 204 | /* |
204 | * sysconfig | 205 | * sysconfig |
205 | */ | 206 | */ |
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 { | |||
103 | * for BUSWAIT :: BWAIT | 103 | * for BUSWAIT :: BWAIT |
104 | * */ | 104 | * */ |
105 | int buswait_bwait; | 105 | int buswait_bwait; |
106 | |||
107 | /* | ||
108 | * option: | ||
109 | * | ||
110 | * delay time from notify_hotplug callback | ||
111 | */ | ||
112 | int detection_delay; | ||
106 | }; | 113 | }; |
107 | 114 | ||
108 | /* | 115 | /* |