linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [dtor-input:next 134/135] drivers/input/joystick/adc-joystick.c:194:10: error: implicit declaration of function 'min_array'
@ 2024-01-19 22:55 kernel test robot
  2024-01-23 16:17 ` Chris Morgan
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2024-01-19 22:55 UTC (permalink / raw)
  To: Chris Morgan; +Cc: oe-kbuild-all, linux-input, Dmitry Torokhov

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
head:   3af6e24a456437d323d1080bd254053f7af05234
commit: 6380a59c534ecab1462608a1f76490289a45a377 [134/135] Input: adc-joystick - handle inverted axes
config: i386-randconfig-011-20240120 (https://download.01.org/0day-ci/archive/20240120/202401200614.B4PnBzhk-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240120/202401200614.B4PnBzhk-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401200614.B4PnBzhk-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/input/joystick/adc-joystick.c: In function 'adc_joystick_set_axes':
>> drivers/input/joystick/adc-joystick.c:194:10: error: implicit declaration of function 'min_array' [-Werror=implicit-function-declaration]
     194 |          min_array(axes[i].range, 2),
         |          ^~~~~~~~~
>> drivers/input/joystick/adc-joystick.c:195:10: error: implicit declaration of function 'max_array'; did you mean 'kmalloc_array'? [-Werror=implicit-function-declaration]
     195 |          max_array(axes[i].range, 2),
         |          ^~~~~~~~~
         |          kmalloc_array
   cc1: some warnings being treated as errors


vim +/min_array +194 drivers/input/joystick/adc-joystick.c

   135	
   136	static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy)
   137	{
   138		struct adc_joystick_axis *axes;
   139		struct fwnode_handle *child;
   140		int num_axes, error, i;
   141	
   142		num_axes = device_get_child_node_count(dev);
   143		if (!num_axes) {
   144			dev_err(dev, "Unable to find child nodes\n");
   145			return -EINVAL;
   146		}
   147	
   148		if (num_axes != joy->num_chans) {
   149			dev_err(dev, "Got %d child nodes for %d channels\n",
   150				num_axes, joy->num_chans);
   151			return -EINVAL;
   152		}
   153	
   154		axes = devm_kmalloc_array(dev, num_axes, sizeof(*axes), GFP_KERNEL);
   155		if (!axes)
   156			return -ENOMEM;
   157	
   158		device_for_each_child_node(dev, child) {
   159			error = fwnode_property_read_u32(child, "reg", &i);
   160			if (error) {
   161				dev_err(dev, "reg invalid or missing\n");
   162				goto err_fwnode_put;
   163			}
   164	
   165			if (i >= num_axes) {
   166				error = -EINVAL;
   167				dev_err(dev, "No matching axis for reg %d\n", i);
   168				goto err_fwnode_put;
   169			}
   170	
   171			error = fwnode_property_read_u32(child, "linux,code",
   172							 &axes[i].code);
   173			if (error) {
   174				dev_err(dev, "linux,code invalid or missing\n");
   175				goto err_fwnode_put;
   176			}
   177	
   178			error = fwnode_property_read_u32_array(child, "abs-range",
   179							       axes[i].range, 2);
   180			if (error) {
   181				dev_err(dev, "abs-range invalid or missing\n");
   182				goto err_fwnode_put;
   183			}
   184	
   185			if (axes[i].range[0] > axes[i].range[1]) {
   186				dev_dbg(dev, "abs-axis %d inverted\n", i);
   187				axes[i].inverted = true;
   188			}
   189	
   190			fwnode_property_read_u32(child, "abs-fuzz", &axes[i].fuzz);
   191			fwnode_property_read_u32(child, "abs-flat", &axes[i].flat);
   192	
   193			input_set_abs_params(joy->input, axes[i].code,
 > 194					     min_array(axes[i].range, 2),
 > 195					     max_array(axes[i].range, 2),
   196					     axes[i].fuzz, axes[i].flat);
   197			input_set_capability(joy->input, EV_ABS, axes[i].code);
   198		}
   199	
   200		joy->axes = axes;
   201	
   202		return 0;
   203	
   204	err_fwnode_put:
   205		fwnode_handle_put(child);
   206		return error;
   207	}
   208	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dtor-input:next 134/135] drivers/input/joystick/adc-joystick.c:194:10: error: implicit declaration of function 'min_array'
  2024-01-19 22:55 [dtor-input:next 134/135] drivers/input/joystick/adc-joystick.c:194:10: error: implicit declaration of function 'min_array' kernel test robot
@ 2024-01-23 16:17 ` Chris Morgan
  2024-01-23 21:04   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Morgan @ 2024-01-23 16:17 UTC (permalink / raw)
  To: kernel test robot; +Cc: oe-kbuild-all, linux-input, Dmitry Torokhov

On Sat, Jan 20, 2024 at 06:55:32AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
> head:   3af6e24a456437d323d1080bd254053f7af05234
> commit: 6380a59c534ecab1462608a1f76490289a45a377 [134/135] Input: adc-joystick - handle inverted axes
> config: i386-randconfig-011-20240120 (https://download.01.org/0day-ci/archive/20240120/202401200614.B4PnBzhk-lkp@intel.com/config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240120/202401200614.B4PnBzhk-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202401200614.B4PnBzhk-lkp@intel.com/
> 

Assume this means we need to explicitly `#include <linux/minmax.h>`, right?

Should I submit a new patch or a bugfix for this patch?

Thank you.

> All errors (new ones prefixed by >>):
> 
>    drivers/input/joystick/adc-joystick.c: In function 'adc_joystick_set_axes':
> >> drivers/input/joystick/adc-joystick.c:194:10: error: implicit declaration of function 'min_array' [-Werror=implicit-function-declaration]
>      194 |          min_array(axes[i].range, 2),
>          |          ^~~~~~~~~
> >> drivers/input/joystick/adc-joystick.c:195:10: error: implicit declaration of function 'max_array'; did you mean 'kmalloc_array'? [-Werror=implicit-function-declaration]
>      195 |          max_array(axes[i].range, 2),
>          |          ^~~~~~~~~
>          |          kmalloc_array
>    cc1: some warnings being treated as errors
> 
> 
> vim +/min_array +194 drivers/input/joystick/adc-joystick.c
> 
>    135	
>    136	static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy)
>    137	{
>    138		struct adc_joystick_axis *axes;
>    139		struct fwnode_handle *child;
>    140		int num_axes, error, i;
>    141	
>    142		num_axes = device_get_child_node_count(dev);
>    143		if (!num_axes) {
>    144			dev_err(dev, "Unable to find child nodes\n");
>    145			return -EINVAL;
>    146		}
>    147	
>    148		if (num_axes != joy->num_chans) {
>    149			dev_err(dev, "Got %d child nodes for %d channels\n",
>    150				num_axes, joy->num_chans);
>    151			return -EINVAL;
>    152		}
>    153	
>    154		axes = devm_kmalloc_array(dev, num_axes, sizeof(*axes), GFP_KERNEL);
>    155		if (!axes)
>    156			return -ENOMEM;
>    157	
>    158		device_for_each_child_node(dev, child) {
>    159			error = fwnode_property_read_u32(child, "reg", &i);
>    160			if (error) {
>    161				dev_err(dev, "reg invalid or missing\n");
>    162				goto err_fwnode_put;
>    163			}
>    164	
>    165			if (i >= num_axes) {
>    166				error = -EINVAL;
>    167				dev_err(dev, "No matching axis for reg %d\n", i);
>    168				goto err_fwnode_put;
>    169			}
>    170	
>    171			error = fwnode_property_read_u32(child, "linux,code",
>    172							 &axes[i].code);
>    173			if (error) {
>    174				dev_err(dev, "linux,code invalid or missing\n");
>    175				goto err_fwnode_put;
>    176			}
>    177	
>    178			error = fwnode_property_read_u32_array(child, "abs-range",
>    179							       axes[i].range, 2);
>    180			if (error) {
>    181				dev_err(dev, "abs-range invalid or missing\n");
>    182				goto err_fwnode_put;
>    183			}
>    184	
>    185			if (axes[i].range[0] > axes[i].range[1]) {
>    186				dev_dbg(dev, "abs-axis %d inverted\n", i);
>    187				axes[i].inverted = true;
>    188			}
>    189	
>    190			fwnode_property_read_u32(child, "abs-fuzz", &axes[i].fuzz);
>    191			fwnode_property_read_u32(child, "abs-flat", &axes[i].flat);
>    192	
>    193			input_set_abs_params(joy->input, axes[i].code,
>  > 194					     min_array(axes[i].range, 2),
>  > 195					     max_array(axes[i].range, 2),
>    196					     axes[i].fuzz, axes[i].flat);
>    197			input_set_capability(joy->input, EV_ABS, axes[i].code);
>    198		}
>    199	
>    200		joy->axes = axes;
>    201	
>    202		return 0;
>    203	
>    204	err_fwnode_put:
>    205		fwnode_handle_put(child);
>    206		return error;
>    207	}
>    208	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dtor-input:next 134/135] drivers/input/joystick/adc-joystick.c:194:10: error: implicit declaration of function 'min_array'
  2024-01-23 16:17 ` Chris Morgan
@ 2024-01-23 21:04   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2024-01-23 21:04 UTC (permalink / raw)
  To: Chris Morgan; +Cc: kernel test robot, oe-kbuild-all, linux-input

On Tue, Jan 23, 2024 at 10:17:25AM -0600, Chris Morgan wrote:
> On Sat, Jan 20, 2024 at 06:55:32AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
> > head:   3af6e24a456437d323d1080bd254053f7af05234
> > commit: 6380a59c534ecab1462608a1f76490289a45a377 [134/135] Input: adc-joystick - handle inverted axes
> > config: i386-randconfig-011-20240120 (https://download.01.org/0day-ci/archive/20240120/202401200614.B4PnBzhk-lkp@intel.com/config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240120/202401200614.B4PnBzhk-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202401200614.B4PnBzhk-lkp@intel.com/
> > 
> 
> Assume this means we need to explicitly `#include <linux/minmax.h>`, right?
> 
> Should I submit a new patch or a bugfix for this patch?

As I mentioned in another email I think usage of min/max_array() is too
clever here. How about we simply "swap(range[0], range[1])" when axis is
inverted?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-23 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19 22:55 [dtor-input:next 134/135] drivers/input/joystick/adc-joystick.c:194:10: error: implicit declaration of function 'min_array' kernel test robot
2024-01-23 16:17 ` Chris Morgan
2024-01-23 21:04   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).