Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies

Arnd Bergmann
2023-03-16T15:22:37Z

On Thu, Mar 16, 2023, at 00:57, Damien Le Moal wrote:
> On 2023/03/15 20:36, Geert Uytterhoeven wrote:

> Ah. OK. I see now. So indeed, applying the dependency on the entire ATA_SFF
> group of drivers is very coarse.

> Can you change this to apply the dependency per driver ?

I think that will fail to build because of this function
on architectures that drop their non-functional
inb/outb helpers:

int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
{
unsigned long bmdma = pci_resource_start(pdev, 4);
u8 simplex;

if (bmdma == 0)
return -ENOENT;

simplex = inb(bmdma + 0x02);
outb(simplex & 0x60, bmdma + 0x02);
simplex = inb(bmdma + 0x02);
if (simplex & 0x80)
return -EOPNOTSUPP;
return 0;
}

This is only called from five pata drivers (ali, amd,
cmd64x, netcell, serverworks), so an easy workaround
would be to make sure those depend on HAS_IOPORT
and enclose the function definition in an #ifdef.

Arnd