Re: Oops calling sysfs_create_link() from pci_probe()

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

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux