mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Preston A. Elder" <prez@goth.net>
To: Dave Jones <davej@redhat.com>, "Preston A. Elder" <prez@goth.net>,
	linux-kernel@vger.kernel.org, greg@kroah.com
Subject: Re: AGPGart / AMD K7
Date: Fri, 20 Apr 2007 14:31:01 -0400	[thread overview]
Message-ID: <462906E5.8060609@goth.net> (raw)
In-Reply-To: <20070420182029.GF20118@redhat.com>

Dave Jones wrote:
> On Fri, Apr 20, 2007 at 02:04:45PM -0400, Preston A. Elder wrote:
>  > Dave Jones wrote:
>  > > On Fri, Apr 20, 2007 at 12:53:31PM -0400, Preston A. Elder wrote:
>  > >
>  > >  > Linux agpgart interface v0.101 (c) Dave Jones
>  > >  > agpgart: DEBUG 0
>  > >  > agpgart: DEBUG 1
>  > >  > __pci_register_driver: In function
>  > >  > __pci_register_driver: driver = agpgart-amdk7, multithread = 0
>  > >  > __pci_register_driver: Before Spinlock
>  > >  > __pci_register_driver: Before List Init
>  > >  > __pci_register_driver: Before Driver Register
>  > >  > __pci_register_driver: Error = 0
>  > >  > __pci_register_driver: Returning 0
>  > >  > 
>  > >  > The DEBUG 0 and 1 are coming from agp_amdk7_init()
>  > >  > There is a DEBUG 2 at the top of agp_amdk7_probe(), even before
>  > >  > pci_find_capability, but the function never gets called.
>  > >
>  > > bus_add_driver() returns 0 on error, but there's a few different
>  > > cases it can fail, which isn't helpful.
>
> Actually I misparsed this function, see below..
>
>  > > Add some printk's to
>  > > the error cases there, and see if that gives any more clues.
>  > >
>  > Here you go:
>
> This is odd..
>
>  > >  > __pci_register_driver: Before Driver Register
>  > >  > __pci_register_driver: Error = 0
>  > >  > __pci_register_driver: Returning 0
>
> That __pci_register_driver code is (presumably with your printk's added..)
>
>         error = driver_register(&drv->driver);
> 	printk("Error = %d\n", error);
>         if (error) {
> 		printk("Returning %d\n" error);
>                 return error;
> 	}
>
> Which doesn't make much sense.  If 'error' is 0, we shouldn't be
> taking that second printk & return. What compiler version is this?
>
> btw Greg, wtf does driver_register return a 0 as 'success' if it
> completes the function, and 0 as 'failure' if !bus ?
> That seems doomed to failure.
>
>  > Linux agpgart interface v0.101 (c) Dave Jones
>  > agpgart: DEBUG 0
>  > agpgart: DEBUG 1
>  > __pci_register_driver: In function
>  > __pci_register_driver: driver = agpgart-amdk7, multithread = 0
>  > __pci_register_driver: Before Spinlock
>  > __pci_register_driver: Before List Init
>  > __pci_register_driver: Before Driver Register
>  > bus_add_driver: In Function
>  > bus_add_driver: Before kobject_set_name (agpgart-amdk7)
>  > bus_add_driver: error = 0
>  > bus_add_driver: Before kobject_register
>  > bus_add_driver: error = 0
>  > bus_add_driver: Before driver_attach
>  > bus_add_driver: error = 0
>  > bus_add_driver: Before klist_add_tail
>  > bus_add_driver: Before module_add_driver
>  > bus_add_driver: Before driver_add_attrs
>  > bus_add_driver: error = 0
>  > bus_add_driver: Before add_bind_files
>  > bus_add_driver: error = 0
>  > bus_add_driver: Returning 0
>  > __pci_register_driver: Error = 0
>  > __pci_register_driver: Returning 0
>
> So we completed bus_add_driver without failing, then popped back
> up to __pci_register_driver and were somehow treated as
> if we failed.   *scratches head*
>
> 	Dave
>
>   
Dave,

Here is the code for __pci_register_driver:

  int __pci_register_driver(struct pci_driver *drv, struct module *owner)
  {
      int error;

  printk(KERN_INFO "__pci_register_driver: In function\n");
      /* initialize common driver fields */
      drv->driver.name = drv->name;
      drv->driver.bus = &pci_bus_type;
      drv->driver.owner = owner;
      drv->driver.kobj.ktype = &pci_driver_kobj_type;

  printk(KERN_INFO "__pci_register_driver: driver = %s, multithread = %d\n",
            drv->name, pci_multithread_probe);
      if (pci_multithread_probe)
          drv->driver.multithread_probe = pci_multithread_probe;
      else
          drv->driver.multithread_probe = drv->multithread_probe;

  printk(KERN_INFO "__pci_register_driver: Before Spinlock\n");
      spin_lock_init(&drv->dynids.lock);
  printk(KERN_INFO "__pci_register_driver: Before List Init\n");
     INIT_LIST_HEAD(&drv->dynids.list);

  printk(KERN_INFO "__pci_register_driver: Before Driver Register\n");
      /* register with core */
      error = driver_register(&drv->driver);

  printk(KERN_INFO "__pci_register_driver: Error = %d\n", error);
      if (!error)
          error = pci_create_newid_file(drv);

  printk(KERN_INFO "__pci_register_driver: Returning %d\n", error);
      return error;
  }

So in the above case, we ARE saying if driver_register returns 0 then
pci_create_newid_file.

Is it different to the code you have?  As I said, this IS 2.6.19.

PreZ :)


  parent reply	other threads:[~2007-04-20 18:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  7:10 Preston A. Elder
2007-04-20 15:55 ` Dave Jones
2007-04-20 16:53   ` Preston A. Elder
2007-04-20 17:33     ` Dave Jones
2007-04-20 18:04       ` Preston A. Elder
2007-04-20 18:20         ` Dave Jones
2007-04-20 18:29           ` Greg KH
2007-04-20 19:00             ` Dave Jones
2007-04-20 23:26               ` Greg KH
2007-04-21  0:33                 ` Dave Jones
2007-04-20 18:31           ` Preston A. Elder [this message]
2007-04-20 18:49             ` Dave Jones
2007-04-20 20:22               ` Preston A. Elder
2007-04-20 20:33                 ` Dave Jones
2007-04-20 22:00                   ` Preston A. Elder
2007-04-20 23:42                     ` Preston A. Elder
2007-04-21  0:15                       ` Greg KH
2007-04-20 23:25                   ` Greg KH
     [not found] <fa.asou3h2GKTshe+XpxGJ/K4Wjf2s@ifi.uio.no>
     [not found] ` <fa.YcM0QJJYQHgI9i0mZF4z2OtPhr8@ifi.uio.no>
     [not found]   ` <fa.8rayS7oJHYA3XGzEX9anUebRoMM@ifi.uio.no>
     [not found]     ` <fa.2SB7j6GjGOW6vvgLY7nbvSnuM6I@ifi.uio.no>
     [not found]       ` <fa.v7TywLl5PsPHzpOETJp8xq50Gno@ifi.uio.no>
     [not found]         ` <fa.S5WSCyOavqOFWClpzzJKcKpj03M@ifi.uio.no>
2007-05-03  9:35           ` John Sigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=462906E5.8060609@goth.net \
    --to=prez@goth.net \
    --cc=davej@redhat.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome