diff mbox series

dmaengine: xilinx: Add empty device_config function

Message ID 20210716182241.218705-1-marex@denx.de (mailing list archive)
State Superseded
Headers show
Series dmaengine: xilinx: Add empty device_config function | expand

Commit Message

Marek Vasut July 16, 2021, 6:22 p.m. UTC
Various DMA users call the dmaengine_slave_config() and expect it to
succeed, but that can only succeed if .device_config is implemented.
Add empty device_config function rather than patching all the places
which use dmaengine_slave_config().

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Kedareswara rao Appana <appana.durga.rao@xilinx.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/xilinx/xilinx_dma.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Vinod Koul July 17, 2021, 11:36 a.m. UTC | #1
On 16-07-21, 20:22, Marek Vasut wrote:
> Various DMA users call the dmaengine_slave_config() and expect it to
> succeed, but that can only succeed if .device_config is implemented.
> Add empty device_config function rather than patching all the places
> which use dmaengine_slave_config().

.device_config is optional, Yes the dmaengine_slave_config() will check
and return error...

I think it would make sense to handle this in caller... (ignore
ENOSYS..) rather than add a dummy one

> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Kedareswara rao Appana <appana.durga.rao@xilinx.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Vinod Koul <vinod.koul@intel.com>

ummm..? you really need to update this :)

> ---
>  drivers/dma/xilinx/xilinx_dma.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index 4b9530a7bf65..d6f4bf0d50e8 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -1658,6 +1658,17 @@ static void xilinx_dma_issue_pending(struct dma_chan *dchan)
>  	spin_unlock_irqrestore(&chan->lock, flags);
>  }
>  
> +/**
> + * xilinx_dma_issue_pending - Configure the DMA channel
> + * @dchan: DMA channel
> + * @config: channel configuration
> + */
> +static int xilinx_dma_device_config(struct dma_chan *dchan,
> +				    struct dma_slave_config *config)
> +{
> +	return 0;
> +}
> +
>  /**
>   * xilinx_dma_complete_descriptor - Mark the active descriptor as complete
>   * @chan : xilinx DMA channel
> @@ -3096,6 +3107,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
>  	xdev->common.device_synchronize = xilinx_dma_synchronize;
>  	xdev->common.device_tx_status = xilinx_dma_tx_status;
>  	xdev->common.device_issue_pending = xilinx_dma_issue_pending;
> +	xdev->common.device_config = xilinx_dma_device_config;
>  	if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
>  		dma_cap_set(DMA_CYCLIC, xdev->common.cap_mask);
>  		xdev->common.device_prep_slave_sg = xilinx_dma_prep_slave_sg;
> -- 
> 2.30.2
Marek Vasut July 17, 2021, 12:01 p.m. UTC | #2
On 7/17/21 1:36 PM, Vinod Koul wrote:
> On 16-07-21, 20:22, Marek Vasut wrote:
>> Various DMA users call the dmaengine_slave_config() and expect it to
>> succeed, but that can only succeed if .device_config is implemented.
>> Add empty device_config function rather than patching all the places
>> which use dmaengine_slave_config().
> 
> .device_config is optional, Yes the dmaengine_slave_config() will check
> and return error...
> 
> I think it would make sense to handle this in caller... (ignore
> ENOSYS..) rather than add a dummy one

That's what I was trying to avoid -- patching all the places in kernel 
which might fail. Why handle it in caller ?

>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Akinobu Mita <akinobu.mita@gmail.com>
>> Cc: Kedareswara rao Appana <appana.durga.rao@xilinx.com>
>> Cc: Michal Simek <monstr@monstr.eu>
>> Cc: Vinod Koul <vinod.koul@intel.com>
> 
> ummm..? you really need to update this :)

I had the patch around for a while indeed, it fell through the cracks.
Vinod Koul July 17, 2021, 2:34 p.m. UTC | #3
On 17-07-21, 14:01, Marek Vasut wrote:
> On 7/17/21 1:36 PM, Vinod Koul wrote:
> > On 16-07-21, 20:22, Marek Vasut wrote:
> > > Various DMA users call the dmaengine_slave_config() and expect it to
> > > succeed, but that can only succeed if .device_config is implemented.
> > > Add empty device_config function rather than patching all the places
> > > which use dmaengine_slave_config().
> > 
> > .device_config is optional, Yes the dmaengine_slave_config() will check
> > and return error...
> > 
> > I think it would make sense to handle this in caller... (ignore
> > ENOSYS..) rather than add a dummy one
> 
> That's what I was trying to avoid -- patching all the places in kernel which
> might fail. Why handle it in caller ?

And how many places would that be..? The xilinx driver using xilinx
dma right>

> > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > Cc: Akinobu Mita <akinobu.mita@gmail.com>
> > > Cc: Kedareswara rao Appana <appana.durga.rao@xilinx.com>
> > > Cc: Michal Simek <monstr@monstr.eu>
> > > Cc: Vinod Koul <vinod.koul@intel.com>
> > 
> > ummm..? you really need to update this :)
> 
> I had the patch around for a while indeed, it fell through the cracks.

This has to be more than 3 yrs old then!
Marek Vasut July 17, 2021, 2:48 p.m. UTC | #4
On 7/17/21 4:34 PM, Vinod Koul wrote:
> On 17-07-21, 14:01, Marek Vasut wrote:
>> On 7/17/21 1:36 PM, Vinod Koul wrote:
>>> On 16-07-21, 20:22, Marek Vasut wrote:
>>>> Various DMA users call the dmaengine_slave_config() and expect it to
>>>> succeed, but that can only succeed if .device_config is implemented.
>>>> Add empty device_config function rather than patching all the places
>>>> which use dmaengine_slave_config().
>>>
>>> .device_config is optional, Yes the dmaengine_slave_config() will check
>>> and return error...
>>>
>>> I think it would make sense to handle this in caller... (ignore
>>> ENOSYS..) rather than add a dummy one
>>
>> That's what I was trying to avoid -- patching all the places in kernel which
>> might fail. Why handle it in caller ?
> 
> And how many places would that be..? The xilinx driver using xilinx
> dma right>

git grep indicates around 170 matches on dmaengine_slave_config. In my 
case, it is generic PCM DMA in sound/soc/soc-generic-dmaengine-pcm.c .

>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>> Cc: Akinobu Mita <akinobu.mita@gmail.com>
>>>> Cc: Kedareswara rao Appana <appana.durga.rao@xilinx.com>
>>>> Cc: Michal Simek <monstr@monstr.eu>
>>>> Cc: Vinod Koul <vinod.koul@intel.com>
>>>
>>> ummm..? you really need to update this :)
>>
>> I had the patch around for a while indeed, it fell through the cracks.
> 
> This has to be more than 3 yrs old then!

Four
kernel test robot July 18, 2021, 7:38 p.m. UTC | #5
Hi Marek,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v5.14-rc1]
[also build test WARNING on next-20210716]
[cannot apply to xlnx/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Marek-Vasut/dmaengine-xilinx-Add-empty-device_config-function/20210718-111119
base:    e73f0f0ee7541171d89f2e2491130c7771ba58d3
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/89cc716182246c22a6c7bdb666952b3cec945a0a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Marek-Vasut/dmaengine-xilinx-Add-empty-device_config-function/20210718-111119
        git checkout 89cc716182246c22a6c7bdb666952b3cec945a0a
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/dma/xilinx/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/dma/xilinx/xilinx_dma.c:800: warning: expecting prototype for xilinx_dma_tx_descriptor(). Prototype was for xilinx_dma_alloc_tx_descriptor() instead
>> drivers/dma/xilinx/xilinx_dma.c:1659: warning: expecting prototype for xilinx_dma_issue_pending(). Prototype was for xilinx_dma_device_config() instead
   drivers/dma/xilinx/xilinx_dma.c:2489: warning: expecting prototype for xilinx_dma_channel_set_config(). Prototype was for xilinx_vdma_channel_set_config() instead


vim +1659 drivers/dma/xilinx/xilinx_dma.c

  1651	
  1652	/**
  1653	 * xilinx_dma_issue_pending - Configure the DMA channel
  1654	 * @dchan: DMA channel
  1655	 * @config: channel configuration
  1656	 */
  1657	static int xilinx_dma_device_config(struct dma_chan *dchan,
  1658					    struct dma_slave_config *config)
