2019-06-01 02:08:42 -06:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2010-10-26 16:07:13 -06:00
|
|
|
/*
|
|
|
|
* OF helpers for network devices.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LINUX_OF_NET_H
|
|
|
|
#define __LINUX_OF_NET_H
|
|
|
|
|
net: of_get_phy_mode: Change API to solve int/unit warnings
Before this change of_get_phy_mode() returned an enum,
phy_interface_t. On error, -ENODEV etc, is returned. If the result of
the function is stored in a variable of type phy_interface_t, and the
compiler has decided to represent this as an unsigned int, comparision
with -ENODEV etc, is a signed vs unsigned comparision.
Fix this problem by changing the API. Make the function return an
error, or 0 on success, and pass a pointer, of type phy_interface_t,
where the phy mode should be stored.
v2:
Return with *interface set to PHY_INTERFACE_MODE_NA on error.
Add error checks to all users of of_get_phy_mode()
Fixup a few reverse christmas tree errors
Fixup a few slightly malformed reverse christmas trees
v3:
Fix 0-day reported errors.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-11-03 18:40:33 -07:00
|
|
|
#include <linux/phy.h>
|
|
|
|
|
2010-10-26 16:07:13 -06:00
|
|
|
#ifdef CONFIG_OF_NET
|
|
|
|
#include <linux/of.h>
|
2015-03-09 15:31:20 -06:00
|
|
|
|
|
|
|
struct net_device;
|
net: of_get_phy_mode: Change API to solve int/unit warnings
Before this change of_get_phy_mode() returned an enum,
phy_interface_t. On error, -ENODEV etc, is returned. If the result of
the function is stored in a variable of type phy_interface_t, and the
compiler has decided to represent this as an unsigned int, comparision
with -ENODEV etc, is a signed vs unsigned comparision.
Fix this problem by changing the API. Make the function return an
error, or 0 on success, and pass a pointer, of type phy_interface_t,
where the phy mode should be stored.
v2:
Return with *interface set to PHY_INTERFACE_MODE_NA on error.
Add error checks to all users of of_get_phy_mode()
Fixup a few reverse christmas tree errors
Fixup a few slightly malformed reverse christmas trees
v3:
Fix 0-day reported errors.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-11-03 18:40:33 -07:00
|
|
|
extern int of_get_phy_mode(struct device_node *np, phy_interface_t *interface);
|
2010-10-26 16:07:13 -06:00
|
|
|
extern const void *of_get_mac_address(struct device_node *np);
|
2015-03-09 15:31:20 -06:00
|
|
|
extern struct net_device *of_find_net_device_by_node(struct device_node *np);
|
2013-04-02 03:35:07 -06:00
|
|
|
#else
|
net: of_get_phy_mode: Change API to solve int/unit warnings
Before this change of_get_phy_mode() returned an enum,
phy_interface_t. On error, -ENODEV etc, is returned. If the result of
the function is stored in a variable of type phy_interface_t, and the
compiler has decided to represent this as an unsigned int, comparision
with -ENODEV etc, is a signed vs unsigned comparision.
Fix this problem by changing the API. Make the function return an
error, or 0 on success, and pass a pointer, of type phy_interface_t,
where the phy mode should be stored.
v2:
Return with *interface set to PHY_INTERFACE_MODE_NA on error.
Add error checks to all users of of_get_phy_mode()
Fixup a few reverse christmas tree errors
Fixup a few slightly malformed reverse christmas trees
v3:
Fix 0-day reported errors.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-11-03 18:40:33 -07:00
|
|
|
static inline int of_get_phy_mode(struct device_node *np,
|
|
|
|
phy_interface_t *interface)
|
2013-04-02 03:35:07 -06:00
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const void *of_get_mac_address(struct device_node *np)
|
|
|
|
{
|
2019-05-19 06:18:44 -06:00
|
|
|
return ERR_PTR(-ENODEV);
|
2013-04-02 03:35:07 -06:00
|
|
|
}
|
2015-03-09 15:31:20 -06:00
|
|
|
|
|
|
|
static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-10-26 16:07:13 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __LINUX_OF_NET_H */
|