lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202311220748.T1FnZwoy-lkp@intel.com>
Date:   Wed, 22 Nov 2023 07:27:08 +0800
From:   kernel test robot <lkp@...el.com>
To:     Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@...nel.org>,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-iio@...r.kernel.org
Cc:     oe-kbuild-all@...ts.linux.dev,
        Olivier MOYSAN <olivier.moysan@...s.st.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Nuno Sa <nuno.sa@...log.com>
Subject: Re: [PATCH 12/12] iio: adc: adi-axi-adc: move to backend framework

Hi Nuno,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus robh/for-next linus/master v6.7-rc2 next-20231121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nuno-Sa-via-B4-Relay/driver-core-allow-modifying-device_links-flags/20231121-182010
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20231121-dev-iio-backend-v1-12-6a3d542eba35%40analog.com
patch subject: [PATCH 12/12] iio: adc: adi-axi-adc: move to backend framework
config: i386-randconfig-141-20231122 (https://download.01.org/0day-ci/archive/20231122/202311220748.T1FnZwoy-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231122/202311220748.T1FnZwoy-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311220748.T1FnZwoy-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iio/industrialio-backend.c:123: warning: expecting prototype for iio_backend_chan_enable(). Prototype was for iio_backend_enable() instead
>> drivers/iio/industrialio-backend.c:242: warning: Function parameter or member 'back' not described in 'iio_backend_get_priv'
>> drivers/iio/industrialio-backend.c:274: warning: Function parameter or member 'dev' not described in 'devm_iio_backend_register'
>> drivers/iio/industrialio-backend.c:274: warning: Function parameter or member 'ops' not described in 'devm_iio_backend_register'
>> drivers/iio/industrialio-backend.c:274: warning: Function parameter or member 'priv' not described in 'devm_iio_backend_register'


vim +242 drivers/iio/industrialio-backend.c

67915cd5ae2cc11 Nuno Sa 2023-11-21  114  
67915cd5ae2cc11 Nuno Sa 2023-11-21  115  /**
67915cd5ae2cc11 Nuno Sa 2023-11-21  116   * iio_backend_chan_enable - Enable the backend.
67915cd5ae2cc11 Nuno Sa 2023-11-21  117   * @back:	Backend device
67915cd5ae2cc11 Nuno Sa 2023-11-21  118   *
67915cd5ae2cc11 Nuno Sa 2023-11-21  119   * RETURNS:
67915cd5ae2cc11 Nuno Sa 2023-11-21  120   * 0 on success, negative error number on failure.
67915cd5ae2cc11 Nuno Sa 2023-11-21  121   */
67915cd5ae2cc11 Nuno Sa 2023-11-21  122  int iio_backend_enable(struct iio_backend *back)
67915cd5ae2cc11 Nuno Sa 2023-11-21 @123  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  124  	return iio_backend_op_call(back, enable);
67915cd5ae2cc11 Nuno Sa 2023-11-21  125  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  126  EXPORT_SYMBOL_GPL(iio_backend_enable);
67915cd5ae2cc11 Nuno Sa 2023-11-21  127  
67915cd5ae2cc11 Nuno Sa 2023-11-21  128  /**
67915cd5ae2cc11 Nuno Sa 2023-11-21  129   * iio_backend_disable - Disable the backend.
67915cd5ae2cc11 Nuno Sa 2023-11-21  130   * @back:	Backend device
67915cd5ae2cc11 Nuno Sa 2023-11-21  131   */
67915cd5ae2cc11 Nuno Sa 2023-11-21  132  void iio_backend_disable(struct iio_backend *back)
67915cd5ae2cc11 Nuno Sa 2023-11-21  133  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  134  	iio_backend_void_op_call(back, disable);
67915cd5ae2cc11 Nuno Sa 2023-11-21  135  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  136  EXPORT_SYMBOL_GPL(iio_backend_disable);
67915cd5ae2cc11 Nuno Sa 2023-11-21  137  
67915cd5ae2cc11 Nuno Sa 2023-11-21  138  /**
67915cd5ae2cc11 Nuno Sa 2023-11-21  139   * iio_backend_data_format_set - Configure the channel data format
67915cd5ae2cc11 Nuno Sa 2023-11-21  140   * @back:	Backend device
67915cd5ae2cc11 Nuno Sa 2023-11-21  141   * @chan:	Channel number.
67915cd5ae2cc11 Nuno Sa 2023-11-21  142   * @data:	Data format.
67915cd5ae2cc11 Nuno Sa 2023-11-21  143   *
67915cd5ae2cc11 Nuno Sa 2023-11-21  144   * Properly configure a channel with respect to the expected data format. A
67915cd5ae2cc11 Nuno Sa 2023-11-21  145   * @struct iio_backend_data_fmt must be passed with the settings.
67915cd5ae2cc11 Nuno Sa 2023-11-21  146   *
67915cd5ae2cc11 Nuno Sa 2023-11-21  147   * RETURNS:
67915cd5ae2cc11 Nuno Sa 2023-11-21  148   * 0 on success, negative error number on failure
67915cd5ae2cc11 Nuno Sa 2023-11-21  149   */
67915cd5ae2cc11 Nuno Sa 2023-11-21  150  int iio_backend_data_format_set(struct iio_backend *back, unsigned int chan,
67915cd5ae2cc11 Nuno Sa 2023-11-21  151  				const struct iio_backend_data_fmt *data)
67915cd5ae2cc11 Nuno Sa 2023-11-21  152  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  153  	if (!data || data->type >= IIO_BACKEND_DATA_TYPE_MAX)
67915cd5ae2cc11 Nuno Sa 2023-11-21  154  		return -EINVAL;
67915cd5ae2cc11 Nuno Sa 2023-11-21  155  
67915cd5ae2cc11 Nuno Sa 2023-11-21  156  	return iio_backend_op_call(back, data_format_set, chan, data);
67915cd5ae2cc11 Nuno Sa 2023-11-21  157  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  158  EXPORT_SYMBOL_GPL(iio_backend_data_format_set);
67915cd5ae2cc11 Nuno Sa 2023-11-21  159  
67915cd5ae2cc11 Nuno Sa 2023-11-21  160  static void iio_backend_free(struct kref *ref)
67915cd5ae2cc11 Nuno Sa 2023-11-21  161  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  162  	struct iio_backend *back = container_of(ref, struct iio_backend, ref);
67915cd5ae2cc11 Nuno Sa 2023-11-21  163  
67915cd5ae2cc11 Nuno Sa 2023-11-21  164  	kfree(back);
67915cd5ae2cc11 Nuno Sa 2023-11-21  165  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  166  
67915cd5ae2cc11 Nuno Sa 2023-11-21  167  static void iio_backend_release(void *arg)
67915cd5ae2cc11 Nuno Sa 2023-11-21  168  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  169  	struct iio_backend *back = arg;
67915cd5ae2cc11 Nuno Sa 2023-11-21  170  
67915cd5ae2cc11 Nuno Sa 2023-11-21  171  	module_put(back->owner);
67915cd5ae2cc11 Nuno Sa 2023-11-21  172  	kref_put(&back->ref, iio_backend_free);
67915cd5ae2cc11 Nuno Sa 2023-11-21  173  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  174  
67915cd5ae2cc11 Nuno Sa 2023-11-21  175  /**
67915cd5ae2cc11 Nuno Sa 2023-11-21  176   * devm_iio_backend_get - Get a backend device
67915cd5ae2cc11 Nuno Sa 2023-11-21  177   * @dev:	Device where to look for the backend.
67915cd5ae2cc11 Nuno Sa 2023-11-21  178   * @name:	Backend name.
67915cd5ae2cc11 Nuno Sa 2023-11-21  179   *
67915cd5ae2cc11 Nuno Sa 2023-11-21  180   * Get's the backend associated with @dev.
67915cd5ae2cc11 Nuno Sa 2023-11-21  181   *
67915cd5ae2cc11 Nuno Sa 2023-11-21  182   * RETURNS:
67915cd5ae2cc11 Nuno Sa 2023-11-21  183   * A backend pointer, negative error pointer otherwise.
67915cd5ae2cc11 Nuno Sa 2023-11-21  184   */
67915cd5ae2cc11 Nuno Sa 2023-11-21  185  struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name)
67915cd5ae2cc11 Nuno Sa 2023-11-21  186  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  187  	struct fwnode_handle *fwnode;
67915cd5ae2cc11 Nuno Sa 2023-11-21  188  	struct iio_backend *back;
67915cd5ae2cc11 Nuno Sa 2023-11-21  189  	int index = 0, ret;
67915cd5ae2cc11 Nuno Sa 2023-11-21  190  
67915cd5ae2cc11 Nuno Sa 2023-11-21  191  	if (name) {
67915cd5ae2cc11 Nuno Sa 2023-11-21  192  		index = device_property_match_string(dev, "io-backends-names",
67915cd5ae2cc11 Nuno Sa 2023-11-21  193  						     name);
67915cd5ae2cc11 Nuno Sa 2023-11-21  194  		if (index < 0)
67915cd5ae2cc11 Nuno Sa 2023-11-21  195  			return ERR_PTR(index);
67915cd5ae2cc11 Nuno Sa 2023-11-21  196  	}
67915cd5ae2cc11 Nuno Sa 2023-11-21  197  
67915cd5ae2cc11 Nuno Sa 2023-11-21  198  	fwnode = fwnode_find_reference(dev_fwnode(dev), "io-backends", index);
67915cd5ae2cc11 Nuno Sa 2023-11-21  199  	if (IS_ERR(fwnode)) {
67915cd5ae2cc11 Nuno Sa 2023-11-21  200  		dev_err(dev, "Cannot get Firmware reference\n");
67915cd5ae2cc11 Nuno Sa 2023-11-21  201  		return ERR_CAST(fwnode);
67915cd5ae2cc11 Nuno Sa 2023-11-21  202  	}
67915cd5ae2cc11 Nuno Sa 2023-11-21  203  
67915cd5ae2cc11 Nuno Sa 2023-11-21  204  	guard(mutex)(&iio_back_lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  205  	list_for_each_entry(back, &iio_back_list, entry) {
67915cd5ae2cc11 Nuno Sa 2023-11-21  206  		struct device_link *link;
67915cd5ae2cc11 Nuno Sa 2023-11-21  207  
67915cd5ae2cc11 Nuno Sa 2023-11-21  208  		if (!device_match_fwnode(back->dev, fwnode))
67915cd5ae2cc11 Nuno Sa 2023-11-21  209  			continue;
67915cd5ae2cc11 Nuno Sa 2023-11-21  210  
67915cd5ae2cc11 Nuno Sa 2023-11-21  211  		fwnode_handle_put(fwnode);
67915cd5ae2cc11 Nuno Sa 2023-11-21  212  		kref_get(&back->ref);
67915cd5ae2cc11 Nuno Sa 2023-11-21  213  		if (!try_module_get(back->owner)) {
67915cd5ae2cc11 Nuno Sa 2023-11-21  214  			dev_err(dev, "Cannot get module reference\n");
67915cd5ae2cc11 Nuno Sa 2023-11-21  215  			return ERR_PTR(-ENODEV);
67915cd5ae2cc11 Nuno Sa 2023-11-21  216  		}
67915cd5ae2cc11 Nuno Sa 2023-11-21  217  
67915cd5ae2cc11 Nuno Sa 2023-11-21  218  		ret = devm_add_action_or_reset(dev, iio_backend_release, back);
67915cd5ae2cc11 Nuno Sa 2023-11-21  219  		if (ret)
67915cd5ae2cc11 Nuno Sa 2023-11-21  220  			return ERR_PTR(ret);
67915cd5ae2cc11 Nuno Sa 2023-11-21  221  
67915cd5ae2cc11 Nuno Sa 2023-11-21  222  		link = device_link_add(dev, back->dev,
67915cd5ae2cc11 Nuno Sa 2023-11-21  223  				       DL_FLAG_AUTOREMOVE_CONSUMER);
67915cd5ae2cc11 Nuno Sa 2023-11-21  224  		if (!link)
67915cd5ae2cc11 Nuno Sa 2023-11-21  225  			dev_warn(dev, "Could not link to supplier(%s)\n",
67915cd5ae2cc11 Nuno Sa 2023-11-21  226  				 dev_name(back->dev));
67915cd5ae2cc11 Nuno Sa 2023-11-21  227  
67915cd5ae2cc11 Nuno Sa 2023-11-21  228  		dev_dbg(dev, "Found backend(%s) device\n", dev_name(back->dev));
67915cd5ae2cc11 Nuno Sa 2023-11-21  229  		return back;
67915cd5ae2cc11 Nuno Sa 2023-11-21  230  	}
67915cd5ae2cc11 Nuno Sa 2023-11-21  231  
67915cd5ae2cc11 Nuno Sa 2023-11-21  232  	fwnode_handle_put(fwnode);
67915cd5ae2cc11 Nuno Sa 2023-11-21  233  	return ERR_PTR(-EPROBE_DEFER);
67915cd5ae2cc11 Nuno Sa 2023-11-21  234  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  235  EXPORT_SYMBOL_GPL(devm_iio_backend_get);
67915cd5ae2cc11 Nuno Sa 2023-11-21  236  
67915cd5ae2cc11 Nuno Sa 2023-11-21  237  /**
67915cd5ae2cc11 Nuno Sa 2023-11-21  238   * iio_backend_get_priv - Get driver private data
67915cd5ae2cc11 Nuno Sa 2023-11-21  239   * @back	Backend device
67915cd5ae2cc11 Nuno Sa 2023-11-21  240   */
67915cd5ae2cc11 Nuno Sa 2023-11-21  241  void *iio_backend_get_priv(const struct iio_backend *back)
67915cd5ae2cc11 Nuno Sa 2023-11-21 @242  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  243  	return back->priv;
67915cd5ae2cc11 Nuno Sa 2023-11-21  244  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  245  EXPORT_SYMBOL_GPL(iio_backend_get_priv);
67915cd5ae2cc11 Nuno Sa 2023-11-21  246  
67915cd5ae2cc11 Nuno Sa 2023-11-21  247  static void iio_backend_unregister(void *arg)
67915cd5ae2cc11 Nuno Sa 2023-11-21  248  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  249  	struct iio_backend *back = arg;
67915cd5ae2cc11 Nuno Sa 2023-11-21  250  
67915cd5ae2cc11 Nuno Sa 2023-11-21  251  	mutex_lock(&iio_back_lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  252  	list_del(&back->entry);
67915cd5ae2cc11 Nuno Sa 2023-11-21  253  	mutex_unlock(&iio_back_lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  254  
67915cd5ae2cc11 Nuno Sa 2023-11-21  255  	mutex_lock(&back->lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  256  	back->ops = NULL;
67915cd5ae2cc11 Nuno Sa 2023-11-21  257  	mutex_unlock(&back->lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  258  	kref_put(&back->ref, iio_backend_free);
67915cd5ae2cc11 Nuno Sa 2023-11-21  259  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  260  
67915cd5ae2cc11 Nuno Sa 2023-11-21  261  /**
67915cd5ae2cc11 Nuno Sa 2023-11-21  262   * devm_iio_backend_register - Register a new backend device
67915cd5ae2cc11 Nuno Sa 2023-11-21  263   * @dev		Backend device being registered.
67915cd5ae2cc11 Nuno Sa 2023-11-21  264   * @ops		Backend ops
67915cd5ae2cc11 Nuno Sa 2023-11-21  265   * @priv	Device private data.
67915cd5ae2cc11 Nuno Sa 2023-11-21  266   *
67915cd5ae2cc11 Nuno Sa 2023-11-21  267   * @ops and @priv are both mandatory. Not providing them results in -EINVAL.
67915cd5ae2cc11 Nuno Sa 2023-11-21  268   *
67915cd5ae2cc11 Nuno Sa 2023-11-21  269   * RETURNS:
67915cd5ae2cc11 Nuno Sa 2023-11-21  270   * 0 on success, negative error number on failure.
67915cd5ae2cc11 Nuno Sa 2023-11-21  271   */
67915cd5ae2cc11 Nuno Sa 2023-11-21  272  int devm_iio_backend_register(struct device *dev,
67915cd5ae2cc11 Nuno Sa 2023-11-21  273  			      const struct iio_backend_ops *ops, void *priv)
67915cd5ae2cc11 Nuno Sa 2023-11-21 @274  {
67915cd5ae2cc11 Nuno Sa 2023-11-21  275  	struct iio_backend *back;
67915cd5ae2cc11 Nuno Sa 2023-11-21  276  
67915cd5ae2cc11 Nuno Sa 2023-11-21  277  	if (!ops || !priv) {
67915cd5ae2cc11 Nuno Sa 2023-11-21  278  		dev_err(dev, "No backend ops or private data given\n");
67915cd5ae2cc11 Nuno Sa 2023-11-21  279  		return -EINVAL;
67915cd5ae2cc11 Nuno Sa 2023-11-21  280  	}
67915cd5ae2cc11 Nuno Sa 2023-11-21  281  
67915cd5ae2cc11 Nuno Sa 2023-11-21  282  	back = kzalloc(sizeof(*back), GFP_KERNEL);
67915cd5ae2cc11 Nuno Sa 2023-11-21  283  	if (!back)
67915cd5ae2cc11 Nuno Sa 2023-11-21  284  		return -ENOMEM;
67915cd5ae2cc11 Nuno Sa 2023-11-21  285  
67915cd5ae2cc11 Nuno Sa 2023-11-21  286  	kref_init(&back->ref);
67915cd5ae2cc11 Nuno Sa 2023-11-21  287  	mutex_init(&back->lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  288  	back->ops = ops;
67915cd5ae2cc11 Nuno Sa 2023-11-21  289  	back->owner = dev->driver->owner;
67915cd5ae2cc11 Nuno Sa 2023-11-21  290  	back->dev = dev;
67915cd5ae2cc11 Nuno Sa 2023-11-21  291  	back->priv = priv;
67915cd5ae2cc11 Nuno Sa 2023-11-21  292  	mutex_lock(&iio_back_lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  293  	list_add(&back->entry, &iio_back_list);
67915cd5ae2cc11 Nuno Sa 2023-11-21  294  	mutex_unlock(&iio_back_lock);
67915cd5ae2cc11 Nuno Sa 2023-11-21  295  
67915cd5ae2cc11 Nuno Sa 2023-11-21  296  	return devm_add_action_or_reset(dev, iio_backend_unregister, back);
67915cd5ae2cc11 Nuno Sa 2023-11-21  297  }
67915cd5ae2cc11 Nuno Sa 2023-11-21  298  EXPORT_SYMBOL_GPL(devm_iio_backend_register);
67915cd5ae2cc11 Nuno Sa 2023-11-21  299  

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