diff options
author | Xi Wang <xi.wang@gmail.com> | 2011-12-02 04:01:11 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-30 14:00:56 -0500 |
commit | a61278037b57b1d75467dcfeb255584d5f11743d (patch) | |
tree | d07d4924dda3b4de16e5e6a1abbd5a2d79cca33d /drivers/media/radio | |
parent | 27d3e366091b13c26d5d996709fd9d99858455eb (diff) |
[media] wl128x: fmdrv_common: fix signedness bugs
Message-Id: <1322820073-19347-2-git-send-email-xi.wang@gmail.com>
The error handling with (ret < 0) didn't work where ret is a u32.
Use int instead. To be consistent we also change the functions to
return an int.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/wl128x/fmdrv_common.c | 58 | ||||
-rw-r--r-- | drivers/media/radio/wl128x/fmdrv_common.h | 28 |
2 files changed, 42 insertions, 44 deletions
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index 5991ab60303d..bf867a6b5ea0 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c | |||
@@ -387,7 +387,7 @@ static void send_tasklet(unsigned long arg) | |||
387 | * Queues FM Channel-8 packet to FM TX queue and schedules FM TX tasklet for | 387 | * Queues FM Channel-8 packet to FM TX queue and schedules FM TX tasklet for |
388 | * transmission | 388 | * transmission |
389 | */ | 389 | */ |
390 | static u32 fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, | 390 | static int fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, |
391 | int payload_len, struct completion *wait_completion) | 391 | int payload_len, struct completion *wait_completion) |
392 | { | 392 | { |
393 | struct sk_buff *skb; | 393 | struct sk_buff *skb; |
@@ -456,13 +456,13 @@ static u32 fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, | |||
456 | } | 456 | } |
457 | 457 | ||
458 | /* Sends FM Channel-8 command to the chip and waits for the response */ | 458 | /* Sends FM Channel-8 command to the chip and waits for the response */ |
459 | u32 fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, | 459 | int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, |
460 | unsigned int payload_len, void *response, int *response_len) | 460 | unsigned int payload_len, void *response, int *response_len) |
461 | { | 461 | { |
462 | struct sk_buff *skb; | 462 | struct sk_buff *skb; |
463 | struct fm_event_msg_hdr *evt_hdr; | 463 | struct fm_event_msg_hdr *evt_hdr; |
464 | unsigned long flags; | 464 | unsigned long flags; |
465 | u32 ret; | 465 | int ret; |
466 | 466 | ||
467 | init_completion(&fmdev->maintask_comp); | 467 | init_completion(&fmdev->maintask_comp); |
468 | ret = fm_send_cmd(fmdev, fm_op, type, payload, payload_len, | 468 | ret = fm_send_cmd(fmdev, fm_op, type, payload, payload_len, |
@@ -470,8 +470,8 @@ u32 fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, | |||
470 | if (ret) | 470 | if (ret) |
471 | return ret; | 471 | return ret; |
472 | 472 | ||
473 | ret = wait_for_completion_timeout(&fmdev->maintask_comp, FM_DRV_TX_TIMEOUT); | 473 | if (!wait_for_completion_timeout(&fmdev->maintask_comp, |
474 | if (!ret) { | 474 | FM_DRV_TX_TIMEOUT)) { |
475 | fmerr("Timeout(%d sec),didn't get reg" | 475 | fmerr("Timeout(%d sec),didn't get reg" |
476 | "completion signal from RX tasklet\n", | 476 | "completion signal from RX tasklet\n", |
477 | jiffies_to_msecs(FM_DRV_TX_TIMEOUT) / 1000); | 477 | jiffies_to_msecs(FM_DRV_TX_TIMEOUT) / 1000); |
@@ -508,7 +508,7 @@ u32 fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, | |||
508 | } | 508 | } |
509 | 509 | ||
510 | /* --- Helper functions used in FM interrupt handlers ---*/ | 510 | /* --- Helper functions used in FM interrupt handlers ---*/ |
511 | static inline u32 check_cmdresp_status(struct fmdev *fmdev, | 511 | static inline int check_cmdresp_status(struct fmdev *fmdev, |
512 | struct sk_buff **skb) | 512 | struct sk_buff **skb) |
513 | { | 513 | { |
514 | struct fm_event_msg_hdr *fm_evt_hdr; | 514 | struct fm_event_msg_hdr *fm_evt_hdr; |
@@ -1058,7 +1058,7 @@ static void fm_irq_handle_intmsk_cmd_resp(struct fmdev *fmdev) | |||
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | /* Returns availability of RDS data in internel buffer */ | 1060 | /* Returns availability of RDS data in internel buffer */ |
1061 | u32 fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file, | 1061 | int fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file, |
1062 | struct poll_table_struct *pts) | 1062 | struct poll_table_struct *pts) |
1063 | { | 1063 | { |
1064 | poll_wait(file, &fmdev->rx.rds.read_queue, pts); | 1064 | poll_wait(file, &fmdev->rx.rds.read_queue, pts); |
@@ -1069,7 +1069,7 @@ u32 fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file, | |||
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | /* Copies RDS data from internal buffer to user buffer */ | 1071 | /* Copies RDS data from internal buffer to user buffer */ |
1072 | u32 fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file, | 1072 | int fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file, |
1073 | u8 __user *buf, size_t count) | 1073 | u8 __user *buf, size_t count) |
1074 | { | 1074 | { |
1075 | u32 block_count; | 1075 | u32 block_count; |
@@ -1113,7 +1113,7 @@ u32 fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file, | |||
1113 | return ret; | 1113 | return ret; |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | u32 fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set) | 1116 | int fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set) |
1117 | { | 1117 | { |
1118 | switch (fmdev->curr_fmmode) { | 1118 | switch (fmdev->curr_fmmode) { |
1119 | case FM_MODE_RX: | 1119 | case FM_MODE_RX: |
@@ -1127,7 +1127,7 @@ u32 fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set) | |||
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | u32 fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq) | 1130 | int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq) |
1131 | { | 1131 | { |
1132 | if (fmdev->rx.freq == FM_UNDEFINED_FREQ) { | 1132 | if (fmdev->rx.freq == FM_UNDEFINED_FREQ) { |
1133 | fmerr("RX frequency is not set\n"); | 1133 | fmerr("RX frequency is not set\n"); |
@@ -1153,7 +1153,7 @@ u32 fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq) | |||
1153 | 1153 | ||
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | u32 fmc_set_region(struct fmdev *fmdev, u8 region_to_set) | 1156 | int fmc_set_region(struct fmdev *fmdev, u8 region_to_set) |
1157 | { | 1157 | { |
1158 | switch (fmdev->curr_fmmode) { | 1158 | switch (fmdev->curr_fmmode) { |
1159 | case FM_MODE_RX: | 1159 | case FM_MODE_RX: |
@@ -1167,7 +1167,7 @@ u32 fmc_set_region(struct fmdev *fmdev, u8 region_to_set) | |||
1167 | } | 1167 | } |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | u32 fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset) | 1170 | int fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset) |
1171 | { | 1171 | { |
1172 | switch (fmdev->curr_fmmode) { | 1172 | switch (fmdev->curr_fmmode) { |
1173 | case FM_MODE_RX: | 1173 | case FM_MODE_RX: |
@@ -1181,7 +1181,7 @@ u32 fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset) | |||
1181 | } | 1181 | } |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | u32 fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode) | 1184 | int fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode) |
1185 | { | 1185 | { |
1186 | switch (fmdev->curr_fmmode) { | 1186 | switch (fmdev->curr_fmmode) { |
1187 | case FM_MODE_RX: | 1187 | case FM_MODE_RX: |
@@ -1195,7 +1195,7 @@ u32 fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode) | |||
1195 | } | 1195 | } |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | u32 fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis) | 1198 | int fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis) |
1199 | { | 1199 | { |
1200 | switch (fmdev->curr_fmmode) { | 1200 | switch (fmdev->curr_fmmode) { |
1201 | case FM_MODE_RX: | 1201 | case FM_MODE_RX: |
@@ -1210,10 +1210,10 @@ u32 fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis) | |||
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | /* Sends power off command to the chip */ | 1212 | /* Sends power off command to the chip */ |
1213 | static u32 fm_power_down(struct fmdev *fmdev) | 1213 | static int fm_power_down(struct fmdev *fmdev) |
1214 | { | 1214 | { |
1215 | u16 payload; | 1215 | u16 payload; |
1216 | u32 ret; | 1216 | int ret; |
1217 | 1217 | ||
1218 | if (!test_bit(FM_CORE_READY, &fmdev->flag)) { | 1218 | if (!test_bit(FM_CORE_READY, &fmdev->flag)) { |
1219 | fmerr("FM core is not ready\n"); | 1219 | fmerr("FM core is not ready\n"); |
@@ -1234,7 +1234,7 @@ static u32 fm_power_down(struct fmdev *fmdev) | |||
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | /* Reads init command from FM firmware file and loads to the chip */ | 1236 | /* Reads init command from FM firmware file and loads to the chip */ |
1237 | static u32 fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name) | 1237 | static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name) |
1238 | { | 1238 | { |
1239 | const struct firmware *fw_entry; | 1239 | const struct firmware *fw_entry; |
1240 | struct bts_header *fw_header; | 1240 | struct bts_header *fw_header; |
@@ -1299,7 +1299,7 @@ rel_fw: | |||
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | /* Loads default RX configuration to the chip */ | 1301 | /* Loads default RX configuration to the chip */ |
1302 | static u32 load_default_rx_configuration(struct fmdev *fmdev) | 1302 | static int load_default_rx_configuration(struct fmdev *fmdev) |
1303 | { | 1303 | { |
1304 | int ret; | 1304 | int ret; |
1305 | 1305 | ||
@@ -1311,7 +1311,7 @@ static u32 load_default_rx_configuration(struct fmdev *fmdev) | |||
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | /* Does FM power on sequence */ | 1313 | /* Does FM power on sequence */ |
1314 | static u32 fm_power_up(struct fmdev *fmdev, u8 mode) | 1314 | static int fm_power_up(struct fmdev *fmdev, u8 mode) |
1315 | { | 1315 | { |
1316 | u16 payload, asic_id, asic_ver; | 1316 | u16 payload, asic_id, asic_ver; |
1317 | int resp_len, ret; | 1317 | int resp_len, ret; |
@@ -1374,7 +1374,7 @@ rel: | |||
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | /* Set FM Modes(TX, RX, OFF) */ | 1376 | /* Set FM Modes(TX, RX, OFF) */ |
1377 | u32 fmc_set_mode(struct fmdev *fmdev, u8 fm_mode) | 1377 | int fmc_set_mode(struct fmdev *fmdev, u8 fm_mode) |
1378 | { | 1378 | { |
1379 | int ret = 0; | 1379 | int ret = 0; |
1380 | 1380 | ||
@@ -1427,7 +1427,7 @@ u32 fmc_set_mode(struct fmdev *fmdev, u8 fm_mode) | |||
1427 | } | 1427 | } |
1428 | 1428 | ||
1429 | /* Returns current FM mode (TX, RX, OFF) */ | 1429 | /* Returns current FM mode (TX, RX, OFF) */ |
1430 | u32 fmc_get_mode(struct fmdev *fmdev, u8 *fmmode) | 1430 | int fmc_get_mode(struct fmdev *fmdev, u8 *fmmode) |
1431 | { | 1431 | { |
1432 | if (!test_bit(FM_CORE_READY, &fmdev->flag)) { | 1432 | if (!test_bit(FM_CORE_READY, &fmdev->flag)) { |
1433 | fmerr("FM core is not ready\n"); | 1433 | fmerr("FM core is not ready\n"); |
@@ -1483,10 +1483,10 @@ static void fm_st_reg_comp_cb(void *arg, char data) | |||
1483 | * This function will be called from FM V4L2 open function. | 1483 | * This function will be called from FM V4L2 open function. |
1484 | * Register with ST driver and initialize driver data. | 1484 | * Register with ST driver and initialize driver data. |
1485 | */ | 1485 | */ |
1486 | u32 fmc_prepare(struct fmdev *fmdev) | 1486 | int fmc_prepare(struct fmdev *fmdev) |
1487 | { | 1487 | { |
1488 | static struct st_proto_s fm_st_proto; | 1488 | static struct st_proto_s fm_st_proto; |
1489 | u32 ret; | 1489 | int ret; |
1490 | 1490 | ||
1491 | if (test_bit(FM_CORE_READY, &fmdev->flag)) { | 1491 | if (test_bit(FM_CORE_READY, &fmdev->flag)) { |
1492 | fmdbg("FM Core is already up\n"); | 1492 | fmdbg("FM Core is already up\n"); |
@@ -1512,10 +1512,8 @@ u32 fmc_prepare(struct fmdev *fmdev) | |||
1512 | fmdev->streg_cbdata = -EINPROGRESS; | 1512 | fmdev->streg_cbdata = -EINPROGRESS; |
1513 | fmdbg("%s waiting for ST reg completion signal\n", __func__); | 1513 | fmdbg("%s waiting for ST reg completion signal\n", __func__); |
1514 | 1514 | ||
1515 | ret = wait_for_completion_timeout(&wait_for_fmdrv_reg_comp, | 1515 | if (!wait_for_completion_timeout(&wait_for_fmdrv_reg_comp, |
1516 | FM_ST_REG_TIMEOUT); | 1516 | FM_ST_REG_TIMEOUT)) { |
1517 | |||
1518 | if (!ret) { | ||
1519 | fmerr("Timeout(%d sec), didn't get reg " | 1517 | fmerr("Timeout(%d sec), didn't get reg " |
1520 | "completion signal from ST\n", | 1518 | "completion signal from ST\n", |
1521 | jiffies_to_msecs(FM_ST_REG_TIMEOUT) / 1000); | 1519 | jiffies_to_msecs(FM_ST_REG_TIMEOUT) / 1000); |
@@ -1589,10 +1587,10 @@ u32 fmc_prepare(struct fmdev *fmdev) | |||
1589 | * This function will be called from FM V4L2 release function. | 1587 | * This function will be called from FM V4L2 release function. |
1590 | * Unregister from ST driver. | 1588 | * Unregister from ST driver. |
1591 | */ | 1589 | */ |
1592 | u32 fmc_release(struct fmdev *fmdev) | 1590 | int fmc_release(struct fmdev *fmdev) |
1593 | { | 1591 | { |
1594 | static struct st_proto_s fm_st_proto; | 1592 | static struct st_proto_s fm_st_proto; |
1595 | u32 ret; | 1593 | int ret; |
1596 | 1594 | ||
1597 | if (!test_bit(FM_CORE_READY, &fmdev->flag)) { | 1595 | if (!test_bit(FM_CORE_READY, &fmdev->flag)) { |
1598 | fmdbg("FM Core is already down\n"); | 1596 | fmdbg("FM Core is already down\n"); |
@@ -1631,7 +1629,7 @@ u32 fmc_release(struct fmdev *fmdev) | |||
1631 | static int __init fm_drv_init(void) | 1629 | static int __init fm_drv_init(void) |
1632 | { | 1630 | { |
1633 | struct fmdev *fmdev = NULL; | 1631 | struct fmdev *fmdev = NULL; |
1634 | u32 ret = -ENOMEM; | 1632 | int ret = -ENOMEM; |
1635 | 1633 | ||
1636 | fmdbg("FM driver version %s\n", FM_DRV_VERSION); | 1634 | fmdbg("FM driver version %s\n", FM_DRV_VERSION); |
1637 | 1635 | ||
diff --git a/drivers/media/radio/wl128x/fmdrv_common.h b/drivers/media/radio/wl128x/fmdrv_common.h index aee243bb6630..d9b9c6cf83b4 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.h +++ b/drivers/media/radio/wl128x/fmdrv_common.h | |||
@@ -368,27 +368,27 @@ struct fm_event_msg_hdr { | |||
368 | #define FM_TX_ANT_IMP_500 2 | 368 | #define FM_TX_ANT_IMP_500 2 |
369 | 369 | ||
370 | /* Functions exported by FM common sub-module */ | 370 | /* Functions exported by FM common sub-module */ |
371 | u32 fmc_prepare(struct fmdev *); | 371 | int fmc_prepare(struct fmdev *); |
372 | u32 fmc_release(struct fmdev *); | 372 | int fmc_release(struct fmdev *); |
373 | 373 | ||
374 | void fmc_update_region_info(struct fmdev *, u8); | 374 | void fmc_update_region_info(struct fmdev *, u8); |
375 | u32 fmc_send_cmd(struct fmdev *, u8, u16, | 375 | int fmc_send_cmd(struct fmdev *, u8, u16, |
376 | void *, unsigned int, void *, int *); | 376 | void *, unsigned int, void *, int *); |
377 | u32 fmc_is_rds_data_available(struct fmdev *, struct file *, | 377 | int fmc_is_rds_data_available(struct fmdev *, struct file *, |
378 | struct poll_table_struct *); | 378 | struct poll_table_struct *); |
379 | u32 fmc_transfer_rds_from_internal_buff(struct fmdev *, struct file *, | 379 | int fmc_transfer_rds_from_internal_buff(struct fmdev *, struct file *, |
380 | u8 __user *, size_t); | 380 | u8 __user *, size_t); |
381 | 381 | ||
382 | u32 fmc_set_freq(struct fmdev *, u32); | 382 | int fmc_set_freq(struct fmdev *, u32); |
383 | u32 fmc_set_mode(struct fmdev *, u8); | 383 | int fmc_set_mode(struct fmdev *, u8); |
384 | u32 fmc_set_region(struct fmdev *, u8); | 384 | int fmc_set_region(struct fmdev *, u8); |
385 | u32 fmc_set_mute_mode(struct fmdev *, u8); | 385 | int fmc_set_mute_mode(struct fmdev *, u8); |
386 | u32 fmc_set_stereo_mono(struct fmdev *, u16); | 386 | int fmc_set_stereo_mono(struct fmdev *, u16); |
387 | u32 fmc_set_rds_mode(struct fmdev *, u8); | 387 | int fmc_set_rds_mode(struct fmdev *, u8); |
388 | 388 | ||
389 | u32 fmc_get_freq(struct fmdev *, u32 *); | 389 | int fmc_get_freq(struct fmdev *, u32 *); |
390 | u32 fmc_get_region(struct fmdev *, u8 *); | 390 | int fmc_get_region(struct fmdev *, u8 *); |
391 | u32 fmc_get_mode(struct fmdev *, u8 *); | 391 | int fmc_get_mode(struct fmdev *, u8 *); |
392 | 392 | ||
393 | /* | 393 | /* |
394 | * channel spacing | 394 | * channel spacing |