RE: [PATCH 3/7] staging: comedi: amplc_pci230: Add attach_pci() hook

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

 



On Friday, June 01, 2012 9:32 AM, Ian Abbott wrote:
> Implement the attach_pci() hook as function pci230_attach_pci().  This
> is called by comedi_pci_auto_config() in preference to the old attach()
> hook (implemented by pci230_attach() and still required for "manual"
> configuration of comedi devices).  The advantage of the attach_pci()
> hook is that it avoids searching for the PCI device.
>
> Refactor pci230_attach() and factor out code common to pci230_attach()
> and pci230_attach_pci() into new functions pci230_match_pci_board(),
> pci230_find_pci_board(), pci230_find_pci(), pci230_alloc_private() and
> pci230_attach_common().
>
> Finally, move pci230_attach() and pci230_detach() along with all the new
> functions towards the bottom of the file as it makes the patch much
> cleaner (though longer) and I plan to move things around soon to get
> rid of the remaining forward references.
>
> Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> ---
>  drivers/staging/comedi/drivers/amplc_pci230.c |  578 +++++++++++++------------
>  1 files changed, 301 insertions(+), 277 deletions(-)

<snip>

> +static int __devinit pci230_attach_pci(struct comedi_device *dev,
> +				       struct pci_dev *pci_dev)

This function should not be tagged '__devinit'.

<snip>

> static struct comedi_driver amplc_pci230_driver = {
>  	.driver_name	= "amplc_pci230",
>  	.module		= THIS_MODULE,
>  	.attach		= pci230_attach,
> +	.attach_pci	= pci230_attach_pci,
>  	.detach		= pci230_detach,
>  	.board_name	= &pci230_boards[0].name,
>  	.offset		= sizeof(pci230_boards[0]),

This comedi_driver structure is going to exist until comedi_driver_unregister
is called to remove it from the global comedi_drivers pool. All the data in this
structure needs to remain valid while it exists.

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