On Sun, Dec 26, 2021 at 03:13:21PM +0200, Andy Shevchenko wrote: > On Sun, Dec 26, 2021 at 1:45 PM Gabriel L. Somlo <gsomlo@xxxxxxxxx> wrote: > > On Sat, Dec 25, 2021 at 06:43:22PM +0200, Andy Shevchenko wrote: > > > On Wed, Dec 15, 2021 at 10:00 PM Gabriel Somlo <gsomlo@xxxxxxxxx> wrote: > > ... > > > > This is wrong. It missed the deferred probe, for example. > > > > > > The best approach is > > > > > > ret = platform_get_irq_optional(...); > > > if (ret < 0 && ret != -ENXIO) > > > return ret; > > > if (ret > 0) > > > ...we got it... > > > > > > It will allow the future API fix of platform_get_irq_optional() to be > > > really optional. > > > > Thanks for the example. I still need to work in a decision to use > > polling, though. How about something like this instead: > > > > ret = platform_get_irq_optional(...); > > if (ret == -ENXIO) > > goto use_polling; > > if (ret < 0) > > return ret; // deferred probe (-EAGAIN likely?) > > if (ret > 0) > > ...we got it, keep going... > > This doesn't define what you should do when you get 0. > I suggest to take my variant with below modification > > if (ret > 0) > ...we have IRQ... > else > goto USE POLLING; > > It will take care of the case. OK, will do. > ... > > > > > +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT > > > > > > Why under ifdeffery? > > > > Because I only want to do it on 64-bit capable architectures. > > > > The alternative would be to call > > > > dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); > > > > on *all* architectures, but ignore the returned error (-EIO, > > presumably on architetures that only support 32-bit DMA). > > I don't understand why you are supposed to ignore errors and why you > expect to get such. If I call `dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));` on a machine where `CONFIG_ARCH_DMA_ADDR_T_64BIT` is *not* set, I expect an error. The implicit default (per Documentation/core-api/dma-api-howto.rst), is DMA_BIT_MASK(32). I'm working under the impression that on machines with CONFIG_ARCH_DMA_ADDR_T_64BIT I should increase that to DMA_BIT_MASK(64). So if I don't #ifdef it, that call will fail on machines supporting only 32-bits. What am I missing? Thanks, --Gabriel > > Do you think that would be cleaner? > > -- > With Best Regards, > Andy Shevchenko