linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libata:upstream] remove compiler warnings
@ 2005-08-22  9:11 Tejun Heo
  2005-08-22 19:50 ` libata TODO: ioread/iowrite work (was Re: [PATCH libata:upstream] remove compiler warnings) Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2005-08-22  9:11 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide

 Hello, Jeff.

 This patch removes compiler warnings which are caused by using
ioports values (unsigned long) for the address argument of
read/write[bwl]() functions without casting.

Signed-off-by: Tejun Heo <htejun@gmail.com>

diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -103,26 +103,31 @@ static void k2_sata_tf_load(struct ata_p
 	unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
 
 	if (tf->ctl != ap->last_ctl) {
-		writeb(tf->ctl, ioaddr->ctl_addr);
+		writeb(tf->ctl, (void __iomem *)ioaddr->ctl_addr);
 		ap->last_ctl = tf->ctl;
 		ata_wait_idle(ap);
 	}
 	if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
-		writew(tf->feature | (((u16)tf->hob_feature) << 8), ioaddr->feature_addr);
-		writew(tf->nsect | (((u16)tf->hob_nsect) << 8), ioaddr->nsect_addr);
-		writew(tf->lbal | (((u16)tf->hob_lbal) << 8), ioaddr->lbal_addr);
-		writew(tf->lbam | (((u16)tf->hob_lbam) << 8), ioaddr->lbam_addr);
-		writew(tf->lbah | (((u16)tf->hob_lbah) << 8), ioaddr->lbah_addr);
+		u16 feature = tf->feature | (((u16)tf->hob_feature) << 8);
+		u16 nsect = tf->nsect | (((u16)tf->hob_nsect) << 8);
+		u16 lbal = tf->lbal | (((u16)tf->hob_lbal) << 8);
+		u16 lbam = tf->lbam | (((u16)tf->hob_lbam) << 8);
+		u16 lbah = tf->lbah | (((u16)tf->hob_lbah) << 8);
+		writew(feature, (void __iomem *)ioaddr->feature_addr);
+		writew(nsect, (void __iomem *)ioaddr->nsect_addr);
+		writew(lbal, (void __iomem *)ioaddr->lbal_addr);
+		writew(lbam, (void __iomem *)ioaddr->lbam_addr);
+		writew(lbah, (void __iomem *)ioaddr->lbah_addr);
 	} else if (is_addr) {
-		writew(tf->feature, ioaddr->feature_addr);
-		writew(tf->nsect, ioaddr->nsect_addr);
-		writew(tf->lbal, ioaddr->lbal_addr);
-		writew(tf->lbam, ioaddr->lbam_addr);
-		writew(tf->lbah, ioaddr->lbah_addr);
+		writew(tf->feature, (void __iomem *)ioaddr->feature_addr);
+		writew(tf->nsect, (void __iomem *)ioaddr->nsect_addr);
+		writew(tf->lbal, (void __iomem *)ioaddr->lbal_addr);
+		writew(tf->lbam, (void __iomem *)ioaddr->lbam_addr);
+		writew(tf->lbah, (void __iomem *)ioaddr->lbah_addr);
 	}
 
 	if (tf->flags & ATA_TFLAG_DEVICE)
-		writeb(tf->device, ioaddr->device_addr);
+		writeb(tf->device, (void __iomem *)ioaddr->device_addr);
 
 	ata_wait_idle(ap);
 }
@@ -133,14 +138,14 @@ static void k2_sata_tf_read(struct ata_p
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	u16 nsect, lbal, lbam, lbah;
 
-	nsect = tf->nsect = readw(ioaddr->nsect_addr);
-	lbal = tf->lbal = readw(ioaddr->lbal_addr);
-	lbam = tf->lbam = readw(ioaddr->lbam_addr);
-	lbah = tf->lbah = readw(ioaddr->lbah_addr);
-	tf->device = readw(ioaddr->device_addr);
+	nsect = tf->nsect = readw((void __iomem *)ioaddr->nsect_addr);
+	lbal = tf->lbal = readw((void __iomem *)ioaddr->lbal_addr);
+	lbam = tf->lbam = readw((void __iomem *)ioaddr->lbam_addr);
+	lbah = tf->lbah = readw((void __iomem *)ioaddr->lbah_addr);
+	tf->device = readw((void __iomem *)ioaddr->device_addr);
 
 	if (tf->flags & ATA_TFLAG_LBA48) {
-		tf->hob_feature = readw(ioaddr->error_addr) >> 8;
+		tf->hob_feature = readw((void __iomem *)ioaddr->error_addr) >> 8;
 		tf->hob_nsect = nsect >> 8;
 		tf->hob_lbal = lbal >> 8;
 		tf->hob_lbam = lbam >> 8;
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -81,10 +81,10 @@ static void vsc_sata_scr_write (struct a
 
 static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl)
 {
-	unsigned long mask_addr;
+	void __iomem *mask_addr;
 	u8 mask;
 
-	mask_addr = (unsigned long) ap->host_set->mmio_base +
+	mask_addr = ap->host_set->mmio_base +
 		VSC_SATA_INT_MASK_OFFSET + ap->port_no;
 	mask = readb(mask_addr);
 	if (ctl & ATA_NIEN)
@@ -110,21 +110,26 @@ static void vsc_sata_tf_load(struct ata_
 		vsc_intr_mask_update(ap, tf->ctl & ATA_NIEN);
 	}
 	if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
-		writew(tf->feature | (((u16)tf->hob_feature) << 8), ioaddr->feature_addr);
-		writew(tf->nsect | (((u16)tf->hob_nsect) << 8), ioaddr->nsect_addr);
-		writew(tf->lbal | (((u16)tf->hob_lbal) << 8), ioaddr->lbal_addr);
-		writew(tf->lbam | (((u16)tf->hob_lbam) << 8), ioaddr->lbam_addr);
-		writew(tf->lbah | (((u16)tf->hob_lbah) << 8), ioaddr->lbah_addr);
+		u16 feature = tf->feature | (((u16)tf->hob_feature) << 8);
+		u16 nsect = tf->nsect | (((u16)tf->hob_nsect) << 8);
+		u16 lbal = tf->lbal | (((u16)tf->hob_lbal) << 8);
+		u16 lbam = tf->lbam | (((u16)tf->hob_lbam) << 8);
+		u16 lbah = tf->lbah | (((u16)tf->hob_lbah) << 8);
+		writew(feature, (void __iomem *)ioaddr->feature_addr);
+		writew(nsect, (void __iomem *)ioaddr->nsect_addr);
+		writew(lbal, (void __iomem *)ioaddr->lbal_addr);
+		writew(lbam, (void __iomem *)ioaddr->lbam_addr);
+		writew(lbah, (void __iomem *)ioaddr->lbah_addr);
 	} else if (is_addr) {
-		writew(tf->feature, ioaddr->feature_addr);
-		writew(tf->nsect, ioaddr->nsect_addr);
-		writew(tf->lbal, ioaddr->lbal_addr);
-		writew(tf->lbam, ioaddr->lbam_addr);
-		writew(tf->lbah, ioaddr->lbah_addr);
+		writew(tf->feature, (void __iomem *)ioaddr->feature_addr);
+		writew(tf->nsect, (void __iomem *)ioaddr->nsect_addr);
+		writew(tf->lbal, (void __iomem *)ioaddr->lbal_addr);
+		writew(tf->lbam, (void __iomem *)ioaddr->lbam_addr);
+		writew(tf->lbah, (void __iomem *)ioaddr->lbah_addr);
 	}
 
 	if (tf->flags & ATA_TFLAG_DEVICE)
-		writeb(tf->device, ioaddr->device_addr);
+		writeb(tf->device, (void __iomem *)ioaddr->device_addr);
 
 	ata_wait_idle(ap);
 }
@@ -135,14 +140,14 @@ static void vsc_sata_tf_read(struct ata_
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	u16 nsect, lbal, lbam, lbah;
 
-	nsect = tf->nsect = readw(ioaddr->nsect_addr);
-	lbal = tf->lbal = readw(ioaddr->lbal_addr);
-	lbam = tf->lbam = readw(ioaddr->lbam_addr);
-	lbah = tf->lbah = readw(ioaddr->lbah_addr);
-	tf->device = readw(ioaddr->device_addr);
+	nsect = tf->nsect = readw((void __iomem *)ioaddr->nsect_addr);
+	lbal = tf->lbal = readw((void __iomem *)ioaddr->lbal_addr);
+	lbam = tf->lbam = readw((void __iomem *)ioaddr->lbam_addr);
+	lbah = tf->lbah = readw((void __iomem *)ioaddr->lbah_addr);
+	tf->device = readw((void __iomem *)ioaddr->device_addr);
 
 	if (tf->flags & ATA_TFLAG_LBA48) {
-		tf->hob_feature = readb(ioaddr->error_addr);
+		tf->hob_feature = readb((void __iomem *)ioaddr->error_addr);
 		tf->hob_nsect = nsect >> 8;
 		tf->hob_lbal = lbal >> 8;
 		tf->hob_lbam = lbam >> 8;
@@ -251,8 +256,8 @@ static void __devinit vsc_sata_setup_por
 	port->ctl_addr		= base + VSC_SATA_TF_CTL_OFFSET;
 	port->bmdma_addr	= base + VSC_SATA_DMA_CMD_OFFSET;
 	port->scr_addr		= base + VSC_SATA_SCR_STATUS_OFFSET;
-	writel(0, base + VSC_SATA_UP_DESCRIPTOR_OFFSET);
-	writel(0, base + VSC_SATA_UP_DATA_BUFFER_OFFSET);
+	writel(0, (void __iomem *)base + VSC_SATA_UP_DESCRIPTOR_OFFSET);
+	writel(0, (void __iomem *)base + VSC_SATA_UP_DATA_BUFFER_OFFSET);
 }
 
 

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

* libata TODO: ioread/iowrite work (was Re: [PATCH libata:upstream] remove compiler warnings)
  2005-08-22  9:11 [PATCH libata:upstream] remove compiler warnings Tejun Heo
@ 2005-08-22 19:50 ` Jeff Garzik
  2005-08-22 20:39   ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2005-08-22 19:50 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, Al Viro, Linux Kernel

