si470x: cleanup define namespace
Subsystems (7)
PATCH 1/7 si470x: cleanup define namespace
Some architectures already use CHIPID defines:
drivers/media/radio/si470x/radio-si470x.h:57:0: warning: "CHIPID" redefined [enabled by default] drivers/media/radio/si470x/radio-si470x.h:57:0: warning: "CHIPID" redefined [enabled by default] drivers/media/radio/si470x/radio-si470x.h:57:0: warning: "CHIPID" redefined [enabled by default]
So, use SI_foo namespace to avoid conflicts.
drivers/media/radio/si470x/radio-si470x-i2c.c +3 -3
@@ -384,14 +384,14 @@ static int si470x_i2c_probe(struct i2c_client *client, goto err_radio; }dev_info (&client->dev,"DeviceID=0x%4.4hx ChipID=0x%4.4hx\n" , - radio->registers[DEVICEID ], radio->registers[CHIPID ]); -if ((radio->registers[CHIPID ] &CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) { + radio->registers[DEVICEID ], radio->registers[SI_CHIPID ]); +if ((radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) {dev_warn (&client->dev,"This driver is known to work with " "firmware version %hu,\n" ,RADIO_FW_VERSION );dev_warn (&client->dev,"but the device has firmware version %hu.\n" , - radio->registers[CHIPID ] &CHIPID_FIRMWARE ); + radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ); version_warning =1 ; }
drivers/media/radio/si470x/radio-si470x-usb.c +3 -3
@@ -686,14 +686,14 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, goto err_ctrl; }dev_info (&intf->dev,"DeviceID=0x%4.4hx ChipID=0x%4.4hx\n" , - radio->registers[DEVICEID ], radio->registers[CHIPID ]); -if ((radio->registers[CHIPID ] &CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) { + radio->registers[DEVICEID ], radio->registers[SI_CHIPID ]); +if ((radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) {dev_warn (&intf->dev,"This driver is known to work with " "firmware version %hu,\n" ,RADIO_FW_VERSION );dev_warn (&intf->dev,"but the device has firmware version %hu.\n" , - radio->registers[CHIPID ] &CHIPID_FIRMWARE ); + radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ); version_warning =1 ; }
drivers/media/radio/si470x/radio-si470x.h +4 -4
@@ -54,10 +54,10 @@#define DEVICEID_PN 0xf000/* bits 15..12: Part Number */ #define DEVICEID_MFGID 0x0fff/* bits 11..00: Manufacturer ID */ -#define CHIPID 1/* Chip ID */ -#define CHIPID_REV 0xfc00/* bits 15..10: Chip Version */ -#define CHIPID_DEV 0x0200/* bits 09..09: Device */ -#define CHIPID_FIRMWARE 0x01ff/* bits 08..00: Firmware Version */ +#define SI_CHIPID 1/* Chip ID */ +#define SI_CHIPID_REV 0xfc00/* bits 15..10: Chip Version */ +#define SI_CHIPID_DEV 0x0200/* bits 09..09: Device */ +#define SI_CHIPID_FIRMWARE 0x01ff/* bits 08..00: Firmware Version */ #define POWERCFG 2/* Power Configuration */ #define POWERCFG_DSMUTE 0x8000/* bits 15..15: Softmute Disable */
Signature · 1 line
2.4.3
PATCH 2/7 tuner-i2c: be consistent with I2C declaration
On alpha, gcc warns a log about signed/unsigned ballance, with produces 3185 warnings. Ok, this is bogus, but it indicates that the declaration at V4L2 side is not consistent with the one at I2C.
With this trivial patch, the number of errors reduce to 2959 warnings. Still too much, but it is 7.1% less. So let's do it.
drivers/media/tuners/tuner-i2c.h +6 -4
@@ -33,7 +33,8 @@ struct tuner_i2c_props {char *name; }; -static inline int tuner_i2c_xfer_send (struct tuner_i2c_props *props,char *buf,int len) +static inline int tuner_i2c_xfer_send (struct tuner_i2c_props *props, +unsigned char *buf,int len) {struct i2c_msg msg = { .addr = props->addr, .flags =0 , .buf = buf, .len = len };
@@ -42,7 +43,8 @@ static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props, char *buf,return (ret ==1 ) ? len : ret; } -static inline int tuner_i2c_xfer_recv (struct tuner_i2c_props *props,char *buf,int len) +static inline int tuner_i2c_xfer_recv (struct tuner_i2c_props *props, +unsigned char *buf,int len) {struct i2c_msg msg = { .addr = props->addr, .flags =I2C_M_RD , .buf = buf, .len = len };
@@ -52,8 +54,8 @@ static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, char *buf, }static inline int tuner_i2c_xfer_send_recv (struct tuner_i2c_props *props, -char *obuf,int olen, -char *ibuf,int ilen) +unsigned char *obuf,int olen, +unsigned char *ibuf,int ilen) {struct i2c_msg msg[2 ] = { { .addr = props->addr, .flags =0 , .buf = obuf, .len = olen },
Signature · 1 line
2.4.3
PATCH 3/7 use CONFIG_PM_SLEEP for suspend/resume
In reply to Mauro Carvalho ChehabUsing CONFIG_PM_SLEEP suppress the warnings when the driver is compiled without PM sleep functions:
drivers/media/rc/st_rc.c:338:12: warning: ?st_rc_suspend? defined but not used [-Wunused-function] drivers/media/rc/st_rc.c:359:12: warning: ?st_rc_resume? defined but not used [-Wunused-function]
drivers/media/rc/st_rc.c +1 -1
@@ -334,7 +334,7 @@ err:return ret; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int st_rc_suspend (struct device *dev) {struct st_rc_device *rc_dev =dev_get_drvdata (dev);
Signature · 1 line
2.4.3
PATCH 3/7 use CONFIG_PM_SLEEP for suspend/resume
Quoted 13 lines · Mauro Carvalho Chehab
Using
CONFIG_PM_SLEEPsuppress the warnings when the driver is compiled without PM sleep functions:
drivers/media/rc/st_rc.c:338:12: warning: ?st_rc_suspend? defined but not used [-Wunused-function]drivers/media/rc/st_rc.c:359:12: warning: ?st_rc_resume? defined but not used [-Wunused-function]Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/rc/st_rc.c +0
-0
drivers/media/rc/st_rc.c err: · line 340
Quoted 8 lines
drivers/media/rc/st_rc.c +1
-1@@ -334,7 +334,7 @@ err:return ret; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int st_rc_suspend (struct device *dev) {struct st_rc_device *rc_dev =dev_get_drvdata (dev);
Thanks!
Maxime
PATCH 4/7 saa7134: fix page size on some archs
In reply to Mauro Carvalho ChehabOn some archs, like tile, the PAGE_SIZE is not 4K. In the case of tile arch, it can be either 16KB or 64KB.
Due to that, a warning is produced:
drivers/media/pci/saa7134/saa7134.h:678:43: warning: large integer implicitly truncated to unsigned type [-Woverflow]
This is actually an error, as it will write trach to the DMA size registers. The logic at saa7134-ts already does the right thing:
saa_writeb(SAA7134_TS_DMA0, ((dev->ts.nr_packets-1)&0xff)); saa_writeb(SAA7134_TS_DMA1, (((dev->ts.nr_packets-1)>>8)&0xff)); /* TSNOPIT=0, TSCOLAP=0 */ saa_writeb(SAA7134_TS_DMA2, ((((dev->ts.nr_packets-1)>>16)&0x3f) | 0x00));
So, fix the driver to take larger page sizes into account.
drivers/media/pci/saa7134/saa7134-go7007.c +3 -3
@@ -289,9 +289,9 @@ static int saa7134_go7007_stream_start(struct go7007 *go)/* Set up transfer block size */ saa_writeb (SAA7134_TS_PARALLEL_SERIAL ,128 -1 ); -saa_writeb (SAA7134_TS_DMA0 , (PAGE_SIZE >>7 ) -1 ); -saa_writeb (SAA7134_TS_DMA1 ,0 ); -saa_writeb (SAA7134_TS_DMA2 ,0 ); +saa_writeb (SAA7134_TS_DMA0 , ((PAGE_SIZE >>7 ) -1 ) &0xff ); +saa_writeb (SAA7134_TS_DMA1 , (PAGE_SIZE >>15 ) &0xff ); +saa_writeb (SAA7134_TS_DMA2 , (PAGE_SIZE >>31 ) &0x3f );/* Enable video streaming mode */ saa_writeb (SAA7134_GPIO_GPSTATUS2 ,GPIO_COMMAND_VIDEO );
Signature · 1 line
2.4.3
PATCH 5/7 omap3isp: remove unused var
In reply to Mauro Carvalho Chehabdrivers/media/platform/omap3isp/isppreview.c:932:6: warning: variable ‘features’ set but not used [-Wunused-but-set-variable]
drivers/media/platform/omap3isp/isppreview.c +0 -4
@@ -929,14 +929,10 @@ static void preview_setup_hw(struct isp_prev_device *prev, u32 update, u32 active) {unsigned int i; -u32 features;if (update ==0 )return ; - features = (prev->params.params[0 ].features & active) - | (prev->params.params[1 ].features & ~active); -for (i =0 ; i <ARRAY_SIZE (update_attrs); i++) {const struct preview_update *attr = &update_attrs[i];struct prev_params *params;
Signature · 1 line
2.4.3
Re: [PATCH 5/7] [media] omap3isp: remove unused var
Hi Mauro,
Quoted 4 lines · On Wednesday 24 June 2015 07:49:09 Mauro Carvalho Chehab wrote:
drivers/media/platform/omap3isp/isppreview.c:932:6: warning: variable ‘features’ set but not used [-Wunused-but-set-variable]Signed-off-by Mauro Carvalho Chehab <[email protected]>
On a side note, I'd appreciate if you could wait a couple of days for review before committing patches to the media_tree master branch.
Or maybe process pending pull requests for the same driver before fast- tracking your own patches ;-)
Quoted 20 lines
(quoted diff) +0
-0
b/drivers/media/platform/omap3isp/isppreview.cindex15cb254ccc39..13803270d104100644drivers/media/platform/omap3isp/isppreview.c +0
-4@@ -929,14 +929,10 @@ static void preview_setup_hw(struct isp_prev_device *prev, u32 update, u32 active) {unsigned int i; -u32 features;if (update ==0 )return ; - features = (prev->params.params[0 ].features & active) - | (prev->params.params[1 ].features & ~active); -for (i =0 ; i <ARRAY_SIZE (update_attrs); i++) {const struct preview_update *attr = &update_attrs[i];struct prev_params *params;
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 6/7 lmedm04: use u32 instead of u64 for relative stats
In reply to Mauro Carvalho ChehabCleanup this sparse warning:
drivers/media/usb/dvb-usb-v2/lmedm04.c:302 lme2510_update_stats() warn: should '((255 - st->signal_sn - 161) * 3) << 8' be a 64 bit type?
Both c_tmp and s_tmp actually stores a u16 stat. Using a u64 data there is a waste, specially on u32 archs, as 64 ints there are more expensive.
So, change the types to u32 and do the typecast only when storing the result.
drivers/media/usb/dvb-usb-v2/lmedm04.c +3 -3
@@ -262,7 +262,7 @@ static void lme2510_update_stats(struct dvb_usb_adapter *adap)struct lme2510_state *st =adap_to_priv (adap);struct dvb_frontend *fe = adap->fe[0 ];struct dtv_frontend_properties *c; -u64 s_tmp =0 , c_tmp =0 ; +u32 s_tmp =0 , c_tmp =0 ;if (!fe)return ;
@@ -309,11 +309,11 @@ static void lme2510_update_stats(struct dvb_usb_adapter *adap) c->strength.len =1 ; c->strength.stat[0 ].scale =FE_SCALE_RELATIVE ; - c->strength.stat[0 ].uvalue = s_tmp; + c->strength.stat[0 ].uvalue = (u64 )s_tmp; c->cnr.len =1 ; c->cnr.stat[0 ].scale =FE_SCALE_RELATIVE ; - c->cnr.stat[0 ].uvalue = c_tmp; + c->cnr.stat[0 ].uvalue = (u64 )c_tmp; }static void lme2510_int_response (struct urb *lme_urb)
Signature · 1 line
2.4.3
PATCH 7/7 lmedm04: fix the range for relative measurements
In reply to Mauro Carvalho ChehabRelative measurements are typically between 0 and 0xffff. However, for some tuners (TUNER_S7395 and TUNER_S0194), the range were from 0 to 0xff00, with means that 100% is never archived. Also, TUNER_RS2000 uses a more complex math.
So, create a macro that does the conversion using bit operations and use it for all conversions.
The code is also easier to read with is a bonus.
While here, remove a bogus comment.
drivers/media/usb/dvb-usb-v2/lmedm04.c +8 -11
@@ -257,6 +257,9 @@ static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out)return ret; } +/* Convert range from 0x00-0xff to 0x0000-0xffff */ +#define reg_to_16bits (x) ((x) | ((x) << 8) +static void lme2510_update_stats (struct dvb_usb_adapter *adap) {struct lme2510_state *st =adap_to_priv (adap);
@@ -288,23 +291,17 @@ static void lme2510_update_stats(struct dvb_usb_adapter *adap)switch (st->tuner_config) {case TUNER_LG : - s_tmp =0xff - st->signal_level; - s_tmp |= s_tmp <<8 ; - - c_tmp =0xff - st->signal_sn; - c_tmp |= c_tmp <<8 ; + s_tmp =reg_to_16bits (0xff - st->signal_level); + c_tmp =reg_to_16bits (0xff - st->signal_sn);break ; -/* fall through */ case TUNER_S7395 :case TUNER_S0194 : s_tmp =0xffff - (((st->signal_level *2 ) <<8 ) *5 /4 ); - - c_tmp = ((0xff - st->signal_sn -0xa1 ) *3 ) <<8 ; + c_tmp =reg_to_16bits ((0xff - st->signal_sn -0xa1 ) *3 );break ;case TUNER_RS2000 : - s_tmp = st->signal_level *0xffff /0xff ; - - c_tmp = st->signal_sn *0xffff /0x7f ; + s_tmp =reg_to_16bits (st->signal_level); + c_tmp =reg_to_16bits (st->signal_sn); } c->strength.len =1 ;
Signature · 1 line
2.4.3