aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/drivers/push-switch.c13
-rw-r--r--include/asm-sh/push-switch.h3
2 files changed, 11 insertions, 5 deletions
diff --git a/arch/sh/drivers/push-switch.c b/arch/sh/drivers/push-switch.c
index f2b9157c314f..b3d20c0e021f 100644
--- a/arch/sh/drivers/push-switch.c
+++ b/arch/sh/drivers/push-switch.c
@@ -14,7 +14,7 @@
14#include <asm/push-switch.h> 14#include <asm/push-switch.h>
15 15
16#define DRV_NAME "push-switch" 16#define DRV_NAME "push-switch"
17#define DRV_VERSION "0.1.0" 17#define DRV_VERSION "0.1.1"
18 18
19static ssize_t switch_show(struct device *dev, 19static ssize_t switch_show(struct device *dev,
20 struct device_attribute *attr, 20 struct device_attribute *attr,
@@ -32,10 +32,10 @@ static void switch_timer(unsigned long data)
32 schedule_work(&psw->work); 32 schedule_work(&psw->work);
33} 33}
34 34
35static void switch_work_handler(void *data) 35static void switch_work_handler(struct work_struct *work)
36{ 36{
37 struct platform_device *pdev = data; 37 struct push_switch *psw = container_of(work, struct push_switch, work);
38 struct push_switch *psw = platform_get_drvdata(pdev); 38 struct platform_device *pdev = psw->pdev;
39 39
40 psw->state = 0; 40 psw->state = 0;
41 41
@@ -76,12 +76,15 @@ static int switch_drv_probe(struct platform_device *pdev)
76 } 76 }
77 } 77 }
78 78
79 INIT_WORK(&psw->work, switch_work_handler, pdev); 79 INIT_WORK(&psw->work, switch_work_handler);
80 init_timer(&psw->debounce); 80 init_timer(&psw->debounce);
81 81
82 psw->debounce.function = switch_timer; 82 psw->debounce.function = switch_timer;
83 psw->debounce.data = (unsigned long)psw; 83 psw->debounce.data = (unsigned long)psw;
84 84
85 /* Workqueue API brain-damage */
86 psw->pdev = pdev;
87
85 platform_set_drvdata(pdev, psw); 88 platform_set_drvdata(pdev, psw);
86 89
87 return 0; 90 return 0;
diff --git a/include/asm-sh/push-switch.h b/include/asm-sh/push-switch.h
index dfc6bad567f0..4903f9e52dd8 100644
--- a/include/asm-sh/push-switch.h
+++ b/include/asm-sh/push-switch.h
@@ -4,6 +4,7 @@
4#include <linux/timer.h> 4#include <linux/timer.h>
5#include <linux/interrupt.h> 5#include <linux/interrupt.h>
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7#include <linux/platform_device.h>
7 8
8struct push_switch { 9struct push_switch {
9 /* switch state */ 10 /* switch state */
@@ -12,6 +13,8 @@ struct push_switch {
12 struct timer_list debounce; 13 struct timer_list debounce;
13 /* workqueue */ 14 /* workqueue */
14 struct work_struct work; 15 struct work_struct work;
16 /* platform device, for workqueue handler */
17 struct platform_device *pdev;
15}; 18};
16 19
17struct push_switch_platform_info { 20struct push_switch_platform_info {