Commit a6127803 authored by Xi Wang's avatar Xi Wang Committed by Mauro Carvalho Chehab

[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: default avatarXi Wang <xi.wang@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 27d3e366
...@@ -387,7 +387,7 @@ static void send_tasklet(unsigned long arg) ...@@ -387,7 +387,7 @@ static void send_tasklet(unsigned long arg)
* Queues FM Channel-8 packet to FM TX queue and schedules FM TX tasklet for * Queues FM Channel-8 packet to FM TX queue and schedules FM TX tasklet for
* transmission * transmission
*/ */
static u32 fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, static int fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
int payload_len, struct completion *wait_completion) int payload_len, struct completion *wait_completion)
{ {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -456,13 +456,13 @@ static u32 fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, ...@@ -456,13 +456,13 @@ static u32 fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
} }
/* Sends FM Channel-8 command to the chip and waits for the response */ /* Sends FM Channel-8 command to the chip and waits for the response */
u32 fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
unsigned int payload_len, void *response, int *response_len) unsigned int payload_len, void *response, int *response_len)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct fm_event_msg_hdr *evt_hdr; struct fm_event_msg_hdr *evt_hdr;
unsigned long flags; unsigned long flags;
u32 ret; int ret;
init_completion(&fmdev->maintask_comp); init_completion(&fmdev->maintask_comp);
ret = fm_send_cmd(fmdev, fm_op, type, payload, payload_len, 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,8 +470,8 @@ u32 fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
if (ret) if (ret)
return ret; return ret;
ret = wait_for_completion_timeout(&fmdev->maintask_comp, FM_DRV_TX_TIMEOUT); if (!wait_for_completion_timeout(&fmdev->maintask_comp,
if (!ret) { FM_DRV_TX_TIMEOUT)) {
fmerr("Timeout(%d sec),didn't get reg" fmerr("Timeout(%d sec),didn't get reg"
"completion signal from RX tasklet\n", "completion signal from RX tasklet\n",
jiffies_to_msecs(FM_DRV_TX_TIMEOUT) / 1000); 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,7 +508,7 @@ u32 fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
} }
/* --- Helper functions used in FM interrupt handlers ---*/ /* --- Helper functions used in FM interrupt handlers ---*/
static inline u32 check_cmdresp_status(struct fmdev *fmdev, static inline int check_cmdresp_status(struct fmdev *fmdev,
struct sk_buff **skb) struct sk_buff **skb)
{ {
struct fm_event_msg_hdr *fm_evt_hdr; struct fm_event_msg_hdr *fm_evt_hdr;
...@@ -1058,7 +1058,7 @@ static void fm_irq_handle_intmsk_cmd_resp(struct fmdev *fmdev) ...@@ -1058,7 +1058,7 @@ static void fm_irq_handle_intmsk_cmd_resp(struct fmdev *fmdev)
} }
/* Returns availability of RDS data in internel buffer */ /* Returns availability of RDS data in internel buffer */
u32 fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file, int fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file,
struct poll_table_struct *pts) struct poll_table_struct *pts)
{ {
poll_wait(file, &fmdev->rx.rds.read_queue, pts); 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,7 +1069,7 @@ u32 fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file,
} }
/* Copies RDS data from internal buffer to user buffer */ /* Copies RDS data from internal buffer to user buffer */
u32 fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file, int fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file,
u8 __user *buf, size_t count) u8 __user *buf, size_t count)
{ {
u32 block_count; u32 block_count;
...@@ -1113,7 +1113,7 @@ u32 fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file, ...@@ -1113,7 +1113,7 @@ u32 fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file,
return ret; return ret;
} }
u32 fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set) int fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set)
{ {
switch (fmdev->curr_fmmode) { switch (fmdev->curr_fmmode) {
case FM_MODE_RX: case FM_MODE_RX:
...@@ -1127,7 +1127,7 @@ u32 fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set) ...@@ -1127,7 +1127,7 @@ u32 fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set)
} }
} }
u32 fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq) int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
{ {
if (fmdev->rx.freq == FM_UNDEFINED_FREQ) { if (fmdev->rx.freq == FM_UNDEFINED_FREQ) {
fmerr("RX frequency is not set\n"); fmerr("RX frequency is not set\n");
...@@ -1153,7 +1153,7 @@ u32 fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq) ...@@ -1153,7 +1153,7 @@ u32 fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
} }
u32 fmc_set_region(struct fmdev *fmdev, u8 region_to_set) int fmc_set_region(struct fmdev *fmdev, u8 region_to_set)
{ {
switch (fmdev->curr_fmmode) { switch (fmdev->curr_fmmode) {
case FM_MODE_RX: case FM_MODE_RX:
...@@ -1167,7 +1167,7 @@ u32 fmc_set_region(struct fmdev *fmdev, u8 region_to_set) ...@@ -1167,7 +1167,7 @@ u32 fmc_set_region(struct fmdev *fmdev, u8 region_to_set)
} }
} }
u32 fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset) int fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset)
{ {
switch (fmdev->curr_fmmode) { switch (fmdev->curr_fmmode) {
case FM_MODE_RX: case FM_MODE_RX:
...@@ -1181,7 +1181,7 @@ u32 fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset) ...@@ -1181,7 +1181,7 @@ u32 fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset)
} }
} }
u32 fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode) int fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode)
{ {
switch (fmdev->curr_fmmode) { switch (fmdev->curr_fmmode) {
case FM_MODE_RX: case FM_MODE_RX:
...@@ -1195,7 +1195,7 @@ u32 fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode) ...@@ -1195,7 +1195,7 @@ u32 fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode)
} }
} }
u32 fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis) int fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis)
{ {
switch (fmdev->curr_fmmode) { switch (fmdev->curr_fmmode) {
case FM_MODE_RX: case FM_MODE_RX:
...@@ -1210,10 +1210,10 @@ u32 fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis) ...@@ -1210,10 +1210,10 @@ u32 fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis)
} }
/* Sends power off command to the chip */ /* Sends power off command to the chip */
static u32 fm_power_down(struct fmdev *fmdev) static int fm_power_down(struct fmdev *fmdev)
{ {
u16 payload; u16 payload;
u32 ret; int ret;
if (!test_bit(FM_CORE_READY, &fmdev->flag)) { if (!test_bit(FM_CORE_READY, &fmdev->flag)) {
fmerr("FM core is not ready\n"); fmerr("FM core is not ready\n");
...@@ -1234,7 +1234,7 @@ static u32 fm_power_down(struct fmdev *fmdev) ...@@ -1234,7 +1234,7 @@ static u32 fm_power_down(struct fmdev *fmdev)
} }
/* Reads init command from FM firmware file and loads to the chip */ /* Reads init command from FM firmware file and loads to the chip */
static u32 fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name) static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name)
{ {
const struct firmware *fw_entry; const struct firmware *fw_entry;
struct bts_header *fw_header; struct bts_header *fw_header;
...@@ -1299,7 +1299,7 @@ static u32 fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name) ...@@ -1299,7 +1299,7 @@ static u32 fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name)
} }
/* Loads default RX configuration to the chip */ /* Loads default RX configuration to the chip */
static u32 load_default_rx_configuration(struct fmdev *fmdev) static int load_default_rx_configuration(struct fmdev *fmdev)
{ {
int ret; int ret;
...@@ -1311,7 +1311,7 @@ static u32 load_default_rx_configuration(struct fmdev *fmdev) ...@@ -1311,7 +1311,7 @@ static u32 load_default_rx_configuration(struct fmdev *fmdev)
} }
/* Does FM power on sequence */ /* Does FM power on sequence */
static u32 fm_power_up(struct fmdev *fmdev, u8 mode) static int fm_power_up(struct fmdev *fmdev, u8 mode)
{ {
u16 payload, asic_id, asic_ver; u16 payload, asic_id, asic_ver;
int resp_len, ret; int resp_len, ret;
...@@ -1374,7 +1374,7 @@ static u32 fm_power_up(struct fmdev *fmdev, u8 mode) ...@@ -1374,7 +1374,7 @@ static u32 fm_power_up(struct fmdev *fmdev, u8 mode)
} }
/* Set FM Modes(TX, RX, OFF) */ /* Set FM Modes(TX, RX, OFF) */
u32 fmc_set_mode(struct fmdev *fmdev, u8 fm_mode) int fmc_set_mode(struct fmdev *fmdev, u8 fm_mode)
{ {
int ret = 0; int ret = 0;
...@@ -1427,7 +1427,7 @@ u32 fmc_set_mode(struct fmdev *fmdev, u8 fm_mode) ...@@ -1427,7 +1427,7 @@ u32 fmc_set_mode(struct fmdev *fmdev, u8 fm_mode)
} }
/* Returns current FM mode (TX, RX, OFF) */ /* Returns current FM mode (TX, RX, OFF) */
u32 fmc_get_mode(struct fmdev *fmdev, u8 *fmmode) int fmc_get_mode(struct fmdev *fmdev, u8 *fmmode)
{ {
if (!test_bit(FM_CORE_READY, &fmdev->flag)) { if (!test_bit(FM_CORE_READY, &fmdev->flag)) {
fmerr("FM core is not ready\n"); fmerr("FM core is not ready\n");
...@@ -1483,10 +1483,10 @@ static void fm_st_reg_comp_cb(void *arg, char data) ...@@ -1483,10 +1483,10 @@ static void fm_st_reg_comp_cb(void *arg, char data)
* This function will be called from FM V4L2 open function. * This function will be called from FM V4L2 open function.
* Register with ST driver and initialize driver data. * Register with ST driver and initialize driver data.
*/ */
u32 fmc_prepare(struct fmdev *fmdev) int fmc_prepare(struct fmdev *fmdev)
{ {
static struct st_proto_s fm_st_proto; static struct st_proto_s fm_st_proto;
u32 ret; int ret;
if (test_bit(FM_CORE_READY, &fmdev->flag)) { if (test_bit(FM_CORE_READY, &fmdev->flag)) {
fmdbg("FM Core is already up\n"); fmdbg("FM Core is already up\n");
...@@ -1512,10 +1512,8 @@ u32 fmc_prepare(struct fmdev *fmdev) ...@@ -1512,10 +1512,8 @@ u32 fmc_prepare(struct fmdev *fmdev)
fmdev->streg_cbdata = -EINPROGRESS; fmdev->streg_cbdata = -EINPROGRESS;
fmdbg("%s waiting for ST reg completion signal\n", __func__); fmdbg("%s waiting for ST reg completion signal\n", __func__);
ret = wait_for_completion_timeout(&wait_for_fmdrv_reg_comp, if (!wait_for_completion_timeout(&wait_for_fmdrv_reg_comp,
FM_ST_REG_TIMEOUT); FM_ST_REG_TIMEOUT)) {
if (!ret) {
fmerr("Timeout(%d sec), didn't get reg " fmerr("Timeout(%d sec), didn't get reg "
"completion signal from ST\n", "completion signal from ST\n",
jiffies_to_msecs(FM_ST_REG_TIMEOUT) / 1000); jiffies_to_msecs(FM_ST_REG_TIMEOUT) / 1000);
...@@ -1589,10 +1587,10 @@ u32 fmc_prepare(struct fmdev *fmdev) ...@@ -1589,10 +1587,10 @@ u32 fmc_prepare(struct fmdev *fmdev)
* This function will be called from FM V4L2 release function. * This function will be called from FM V4L2 release function.
* Unregister from ST driver. * Unregister from ST driver.
*/ */
u32 fmc_release(struct fmdev *fmdev) int fmc_release(struct fmdev *fmdev)
{ {
static struct st_proto_s fm_st_proto; static struct st_proto_s fm_st_proto;
u32 ret; int ret;
if (!test_bit(FM_CORE_READY, &fmdev->flag)) { if (!test_bit(FM_CORE_READY, &fmdev->flag)) {
fmdbg("FM Core is already down\n"); fmdbg("FM Core is already down\n");
...@@ -1631,7 +1629,7 @@ u32 fmc_release(struct fmdev *fmdev) ...@@ -1631,7 +1629,7 @@ u32 fmc_release(struct fmdev *fmdev)
static int __init fm_drv_init(void) static int __init fm_drv_init(void)
{ {
struct fmdev *fmdev = NULL; struct fmdev *fmdev = NULL;
u32 ret = -ENOMEM; int ret = -ENOMEM;
fmdbg("FM driver version %s\n", FM_DRV_VERSION); fmdbg("FM driver version %s\n", FM_DRV_VERSION);
......
...@@ -368,27 +368,27 @@ struct fm_event_msg_hdr { ...@@ -368,27 +368,27 @@ struct fm_event_msg_hdr {
#define FM_TX_ANT_IMP_500 2 #define FM_TX_ANT_IMP_500 2
/* Functions exported by FM common sub-module */ /* Functions exported by FM common sub-module */
u32 fmc_prepare(struct fmdev *); int fmc_prepare(struct fmdev *);
u32 fmc_release(struct fmdev *); int fmc_release(struct fmdev *);
void fmc_update_region_info(struct fmdev *, u8); void fmc_update_region_info(struct fmdev *, u8);
u32 fmc_send_cmd(struct fmdev *, u8, u16, int fmc_send_cmd(struct fmdev *, u8, u16,
void *, unsigned int, void *, int *); void *, unsigned int, void *, int *);
u32 fmc_is_rds_data_available(struct fmdev *, struct file *, int fmc_is_rds_data_available(struct fmdev *, struct file *,
struct poll_table_struct *); struct poll_table_struct *);
u32 fmc_transfer_rds_from_internal_buff(struct fmdev *, struct file *, int fmc_transfer_rds_from_internal_buff(struct fmdev *, struct file *,
u8 __user *, size_t); u8 __user *, size_t);
u32 fmc_set_freq(struct fmdev *, u32); int fmc_set_freq(struct fmdev *, u32);
u32 fmc_set_mode(struct fmdev *, u8); int fmc_set_mode(struct fmdev *, u8);
u32 fmc_set_region(struct fmdev *, u8); int fmc_set_region(struct fmdev *, u8);
u32 fmc_set_mute_mode(struct fmdev *, u8); int fmc_set_mute_mode(struct fmdev *, u8);
u32 fmc_set_stereo_mono(struct fmdev *, u16); int fmc_set_stereo_mono(struct fmdev *, u16);
u32 fmc_set_rds_mode(struct fmdev *, u8); int fmc_set_rds_mode(struct fmdev *, u8);
u32 fmc_get_freq(struct fmdev *, u32 *); int fmc_get_freq(struct fmdev *, u32 *);
u32 fmc_get_region(struct fmdev *, u8 *); int fmc_get_region(struct fmdev *, u8 *);
u32 fmc_get_mode(struct fmdev *, u8 *); int fmc_get_mode(struct fmdev *, u8 *);
/* /*
* channel spacing * channel spacing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment