Re: [RFC] 2.6.0 EDD enhancements
From: James Bottomley
Date: Fri Dec 19 2003 - 15:25:05 EST
On Fri, 2003-12-19 at 14:01, Matt Domsch wrote:
> @@ -639,11 +629,11 @@
> pci_dev = edd_get_pci_dev(edev);
> if (pci_dev) {
> struct scsi_device * sdev = edd_find_matching_scsi_device(edev);
> - if (sdev && get_device(&sdev->sdev_driverfs_dev)) {
> + if (sdev && get_device(&sdev->sdev_gendev)) {
> rc = sysfs_create_link(&edev->kobj,
> - &sdev->sdev_driverfs_dev.kobj,
> + &sdev->sdev_gendev.kobj,
> "disc");
> - put_device(&sdev->sdev_driverfs_dev);
> + put_device(&sdev->sdev_gendev);
This is a bit nasty...you're assuming a lot of hidden knowledge about
the layout of sysfs objects in scsi_device in this code.
The current(*) way you should be doing this is to use scsi_device_get()
in your edd_match_scsi_dev() and do a scsi_device_put() after creating
the link...that should be hotplug robust.
(*) since SCSI hotplug is a work in progress, this may change...
James
-
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/