net: use container_of instead of dev->type_data
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
2c54046510
commit
67d938b2ea
|
@ -360,7 +360,7 @@ static const char *yesno_str(int v)
|
||||||
|
|
||||||
static void cs8900_info(struct device_d *dev)
|
static void cs8900_info(struct device_d *dev)
|
||||||
{
|
{
|
||||||
struct eth_device *edev = (struct eth_device *)dev->type_data;
|
struct eth_device *edev = dev_to_edev(dev);
|
||||||
struct cs8900_priv *priv = (struct cs8900_priv *)edev->priv;
|
struct cs8900_priv *priv = (struct cs8900_priv *)edev->priv;
|
||||||
u16 v;
|
u16 v;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ struct eth_device {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define dev_to_edev(d) container_of(d, struct eth_device, dev)
|
||||||
|
|
||||||
int eth_register(struct eth_device* dev); /* Register network device */
|
int eth_register(struct eth_device* dev); /* Register network device */
|
||||||
void eth_unregister(struct eth_device* dev); /* Unregister network device */
|
void eth_unregister(struct eth_device* dev); /* Unregister network device */
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ int eth_rx(void)
|
||||||
|
|
||||||
static int eth_set_ethaddr(struct device_d *dev, struct param_d *param, const char *val)
|
static int eth_set_ethaddr(struct device_d *dev, struct param_d *param, const char *val)
|
||||||
{
|
{
|
||||||
struct eth_device *edev = dev->type_data;
|
struct eth_device *edev = dev_to_edev(dev);
|
||||||
char ethaddr[sizeof("xx:xx:xx:xx:xx:xx")];
|
char ethaddr[sizeof("xx:xx:xx:xx:xx:xx")];
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
|
@ -168,7 +168,7 @@ static int eth_set_ethaddr(struct device_d *dev, struct param_d *param, const ch
|
||||||
|
|
||||||
static int eth_set_ipaddr(struct device_d *dev, struct param_d *param, const char *val)
|
static int eth_set_ipaddr(struct device_d *dev, struct param_d *param, const char *val)
|
||||||
{
|
{
|
||||||
struct eth_device *edev = dev->type_data;
|
struct eth_device *edev = dev_to_edev(dev);
|
||||||
IPaddr_t ip;
|
IPaddr_t ip;
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
|
@ -205,7 +205,6 @@ int eth_register(struct eth_device *edev)
|
||||||
|
|
||||||
register_device(&edev->dev);
|
register_device(&edev->dev);
|
||||||
|
|
||||||
dev->type_data = edev;
|
|
||||||
dev_add_param(dev, "ipaddr", eth_set_ipaddr, NULL, 0);
|
dev_add_param(dev, "ipaddr", eth_set_ipaddr, NULL, 0);
|
||||||
dev_add_param(dev, "ethaddr", eth_set_ethaddr, NULL, 0);
|
dev_add_param(dev, "ethaddr", eth_set_ethaddr, NULL, 0);
|
||||||
dev_add_param(dev, "gateway", eth_set_ipaddr, NULL, 0);
|
dev_add_param(dev, "gateway", eth_set_ipaddr, NULL, 0);
|
||||||
|
|
Loading…
Reference in New Issue