Tejun Heo wrote:
>  Hello, Jeff.
> 
>  This patch removes compiler warnings which are caused by using
> ioports values (unsigned long) for the address argument of
> read/write[bwl]() functions without casting.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>

NAK...  These warnings exist as a reminder of the remaining 
ioread/iowrite() work that must occur.  Look at the 'iomap' and 
'iomap-step1' branches of libata-dev.git for incomplete examples of this 
work.

One must:

- create a data structure to store a bunch of I/O port values, as 
returned by pci_iomap() and ioport_map()
- update legacy PCI IDE (aka looks like ISA IDE) code path to use 
ioport_map() to obtain the I/O addresses we need
- update native mode PCI IDE (aka looks like PCI) code path to use 
pci_iomap()
- update all the other drivers that use ioremap() to use pci_iomap()
- change struct ata_ioports, s/unsigned long/void __iomem */
- fix up the last few bits in each driver, such as
	* eliminating the 'unsigned long base' variable in each
	  xxx_init_one() function
	* changing the xxx_setup_port() function to indicate
	  void __iomem * rather than unsigned long
- one last check for any last s/long/void iomem */ changes to be made
- install Linus's "sparse" source checker
- run 'make C=1' in the kernel tree, and make sure libata and drivers 
don't spew warnings


So... it's not as simple as just killing the warnings ;-)

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

* Re: libata TODO: ioread/iowrite work (was Re: [PATCH libata:upstream] remove compiler warnings)
  2005-08-22 19:50 ` libata TODO: ioread/iowrite work (was Re: [PATCH libata:upstream] remove compiler warnings) Jeff Garzik
@ 2005-08-22 20:39   ` Sam Ravnborg
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2005-08-22 20:39 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Tejun Heo, linux-ide, Al Viro, Linux Kernel

> - install Linus's "sparse" source checker
> - run 'make C=1' in the kernel tree, and make sure libata and drivers 
> don't spew warnings
make C=2 will check all files. Handy so you do not need to do a make
clean.
make C=2 drivers/scsi/libata.ko to limit it to libata.

	Sam

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

end of thread, other threads:[~2005-08-22 22:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-22  9:11 [PATCH libata:upstream] remove compiler warnings Tejun Heo
2005-08-22 19:50 ` libata TODO: ioread/iowrite work (was Re: [PATCH libata:upstream] remove compiler warnings) Jeff Garzik
2005-08-22 20:39   ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).