Re: [PATCH v2 05/11] PCI: Add pci_rebar_size_supported() helper
From: Jani Nikula
Date: Tue Sep 16 2025 - 04:07:31 EST
On Mon, 15 Sep 2025, Andi Shyti <andi.shyti@xxxxxxxxxx> wrote:
> Hi Ilpo,
>
>> +/**
>> + * pci_rebar_size_supported - check if size is supported for BAR
>> + * @pdev: PCI device
>> + * @bar: BAR to check
>> + * @size: size as defined in the PCIe spec (0=1MB, 31=128TB)
>> + *
>> + * Return: %true if @bar is resizable and @size is a supported, otherwise
>> + * %false.
>> + */
>> +bool pci_rebar_size_supported(struct pci_dev *pdev, int bar, int size)
>> +{
>> + u64 sizes = pci_rebar_get_possible_sizes(pdev, bar);
>> +
>> + return BIT(size) & sizes;
>
> I would return here "!!(BIT(size) & sizes)", but it doesn't
> really matter.
If the patch had that, I'd ask to drop the superfluous negations and
parens...
BR,
Jani.
>
> Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx>
>
> Andi
--
Jani Nikula, Intel