mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	linux1394-devel@lists.sourceforge.net,
	Ben Collins <ben.collins@ubuntu.com>
Subject: [PATCH 40/64] ieee1394: remove driver_data direct access of struct device
Date: Mon, 15 Jun 2009 22:46:29 -0700	[thread overview]
Message-ID: <1245131213-24168-40-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20090616051351.GA23627@kroah.com>

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>
---
 drivers/ieee1394/eth1394.c |   16 +++++++---------
 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 4ca1035..f5c586c 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,
 	node_info->pdg.sz = 0;
 	node_info->fifo = CSR1212_INVALID_ADDR_SPACE;
 
-	ud->device.driver_data = node_info;
+	dev_set_drvdata(&ud->device, node_info);
 	new_node->ud = ud;
 
 	priv = netdev_priv(hi->dev);
@@ -406,7 +406,7 @@ static int eth1394_remove(struct device *dev)
 	list_del(&old_node->list);
 	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);
 	/* 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);
 
 	kfree(node_info);
-	ud->device.driver_data = NULL;
+	dev_set_drvdata(&ud->device, NULL);
 	return 0;
 }
 
@@ -688,7 +688,7 @@ static void ether1394_host_reset(struct hpsb_host *host)
 	ether1394_reset_priv(dev, 0);
 
 	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);
 
@@ -872,8 +872,7 @@ static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
 		if (!node)
 			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 */
 		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;
 	}
 
-	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? */
 	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)
 			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)
 			goto fail;
 
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index a51ab23..83b734a 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -718,7 +718,7 @@ static int sbp2_remove(struct device *dev)
 	struct scsi_device *sdev;
 
 	ud = container_of(dev, struct unit_directory, device);
-	lu = ud->device.driver_data;
+	lu = dev_get_drvdata(&ud->device);
 	if (!lu)
 		return 0;
 
@@ -746,7 +746,7 @@ static int sbp2_remove(struct device *dev)
 
 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) {
 		/*
@@ -815,7 +815,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)
 	atomic_set(&lu->state, SBP2LU_STATE_RUNNING);
 	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);
 	if (!hi) {
@@ -1051,7 +1051,7 @@ static void sbp2_remove_device(struct sbp2_lu *lu)
 		hpsb_unregister_addrspace(&sbp2_highlevel, hi->host,
 					  lu->status_fifo_addr);
 
-	lu->ud->device.driver_data = NULL;
+	dev_set_drvdata(&lu->ud->device, NULL);
 
 	module_put(hi->host->driver->owner);
 no_hi:
-- 
1.6.3.2


  parent reply	other threads:[~2009-06-16  6:00 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16  5:13 [GIT PATCH] driver core patches for 2.6.30-git Greg KH
2009-06-16  5:45 ` [PATCH 01/64] driver core: set default SYSFS_DEPRECATED=n Greg Kroah-Hartman
2009-06-24 15:02   ` Pavel Machek
2009-06-16  5:45 ` [PATCH 02/64] sched: delayed cleanup of user_struct Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 03/64] Driver Core: Warn driver authors about adding device attributes Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 04/64] Sysfs: fix possible memleak in sysfs_follow_link Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 05/64] driver core: firmware_class: replace kfree(dev) with put_device(dev) Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 06/64] driver core: add BUS_NOTIFY_UNBOUND_DRIVER event Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 07/64] driver core: Const-correct platform getbyname functions Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 08/64] debugfs: dont stop on first failed recursive delete Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 09/64] Driver core: fix comment for device_attach() Greg Kroah-Hartman
2009-06-16  5:45 ` [PATCH 10/64] kobject: make kset_create check kobject_set_name return value Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 11/64] driver-core: make sysdev_class_register " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 12/64] debugfs: fix docbook error Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 13/64] driver core: synchronize device shutdown Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 14/64] kobject: samples: make SAMPLE_KOBJECT module-only Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 15/64] driver core: fix documentation of request_firmware_nowait Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 16/64] firmware: allocate firmware id dynamically Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 17/64] firmware: atm/ueagle-atm: prepare for FIRMWARE_NAME_MAX removal Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 18/64] firmware: tuners/xc2028: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 19/64] firmware: dvb/dvb-usb: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 20/64] firmware: pcmcia/ds: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 21/64] firmware: wireless/libertas: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 22/64] firmware: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 23/64] firmware: remove broken example files Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 24/64] driver core: fix gcc 4.3.3 warnings about string literals Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 25/64] Driver Core: add nodename callbacks Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 26/64] Driver Core: misc: add nodename support for misc devices Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 27/64] Driver Core: usb: add nodename support for usb drivers Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 28/64] Driver Core: block: add nodename support for block drivers Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 29/64] Driver Core: x86: add nodename for cpuid and msr drivers Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 30/64] Driver Core: dvb: add nodename for dvb drivers Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 31/64] Driver Core: input: add nodename for input drivers Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 32/64] Driver Core: sound: add nodename for sound drivers Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 33/64] Driver Core: raw: add nodename for raw devices Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 34/64] Driver Core: drm: add nodename for drm devices Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 35/64] Driver Core: aoe: add nodename for aoe devices Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 36/64] Driver Core: bsg: add nodename for bsg driver Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 37/64] eisa: remove driver_data direct access of struct device Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 38/64] firewire: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 39/64] ide: " Greg Kroah-Hartman
2009-06-16  5:46 ` Greg Kroah-Hartman [this message]
2009-06-16  5:46 ` [PATCH 41/64] infiniband: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 42/64] input: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 43/64] media: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 44/64] mfd: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 45/64] PCIE: " Greg Kroah-Hartman
2009-06-16 17:13   ` Jesse Barnes
2009-06-16 17:17     ` Greg KH
2009-06-16  5:46 ` [PATCH 46/64] pcmcia: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 47/64] scsi: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 48/64] thermal: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 49/64] xen block: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 50/64] hvcs: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 51/64] ibmvscsi: gadget: at91_udc: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 52/64] infiniband: ehca: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 53/64] ipmi: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 54/64] mips: " Greg Kroah-Hartman
2009-06-16  9:31   ` Ralf Baechle
2009-06-16 16:25     ` Greg KH
2009-06-16  5:46 ` [PATCH 55/64] of_serial: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 56/64] parisc: " Greg Kroah-Hartman
2009-06-16 15:15   ` Kyle McMartin
2009-06-16 16:25     ` Greg KH
2009-06-16 17:24       ` Kyle McMartin
2009-06-16  5:46 ` [PATCH 57/64] parport: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 58/64] s390: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 59/64] block/ps3: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 60/64] uml: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 61/64] usb: gadget: at91_udc: " Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 62/64] xen: remove driver_data direct access of struct device from more drivers Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 63/64] debugfs: Fix terminology inconsistency of dir name to mount debugfs filesystem Greg Kroah-Hartman
2009-06-16  5:46 ` [PATCH 64/64] debugfs: use specified mode to possibly mark files read/write only Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1245131213-24168-40-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=ben.collins@ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®