aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorÉric Piel <eric.piel@tremplin-utc.net>2011-10-31 20:10:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 20:30:52 -0400
commitd7f81d4299cdc8cf06fc9562ec3dafce528bd6ff (patch)
tree60f021811bea7252c9eb555cbddc055f7d8a66ed /drivers
parent0021586b958d7eb5d73dbb9c42a0b4f19ebe3a9e (diff)
lis3: use consistent naming of variables
Signed-off-by: Ilkka Koskinen <ilkka.koskinen@nokia.com> Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net> Cc: Matthew Garrett <mjg@redhat.com> Cc: Witold Pilat <witold.pilat@gmail.com> Cc: Lyall Pearce <lyall.pearce@hp.com> Cc: Malte Starostik <m-starostik@versanet.de> Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Cc: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/lis3lv02d/lis3lv02d.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index 1fc671566562..eaef96bbbdfd 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -833,23 +833,23 @@ int lis3lv02d_remove_fs(struct lis3lv02d *lis3)
833} 833}
834EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); 834EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);
835 835
836static void lis3lv02d_8b_configure(struct lis3lv02d *dev, 836static void lis3lv02d_8b_configure(struct lis3lv02d *lis3,
837 struct lis3lv02d_platform_data *p) 837 struct lis3lv02d_platform_data *p)
838{ 838{
839 int err; 839 int err;
840 int ctrl2 = p->hipass_ctrl; 840 int ctrl2 = p->hipass_ctrl;
841 841
842 if (p->click_flags) { 842 if (p->click_flags) {
843 dev->write(dev, CLICK_CFG, p->click_flags); 843 lis3->write(lis3, CLICK_CFG, p->click_flags);
844 dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit); 844 lis3->write(lis3, CLICK_TIMELIMIT, p->click_time_limit);
845 dev->write(dev, CLICK_LATENCY, p->click_latency); 845 lis3->write(lis3, CLICK_LATENCY, p->click_latency);
846 dev->write(dev, CLICK_WINDOW, p->click_window); 846 lis3->write(lis3, CLICK_WINDOW, p->click_window);
847 dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf); 847 lis3->write(lis3, CLICK_THSZ, p->click_thresh_z & 0xf);
848 dev->write(dev, CLICK_THSY_X, 848 lis3->write(lis3, CLICK_THSY_X,
849 (p->click_thresh_x & 0xf) | 849 (p->click_thresh_x & 0xf) |
850 (p->click_thresh_y << 4)); 850 (p->click_thresh_y << 4));
851 851
852 if (dev->idev) { 852 if (lis3->idev) {
853 struct input_dev *input_dev = lis3_dev.idev->input; 853 struct input_dev *input_dev = lis3_dev.idev->input;
854 input_set_capability(input_dev, EV_KEY, BTN_X); 854 input_set_capability(input_dev, EV_KEY, BTN_X);
855 input_set_capability(input_dev, EV_KEY, BTN_Y); 855 input_set_capability(input_dev, EV_KEY, BTN_Y);
@@ -858,22 +858,22 @@ static void lis3lv02d_8b_configure(struct lis3lv02d *dev,
858 } 858 }
859 859
860 if (p->wakeup_flags) { 860 if (p->wakeup_flags) {
861 dev->write(dev, FF_WU_CFG_1, p->wakeup_flags); 861 lis3->write(lis3, FF_WU_CFG_1, p->wakeup_flags);
862 dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f); 862 lis3->write(lis3, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
863 /* pdata value + 1 to keep this backward compatible*/ 863 /* pdata value + 1 to keep this backward compatible*/
864 dev->write(dev, FF_WU_DURATION_1, p->duration1 + 1); 864 lis3->write(lis3, FF_WU_DURATION_1, p->duration1 + 1);
865 ctrl2 ^= HP_FF_WU1; /* Xor to keep compatible with old pdata*/ 865 ctrl2 ^= HP_FF_WU1; /* Xor to keep compatible with old pdata*/
866 } 866 }
867 867
868 if (p->wakeup_flags2) { 868 if (p->wakeup_flags2) {
869 dev->write(dev, FF_WU_CFG_2, p->wakeup_flags2); 869 lis3->write(lis3, FF_WU_CFG_2, p->wakeup_flags2);
870 dev->write(dev, FF_WU_THS_2, p->wakeup_thresh2 & 0x7f); 870 lis3->write(lis3, FF_WU_THS_2, p->wakeup_thresh2 & 0x7f);
871 /* pdata value + 1 to keep this backward compatible*/ 871 /* pdata value + 1 to keep this backward compatible*/
872 dev->write(dev, FF_WU_DURATION_2, p->duration2 + 1); 872 lis3->write(lis3, FF_WU_DURATION_2, p->duration2 + 1);
873 ctrl2 ^= HP_FF_WU2; /* Xor to keep compatible with old pdata*/ 873 ctrl2 ^= HP_FF_WU2; /* Xor to keep compatible with old pdata*/
874 } 874 }
875 /* Configure hipass filters */ 875 /* Configure hipass filters */
876 dev->write(dev, CTRL_REG2, ctrl2); 876 lis3->write(lis3, CTRL_REG2, ctrl2);
877 877
878 if (p->irq2) { 878 if (p->irq2) {
879 err = request_threaded_irq(p->irq2, 879 err = request_threaded_irq(p->irq2,
@@ -891,72 +891,72 @@ static void lis3lv02d_8b_configure(struct lis3lv02d *dev,
891 * Initialise the accelerometer and the various subsystems. 891 * Initialise the accelerometer and the various subsystems.
892 * Should be rather independent of the bus system. 892 * Should be rather independent of the bus system.
893 */ 893 */
894int lis3lv02d_init_device(struct lis3lv02d *dev) 894int lis3lv02d_init_device(struct lis3lv02d *lis3)
895{ 895{
896 int err; 896 int err;
897 irq_handler_t thread_fn; 897 irq_handler_t thread_fn;
898 int irq_flags = 0; 898 int irq_flags = 0;
899 899
900 dev->whoami = lis3lv02d_read_8(dev, WHO_AM_I); 900 lis3->whoami = lis3lv02d_read_8(lis3, WHO_AM_I);
901 901
902 switch (dev->whoami) { 902 switch (lis3->whoami) {
903 case WAI_12B: 903 case WAI_12B:
904 pr_info("12 bits sensor found\n"); 904 pr_info("12 bits sensor found\n");
905 dev->read_data = lis3lv02d_read_12; 905 lis3->read_data = lis3lv02d_read_12;
906 dev->mdps_max_val = 2048; 906 lis3->mdps_max_val = 2048;
907 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_12B; 907 lis3->pwron_delay = LIS3_PWRON_DELAY_WAI_12B;
908 dev->odrs = lis3_12_rates; 908 lis3->odrs = lis3_12_rates;
909 dev->odr_mask = CTRL1_DF0 | CTRL1_DF1; 909 lis3->odr_mask = CTRL1_DF0 | CTRL1_DF1;
910 dev->scale = LIS3_SENSITIVITY_12B; 910 lis3->scale = LIS3_SENSITIVITY_12B;
911 dev->regs = lis3_wai12_regs; 911 lis3->regs = lis3_wai12_regs;
912 dev->regs_size = ARRAY_SIZE(lis3_wai12_regs); 912 lis3->regs_size = ARRAY_SIZE(lis3_wai12_regs);
913 break; 913 break;
914 case WAI_8B: 914 case WAI_8B:
915 pr_info("8 bits sensor found\n"); 915 pr_info("8 bits sensor found\n");
916 dev->read_data = lis3lv02d_read_8; 916 lis3->read_data = lis3lv02d_read_8;
917 dev->mdps_max_val = 128; 917 lis3->mdps_max_val = 128;
918 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B; 918 lis3->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
919 dev->odrs = lis3_8_rates; 919 lis3->odrs = lis3_8_rates;
920 dev->odr_mask = CTRL1_DR; 920 lis3->odr_mask = CTRL1_DR;
921 dev->scale = LIS3_SENSITIVITY_8B; 921 lis3->scale = LIS3_SENSITIVITY_8B;
922 dev->regs = lis3_wai8_regs; 922 lis3->regs = lis3_wai8_regs;
923 dev->regs_size = ARRAY_SIZE(lis3_wai8_regs); 923 lis3->regs_size = ARRAY_SIZE(lis3_wai8_regs);
924 break; 924 break;
925 case WAI_3DC: 925 case WAI_3DC:
926 pr_info("8 bits 3DC sensor found\n"); 926 pr_info("8 bits 3DC sensor found\n");
927 dev->read_data = lis3lv02d_read_8; 927 lis3->read_data = lis3lv02d_read_8;
928 dev->mdps_max_val = 128; 928 lis3->mdps_max_val = 128;
929 dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B; 929 lis3->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
930 dev->odrs = lis3_3dc_rates; 930 lis3->odrs = lis3_3dc_rates;
931 dev->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3; 931 lis3->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3;
932 dev->scale = LIS3_SENSITIVITY_8B; 932 lis3->scale = LIS3_SENSITIVITY_8B;
933 break; 933 break;
934 default: 934 default:
935 pr_err("unknown sensor type 0x%X\n", dev->whoami); 935 pr_err("unknown sensor type 0x%X\n", lis3->whoami);
936 return -EINVAL; 936 return -EINVAL;
937 } 937 }
938 938
939 dev->reg_cache = kzalloc(max(sizeof(lis3_wai8_regs), 939 lis3->reg_cache = kzalloc(max(sizeof(lis3_wai8_regs),
940 sizeof(lis3_wai12_regs)), GFP_KERNEL); 940 sizeof(lis3_wai12_regs)), GFP_KERNEL);
941 941
942 if (dev->reg_cache == NULL) { 942 if (lis3->reg_cache == NULL) {
943 printk(KERN_ERR DRIVER_NAME "out of memory\n"); 943 printk(KERN_ERR DRIVER_NAME "out of memory\n");
944 return -ENOMEM; 944 return -ENOMEM;
945 } 945 }
946 946
947 mutex_init(&dev->mutex); 947 mutex_init(&lis3->mutex);
948 atomic_set(&dev->wake_thread, 0); 948 atomic_set(&lis3->wake_thread, 0);
949 949
950 lis3lv02d_add_fs(dev); 950 lis3lv02d_add_fs(lis3);
951 err = lis3lv02d_poweron(dev); 951 err = lis3lv02d_poweron(lis3);
952 if (err) { 952 if (err) {
953 lis3lv02d_remove_fs(dev); 953 lis3lv02d_remove_fs(lis3);
954 return err; 954 return err;
955 } 955 }
956 956
957 if (dev->pm_dev) { 957 if (lis3->pm_dev) {
958 pm_runtime_set_active(dev->pm_dev); 958 pm_runtime_set_active(lis3->pm_dev);
959 pm_runtime_enable(dev->pm_dev); 959 pm_runtime_enable(lis3->pm_dev);
960 } 960 }
961 961
962 if (lis3lv02d_joystick_enable()) 962 if (lis3lv02d_joystick_enable())
@@ -964,24 +964,24 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
964 964
965 /* passing in platform specific data is purely optional and only 965 /* passing in platform specific data is purely optional and only
966 * used by the SPI transport layer at the moment */ 966 * used by the SPI transport layer at the moment */
967 if (dev->pdata) { 967 if (lis3->pdata) {
968 struct lis3lv02d_platform_data *p = dev->pdata; 968 struct lis3lv02d_platform_data *p = lis3->pdata;
969 969
970 if (dev->whoami == WAI_8B) 970 if (lis3->whoami == WAI_8B)
971 lis3lv02d_8b_configure(dev, p); 971 lis3lv02d_8b_configure(lis3, p);
972 972
973 irq_flags = p->irq_flags1 & IRQF_TRIGGER_MASK; 973 irq_flags = p->irq_flags1 & IRQF_TRIGGER_MASK;
974 974
975 dev->irq_cfg = p->irq_cfg; 975 lis3->irq_cfg = p->irq_cfg;
976 if (p->irq_cfg) 976 if (p->irq_cfg)
977 dev->write(dev, CTRL_REG3, p->irq_cfg); 977 lis3->write(lis3, CTRL_REG3, p->irq_cfg);
978 978
979 if (p->default_rate) 979 if (p->default_rate)
980 lis3lv02d_set_odr(p->default_rate); 980 lis3lv02d_set_odr(p->default_rate);
981 } 981 }
982 982
983 /* bail if we did not get an IRQ from the bus layer */ 983 /* bail if we did not get an IRQ from the bus layer */
984 if (!dev->irq) { 984 if (!lis3->irq) {
985 pr_debug("No IRQ. Disabling /dev/freefall\n"); 985 pr_debug("No IRQ. Disabling /dev/freefall\n");
986 goto out; 986 goto out;
987 } 987 }
@@ -997,12 +997,12 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
997 * io-apic is not configurable (and generates a warning) but I keep it 997 * io-apic is not configurable (and generates a warning) but I keep it
998 * in case of support for other hardware. 998 * in case of support for other hardware.
999 */ 999 */
1000 if (dev->pdata && dev->whoami == WAI_8B) 1000 if (lis3->pdata && lis3->whoami == WAI_8B)
1001 thread_fn = lis302dl_interrupt_thread1_8b; 1001 thread_fn = lis302dl_interrupt_thread1_8b;
1002 else 1002 else
1003 thread_fn = NULL; 1003 thread_fn = NULL;
1004 1004
1005 err = request_threaded_irq(dev->irq, lis302dl_interrupt, 1005 err = request_threaded_irq(lis3->irq, lis302dl_interrupt,
1006 thread_fn, 1006 thread_fn,
1007 IRQF_TRIGGER_RISING | IRQF_ONESHOT | 1007 IRQF_TRIGGER_RISING | IRQF_ONESHOT |
1008 irq_flags, 1008 irq_flags,