linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luben Tuikov <luben_tuikov@adaptec.com>
To: Greg KH <greg@kroah.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Oops calling sysfs_create_link() from pci_probe()
Date: Fri, 17 Jun 2005 12:23:19 -0400	[thread overview]
Message-ID: <42B2F8F7.3030101@adaptec.com> (raw)
In-Reply-To: <20050617055555.GA16371@kroah.com>

On 06/17/05 01:55, Greg KH wrote:
> On Thu, Jun 16, 2005 at 03:57:34PM -0400, Luben Tuikov wrote:
> 
>>Hi,
>>
>>I'm calling
>>
>>sysfs_create_link(&class->kobj,
>>		  &pcidev->driver->driver.kobj, "driver");
>>
>>To create a link from a syfs directory of an object which I've
>>created with class_device_regsiter(), to point to the
>>driver directory of the pci driver.
> 
> 
> Ick, why?  Shouldn't something like this be done in the driver core, and
> not in the individual drivers?

Hi Greg,

I agree, it should be done in the driver core.  The LLDD is registering
with the SAS class (unfinished, incomplete) and this is what appears:
/sys/class/sas/
/sys/class/sas/ha0/
/sys/class/sas/ha0/device -> link to PCI device
/sys/class/sas/ha0/device_name

where device name is the SAS address attribute (RO).
I'd ideally like to have a link to the LLDD in there
as well:

/sys/class/sas/ha0/driver -> link to the driver

But this host adapter registration with the SAS class happens
at pci_probe time, *at pci_register_driver* time so it seems that this
is the reason for the oops. (as opposed to PCI hot plugging the controller)
 
> Looks like one of the kobjects that you are wanting to link is not fully
> initialized and registered with sysfs.  Where are you getting that
> "&class->kobj" from?

It is the kobj of "ha0" which was just registered with class_device_register().
I suspect since all this is called from pci_probe at module init, it is
failing for the 2nd kobj, the driver.

Would this imply that had pci_probe been called on a PCI hot plug event
(not at pci_driver_register() time) then that symlink would've succeeded?
(since the driver had been registered already)

If so, can we reconcile this somehow so that code executed in pci_probe
at time B, could've also been executed at time A, A < B?

> Have a pointer to your patch anywhere?

It is quite incomplete.  Let me have something substantial and I'll post it
and then we can figure it out.  For now that line is /* XXX it would be good... */

> Also, try turning on kobject and driver core debugging, you should get a
> lot of helpful information in your syslog right before this oops.

Thanks,
	Luben

      reply	other threads:[~2005-06-17 16:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-16 19:57 Oops calling sysfs_create_link() from pci_probe() Luben Tuikov
2005-06-17  5:55 ` Greg KH
2005-06-17 16:23   ` Luben Tuikov [this message]

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=42B2F8F7.3030101@adaptec.com \
    --to=luben_tuikov@adaptec.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;
as well as URLs for NNTP newsgroup(s).