Skip to contentSkip to conversation

the needless loop?

DISCUSSION Shevchenko, Andriy 3 participants 5 messages Oct 21, 2015 – Oct 28, 2015 GPIO

lore
Share & tools
lore
#0 lore raw

Hi!

Catch such code in pinconf.c

         for (j = 0; j < map->data.configs.num_configs; j++) { if (!strcmp(map->data.configs.group_or_pin, dbg->pin_name)) { /* We found the right pin / state */ found = map;
                         break;
                 }
         }

I do not get how the result of strcmp() would be different during the loop. Can you elaborate?

Signature · 12 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw
Quoted 11 lines · Andriy

Catch such code in pinconf.c

         for (j = 0; j < map->data.configs.num_configs; j++) {
                 if (!strcmp(map->data.configs.group_or_pin,
                                 dbg->pin_name)) {
                         /* We found the right pin / state */
                         found = map;
                         break;
                 }
         }
Quoted 2 lines

I do not get how the result of strcmp() would be different during the loop. Can you elaborate?

As you can see from git blame Laurent Meunier wrote this code, (commit f07512e615dd8) so let's
ask him. I suspect a simple copy/paste error? Laurent?

Yours,
Linus Walleij

#2 lore raw

Hi Linus, Andriy,

Quoted 14 lines
Quoted 11 lines · Andriy

Catch such code in pinconf.c

         for (j = 0; j < map->data.configs.num_configs; j++) {
                 if (!strcmp(map->data.configs.group_or_pin,
                                 dbg->pin_name)) {
                         /* We found the right pin / state */
                         found = map;
                         break;
                 }
         }
Quoted 6 lines
Quoted 2 lines

I do not get how the result of strcmp() would be different during the loop. Can you elaborate?

As you can see from git blame Laurent Meunier wrote this code, (commit f07512e615dd8) so let's ask him. I suspect a simple copy/paste error? Laurent?

Indeed obviously a copy / paste error I did
The loop shall be removed ... Has someone already any plan to send the fix ?

Laurent

Quoted 2 lines

Yours,
Linus Walleij

#3 lore raw
Quoted 26 lines · Laurent MEUNIER

Hi Linus, Andriy,

Quoted 18 lines
Quoted 11 lines · Andriy

Catch such code in pinconf.c

         for (j = 0; j < map->data.configs.num_configs; j++) { if (!strcmp(map->data.configs.group_or_pin, dbg->pin_name)) { /* We found the right pin / state */ found = map;
                         break;
                 }
         }

Quoted 3 lines

I do not get how the result of strcmp() would be different during the
loop. Can you elaborate?

Quoted 5 lines

As you can see from git blame Laurent Meunier wrote this code, (commit
f07512e615dd8) so let's ask him. I suspect a simple copy/paste error?
Laurent?

Quoted 3 lines

Indeed obviously a copy / paste error I did
The loop shall be removed ... Has someone already any plan to send the fix ?

Not me, too busy with other stuff (https://lkml.org/lkml/2015/10/27/451
)

Quoted 5 lines

Laurent

Quoted 2 lines

Yours,
Linus Walleij

Signature · 12 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#4 lore raw
Quoted 5 lines
Quoted 2 lines

Indeed obviously a copy / paste error I did The loop shall be removed ... Has someone already any plan to send the fix ?

Not me, too busy with other stuff (https://lkml.org/lkml/2015/10/27/451
)

Ok sure - I will do so
Laurent

Quoted 17 lines
Quoted 5 lines

Laurent

Quoted 2 lines

Yours,
Linus Walleij

--
Andy Shevchenko <[email protected]> Intel Finland Oy
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.