Skip to content

Commit

Permalink
net: remove driver_data direct access of struct device from more drivers
Browse files Browse the repository at this point in the history
In the near future, the driver core is going to not allow direct access
to the driver_data pointer in struct device.  Instead, the functions
dev_get_drvdata() and dev_set_drvdata() should be used.  These functions
have been around since the beginning, so are backwards compatible with
all older kernel versions.

Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
gregkh authored and davem330 committed May 5, 2009
1 parent 088eb2d commit c7ae011
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ehea/ehea_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3256,7 +3256,7 @@ static ssize_t ehea_probe_port(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ehea_adapter *adapter = dev->driver_data;
struct ehea_adapter *adapter = dev_get_drvdata(dev);
struct ehea_port *port;
struct device_node *eth_dn = NULL;
int i;
Expand Down Expand Up @@ -3311,7 +3311,7 @@ static ssize_t ehea_remove_port(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ehea_adapter *adapter = dev->driver_data;
struct ehea_adapter *adapter = dev_get_drvdata(dev);
struct ehea_port *port;
int i;
u32 logical_port_id;
Expand Down Expand Up @@ -3399,7 +3399,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,

adapter->pd = EHEA_PD_ID;

dev->dev.driver_data = adapter;
dev_set_drvdata(&dev->dev, adapter);


/* initialize adapter and ports */
Expand Down Expand Up @@ -3463,7 +3463,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,

static int __devexit ehea_remove(struct of_device *dev)
{
struct ehea_adapter *adapter = dev->dev.driver_data;
struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev);
int i;

for (i = 0; i < EHEA_MAX_PORTS; i++)
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ibmveth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
return -ENOMEM;

adapter = netdev_priv(netdev);
dev->dev.driver_data = netdev;
dev_set_drvdata(&dev->dev, netdev);

adapter->vdev = dev;
adapter->netdev = netdev;
Expand Down Expand Up @@ -1341,7 +1341,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_

static int __devexit ibmveth_remove(struct vio_dev *dev)
{
struct net_device *netdev = dev->dev.driver_data;
struct net_device *netdev = dev_get_drvdata(&dev->dev);
struct ibmveth_adapter *adapter = netdev_priv(netdev);
int i;

Expand Down Expand Up @@ -1474,8 +1474,8 @@ const char * buf, size_t count)
struct ibmveth_buff_pool *pool = container_of(kobj,
struct ibmveth_buff_pool,
kobj);
struct net_device *netdev =
container_of(kobj->parent, struct device, kobj)->driver_data;
struct net_device *netdev = dev_get_drvdata(
container_of(kobj->parent, struct device, kobj));
struct ibmveth_adapter *adapter = netdev_priv(netdev);
long value = simple_strtol(buf, NULL, 10);
long rc;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/sb1250-mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2300,7 +2300,7 @@ static const struct net_device_ops sbmac_netdev_ops = {

static int sbmac_init(struct platform_device *pldev, long long base)
{
struct net_device *dev = pldev->dev.driver_data;
struct net_device *dev = dev_get_drvdata(&pldev->dev);
int idx = pldev->id;
struct sbmac_softc *sc = netdev_priv(dev);
unsigned char *eaddr;
Expand Down Expand Up @@ -2731,7 +2731,7 @@ static int __init sbmac_probe(struct platform_device *pldev)
goto out_unmap;
}

pldev->dev.driver_data = dev;
dev_set_drvdata(&pldev->dev, dev);
SET_NETDEV_DEV(dev, &pldev->dev);

sc = netdev_priv(dev);
Expand All @@ -2756,7 +2756,7 @@ static int __init sbmac_probe(struct platform_device *pldev)

static int __exit sbmac_remove(struct platform_device *pldev)
{
struct net_device *dev = pldev->dev.driver_data;
struct net_device *dev = dev_get_drvdata(&pldev->dev);
struct sbmac_softc *sc = netdev_priv(dev);

unregister_netdev(dev);
Expand Down

0 comments on commit c7ae011

Please sign in to comment.