EDP: fixing bug with priority definitions
Sivaram Nair [Wed, 6 Feb 2013 16:06:32 +0000 (18:06 +0200)]
The min and max priority constants are defined incorrectly (in the wrong
order). This patch corrects it and updates the affected drivers and
platform data.

Change-Id: I94a628c4f4076d1c36dff1692f0427ad1f218fb5
Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
(cherry picked from commit 3d2fe9f41fdd54d4c79b7202680e93de8debc8a1)
Reviewed-on: http://git-master/r/198395
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

Documentation/edp/howto
arch/arm/mach-tegra/board-pluto-sensors.c
drivers/edp/edp.c
drivers/input/misc/max77665_haptic.c
drivers/video/backlight/max8831_bl.c
include/linux/edp.h

index 8433529..f845eb7 100644 (file)
@@ -155,7 +155,7 @@ examples show how the usual operations are performed.
                .states = modem_states,
                .num_states = ARRAY_SIZE(num_states),
                .e0_index = MODEM_EDP_E0,
-               .priority = EDP_MAX_PRIO - 3,
+               .priority = EDP_MAX_PRIO + 3,
                .max_borrowers = 1,
                ...
        };
index ede5d3a..27fb07a 100644 (file)
@@ -192,7 +192,7 @@ static struct max77665_f_platform_data pluto_max77665_flash_pdata = {
                .states = max77665_f_estates,
                .num_states = ARRAY_SIZE(max77665_f_estates),
                .e0_index = 3,
-               .priority = EDP_MAX_PRIO - 2,
+               .priority = EDP_MAX_PRIO + 2,
                },
 };
 
@@ -568,7 +568,7 @@ static struct imx091_platform_data imx091_pdata = {
                .states = imx091_estates,
                .num_states = ARRAY_SIZE(imx091_estates),
                .e0_index = 0,
-               .priority = EDP_MAX_PRIO - 1,
+               .priority = EDP_MAX_PRIO + 1,
                },
        .power_on               = pluto_imx091_power_on,
        .power_off              = pluto_imx091_power_off,
index ed0f13c..e4a728f 100644 (file)
@@ -219,8 +219,8 @@ static int register_client(struct edp_manager *mgr, struct edp_client *client)
        if (client->manager || find_client(mgr, client->name))
                return -EEXIST;
 
-       if (!states_ok(client) || client->priority < EDP_MIN_PRIO ||
-                       client->priority > EDP_MAX_PRIO ||
+       if (!states_ok(client) || client->priority > EDP_MIN_PRIO ||
+                       client->priority < EDP_MAX_PRIO ||
                        (client->e0_index && !client->throttle))
                return -EINVAL;
 
index eb1cb17..d47b668 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * MAX77665-haptic controller driver
  *
- * Copyright (c) 2012, NVIDIA Corporation, All Rights Reserved.
+ * Copyright (c) 2012-2013, NVIDIA Corporation, All Rights Reserved.
  *
  * Based on driver max8997_haptic.c
  * Copyright (c) 2012 Samsung Electronics
@@ -466,7 +466,7 @@ static int __devinit max77665_haptic_probe(struct platform_device *pdev)
        chip->haptic_edp_client->states = haptic_pdata->edp_states;
        chip->haptic_edp_client->num_states = MAX77665_HAPTIC_EDP_NUM_STATES;
        chip->haptic_edp_client->e0_index = MAX77665_HAPTIC_EDP_LOW;
-       chip->haptic_edp_client->priority = EDP_MAX_PRIO - 2;
+       chip->haptic_edp_client->priority = EDP_MAX_PRIO + 2;
        chip->haptic_edp_client->throttle = max77665_haptic_throttle;
        chip->haptic_edp_client->private_data = chip;
 
index c99a25f..cfb1803 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Backlight LEDs driver for MAX8831
  *
- * Copyright (c) 2008-2012, NVIDIA Corporation.
+ * Copyright (c) 2008-2013, NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -189,7 +189,7 @@ static int __devinit max8831_bl_probe(struct platform_device *pdev)
        data->max8831_edp_client->num_states = MAX8831_EDP_NUM_STATES;
        data->max8831_edp_client->e0_index = MAX8831_EDP_ZERO;
        data->max8831_edp_client->private_data = bl;
-       data->max8831_edp_client->priority = EDP_MAX_PRIO - 2;
+       data->max8831_edp_client->priority = EDP_MAX_PRIO + 2;
        data->max8831_edp_client->throttle = max8831_backlight_throttle;
 
        battery_manager = edp_get_manager("battery");
index c5acab6..7a72072 100644 (file)
@@ -22,8 +22,8 @@
 #include <linux/workqueue.h>
 
 #define EDP_NAME_LEN   16
-#define EDP_MIN_PRIO   0
-#define EDP_MAX_PRIO   19
+#define EDP_MIN_PRIO   19
+#define EDP_MAX_PRIO   0
 
 struct edp_manager {
        char name[EDP_NAME_LEN];