staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation
Subsystems (2)
PATCH 1/4 staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation
--- drivers/staging/media/go7007/go7007-driver.c | 2 +- drivers/staging/media/go7007/go7007-v4l2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/go7007/go7007-driver.c +1 -1
@@ -571,7 +571,7 @@ struct go7007 *go7007_alloc(struct go7007_board_info *board, struct device *dev)struct go7007 *go;int i; - go =kmalloc (sizeof (struct go7007 ),GFP_KERNEL ); + go =kzalloc (sizeof (struct go7007 ),GFP_KERNEL );if (go ==NULL )return NULL ; go->dev = dev;
drivers/staging/media/go7007/go7007-v4l2.c +1 -1
@@ -98,7 +98,7 @@ static int go7007_open(struct file *file)if (go->status !=STATUS_ONLINE )return -EBUSY ; - gofh =kmalloc (sizeof (struct go7007_file ),GFP_KERNEL ); + gofh =kzalloc (sizeof (struct go7007_file ),GFP_KERNEL );if (gofh ==NULL )return -ENOMEM ; ++go->ref_count;
Signature · 1 line
1.7.7.6
PATCH 2/4 staging: media: go7007: firmware protection Protection for unfirmware load
--- drivers/staging/media/go7007/go7007-usb.c | 2 +- drivers/staging/media/go7007/go7007-v4l2.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/go7007/go7007-usb.c +1 -1
@@ -1245,7 +1245,6 @@ static void go7007_usb_disconnect(struct usb_interface *intf)struct urb *vurb, *aurb;int i; - go->status =STATUS_SHUTDOWN ;usb_kill_urb (usb->intr_urb);/* Free USB-related structs */
@@ -1269,6 +1268,7 @@ static void go7007_usb_disconnect(struct usb_interface *intf)kfree (go->hpi_context);go7007_remove (go); + go->status =STATUS_SHUTDOWN ; }static struct usb_driver go7007_usb_driver = {
drivers/staging/media/go7007/go7007-v4l2.c +2 -1
@@ -1832,5 +1832,6 @@ void go7007_v4l2_remove(struct go7007 *go)mutex_unlock (&go->hw_lock);if (go->video_dev)video_unregister_device (go->video_dev); -v4l2_device_unregister (&go->v4l2_dev); +if (go->status !=STATUS_SHUTDOWN ) +v4l2_device_unregister (&go->v4l2_dev); }
Signature · 1 line
1.7.7.6
Re: [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load
The problem is that the firmware was being unloaded on disconnect?
regards,
dan carpenter
Re: [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load
Quoted 4 lines · Dan Carpenter
The problem is that the firmware was being unloaded on disconnect?
regards,
dan carpenter
If no firmware was loaded (no exists,wrong or some error) then rmmod fails with OOPS, so need some protection stuff
Quoted 1 line
Re: [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load
Hi Volokh,
Quoted 5 lines · Volokh Konstantin
Quoted 2 lines · Dan Carpenter
The problem is that the firmware was being unloaded on disconnect?
If no firmware was loaded (no exists,wrong or some error) then rmmod fails with OOPS, so need some protection stuff
This explanation should be part of the commit message. It helps people understand what you're doing and why it's needed.
BTW, none of this 4-patch series has a detailed commit message besides the commit title.
I know they are small patches, but I'm sure you can do better than that!
Signature · 1 line
Ezequiel
PATCH 3/4 staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize
In reply to Volokh Konstantin--- drivers/staging/media/go7007/go7007-driver.c | 5 +++++ drivers/staging/media/go7007/go7007-usb.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/media/go7007/go7007-driver.c +5 -0
@@ -173,6 +173,11 @@ static int go7007_init_encoder(struct go7007 *go)go7007_write_addr (go,0x3c82 ,0x0001 );go7007_write_addr (go,0x3c80 ,0x00fe ); } +if (go->board_id ==GO7007_BOARDID_ADLINK_MPG24 ) { +/* set GPIO5 to be an output, currently low */ +go7007_write_addr (go,0x3c82 ,0x0000 ); +go7007_write_addr (go,0x3c80 ,0x00df ); + }return 0 ; }
drivers/staging/media/go7007/go7007-usb.c +0 -3
@@ -1110,9 +1110,6 @@ static int go7007_usb_probe(struct usb_interface *intf, }else {u16 channel; -/* set GPIO5 to be an output, currently low */ -go7007_write_addr (go,0x3c82 ,0x0000 ); -go7007_write_addr (go,0x3c80 ,0x00df );/* read channel number from GPIO[1:0] */ go7007_read_addr (go,0x3c81 , &channel); channel &=0x3 ;
Signature · 1 line
1.7.7.6
Re: [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize
You've added the writes for GO7007_BOARDID_ADLINK_MPG24 but removed them for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III. Won't that break those boards?
regards,
dan carpenter
Re: [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize
Quoted 4 lines · Dan Carpenter
You've added the writes for
GO7007_BOARDID_ADLINK_MPG24but removed them forGO7007_BOARDID_XMENandGO7007_BOARDID_XMEN_III. Won't that break those boards?
I don`t remove code for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III. case there are auto reusing for XMen and XMen-III:
look old code:
if ((go->board_id == GO7007_BOARDID_XMEN ||
go->board_id == GO7007_BOARDID_XMEN_III) &&
go->i2c_adapter_online) {
union i2c_smbus_data data;
/* Check to see if register 0x0A is 0x76 */
i2c_smbus_xfer(&go->i2c_adapter, 0x21, I2C_CLIENT_SCCB,
I2C_SMBUS_READ, 0x0A, I2C_SMBUS_BYTE_DATA, &data);
if (data.byte != 0x76) {
if (assume_endura) {
go->board_id = GO7007_BOARDID_ENDURA;
usb->board = board = &board_endura;
go->board_info = &board->main_info;
strncpy(go->name, "Pelco Endura",
sizeof(go->name));
} else {
u16 channel;
- /* set GPIO5 to be an output, currently low */
- go7007_write_addr(go, 0x3c82, 0x0000);
- go7007_write_addr(go, 0x3c80, 0x00df);
/* read channel number from GPIO[1:0] */
go7007_read_addr(go, 0x3c81, &channel);
channel &= 0x3;Quoted 1 line
Quoted 1 line
Quoted 1 line
go->board_id = GO7007_BOARDID_ADLINK_MPG24;
Here any XMen or XMen-III will reassigned as Adlink-mpg24 id
so any i2c initialization will reassigned to that id and we can use that id in init_encoder.
usb->board = board = &board_adlink_mpg24; go->board_info = &board->main_info; go->channel_number = channel; snprintf(go->name, sizeof(go->name), "Adlink PCI-MPG24, channel #%d", channel); } } }
Quoted 4 lines
regards,
dan carpenter
Dan Carpenter
Reviewed-byRe: [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize
Quoted 7 lines · Volokh Konstantin
Quoted 4 lines · Dan Carpenter
You've added the writes for
GO7007_BOARDID_ADLINK_MPG24but removed them forGO7007_BOARDID_XMENandGO7007_BOARDID_XMEN_III. Won't that break those boards?I don`t remove code for
GO7007_BOARDID_XMENandGO7007_BOARDID_XMEN_III. case there are auto reusing for XMen and XMen-III:
Ah. Grand.
regards,
dan carpenter
PATCH 4/4 staging: media: go7007: call_all stream stuff Some Additional stuff for v4l2_subdev stream events partial need for new style framework. Also need for wis_tw2804 notification stuff
In reply to Volokh Konstantin--- drivers/staging/media/go7007/go7007-v4l2.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/media/go7007/go7007-v4l2.c +2 -0
@@ -953,6 +953,7 @@ static int vidioc_streamon(struct file *file, void *priv, }mutex_unlock (&go->hw_lock);mutex_unlock (&gofh->lock); +call_all (&go->v4l2_dev, video, s_stream,1 );return retval; }
@@ -968,6 +969,7 @@ static int vidioc_streamoff(struct file *file, void *priv,mutex_lock (&gofh->lock);go7007_streamoff (go);mutex_unlock (&gofh->lock); +call_all (&go->v4l2_dev, video, s_stream,0 );return 0 ; }
Signature · 1 line
1.7.7.6
Quoted 1 line · Volokh Konstantin
Signed-off-by Volokh Konstantin <[email protected]>