initialize the url field for packages
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1281-checkpatch-accel-fixes.patch.patch
1 From 2d61a7406ec89893cdb4246d3f0144818278a5d8 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 15 Aug 2008 11:51:04 +0100
4 Subject: [PATCH] checkpatch-accel-fixes.patch
5
6 style cleanups for accel threshold setting patch
7
8 Signed-off-by: Andy Green <andy@openmoko.com>
9 ---
10 drivers/input/misc/lis302dl.c | 43 +++++++++++++++++++++++-----------------
11 1 files changed, 25 insertions(+), 18 deletions(-)
12
13 diff --git a/drivers/input/misc/lis302dl.c b/drivers/input/misc/lis302dl.c
14 index 3f6d0eb..7df31af 100644
15 --- a/drivers/input/misc/lis302dl.c
16 +++ b/drivers/input/misc/lis302dl.c
17 @@ -254,7 +254,7 @@ static int freefall_ms_to_duration(struct lis302dl_info *lis, int ms)
18
19 /* If we have 400 ms sampling rate, the stepping is 2.5 ms,
20 * on 100 ms the stepping is 10ms */
21 - if ( r & LIS302DL_CTRL1_DR ) {
22 + if (r & LIS302DL_CTRL1_DR) {
23 /* Too large */
24 if (ms > 637)
25 return -1;
26 @@ -272,15 +272,15 @@ static int freefall_duration_to_ms(struct lis302dl_info *lis, int duration)
27 {
28 u_int8_t r = reg_read(lis, LIS302DL_REG_CTRL1);
29
30 - if ( r & LIS302DL_CTRL1_DR )
31 + if (r & LIS302DL_CTRL1_DR)
32 return (duration * 25) / 10;
33
34 return duration * 10;
35 }
36
37 /* Configure freefall/wakeup interrupts */
38 -static ssize_t set_freefall_common(int which, struct device *dev, struct device_attribute *attr,
39 - const char *buf, size_t count)
40 +static ssize_t set_freefall_common(int which, struct device *dev,
41 + struct device_attribute *attr, const char *buf, size_t count)
42 {
43 struct lis302dl_info *lis = dev_get_drvdata(dev);
44 u_int8_t x_lo, y_lo, z_lo;
45 @@ -305,17 +305,18 @@ static ssize_t set_freefall_common(int which, struct device *dev, struct device_
46 flag_mask = LIS302DL_F_WUP_FF_2;
47 intmode = LIS302DL_INTMODE_FF_WU_2;
48
49 - printk(KERN_WARNING "Configuring second freefall / wakeup interrupt\n");
50 + printk(KERN_WARNING
51 + "Configuring second freefall / wakeup interrupt\n");
52 }
53
54 /* Parse the input */
55 - if (strcmp(buf, "0\n") == 0)
56 - {
57 + if (strcmp(buf, "0\n") == 0) {
58 /* Turn off the interrupt */
59 local_save_flags(flags);
60 - if ( (lis->flags & LIS302DL_F_IRQ_WAKE) != 0 )
61 + if (lis->flags & LIS302DL_F_IRQ_WAKE)
62 disable_irq_wake(lis->spi_dev->irq);
63 - lis302dl_int_mode(lis->spi_dev, which, LIS302DL_INTMODE_DATA_READY);
64 + lis302dl_int_mode(lis->spi_dev, which,
65 + LIS302DL_INTMODE_DATA_READY);
66 lis->flags &= ~(flag_mask | LIS302DL_F_IRQ_WAKE);
67
68 reg_write(lis, r_cfg, 0);
69 @@ -323,15 +324,17 @@ static ssize_t set_freefall_common(int which, struct device *dev, struct device_
70 reg_write(lis, r_duration, 0);
71
72 /* Power off unless the input subsystem is using the device */
73 - if ( (lis->flags & LIS302DL_F_INPUT_OPEN) == 0 )
74 - reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_PD, 0);
75 + if (!(lis->flags & LIS302DL_F_INPUT_OPEN))
76 + reg_set_bit_mask(lis, LIS302DL_REG_CTRL1,
77 + LIS302DL_CTRL1_PD, 0);
78
79 local_irq_restore(flags);
80
81 return count;
82 }
83
84 - if (sscanf(buf, "%d %d %d %d %d %d", &x, &y, &z, &threshold, &ms, &and_events) != 6)
85 + if (sscanf(buf, "%d %d %d %d %d %d", &x, &y, &z, &threshold, &ms,
86 + &and_events) != 6)
87 return -EINVAL;
88
89 duration = freefall_ms_to_duration(lis, ms);
90 @@ -364,7 +367,7 @@ static ssize_t set_freefall_common(int which, struct device *dev, struct device_
91
92 /* Power up the device and note that we want to wake up from
93 * this interrupt */
94 - if ( (lis->flags & LIS302DL_F_IRQ_WAKE) == 0 )
95 + if (!(lis->flags & LIS302DL_F_IRQ_WAKE))
96 enable_irq_wake(lis->spi_dev->irq);
97
98 lis->flags |= flag_mask | LIS302DL_F_IRQ_WAKE;
99 @@ -420,10 +423,12 @@ static ssize_t show_freefall_common(int which, struct device *dev,
100 LIS302DL_FFWUCFG_ZLIE | LIS302DL_FFWUCFG_ZHIE)) == 0)
101 return sprintf(buf, "off\n");
102
103 - return sprintf(buf,"%s events, %s interrupt, duration %d, threshold %d, "
104 + return sprintf(buf,
105 + "%s events, %s interrupt, duration %d, threshold %d, "
106 "enabled: %s %s %s %s %s %s\n",
107 (config & LIS302DL_FFWUCFG_AOI) == 0 ? "or" : "and",
108 - (config & LIS302DL_FFWUCFG_LIR) == 0 ? "don't latch" : "latch",
109 + (config & LIS302DL_FFWUCFG_LIR) == 0 ?
110 + "don't latch" : "latch",
111 freefall_duration_to_ms(lis, duration), threshold,
112 (config & LIS302DL_FFWUCFG_XLIE) == 0 ? "---" : "xlo",
113 (config & LIS302DL_FFWUCFG_XHIE) == 0 ? "---" : "xhi",
114 @@ -445,8 +450,10 @@ static ssize_t show_freefall_2(struct device *dev,
115 return show_freefall_common(2, dev, attr, buf);
116 }
117
118 -static DEVICE_ATTR(freefall_wakeup_1, S_IRUGO | S_IWUSR, show_freefall_1, set_freefall_1);
119 -static DEVICE_ATTR(freefall_wakeup_2, S_IRUGO | S_IWUSR, show_freefall_2, set_freefall_2);
120 +static DEVICE_ATTR(freefall_wakeup_1, S_IRUGO | S_IWUSR, show_freefall_1,
121 + set_freefall_1);
122 +static DEVICE_ATTR(freefall_wakeup_2, S_IRUGO | S_IWUSR, show_freefall_2,
123 + set_freefall_2);
124
125 static struct attribute *lis302dl_sysfs_entries[] = {
126 &dev_attr_sample_rate.attr,
127 @@ -618,7 +625,7 @@ static int __devinit lis302dl_probe(struct spi_device *spi)
128 /* start off in powered down mode; we power up when someone opens us */
129 reg_write(lis, LIS302DL_REG_CTRL1, LIS302DL_CTRL1_Xen |
130 LIS302DL_CTRL1_Yen |
131 - LIS302DL_CTRL1_Zen);
132 + LIS302DL_CTRL1_Zen);
133
134 if (pdata->open_drain)
135 /* switch interrupt to open collector, active-low */
136 --
137 1.5.6.5
138
This page took 0.059154 seconds and 5 git commands to generate.