Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: legacy: simplify getting .driver_data

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wolfram Sang and committed by
David S. Miller
2af1ccd5 c0bfdae0

+2 -4
+2 -4
net/dsa/legacy.c
··· 686 686 #ifdef CONFIG_PM_SLEEP 687 687 static int dsa_suspend(struct device *d) 688 688 { 689 - struct platform_device *pdev = to_platform_device(d); 690 - struct dsa_switch_tree *dst = platform_get_drvdata(pdev); 689 + struct dsa_switch_tree *dst = dev_get_drvdata(d); 691 690 int i, ret = 0; 692 691 693 692 for (i = 0; i < dst->pd->nr_chips; i++) { ··· 701 702 702 703 static int dsa_resume(struct device *d) 703 704 { 704 - struct platform_device *pdev = to_platform_device(d); 705 - struct dsa_switch_tree *dst = platform_get_drvdata(pdev); 705 + struct dsa_switch_tree *dst = dev_get_drvdata(d); 706 706 int i, ret = 0; 707 707 708 708 for (i = 0; i < dst->pd->nr_chips; i++) {