diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-30 17:43:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:30:26 -0400 |
commit | bab030595a4f84c679fe26e05263e3dc9f560391 (patch) | |
tree | 0a49f3a38b7798eaf79a10b76df718023f5da066 /drivers/ieee1394 | |
parent | fcb5207723919ad85178420633d55efea80b652d (diff) |
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>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/eth1394.c | 16 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.c | 8 |
2 files changed, 11 insertions, 13 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 4ca103577c0a..f5c586c2bba6 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -361,7 +361,7 @@ static int eth1394_new_node(struct eth1394_host_info *hi, | |||
361 | node_info->pdg.sz = 0; | 361 | node_info->pdg.sz = 0; |
362 | node_info->fifo = CSR1212_INVALID_ADDR_SPACE; | 362 | node_info->fifo = CSR1212_INVALID_ADDR_SPACE; |
363 | 363 | ||
364 | ud->device.driver_data = node_info; | 364 | dev_set_drvdata(&ud->device, node_info); |
365 | new_node->ud = ud; | 365 | new_node->ud = ud; |
366 | 366 | ||
367 | priv = netdev_priv(hi->dev); | 367 | priv = netdev_priv(hi->dev); |
@@ -406,7 +406,7 @@ static int eth1394_remove(struct device *dev) | |||
406 | list_del(&old_node->list); | 406 | list_del(&old_node->list); |
407 | kfree(old_node); | 407 | kfree(old_node); |
408 | 408 | ||
409 | node_info = (struct eth1394_node_info*)ud->device.driver_data; | 409 | node_info = dev_get_drvdata(&ud->device); |
410 | 410 | ||
411 | spin_lock_irqsave(&node_info->pdg.lock, flags); | 411 | spin_lock_irqsave(&node_info->pdg.lock, flags); |
412 | /* The partial datagram list should be empty, but we'll just | 412 | /* The partial datagram list should be empty, but we'll just |
@@ -416,7 +416,7 @@ static int eth1394_remove(struct device *dev) | |||
416 | spin_unlock_irqrestore(&node_info->pdg.lock, flags); | 416 | spin_unlock_irqrestore(&node_info->pdg.lock, flags); |
417 | 417 | ||
418 | kfree(node_info); | 418 | kfree(node_info); |
419 | ud->device.driver_data = NULL; | 419 | dev_set_drvdata(&ud->device, NULL); |
420 | return 0; | 420 | return 0; |
421 | } | 421 | } |
422 | 422 | ||
@@ -688,7 +688,7 @@ static void ether1394_host_reset(struct hpsb_host *host) | |||
688 | ether1394_reset_priv(dev, 0); | 688 | ether1394_reset_priv(dev, 0); |
689 | 689 | ||
690 | list_for_each_entry(node, &priv->ip_node_list, list) { | 690 | list_for_each_entry(node, &priv->ip_node_list, list) { |
691 | node_info = node->ud->device.driver_data; | 691 | node_info = dev_get_drvdata(&node->ud->device); |
692 | 692 | ||
693 | spin_lock_irqsave(&node_info->pdg.lock, flags); | 693 | spin_lock_irqsave(&node_info->pdg.lock, flags); |
694 | 694 | ||
@@ -872,8 +872,7 @@ static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, | |||
872 | if (!node) | 872 | if (!node) |
873 | return cpu_to_be16(0); | 873 | return cpu_to_be16(0); |
874 | 874 | ||
875 | node_info = | 875 | node_info = dev_get_drvdata(&node->ud->device); |
876 | (struct eth1394_node_info *)node->ud->device.driver_data; | ||
877 | 876 | ||
878 | /* Update our speed/payload/fifo_offset table */ | 877 | /* Update our speed/payload/fifo_offset table */ |
879 | node_info->maxpayload = maxpayload; | 878 | node_info->maxpayload = maxpayload; |
@@ -1080,7 +1079,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, | |||
1080 | priv->ud_list[NODEID_TO_NODE(srcid)] = ud; | 1079 | priv->ud_list[NODEID_TO_NODE(srcid)] = ud; |
1081 | } | 1080 | } |
1082 | 1081 | ||
1083 | node_info = (struct eth1394_node_info *)ud->device.driver_data; | 1082 | node_info = dev_get_drvdata(&ud->device); |
1084 | 1083 | ||
1085 | /* First, did we receive a fragmented or unfragmented datagram? */ | 1084 | /* First, did we receive a fragmented or unfragmented datagram? */ |
1086 | hdr->words.word1 = ntohs(hdr->words.word1); | 1085 | hdr->words.word1 = ntohs(hdr->words.word1); |
@@ -1617,8 +1616,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev) | |||
1617 | if (!node) | 1616 | if (!node) |
1618 | goto fail; | 1617 | goto fail; |
1619 | 1618 | ||
1620 | node_info = | 1619 | node_info = dev_get_drvdata(&node->ud->device); |
1621 | (struct eth1394_node_info *)node->ud->device.driver_data; | ||
1622 | if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE) | 1620 | if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE) |
1623 | goto fail; | 1621 | goto fail; |
1624 | 1622 | ||
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index a51ab233342d..83b734aec923 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -718,7 +718,7 @@ static int sbp2_remove(struct device *dev) | |||
718 | struct scsi_device *sdev; | 718 | struct scsi_device *sdev; |
719 | 719 | ||
720 | ud = container_of(dev, struct unit_directory, device); | 720 | ud = container_of(dev, struct unit_directory, device); |
721 | lu = ud->device.driver_data; | 721 | lu = dev_get_drvdata(&ud->device); |
722 | if (!lu) | 722 | if (!lu) |
723 | return 0; | 723 | return 0; |
724 | 724 | ||
@@ -746,7 +746,7 @@ static int sbp2_remove(struct device *dev) | |||
746 | 746 | ||
747 | static int sbp2_update(struct unit_directory *ud) | 747 | static int sbp2_update(struct unit_directory *ud) |
748 | { | 748 | { |
749 | struct sbp2_lu *lu = ud->device.driver_data; | 749 | struct sbp2_lu *lu = dev_get_drvdata(&ud->device); |
750 | 750 | ||
751 | if (sbp2_reconnect_device(lu) != 0) { | 751 | if (sbp2_reconnect_device(lu) != 0) { |
752 | /* | 752 | /* |
@@ -815,7 +815,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud) | |||
815 | atomic_set(&lu->state, SBP2LU_STATE_RUNNING); | 815 | atomic_set(&lu->state, SBP2LU_STATE_RUNNING); |
816 | INIT_WORK(&lu->protocol_work, NULL); | 816 | INIT_WORK(&lu->protocol_work, NULL); |
817 | 817 | ||
818 | ud->device.driver_data = lu; | 818 | dev_set_drvdata(&ud->device, lu); |
819 | 819 | ||
820 | hi = hpsb_get_hostinfo(&sbp2_highlevel, ud->ne->host); | 820 | hi = hpsb_get_hostinfo(&sbp2_highlevel, ud->ne->host); |
821 | if (!hi) { | 821 | if (!hi) { |
@@ -1051,7 +1051,7 @@ static void sbp2_remove_device(struct sbp2_lu *lu) | |||
1051 | hpsb_unregister_addrspace(&sbp2_highlevel, hi->host, | 1051 | hpsb_unregister_addrspace(&sbp2_highlevel, hi->host, |
1052 | lu->status_fifo_addr); | 1052 | lu->status_fifo_addr); |
1053 | 1053 | ||
1054 | lu->ud->device.driver_data = NULL; | 1054 | dev_set_drvdata(&lu->ud->device, NULL); |
1055 | 1055 | ||
1056 | module_put(hi->host->driver->owner); | 1056 | module_put(hi->host->driver->owner); |
1057 | no_hi: | 1057 | no_hi: |