]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
da850-evm: extract defines for SEL{A,B,C} pins in UI expander
authorBen Gardiner <bengardiner@nanometrics.ca>
Thu, 9 Dec 2010 21:51:05 +0000 (16:51 -0500)
committerKevin Hilman <khilman@deeprootsystems.com>
Wed, 22 Dec 2010 19:45:19 +0000 (11:45 -0800)
The setup and teardown methods of the UI expander reference the SEL_{A,B,C}
pins by 'magic number' in each function. This uses the common enum for their offsets
in the expander setup and teardown functions.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
CC: Victor Rodriguez <vm.rod25@gmail.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/board-da850-evm.c

index 93bd43e93c450ac1054040e0ad3d40df1721c5ba..f9969dead63bdc7eb4aa0b6bc5a622e9f273fc35 100644 (file)
@@ -360,23 +360,23 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
 {
        int sel_a, sel_b, sel_c, ret;
 
-       sel_a = gpio + 7;
-       sel_b = gpio + 6;
-       sel_c = gpio + 5;
+       sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
+       sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
+       sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
 
-       ret = gpio_request(sel_a, "sel_a");
+       ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
        if (ret) {
                pr_warning("Cannot open UI expander pin %d\n", sel_a);
                goto exp_setup_sela_fail;
        }
 
-       ret = gpio_request(sel_b, "sel_b");
+       ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
        if (ret) {
                pr_warning("Cannot open UI expander pin %d\n", sel_b);
                goto exp_setup_selb_fail;
        }
 
-       ret = gpio_request(sel_c, "sel_c");
+       ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
        if (ret) {
                pr_warning("Cannot open UI expander pin %d\n", sel_c);
                goto exp_setup_selc_fail;
@@ -419,13 +419,13 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client,
        platform_device_unregister(&da850_evm_ui_keys_device);
 
        /* deselect all functionalities */
-       gpio_set_value_cansleep(gpio + 5, 1);
-       gpio_set_value_cansleep(gpio + 6, 1);
-       gpio_set_value_cansleep(gpio + 7, 1);
+       gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
+       gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
+       gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
 
-       gpio_free(gpio + 5);
-       gpio_free(gpio + 6);
-       gpio_free(gpio + 7);
+       gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
+       gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
+       gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
 
        return 0;
 }