* [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata
@ 2016-07-05 22:07 Florian Fainelli
2016-07-05 22:07 ` [PATCH net-next v2 1/4] net: dsa: Pass device pointer to dsa_register_switch Florian Fainelli
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Florian Fainelli @ 2016-07-05 22:07 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
Hi all,
This is a resend of the patches that just clean up and prepare net/dsa/dsa2.c
to support platform data in the future.
Florian Fainelli (4):
net: dsa: Pass device pointer to dsa_register_switch
net: dsa: Make most functions take a dsa_port argument
net: dsa: Suffix function manipulating device_node with _dn
net: dsa: Move ports assignment closer to error checking
drivers/net/dsa/b53/b53_common.c | 2 +-
drivers/net/dsa/mv88e6xxx/chip.c | 7 ++--
include/net/dsa.h | 2 +-
net/dsa/dsa.c | 14 ++++---
net/dsa/dsa2.c | 87 ++++++++++++++++++++++------------------
net/dsa/dsa_priv.h | 4 +-
6 files changed, 62 insertions(+), 54 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next v2 1/4] net: dsa: Pass device pointer to dsa_register_switch
2016-07-05 22:07 [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Florian Fainelli
@ 2016-07-05 22:07 ` Florian Fainelli
2016-07-05 22:23 ` Andrew Lunn
2016-07-05 22:07 ` [PATCH net-next v2 2/4] net: dsa: Make most functions take a dsa_port argument Florian Fainelli
` (3 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Florian Fainelli @ 2016-07-05 22:07 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
In preparation for allowing dsa_register_switch() to be supplied with
device/platform data, pass down a struct device pointer instead of a
struct device_node.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 2 +-
drivers/net/dsa/mv88e6xxx/chip.c | 7 +++----
include/net/dsa.h | 2 +-
net/dsa/dsa2.c | 7 ++++---
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 444de66667b9..e5799a68cfc8 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1778,7 +1778,7 @@ int b53_switch_register(struct b53_device *dev)
pr_info("found switch: %s, rev %i\n", dev->name, dev->core_rev);
- return dsa_register_switch(dev->ds, dev->ds->dev->of_node);
+ return dsa_register_switch(dev->ds, dev->ds->dev);
}
EXPORT_SYMBOL(b53_switch_register);
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 5cb06f7673af..11617c04cd33 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3848,8 +3848,7 @@ static struct dsa_switch_driver mv88e6xxx_switch_driver = {
.port_fdb_dump = mv88e6xxx_port_fdb_dump,
};
-static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip,
- struct device_node *np)
+static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
{
struct device *dev = chip->dev;
struct dsa_switch *ds;
@@ -3864,7 +3863,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip,
dev_set_drvdata(dev, ds);
- return dsa_register_switch(ds, np);
+ return dsa_register_switch(ds, dev);
}
static void mv88e6xxx_unregister_switch(struct mv88e6xxx_chip *chip)
@@ -3911,7 +3910,7 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
if (err)
return err;
- err = mv88e6xxx_register_switch(chip, np);
+ err = mv88e6xxx_register_switch(chip);
if (err) {
mv88e6xxx_mdio_unregister(chip);
return err;
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 20b3087ad193..6de162c8283e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -381,5 +381,5 @@ static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
}
void dsa_unregister_switch(struct dsa_switch *ds);
-int dsa_register_switch(struct dsa_switch *ds, struct device_node *np);
+int dsa_register_switch(struct dsa_switch *ds, struct device *dev);
#endif
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 83b95fc4cede..0940a0ec83e6 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -590,8 +590,9 @@ static struct device_node *dsa_get_ports(struct dsa_switch *ds,
return ports;
}
-static int _dsa_register_switch(struct dsa_switch *ds, struct device_node *np)
+static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev)
{
+ struct device_node *np = dev->of_node;
struct device_node *ports = dsa_get_ports(ds, np);
struct dsa_switch_tree *dst;
u32 tree, index;
@@ -660,12 +661,12 @@ out:
return err;
}
-int dsa_register_switch(struct dsa_switch *ds, struct device_node *np)
+int dsa_register_switch(struct dsa_switch *ds, struct device *dev)
{
int err;
mutex_lock(&dsa2_mutex);
- err = _dsa_register_switch(ds, np);
+ err = _dsa_register_switch(ds, dev);
mutex_unlock(&dsa2_mutex);
return err;
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v2 2/4] net: dsa: Make most functions take a dsa_port argument
2016-07-05 22:07 [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Florian Fainelli
2016-07-05 22:07 ` [PATCH net-next v2 1/4] net: dsa: Pass device pointer to dsa_register_switch Florian Fainelli
@ 2016-07-05 22:07 ` Florian Fainelli
2016-07-05 22:30 ` Andrew Lunn
2016-07-05 22:07 ` [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn Florian Fainelli
` (2 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Florian Fainelli @ 2016-07-05 22:07 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
In preparation for allowing platform data, and therefore no valid
device_node pointer, make most DSA functions takes a pointer to a
dsa_port structure whenever possible. While at it, introduce a
dsa_port_is_valid() helper function which checks whether port->dn is
NULL or not at the moment.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa.c | 14 +++++++------
net/dsa/dsa2.c | 61 +++++++++++++++++++++++++++++-------------------------
net/dsa/dsa_priv.h | 4 ++--
3 files changed, 43 insertions(+), 36 deletions(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 766d2a525ada..d117580a78b6 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -208,8 +208,9 @@ __ATTRIBUTE_GROUPS(dsa_hwmon);
/* basic switch operations **************************************************/
int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
- struct device_node *port_dn, int port)
+ struct dsa_port *dport, int port)
{
+ struct device_node *port_dn = dport->dn;
struct phy_device *phydev;
int ret, mode;
@@ -237,15 +238,15 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
static int dsa_cpu_dsa_setups(struct dsa_switch *ds, struct device *dev)
{
- struct device_node *port_dn;
+ struct dsa_port *dport;
int ret, port;
for (port = 0; port < DSA_MAX_PORTS; port++) {
if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)))
continue;
- port_dn = ds->ports[port].dn;
- ret = dsa_cpu_dsa_setup(ds, dev, port_dn, port);
+ dport = &ds->ports[port];
+ ret = dsa_cpu_dsa_setup(ds, dev, dport, port);
if (ret)
return ret;
}
@@ -494,8 +495,9 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
return ds;
}
-void dsa_cpu_dsa_destroy(struct device_node *port_dn)
+void dsa_cpu_dsa_destroy(struct dsa_port *port)
{
+ struct device_node *port_dn = port->dn;
struct phy_device *phydev;
if (of_phy_is_fixed_link(port_dn)) {
@@ -531,7 +533,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
for (port = 0; port < DSA_MAX_PORTS; port++) {
if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)))
continue;
- dsa_cpu_dsa_destroy(ds->ports[port].dn);
+ dsa_cpu_dsa_destroy(&ds->ports[port]);
/* Clearing a bit which is not set does no harm */
ds->cpu_port_mask |= ~(1 << port);
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 0940a0ec83e6..3a782ceef716 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -77,11 +77,16 @@ static void dsa_dst_del_ds(struct dsa_switch_tree *dst,
kref_put(&dst->refcount, dsa_free_dst);
}
-static bool dsa_port_is_dsa(struct device_node *port)
+static bool dsa_port_is_valid(struct dsa_port *port)
+{
+ return !!port->dn;
+}
+
+static bool dsa_port_is_dsa(struct dsa_port *port)
{
const char *name;
- name = of_get_property(port, "label", NULL);
+ name = of_get_property(port->dn, "label", NULL);
if (!name)
return false;
@@ -91,11 +96,11 @@ static bool dsa_port_is_dsa(struct device_node *port)
return false;
}
-static bool dsa_port_is_cpu(struct device_node *port)
+static bool dsa_port_is_cpu(struct dsa_port *port)
{
const char *name;
- name = of_get_property(port, "label", NULL);
+ name = of_get_property(port->dn, "label", NULL);
if (!name)
return false;
@@ -136,7 +141,7 @@ static struct dsa_switch *dsa_dst_find_port(struct dsa_switch_tree *dst,
static int dsa_port_complete(struct dsa_switch_tree *dst,
struct dsa_switch *src_ds,
- struct device_node *port,
+ struct dsa_port *port,
u32 src_port)
{
struct device_node *link;
@@ -144,7 +149,7 @@ static int dsa_port_complete(struct dsa_switch_tree *dst,
struct dsa_switch *dst_ds;
for (index = 0;; index++) {
- link = of_parse_phandle(port, "link", index);
+ link = of_parse_phandle(port->dn, "link", index);
if (!link)
break;
@@ -167,13 +172,13 @@ static int dsa_port_complete(struct dsa_switch_tree *dst,
*/
static int dsa_ds_complete(struct dsa_switch_tree *dst, struct dsa_switch *ds)
{
- struct device_node *port;
+ struct dsa_port *port;
u32 index;
int err;
for (index = 0; index < DSA_MAX_PORTS; index++) {
- port = ds->ports[index].dn;
- if (!port)
+ port = &ds->ports[index];
+ if (!dsa_port_is_valid(port))
continue;
if (!dsa_port_is_dsa(port))
@@ -213,7 +218,7 @@ static int dsa_dst_complete(struct dsa_switch_tree *dst)
return 0;
}
-static int dsa_dsa_port_apply(struct device_node *port, u32 index,
+static int dsa_dsa_port_apply(struct dsa_port *port, u32 index,
struct dsa_switch *ds)
{
int err;
@@ -228,13 +233,13 @@ static int dsa_dsa_port_apply(struct device_node *port, u32 index,
return 0;
}
-static void dsa_dsa_port_unapply(struct device_node *port, u32 index,
+static void dsa_dsa_port_unapply(struct dsa_port *port, u32 index,
struct dsa_switch *ds)
{
dsa_cpu_dsa_destroy(port);
}
-static int dsa_cpu_port_apply(struct device_node *port, u32 index,
+static int dsa_cpu_port_apply(struct dsa_port *port, u32 index,
struct dsa_switch *ds)
{
int err;
@@ -251,7 +256,7 @@ static int dsa_cpu_port_apply(struct device_node *port, u32 index,
return 0;
}
-static void dsa_cpu_port_unapply(struct device_node *port, u32 index,
+static void dsa_cpu_port_unapply(struct dsa_port *port, u32 index,
struct dsa_switch *ds)
{
dsa_cpu_dsa_destroy(port);
@@ -259,13 +264,13 @@ static void dsa_cpu_port_unapply(struct device_node *port, u32 index,
}
-static int dsa_user_port_apply(struct device_node *port, u32 index,
+static int dsa_user_port_apply(struct dsa_port *port, u32 index,
struct dsa_switch *ds)
{
const char *name;
int err;
- name = of_get_property(port, "label", NULL);
+ name = of_get_property(port->dn, "label", NULL);
err = dsa_slave_create(ds, ds->dev, index, name);
if (err) {
@@ -277,7 +282,7 @@ static int dsa_user_port_apply(struct device_node *port, u32 index,
return 0;
}
-static void dsa_user_port_unapply(struct device_node *port, u32 index,
+static void dsa_user_port_unapply(struct dsa_port *port, u32 index,
struct dsa_switch *ds)
{
if (ds->ports[index].netdev) {
@@ -289,7 +294,7 @@ static void dsa_user_port_unapply(struct device_node *port, u32 index,
static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
{
- struct device_node *port;
+ struct dsa_port *port;
u32 index;
int err;
@@ -325,8 +330,8 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
}
for (index = 0; index < DSA_MAX_PORTS; index++) {
- port = ds->ports[index].dn;
- if (!port)
+ port = &ds->ports[index];
+ if (!dsa_port_is_valid(port))
continue;
if (dsa_port_is_dsa(port)) {
@@ -353,12 +358,12 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
static void dsa_ds_unapply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
{
- struct device_node *port;
+ struct dsa_port *port;
u32 index;
for (index = 0; index < DSA_MAX_PORTS; index++) {
- port = ds->ports[index].dn;
- if (!port)
+ port = &ds->ports[index];
+ if (!dsa_port_is_valid(port))
continue;
if (dsa_port_is_dsa(port)) {
@@ -439,14 +444,14 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
dst->applied = false;
}
-static int dsa_cpu_parse(struct device_node *port, u32 index,
+static int dsa_cpu_parse(struct dsa_port *port, u32 index,
struct dsa_switch_tree *dst,
struct dsa_switch *ds)
{
struct net_device *ethernet_dev;
struct device_node *ethernet;
- ethernet = of_parse_phandle(port, "ethernet", 0);
+ ethernet = of_parse_phandle(port->dn, "ethernet", 0);
if (!ethernet)
return -EINVAL;
@@ -478,13 +483,13 @@ static int dsa_cpu_parse(struct device_node *port, u32 index,
static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds)
{
- struct device_node *port;
+ struct dsa_port *port;
u32 index;
int err;
for (index = 0; index < DSA_MAX_PORTS; index++) {
- port = ds->ports[index].dn;
- if (!port)
+ port = &ds->ports[index];
+ if (!dsa_port_is_valid(port))
continue;
if (dsa_port_is_cpu(port)) {
@@ -545,7 +550,7 @@ static int dsa_parse_ports_dn(struct device_node *ports, struct dsa_switch *ds)
* to have access to a correct value, just like what
* net/dsa/dsa.c::dsa_switch_setup_one does.
*/
- if (!dsa_port_is_cpu(port))
+ if (!dsa_port_is_cpu(&ds->ports[reg]))
ds->enabled_port_mask |= 1 << reg;
}
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 00077a9c97f4..3dbc9ce10ab0 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -51,8 +51,8 @@ struct dsa_slave_priv {
/* dsa.c */
extern char dsa_driver_version[];
int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
- struct device_node *port_dn, int port);
-void dsa_cpu_dsa_destroy(struct device_node *port_dn);
+ struct dsa_port *dport, int port);
+void dsa_cpu_dsa_destroy(struct dsa_port *dport);
const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds);
void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds);
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn
2016-07-05 22:07 [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Florian Fainelli
2016-07-05 22:07 ` [PATCH net-next v2 1/4] net: dsa: Pass device pointer to dsa_register_switch Florian Fainelli
2016-07-05 22:07 ` [PATCH net-next v2 2/4] net: dsa: Make most functions take a dsa_port argument Florian Fainelli
@ 2016-07-05 22:07 ` Florian Fainelli
2016-07-05 22:36 ` Andrew Lunn
2016-07-05 22:07 ` [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking Florian Fainelli
2016-07-07 2:00 ` [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Vivien Didelot
4 siblings, 1 reply; 15+ messages in thread
From: Florian Fainelli @ 2016-07-05 22:07 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
Make it clear that these functions take a device_node structure pointer
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa2.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 3a782ceef716..bdde5d217326 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -110,8 +110,8 @@ static bool dsa_port_is_cpu(struct dsa_port *port)
return false;
}
-static bool dsa_ds_find_port(struct dsa_switch *ds,
- struct device_node *port)
+static bool dsa_ds_find_port_dn(struct dsa_switch *ds,
+ struct device_node *port)
{
u32 index;
@@ -121,8 +121,8 @@ static bool dsa_ds_find_port(struct dsa_switch *ds,
return false;
}
-static struct dsa_switch *dsa_dst_find_port(struct dsa_switch_tree *dst,
- struct device_node *port)
+static struct dsa_switch *dsa_dst_find_port_dn(struct dsa_switch_tree *dst,
+ struct device_node *port)
{
struct dsa_switch *ds;
u32 index;
@@ -132,7 +132,7 @@ static struct dsa_switch *dsa_dst_find_port(struct dsa_switch_tree *dst,
if (!ds)
continue;
- if (dsa_ds_find_port(ds, port))
+ if (dsa_ds_find_port_dn(ds, port))
return ds;
}
@@ -153,7 +153,7 @@ static int dsa_port_complete(struct dsa_switch_tree *dst,
if (!link)
break;
- dst_ds = dsa_dst_find_port(dst, link);
+ dst_ds = dsa_dst_find_port_dn(dst, link);
of_node_put(link);
if (!dst_ds)
@@ -557,7 +557,7 @@ static int dsa_parse_ports_dn(struct device_node *ports, struct dsa_switch *ds)
return 0;
}
-static int dsa_parse_member(struct device_node *np, u32 *tree, u32 *index)
+static int dsa_parse_member_dn(struct device_node *np, u32 *tree, u32 *index)
{
int err;
@@ -603,7 +603,7 @@ static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev)
u32 tree, index;
int err;
- err = dsa_parse_member(np, &tree, &index);
+ err = dsa_parse_member_dn(np, &tree, &index);
if (err)
return err;
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking
2016-07-05 22:07 [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Florian Fainelli
` (2 preceding siblings ...)
2016-07-05 22:07 ` [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn Florian Fainelli
@ 2016-07-05 22:07 ` Florian Fainelli
2016-07-05 22:37 ` Andrew Lunn
2016-07-06 11:50 ` Sergei Shtylyov
2016-07-07 2:00 ` [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Vivien Didelot
4 siblings, 2 replies; 15+ messages in thread
From: Florian Fainelli @ 2016-07-05 22:07 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
Move the assignment of ports in _dsa_register_switch() closer to where
it is checked, no functional change. Re-order declarations to be
preserve the inverted christmas tree style.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index bdde5d217326..a565bd919aa3 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -598,8 +598,8 @@ static struct device_node *dsa_get_ports(struct dsa_switch *ds,
static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev)
{
struct device_node *np = dev->of_node;
- struct device_node *ports = dsa_get_ports(ds, np);
struct dsa_switch_tree *dst;
+ struct device_node *ports;
u32 tree, index;
int err;
@@ -607,6 +607,7 @@ static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev)
if (err)
return err;
+ ports = dsa_get_ports(ds, np);
if (IS_ERR(ports))
return PTR_ERR(ports);
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 1/4] net: dsa: Pass device pointer to dsa_register_switch
2016-07-05 22:07 ` [PATCH net-next v2 1/4] net: dsa: Pass device pointer to dsa_register_switch Florian Fainelli
@ 2016-07-05 22:23 ` Andrew Lunn
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2016-07-05 22:23 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot
On Tue, Jul 05, 2016 at 03:07:10PM -0700, Florian Fainelli wrote:
> In preparation for allowing dsa_register_switch() to be supplied with
> device/platform data, pass down a struct device pointer instead of a
> struct device_node.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 2/4] net: dsa: Make most functions take a dsa_port argument
2016-07-05 22:07 ` [PATCH net-next v2 2/4] net: dsa: Make most functions take a dsa_port argument Florian Fainelli
@ 2016-07-05 22:30 ` Andrew Lunn
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2016-07-05 22:30 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot
On Tue, Jul 05, 2016 at 03:07:11PM -0700, Florian Fainelli wrote:
> In preparation for allowing platform data, and therefore no valid
> device_node pointer, make most DSA functions takes a pointer to a
> dsa_port structure whenever possible. While at it, introduce a
> dsa_port_is_valid() helper function which checks whether port->dn is
> NULL or not at the moment.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn
2016-07-05 22:07 ` [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn Florian Fainelli
@ 2016-07-05 22:36 ` Andrew Lunn
2016-07-05 22:43 ` Florian Fainelli
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Lunn @ 2016-07-05 22:36 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot
On Tue, Jul 05, 2016 at 03:07:12PM -0700, Florian Fainelli wrote:
> Make it clear that these functions take a device_node structure pointer
Hi Florian
Didn't we agree that we would only support a single device via a C
coded platform data structure?
All the functions you are renaming will never be called in that
case. So i think they can retain there names. You have no need to add
none device node equivalents.
So lets drop this patch.
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking
2016-07-05 22:07 ` [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking Florian Fainelli
@ 2016-07-05 22:37 ` Andrew Lunn
2016-07-06 11:50 ` Sergei Shtylyov
1 sibling, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2016-07-05 22:37 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot
On Tue, Jul 05, 2016 at 03:07:13PM -0700, Florian Fainelli wrote:
> Move the assignment of ports in _dsa_register_switch() closer to where
> it is checked, no functional change. Re-order declarations to be
> preserve the inverted christmas tree style.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn
2016-07-05 22:36 ` Andrew Lunn
@ 2016-07-05 22:43 ` Florian Fainelli
2016-07-05 22:52 ` Andrew Lunn
2016-07-06 1:59 ` Vivien Didelot
0 siblings, 2 replies; 15+ messages in thread
From: Florian Fainelli @ 2016-07-05 22:43 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, davem, vivien.didelot
On 07/05/2016 03:36 PM, Andrew Lunn wrote:
> On Tue, Jul 05, 2016 at 03:07:12PM -0700, Florian Fainelli wrote:
>> Make it clear that these functions take a device_node structure pointer
>
> Hi Florian
>
> Didn't we agree that we would only support a single device via a C
> coded platform data structure?
That is true for the devices I know about, both in and out of tree,
however, while discussing offline with Vivien it seemed like there was a
potential need for having a x86-based platform which could need that,
Vivien do you think this platform could be in-tree one day (if not already)?
>
> All the functions you are renaming will never be called in that
> case. So i think they can retain there names. You have no need to add
> none device node equivalents.
>
> So lets drop this patch.
>
> Andrew
>
--
Florian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn
2016-07-05 22:43 ` Florian Fainelli
@ 2016-07-05 22:52 ` Andrew Lunn
2016-07-06 1:59 ` Vivien Didelot
1 sibling, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2016-07-05 22:52 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot
> That is true for the devices I know about, both in and out of tree,
> however, while discussing offline with Vivien it seemed like there was a
> potential need for having a x86-based platform which could need that,
> Vivien do you think this platform could be in-tree one day (if not already)?
x86 can do device tree. And if it is a complex board, it probably
needs more of the device tree features like fixed-phys, phy-mode,
devlink when it lands, etc.
If this board really does come to mainline, we should consider support
for it, one way or the other, but until then, i prefer KISS.
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn
2016-07-05 22:43 ` Florian Fainelli
2016-07-05 22:52 ` Andrew Lunn
@ 2016-07-06 1:59 ` Vivien Didelot
2016-07-07 17:57 ` Florian Fainelli
1 sibling, 1 reply; 15+ messages in thread
From: Vivien Didelot @ 2016-07-06 1:59 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn; +Cc: netdev, davem
Hi,
Florian Fainelli <f.fainelli@gmail.com> writes:
> On 07/05/2016 03:36 PM, Andrew Lunn wrote:
>> On Tue, Jul 05, 2016 at 03:07:12PM -0700, Florian Fainelli wrote:
>>> Make it clear that these functions take a device_node structure pointer
>>
>> Hi Florian
>>
>> Didn't we agree that we would only support a single device via a C
>> coded platform data structure?
>
> That is true for the devices I know about, both in and out of tree,
> however, while discussing offline with Vivien it seemed like there was a
> potential need for having a x86-based platform which could need that,
> Vivien do you think this platform could be in-tree one day (if not already)?
This customer platform is not mainlined yet and I cannot say today if it
will be. However it is likely to get a new revision soon with 3
interconnected 6352 hanging the x86 Baytrail.
DT on x86 is possible, but not straight-forward, and thanks to Florian's
work the pdata support is almost there for free.
>> All the functions you are renaming will never be called in that
>> case. So i think they can retain there names. You have no need to add
>> none device node equivalents.
>>
>> So lets drop this patch.
The patch is not big and I think it doesn't hurt to add that explicit
suffix, I'd keep the patch in the series.
Thanks,
Vivien
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking
2016-07-05 22:07 ` [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking Florian Fainelli
2016-07-05 22:37 ` Andrew Lunn
@ 2016-07-06 11:50 ` Sergei Shtylyov
1 sibling, 0 replies; 15+ messages in thread
From: Sergei Shtylyov @ 2016-07-06 11:50 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: davem, andrew, vivien.didelot
Hello.
On 7/6/2016 1:07 AM, Florian Fainelli wrote:
> Move the assignment of ports in _dsa_register_switch() closer to where
> it is checked, no functional change. Re-order declarations to be
"Be" doesn't seem needed here.
> preserve the inverted christmas tree style.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata
2016-07-05 22:07 [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Florian Fainelli
` (3 preceding siblings ...)
2016-07-05 22:07 ` [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking Florian Fainelli
@ 2016-07-07 2:00 ` Vivien Didelot
4 siblings, 0 replies; 15+ messages in thread
From: Vivien Didelot @ 2016-07-07 2:00 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: davem, andrew, Florian Fainelli
Hi,
Florian Fainelli <f.fainelli@gmail.com> writes:
> Hi all,
>
> This is a resend of the patches that just clean up and prepare net/dsa/dsa2.c
> to support platform data in the future.
>
> Florian Fainelli (4):
> net: dsa: Pass device pointer to dsa_register_switch
> net: dsa: Make most functions take a dsa_port argument
> net: dsa: Suffix function manipulating device_node with _dn
> net: dsa: Move ports assignment closer to error checking
>
> drivers/net/dsa/b53/b53_common.c | 2 +-
> drivers/net/dsa/mv88e6xxx/chip.c | 7 ++--
> include/net/dsa.h | 2 +-
> net/dsa/dsa.c | 14 ++++---
> net/dsa/dsa2.c | 87 ++++++++++++++++++++++------------------
> net/dsa/dsa_priv.h | 4 +-
> 6 files changed, 62 insertions(+), 54 deletions(-)
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Thanks,
Vivien
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn
2016-07-06 1:59 ` Vivien Didelot
@ 2016-07-07 17:57 ` Florian Fainelli
0 siblings, 0 replies; 15+ messages in thread
From: Florian Fainelli @ 2016-07-07 17:57 UTC (permalink / raw)
To: Vivien Didelot, Andrew Lunn; +Cc: netdev, davem
On 07/05/2016 06:59 PM, Vivien Didelot wrote:
> Hi,
>
> Florian Fainelli <f.fainelli@gmail.com> writes:
>
>> On 07/05/2016 03:36 PM, Andrew Lunn wrote:
>>> On Tue, Jul 05, 2016 at 03:07:12PM -0700, Florian Fainelli wrote:
>>>> Make it clear that these functions take a device_node structure pointer
>>>
>>> Hi Florian
>>>
>>> Didn't we agree that we would only support a single device via a C
>>> coded platform data structure?
>>
>> That is true for the devices I know about, both in and out of tree,
>> however, while discussing offline with Vivien it seemed like there was a
>> potential need for having a x86-based platform which could need that,
>> Vivien do you think this platform could be in-tree one day (if not already)?
>
> This customer platform is not mainlined yet and I cannot say today if it
> will be. However it is likely to get a new revision soon with 3
> interconnected 6352 hanging the x86 Baytrail.
>
> DT on x86 is possible, but not straight-forward, and thanks to Florian's
> work the pdata support is almost there for free.
>
>>> All the functions you are renaming will never be called in that
>>> case. So i think they can retain there names. You have no need to add
>>> none device node equivalents.
>>>
>>> So lets drop this patch.
>
> The patch is not big and I think it doesn't hurt to add that explicit
> suffix, I'd keep the patch in the series.
Either way is fine with me really, we can drop this patch, add it later,
not add it, up to you guys. I think the 3 others could go in as they are
pretty self contained, your call David.
--
Florian
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-07-07 17:57 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-05 22:07 [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Florian Fainelli
2016-07-05 22:07 ` [PATCH net-next v2 1/4] net: dsa: Pass device pointer to dsa_register_switch Florian Fainelli
2016-07-05 22:23 ` Andrew Lunn
2016-07-05 22:07 ` [PATCH net-next v2 2/4] net: dsa: Make most functions take a dsa_port argument Florian Fainelli
2016-07-05 22:30 ` Andrew Lunn
2016-07-05 22:07 ` [PATCH net-next v2 3/4] net: dsa: Suffix function manipulating device_node with _dn Florian Fainelli
2016-07-05 22:36 ` Andrew Lunn
2016-07-05 22:43 ` Florian Fainelli
2016-07-05 22:52 ` Andrew Lunn
2016-07-06 1:59 ` Vivien Didelot
2016-07-07 17:57 ` Florian Fainelli
2016-07-05 22:07 ` [PATCH net-next v2 4/4] net: dsa: Move ports assignment closer to error checking Florian Fainelli
2016-07-05 22:37 ` Andrew Lunn
2016-07-06 11:50 ` Sergei Shtylyov
2016-07-07 2:00 ` [PATCH net-next v2 0/4] net: dsa: Preparatory patches for pdata Vivien Didelot
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).