public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation
@ 2013-01-16 13:00 Volokh Konstantin
  2013-01-16 13:00 ` [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load Volokh Konstantin
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Volokh Konstantin @ 2013-01-16 13:00 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, gregkh, volokh84, dhowells, rdunlap, hans.verkuil,
	justinmattock, devel, linux-kernel

Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
---
 drivers/staging/media/go7007/go7007-driver.c |    2 +-
 drivers/staging/media/go7007/go7007-v4l2.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c
index ece2dd1..a66e339 100644
--- a/drivers/staging/media/go7007/go7007-driver.c
+++ b/drivers/staging/media/go7007/go7007-driver.c
@@ -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;
diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c
index a78133b..e6fa543 100644
--- a/drivers/staging/media/go7007/go7007-v4l2.c
+++ b/drivers/staging/media/go7007/go7007-v4l2.c
@@ -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;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load
  2013-01-16 13:00 [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Volokh Konstantin
@ 2013-01-16 13:00 ` Volokh Konstantin
  2013-01-16 13:35   ` Dan Carpenter
  2013-01-16 13:00 ` [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize Volokh Konstantin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Volokh Konstantin @ 2013-01-16 13:00 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, gregkh, volokh84, dhowells, rdunlap, hans.verkuil,
	justinmattock, devel, linux-kernel

Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
---
 drivers/staging/media/go7007/go7007-usb.c  |    2 +-
 drivers/staging/media/go7007/go7007-v4l2.c |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index 5443e25..a6cad15 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -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 = {
diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c
index e6fa543..a69250f 100644
--- a/drivers/staging/media/go7007/go7007-v4l2.c
+++ b/drivers/staging/media/go7007/go7007-v4l2.c
@@ -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);
 }
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24   need reset GPIO always when encoder initialize
  2013-01-16 13:00 [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Volokh Konstantin
  2013-01-16 13:00 ` [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load Volokh Konstantin
@ 2013-01-16 13:00 ` Volokh Konstantin
  2013-01-16 13:36   ` Dan Carpenter
  2013-01-16 13:00 ` [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 Volokh Konstantin
  2013-01-16 13:20 ` [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Dan Carpenter
  3 siblings, 1 reply; 11+ messages in thread
From: Volokh Konstantin @ 2013-01-16 13:00 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, gregkh, volokh84, dhowells, rdunlap, hans.verkuil,
	justinmattock, devel, linux-kernel

Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
---
 drivers/staging/media/go7007/go7007-driver.c |    5 +++++
 drivers/staging/media/go7007/go7007-usb.c    |    3 ---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c
index a66e339..c0ea312 100644
--- a/drivers/staging/media/go7007/go7007-driver.c
+++ b/drivers/staging/media/go7007/go7007-driver.c
@@ -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;
 }
 
diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index a6cad15..9dbf5ec 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -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;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [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
  2013-01-16 13:00 [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Volokh Konstantin
  2013-01-16 13:00 ` [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load Volokh Konstantin
  2013-01-16 13:00 ` [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize Volokh Konstantin
@ 2013-01-16 13:00 ` Volokh Konstantin
  2013-01-16 13:20 ` [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Dan Carpenter
  3 siblings, 0 replies; 11+ messages in thread
From: Volokh Konstantin @ 2013-01-16 13:00 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, gregkh, volokh84, dhowells, rdunlap, hans.verkuil,
	justinmattock, devel, linux-kernel

Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
---
 drivers/staging/media/go7007/go7007-v4l2.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c
index a69250f..2330861 100644
--- a/drivers/staging/media/go7007/go7007-v4l2.c
+++ b/drivers/staging/media/go7007/go7007-v4l2.c
@@ -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;
 }
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation
  2013-01-16 13:00 [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Volokh Konstantin
                   ` (2 preceding siblings ...)
  2013-01-16 13:00 ` [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 Volokh Konstantin
@ 2013-01-16 13:20 ` Dan Carpenter
  3 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2013-01-16 13:20 UTC (permalink / raw)
  To: Volokh Konstantin
  Cc: linux-media, devel, mchehab, gregkh, linux-kernel, dhowells,
	rdunlap, hans.verkuil, justinmattock

On Wed, Jan 16, 2013 at 05:00:48PM +0400, Volokh Konstantin wrote:
> Signed-off-by: Volokh Konstantin <volokh84@gmail.com>

Acked-by: Dan Carpenter <dan.carpenter@oracle.com>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load
  2013-01-16 13:00 ` [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load Volokh Konstantin
@ 2013-01-16 13:35   ` Dan Carpenter
  2013-01-16 13:42     ` Volokh Konstantin
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2013-01-16 13:35 UTC (permalink / raw)
  To: Volokh Konstantin
  Cc: linux-media, devel, mchehab, gregkh, linux-kernel, dhowells,
	rdunlap, hans.verkuil, justinmattock

The problem is that the firmware was being unloaded on disconnect?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 11+ messages in thread

* 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
  2013-01-16 13:00 ` [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize Volokh Konstantin
@ 2013-01-16 13:36   ` Dan Carpenter
  2013-01-16 14:00     ` Volokh Konstantin
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2013-01-16 13:36 UTC (permalink / raw)
  To: Volokh Konstantin
  Cc: linux-media, devel, mchehab, gregkh, linux-kernel, dhowells,
	rdunlap, hans.verkuil, justinmattock

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



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load
  2013-01-16 13:35   ` Dan Carpenter
@ 2013-01-16 13:42     ` Volokh Konstantin
  2013-01-16 18:03       ` Ezequiel Garcia
  0 siblings, 1 reply; 11+ messages in thread
From: Volokh Konstantin @ 2013-01-16 13:42 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-media, devel, mchehab, gregkh, linux-kernel, dhowells,
	rdunlap, hans.verkuil, justinmattock

On Wed, Jan 16, 2013 at 04:35:45PM +0300, Dan Carpenter wrote:
> 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
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* 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
  2013-01-16 13:36   ` Dan Carpenter
@ 2013-01-16 14:00     ` Volokh Konstantin
  2013-01-16 14:33       ` Dan Carpenter
  0 siblings, 1 reply; 11+ messages in thread
From: Volokh Konstantin @ 2013-01-16 14:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-media, devel, mchehab, gregkh, linux-kernel, dhowells,
	rdunlap, hans.verkuil, justinmattock

On Wed, Jan 16, 2013 at 04:36:08PM +0300, Dan Carpenter wrote:
> 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?
>
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;
>>>				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);
			}
		}
	}
