RE: [PATCH RESEND 1/2] i2c: tegra: Add GPCDMA support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 19.08.2022 18:15, Dmitry Osipenko пишет:
> > 19.08.2022 15:23, Akhil R пишет:
> >>      if (of_device_is_compatible(np, "nvidia,tegra210-i2c-vi"))
> >>              i2c_dev->is_vi = true;
> >> +    else
> >> +            i2c_dev->dma_support = !!(of_find_property(np, "dmas",
> >> + NULL));
> >
> > 1. You leak the np returned by of_find_property().
> >
> > 2. There is device_property_read_bool() for this kind of
> > property-exists checks.
Okay. I went by the implementation in of_dma_request_slave_channel() to
check 'dmas'.

> >
> > 3. If "dmas" is missing in DT, then dma_request_chan() should return
> > NULL and everything will work fine. I suppose you haven't tried to
> > test this code.
> 
> Although, no. It should return ERR_PTR(-ENODEV) and then you should check
> the return code.
Yes. Agree that it is more agnostic to check for ERR_PTR(-ENODEV). But since I
call tegra_init_dma() for every large transfer until DMA is initialized, wouldn't
it be better to have a flag inside the driver so that we do not have to go through
so many functions for every attempted DMA transaction to find out that the DT
properties don't exist?

Shall I just put i2c_dev->dma_support = true here since DMA is supported by
hardware? It would turn false if dma_request_chan() returns something other
than -EPROBE_DEFER.

      if (of_device_is_compatible(np, "nvidia,tegra210-i2c-vi"))
              i2c_dev->is_vi = true;
 +    else
 +            i2c_dev->dma_support = true;




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux