public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device()
@ 2005-05-29  7:40 Jeff Garzik
  2005-05-29  7:57 ` [PATCH 0/4] aic7xxx/aic79xx changes Jeff Garzik
  2005-05-29  8:24 ` [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Christoph Hellwig
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff Garzik @ 2005-05-29  7:40 UTC (permalink / raw)
  To: linux-scsi



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

author Jeff Garzik <jgarzik@pobox.com> Sun, 29 May 2005 06:47:07 -0400
committer Jeff Garzik <jgarzik@pobox.com> 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.

diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -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);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -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);
diff --git a/include/linux/libata.h b/include/linux/libata.h
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -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,
diff --git a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -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:
  *

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/4] aic7xxx/aic79xx changes
  2005-05-29  7:40 [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Jeff Garzik
@ 2005-05-29  7:57 ` Jeff Garzik
  2005-05-29  8:24 ` [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Christoph Hellwig
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2005-05-29  7:57 UTC (permalink / raw)
  To: linux-scsi; +Cc: Arjan van de Ven


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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device()
  2005-05-29  7:40 [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Jeff Garzik
  2005-05-29  7:57 ` [PATCH 0/4] aic7xxx/aic79xx changes Jeff Garzik
@ 2005-05-29  8:24 ` Christoph Hellwig
  2005-05-29  8:27   ` Jeff Garzik
  2005-05-29  8:52   ` [PATCH] " Jeff Garzik
  1 sibling, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2005-05-29  8:24 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi

On Sun, May 29, 2005 at 03:40:29AM -0400, Jeff Garzik wrote:
> 
> 
> [note:  just for review...  do not apply, will be submitted later via git]
> 
> author Jeff Garzik <jgarzik@pobox.com> Sun, 29 May 2005 06:47:07 -0400
> committer Jeff Garzik <jgarzik@pobox.com> 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device()
  2005-05-29  8:24 ` [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Christoph Hellwig
@ 2005-05-29  8:27   ` Jeff Garzik
  2005-05-29  8:30     ` Christoph Hellwig
  2005-05-29  8:52   ` [PATCH] " Jeff Garzik
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2005-05-29  8:27 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-scsi

Christoph Hellwig wrote:
> 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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device()
  2005-05-29  8:27   ` Jeff Garzik
@ 2005-05-29  8:30     ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2005-05-29  8:30 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi

On Sun, May 29, 2005 at 04:27:37AM -0400, Jeff Garzik wrote:
> Christoph Hellwig wrote:
> >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..


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] Re: [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device()
  2005-05-29  8:24 ` [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Christoph Hellwig
  2005-05-29  8:27   ` Jeff Garzik
@ 2005-05-29  8:52   ` Jeff Garzik
  2005-05-29  9:05     ` Christoph Hellwig
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2005-05-29  8:52 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 250 bytes --]

Christoph Hellwig wrote:
> 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



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 4154 bytes --]

diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -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)
 
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -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;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -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;
 }
 
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h
--- a/drivers/scsi/ips.h
+++ b/drivers/scsi/ips.h
@@ -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
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -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;
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -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;
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -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
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Re: [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device()
  2005-05-29  8:52   ` [PATCH] " Jeff Garzik
@ 2005-05-29  9:05     ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2005-05-29  9:05 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Christoph Hellwig, linux-scsi

On Sun, May 29, 2005 at 04:52:56AM -0400, Jeff Garzik wrote:
> Christoph Hellwig wrote:
> >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 :)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-05-29  9:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-29  7:40 [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Jeff Garzik
2005-05-29  7:57 ` [PATCH 0/4] aic7xxx/aic79xx changes Jeff Garzik
2005-05-29  8:24 ` [PATCH 1/4] aic7xxx/aic79xx: call scsi_set_device() Christoph Hellwig
2005-05-29  8:27   ` Jeff Garzik
2005-05-29  8:30     ` Christoph Hellwig
2005-05-29  8:52   ` [PATCH] " Jeff Garzik
2005-05-29  9:05     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox