aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joydev.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-08-02 23:15:17 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-02 23:29:56 -0400
commit987a6c0298260b7aa40702b349282554d6180e4b (patch)
tree29d0873435221a6d731267efc2412814440e4a28 /drivers/input/joydev.c
parent7957e9c4d175cc065f4277211fcb7d784fcee860 (diff)
Input: switch to input_abs_*() access functions
Change all call sites in drivers/input to not access the ABS axis information directly anymore. Make them use the access helpers instead. Also use input_set_abs_params() when possible. Did some code refactoring as I was on it. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r--drivers/input/joydev.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 63834585c283..d85bd8a7967d 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -530,7 +530,7 @@ static int joydev_ioctl_common(struct joydev *joydev,
530{ 530{
531 struct input_dev *dev = joydev->handle.dev; 531 struct input_dev *dev = joydev->handle.dev;
532 size_t len; 532 size_t len;
533 int i, j; 533 int i;
534 const char *name; 534 const char *name;
535 535
536 /* Process fixed-sized commands. */ 536 /* Process fixed-sized commands. */
@@ -562,12 +562,11 @@ static int joydev_ioctl_common(struct joydev *joydev,
562 case JSIOCSCORR: 562 case JSIOCSCORR:
563 if (copy_from_user(joydev->corr, argp, 563 if (copy_from_user(joydev->corr, argp,
564 sizeof(joydev->corr[0]) * joydev->nabs)) 564 sizeof(joydev->corr[0]) * joydev->nabs))
565 return -EFAULT; 565 return -EFAULT;
566 566
567 for (i = 0; i < joydev->nabs; i++) { 567 for (i = 0; i < joydev->nabs; i++) {
568 j = joydev->abspam[i]; 568 int val = input_abs_get_val(dev, joydev->abspam[i]);
569 joydev->abs[i] = joydev_correct(dev->abs[j], 569 joydev->abs[i] = joydev_correct(val, &joydev->corr[i]);
570 &joydev->corr[i]);
571 } 570 }
572 return 0; 571 return 0;
573 572
@@ -848,25 +847,27 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
848 847
849 for (i = 0; i < joydev->nabs; i++) { 848 for (i = 0; i < joydev->nabs; i++) {
850 j = joydev->abspam[i]; 849 j = joydev->abspam[i];
851 if (dev->absmax[j] == dev->absmin[j]) { 850 if (input_abs_get_max(dev, j) == input_abs_get_min(dev, j)) {
852 joydev->corr[i].type = JS_CORR_NONE; 851 joydev->corr[i].type = JS_CORR_NONE;
853 joydev->abs[i] = dev->abs[j]; 852 joydev->abs[i] = input_abs_get_val(dev, j);
854 continue; 853 continue;
855 } 854 }
856 joydev->corr[i].type = JS_CORR_BROKEN; 855 joydev->corr[i].type = JS_CORR_BROKEN;
857 joydev->corr[i].prec = dev->absfuzz[j]; 856 joydev->corr[i].prec = input_abs_get_fuzz(dev, j);
858 joydev->corr[i].coef[0] = 857
859 (dev->absmax[j] + dev->absmin[j]) / 2 - dev->absflat[j]; 858 t = (input_abs_get_max(dev, j) + input_abs_get_min(dev, j)) / 2;
860 joydev->corr[i].coef[1] = 859 joydev->corr[i].coef[0] = t - input_abs_get_flat(dev, j);
861 (dev->absmax[j] + dev->absmin[j]) / 2 + dev->absflat[j]; 860 joydev->corr[i].coef[1] = t + input_abs_get_flat(dev, j);
862 861
863 t = (dev->absmax[j] - dev->absmin[j]) / 2 - 2 * dev->absflat[j]; 862 t = (input_abs_get_max(dev, j) - input_abs_get_min(dev, j)) / 2
863 - 2 * input_abs_get_flat(dev, j);
864 if (t) { 864 if (t) {
865 joydev->corr[i].coef[2] = (1 << 29) / t; 865 joydev->corr[i].coef[2] = (1 << 29) / t;
866 joydev->corr[i].coef[3] = (1 << 29) / t; 866 joydev->corr[i].coef[3] = (1 << 29) / t;
867 867
868 joydev->abs[i] = joydev_correct(dev->abs[j], 868 joydev->abs[i] =
869 joydev->corr + i); 869 joydev_correct(input_abs_get_val(dev, j),
870 joydev->corr + i);
870 } 871 }
871 } 872 }
872 873