* [PATCH] drivers/media: nuvoton: always true expression
@ 2010-11-16 20:19 Nicolas Kaiser
2010-11-16 21:54 ` Jarod Wilson
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Kaiser @ 2010-11-16 20:19 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Jarod Wilson, linux-media, linux-kernel
I noticed that the second part of this conditional is always true.
Would the intention be to strictly check on both chip_major and
chip_minor?
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
drivers/media/IR/nuvoton-cir.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c
index 301be53..896463b 100644
--- a/drivers/media/IR/nuvoton-cir.c
+++ b/drivers/media/IR/nuvoton-cir.c
@@ -249,8 +249,8 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
chip_minor = nvt_cr_read(nvt, CR_CHIP_ID_LO);
nvt_dbg("%s: chip id: 0x%02x 0x%02x", chip_id, chip_major, chip_minor);
- if (chip_major != CHIP_ID_HIGH &&
- (chip_minor != CHIP_ID_LOW || chip_minor != CHIP_ID_LOW2))
+ if (chip_major != CHIP_ID_HIGH ||
+ (chip_minor != CHIP_ID_LOW && chip_minor != CHIP_ID_LOW2))
ret = -ENODEV;
nvt_efm_disable(nvt);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drivers/media: nuvoton: always true expression
2010-11-16 20:19 [PATCH] drivers/media: nuvoton: always true expression Nicolas Kaiser
@ 2010-11-16 21:54 ` Jarod Wilson
2010-11-17 1:51 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 7+ messages in thread
From: Jarod Wilson @ 2010-11-16 21:54 UTC (permalink / raw)
To: Nicolas Kaiser; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel
On Tue, Nov 16, 2010 at 09:19:53PM +0100, Nicolas Kaiser wrote:
> I noticed that the second part of this conditional is always true.
> Would the intention be to strictly check on both chip_major and
> chip_minor?
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Hrm, yeah, looks like I screwed that one up. You're correct, the intention
was to make sure we have a matching chip id high and one or the other of
the chip id low values.
Acked-by: Jarod Wilson <jarod@redhat.com>
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drivers/media: nuvoton: always true expression
2010-11-16 21:54 ` Jarod Wilson
@ 2010-11-17 1:51 ` Mauro Carvalho Chehab
2010-11-17 10:35 ` [PATCH] drivers/media: nuvoton: fix chip id probe Nicolas Kaiser
0 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2010-11-17 1:51 UTC (permalink / raw)
To: Jarod Wilson; +Cc: Nicolas Kaiser, linux-media, linux-kernel
Em 16-11-2010 19:54, Jarod Wilson escreveu:
> On Tue, Nov 16, 2010 at 09:19:53PM +0100, Nicolas Kaiser wrote:
>> I noticed that the second part of this conditional is always true.
>> Would the intention be to strictly check on both chip_major and
>> chip_minor?
>>
>> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
>
> Hrm, yeah, looks like I screwed that one up. You're correct, the intention
> was to make sure we have a matching chip id high and one or the other of
> the chip id low values.
>
> Acked-by: Jarod Wilson <jarod@redhat.com>
>
I wander if it wouldn't be good to print something if the probe fails due to
the wrong chip ID. It may help if someone complain about a different
revision.
Mauro.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] drivers/media: nuvoton: fix chip id probe
2010-11-17 1:51 ` Mauro Carvalho Chehab
@ 2010-11-17 10:35 ` Nicolas Kaiser
2010-11-19 19:16 ` Jarod Wilson
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Kaiser @ 2010-11-17 10:35 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Jarod Wilson, linux-media, linux-kernel
Make sure we have a matching chip id high and one or the other
of the chip id low values.
Print the values if the probe fails.
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
Like this?
Supersedes patch "drivers/media: nuvoton: always true expression".
drivers/media/IR/nuvoton-cir.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c
index 301be53..92d32c8 100644
--- a/drivers/media/IR/nuvoton-cir.c
+++ b/drivers/media/IR/nuvoton-cir.c
@@ -249,9 +249,12 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
chip_minor = nvt_cr_read(nvt, CR_CHIP_ID_LO);
nvt_dbg("%s: chip id: 0x%02x 0x%02x", chip_id, chip_major, chip_minor);
- if (chip_major != CHIP_ID_HIGH &&
- (chip_minor != CHIP_ID_LOW || chip_minor != CHIP_ID_LOW2))
+ if (chip_major != CHIP_ID_HIGH ||
+ (chip_minor != CHIP_ID_LOW && chip_minor != CHIP_ID_LOW2)) {
+ nvt_pr(KERN_ERR, "%s: chip id mismatch: 0x%02x 0x%02x",
+ chip_id, chip_major, chip_minor);
ret = -ENODEV;
+ }
nvt_efm_disable(nvt);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drivers/media: nuvoton: fix chip id probe
2010-11-17 10:35 ` [PATCH] drivers/media: nuvoton: fix chip id probe Nicolas Kaiser
@ 2010-11-19 19:16 ` Jarod Wilson
2010-11-19 20:42 ` [PATCH] drivers/media: nuvoton: fix chip id probe v2 Nicolas Kaiser
0 siblings, 1 reply; 7+ messages in thread
From: Jarod Wilson @ 2010-11-19 19:16 UTC (permalink / raw)
To: Nicolas Kaiser; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel
On Wed, Nov 17, 2010 at 11:35:25AM +0100, Nicolas Kaiser wrote:
> Make sure we have a matching chip id high and one or the other
> of the chip id low values.
> Print the values if the probe fails.
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
> Like this?
> Supersedes patch "drivers/media: nuvoton: always true expression".
>
> drivers/media/IR/nuvoton-cir.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c
> index 301be53..92d32c8 100644
> --- a/drivers/media/IR/nuvoton-cir.c
> +++ b/drivers/media/IR/nuvoton-cir.c
> @@ -249,9 +249,12 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
> chip_minor = nvt_cr_read(nvt, CR_CHIP_ID_LO);
> nvt_dbg("%s: chip id: 0x%02x 0x%02x", chip_id, chip_major, chip_minor);
>
> - if (chip_major != CHIP_ID_HIGH &&
> - (chip_minor != CHIP_ID_LOW || chip_minor != CHIP_ID_LOW2))
> + if (chip_major != CHIP_ID_HIGH ||
> + (chip_minor != CHIP_ID_LOW && chip_minor != CHIP_ID_LOW2)) {
> + nvt_pr(KERN_ERR, "%s: chip id mismatch: 0x%02x 0x%02x",
I'd probably go with "unsupported chip, id: " instead, since it makes the
message a bit clearer, but generally speaking, yeah, something along
those lines should be fine.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] drivers/media: nuvoton: fix chip id probe v2
2010-11-19 19:16 ` Jarod Wilson
@ 2010-11-19 20:42 ` Nicolas Kaiser
2010-11-19 21:39 ` Jarod Wilson
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Kaiser @ 2010-11-19 20:42 UTC (permalink / raw)
To: Jarod Wilson; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel
Make sure we have a matching chip id high and one or the other
of the chip id low values.
Print the values if the probe fails.
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
drivers/media/IR/nuvoton-cir.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c
index 301be53..e3274ef 100644
--- a/drivers/media/IR/nuvoton-cir.c
+++ b/drivers/media/IR/nuvoton-cir.c
@@ -249,9 +249,12 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
chip_minor = nvt_cr_read(nvt, CR_CHIP_ID_LO);
nvt_dbg("%s: chip id: 0x%02x 0x%02x", chip_id, chip_major, chip_minor);
- if (chip_major != CHIP_ID_HIGH &&
- (chip_minor != CHIP_ID_LOW || chip_minor != CHIP_ID_LOW2))
+ if (chip_major != CHIP_ID_HIGH ||
+ (chip_minor != CHIP_ID_LOW && chip_minor != CHIP_ID_LOW2)) {
+ nvt_pr(KERN_ERR, "%s: unsupported chip, id: 0x%02x 0x%02x",
+ chip_id, chip_major, chip_minor);
ret = -ENODEV;
+ }
nvt_efm_disable(nvt);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drivers/media: nuvoton: fix chip id probe v2
2010-11-19 20:42 ` [PATCH] drivers/media: nuvoton: fix chip id probe v2 Nicolas Kaiser
@ 2010-11-19 21:39 ` Jarod Wilson
0 siblings, 0 replies; 7+ messages in thread
From: Jarod Wilson @ 2010-11-19 21:39 UTC (permalink / raw)
To: Nicolas Kaiser; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel
On Fri, Nov 19, 2010 at 09:42:40PM +0100, Nicolas Kaiser wrote:
> Make sure we have a matching chip id high and one or the other
> of the chip id low values.
> Print the values if the probe fails.
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
That works for me, thanks much.
Acked-by: Jarod Wilson <jarod@redhat.com>
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-11-19 21:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-16 20:19 [PATCH] drivers/media: nuvoton: always true expression Nicolas Kaiser
2010-11-16 21:54 ` Jarod Wilson
2010-11-17 1:51 ` Mauro Carvalho Chehab
2010-11-17 10:35 ` [PATCH] drivers/media: nuvoton: fix chip id probe Nicolas Kaiser
2010-11-19 19:16 ` Jarod Wilson
2010-11-19 20:42 ` [PATCH] drivers/media: nuvoton: fix chip id probe v2 Nicolas Kaiser
2010-11-19 21:39 ` Jarod Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).