mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net: ethernet: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Also, unnecessary dev_set_drvdata() is removed, because the driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6d0bfe2261
commit
8513fbd880
23 changed files with 66 additions and 95 deletions
|
@ -95,7 +95,7 @@ static inline u32 rgmii_mode_mask(int mode, int input)
|
|||
|
||||
int rgmii_attach(struct platform_device *ofdev, int input, int mode)
|
||||
{
|
||||
struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
|
||||
struct rgmii_instance *dev = platform_get_drvdata(ofdev);
|
||||
struct rgmii_regs __iomem *p = dev->base;
|
||||
|
||||
RGMII_DBG(dev, "attach(%d)" NL, input);
|
||||
|
@ -124,7 +124,7 @@ int rgmii_attach(struct platform_device *ofdev, int input, int mode)
|
|||
|
||||
void rgmii_set_speed(struct platform_device *ofdev, int input, int speed)
|
||||
{
|
||||
struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
|
||||
struct rgmii_instance *dev = platform_get_drvdata(ofdev);
|
||||
struct rgmii_regs __iomem *p = dev->base;
|
||||
u32 ssr;
|
||||
|
||||
|
@ -146,7 +146,7 @@ void rgmii_set_speed(struct platform_device *ofdev, int input, int speed)
|
|||
|
||||
void rgmii_get_mdio(struct platform_device *ofdev, int input)
|
||||
{
|
||||
struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
|
||||
struct rgmii_instance *dev = platform_get_drvdata(ofdev);
|
||||
struct rgmii_regs __iomem *p = dev->base;
|
||||
u32 fer;
|
||||
|
||||
|
@ -167,7 +167,7 @@ void rgmii_get_mdio(struct platform_device *ofdev, int input)
|
|||
|
||||
void rgmii_put_mdio(struct platform_device *ofdev, int input)
|
||||
{
|
||||
struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
|
||||
struct rgmii_instance *dev = platform_get_drvdata(ofdev);
|
||||
struct rgmii_regs __iomem *p = dev->base;
|
||||
u32 fer;
|
||||
|
||||
|
@ -188,7 +188,7 @@ void rgmii_put_mdio(struct platform_device *ofdev, int input)
|
|||
|
||||
void rgmii_detach(struct platform_device *ofdev, int input)
|
||||
{
|
||||
struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
|
||||
struct rgmii_instance *dev = platform_get_drvdata(ofdev);
|
||||
struct rgmii_regs __iomem *p;
|
||||
|
||||
BUG_ON(!dev || dev->users == 0);
|
||||
|
@ -214,7 +214,7 @@ int rgmii_get_regs_len(struct platform_device *ofdev)
|
|||
|
||||
void *rgmii_dump_regs(struct platform_device *ofdev, void *buf)
|
||||
{
|
||||
struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
|
||||
struct rgmii_instance *dev = platform_get_drvdata(ofdev);
|
||||
struct emac_ethtool_regs_subhdr *hdr = buf;
|
||||
struct rgmii_regs *regs = (struct rgmii_regs *)(hdr + 1);
|
||||
|
||||
|
@ -279,7 +279,7 @@ static int rgmii_probe(struct platform_device *ofdev)
|
|||
(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out");
|
||||
|
||||
wmb();
|
||||
dev_set_drvdata(&ofdev->dev, dev);
|
||||
platform_set_drvdata(ofdev, dev);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -291,9 +291,7 @@ static int rgmii_probe(struct platform_device *ofdev)
|
|||
|
||||
static int rgmii_remove(struct platform_device *ofdev)
|
||||
{
|
||||
struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
|
||||
|
||||
dev_set_drvdata(&ofdev->dev, NULL);
|
||||
struct rgmii_instance *dev = platform_get_drvdata(ofdev);
|
||||
|
||||
WARN_ON(dev->users != 0);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue