Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-10 Thread Vladimir Oltean
On Sun, Apr 10, 2022 at 10:30:31PM +0200, Jakob Koschel wrote: > > On 10. Apr 2022, at 22:02, Vladimir Oltean wrote: > > > > On Sun, Apr 10, 2022 at 08:24:37PM +0200, Jakob Koschel wrote: > >> Btw, I just realized that the if (!pos) is not necessary. This should > >> simply do it: > >> > >>

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-10 Thread Jakob Koschel
> On 10. Apr 2022, at 22:02, Vladimir Oltean wrote: > > On Sun, Apr 10, 2022 at 08:24:37PM +0200, Jakob Koschel wrote: >> Btw, I just realized that the if (!pos) is not necessary. This should simply >> do it: >> >> diff --git a/drivers/net/dsa/sja1105/sja1105_vl.c >>

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-10 Thread Vladimir Oltean
On Sun, Apr 10, 2022 at 08:24:37PM +0200, Jakob Koschel wrote: > Btw, I just realized that the if (!pos) is not necessary. This should simply > do it: > > diff --git a/drivers/net/dsa/sja1105/sja1105_vl.c > b/drivers/net/dsa/sja1105/sja1105_vl.c > index b7e95d60a6e4..2d59e75a9e3d 100644 > ---

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-10 Thread Jakob Koschel
> On 10. Apr 2022, at 14:39, Jakob Koschel wrote: > > > >> On 10. Apr 2022, at 13:05, Vladimir Oltean wrote: >> >> On Sun, Apr 10, 2022 at 12:51:56PM +0200, Jakob Koschel wrote: >>> I've just looked at this again in a bit more detail while integrating it >>> into the patch series. >>>

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-10 Thread Jakob Koschel
> On 10. Apr 2022, at 13:05, Vladimir Oltean wrote: > > On Sun, Apr 10, 2022 at 12:51:56PM +0200, Jakob Koschel wrote: >> I've just looked at this again in a bit more detail while integrating it >> into the patch series. >> >> I realized that this just shifts the 'problem' to using the

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-10 Thread Vladimir Oltean
On Sun, Apr 10, 2022 at 12:51:56PM +0200, Jakob Koschel wrote: > I've just looked at this again in a bit more detail while integrating it into > the patch series. > > I realized that this just shifts the 'problem' to using the 'pos' iterator > variable after the loop. > If the scope of the list

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-10 Thread Jakob Koschel
Hey Vladimir, > On 9. Apr 2022, at 01:54, Jakob Koschel wrote: > > Hello Vladimir, > >> On 8. Apr 2022, at 13:41, Vladimir Oltean wrote: >> >> Hello Jakob, >> >> On Thu, Apr 07, 2022 at 12:28:47PM +0200, Jakob Koschel wrote: >>> In preparation to limit the scope of a list iterator to the

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-08 Thread Vladimir Oltean
On Sat, Apr 09, 2022 at 01:58:29AM +0200, Jakob Koschel wrote: > Hello Jakub, > > Also the list_add() could be converted to list_add_tail(). > > Good point, I wasn't sure if that's considered as something that should be > done as a separate change. I'm happy to include it in v2. By now you

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-08 Thread Jakub Kicinski
On Sat, 9 Apr 2022 01:58:29 +0200 Jakob Koschel wrote: > > This turns a pretty slick piece of code into something ugly :( > > I'd rather you open coded the iteration here than make it more > > complex to satisfy "safe coding guidelines". > > I'm not entirely sure I understand what you mean

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-08 Thread Jakob Koschel
Hello Jakub, > On 8. Apr 2022, at 05:54, Jakub Kicinski wrote: > > On Thu, 7 Apr 2022 12:28:47 +0200 Jakob Koschel wrote: >> diff --git a/drivers/net/dsa/sja1105/sja1105_vl.c >> b/drivers/net/dsa/sja1105/sja1105_vl.c >> index b7e95d60a6e4..cfcae4d19eef 100644 >> ---

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-08 Thread Jakob Koschel
Hello Vladimir, > On 8. Apr 2022, at 13:41, Vladimir Oltean wrote: > > Hello Jakob, > > On Thu, Apr 07, 2022 at 12:28:47PM +0200, Jakob Koschel wrote: >> In preparation to limit the scope of a list iterator to the list >> traversal loop, use a dedicated pointer to point to the found element

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-08 Thread Jakob Koschel
Hey Christophe, > On 8. Apr 2022, at 09:47, Christophe Leroy > wrote: > > > > Le 07/04/2022 à 12:28, Jakob Koschel a écrit : >> In preparation to limit the scope of a list iterator to the list >> traversal loop, use a dedicated pointer to point to the found element [1]. >> >> Before, the

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-08 Thread Vladimir Oltean
Hello Jakob, On Thu, Apr 07, 2022 at 12:28:47PM +0200, Jakob Koschel wrote: > In preparation to limit the scope of a list iterator to the list > traversal loop, use a dedicated pointer to point to the found element [1]. > > Before, the code implicitly used the head when no element was found >

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-08 Thread Christophe Leroy
Le 07/04/2022 à 12:28, Jakob Koschel a écrit : > In preparation to limit the scope of a list iterator to the list > traversal loop, use a dedicated pointer to point to the found element [1]. > > Before, the code implicitly used the head when no element was found > when using >list. Since the

Re: [PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-07 Thread Jakub Kicinski
On Thu, 7 Apr 2022 12:28:47 +0200 Jakob Koschel wrote: > diff --git a/drivers/net/dsa/sja1105/sja1105_vl.c > b/drivers/net/dsa/sja1105/sja1105_vl.c > index b7e95d60a6e4..cfcae4d19eef 100644 > --- a/drivers/net/dsa/sja1105/sja1105_vl.c > +++ b/drivers/net/dsa/sja1105/sja1105_vl.c > @@ -27,20

[PATCH net-next 02/15] net: dsa: sja1105: Remove usage of iterator for list_add() after loop

2022-04-07 Thread Jakob Koschel
In preparation to limit the scope of a list iterator to the list traversal loop, use a dedicated pointer to point to the found element [1]. Before, the code implicitly used the head when no element was found when using >list. Since the new variable is only set if an element was found, the