summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2011-08-25 15:22:36 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2011-08-27 00:58:22 +0200
commitd4a093cc729c4079157c448a6cd36c7c9781e302 (patch)
tree93af7f015c9643db31651069515dbd849d40eb54 /linux
parent8d48716a8ef62f88a8bf9411e3db804746293953 (diff)
Match signedness of char pointer comparisons and assignments
* linux/dev/drivers/block/genhd.c (msdos_partition): Cast `data' assignment to `unsigned char *'. * linux/src/drivers/block/ide-cd.c (cdrom_queue_request_sense): Cast `buffer' assignment to `unsigned char *'. (cdrom_transfer_packet_command): Change `cmd_buf' argument type to `unsigned char *'. (cdrom_read_capacity): Cast `pc.buffer' assignments to `unsigned char *'. Use temporary `model' and `fw_rev' `const char *' variables to compare against literal strings and characters. * linux/src/drivers/block/ide.c (execute_drive_cmd): Cast `args' assignment to `byte *'. (ide_open): Cast `rq.buffer' assignment to `char *'. (ide_release): Likewise. (ide_ioctl): Likewise. (do_identify): Cast variables being compared against literal string to `char *'. (probe_for_drive): Likewise. * linux/src/drivers/block/ide.h (struct packet_command): Change `buffer' type to `unsigned char *'.
Diffstat (limited to 'linux')
-rw-r--r--linux/dev/drivers/block/genhd.c2
-rw-r--r--linux/src/drivers/block/ide-cd.c47
-rw-r--r--linux/src/drivers/block/ide.c23
-rw-r--r--linux/src/drivers/block/ide.h2
4 files changed, 40 insertions, 34 deletions
diff --git a/linux/dev/drivers/block/genhd.c b/linux/dev/drivers/block/genhd.c
index 3946b39c..68a27d51 100644
--- a/linux/dev/drivers/block/genhd.c
+++ b/linux/dev/drivers/block/genhd.c
@@ -289,7 +289,7 @@ read_mbr:
printk(" unable to read partition table\n");
return -1;
}
- data = bh->b_data;
+ data = (unsigned char *)bh->b_data;
/* In some cases we modify the geometry */
/* of the drive (below), so ensure that */
/* nobody else tries to re-use this data. */
diff --git a/linux/src/drivers/block/ide-cd.c b/linux/src/drivers/block/ide-cd.c
index 17f60b94..56656cba 100644
--- a/linux/src/drivers/block/ide-cd.c
+++ b/linux/src/drivers/block/ide-cd.c
@@ -626,7 +626,7 @@ static void cdrom_queue_request_sense (ide_drive_t *drive,
pc->c[0] = REQUEST_SENSE;
pc->c[4] = len;
- pc->buffer = (char *)reqbuf;
+ pc->buffer = (unsigned char *)reqbuf;
pc->buflen = len;
pc->sense_data = (struct atapi_request_sense *)failed_command;
@@ -844,7 +844,7 @@ static int cdrom_start_packet_command (ide_drive_t *drive, int xferlen,
HANDLER is the interrupt handler to call when the command completes
or there's data ready. */
static int cdrom_transfer_packet_command (ide_drive_t *drive,
- char *cmd_buf, int cmd_len,
+ unsigned char *cmd_buf, int cmd_len,
ide_handler_t *handler)
{
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
@@ -1660,7 +1660,7 @@ cdrom_read_capacity (ide_drive_t *drive, unsigned *capacity,
pc.sense_data = reqbuf;
pc.c[0] = READ_CAPACITY;
- pc.buffer = (char *)&capbuf;
+ pc.buffer = (unsigned char *)&capbuf;
pc.buflen = sizeof (capbuf);
stat = cdrom_queue_packet_command (drive, &pc);
@@ -1681,7 +1681,7 @@ cdrom_read_tocentry (ide_drive_t *drive, int trackno, int msf_flag,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = buflen;
pc.c[0] = SCMD_READ_TOC;
pc.c[6] = trackno;
@@ -1813,7 +1813,7 @@ cdrom_read_subchannel (ide_drive_t *drive, int format,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *) buf;
pc.buflen = buflen;
pc.c[0] = SCMD_READ_SUBCHANNEL;
pc.c[1] = 2; /* MSF addressing */
@@ -1836,7 +1836,7 @@ cdrom_mode_sense (ide_drive_t *drive, int pageno, int modeflag,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = buflen;
pc.c[0] = MODE_SENSE_10;
pc.c[2] = pageno | (modeflag << 6);
@@ -1855,7 +1855,7 @@ cdrom_mode_select (ide_drive_t *drive, int pageno, char *buf, int buflen,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = - buflen;
pc.c[0] = MODE_SELECT_10;
pc.c[1] = 0x10;
@@ -1971,7 +1971,7 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba, int nblocks,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = buflen;
#if ! STANDARD_ATAPI
@@ -2698,9 +2698,12 @@ void ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 0;
if (drive->id != NULL) {
- if (strcmp (drive->id->model, "V003S0DS") == 0 &&
- drive->id->fw_rev[4] == '1' &&
- drive->id->fw_rev[6] <= '2') {
+ const char *model = (const char *)drive->id->model;
+ const char *fw_rev = (const char *)drive->id->fw_rev;
+
+ if (strcmp (model, "V003S0DS") == 0 &&
+ fw_rev[4] == '1' &&
+ fw_rev[6] <= '2') {
/* Vertos 300.
Some versions of this drive like to talk BCD. */
CDROM_CONFIG_FLAGS (drive)->toctracks_as_bcd = 1;
@@ -2709,27 +2712,27 @@ void ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1;
}
- else if (strcmp (drive->id->model, "V006E0DS") == 0 &&
- drive->id->fw_rev[4] == '1' &&
- drive->id->fw_rev[6] <= '2') {
+ else if (strcmp (model, "V006E0DS") == 0 &&
+ fw_rev[4] == '1' &&
+ fw_rev[6] <= '2') {
/* Vertos 600 ESD. */
CDROM_CONFIG_FLAGS (drive)->toctracks_as_bcd = 1;
}
- else if (strcmp (drive->id->model, "GCD-R580B") == 0)
+ else if (strcmp (model, "GCD-R580B") == 0)
drive->cdrom_info.max_sectors = 124;
- else if (strcmp (drive->id->model,
+ else if (strcmp (model,
"NEC CD-ROM DRIVE:260") == 0 &&
- strcmp (drive->id->fw_rev, "1.01") == 0) {
+ strcmp (fw_rev, "1.01") == 0) {
/* Old NEC260 (not R). */
CDROM_CONFIG_FLAGS (drive)->tocaddr_as_bcd = 1;
CDROM_CONFIG_FLAGS (drive)->playmsf_as_bcd = 1;
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1;
}
- else if (strcmp (drive->id->model, "WEARNES CDD-120") == 0 &&
- strcmp (drive->id->fw_rev, "A1.1") == 0) {
+ else if (strcmp (model, "WEARNES CDD-120") == 0 &&
+ strcmp (fw_rev, "A1.1") == 0) {
/* Wearnes */
CDROM_CONFIG_FLAGS (drive)->playmsf_as_bcd = 1;
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1;
@@ -2737,9 +2740,9 @@ void ide_cdrom_setup (ide_drive_t *drive)
/* Sanyo 3 CD changer uses a non-standard command
for CD changing */
- else if ((strcmp(drive->id->model, "CD-ROM CDR-C3 G") == 0) ||
- (strcmp(drive->id->model, "CD-ROM CDR-C3G") == 0) ||
- (strcmp(drive->id->model, "CD-ROM CDR_C36") == 0)) {
+ else if ((strcmp(model, "CD-ROM CDR-C3 G") == 0) ||
+ (strcmp(model, "CD-ROM CDR-C3G") == 0) ||
+ (strcmp(model, "CD-ROM CDR_C36") == 0)) {
/* uses CD in slot 0 when value is set to 3 */
CDROM_STATE_FLAGS (drive)->sanyo_slot = 3;
}
diff --git a/linux/src/drivers/block/ide.c b/linux/src/drivers/block/ide.c
index 18f2e763..d9e3fbaf 100644
--- a/linux/src/drivers/block/ide.c
+++ b/linux/src/drivers/block/ide.c
@@ -1525,7 +1525,7 @@ static inline void do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned
*/
static void execute_drive_cmd (ide_drive_t *drive, struct request *rq)
{
- byte *args = rq->buffer;
+ byte *args = (byte *)rq->buffer;
if (args) {
#ifdef DEBUG
printk("%s: DRIVE_CMD cmd=0x%02x sc=0x%02x fr=0x%02x xx=0x%02x\n",
@@ -2020,7 +2020,7 @@ static int ide_open(struct inode * inode, struct file * filp)
struct request rq;
check_disk_change(inode->i_rdev);
ide_init_drive_cmd (&rq);
- rq.buffer = door_lock;
+ rq.buffer = (char *)door_lock;
/*
* Ignore the return code from door_lock,
* since the open() has already succeeded,
@@ -2071,7 +2071,7 @@ static void ide_release(struct inode * inode, struct file * file)
struct request rq;
invalidate_buffers(inode->i_rdev);
ide_init_drive_cmd (&rq);
- rq.buffer = door_unlock;
+ rq.buffer = (char *)door_unlock;
(void) ide_do_drive_cmd(drive, &rq, ide_wait);
}
}
@@ -2321,7 +2321,7 @@ static int ide_ioctl (struct inode *inode, struct file *file,
argbuf[3] = args[3];
}
if (!(err = verify_area(VERIFY_WRITE,(void *)arg, argsize))) {
- rq.buffer = argbuf;
+ rq.buffer = (char *)argbuf;
err = ide_do_drive_cmd(drive, &rq, ide_wait);
memcpy_tofs((void *)arg, argbuf, argsize);
}
@@ -2455,7 +2455,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
ide_fixstring (id->fw_rev, sizeof(id->fw_rev), bswap);
ide_fixstring (id->serial_no, sizeof(id->serial_no), bswap);
- if (strstr(id->model, "E X A B Y T E N E S T"))
+ if (strstr((char *)id->model, "E X A B Y T E N E S T"))
return;
#ifdef CONFIG_BLK_DEV_IDEATAPI
@@ -2474,9 +2474,12 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
#endif /* CONFIG_BLK_DEV_PROMISE */
if (!drive->ide_scsi) switch (type) {
case 0:
- if (!strstr(id->model, "oppy") && !strstr(id->model, "poyp") && !strstr(id->model, "ZIP"))
+ if (!strstr((char *)id->model, "oppy") &&
+ !strstr((char *)id->model, "poyp") &&
+ !strstr((char *)id->model, "ZIP"))
printk("cdrom or floppy?, assuming ");
- if (drive->media != ide_cdrom && !strstr(id->model, "CD-ROM")) {
+ if (drive->media != ide_cdrom &&
+ !strstr((char *)id->model, "CD-ROM")) {
#ifdef CONFIG_BLK_DEV_IDEFLOPPY
printk("FLOPPY drive\n");
drive->media = ide_floppy;
@@ -2616,8 +2619,8 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
drive->bios_cyl = capacity/cylsize;
}
- if (!strncmp(id->model, "BMI ", 4) &&
- strstr(id->model, " ENHANCED IDE ") &&
+ if (!strncmp((char *)id->model, "BMI ", 4) &&
+ strstr((char *)id->model, " ENHANCED IDE ") &&
drive->select.b.lba)
drive->no_geom = 1;
@@ -2856,7 +2859,7 @@ static inline byte probe_for_drive (ide_drive_t *drive)
(void) do_probe(drive, WIN_PIDENTIFY); /* look for ATAPI device */
#endif /* CONFIG_BLK_DEV_IDEATAPI */
}
- if (drive->id && strstr(drive->id->model, "E X A B Y T E N E S T"))
+ if (drive->id && strstr((char *)drive->id->model, "E X A B Y T E N E S T"))
enable_nest(drive);
if (!drive->present)
return 0; /* drive not found */
diff --git a/linux/src/drivers/block/ide.h b/linux/src/drivers/block/ide.h
index 44331607..9b8904e0 100644
--- a/linux/src/drivers/block/ide.h
+++ b/linux/src/drivers/block/ide.h
@@ -198,7 +198,7 @@ struct atapi_request_sense {
};
struct packet_command {
- char *buffer;
+ unsigned char *buffer;
int buflen;
int stat;
struct atapi_request_sense *sense_data;