Re: finding pci_dev from scsi_device

From: Herbert Rosmanith
Date: Mon Jun 26 2006 - 10:41:42 EST


> isn't it better to do this in the ahci driver itself instead? it for
> sure will be orders of magnitude easier....

drivers/scsi/ahci.c:

// XXX added herp
static int ahci_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) {
...

For some reason, I have to use an ioctl to reconfigure the controller.
This means that I don't have the "struct pci_dev *pdev" from ahci_init_one
and ahci_remove_one.

I could store a pointer to pci_dev by extending "struct ahci_host_priv",
but before doing this, I'm trying to figure out if there's a "correct"
way of finding a pci_dev from a scsi_device.

>From the scsi_device, I know I can get a "struct ata_port", from there
a "struct Scsi_Host", a "struct ata_host_set" and even a generic
"struct device *".

Now all that's missing is a pointer to "struct pci_dev". Is there a function
to enumerate all "struct device", in that case I could compare
"struct pci_dev -> dev", if the pointers match, I've found it.

kind regards,
h.rosmanith


-
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/