mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: cec: core: remove length check of Timer Status
@ 2024-01-25 13:28 nini.song
  2024-02-05 12:00 ` Hans Verkuil
  2024-04-04  8:40 ` Hans Verkuil
  0 siblings, 2 replies; 4+ messages in thread
From: nini.song @ 2024-01-25 13:28 UTC (permalink / raw)
  To: nini.song
  Cc: ci.wu, mchehab, nicolas, linux-media, linux-arm-kernel,
	linux-mediatek, Hans Verkuil, Matthias Brugger,
	AngeloGioacchino Del Regno, Jani Nikula, linux-kernel

From: "nini.song" <nini.song@mediatek.com>

The valid_la is used to check the length requirements,
including special cases of Timer Status. If the length is
shorter than 5, that means no Duration Available is returned,
the message will be forced to be invalid.

However, the description of Duration Available in the spec
is that this parameter may be returned when these cases, or
that it can be optionally return when these cases. The key
words in the spec description are flexible choices.

Remove the special length check of Timer Status to fit the
spec which is not compulsory about that.

Signed-off-by: Nini Song <nini.song@mediatek.com>
---
 drivers/media/cec/core/cec-adap.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
index 5741adf09a2e..559a172ebc6c 100644
--- a/drivers/media/cec/core/cec-adap.c
+++ b/drivers/media/cec/core/cec-adap.c
@@ -1151,20 +1151,6 @@ void cec_received_msg_ts(struct cec_adapter *adap,
 	if (valid_la && min_len) {
 		/* These messages have special length requirements */
 		switch (cmd) {
-		case CEC_MSG_TIMER_STATUS:
-			if (msg->msg[2] & 0x10) {
-				switch (msg->msg[2] & 0xf) {
-				case CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE:
-				case CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE:
-					if (msg->len < 5)
-						valid_la = false;
-					break;
-				}
-			} else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) {
-				if (msg->len < 5)
-					valid_la = false;
-			}
-			break;
 		case CEC_MSG_RECORD_ON:
 			switch (msg->msg[2]) {
 			case CEC_OP_RECORD_SRC_OWN:
-- 
2.18.0


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

* Re: [PATCH] media: cec: core: remove length check of Timer Status
  2024-01-25 13:28 [PATCH] media: cec: core: remove length check of Timer Status nini.song
@ 2024-02-05 12:00 ` Hans Verkuil
       [not found]   ` <089a5abf85fb3aaa57cb9436193b09eea47a03d2.camel@mediatek.com>
  2024-04-04  8:40 ` Hans Verkuil
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2024-02-05 12:00 UTC (permalink / raw)
  To: nini.song
  Cc: ci.wu, mchehab, nicolas, linux-media, linux-arm-kernel,
	linux-mediatek, Matthias Brugger, AngeloGioacchino Del Regno,
	Jani Nikula, linux-kernel

On 25/01/2024 14:28, nini.song@mediatek.com wrote:
> From: "nini.song" <nini.song@mediatek.com>
> 
> The valid_la is used to check the length requirements,
> including special cases of Timer Status. If the length is
> shorter than 5, that means no Duration Available is returned,
> the message will be forced to be invalid.
> 
> However, the description of Duration Available in the spec
> is that this parameter may be returned when these cases, or
> that it can be optionally return when these cases. The key
> words in the spec description are flexible choices.

Good catch, the spec indeed says 'may', so dropping the check
in this patch is the correct thing to do.

It's merged in our staging tree and it will appear in v6.9.

Regards,

	Hans

> 
> Remove the special length check of Timer Status to fit the
> spec which is not compulsory about that.
> 
> Signed-off-by: Nini Song <nini.song@mediatek.com>
> ---
>  drivers/media/cec/core/cec-adap.c | 14 --------------
>  1 file changed, 14 deletions(-)
> 
> diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
> index 5741adf09a2e..559a172ebc6c 100644
> --- a/drivers/media/cec/core/cec-adap.c
> +++ b/drivers/media/cec/core/cec-adap.c
> @@ -1151,20 +1151,6 @@ void cec_received_msg_ts(struct cec_adapter *adap,
>  	if (valid_la && min_len) {
>  		/* These messages have special length requirements */
>  		switch (cmd) {
> -		case CEC_MSG_TIMER_STATUS:
> -			if (msg->msg[2] & 0x10) {
> -				switch (msg->msg[2] & 0xf) {
> -				case CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE:
> -				case CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE:
> -					if (msg->len < 5)
> -						valid_la = false;
> -					break;
> -				}
> -			} else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) {
> -				if (msg->len < 5)
> -					valid_la = false;
> -			}
> -			break;
>  		case CEC_MSG_RECORD_ON:
>  			switch (msg->msg[2]) {
>  			case CEC_OP_RECORD_SRC_OWN:


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

* Re: [PATCH] media: cec: core: remove length check of Timer Status
       [not found]   ` <089a5abf85fb3aaa57cb9436193b09eea47a03d2.camel@mediatek.com>
@ 2024-02-21  9:02     ` Hans Verkuil
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2024-02-21  9:02 UTC (permalink / raw)
  To: Nini Song (宋宛妮)
  Cc: linux-mediatek, linux-kernel, linux-media,
	CI Wu (伍倉億),
	mchehab, stable, nicolas, linux-arm-kernel, matthias.bgg,
	angelogioacchino.delregno, jani.nikula

Dear Nini,

Unfortunately I forgot to add a 'Fixes' tag to the patch, if I had, then it would
have happened automatically.

Please remind me of this once kernel 6.9-rc1 is released since that will contain
the fix. Then I can post the same patch to the stable mailinglist for inclusion in
older kernels.

It has to wait until 6.9-rc1 is release though, patches need to be in mainline first
before they can be backported.

Regards,

	Hans

On 21/02/2024 07:30, Nini Song (宋宛妮) wrote:
> Dear Hans,
> 
> Thank your reply.
> Could you also help to marge solution into v5.15? Our customer used v5.15 for MP production, which requires this solution.
> 
> 
> BR,
> Nini Song
> On Mon, 2024-02-05 at 13:00 +0100, Hans Verkuil wrote:
>> 	
>>
>> External email : Please do not click links or open attachments until you have verified the sender or the content.
>>
>> On 25/01/2024 14:28, nini.song@mediatek.com wrote:
>> > From: "nini.song" <nini.song@mediatek.com>
>> > 
>> > The valid_la is used to check the length requirements,
>> > including special cases of Timer Status. If the length is
>> > shorter than 5, that means no Duration Available is returned,
>> > the message will be forced to be invalid.
>> > 
>> > However, the description of Duration Available in the spec
>> > is that this parameter may be returned when these cases, or
>> > that it can be optionally return when these cases. The key
>> > words in the spec description are flexible choices.
>>
>> Good catch, the spec indeed says 'may', so dropping the check
>> in this patch is the correct thing to do.
>>
>> It's merged in our staging tree and it will appear in v6.9.
>>
>> Regards,
>>
>> Hans
>>
>> > 
>> > Remove the special length check of Timer Status to fit the
>> > spec which is not compulsory about that.
>> > 
>> > Signed-off-by: Nini Song <nini.song@mediatek.com>
>> > ---
>> >  drivers/media/cec/core/cec-adap.c | 14 --------------
>> >  1 file changed, 14 deletions(-)
>> > 
>> > diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
>> > index 5741adf09a2e..559a172ebc6c 100644
>> > --- a/drivers/media/cec/core/cec-adap.c
>> > +++ b/drivers/media/cec/core/cec-adap.c
>> > @@ -1151,20 +1151,6 @@ void cec_received_msg_ts(struct cec_adapter *adap,
>> >  if (valid_la && min_len) {
>> >  /* These messages have special length requirements */
>> >  switch (cmd) {
>> > -case CEC_MSG_TIMER_STATUS:
>> > -if (msg->msg[2] & 0x10) {
>> > -switch (msg->msg[2] & 0xf) {
>> > -case CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE:
>> > -case CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE:
>> > -if (msg->len < 5)
>> > -valid_la = false;
>> > -break;
>> > -}
>> > -} else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) {
>> > -if (msg->len < 5)
>> > -valid_la = false;
>> > -}
>> > -break;
>> >  case CEC_MSG_RECORD_ON:
>> >  switch (msg->msg[2]) {
>> >  case CEC_OP_RECORD_SRC_OWN:
>>
>>


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

* Re: [PATCH] media: cec: core: remove length check of Timer Status
  2024-01-25 13:28 [PATCH] media: cec: core: remove length check of Timer Status nini.song
  2024-02-05 12:00 ` Hans Verkuil
@ 2024-04-04  8:40 ` Hans Verkuil
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2024-04-04  8:40 UTC (permalink / raw)
  To: nini.song
  Cc: ci.wu, mchehab, nicolas, linux-media, linux-arm-kernel,
	linux-mediatek, Matthias Brugger, AngeloGioacchino Del Regno,
	Jani Nikula, linux-kernel

Hi Nini,

This patch has now been merged in mainline as commit ce5d241c3ad45
("media: cec: core: remove length check of Timer Status").

To get this into older kernels please post this patch to
stable@vger.kernel.org, CC the linux-media mailinglist, and mention the
mainline commit that I provided above.

Also mention that this patch applies to 5.10 and up. You can mention
that the patch applies to 5.4 and 4.19 as well after removing the '/core'
directory from the pathnames.

Since you are the author of the patch, you should be the one to post
the patch.

Regards,

	Hans


On 25/01/2024 14:28, nini.song@mediatek.com wrote:
> From: "nini.song" <nini.song@mediatek.com>
> 
> The valid_la is used to check the length requirements,
> including special cases of Timer Status. If the length is
> shorter than 5, that means no Duration Available is returned,
> the message will be forced to be invalid.
> 
> However, the description of Duration Available in the spec
> is that this parameter may be returned when these cases, or
> that it can be optionally return when these cases. The key
> words in the spec description are flexible choices.
> 
> Remove the special length check of Timer Status to fit the
> spec which is not compulsory about that.
> 
> Signed-off-by: Nini Song <nini.song@mediatek.com>
> ---
>  drivers/media/cec/core/cec-adap.c | 14 --------------
>  1 file changed, 14 deletions(-)
> 
> diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
> index 5741adf09a2e..559a172ebc6c 100644
> --- a/drivers/media/cec/core/cec-adap.c
> +++ b/drivers/media/cec/core/cec-adap.c
> @@ -1151,20 +1151,6 @@ void cec_received_msg_ts(struct cec_adapter *adap,
>  	if (valid_la && min_len) {
>  		/* These messages have special length requirements */
>  		switch (cmd) {
> -		case CEC_MSG_TIMER_STATUS:
> -			if (msg->msg[2] & 0x10) {
> -				switch (msg->msg[2] & 0xf) {
> -				case CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE:
> -				case CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE:
> -					if (msg->len < 5)
> -						valid_la = false;
> -					break;
> -				}
> -			} else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) {
> -				if (msg->len < 5)
> -					valid_la = false;
> -			}
> -			break;
>  		case CEC_MSG_RECORD_ON:
>  			switch (msg->msg[2]) {
>  			case CEC_OP_RECORD_SRC_OWN:


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

end of thread, other threads:[~2024-04-04  8:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 13:28 [PATCH] media: cec: core: remove length check of Timer Status nini.song
2024-02-05 12:00 ` Hans Verkuil
     [not found]   ` <089a5abf85fb3aaa57cb9436193b09eea47a03d2.camel@mediatek.com>
2024-02-21  9:02     ` Hans Verkuil
2024-04-04  8:40 ` Hans Verkuil

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

all inboxes | Powered by JetHome®