* [PATCH] Input: intel-mid-touch - remove pointless checking for variable 'found'
@ 2011-07-12 7:13 Axel Lin
2011-07-13 6:57 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2011-07-12 7:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Sreedhara Murthy. D.S, Dmitry Torokhov, linux-input
The implementation does break from the for loop after we assign i to variable
'found'.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/input/touchscreen/intel-mid-touch.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c
index 66c96bf..9283284 100644
--- a/drivers/input/touchscreen/intel-mid-touch.c
+++ b/drivers/input/touchscreen/intel-mid-touch.c
@@ -454,9 +454,6 @@ static int __devinit mrstouch_chan_parse(struct mrstouch_dev *tsdev)
found = -1;
for (i = 0; i < MRSTOUCH_MAX_CHANNELS; i++) {
- if (found >= 0)
- break;
-
err = intel_scu_ipc_ioread8(PMICADDR0 + i, &r8);
if (err)
return err;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: intel-mid-touch - remove pointless checking for variable 'found'
2011-07-12 7:13 [PATCH] Input: intel-mid-touch - remove pointless checking for variable 'found' Axel Lin
@ 2011-07-13 6:57 ` Dmitry Torokhov
2011-07-13 13:06 ` Axel Lin
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2011-07-13 6:57 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Sreedhara Murthy. D.S, linux-input, Alan Cox
On Tue, Jul 12, 2011 at 03:13:51PM +0800, Axel Lin wrote:
> The implementation does break from the for loop after we assign i to variable
> 'found'.
>
Hmm, if we are cleaning this up what about the following?
Thanks.
--
Dmitry
Input: intel-mid-touch - remove pointless checking for variable 'found'
From: Axel Lin <axel.lin@gmail.com>
The implementation does break from the for loop after we assign i to variable
'found'.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/touchscreen/intel-mid-touch.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c
index 66c96bf..3276952 100644
--- a/drivers/input/touchscreen/intel-mid-touch.c
+++ b/drivers/input/touchscreen/intel-mid-touch.c
@@ -448,15 +448,11 @@ static int __devinit mrstouch_read_pmic_id(uint *vendor, uint *rev)
*/
static int __devinit mrstouch_chan_parse(struct mrstouch_dev *tsdev)
{
- int err, i, found;
+ int found = 0;
+ int err, i;
u8 r8;
- found = -1;
-
for (i = 0; i < MRSTOUCH_MAX_CHANNELS; i++) {
- if (found >= 0)
- break;
-
err = intel_scu_ipc_ioread8(PMICADDR0 + i, &r8);
if (err)
return err;
@@ -466,16 +462,15 @@ static int __devinit mrstouch_chan_parse(struct mrstouch_dev *tsdev)
break;
}
}
- if (found < 0)
- return 0;
if (tsdev->vendor == PMIC_VENDOR_FS) {
- if (found && found > (MRSTOUCH_MAX_CHANNELS - 18))
+ if (found > MRSTOUCH_MAX_CHANNELS - 18)
return -ENOSPC;
} else {
- if (found && found > (MRSTOUCH_MAX_CHANNELS - 4))
+ if (found > MRSTOUCH_MAX_CHANNELS - 4)
return -ENOSPC;
}
+
return found;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: intel-mid-touch - remove pointless checking for variable 'found'
2011-07-13 6:57 ` Dmitry Torokhov
@ 2011-07-13 13:06 ` Axel Lin
0 siblings, 0 replies; 3+ messages in thread
From: Axel Lin @ 2011-07-13 13:06 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-kernel, Sreedhara Murthy. D.S, linux-input, Alan Cox
2011/7/13 Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> On Tue, Jul 12, 2011 at 03:13:51PM +0800, Axel Lin wrote:
>> The implementation does break from the for loop after we assign i to variable
>> 'found'.
>>
>
> Hmm, if we are cleaning this up what about the following?
>
hi Dmitry,
It looks good and better.
Thanks,
Axel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-13 13:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-12 7:13 [PATCH] Input: intel-mid-touch - remove pointless checking for variable 'found' Axel Lin
2011-07-13 6:57 ` Dmitry Torokhov
2011-07-13 13:06 ` Axel Lin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.