aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/rtl8366s.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-08-04 00:43:40 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-08-04 00:43:40 +0000
commit3d5783d3c490b4da159dbf69812ebcb5f9f41b29 (patch)
treea9432c86caea410933545f281cf2bba534c5e3f4 /target/linux/generic/files/drivers/net/phy/rtl8366s.c
parent40174d507da9231e212881ea42c6a37f57e75d51 (diff)
downloadmaster-187ad058-3d5783d3c490b4da159dbf69812ebcb5f9f41b29.tar.gz
master-187ad058-3d5783d3c490b4da159dbf69812ebcb5f9f41b29.tar.bz2
master-187ad058-3d5783d3c490b4da159dbf69812ebcb5f9f41b29.zip
swconfig: cleanup of kernel drivers and interface
- add some comments to a few data structures - add a switch_dev_ops data structure for attributes and callback to replace the stupid template memcpy - get rid of the switch_dev.priv pointer - using container_of() is better git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22476 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/rtl8366s.c')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366s.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 17050451fc..7aab8341cf 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -876,12 +876,7 @@ static struct switch_attr rtl8366s_vlan[] = {
},
};
-/* template */
-static struct switch_dev rtl8366_switch_dev = {
- .name = "RTL8366S",
- .cpu_port = RTL8366S_PORT_NUM_CPU,
- .ports = RTL8366S_NUM_PORTS,
- .vlans = RTL8366S_NUM_VLANS,
+static const struct switch_dev_ops rtl8366_ops = {
.attr_global = {
.attr = rtl8366s_globals,
.n_attr = ARRAY_SIZE(rtl8366s_globals),
@@ -907,8 +902,11 @@ static int rtl8366s_switch_init(struct rtl8366_smi *smi)
struct switch_dev *dev = &smi->sw_dev;
int err;
- memcpy(dev, &rtl8366_switch_dev, sizeof(struct switch_dev));
- dev->priv = smi;
+ dev->name = "RTL8366S";
+ dev->cpu_port = RTL8366S_PORT_NUM_CPU;
+ dev->ports = RTL8366S_NUM_PORTS;
+ dev->vlans = RTL8366S_NUM_VLANS;
+ dev->ops = &rtl8366_ops;
dev->devname = dev_name(smi->parent);
err = register_switch(dev, NULL);