Skip to contentSkip to conversation

lis3lv02d: switch to using input device polling mode

PATCH In review Dmitry Torokhov 3 participants 6 messages Oct 2, 2019 – Oct 9, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lis3lv02d: switch to using input device polling mode

Now that instances of input_dev support polling mode natively, we no longer need to create input_polled_dev instance.

---
 drivers/misc/Kconfig               |  1 -
 drivers/misc/lis3lv02d/lis3lv02d.c | 80 ++++++++++++++++--------------
 drivers/misc/lis3lv02d/lis3lv02d.h |  4 +-
 3 files changed, 46 insertions(+), 39 deletions(-)
drivers/misc/Kconfig +0 -1
index 16900357afc2..02c53b20c632 100644
@@ -8,7 +8,6 @@ menu "Misc devices"
 config SENSORS_LIS3LV02D
 	tristate
 	depends on INPUT
-	select INPUT_POLLDEV
 
 config AD525X_DPOT
 	tristate "Analog Devices Digital Potentiometers"
drivers/misc/lis3lv02d/lis3lv02d.c +44 -36

154 lines not on this page · raw message

drivers/misc/lis3lv02d/lis3lv02d.h +2 -2
index 1b0c99883c57..c394c0b08519 100644
@@ -6,7 +6,7 @@
  *  Copyright (C) 2008-2009 Eric Piel
  */
 #include <linux/platform_device.h>
-#include <linux/input-polldev.h>
+#include <linux/input.h>
 #include <linux/regulator/consumer.h>
 #include <linux/miscdevice.h>
 
@@ -281,7 +281,7 @@ struct lis3lv02d {
 					* (1/1000th of earth gravity)
 					*/
 
-	struct input_polled_dev	*idev;     /* input device */
+	struct input_dev	*idev;     /* input device */
 	struct platform_device	*pdev;     /* platform device */
 	struct regulator_bulk_data regulators[2];
 	atomic_t		count;     /* interrupt count after last read */
Signature · 5 lines
2.23.0.444.g18eeb5a265-goog


-- 
Dmitry
#1 lore raw
I love your patch! Yet something to improve:

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[cannot apply to v5.4-rc1 next-20191002]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/lis3lv02d-switch-to-using-input-device-polling-mode/20191003-062746
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=xtensa

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers/misc/lis3lv02d/lis3lv02d.c: In function 'lis3lv02d_joystick_enable':

>> drivers/misc/lis3lv02d/lis3lv02d.c:713:8: error: implicit declaration of function 'input_setup_polling'; did you mean 'input_set_capability'? [-Werror=implicit-function-declaration]
     err = input_setup_polling(input_dev, lis3lv02d_joystick_poll);
           ^~~~~~~~~~~~~~~~~~~
           input_set_capability
>> drivers/misc/lis3lv02d/lis3lv02d.c:717:2: error: implicit declaration of function 'input_set_poll_interval'; did you mean 'input_set_abs_params'? [-Werror=implicit-function-declaration]
     input_set_poll_interval(input_dev, MDPS_POLL_INTERVAL);
     ^~~~~~~~~~~~~~~~~~~~~~~
     input_set_abs_params
>> drivers/misc/lis3lv02d/lis3lv02d.c:718:2: error: implicit declaration of function 'input_set_min_poll_interval' [-Werror=implicit-function-declaration]
     input_set_min_poll_interval(input_dev, MDPS_POLL_MIN);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/misc/lis3lv02d/lis3lv02d.c:719:2: error: implicit declaration of function 'input_set_max_poll_interval'; did you mean 'input_set_capability'? [-Werror=implicit-function-declaration]
     input_set_max_poll_interval(input_dev, MDPS_POLL_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
     input_set_capability

cc1: some warnings being treated as errors

vim +713 drivers/misc/lis3lv02d/lis3lv02d.c

671
672 int lis3lv02d_joystick_enable(struct lis3lv02d *lis3)
673 {
674 struct input_dev *input_dev;
675 int err;
676 int max_val, fuzz, flat;
677 int btns[] = {BTN_X, BTN_Y, BTN_Z};
678
679 if (lis3->idev)
680 return -EINVAL;
681
682 input_dev = input_allocate_device();
683 if (!input_dev)
684 return -ENOMEM;
685
686 input_dev->name = "ST LIS3LV02DL Accelerometer";
687 input_dev->phys = DRIVER_NAME "/input0";
688 input_dev->id.bustype = BUS_HOST;
689 input_dev->id.vendor = 0;
690 input_dev->dev.parent = &lis3->pdev->dev;
691
692 input_dev->open = lis3lv02d_joystick_open;
693 input_dev->close = lis3lv02d_joystick_close;
694
695 max_val = (lis3->mdps_max_val * lis3->scale) / LIS3_ACCURACY;
696 if (lis3->whoami == WAI_12B) {
697 fuzz = LIS3_DEFAULT_FUZZ_12B;
698 flat = LIS3_DEFAULT_FLAT_12B;
699 } else {
700 fuzz = LIS3_DEFAULT_FUZZ_8B;
701 flat = LIS3_DEFAULT_FLAT_8B;
702 }
703 fuzz = (fuzz * lis3->scale) / LIS3_ACCURACY;
704 flat = (flat * lis3->scale) / LIS3_ACCURACY;
705
706 input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat);
707 input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat);
708 input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat);
709
710 input_set_drvdata(input_dev, lis3);
711 lis3->idev = input_dev;
712

 > 713		err = input_setup_polling(input_dev, lis3lv02d_joystick_poll);
   714		if (err)
   715			goto err_free_input;
   716	
 > 717		input_set_poll_interval(input_dev, MDPS_POLL_INTERVAL);
 > 718		input_set_min_poll_interval(input_dev, MDPS_POLL_MIN);
 > 719		input_set_max_poll_interval(input_dev, MDPS_POLL_MAX);

