Skip to contentSkip to conversation

aic7xxx/aic79xx: call scsi_set_device()

PATCH In review Jeff Garzik 2 participants 7 messages May 29, 2005

Subsystems (10)
Documentation SCSI PCI libata +6 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 aic7xxx/aic79xx: call scsi_set_device()

[note: just for review... do not apply, will be submitted later via git]

author Jeff Garzik <[email protected]> Sun, 29 May 2005 06:47:07 -0400 committer Jeff Garzik <[email protected]> Sun, 29 May 2005 06:47:07 -0400

[SCSI] aic7xxx/aic79xx: call scsi_set_device()

The 2.4.x version correctly called scsi_set_pci_device(), but the author missed the corresponding 2.6.x scsi_set_device() change.

This requires moving the definition of pci_dev_to_dev() from include/linux/libata.h to include/linux/pci.h.

drivers/scsi/aic7xxx/aic79xx_osm.c +2 -0
@@ -2022,6 +2022,8 @@ ahd_linux_register_host(struct ahd_softc
 	host->unique_id = ahd->unit;
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	scsi_set_pci_device(host, ahd->dev_softc);
+#else
+	scsi_set_device(host, pci_dev_to_dev(ahd->dev_softc));
 #endif
 	ahd_linux_setup_user_rd_strm_settings(ahd);
 	ahd_linux_initialize_scsi_bus(ahd);
drivers/scsi/aic7xxx/aic7xxx_osm.c +1 -0
@@ -1196,6 +1196,7 @@ ahc_linux_register_host(struct ahc_softc
 		ahc_set_name(ahc, new_name);
 	}
 	host->unique_id = ahc->unit;
+	scsi_set_device(host, pci_dev_to_dev(ahc->dev_softc));
 	ahc_linux_initialize_scsi_bus(ahc);
 	ahc_intr_enable(ahc, TRUE);
 	ahc_unlock(ahc, &s);
include/linux/libata.h +0 -6
@@ -69,12 +69,6 @@
 /* defines only for the constants which don't work well as enums */
 #define ATA_TAG_POISON		0xfafbfcfdU
 
-/* move to PCI layer? */
-static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
-{
-	return &pdev->dev;
-}
-
 enum {
 	/* various global constants */
 	LIBATA_MAX_PRD		= ATA_MAX_PRD / 2,
include/linux/pci.h +5 -0
@@ -573,6 +573,11 @@ struct pci_dev {
 #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
 
+static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
+{
+	return &pdev->dev;
+}
+
 /*
  *  For PCI devices, the region numbers are assigned this way:
  *
#1 lore raw

cover aic7xxx/aic79xx changes

To kernel hackers:

These changes are all checked into git. Use the "aic" branch of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git

If you need an introduction to git, read http://lkml.org/lkml/2005/5/26/11

Jeff

#2 lore raw
In reply to Jeff Garzik
Quoted 11 lines · Jeff Garzik

[note: just for review... do not apply, will be submitted later via git]

author Jeff Garzik <[email protected]> Sun, 29 May 2005 06:47:07 -0400 committer Jeff Garzik <[email protected]> Sun, 29 May 2005 06:47:07 -0400

[SCSI] aic7xxx/aic79xx: call scsi_set_device()

The 2.4.x version correctly called scsi_set_pci_device(), but the author missed the corresponding 2.6.x scsi_set_device() change.

scsi_add_host connects the host to the device tree. scsi_set_device is obsolete and should go away ASAP.

#3 lore raw
Quoted 2 lines · Christoph Hellwig

scsi_add_host connects the host to the device tree. scsi_set_device is obsolete and should go away ASAP.

Ahhh, indeed it does.

It sounds like I should remove scsi_set_device(), and all calls to it.

Jeff

#4 lore raw
Quoted 7 lines · Jeff Garzik
Quoted 2 lines · Christoph Hellwig

scsi_add_host connects the host to the device tree. scsi_set_device is obsolete and should go away ASAP.

Ahhh, indeed it does.

It sounds like I should remove scsi_set_device(), and all calls to it.

We keep it for the few drivers that still use pci_find_device/pci_get_device loops. And yes, usage of those APIs should go away aswell..

#5 lore raw
In reply to Christoph Hellwig
Quoted 2 lines · Christoph Hellwig

scsi_add_host connects the host to the device tree. scsi_set_device is obsolete and should go away ASAP.

Someone needs to tell authors of newer drivers not to use scsi_set_device(), until it can be deleted...

Jeff

Documentation/scsi/scsi_mid_low_api.txt +7 -2
@@ -388,7 +388,7 @@ Summary:
    scsi_remove_device - detach and remove a SCSI device
    scsi_remove_host - detach and remove all SCSI devices owned by host
    scsi_report_bus_reset - report scsi _bus_ reset observed
-   scsi_set_device - place device reference in host structure
+   scsi_set_device - place device reference in host structure (DEPRECATED)
    scsi_track_queue_full - track successive QUEUE_FULL events 
    scsi_unblock_requests - allow further commands to be queued to given host
    scsi_unregister - [calls scsi_host_put()]
@@ -741,7 +741,7 @@ void scsi_report_bus_reset(struct Scsi_H
 
 
 /**
- * scsi_set_device - place device reference in host structure
+ * scsi_set_device - place device reference in host structure (DEPRECATED)
  * @shost: a pointer to a scsi host instance
  * @pdev: pointer to device instance to assign
  *
@@ -750,6 +750,11 @@ void scsi_report_bus_reset(struct Scsi_H
  *      Might block: no
  *
  *      Defined in: include/scsi/scsi_host.h .
+ *
+ *	Notes:  Do not use this function, it only exists for a few
+ *	ancient drivers.  Add struct device* to scsi_add_host()
+ *	instead.
+ *
  **/
 void scsi_set_device(struct Scsi_Host * shost, struct device * dev)
 
drivers/message/fusion/mptscsih.c +0 -4
@@ -1157,10 +1157,6 @@ mptscsih_probe(struct pci_dev *pdev, con
 		sh->sg_tablesize = numSGE;
 	}
 
-	/* Set the pci device pointer in Scsi_Host structure.
-	 */
-	scsi_set_device(sh, &ioc->pcidev->dev);
-
 	spin_unlock_irqrestore(&ioc->FreeQlock, flags);
 
 	hd = (MPT_SCSI_HOST *) sh->hostdata;
drivers/scsi/ips.c +1 -1
@@ -7034,7 +7034,7 @@ ips_register_scsi(int index)
 	sh->max_channel = ha->nbus - 1;
 	sh->can_queue = ha->max_cmds - 1;
 
-	IPS_ADD_HOST(sh, NULL);
+	IPS_ADD_HOST(sh, &ha->pcidev->dev);
 	return 0;
 }
 
drivers/scsi/ips.h +1 -1
@@ -111,7 +111,7 @@
       #define IPS_UNREGISTER_HOSTS(SHT)
       #define IPS_ADD_HOST(shost,device)   do { scsi_add_host(shost,device); scsi_scan_host(shost); } while (0)
       #define IPS_REMOVE_HOST(shost)       scsi_remove_host(shost)
-      #define IPS_SCSI_SET_DEVICE(sh,ha)   scsi_set_device(sh, &(ha)->pcidev->dev)
+      #define IPS_SCSI_SET_DEVICE(sh,ha)
       #define IPS_PRINTK(level, pcidev, format, arg...)                 \
             dev_printk(level , &((pcidev)->dev) , format , ## arg)
    #endif
drivers/scsi/libata-core.c +0 -1
@@ -3365,7 +3365,6 @@ static void ata_host_init(struct ata_por
 	host->max_channel = 1;
 	host->unique_id = ata_unique_id++;
 	host->max_cmd_len = 12;
-	scsi_set_device(host, ent->dev);
 	scsi_assign_lock(host, &host_set->lock);
 
 	ap->flags = ATA_FLAG_PORT_DISABLED;
drivers/scsi/megaraid/megaraid_mbox.c +0 -1
@@ -814,7 +814,6 @@ megaraid_io_attach(adapter_t *adapter)
 
 	// export the parameters required by the mid-layer
 	scsi_assign_lock(host, adapter->host_lock);
-	scsi_set_device(host, &adapter->pdev->dev);
 
 	host->irq		= adapter->irq;
 	host->unique_id		= adapter->unique_id;
drivers/scsi/nsp32.c +1 -3
@@ -2720,9 +2720,7 @@ static int nsp32_detect(Scsi_Host_Templa
 	host->unique_id = data->BaseAddress;
 	host->n_io_port	= data->NumAddress;
 	host->base      = (unsigned long)data->MmioAddress;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,63))
-	scsi_set_device(host, &PCIDEV->dev);
-#else
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,63))
 	scsi_set_pci_device(host, PCIDEV);
 #endif
 
#6 lore raw
Quoted 6 lines · Jeff Garzik
Quoted 2 lines · Christoph Hellwig

scsi_add_host connects the host to the device tree. scsi_set_device is obsolete and should go away ASAP.

Someone needs to tell authors of newer drivers not to use scsi_set_device(), until it can be deleted...

I do so in every review :)