Commit e107e6eb authored by Marek Belisko's avatar Marek Belisko Committed by Greg Kroah-Hartman

staging: olpc_dcon: checkpatch.pl fixes for olpc_dcon.c file.

Signed-off-by: default avatarMarek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a90dcd4f
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <asm/tsc.h> #include <asm/tsc.h>
...@@ -93,8 +93,8 @@ static DECLARE_WAIT_QUEUE_HEAD(dcon_wait_queue); ...@@ -93,8 +93,8 @@ static DECLARE_WAIT_QUEUE_HEAD(dcon_wait_queue);
static unsigned short normal_i2c[] = { 0x0d, I2C_CLIENT_END }; static unsigned short normal_i2c[] = { 0x0d, I2C_CLIENT_END };
#define dcon_write(reg,val) i2c_smbus_write_word_data(dcon_client,reg,val) #define dcon_write(reg, val) i2c_smbus_write_word_data(dcon_client, reg, val)
#define dcon_read(reg) i2c_smbus_read_word_data(dcon_client,reg) #define dcon_read(reg) i2c_smbus_read_word_data(dcon_client, reg)
/* The current backlight value - this saves us some smbus traffic */ /* The current backlight value - this saves us some smbus traffic */
static int bl_val = -1; static int bl_val = -1;
...@@ -117,7 +117,8 @@ static int dcon_hw_init(struct i2c_client *client, int is_init) ...@@ -117,7 +117,8 @@ static int dcon_hw_init(struct i2c_client *client, int is_init)
if (is_init) { if (is_init) {
printk(KERN_INFO "olpc-dcon: Discovered DCON version %x\n", printk(KERN_INFO "olpc-dcon: Discovered DCON version %x\n",
ver & 0xFF); ver & 0xFF);
if ((rc = pdata->init()) != 0) { rc = pdata->init();
if (rc != 0) {
printk(KERN_ERR "olpc-dcon: Unable to init.\n"); printk(KERN_ERR "olpc-dcon: Unable to init.\n");
goto err; goto err;
} }
...@@ -139,8 +140,7 @@ static int dcon_hw_init(struct i2c_client *client, int is_init) ...@@ -139,8 +140,7 @@ static int dcon_hw_init(struct i2c_client *client, int is_init)
i2c_smbus_write_word_data(client, 0x3b, 0x002b); i2c_smbus_write_word_data(client, 0x3b, 0x002b);
i2c_smbus_write_word_data(client, 0x41, 0x0101); i2c_smbus_write_word_data(client, 0x41, 0x0101);
i2c_smbus_write_word_data(client, 0x42, 0x0101); i2c_smbus_write_word_data(client, 0x42, 0x0101);
} } else if (!noinit) {
else if (!noinit) {
/* SDRAM setup/hold time */ /* SDRAM setup/hold time */
i2c_smbus_write_word_data(client, 0x3a, 0xc040); i2c_smbus_write_word_data(client, 0x3a, 0xc040);
i2c_smbus_write_word_data(client, 0x41, 0x0000); i2c_smbus_write_word_data(client, 0x41, 0x0000);
...@@ -181,7 +181,8 @@ static int dcon_bus_stabilize(struct i2c_client *client, int is_powered_down) ...@@ -181,7 +181,8 @@ static int dcon_bus_stabilize(struct i2c_client *client, int is_powered_down)
power_up: power_up:
if (is_powered_down) { if (is_powered_down) {
x = 1; x = 1;
if ((x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0))) { x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0);
if (x) {
printk(KERN_WARNING "olpc-dcon: unable to force dcon " printk(KERN_WARNING "olpc-dcon: unable to force dcon "
"to power up: %d!\n", x); "to power up: %d!\n", x);
return x; return x;
...@@ -261,8 +262,7 @@ static int dcon_set_output(int arg) ...@@ -261,8 +262,7 @@ static int dcon_set_output(int arg)
if (arg == DCON_OUTPUT_MONO) { if (arg == DCON_OUTPUT_MONO) {
dcon_disp_mode &= ~(MODE_CSWIZZLE | MODE_COL_AA); dcon_disp_mode &= ~(MODE_CSWIZZLE | MODE_COL_AA);
dcon_disp_mode |= MODE_MONO_LUMA; dcon_disp_mode |= MODE_MONO_LUMA;
} } else {
else {
dcon_disp_mode &= ~(MODE_MONO_LUMA); dcon_disp_mode &= ~(MODE_MONO_LUMA);
dcon_disp_mode |= MODE_CSWIZZLE; dcon_disp_mode |= MODE_CSWIZZLE;
if (useaa) if (useaa)
...@@ -291,18 +291,18 @@ static void dcon_sleep(int state) ...@@ -291,18 +291,18 @@ static void dcon_sleep(int state)
if (state == DCON_SLEEP) { if (state == DCON_SLEEP) {
x = 0; x = 0;
if ((x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0))) x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0);
if (x)
printk(KERN_WARNING "olpc-dcon: unable to force dcon " printk(KERN_WARNING "olpc-dcon: unable to force dcon "
"to power down: %d!\n", x); "to power down: %d!\n", x);
else else
dcon_sleep_val = state; dcon_sleep_val = state;
} } else {
else {
/* Only re-enable the backlight if the backlight value is set */ /* Only re-enable the backlight if the backlight value is set */
if (bl_val != 0) if (bl_val != 0)
dcon_disp_mode |= MODE_BL_ENABLE; dcon_disp_mode |= MODE_BL_ENABLE;
x = dcon_bus_stabilize(dcon_client, 1);
if ((x=dcon_bus_stabilize(dcon_client, 1))) if (x)
printk(KERN_WARNING "olpc-dcon: unable to reinit dcon" printk(KERN_WARNING "olpc-dcon: unable to reinit dcon"
" hardware: %d!\n", x); " hardware: %d!\n", x);
else else
...@@ -323,7 +323,7 @@ static void dcon_sleep(int state) ...@@ -323,7 +323,7 @@ static void dcon_sleep(int state)
void dcon_load_holdoff(void) void dcon_load_holdoff(void)
{ {
struct timespec delta_t, now; struct timespec delta_t, now;
while(1) { while (1) {
getnstimeofday(&now); getnstimeofday(&now);
delta_t = timespec_sub(now, dcon_load_time); delta_t = timespec_sub(now, dcon_load_time);
if (delta_t.tv_sec != 0 || if (delta_t.tv_sec != 0 ||
...@@ -352,10 +352,12 @@ static void dcon_source_switch(struct work_struct *work) ...@@ -352,10 +352,12 @@ static void dcon_source_switch(struct work_struct *work)
printk("dcon_source_switch to CPU\n"); printk("dcon_source_switch to CPU\n");
/* Enable the scanline interrupt bit */ /* Enable the scanline interrupt bit */
if (dcon_write(DCON_REG_MODE, dcon_disp_mode | MODE_SCAN_INT)) if (dcon_write(DCON_REG_MODE, dcon_disp_mode | MODE_SCAN_INT))
printk(KERN_ERR "olpc-dcon: couldn't enable scanline interrupt!\n"); printk(KERN_ERR
"olpc-dcon: couldn't enable scanline interrupt!\n");
else { else {
/* Wait up to one second for the scanline interrupt */ /* Wait up to one second for the scanline interrupt */
wait_event_timeout(dcon_wait_queue, dcon_switched == 1, HZ); wait_event_timeout(dcon_wait_queue,
dcon_switched == 1, HZ);
} }
if (!dcon_switched) if (!dcon_switched)
...@@ -396,7 +398,7 @@ static void dcon_source_switch(struct work_struct *work) ...@@ -396,7 +398,7 @@ static void dcon_source_switch(struct work_struct *work)
int t; int t;
struct timespec delta_t; struct timespec delta_t;
printk("dcon_source_switch to DCON\n"); printk(KERN_INFO "dcon_source_switch to DCON\n");
add_wait_queue(&dcon_wait_queue, &wait); add_wait_queue(&dcon_wait_queue, &wait);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
...@@ -471,7 +473,8 @@ static void dcon_set_source_sync(int arg) ...@@ -471,7 +473,8 @@ static void dcon_set_source_sync(int arg)
flush_scheduled_work(); flush_scheduled_work();
} }
static int dconbl_set(struct backlight_device *dev) { static int dconbl_set(struct backlight_device *dev)
{
int level = dev->props.brightness; int level = dev->props.brightness;
...@@ -482,7 +485,8 @@ static int dconbl_set(struct backlight_device *dev) { ...@@ -482,7 +485,8 @@ static int dconbl_set(struct backlight_device *dev) {
return 0; return 0;
} }
static int dconbl_get(struct backlight_device *dev) { static int dconbl_get(struct backlight_device *dev)
{
return dcon_get_backlight(); return dcon_get_backlight();
} }
...@@ -521,7 +525,7 @@ static int _strtoul(const char *buf, int len, unsigned int *val) ...@@ -521,7 +525,7 @@ static int _strtoul(const char *buf, int len, unsigned int *val)
{ {
char *endp; char *endp;
unsigned int output = simple_strtoul(buf, &endp, 0); unsigned int output = strict_strtoul(buf, &endp, 0);
int size = endp - buf; int size = endp - buf;
if (*endp && isspace(*endp)) if (*endp && isspace(*endp))
...@@ -559,7 +563,7 @@ static ssize_t dcon_freeze_store(struct device *dev, ...@@ -559,7 +563,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
if (_strtoul(buf, count, &output)) if (_strtoul(buf, count, &output))
return -EINVAL; return -EINVAL;
printk("dcon_freeze_store: %d\n", output); printk(KERN_INFO "dcon_freeze_store: %d\n", output);
switch (output) { switch (output) {
case 0: case 0:
...@@ -568,7 +572,7 @@ static ssize_t dcon_freeze_store(struct device *dev, ...@@ -568,7 +572,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
case 1: case 1:
dcon_set_source_sync(DCON_SOURCE_DCON); dcon_set_source_sync(DCON_SOURCE_DCON);
break; break;
case 2: // normally unused case 2: /* normally unused */
dcon_set_source(DCON_SOURCE_DCON); dcon_set_source(DCON_SOURCE_DCON);
break; break;
default: default:
...@@ -620,7 +624,8 @@ static const struct backlight_ops dcon_bl_ops = { ...@@ -620,7 +624,8 @@ static const struct backlight_ops dcon_bl_ops = {
}; };
static int dcon_reboot_notify(struct notifier_block *nb, unsigned long foo, void *bar) static int dcon_reboot_notify(struct notifier_block *nb,
unsigned long foo, void *bar)
{ {
if (dcon_client == NULL) if (dcon_client == NULL)
return 0; return 0;
...@@ -636,7 +641,8 @@ static struct notifier_block dcon_nb = { ...@@ -636,7 +641,8 @@ static struct notifier_block dcon_nb = {
.priority = -1, .priority = -1,
}; };
static int unfreeze_on_panic(struct notifier_block *nb, unsigned long e, void *p) static int unfreeze_on_panic(struct notifier_block *nb,
unsigned long e, void *p)
{ {
pdata->set_dconload(1); pdata->set_dconload(1);
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -650,7 +656,8 @@ static struct notifier_block dcon_panic_nb = { ...@@ -650,7 +656,8 @@ static struct notifier_block dcon_panic_nb = {
* When the framebuffer sleeps due to external sources (e.g. user idle), power * When the framebuffer sleeps due to external sources (e.g. user idle), power
* down the DCON as well. Power it back up when the fb comes back to life. * down the DCON as well. Power it back up when the fb comes back to life.
*/ */
static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data) static int fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data)
{ {
struct fb_event *evdata = data; struct fb_event *evdata = data;
int *blank = (int *) evdata->data; int *blank = (int *) evdata->data;
...@@ -688,19 +695,20 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -688,19 +695,20 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
dcon_device = platform_device_alloc("dcon", -1); dcon_device = platform_device_alloc("dcon", -1);
if (dcon_device == NULL) { if (dcon_device == NULL) {
printk("dcon: Unable to create the DCON device\n"); printk(KERN_ERR "dcon: Unable to create the DCON device\n");
rc = -ENOMEM; rc = -ENOMEM;
goto eirq; goto eirq;
} }
/* Place holder...*/ /* Place holder...*/
i2c_set_clientdata(client, dcon_device); i2c_set_clientdata(client, dcon_device);
rc = platform_device_add(dcon_device);
if ((rc = platform_device_add(dcon_device))) { if (rc) {
printk("dcon: Unable to add the DCON device\n"); printk(KERN_ERR "dcon: Unable to add the DCON device\n");
goto edev; goto edev;
} }
for(i = 0; i < ARRAY_SIZE(dcon_device_files); i++) { for (i = 0; i < ARRAY_SIZE(dcon_device_files); i++) {
rc = device_create_file(&dcon_device->dev, rc = device_create_file(&dcon_device->dev,
&dcon_device_files[i]); &dcon_device_files[i]);
if (rc) { if (rc) {
...@@ -717,10 +725,10 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -717,10 +725,10 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
NULL, &dcon_bl_ops, NULL); NULL, &dcon_bl_ops, NULL);
if (IS_ERR(dcon_bl_dev)) { if (IS_ERR(dcon_bl_dev)) {
printk("Could not register the backlight device for the DCON (%ld)\n", PTR_ERR(dcon_bl_dev)); printk(KERN_ERR "Cannot register the backlight device (%ld)\n",
PTR_ERR(dcon_bl_dev));
dcon_bl_dev = NULL; dcon_bl_dev = NULL;
} } else {
else {
dcon_bl_dev->props.max_brightness = 15; dcon_bl_dev->props.max_brightness = 15;
dcon_bl_dev->props.power = FB_BLANK_UNBLANK; dcon_bl_dev->props.power = FB_BLANK_UNBLANK;
dcon_bl_dev->props.brightness = dcon_get_backlight(); dcon_bl_dev->props.brightness = dcon_get_backlight();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment