From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Ben Dooks <ben.dooks@codethink.co.uk>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Subject: [PATCH v5 net-next v5 07/14] net: dsa: mv88e6xxx: remove table args in info lookup
Date: Mon, 20 Jun 2016 13:14:04 -0400 [thread overview]
Message-ID: <20160620171411.13746-8-vivien.didelot@savoirfairelinux.com> (raw)
In-Reply-To: <20160620171411.13746-1-vivien.didelot@savoirfairelinux.com>
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>
---
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.9.0
next prev parent reply other threads:[~2016-06-20 17:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 17:13 [PATCH v5 net-next v5 00/14] net: dsa: mv88e6xxx: probe compatible Vivien Didelot
2016-06-20 17:13 ` [PATCH v5 net-next v5 01/14] net: dsa: mv88e6xxx: fix style issues Vivien Didelot
2016-06-20 17:13 ` [PATCH v5 net-next v5 02/14] net: dsa: mv88e6xxx: remove redundant assignments Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 03/14] net: dsa: mv88e6xxx: use already declared variables Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 04/14] net: dsa: mv88e6xxx: do not increment bus refcount Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 05/14] net: dsa: mv88e6xxx: add switch register helpers Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 06/14] net: dsa: mv88e6xxx: use gpio get optional variant Vivien Didelot
2016-06-20 17:14 ` Vivien Didelot [this message]
2016-06-20 17:14 ` [PATCH v5 net-next v5 08/14] net: dsa: mv88e6xxx: rename smi_mutex to reg_lock Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 09/14] net: dsa: mv88e6xxx: add chip allocation helper Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 10/14] net: dsa: mv88e6xxx: add SMI init helper Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 11/14] net: dsa: mv88e6xxx: add detection helper Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 12/14] net: dsa: mv88e6xxx: pass compatible info Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 13/14] net: dsa: mv88e6xxx: add port base address to info Vivien Didelot
2016-06-20 17:14 ` [PATCH v5 net-next v5 14/14] net: dsa: mv88e6xxx: abstract switch registers accesses Vivien Didelot
2016-06-21 8:05 ` [PATCH v5 net-next v5 00/14] net: dsa: mv88e6xxx: probe compatible David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160620171411.13746-8-vivien.didelot@savoirfairelinux.com \
--to=vivien.didelot@savoirfairelinux.com \
--cc=andrew@lunn.ch \
--cc=ben.dooks@codethink.co.uk \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).