RE: [PATCH 9/9] staging: comedi: das08: Add attach_pci() hook

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

 



On Wednesday, May 23, 2012 9:50 AM, Ian Abbott wrote:
>
> Implement the attach_pci() hook.  This is called by
> comedi_pci_auto_config() in preference to the old attach() hook and
> avoids searching for the probed PCI device.  Factor out some common code
> used by both the attach() and attach_pci() hooks into a couple of new
> functions, das08_pci_attach_common() and das08_find_pci_board().
>
> Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> ---

<snip>

> @@ -995,19 +1063,12 @@ static int das08_find_pci(struct comedi_device *dev, int bus, int slot,
>  			continue;
>  		if (thisboard->id == PCI_ANY_ID) {
>  			/* wildcard board matches any supported PCI board */
> -			unsigned int i;
> -			for (i = 0; i < ARRAY_SIZE(das08_boards); i++) {
> -				if (das08_boards[i].bustype != pci)
> -					continue;
> -				if (pdev->device == das08_boards[i].id) {
> -					/* replace wildcard board_ptr */
> -					dev->board_ptr = &das08_boards[i];
> -					thisboard = comedi_board(dev);
> -					break;
> -				}
> -			}
> -			if (i == ARRAY_SIZE(das08_boards))
> +			const struct das08_board_struct *foundboard =
> +				das08_find_pci_board(pdev);
> +			if (foundboard == NULL)
>  				continue;
> +			/* replace wildcard board_ptr */
> +			dev->board_ptr = thisboard = foundboard;

Ian,

I don't think the das08_find_pci() function needs the 'thisboard' stuff.

You are searching the boardinfo for a match to the pci_dev and then
replacing the dev->board_ptr. You are not actually trying to use anything
that 'thisboard' would give you about the boardinfo.

Regards,
Hartley

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux