Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors

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

 



On 3/18/19 9:19 AM, Geert Uytterhoeven wrote:
> Hi Marek,
> 
> On Mon, Mar 18, 2019 at 12:39 AM Marek Vasut <marek.vasut@xxxxxxxxx> wrote:
>> On 3/17/19 11:22 AM, Geert Uytterhoeven wrote:
>>> On Sun, Mar 17, 2019 at 1:06 AM Marek Vasut <marek.vasut@xxxxxxxxx> wrote:
>>>> On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
>>>>> On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@xxxxxxxxx> wrote:
>>>>>> --- a/drivers/pci/controller/pcie-rcar.c
>>>>>> +++ b/drivers/pci/controller/pcie-rcar.c
>>>>>> @@ -152,14 +152,12 @@ struct rcar_pcie {
>>>>>>         struct                  rcar_msi msi;
>>>>>>  };
>>>>>>
>>>>>> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
>>>>>> -                              unsigned long reg)
>>>>>> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
>>>>>
>>>>> Doesn't unsigned int make more sense for reg?
>>>>
>>>> Isn't u32 more explicit ?
>>>
>>> It's just an offset in the register block, with a range much smaller than u32.
>>
>> We could use u16 ?
> 
> u16 may be more expensive on some processor architectures
> (MIPS comes too mind, don't know about ARM).

On armv8a, none.

>> However, Bjorn's concern was that using unsigned long
>> for registers was not recommended ;
> 
> Wasn't that comment meant for the size of the register values?
> 
>> how's unsigned int better ?
> 
> Basic rule "If you don't care about the size, use (unsigned) int"?

This only applies to the $shift variable, yes ? The rest are u32 since
those contain actual values read/written into the registers.

-- 
Best regards,
Marek Vasut



[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