Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1425565 > unrolled thread

[PATCH v3 net-next v3 07/14] net: dsa: mv88e6xxx: remove table args in info lookup

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2016-06-18 02:20 +0200
Last post2016-06-18 22:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 net-next v3 07/14] net: dsa: mv88e6xxx: remove table args in info lookup Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-06-18 02:20 +0200
    Re: [PATCH v3 net-next v3 07/14] net: dsa: mv88e6xxx: remove table  args in info lookup Andrew Lunn <andrew@lunn.ch> - 2016-06-18 22:20 +0200

#1425565 — [PATCH v3 net-next v3 07/14] net: dsa: mv88e6xxx: remove table args in info lookup

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-06-18 02:20 +0200
Subject[PATCH v3 net-next v3 07/14] net: dsa: mv88e6xxx: remove table args in info lookup
Message-ID<rLc9r-57u-5@gated-at.bofh.it>
The mv88e6xxx_table array and the mv88e6xxx_lookup_info function are
static, so remove the table and size arguments from the lookup function.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 drivers/net/dsa/mv88e6xxx.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index ec28465..75e5408 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -3590,15 +3590,13 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 	},
 };
 
-static const struct mv88e6xxx_info *
-mv88e6xxx_lookup_info(unsigned int prod_num, const struct mv88e6xxx_info *table,
-		      unsigned int num)
+static const struct mv88e6xxx_info *mv88e6xxx_lookup_info(unsigned int prod_num)
 {
 	int i;
 
-	for (i = 0; i < num; ++i)
-		if (table[i].prod_num == prod_num)
-			return &table[i];
+	for (i = 0; i < ARRAY_SIZE(mv88e6xxx_table); ++i)
+		if (mv88e6xxx_table[i].prod_num == prod_num)
+			return &mv88e6xxx_table[i];
 
 	return NULL;
 }
@@ -3625,8 +3623,7 @@ static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,
 	prod_num = (id & 0xfff0) >> 4;
 	rev = id & 0x000f;
 
-	info = mv88e6xxx_lookup_info(prod_num, mv88e6xxx_table,
-				     ARRAY_SIZE(mv88e6xxx_table));
+	info = mv88e6xxx_lookup_info(prod_num);
 	if (!info)
 		return NULL;
 
@@ -3739,8 +3736,7 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
 	prod_num = (id & 0xfff0) >> 4;
 	rev = id & 0x000f;
 
-	ps->info = mv88e6xxx_lookup_info(prod_num, mv88e6xxx_table,
-					 ARRAY_SIZE(mv88e6xxx_table));
+	ps->info = mv88e6xxx_lookup_info(prod_num);
 	if (!ps->info)
 		return -ENODEV;
 
-- 
2.8.3

[toc] | [next] | [standalone]


#1425832 — Re: [PATCH v3 net-next v3 07/14] net: dsa: mv88e6xxx: remove table args in info lookup

FromAndrew Lunn <andrew@lunn.ch>
Date2016-06-18 22:20 +0200
SubjectRe: [PATCH v3 net-next v3 07/14] net: dsa: mv88e6xxx: remove table args in info lookup
Message-ID<rLuSJ-qu-1@gated-at.bofh.it>
In reply to#1425565
On Fri, Jun 17, 2016 at 08:07:29PM -0400, Vivien Didelot wrote:
> The mv88e6xxx_table array and the mv88e6xxx_lookup_info function are
> static, so remove the table and size arguments from the lookup function.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web