> 1659	{
  1660		return 0;
  1661	}
  1662	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Vinod Koul July 28, 2021, 11:07 a.m. UTC | #6
On 17-07-21, 16:48, Marek Vasut wrote:
> On 7/17/21 4:34 PM, Vinod Koul wrote:
> > On 17-07-21, 14:01, Marek Vasut wrote:
> > > On 7/17/21 1:36 PM, Vinod Koul wrote:
> > > > On 16-07-21, 20:22, Marek Vasut wrote:
> > > > > Various DMA users call the dmaengine_slave_config() and expect it to
> > > > > succeed, but that can only succeed if .device_config is implemented.
> > > > > Add empty device_config function rather than patching all the places
> > > > > which use dmaengine_slave_config().
> > > > 
> > > > .device_config is optional, Yes the dmaengine_slave_config() will check
> > > > and return error...
> > > > 
> > > > I think it would make sense to handle this in caller... (ignore
> > > > ENOSYS..) rather than add a dummy one
> > > 
> > > That's what I was trying to avoid -- patching all the places in kernel which
> > > might fail. Why handle it in caller ?
> > 
> > And how many places would that be..? The xilinx driver using xilinx
> > dma right>
> 
> git grep indicates around 170 matches on dmaengine_slave_config. In my case,
> it is generic PCM DMA in sound/soc/soc-generic-dmaengine-pcm.c .

Okay lets have this. Looks like kbuild-bot is not happy, can you fix
that and send update
diff mbox series

Patch

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 4b9530a7bf65..d6f4bf0d50e8 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -1658,6 +1658,17 @@  static void xilinx_dma_issue_pending(struct dma_chan *dchan)
 	spin_unlock_irqrestore(&chan->lock, flags);
 }
 
+/**
+ * xilinx_dma_issue_pending - Configure the DMA channel
+ * @dchan: DMA channel
+ * @config: channel configuration
+ */
+static int xilinx_dma_device_config(struct dma_chan *dchan,
+				    struct dma_slave_config *config)
+{
+	return 0;
+}
+
 /**
  * xilinx_dma_complete_descriptor - Mark the active descriptor as complete
  * @chan : xilinx DMA channel
@@ -3096,6 +3107,7 @@  static int xilinx_dma_probe(struct platform_device *pdev)
 	xdev->common.device_synchronize = xilinx_dma_synchronize;
 	xdev->common.device_tx_status = xilinx_dma_tx_status;
 	xdev->common.device_issue_pending = xilinx_dma_issue_pending;
+	xdev->common.device_config = xilinx_dma_device_config;
 	if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
 		dma_cap_set(DMA_CYCLIC, xdev->common.cap_mask);
 		xdev->common.device_prep_slave_sg = xilinx_dma_prep_slave_sg;