linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* the needless loop?
@ 2015-10-21 16:45 Shevchenko, Andriy
  2015-10-27 15:27 ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Shevchenko, Andriy @ 2015-10-21 16:45 UTC (permalink / raw)
  To: linux-gpio@vger.kernel.org; +Cc: linus.walleij@linaro.org

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?

-- 
Andy Shevchenko <andriy.shevchenko@intel.com>
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.

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

* Re: the needless loop?
  2015-10-21 16:45 the needless loop? Shevchenko, Andriy
@ 2015-10-27 15:27 ` Linus Walleij
  2015-10-28 10:07   ` Laurent MEUNIER
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2015-10-27 15:27 UTC (permalink / raw)
  To: Shevchenko, Andriy, Laurent Meunier; +Cc: linux-gpio@vger.kernel.org

On Wed, Oct 21, 2015 at 6:45 PM, Shevchenko, Andriy
<andriy.shevchenko@intel.com> wrote:

> 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?

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

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

* RE: the needless loop?
  2015-10-27 15:27 ` Linus Walleij
@ 2015-10-28 10:07   ` Laurent MEUNIER
  2015-10-28 10:50     ` Shevchenko, Andriy
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent MEUNIER @ 2015-10-28 10:07 UTC (permalink / raw)
  To: Linus Walleij, Shevchenko, Andriy; +Cc: linux-gpio@vger.kernel.org

Hi Linus, Andriy,

> On Wed, Oct 21, 2015 at 6:45 PM, Shevchenko, Andriy
> <andriy.shevchenko@intel.com> wrote:
> 
> > 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?
>
> 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

> Yours,
> Linus Walleij

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

* Re: the needless loop?
  2015-10-28 10:07   ` Laurent MEUNIER
@ 2015-10-28 10:50     ` Shevchenko, Andriy
  2015-10-28 14:35       ` Laurent MEUNIER
  0 siblings, 1 reply; 5+ messages in thread
From: Shevchenko, Andriy @ 2015-10-28 10:50 UTC (permalink / raw)
  To: laurent.meunier@st.com, linus.walleij@linaro.org
  Cc: linux-gpio@vger.kernel.org

On Wed, 2015-10-28 at 10:07 +0000, Laurent MEUNIER wrote:
> Hi Linus, Andriy,
> 
> > On Wed, Oct 21, 2015 at 6:45 PM, Shevchenko, Andriy
> > <andriy.shevchenko@intel.com> wrote:
> > 
> > > 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?
> > 
> > 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 ? 

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

> 
> Laurent
> 
> > Yours,
> > Linus Walleij

-- 
Andy Shevchenko <andriy.shevchenko@intel.com>
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.

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

* RE: the needless loop?
  2015-10-28 10:50     ` Shevchenko, Andriy
@ 2015-10-28 14:35       ` Laurent MEUNIER
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent MEUNIER @ 2015-10-28 14:35 UTC (permalink / raw)
  To: Shevchenko, Andriy, linus.walleij@linaro.org; +Cc: linux-gpio@vger.kernel.org

> > 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

> >
> > Laurent
> >
> > > Yours,
> > > Linus Walleij
> 
> --
> Andy Shevchenko <andriy.shevchenko@intel.com> 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.

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

end of thread, other threads:[~2015-10-28 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21 16:45 the needless loop? Shevchenko, Andriy
2015-10-27 15:27 ` Linus Walleij
2015-10-28 10:07   ` Laurent MEUNIER
2015-10-28 10:50     ` Shevchenko, Andriy
2015-10-28 14:35       ` Laurent MEUNIER

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).