From 6886519f62cf784ed12a0367fa100092130d8522 Mon Sep 17 00:00:00 2001 From: blogic Date: Sat, 15 Dec 2012 01:59:08 +0000 Subject: [kernel] make rtl8366 driver OF capable git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34682 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/generic/files/drivers/net/phy/rtl8366s.c | 30 ++++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'target/linux/generic/files/drivers/net/phy/rtl8366s.c') diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c index 77427d6c9..6e5e48749 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -1059,22 +1059,9 @@ static int __devinit rtl8366s_probe(struct platform_device *pdev) printk(KERN_NOTICE RTL8366S_DRIVER_DESC " version " RTL8366S_DRIVER_VER"\n"); - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "no platform data specified\n"); - err = -EINVAL; - goto err_out; - } - - smi = rtl8366_smi_alloc(&pdev->dev); - if (!smi) { - err = -ENOMEM; - goto err_out; - } - - smi->gpio_sda = pdata->gpio_sda; - smi->gpio_sck = pdata->gpio_sck; - smi->hw_reset = pdata->hw_reset; + smi = rtl8366_smi_probe(pdev); + if (!smi) + return -ENODEV; smi->clk_delay = 10; smi->cmd_read = 0xa9; @@ -1121,10 +1108,19 @@ static int __devexit rtl8366s_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id rtl8366s_match[] = { + { .compatible = "rtl8366s" }, + {}, +}; +MODULE_DEVICE_TABLE(of, rtl8366s_match); +#endif + static struct platform_driver rtl8366s_driver = { .driver = { .name = RTL8366S_DRIVER_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(rtl8366s_match), }, .probe = rtl8366s_probe, .remove = __devexit_p(rtl8366s_remove), -- cgit v1.2.3 From 6f8f4723ff1b59d2e5723da351e8a47fbaa30350 Mon Sep 17 00:00:00 2001 From: jogo Date: Sat, 15 Dec 2012 13:32:02 +0000 Subject: linux: generic: rtl836*: fix compilation with !CONFIG_OF fixes the following errors caused by r34682: CC [M] drivers/net/phy/rtl8366_smi.o In file included from drivers/net/phy/rtl8366_smi.c:26:0: drivers/net/phy/rtl8366_smi.h:149:46: warning: 'struct platform_device' declared inside parameter list [enabled by default] drivers/net/phy/rtl8366_smi.h:149:46: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] drivers/net/phy/rtl8366_smi.c:1398:65: warning: 'struct platform_device' declared inside parameter list [enabled by default] drivers/net/phy/rtl8366_smi.c: In function 'rtl8366_smi_probe_plat': drivers/net/phy/rtl8366_smi.c:1400:44: error: dereferencing pointer to incomplete type drivers/net/phy/rtl8366_smi.c:1402:11: error: dereferencing pointer to incomplete type drivers/net/phy/rtl8366_smi.c:1403:16: error: dereferencing pointer to incomplete type drivers/net/phy/rtl8366_smi.c: At top level: drivers/net/phy/rtl8366_smi.c:1415:46: warning: 'struct platform_device' declared inside parameter list [enabled by default] drivers/net/phy/rtl8366_smi.c:1415:21: error: conflicting types for 'rtl8366_smi_probe' drivers/net/phy/rtl8366_smi.h:149:21: note: previous declaration of 'rtl8366_smi_probe' was here drivers/net/phy/rtl8366_smi.c: In function 'rtl8366_smi_probe': drivers/net/phy/rtl8366_smi.c:1420:31: error: dereferencing pointer to incomplete type drivers/net/phy/rtl8366_smi.c:1424:10: error: dereferencing pointer to incomplete type drivers/net/phy/rtl8366_smi.c:1425:3: warning: passing argument 1 of 'rtl8366_smi_probe_of' from incompatible pointer type [enabled by default] drivers/net/phy/rtl8366_smi.c:1392:19: note: expected 'struct device_node *' but argument is of type 'struct platform_device *' drivers/net/phy/rtl8366_smi.c:1427:3: warning: passing argument 1 of 'rtl8366_smi_probe_plat' from incompatible pointer type [enabled by default] drivers/net/phy/rtl8366_smi.c:1398:5: note: expected 'struct platform_device *' but argument is of type 'struct platform_device *' drivers/net/phy/rtl8366_smi.c: At top level: drivers/net/phy/rtl8366_smi.c:1438:1: error: conflicting types for 'rtl8366_smi_probe' drivers/net/phy/rtl8366_smi.h:149:21: note: previous declaration of 'rtl8366_smi_probe' was here make[7]: *** [drivers/net/phy/rtl8366_smi.o] Error 1 make[6]: *** [drivers/net/phy] Error 2 make[5]: *** [drivers/net] Error 2 make[4]: *** [drivers] Error 2 Signed-off-by: Jonas Gorski git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34703 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/drivers/net/phy/rtl8366s.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'target/linux/generic/files/drivers/net/phy/rtl8366s.c') diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c index 6e5e48749..42b193933 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -1120,7 +1121,9 @@ static struct platform_driver rtl8366s_driver = { .driver = { .name = RTL8366S_DRIVER_NAME, .owner = THIS_MODULE, +#ifdef CONFIG_OF .of_match_table = of_match_ptr(rtl8366s_match), +#endif }, .probe = rtl8366s_probe, .remove = __devexit_p(rtl8366s_remove), -- cgit v1.2.3 From 1a20d913f9cea25528a396a129303f9e6405c616 Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 17 Dec 2012 13:02:18 +0000 Subject: generic: rtl836x: fix compiler warnings CC drivers/net/phy/rtl8366rb.o In file included from drivers/net/phy/rtl8366s.c:16:0: include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default] include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] drivers/net/phy/rtl8366s.c: In function 'rtl8366s_probe': drivers/net/phy/rtl8366s.c:1094:2: warning: label 'err_out' defined but not used [-Wunused-label] drivers/net/phy/rtl8366s.c:1055:32: warning: unused variable 'pdata'[-Wunused-variable] CC drivers/net/phy/rtl8366rb.o In file included from drivers/net/phy/rtl8366rb.c:17:0: include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default] include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] drivers/net/phy/rtl8366rb.c: In function 'rtl8366rb_probe': drivers/net/phy/rtl8366rb.c:1214:2: warning: label 'err_out' defined but not used [-Wunused-label] drivers/net/phy/rtl8366rb.c:1175:32: warning: unused variable 'pdata'[-Wunused-variable] CC drivers/net/phy/rtl8367.o In file included from drivers/net/phy/rtl8367.c:15:0: include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default] include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] drivers/net/phy/rtl8367.c: In function 'rtl8367_probe': drivers/net/phy/rtl8367.c:1712:2: warning: label 'err_out' defined but not used [-Wunused-label] drivers/net/phy/rtl8367.c:1677:32: warning: unused variable 'pdata' [-Wunused-variable] CC drivers/net/phy/rtl8367b.o In file included from drivers/net/phy/rtl8367b.c:15:0: include/linux/of_platform.h:106:13: warning: 'struct device' declared inside parameter list [enabled by default] include/linux/of_platform.h:106:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] drivers/net/phy/rtl8367b.c: In function 'rtl8367b_probe': drivers/net/phy/rtl8367b.c:1494:2: warning: label 'err_out' defined but not used [-Wunused-label] drivers/net/phy/rtl8367b.c:1459:32: warning: unused variable 'pdata' [-Wunused-variable] Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34731 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/drivers/net/phy/rtl8366s.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'target/linux/generic/files/drivers/net/phy/rtl8366s.c') diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c index 42b193933..7d0de7c6a 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -1052,7 +1053,6 @@ static struct rtl8366_smi_ops rtl8366s_smi_ops = { static int __devinit rtl8366s_probe(struct platform_device *pdev) { static int rtl8366_smi_version_printed; - struct rtl8366_platform_data *pdata; struct rtl8366_smi *smi; int err; @@ -1091,7 +1091,6 @@ static int __devinit rtl8366s_probe(struct platform_device *pdev) rtl8366_smi_cleanup(smi); err_free_smi: kfree(smi); - err_out: return err; } -- cgit v1.2.3 From 91ba1524d4179b776ff3ae90c22a37eb26827833 Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 27 Jan 2013 17:48:48 +0000 Subject: kernel: remove __devinit, __devexit and __devexit_p for kernel 3.8 These attributes where removed with kernel 3.8 and are now causing compile errors. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35328 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/drivers/net/phy/rtl8366s.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'target/linux/generic/files/drivers/net/phy/rtl8366s.c') diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c index 7d0de7c6a..196d49e4c 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c @@ -1050,7 +1050,7 @@ static struct rtl8366_smi_ops rtl8366s_smi_ops = { .enable_port = rtl8366s_enable_port, }; -static int __devinit rtl8366s_probe(struct platform_device *pdev) +static int rtl8366s_probe(struct platform_device *pdev) { static int rtl8366_smi_version_printed; struct rtl8366_smi *smi; @@ -1094,7 +1094,7 @@ static int __devinit rtl8366s_probe(struct platform_device *pdev) return err; } -static int __devexit rtl8366s_remove(struct platform_device *pdev) +static int rtl8366s_remove(struct platform_device *pdev) { struct rtl8366_smi *smi = platform_get_drvdata(pdev); @@ -1125,7 +1125,7 @@ static struct platform_driver rtl8366s_driver = { #endif }, .probe = rtl8366s_probe, - .remove = __devexit_p(rtl8366s_remove), + .remove = rtl8366s_remove, }; static int __init rtl8366s_module_init(void) -- cgit v1.2.3 From 8029395fe5f360ec244174468bbee97300ab2460 Mon Sep 17 00:00:00 2001 From: blogic Date: Fri, 12 Apr 2013 18:56:05 +0000 Subject: [geneirc] fix rtl8366s OF binding Signed-off-by: John Crispin git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36323 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/drivers/net/phy/rtl8366s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'target/linux/generic/files/drivers/net/phy/rtl8366s.c') diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c index 196d49e4c..3dc2a87ae 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c @@ -256,7 +256,7 @@ static int rtl8366s_setup(struct rtl8366_smi *smi) int err; pdata = smi->parent->platform_data; - if (pdata->num_initvals && pdata->initvals) { + if (pdata && pdata->num_initvals && pdata->initvals) { unsigned i; dev_info(smi->parent, "applying initvals\n"); @@ -1110,7 +1110,7 @@ static int rtl8366s_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id rtl8366s_match[] = { - { .compatible = "rtl8366s" }, + { .compatible = "realtek,rtl8366s" }, {}, }; MODULE_DEVICE_TABLE(of, rtl8366s_match); -- cgit v1.2.3