lkml.org 
[lkml]   [2023]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 1/7] swiotlb: make io_tlb_default_mem local to swiotlb.c
From
On 27/06/2023 11:24 am, Greg Kroah-Hartman wrote:
> On Tue, Jun 27, 2023 at 11:54:23AM +0200, Petr Tesarik wrote:
>> +/**
>> + * is_swiotlb_active() - check if the software IO TLB is initialized
>> + * @dev: Device to check, or %NULL for the default IO TLB.
>> + */
>> bool is_swiotlb_active(struct device *dev)
>> {
>> - struct io_tlb_mem *mem = dev->dma_io_tlb_mem;
>> + struct io_tlb_mem *mem = dev
>> + ? dev->dma_io_tlb_mem
>> + : &io_tlb_default_mem;
>
> That's impossible to read and maintain over time, sorry.
>
> Please use real "if () else" lines, so that it can be maintained over
> time.

Moreover, it makes for a horrible interface anyway. If there's a need
for a non-specific "is SWIOTLB present at all?" check unrelated to any
particular device (which arguably still smells of poking into
implementation details...), please encapsulate it in its own distinct
helper like, say, is_swiotlb_present(void).

However, the more I think about it, the more I doubt that logic like
octeon_pci_setup() can continue to work properly at all if SWIOTLB
allocation becomes dynamic... :/

Thanks,
Robin.

\
 
 \ /
  Last update: 2023-06-27 12:55    [W:0.031 / U:0.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site