RE: [PATCH] cpqarray update

From: Wiran, Francis
Date: Mon Jan 26 2004 - 23:49:15 EST


Hmm... cpqarray supports both pci and eisa ctrls.

What would happen if there are no pci ctrl detected, but there is one
eisa ctrl detected? What do we return in cpqarray_init()? The return
code of pci_module_init is either 0 or -ENODEV. What happen if
cpqarray_init returns -ENODEV? Would the driver stay loaded? How about
0, or positive number?


thanks
-francis-

> -----Original Message-----
> From: Jeff Garzik [mailto:jgarzik@xxxxxxxxx]
> Sent: Monday, January 26, 2004 7:52 PM
> To: Wiran, Francis
> Cc: Linux Kernel Mailing List
> Subject: Re: [PATCH] cpqarray update
>
>
> Wiran, Francis wrote:
> >>You need to check the return value of pci_module_init() for errors.
> >
> > No, because the return value is determined from number of
> ctrls found,
> > and not from function return.
> >
> > int __init cpqarray_init(void)
> > {
> > ...
> > pci_module_init(&cpqarray_pci_driver);
> > cpqarray_eisa_detect();
> >
> > for(i=0;i<MAX_CTLR;i++) {
> > if(hba[i] != NULL)
> > num_ctlrs_reg++
> > }
> >
> > return (num_ctlrs_reg);
> > }
> >
> > int __init cpqarray_init_module(void)
> > {
> > if (cpqarray_init() == 0)
> > return -ENODEV;
> > return 0;
> > }
>
>
> Nope, this needs to be turned inside out. The proper PCI
> driver looks like
>
> static int __init cp_init (void)
> {
> return pci_module_init (&cp_driver);
> }
>
> static void __exit cp_exit (void)
> {
> pci_unregister_driver (&cp_driver);
> }
>
> We already handle the cases you describe. The cpqarray code -breaks-
> the API design by doing it this way.
>
> cpqarray does not fully support the pci_ids features and
> hotplug without
> this.
>
> Jeff
>
>
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/