Re: [PATCH v3 7/8] PCI: Make minimum bridge window alignment reference more obvious

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

 



On Tue, May 07, 2024 at 01:25:22PM +0300, Ilpo Järvinen wrote:
> Calculations related to bridge window size contain literal 20 that is
> the minimum alignment for a bridge window. Make the code more obvious
> by converting the literal 20 to __ffs(SZ_1MB).

...

> -		align1 <<= (order + 20);
> +		align1 <<= (order + __ffs(SZ_1M));

No need for outer parentheses.

...

> +			order = __ffs(align) - __ffs(SZ_1M);

Yeah, would be nice to have something like

#define bit_distance(a, b)	(ffs(a) - fls(b))

in bitops.h as we have a few users and I have heard about one more coming,
but this is topic to another discussion. (Yuri, just FYI.)

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux