summaryrefslogtreecommitdiffstats
path: root/target/linux/s3c24xx/patches-2.6.24/1281-checkpatch-accel-fixes.patch.patch
blob: 9b57c87a4e2eac88e220365c749690977e59c0f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
From 2d61a7406ec89893cdb4246d3f0144818278a5d8 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Fri, 15 Aug 2008 11:51:04 +0100
Subject: [PATCH] checkpatch-accel-fixes.patch

style cleanups for accel threshold setting patch

Signed-off-by: Andy Green <andy@openmoko.com>
---
 drivers/input/misc/lis302dl.c |   43 +++++++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/input/misc/lis302dl.c b/drivers/input/misc/lis302dl.c
index 3f6d0eb..7df31af 100644
--- a/drivers/input/misc/lis302dl.c
+++ b/drivers/input/misc/lis302dl.c
@@ -254,7 +254,7 @@ static int freefall_ms_to_duration(struct lis302dl_info *lis, int ms)
 
 	/* If we have 400 ms sampling rate, the stepping is 2.5 ms,
 	 * on 100 ms the stepping is 10ms */
-	if ( r & LIS302DL_CTRL1_DR ) {
+	if (r & LIS302DL_CTRL1_DR) {
 		/* Too large */
 		if (ms > 637)
 			return -1;
@@ -272,15 +272,15 @@ static int freefall_duration_to_ms(struct lis302dl_info *lis, int duration)
 {
 	u_int8_t r = reg_read(lis, LIS302DL_REG_CTRL1);
 
-	if ( r & LIS302DL_CTRL1_DR )
+	if (r & LIS302DL_CTRL1_DR)
 		return (duration * 25) / 10;
 
 	return duration * 10;
 }
 
 /* Configure freefall/wakeup interrupts */
-static ssize_t set_freefall_common(int which, struct device *dev, struct device_attribute *attr,
-			 const char *buf, size_t count)
+static ssize_t set_freefall_common(int which, struct device *dev,
+		   struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct lis302dl_info *lis = dev_get_drvdata(dev);
 	u_int8_t x_lo, y_lo, z_lo;
@@ -305,17 +305,18 @@ static ssize_t set_freefall_common(int which, struct device *dev, struct device_
 		flag_mask = LIS302DL_F_WUP_FF_2;
 		intmode = LIS302DL_INTMODE_FF_WU_2;
 
-		printk(KERN_WARNING "Configuring second freefall / wakeup interrupt\n");
+		printk(KERN_WARNING
+			    "Configuring second freefall / wakeup interrupt\n");
 	}
 
 	/* Parse the input */
-	if (strcmp(buf, "0\n") == 0)
-	{
+	if (strcmp(buf, "0\n") == 0) {
 		/* Turn off the interrupt */
 		local_save_flags(flags);
-		if ( (lis->flags & LIS302DL_F_IRQ_WAKE) != 0 )
+		if (lis->flags & LIS302DL_F_IRQ_WAKE)
 			disable_irq_wake(lis->spi_dev->irq);
-		lis302dl_int_mode(lis->spi_dev, which, LIS302DL_INTMODE_DATA_READY);
+		lis302dl_int_mode(lis->spi_dev, which,
+						   LIS302DL_INTMODE_DATA_READY);
 		lis->flags &= ~(flag_mask | LIS302DL_F_IRQ_WAKE);
 
 		reg_write(lis, r_cfg, 0);
@@ -323,15 +324,17 @@ static ssize_t set_freefall_common(int which, struct device *dev, struct device_
 		reg_write(lis, r_duration, 0);
 
 		/* Power off unless the input subsystem is using the device */
-		if ( (lis->flags & LIS302DL_F_INPUT_OPEN) == 0 )
-			reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_PD, 0);
+		if (!(lis->flags & LIS302DL_F_INPUT_OPEN))
+			reg_set_bit_mask(lis, LIS302DL_REG_CTRL1,
+							  LIS302DL_CTRL1_PD, 0);
 
 		local_irq_restore(flags);
 
 		return count;
 	}
 
-	if (sscanf(buf, "%d %d %d %d %d %d", &x, &y, &z, &threshold, &ms, &and_events) != 6)
+	if (sscanf(buf, "%d %d %d %d %d %d", &x, &y, &z, &threshold, &ms,
+							      &and_events) != 6)
 		return -EINVAL;
 
 	duration = freefall_ms_to_duration(lis, ms);
@@ -364,7 +367,7 @@ static ssize_t set_freefall_common(int which, struct device *dev, struct device_
 
 	/* Power up the device and note that we want to wake up from
 	 * this interrupt */
-	if ( (lis->flags & LIS302DL_F_IRQ_WAKE) == 0 )
+	if (!(lis->flags & LIS302DL_F_IRQ_WAKE))
 		enable_irq_wake(lis->spi_dev->irq);
 
 	lis->flags |= flag_mask | LIS302DL_F_IRQ_WAKE;
@@ -420,10 +423,12 @@ static ssize_t show_freefall_common(int which, struct device *dev,
 			LIS302DL_FFWUCFG_ZLIE | LIS302DL_FFWUCFG_ZHIE)) == 0)
 		return sprintf(buf, "off\n");
 
-	return sprintf(buf,"%s events, %s interrupt, duration %d, threshold %d, "
+	return sprintf(buf,
+			"%s events, %s interrupt, duration %d, threshold %d, "
 			"enabled: %s %s %s %s %s %s\n",
 			(config & LIS302DL_FFWUCFG_AOI) == 0 ? "or" : "and",
-			(config & LIS302DL_FFWUCFG_LIR) == 0 ? "don't latch" : "latch",
+			(config & LIS302DL_FFWUCFG_LIR) == 0 ?
+							"don't latch" : "latch",
 			freefall_duration_to_ms(lis, duration), threshold,
 			(config & LIS302DL_FFWUCFG_XLIE) == 0 ? "---" : "xlo",
 			(config & LIS302DL_FFWUCFG_XHIE) == 0 ? "---" : "xhi",
@@ -445,8 +450,10 @@ static ssize_t show_freefall_2(struct device *dev,
 	return show_freefall_common(2, dev, attr, buf);
 }
 
-static DEVICE_ATTR(freefall_wakeup_1, S_IRUGO | S_IWUSR, show_freefall_1, set_freefall_1);
-static DEVICE_ATTR(freefall_wakeup_2, S_IRUGO | S_IWUSR, show_freefall_2, set_freefall_2);
+static DEVICE_ATTR(freefall_wakeup_1, S_IRUGO | S_IWUSR, show_freefall_1,
+								set_freefall_1);
+static DEVICE_ATTR(freefall_wakeup_2, S_IRUGO | S_IWUSR, show_freefall_2,
+								set_freefall_2);
 
 static struct attribute *lis302dl_sysfs_entries[] = {
 	&dev_attr_sample_rate.attr,
@@ -618,7 +625,7 @@ static int __devinit lis302dl_probe(struct spi_device *spi)
 	/* start off in powered down mode; we power up when someone opens us */
 	reg_write(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_Xen |
 					   LIS302DL_CTRL1_Yen |
-			 		   LIS302DL_CTRL1_Zen);
+					   LIS302DL_CTRL1_Zen);
 
 	if (pdata->open_drain)
 		/* switch interrupt to open collector, active-low */
-- 
1.5.6.5