> regards,
> dan carpenter
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* 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
  2013-01-16 14:00     ` Volokh Konstantin
@ 2013-01-16 14:33       ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2013-01-16 14:33 UTC (permalink / raw)
  To: Volokh Konstantin
  Cc: devel, mchehab, gregkh, linux-kernel, dhowells, rdunlap,
	hans.verkuil, justinmattock, linux-media

On Wed, Jan 16, 2013 at 06:00:13PM +0400, Volokh Konstantin wrote:
> On Wed, Jan 16, 2013 at 04:36:08PM +0300, Dan Carpenter wrote:
> > 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?
> >
> I don`t remove code for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III.
> case there are auto reusing for XMen and XMen-III:

Ah.  Grand.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load
  2013-01-16 13:42     ` Volokh Konstantin
@ 2013-01-16 18:03       ` Ezequiel Garcia
  0 siblings, 0 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2013-01-16 18:03 UTC (permalink / raw)
  To: Volokh Konstantin
  Cc: Dan Carpenter, devel, mchehab, gregkh, linux-kernel, dhowells,
	rdunlap, hans.verkuil, justinmattock, linux-media

Hi Volokh,

On Wed, Jan 16, 2013 at 10:42 AM, Volokh Konstantin <volokh84@gmail.com> wrote:
> On Wed, Jan 16, 2013 at 04:35:45PM +0300, Dan Carpenter wrote:
>> 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!

-- 
    Ezequiel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-01-16 18:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 13:00 [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Volokh Konstantin
2013-01-16 13:00 ` [PATCH 2/4] staging: media: go7007: firmware protection Protection for unfirmware load Volokh Konstantin
2013-01-16 13:35   ` Dan Carpenter
2013-01-16 13:42     ` Volokh Konstantin
2013-01-16 18:03       ` Ezequiel Garcia
2013-01-16 13:00 ` [PATCH 3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize Volokh Konstantin
2013-01-16 13:36   ` Dan Carpenter
2013-01-16 14:00     ` Volokh Konstantin
2013-01-16 14:33       ` Dan Carpenter
2013-01-16 13:00 ` [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 Volokh Konstantin
2013-01-16 13:20 ` [PATCH 1/4] staging: media: go7007: memory clear fix memory clearing for v4l2_subdev allocation Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox