-/*
- * FIXME - as of 15-Jan-2003, there are some non-"scsi_device"s on the
- * scsi_bus list. The following functions could possibly mis-access
- * memory in that case. This is actually a problem with the SCSI
- * layer, which is being addressed there. Until then, don't use the
- * SCSI functions.
- */
-
-#undef CONFIG_SCSI
-#undef CONFIG_SCSI_MODULE
-#if defined(CONFIG_SCSI) || defined(CONFIG_SCSI_MODULE)
-
-struct edd_match_data {
- struct edd_device * edev;
- struct scsi_device * sd;
-};
-
-/**
- * edd_match_scsidev()
- * @edev - EDD device is a known SCSI device
- * @sd - scsi_device with host who's parent is a PCI controller
- *
- * returns 1 if a match is found, 0 if not.
- */
-static int edd_match_scsidev(struct device * dev, void * d)
-{
- struct edd_match_data * data = (struct edd_match_data *)d;
- struct edd_info *info = edd_dev_get_info(data->edev);
- struct scsi_device * sd = to_scsi_device(dev);
-
- if (info) {
- if ((sd->channel == info->params.interface_path.pci.channel) &&
- (sd->id == info->params.device_path.scsi.id) &&
- (sd->lun == info->params.device_path.scsi.lun)) {
- data->sd = sd;
- return 1;
- }
- }
- return 0;
-}
-
-/**
- * edd_find_matching_device()
- * @edev - edd_device to match
- *
- * Search the SCSI devices for a drive that matches the EDD
- * device descriptor we have. If we find a match, return it,
- * otherwise, return NULL.
- */
-
-static struct scsi_device *
-edd_find_matching_scsi_device(struct edd_device *edev)
-{
- struct edd_match_data data;
- struct bus_type * scsi_bus = find_bus("scsi");
-
- if (!scsi_bus) {
- return NULL;
- }
-
- data.edev = edev;
-
- if (edd_dev_is_type(edev, "SCSI")) {
- if (bus_for_each_dev(scsi_bus,NULL,&data,edd_match_scsidev))
- return data.sd;
- }
- return NULL;
-}
-
-static int
-edd_create_symlink_to_scsidev(struct edd_device *edev)
-{
- struct pci_dev *pci_dev;
- int rc = -EINVAL;
-
- 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)) {
- rc = sysfs_create_link(&edev->kobj,
- &sdev->sdev_driverfs_dev.kobj,
- "disc");
- put_device(&sdev->sdev_driverfs_dev);
- }
- }
- return rc;
-}
-
-#else
-static int
-edd_create_symlink_to_scsidev(struct edd_device *edev)
-{
- return -ENOSYS;
-}
-#endif
-
-