lkml.org 
[lkml]   [2021]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v10 2/8] PCI: Add new array for keeping track of ordering of reset methods
From
Date
Hi Bjorn,

On 7/27/21 5:59 PM, Bjorn Helgaas wrote:
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index fefa6d7b3..42440cb10 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -72,6 +72,14 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
>> msleep(delay);
>> }
>>
>> +int pci_reset_supported(struct pci_dev *dev)
>> +{
>> + u8 null_reset_methods[PCI_NUM_RESET_METHODS] = { 0 };
>> +
>> + return memcmp(null_reset_methods,
>> + dev->reset_methods, sizeof(null_reset_methods));
> I think "return dev->reset_methods[0] != 0;" is sufficient, isn't it?
>

Agree with you, it simplifies code logic and can be moved to "include/linux/pci.h"
with inline definition. Can we change return type to 'bool' instead of 'int' ?

static inline bool pci_reset_supported(struct pci_dev *dev)
{  
    return !!dev->reset_methods[0];
}

\
 
 \ /
  Last update: 2021-07-28 20:32    [W:0.102 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site