[linux-dvb] 64-bit warnings when compiling v4l-dvb

Peter Beutner p.beutner at gmx.net
Sun Dec 11 23:06:13 CET 2005


Johannes Stezenbach schrieb:
> IMHO if dishnetwork_send_legacy_command() takes the ioctl parg argument it
> should be changed to take an unsigned long.
Patch attached.

> 
> 
> Johannes
> 
> 
-------------- next part --------------
Fix gcc warnings on x86_64
(warning: cast from pointer to integer of different size)

Signed-off-by: Peter Beutner <p.beutner at gmx.net>

Index: linux/drivers/media/dvb/dvb-core/dvb_frontend.c
===================================================================
--- linux/drivers/media/dvb/dvb-core/dvb_frontend.c.orig
+++ linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -104,7 +104,7 @@ struct dvb_frontend_private {
 	unsigned int exit;
 	unsigned int wakeup;
 	fe_status_t status;
-	unsigned int tune_mode_flags;
+	unsigned long tune_mode_flags;
 	unsigned int delay;
 
 	/* swzigzag values */
@@ -794,7 +794,7 @@ static int dvb_frontend_ioctl(struct ino
 
 	case FE_DISHNETWORK_SEND_LEGACY_CMD:
 		if (fe->ops->dishnetwork_send_legacy_command) {
-			err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned int) parg);
+			err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned long) parg);
 			fepriv->state = FESTATE_DISEQC;
 			fepriv->status = 0;
 		} else if (fe->ops->set_voltage) {
@@ -814,13 +814,13 @@ static int dvb_frontend_ioctl(struct ino
 			 * initialization, so parg is 8 bits and does not
 			 * include the initialization or start bit
 			 */
-			unsigned int cmd = ((unsigned int) parg) << 1;
+			unsigned long cmd = ((unsigned long) parg) << 1;
 			struct timeval nexttime;
 			struct timeval tv[10];
 			int i;
 			u8 last = 1;
 			if (dvb_frontend_debug)
-				printk("%s switch command: 0x%04x\n", __FUNCTION__, cmd);
+				printk("%s switch command: 0x%04lx\n", __FUNCTION__, cmd);
 			do_gettimeofday(&nexttime);
 			if (dvb_frontend_debug)
 				memcpy(&tv[0], &nexttime, sizeof(struct timeval));
@@ -861,7 +861,7 @@ static int dvb_frontend_ioctl(struct ino
 
 	case FE_ENABLE_HIGH_LNB_VOLTAGE:
 		if (fe->ops->enable_high_lnb_voltage)
-			err = fe->ops->enable_high_lnb_voltage(fe, (int) parg);
+			err = fe->ops->enable_high_lnb_voltage(fe, (long) parg);
 		break;
 
 	case FE_SET_FRONTEND: {
@@ -940,7 +940,7 @@ static int dvb_frontend_ioctl(struct ino
 		break;
 
 	case FE_SET_FRONTEND_TUNE_MODE:
-		fepriv->tune_mode_flags = (unsigned int) parg;
+		fepriv->tune_mode_flags = (unsigned long)parg;
 		break;
 	};
 
Index: linux/drivers/media/dvb/dvb-core/dvb_frontend.h
===================================================================
--- linux/drivers/media/dvb/dvb-core/dvb_frontend.h.orig
+++ linux/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -83,8 +83,8 @@ struct dvb_frontend_ops {
 	int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
 	int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
 	int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
-	int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, int arg);
-	int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd);
+	int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg);
+	int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
 	int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
 };
 
Index: linux/drivers/media/dvb/frontends/stv0299.c
===================================================================
--- linux/drivers/media/dvb/frontends/stv0299.c.orig
+++ linux/drivers/media/dvb/frontends/stv0299.c
@@ -394,7 +394,7 @@ static int stv0299_set_voltage (struct d
 	};
 }
 
-static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, u32 cmd)
+static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long cmd)
 {
 	struct stv0299_state* state = fe->demodulator_priv;
 	u8 reg0x08;
@@ -414,7 +414,7 @@ static int stv0299_send_legacy_dish_cmd 
 
 	cmd = cmd << 1;
 	if (debug_legacy_dish_switch)
-		printk ("%s switch command: 0x%04x\n",__FUNCTION__, cmd);
+		printk ("%s switch command: 0x%04lx\n",__FUNCTION__, cmd);
 
 	do_gettimeofday (&nexttime);
 	if (debug_legacy_dish_switch)
Index: linux/drivers/media/dvb/ttpci/av7110.c
===================================================================
--- linux/drivers/media/dvb/ttpci/av7110.c.orig
+++ linux/drivers/media/dvb/ttpci/av7110.c
@@ -2196,7 +2196,7 @@ static int av7110_fe_set_voltage(struct 
 	return ret;
 }
 
-static int av7110_fe_dishnetwork_send_legacy_command(struct dvb_frontend* fe, unsigned int cmd)
+static int av7110_fe_dishnetwork_send_legacy_command(struct dvb_frontend* fe, unsigned long cmd)
 {
 	struct av7110* av7110 = fe->dvb->priv;
 
Index: linux/drivers/media/dvb/ttpci/av7110.h
===================================================================
--- linux/drivers/media/dvb/ttpci/av7110.h.orig
+++ linux/drivers/media/dvb/ttpci/av7110.h
@@ -253,7 +253,7 @@ struct av7110 {
 	int (*fe_diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
 	int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
 	int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
-	int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd);
+	int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
 	int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
 };
 
Index: linux/drivers/media/dvb/ttpci/budget.c
===================================================================
--- linux/drivers/media/dvb/ttpci/budget.c.orig
+++ linux/drivers/media/dvb/ttpci/budget.c
@@ -212,7 +212,7 @@ static int lnbp21_set_voltage(struct dvb
 	return 0;
 }
 
-static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, int arg)
+static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, long arg)
 {
 	struct budget* budget = (struct budget*) fe->dvb->priv;
 	u8 buf;
Index: linux/drivers/media/dvb/dvb-core/dvb_net.c
===================================================================
--- linux/drivers/media/dvb/dvb-core/dvb_net.c.orig
+++ linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -1222,7 +1222,7 @@ static int dvb_net_add_if(struct dvb_net
 	return if_num;
 }
 
-static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned int num)
+static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned long num)
 {
 	struct net_device *net = dvbnet->device[num];
 	struct dvb_net_priv *priv;
@@ -1296,9 +1296,9 @@ static int dvb_net_do_ioctl(struct inode
 
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		if ((unsigned int) parg >= DVB_NET_DEVICES_MAX)
+		if ((unsigned long) parg >= DVB_NET_DEVICES_MAX)
 			return -EINVAL;
-		ret = dvb_net_remove_if(dvbnet, (unsigned int) parg);
+		ret = dvb_net_remove_if(dvbnet, (unsigned long) parg);
 		if (!ret)
 			module_put(dvbdev->adapter->module);
 		return ret;


More information about the linux-dvb mailing list