Re: [PATCH] fix improper use of pci_module_init() in drivers/char/agp/amd64-agp.c

From: Greg KH (greg_at_kroah.com)
Date: 09/30/04

  • Next message: Russell King: "Re: Serial driver hangs"
    Date:	Thu, 30 Sep 2004 12:59:05 -0700
    To: Andi Kleen <ak@suse.de>
    
    

    On Thu, Sep 30, 2004 at 09:20:09PM +0200, Andi Kleen wrote:
    > On Thu, Sep 30, 2004 at 11:42:48AM -0700, Greg KH wrote:
    > > Hi,
    > >
    > > In going through the tree and auditing the usage of pci_module_init(), I
    > > noticed that the amd64-agp driver was assuming that the return value of
    > > this function could be greater than 0 (which is what could happen in 2.2
    > > and 2.4 kernels.) As this is no longer true, I think the following
    > > patch is correct.
    > >
    > > I can add this to my bk-pci tree if you wish, otherwise feel free to
    > > send it upwards.
    >
    > There needs to be some replacement for it, you cannot just delete
    > the code.

    But that code has not ever run, since early 2.5 days. Don't tell me
    people are used to it :)

    > The idea is to run it as fallback when no devices are found.
    >
    > How about this patch?

    That does not work the way you are asking it to work. pci_module_init()
    is just a replacement for pci_register_driver these days. It will
    return either "0" if the driver is successfully registered, or a
    negative value if something bad happened. It will not return the number
    of devices that this driver bound to.

    So, if no devices are in the system, it will return 0, and again, the
    code you are wanting to run, will not.

    So, how about using the new pci_dev_present() call instead? That should
    be what you want, right?

    thanks,

    greg k-h
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Russell King: "Re: Serial driver hangs"

    Relevant Pages