Re: [PATCH 05/22] aerdrv: rework find_device_iter

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

 



(2010/04/08 13:24), Kenji Kaneshige wrote:
> How about changing like the below?
> 
> bool is_error_source(struct pci_dev, struct aer_err_info *e_info)
> {
>     if (the device is an error source)
>         return true;
>     return false;
> }
> 
> int add_error_device()
> {
>     if (the error buffer is full)
>         return -ENOSPC;
>     Add error information to the buffuer;
>     return 0;
> }
> 
> static int find_device_iter(struct pci_dev *dev, void *data)
> {
>     if (is_error_source(dev, e_info)) {
>         /* If the error buffer is full, stop iteration */
>         if (add_error_device(...)) {
>             Maybe error message is required here;
>             return 1;
>         }
>         /* If there is only a single error, stop iteration */         if
> (!e_info->multi_error_valid)
>             return 1;
>     }
>     return 0;
> }

Hum, I like it.
At least it is better to have is_error_source() instead of
using goto.  Next version will have it.


Thanks,
H.Seto

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux