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

Niklas Schnelle
2023-04-28T13:51:47Z

On Thu, 2023-03-16 at 16:21 +0100, Arnd Bergmann wrote:
> 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

There were a few additional inb()/outb() uses so a few more drivers had
to have the dependency added but for v4 it will no longer be on the
ATA_SFF option and I used your suggestion above for this function.
There was another call to it in ata_generic_init_one() that is only
done for PCI_VENDOR_ID_AL so I added an #ifdef CONFIG_PATA_ALI around
that.

Thanks,
Niklas