720
721 lis3->mapped_btns[0] = lis3lv02d_get_axis(abs(lis3->ac.x), btns);
722 lis3->mapped_btns[1] = lis3lv02d_get_axis(abs(lis3->ac.y), btns);
723 lis3->mapped_btns[2] = lis3lv02d_get_axis(abs(lis3->ac.z), btns);
724
725 err = input_register_device(lis3->idev);
726 if (err)
727 goto err_free_input;
728
729 return 0;
730
731 err_free_input:
732 input_free_device(input_dev);
733 lis3->idev = NULL;
734 return err;
735

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#2 lore raw
In reply to Dmitry Torokhov
I love your patch! Yet something to improve:

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[cannot apply to v5.4-rc1 next-20191002]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/lis3lv02d-switch-to-using-input-device-polling-mode/20191003-062746
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=parisc

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers/misc/lis3lv02d/lis3lv02d.c: In function 'lis3lv02d_joystick_enable':
drivers/misc/lis3lv02d/lis3lv02d.c:713:8: error: implicit declaration of function 'input_setup_polling'; did you mean 'input_set_capability'? [-Werror=implicit-function-declaration]

     err = input_setup_polling(input_dev, lis3lv02d_joystick_poll);
           ^~~~~~~~~~~~~~~~~~~
           input_set_capability
>> drivers/misc/lis3lv02d/lis3lv02d.c:717:2: error: implicit declaration of function 'input_set_poll_interval'; did you mean '__put_user_internal'? [-Werror=implicit-function-declaration]
     input_set_poll_interval(input_dev, MDPS_POLL_INTERVAL);
     ^~~~~~~~~~~~~~~~~~~~~~~
     __put_user_internal
   drivers/misc/lis3lv02d/lis3lv02d.c:718:2: error: implicit declaration of function 'input_set_min_poll_interval' [-Werror=implicit-function-declaration]
     input_set_min_poll_interval(input_dev, MDPS_POLL_MIN);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/misc/lis3lv02d/lis3lv02d.c:719:2: error: implicit declaration of function 'input_set_max_poll_interval'; did you mean 'input_set_capability'? [-Werror=implicit-function-declaration]
     input_set_max_poll_interval(input_dev, MDPS_POLL_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
     input_set_capability

cc1: some warnings being treated as errors

vim +717 drivers/misc/lis3lv02d/lis3lv02d.c

671
672 int lis3lv02d_joystick_enable(struct lis3lv02d *lis3)
673 {
674 struct input_dev *input_dev;
675 int err;
676 int max_val, fuzz, flat;
677 int btns[] = {BTN_X, BTN_Y, BTN_Z};
678
679 if (lis3->idev)
680 return -EINVAL;
681
682 input_dev = input_allocate_device();
683 if (!input_dev)
684 return -ENOMEM;
685
686 input_dev->name = "ST LIS3LV02DL Accelerometer";
687 input_dev->phys = DRIVER_NAME "/input0";
688 input_dev->id.bustype = BUS_HOST;
689 input_dev->id.vendor = 0;
690 input_dev->dev.parent = &lis3->pdev->dev;
691
692 input_dev->open = lis3lv02d_joystick_open;
693 input_dev->close = lis3lv02d_joystick_close;
694
695 max_val = (lis3->mdps_max_val * lis3->scale) / LIS3_ACCURACY;
696 if (lis3->whoami == WAI_12B) {
697 fuzz = LIS3_DEFAULT_FUZZ_12B;
698 flat = LIS3_DEFAULT_FLAT_12B;
699 } else {
700 fuzz = LIS3_DEFAULT_FUZZ_8B;
701 flat = LIS3_DEFAULT_FLAT_8B;
702 }
703 fuzz = (fuzz * lis3->scale) / LIS3_ACCURACY;
704 flat = (flat * lis3->scale) / LIS3_ACCURACY;
705
706 input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat);
707 input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat);
708 input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat);
709
710 input_set_drvdata(input_dev, lis3);
711 lis3->idev = input_dev;
712

 > 713		err = input_setup_polling(input_dev, lis3lv02d_joystick_poll);
   714		if (err)
   715			goto err_free_input;
   716	
 > 717		input_set_poll_interval(input_dev, MDPS_POLL_INTERVAL);

718 input_set_min_poll_interval(input_dev, MDPS_POLL_MIN);
719 input_set_max_poll_interval(input_dev, MDPS_POLL_MAX);
720
721 lis3->mapped_btns[0] = lis3lv02d_get_axis(abs(lis3->ac.x), btns);
722 lis3->mapped_btns[1] = lis3lv02d_get_axis(abs(lis3->ac.y), btns);
723 lis3->mapped_btns[2] = lis3lv02d_get_axis(abs(lis3->ac.z), btns);
724
725 err = input_register_device(lis3->idev);
726 if (err)
727 goto err_free_input;
728
729 return 0;
730
731 err_free_input:
732 input_free_device(input_dev);
733 lis3->idev = NULL;
734 return err;
735

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#3 lore raw
Quoted 6 lines · kbuild test robot

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing] [cannot apply to v5.4-rc1 next-20191002]

This is weird, I just tried applying it to both next-20191002 and Greg's char-misc/char-misc-testing and it applied cleanly and compiled (on x86).

Quoted 104 lines

[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/lis3lv02d-switch-to-using-input-device-polling-mode/20191003-062746
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=parisc

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers/misc/lis3lv02d/lis3lv02d.c: In function 'lis3lv02d_joystick_enable':

   drivers/misc/lis3lv02d/lis3lv02d.c:713:8: error: implicit declaration of function 'input_setup_polling'; did you mean 'input_set_capability'? [-Werror=implicit-function-declaration]
     err = input_setup_polling(input_dev, lis3lv02d_joystick_poll);
           ^~~~~~~~~~~~~~~~~~~
           input_set_capability
Quoted 1 line
Quoted 1 line

drivers/misc/lis3lv02d/lis3lv02d.c:717:2: error: implicit declaration of function 'input_set_poll_interval'; did you mean '__put_user_internal'? [-Werror=implicit-function-declaration]

     input_set_poll_interval(input_dev, MDPS_POLL_INTERVAL);
     ^~~~~~~~~~~~~~~~~~~~~~~
     __put_user_internal
   drivers/misc/lis3lv02d/lis3lv02d.c:718:2: error: implicit declaration of function 'input_set_min_poll_interval' [-Werror=implicit-function-declaration]
     input_set_min_poll_interval(input_dev, MDPS_POLL_MIN);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/misc/lis3lv02d/lis3lv02d.c:719:2: error: implicit declaration of function 'input_set_max_poll_interval'; did you mean 'input_set_capability'? [-Werror=implicit-function-declaration]
     input_set_max_poll_interval(input_dev, MDPS_POLL_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
     input_set_capability

cc1: some warnings being treated as errors

vim +717 drivers/misc/lis3lv02d/lis3lv02d.c

   671	
   672	int lis3lv02d_joystick_enable(struct lis3lv02d *lis3)
   673	{
   674		struct input_dev *input_dev;
   675		int err;
   676		int max_val, fuzz, flat;
   677		int btns[] = {BTN_X, BTN_Y, BTN_Z};
   678	
   679		if (lis3->idev)
   680			return -EINVAL;
   681	
   682		input_dev = input_allocate_device();
   683		if (!input_dev)
   684			return -ENOMEM;
   685	
   686		input_dev->name       = "ST LIS3LV02DL Accelerometer";
   687		input_dev->phys       = DRIVER_NAME "/input0";
   688		input_dev->id.bustype = BUS_HOST;
   689		input_dev->id.vendor  = 0;
   690		input_dev->dev.parent = &lis3->pdev->dev;
   691	
   692		input_dev->open = lis3lv02d_joystick_open;
   693		input_dev->close = lis3lv02d_joystick_close;
   694	
   695		max_val = (lis3->mdps_max_val * lis3->scale) / LIS3_ACCURACY;
   696		if (lis3->whoami == WAI_12B) {
   697			fuzz = LIS3_DEFAULT_FUZZ_12B;
   698			flat = LIS3_DEFAULT_FLAT_12B;
   699		} else {
   700			fuzz = LIS3_DEFAULT_FUZZ_8B;
   701			flat = LIS3_DEFAULT_FLAT_8B;
   702		}
   703		fuzz = (fuzz * lis3->scale) / LIS3_ACCURACY;
   704		flat = (flat * lis3->scale) / LIS3_ACCURACY;
   705	
   706		input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat);
   707		input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat);
   708		input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat);
   709	
   710		input_set_drvdata(input_dev, lis3);
   711		lis3->idev = input_dev;
   712	
Quoted 1 line

713 err = input_setup_polling(input_dev, lis3lv02d_joystick_poll);

714 if (err)

   715			goto err_free_input;
   716	
Quoted 1 line

717 input_set_poll_interval(input_dev, MDPS_POLL_INTERVAL);

   718		input_set_min_poll_interval(input_dev, MDPS_POLL_MIN);
   719		input_set_max_poll_interval(input_dev, MDPS_POLL_MAX);
   720	
   721		lis3->mapped_btns[0] = lis3lv02d_get_axis(abs(lis3->ac.x), btns);
   722		lis3->mapped_btns[1] = lis3lv02d_get_axis(abs(lis3->ac.y), btns);
   723		lis3->mapped_btns[2] = lis3lv02d_get_axis(abs(lis3->ac.z), btns);
   724	
   725		err = input_register_device(lis3->idev);
   726		if (err)
   727			goto err_free_input;
   728	
   729		return 0;
   730	
   731	err_free_input:
   732		input_free_device(input_dev);
   733		lis3->idev = NULL;
   734		return err;
   735	
Quoted 3 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Thanks.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 10 lines · Dmitry Torokhov
Quoted 6 lines · kbuild test robot

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing] [cannot apply to v5.4-rc1 next-20191002]

This is weird, I just tried applying it to both next-20191002 and Greg's char-misc/char-misc-testing and it applied cleanly and compiled (on x86).

You seem to have tried applying it to this commit:

Merge tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver updates from Greg KH:
"Here is the big char/misc driver pull request for 5.4-rc1...

so of it failed because at that time Linus' tree did not have the necessary input changes. I am not sure why you decided to apply the patch to this particular commit.

Thanks.

Signature · 1 line
Dmitry
#5 lore raw

Hi,

Quoted 14 lines · Dmitry Torokhov
Quoted 9 lines · Dmitry Torokhov
Quoted 6 lines · kbuild test robot

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing] [cannot apply to v5.4-rc1 next-20191002]

This is weird, I just tried applying it to both next-20191002 and Greg's char-misc/char-misc-testing and it applied cleanly and compiled (on x86).

You seem to have tried applying it to this commit:

Merge tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Quoted 8 lines

Pull char/misc driver updates from Greg KH:
"Here is the big char/misc driver pull request for 5.4-rc1...

so of it failed because at that time Linus' tree did not have the necessary input changes. I am not sure why you decided to apply the patch to this particular commit.

Thanks.

Thanks for your comment, robot applied the patch to the head of char-misc/char-misc-testing, It seems the branch was still old at that moment. We'll fix it asap.

Best Regards,
Rong Chen