Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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

parent a90dcd4f
Loading
Loading
Loading
Loading
+46 −38
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
#include <linux/backlight.h>
#include <linux/device.h>
#include <linux/notifier.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include <linux/ctype.h>
#include <linux/reboot.h>
#include <asm/tsc.h>
@@ -117,7 +117,8 @@ static int dcon_hw_init(struct i2c_client *client, int is_init)
	if (is_init) {
		printk(KERN_INFO "olpc-dcon:  Discovered DCON version %x\n",
				ver & 0xFF);
		if ((rc = pdata->init()) != 0) {
		rc = pdata->init();
		if (rc != 0) {
			printk(KERN_ERR "olpc-dcon:  Unable to init.\n");
			goto err;
		}
@@ -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, 0x41, 0x0101);
		i2c_smbus_write_word_data(client, 0x42, 0x0101);
	}
	else if (!noinit) {
	} else if (!noinit) {
		/* SDRAM setup/hold time */
		i2c_smbus_write_word_data(client, 0x3a, 0xc040);
		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)
power_up:
	if (is_powered_down) {
		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 "
					"to power up: %d!\n", x);
			return x;
@@ -261,8 +262,7 @@ static int dcon_set_output(int arg)
	if (arg == DCON_OUTPUT_MONO) {
		dcon_disp_mode &= ~(MODE_CSWIZZLE | MODE_COL_AA);
		dcon_disp_mode |= MODE_MONO_LUMA;
	}
	else {
	} else {
		dcon_disp_mode &= ~(MODE_MONO_LUMA);
		dcon_disp_mode |= MODE_CSWIZZLE;
		if (useaa)
@@ -291,18 +291,18 @@ static void dcon_sleep(int state)

	if (state == DCON_SLEEP) {
		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 "
					"to power down: %d!\n", x);
		else
			dcon_sleep_val = state;
	}
	else {
	} else {
		/* Only re-enable the backlight if the backlight value is set */
		if (bl_val != 0)
			dcon_disp_mode |= MODE_BL_ENABLE;

		if ((x=dcon_bus_stabilize(dcon_client, 1)))
		x = dcon_bus_stabilize(dcon_client, 1);
		if (x)
			printk(KERN_WARNING "olpc-dcon:  unable to reinit dcon"
					" hardware: %d!\n", x);
		else
@@ -352,10 +352,12 @@ static void dcon_source_switch(struct work_struct *work)
		printk("dcon_source_switch to CPU\n");
		/* Enable the scanline interrupt bit */
		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 {
			/* 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)
@@ -396,7 +398,7 @@ static void dcon_source_switch(struct work_struct *work)
		int 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);
		set_current_state(TASK_UNINTERRUPTIBLE);
@@ -471,7 +473,8 @@ static void dcon_set_source_sync(int arg)
	flush_scheduled_work();
}

static int dconbl_set(struct backlight_device *dev) {
static int dconbl_set(struct backlight_device *dev)
{

	int level = dev->props.brightness;

@@ -482,7 +485,8 @@ static int dconbl_set(struct backlight_device *dev) {
	return 0;
}

static int dconbl_get(struct backlight_device *dev) {
static int dconbl_get(struct backlight_device *dev)
{
	return dcon_get_backlight();
}

@@ -521,7 +525,7 @@ static int _strtoul(const char *buf, int len, unsigned int *val)
{

	char *endp;
	unsigned int output = simple_strtoul(buf, &endp, 0);
	unsigned int output = strict_strtoul(buf, &endp, 0);
	int size = endp - buf;

	if (*endp && isspace(*endp))
@@ -559,7 +563,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
	if (_strtoul(buf, count, &output))
		return -EINVAL;

	printk("dcon_freeze_store: %d\n", output);
	printk(KERN_INFO "dcon_freeze_store: %d\n", output);

	switch (output) {
	case 0:
@@ -568,7 +572,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
	case 1:
		dcon_set_source_sync(DCON_SOURCE_DCON);
		break;
	case 2:  // normally unused
	case 2:  /* normally unused */
		dcon_set_source(DCON_SOURCE_DCON);
		break;
	default:
@@ -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)
		return 0;
@@ -636,7 +641,8 @@ static struct notifier_block dcon_nb = {
	.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);
	return NOTIFY_DONE;
@@ -650,7 +656,8 @@ static struct notifier_block dcon_panic_nb = {
 * 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.
 */
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;
	int *blank = (int *) evdata->data;
@@ -688,15 +695,16 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
	dcon_device = platform_device_alloc("dcon", -1);

	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;
		goto eirq;
	}
	/* Place holder...*/
	i2c_set_clientdata(client, dcon_device);
	rc = platform_device_add(dcon_device);

	if ((rc = platform_device_add(dcon_device))) {
		printk("dcon:  Unable to add the DCON device\n");
	if (rc) {
		printk(KERN_ERR "dcon:  Unable to add the DCON device\n");
		goto edev;
	}

@@ -717,10 +725,10 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
		NULL, &dcon_bl_ops, NULL);

	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;
	}
	else {
	} else {
		dcon_bl_dev->props.max_brightness = 15;
		dcon_bl_dev->props.power = FB_BLANK_UNBLANK;
		dcon_bl_dev->props.brightness = dcon_get_backlight();