Bladeren bron

ieee1394: remove driver_data direct access of struct device

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.

Cc: linux1394-devel@lists.sourceforge.net
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Ben Collins <ben.collins@ubuntu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Greg Kroah-Hartman 16 jaren geleden
bovenliggende
commit
bab030595a
2 gewijzigde bestanden met toevoegingen van 11 en 13 verwijderingen
  1. 7 9
      drivers/ieee1394/eth1394.c
  2. 4 4
      drivers/ieee1394/sbp2.c

+ 7 - 9
drivers/ieee1394/eth1394.c

@@ -361,7 +361,7 @@ static int eth1394_new_node(struct eth1394_host_info *hi,
 	node_info->pdg.sz = 0;
 	node_info->pdg.sz = 0;
 	node_info->fifo = CSR1212_INVALID_ADDR_SPACE;
 	node_info->fifo = CSR1212_INVALID_ADDR_SPACE;
 
 
-	ud->device.driver_data = node_info;
+	dev_set_drvdata(&ud->device, node_info);
 	new_node->ud = ud;
 	new_node->ud = ud;
 
 
 	priv = netdev_priv(hi->dev);
 	priv = netdev_priv(hi->dev);
@@ -406,7 +406,7 @@ static int eth1394_remove(struct device *dev)
 	list_del(&old_node->list);
 	list_del(&old_node->list);
 	kfree(old_node);
 	kfree(old_node);
 
 
-	node_info = (struct eth1394_node_info*)ud->device.driver_data;
+	node_info = dev_get_drvdata(&ud->device);
 
 
 	spin_lock_irqsave(&node_info->pdg.lock, flags);
 	spin_lock_irqsave(&node_info->pdg.lock, flags);
 	/* The partial datagram list should be empty, but we'll just
 	/* The partial datagram list should be empty, but we'll just
@@ -416,7 +416,7 @@ static int eth1394_remove(struct device *dev)
 	spin_unlock_irqrestore(&node_info->pdg.lock, flags);
 	spin_unlock_irqrestore(&node_info->pdg.lock, flags);
 
 
 	kfree(node_info);
 	kfree(node_info);
-	ud->device.driver_data = NULL;
+	dev_set_drvdata(&ud->device, NULL);
 	return 0;
 	return 0;
 }
 }
 
 
@@ -688,7 +688,7 @@ static void ether1394_host_reset(struct hpsb_host *host)
 	ether1394_reset_priv(dev, 0);
 	ether1394_reset_priv(dev, 0);
 
 
 	list_for_each_entry(node, &priv->ip_node_list, list) {
 	list_for_each_entry(node, &priv->ip_node_list, list) {
-		node_info = node->ud->device.driver_data;
+		node_info = dev_get_drvdata(&node->ud->device);
 
 
 		spin_lock_irqsave(&node_info->pdg.lock, flags);
 		spin_lock_irqsave(&node_info->pdg.lock, flags);
 
 
@@ -872,8 +872,7 @@ static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
 		if (!node)
 		if (!node)
 			return cpu_to_be16(0);
 			return cpu_to_be16(0);
 
 
-		node_info =
-		    (struct eth1394_node_info *)node->ud->device.driver_data;
+		node_info = dev_get_drvdata(&node->ud->device);
 
 
 		/* Update our speed/payload/fifo_offset table */
 		/* Update our speed/payload/fifo_offset table */
 		node_info->maxpayload =	maxpayload;
 		node_info->maxpayload =	maxpayload;
@@ -1080,7 +1079,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
 		priv->ud_list[NODEID_TO_NODE(srcid)] = ud;
 		priv->ud_list[NODEID_TO_NODE(srcid)] = ud;
 	}
 	}
 
 
-	node_info = (struct eth1394_node_info *)ud->device.driver_data;
+	node_info = dev_get_drvdata(&ud->device);
 
 
 	/* First, did we receive a fragmented or unfragmented datagram? */
 	/* First, did we receive a fragmented or unfragmented datagram? */
 	hdr->words.word1 = ntohs(hdr->words.word1);
 	hdr->words.word1 = ntohs(hdr->words.word1);
@@ -1617,8 +1616,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
 		if (!node)
 		if (!node)
 			goto fail;
 			goto fail;
 
 
-		node_info =
-		    (struct eth1394_node_info *)node->ud->device.driver_data;
+		node_info = dev_get_drvdata(&node->ud->device);
 		if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE)
 		if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE)
 			goto fail;
 			goto fail;
 
 

+ 4 - 4
drivers/ieee1394/sbp2.c

@@ -718,7 +718,7 @@ static int sbp2_remove(struct device *dev)
 	struct scsi_device *sdev;
 	struct scsi_device *sdev;
 
 
 	ud = container_of(dev, struct unit_directory, device);
 	ud = container_of(dev, struct unit_directory, device);
-	lu = ud->device.driver_data;
+	lu = dev_get_drvdata(&ud->device);
 	if (!lu)
 	if (!lu)
 		return 0;
 		return 0;
 
 
@@ -746,7 +746,7 @@ static int sbp2_remove(struct device *dev)
 
 
 static int sbp2_update(struct unit_directory *ud)
 static int sbp2_update(struct unit_directory *ud)
 {
 {
-	struct sbp2_lu *lu = ud->device.driver_data;
+	struct sbp2_lu *lu = dev_get_drvdata(&ud->device);
 
 
 	if (sbp2_reconnect_device(lu) != 0) {
 	if (sbp2_reconnect_device(lu) != 0) {
 		/*
 		/*
@@ -815,7 +815,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)
 	atomic_set(&lu->state, SBP2LU_STATE_RUNNING);
 	atomic_set(&lu->state, SBP2LU_STATE_RUNNING);
 	INIT_WORK(&lu->protocol_work, NULL);
 	INIT_WORK(&lu->protocol_work, NULL);
 
 
-	ud->device.driver_data = lu;
+	dev_set_drvdata(&ud->device, lu);
 
 
 	hi = hpsb_get_hostinfo(&sbp2_highlevel, ud->ne->host);
 	hi = hpsb_get_hostinfo(&sbp2_highlevel, ud->ne->host);
 	if (!hi) {
 	if (!hi) {
@@ -1051,7 +1051,7 @@ static void sbp2_remove_device(struct sbp2_lu *lu)
 		hpsb_unregister_addrspace(&sbp2_highlevel, hi->host,
 		hpsb_unregister_addrspace(&sbp2_highlevel, hi->host,
 					  lu->status_fifo_addr);
 					  lu->status_fifo_addr);
 
 
-	lu->ud->device.driver_data = NULL;
+	dev_set_drvdata(&lu->ud->device, NULL);
 
 
 	module_put(hi->host->driver->owner);
 	module_put(hi->host->driver->owner);
 no_hi:
 no_hi: