1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-28 16:54:03 +02:00
openwrt-xburst/target/linux/s3c24xx/patches-2.6.24/1281-checkpatch-accel-fixes.patch.patch

139 lines
5.2 KiB
Diff
Raw Normal View History

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