Message ID | 20241220131350.544009-1-csokas.bence@prolan.hu (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [next] dma: Add devm_dma_request_chan() | expand |
Hi Bence, kernel test robot noticed the following build warnings: [auto build test WARNING on next-20241220] url: https://github.com/intel-lab-lkp/linux/commits/Bence-Cs-k-s/dma-Add-devm_dma_request_chan/20241220-211523 base: next-20241220 patch link: https://lore.kernel.org/r/20241220131350.544009-1-csokas.bence%40prolan.hu patch subject: [PATCH next] dma: Add devm_dma_request_chan() config: x86_64-buildonly-randconfig-002-20241221 (https://download.01.org/0day-ci/archive/20241221/202412211953.UwS2Qw11-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412211953.UwS2Qw11-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/202412211953.UwS2Qw11-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/dma/dmaengine.c:944:18: warning: no previous prototype for 'devm_dma_request_chan' [-Wmissing-prototypes] 944 | struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) | ^~~~~~~~~~~~~~~~~~~~~ drivers/dma/dmaengine.c: In function 'devm_dma_request_chan': >> drivers/dma/dmaengine.c:953:32: warning: passing argument 1 of 'PTR_ERR' makes pointer from integer without a cast [-Wint-conversion] 953 | return PTR_ERR(ret); | ^~~ | | | int In file included from arch/x86/include/asm/processor.h:36, from include/linux/sched.h:13, from include/linux/ratelimit.h:6, from include/linux/dev_printk.h:16, from include/linux/device.h:15, from include/linux/platform_device.h:13, from drivers/dma/dmaengine.c:34: include/linux/err.h:52:61: note: expected 'const void *' but argument is of type 'int' 52 | static inline long __must_check PTR_ERR(__force const void *ptr) | ~~~~~~~~~~~~^~~ >> drivers/dma/dmaengine.c:953:24: warning: returning 'long int' from a function with return type 'struct dma_chan *' makes pointer from integer without a cast [-Wint-conversion] 953 | return PTR_ERR(ret); | ^~~~~~~~~~~~ vim +/devm_dma_request_chan +944 drivers/dma/dmaengine.c 933 934 /** 935 * devm_dma_request_chan - try to allocate an exclusive slave channel 936 * @dev: pointer to client device structure 937 * @name: slave channel name 938 * 939 * Returns pointer to appropriate DMA channel on success or an error pointer. 940 * 941 * The operation is managed and will be undone on driver detach. 942 */ 943 > 944 struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) 945 { 946 struct dma_chan *chan = dma_request_chan(dev, name); 947 int ret = 0; 948 949 if (!IS_ERR(chan)) 950 ret = devm_add_action_or_reset(dev, dmaenginem_release_channel, chan); 951 952 if (ret) > 953 return PTR_ERR(ret); 954 955 return chan; 956 } 957 EXPORT_SYMBOL_GPL(devm_dma_request_chan); 958
Hi Bence, kernel test robot noticed the following build errors: [auto build test ERROR on next-20241220] url: https://github.com/intel-lab-lkp/linux/commits/Bence-Cs-k-s/dma-Add-devm_dma_request_chan/20241220-211523 base: next-20241220 patch link: https://lore.kernel.org/r/20241220131350.544009-1-csokas.bence%40prolan.hu patch subject: [PATCH next] dma: Add devm_dma_request_chan() config: arm-randconfig-002-20241221 (https://download.01.org/0day-ci/archive/20241221/202412211754.Jh1oIu6A-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412211754.Jh1oIu6A-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/202412211754.Jh1oIu6A-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/dma/dmaengine.c:944:18: warning: no previous prototype for 'devm_dma_request_chan' [-Wmissing-prototypes] 944 | struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) | ^~~~~~~~~~~~~~~~~~~~~ drivers/dma/dmaengine.c: In function 'devm_dma_request_chan': >> drivers/dma/dmaengine.c:953:32: error: passing argument 1 of 'PTR_ERR' makes pointer from integer without a cast [-Wint-conversion] 953 | return PTR_ERR(ret); | ^~~ | | | int In file included from include/linux/string.h:10, from include/linux/bitmap.h:13, from include/linux/cpumask.h:12, from include/linux/smp.h:13, from include/linux/lockdep.h:14, from include/linux/spinlock.h:63, from include/linux/sched.h:2182, from include/linux/ratelimit.h:6, from include/linux/dev_printk.h:16, from include/linux/device.h:15, from include/linux/platform_device.h:13, from drivers/dma/dmaengine.c:34: include/linux/err.h:52:61: note: expected 'const void *' but argument is of type 'int' 52 | static inline long __must_check PTR_ERR(__force const void *ptr) | ~~~~~~~~~~~~^~~ >> drivers/dma/dmaengine.c:953:24: error: returning 'long int' from a function with return type 'struct dma_chan *' makes pointer from integer without a cast [-Wint-conversion] 953 | return PTR_ERR(ret); | ^~~~~~~~~~~~ vim +/PTR_ERR +953 drivers/dma/dmaengine.c 933 934 /** 935 * devm_dma_request_chan - try to allocate an exclusive slave channel 936 * @dev: pointer to client device structure 937 * @name: slave channel name 938 * 939 * Returns pointer to appropriate DMA channel on success or an error pointer. 940 * 941 * The operation is managed and will be undone on driver detach. 942 */ 943 944 struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) 945 { 946 struct dma_chan *chan = dma_request_chan(dev, name); 947 int ret = 0; 948 949 if (!IS_ERR(chan)) 950 ret = devm_add_action_or_reset(dev, dmaenginem_release_channel, chan); 951 952 if (ret) > 953 return PTR_ERR(ret); 954 955 return chan; 956 } 957 EXPORT_SYMBOL_GPL(devm_dma_request_chan); 958
Hi Bence, kernel test robot noticed the following build errors: [auto build test ERROR on next-20241220] url: https://github.com/intel-lab-lkp/linux/commits/Bence-Cs-k-s/dma-Add-devm_dma_request_chan/20241220-211523 base: next-20241220 patch link: https://lore.kernel.org/r/20241220131350.544009-1-csokas.bence%40prolan.hu patch subject: [PATCH next] dma: Add devm_dma_request_chan() config: i386-buildonly-randconfig-004-20241221 (https://download.01.org/0day-ci/archive/20241221/202412211736.wXS6zm9z-lkp@intel.com/config) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412211736.wXS6zm9z-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/202412211736.wXS6zm9z-lkp@intel.com/ All error/warnings (new ones prefixed by >>): >> drivers/dma/dmaengine.c:953:18: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion] 953 | return PTR_ERR(ret); | ^~~ include/linux/err.h:52:61: note: passing argument to parameter 'ptr' here 52 | static inline long __must_check PTR_ERR(__force const void *ptr) | ^ >> drivers/dma/dmaengine.c:953:10: error: incompatible integer to pointer conversion returning 'long' from a function with result type 'struct dma_chan *' [-Wint-conversion] 953 | return PTR_ERR(ret); | ^~~~~~~~~~~~ >> drivers/dma/dmaengine.c:944:18: warning: no previous prototype for function 'devm_dma_request_chan' [-Wmissing-prototypes] 944 | struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) | ^ drivers/dma/dmaengine.c:944:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 944 | struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) | ^ | static 1 warning and 2 errors generated. vim +953 drivers/dma/dmaengine.c 933 934 /** 935 * devm_dma_request_chan - try to allocate an exclusive slave channel 936 * @dev: pointer to client device structure 937 * @name: slave channel name 938 * 939 * Returns pointer to appropriate DMA channel on success or an error pointer. 940 * 941 * The operation is managed and will be undone on driver detach. 942 */ 943 > 944 struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) 945 { 946 struct dma_chan *chan = dma_request_chan(dev, name); 947 int ret = 0; 948 949 if (!IS_ERR(chan)) 950 ret = devm_add_action_or_reset(dev, dmaenginem_release_channel, chan); 951 952 if (ret) > 953 return PTR_ERR(ret); 954 955 return chan; 956 } 957 EXPORT_SYMBOL_GPL(devm_dma_request_chan); 958
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index c1357d7f3dc6..51c41664838d 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -926,6 +926,36 @@ void dma_release_channel(struct dma_chan *chan) } EXPORT_SYMBOL_GPL(dma_release_channel); +static void dmaenginem_release_channel(void *chan) +{ + dma_release_channel(chan); +} + +/** + * devm_dma_request_chan - try to allocate an exclusive slave channel + * @dev: pointer to client device structure + * @name: slave channel name + * + * Returns pointer to appropriate DMA channel on success or an error pointer. + * + * The operation is managed and will be undone on driver detach. + */ + +struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name) +{ + struct dma_chan *chan = dma_request_chan(dev, name); + int ret = 0; + + if (!IS_ERR(chan)) + ret = devm_add_action_or_reset(dev, dmaenginem_release_channel, chan); + + if (ret) + return PTR_ERR(ret); + + return chan; +} +EXPORT_SYMBOL_GPL(devm_dma_request_chan); + /** * dmaengine_get - register interest in dma_channels */
Expand the arsenal of devm functions for DMA devices, this time for requesting channels. Signed-off-by: Bence Csókás <csokas.bence@prolan.hu> --- drivers/dma/dmaengine.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)