Hidetoshi Seto <[EMAIL PROTECTED]> writes:

>
> int sample_read_with_iochk(struct pci_dev *dev, u32 *buf, int words)
> {
>       unsigned long ofs = pci_resource_start(dev, 0) + DATA_OFFSET;
>       int i;
>
>       /* Create magical cookie on the stack */
>       iocookie cookie;
>
>       /* Critical section start */
>       iochk_clear(&dev, &cookie);
>       {
>               /* Get the whole packet of data */
>               for (i = 0; i < words; i++)
>                       *buf++ = ioread32(dev, ofs);
>       }
>       /* Critical section end. Did we have any trouble? */
>       if ( iochk_read(&cookie) ) return -1;

Looks good for handling PCI-Express errors.

But what would the default handling be? It would be nice if there
was a simple way for a driver to say "just shut me down on an error"
without adding iochk_* to each function. Ideally this would be just
a standard callback that knows how to clean up the driver.

> +void iochk_clear(iocookie *cookie, struct pci_dev *dev)
> +{
> +       local_irq_save(*cookie);
> +}
> +
> +int iochk_read(iocookie *cookie)
> +{
> +       local_irq_restore(*cookie);
> +       return 0;
> +}

These should be inlined.

> +EXPORT_SYMBOL(iochk_init);

This doesn't need to be exported.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to