Skip to contentSkip to conversation

remove compiler warnings

PATCH In review Tejun Heo 3 participants 3 messages Aug 22, 2005

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

libata TODO: ioread/iowrite work (was Re: [PATCH libata:upstream] remove compiler warnings)

In reply to Tejun Heo
Quoted 7 lines · Tejun Heo

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.

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 ;-)

#2 lore raw

Re: libata TODO: ioread/iowrite work (was Re: [PATCH libata:upstream] remove compiler warnings)

Quoted 3 lines

- 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

Tejun Heo

author
#0 lore raw

PATCH 1/1 remove compiler warnings

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.

drivers/scsi/sata_svw.c +23 -18
@@ -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;
drivers/scsi/sata_vsc.c +26 -21

79 lines not on this page · raw message