generic: rtl8366: add common rtl8366_sw_{get,set}_port_pvid functions
[openwrt.git] / target / linux / generic / files / drivers / net / phy / rtl8366rb.c
index 2156078..f71f4f2 100644 (file)
@@ -875,18 +875,6 @@ static int rtl8366rb_sw_set_vlan_ports(struct switch_dev *dev,
        return rtl8366_set_vlan(smi, val->port_vlan, member, untag, 0);
 }
 
-static int rtl8366rb_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
-{
-       struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
-       return rtl8366_get_pvid(smi, port, val);
-}
-
-static int rtl8366rb_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
-{
-       struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
-       return rtl8366_set_pvid(smi, port, val);
-}
-
 static int rtl8366rb_sw_reset_switch(struct switch_dev *dev)
 {
        struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
@@ -998,8 +986,8 @@ static struct switch_dev rtl8366_switch_dev = {
 
        .get_vlan_ports = rtl8366rb_sw_get_vlan_ports,
        .set_vlan_ports = rtl8366rb_sw_set_vlan_ports,
-       .get_port_pvid = rtl8366rb_sw_get_port_pvid,
-       .set_port_pvid = rtl8366rb_sw_set_port_pvid,
+       .get_port_pvid = rtl8366_sw_get_port_pvid,
+       .set_port_pvid = rtl8366_sw_set_port_pvid,
        .reset_switch = rtl8366rb_sw_reset_switch,
 };
 
@@ -1103,6 +1091,8 @@ static int rtl8366rb_detect(struct rtl8366_smi *smi)
 
 static struct rtl8366_smi_ops rtl8366rb_smi_ops = {
        .detect         = rtl8366rb_detect,
+       .setup          = rtl8366rb_setup,
+
        .mii_read       = rtl8366rb_mii_read,
        .mii_write      = rtl8366rb_mii_write,
 
@@ -1133,14 +1123,12 @@ static int __init rtl8366rb_probe(struct platform_device *pdev)
                goto err_out;
        }
 
-       smi = kzalloc(sizeof(*smi), GFP_KERNEL);
+       smi = rtl8366_smi_alloc(&pdev->dev);
        if (!smi) {
-               dev_err(&pdev->dev, "no memory for private data\n");
                err = -ENOMEM;
                goto err_out;
        }
 
-       smi->parent = &pdev->dev;
        smi->gpio_sda = pdata->gpio_sda;
        smi->gpio_sck = pdata->gpio_sck;
        smi->ops = &rtl8366rb_smi_ops;
@@ -1156,10 +1144,6 @@ static int __init rtl8366rb_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, smi);
 
-       err = rtl8366rb_setup(smi);
-       if (err)
-               goto err_clear_drvdata;
-
        err = rtl8366rb_switch_init(smi);
        if (err)
                goto err_clear_drvdata;
This page took 0.023477 seconds and 4 git commands to generate.