Re: [PATCH] ahci: simplify init function

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

 



On 1/4/25 9:32 AM, Damien Le Moal wrote:
> On 12/30/24 21:15, Tomas Henzl wrote:
>> by removing few lines. No functional change.
>>
>> Signed-off-by: Tomas Henzl <thenzl@xxxxxxxxxx>
> 
> Please send patches to the maintainers as well.
> 
>> ---
>>  drivers/ata/ahci.c | 12 +++++-------
>>  1 file changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
>> index 8d27c567be1c..66c19039449d 100644
>> --- a/drivers/ata/ahci.c
>> +++ b/drivers/ata/ahci.c
>> @@ -1665,7 +1665,7 @@ static int ahci_get_irq_vector(struct ata_host *host, int port)
>>  	return pci_irq_vector(to_pci_dev(host->dev), port);
>>  }
>>  
>> -static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
>> +static int ahci_init_irq(struct pci_dev *pdev, unsigned int n_ports,
>>  			struct ahci_host_priv *hpriv)
>>  {
>>  	int nvec;
>> @@ -1700,12 +1700,13 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
>>  
>>  	/*
>>  	 * If the host is not capable of supporting per-port vectors, fall
>> -	 * back to single MSI before finally attempting single MSI-X.
>> +	 * back to single MSI before finally attempting single MSI-X or
>> +	 * a legacy INTx.
>>  	 */
>>  	nvec = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
>>  	if (nvec == 1)
>>  		return nvec;
>> -	return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
>> +	return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX | PCI_IRQ_INTX);
>>  }
>>  
>>  static void ahci_mark_external_port(struct ata_port *ap)
>> @@ -1985,10 +1986,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>>  	}
>>  	host->private_data = hpriv;
>>  
>> -	if (ahci_init_msi(pdev, n_ports, hpriv) < 0) {
>> -		/* legacy intx interrupts */
>> -		pci_intx(pdev, 1);
>> -	}
>> +	ahci_init_irq(pdev, n_ports, hpriv);
> 
> I think this needs error return check, unless we are guaranteed that
> pci_alloc_irq_vectors() always return success when PCI_IRQ_INTX is set. If that
> is the case, we can make ahci_init_irq() a void function. Please check.

With parameters we use the pci_alloc_irq_vectors won't fail.
I'll post a corresponding V2

> 
>>  	hpriv->irq = pci_irq_vector(pdev, 0);
>>  
>>  	if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
> 
> 





[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux