public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 11/47] cio: Use dev_{g,s}et_drvdata().
Date: Thu, 20 Dec 2007 16:19:36 +0100	[thread overview]
Message-ID: <20071220152105.364996161@de.ibm.com> (raw)
In-Reply-To: 20071220151925.405881218@de.ibm.com

[-- Attachment #1: 110-cio-drvdata.diff --]
[-- Type: text/plain, Size: 9616 bytes --]

From: Cornelia Huck <cornelia.huck@de.ibm.com>

Also define helpers sch_{g,s}et_cdev() to make the intention more
clear.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 drivers/s390/cio/ccwgroup.c   |   14 +++++++-------
 drivers/s390/cio/device.c     |   36 ++++++++++++++++++------------------
 drivers/s390/cio/device_fsm.c |   26 +++++++++++++-------------
 drivers/s390/cio/io_sch.h     |    2 ++
 4 files changed, 40 insertions(+), 38 deletions(-)

Index: quilt-2.6/drivers/s390/cio/ccwgroup.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/ccwgroup.c
+++ quilt-2.6/drivers/s390/cio/ccwgroup.c
@@ -111,7 +111,7 @@ ccwgroup_release (struct device *dev)
 	gdev = to_ccwgroupdev(dev);
 
 	for (i = 0; i < gdev->count; i++) {
-		gdev->cdev[i]->dev.driver_data = NULL;
+		dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
 		put_device(&gdev->cdev[i]->dev);
 	}
 	kfree(gdev);
@@ -196,11 +196,11 @@ int ccwgroup_create(struct device *root,
 			goto error;
 		}
 		/* Don't allow a device to belong to more than one group. */
-		if (gdev->cdev[i]->dev.driver_data) {
+		if (dev_get_drvdata(&gdev->cdev[i]->dev)) {
 			rc = -EINVAL;
 			goto error;
 		}
-		gdev->cdev[i]->dev.driver_data = gdev;
+		dev_set_drvdata(&gdev->cdev[i]->dev, gdev);
 	}
 
 	gdev->creator_id = creator_id;
@@ -234,8 +234,8 @@ int ccwgroup_create(struct device *root,
 error:
 	for (i = 0; i < argc; i++)
 		if (gdev->cdev[i]) {
-			if (gdev->cdev[i]->dev.driver_data == gdev)
-				gdev->cdev[i]->dev.driver_data = NULL;
+			if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
+				dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
 			put_device(&gdev->cdev[i]->dev);
 		}
 	mutex_unlock(&gdev->reg_mutex);
@@ -463,8 +463,8 @@ __ccwgroup_get_gdev_by_cdev(struct ccw_d
 {
 	struct ccwgroup_device *gdev;
 
-	if (cdev->dev.driver_data) {
-		gdev = (struct ccwgroup_device *)cdev->dev.driver_data;
+	gdev = dev_get_drvdata(&cdev->dev);
+	if (gdev) {
 		if (get_device(&gdev->dev)) {
 			mutex_lock(&gdev->reg_mutex);
 			if (device_is_registered(&gdev->dev))
Index: quilt-2.6/drivers/s390/cio/device.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/device.c
+++ quilt-2.6/drivers/s390/cio/device.c
@@ -773,7 +773,7 @@ static void sch_attach_device(struct sub
 {
 	css_update_ssd_info(sch);
 	spin_lock_irq(sch->lock);
-	sch->dev.driver_data = cdev;
+	sch_set_cdev(sch, cdev);
 	cdev->private->schid = sch->schid;
 	cdev->ccwlock = sch->lock;
 	device_trigger_reprobe(sch);
@@ -795,7 +795,7 @@ static void sch_attach_disconnected_devi
 		put_device(&other_sch->dev);
 		return;
 	}
-	other_sch->dev.driver_data = NULL;
+	sch_set_cdev(other_sch, NULL);
 	/* No need to keep a subchannel without ccw device around. */
 	css_sch_device_unregister(other_sch);
 	put_device(&other_sch->dev);
@@ -831,12 +831,12 @@ static void sch_create_and_recog_new_dev
 		return;
 	}
 	spin_lock_irq(sch->lock);
-	sch->dev.driver_data = cdev;
+	sch_set_cdev(sch, cdev);
 	spin_unlock_irq(sch->lock);
 	/* Start recognition for the new ccw device. */
 	if (io_subchannel_recog(cdev, sch)) {
 		spin_lock_irq(sch->lock);
-		sch->dev.driver_data = NULL;
+		sch_set_cdev(sch, NULL);
 		spin_unlock_irq(sch->lock);
 		if (cdev->dev.release)
 			cdev->dev.release(&cdev->dev);
@@ -940,7 +940,7 @@ io_subchannel_register(struct work_struc
 			      cdev->private->dev_id.devno, ret);
 		put_device(&cdev->dev);
 		spin_lock_irqsave(sch->lock, flags);
-		sch->dev.driver_data = NULL;
+		sch_set_cdev(sch, NULL);
 		spin_unlock_irqrestore(sch->lock, flags);
 		kfree (cdev->private);
 		kfree (cdev);
@@ -1022,7 +1022,7 @@ io_subchannel_recog(struct ccw_device *c
 	int rc;
 	struct ccw_device_private *priv;
 
-	sch->dev.driver_data = cdev;
+	sch_set_cdev(sch, cdev);
 	sch->driver = &io_subchannel_driver;
 	cdev->ccwlock = sch->lock;
 
@@ -1082,7 +1082,7 @@ static void ccw_device_move_to_sch(struc
 	}
 	if (former_parent) {
 		spin_lock_irq(former_parent->lock);
-		former_parent->dev.driver_data = NULL;
+		sch_set_cdev(former_parent, NULL);
 		spin_unlock_irq(former_parent->lock);
 		css_sch_device_unregister(former_parent);
 		/* Reset intparm to zeroes. */
@@ -1100,7 +1100,7 @@ static void io_subchannel_irq(struct sub
 {
 	struct ccw_device *cdev;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 
 	CIO_TRACE_EVENT(3, "IRQ");
 	CIO_TRACE_EVENT(3, sch->dev.bus_id);
@@ -1116,13 +1116,13 @@ io_subchannel_probe (struct subchannel *
 	unsigned long flags;
 	struct ccw_dev_id dev_id;
 
-	if (sch->dev.driver_data) {
+	cdev = sch_get_cdev(sch);
+	if (cdev) {
 		/*
 		 * This subchannel already has an associated ccw_device.
 		 * Register it and exit. This happens for all early
 		 * device, e.g. the console.
 		 */
-		cdev = sch->dev.driver_data;
 		cdev->dev.groups = ccwdev_attr_groups;
 		device_initialize(&cdev->dev);
 		ccw_device_register(cdev);
@@ -1173,7 +1173,7 @@ io_subchannel_probe (struct subchannel *
 	rc = io_subchannel_recog(cdev, sch);
 	if (rc) {
 		spin_lock_irqsave(sch->lock, flags);
-		sch->dev.driver_data = NULL;
+		sch_set_cdev(sch, NULL);
 		spin_unlock_irqrestore(sch->lock, flags);
 		if (cdev->dev.release)
 			cdev->dev.release(&cdev->dev);
@@ -1189,12 +1189,12 @@ io_subchannel_remove (struct subchannel 
 	struct ccw_device *cdev;
 	unsigned long flags;
 
-	if (!sch->dev.driver_data)
+	cdev = sch_get_cdev(sch);
+	if (!cdev)
 		return 0;
-	cdev = sch->dev.driver_data;
 	/* Set ccw device to not operational and drop reference. */
 	spin_lock_irqsave(cdev->ccwlock, flags);
-	sch->dev.driver_data = NULL;
+	sch_set_cdev(sch, NULL);
 	cdev->private->state = DEV_STATE_NOT_OPER;
 	spin_unlock_irqrestore(cdev->ccwlock, flags);
 	ccw_device_unregister(cdev);
@@ -1207,7 +1207,7 @@ static int io_subchannel_notify(struct s
 {
 	struct ccw_device *cdev;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 	if (!cdev)
 		return 0;
 	if (!cdev->drv)
@@ -1221,7 +1221,7 @@ static void io_subchannel_verify(struct 
 {
 	struct ccw_device *cdev;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 	if (cdev)
 		dev_fsm_event(cdev, DEV_EVENT_VERIFY);
 }
@@ -1230,7 +1230,7 @@ static void io_subchannel_ioterm(struct 
 {
 	struct ccw_device *cdev;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 	if (!cdev)
 		return;
 	/* Internal I/O will be retried by the interrupt handler. */
@@ -1248,7 +1248,7 @@ io_subchannel_shutdown(struct subchannel
 	struct ccw_device *cdev;
 	int ret;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 
 	if (cio_is_console(sch->schid))
 		return;
Index: quilt-2.6/drivers/s390/cio/device_fsm.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/device_fsm.c
+++ quilt-2.6/drivers/s390/cio/device_fsm.c
@@ -32,9 +32,9 @@ device_is_online(struct subchannel *sch)
 {
 	struct ccw_device *cdev;
 
-	if (!sch->dev.driver_data)
+	cdev = sch_get_cdev(sch);
+	if (!cdev)
 		return 0;
-	cdev = sch->dev.driver_data;
 	return (cdev->private->state == DEV_STATE_ONLINE);
 }
 
@@ -43,9 +43,9 @@ device_is_disconnected(struct subchannel
 {
 	struct ccw_device *cdev;
 
-	if (!sch->dev.driver_data)
+	cdev = sch_get_cdev(sch);
+	if (!cdev)
 		return 0;
-	cdev = sch->dev.driver_data;
 	return (cdev->private->state == DEV_STATE_DISCONNECTED ||
 		cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID);
 }
@@ -55,9 +55,9 @@ device_set_disconnected(struct subchanne
 {
 	struct ccw_device *cdev;
 
-	if (!sch->dev.driver_data)
+	cdev = sch_get_cdev(sch);
+	if (!cdev)
 		return;
-	cdev = sch->dev.driver_data;
 	ccw_device_set_timeout(cdev, 0);
 	cdev->private->flags.fake_irb = 0;
 	cdev->private->state = DEV_STATE_DISCONNECTED;
@@ -67,7 +67,7 @@ void device_set_intretry(struct subchann
 {
 	struct ccw_device *cdev;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 	if (!cdev)
 		return;
 	cdev->private->flags.intretry = 1;
@@ -77,7 +77,7 @@ int device_trigger_verify(struct subchan
 {
 	struct ccw_device *cdev;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 	if (!cdev || !cdev->online)
 		return -EINVAL;
 	dev_fsm_event(cdev, DEV_EVENT_VERIFY);
@@ -175,9 +175,9 @@ device_kill_pending_timer(struct subchan
 {
 	struct ccw_device *cdev;
 
-	if (!sch->dev.driver_data)
+	cdev = sch_get_cdev(sch);
+	if (!cdev)
 		return;
-	cdev = sch->dev.driver_data;
 	ccw_device_set_timeout(cdev, 0);
 }
 
@@ -992,7 +992,7 @@ void device_kill_io(struct subchannel *s
 	int ret;
 	struct ccw_device *cdev;
 
-	cdev = sch->dev.driver_data;
+	cdev = sch_get_cdev(sch);
 	ret = ccw_device_cancel_halt_clear(cdev);
 	if (ret == -EBUSY) {
 		ccw_device_set_timeout(cdev, 3*HZ);
@@ -1062,9 +1062,9 @@ device_trigger_reprobe(struct subchannel
 {
 	struct ccw_device *cdev;
 
-	if (!sch->dev.driver_data)
+	cdev = sch_get_cdev(sch);
+	if (!cdev)
 		return;
-	cdev = sch->dev.driver_data;
 	if (cdev->private->state != DEV_STATE_DISCONNECTED)
 		return;
 
Index: quilt-2.6/drivers/s390/cio/io_sch.h
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/io_sch.h
+++ quilt-2.6/drivers/s390/cio/io_sch.h
@@ -34,6 +34,8 @@ struct io_subchannel_private {
 } __attribute__ ((aligned(8)));
 
 #define to_io_private(n) ((struct io_subchannel_private *)n->private)
+#define sch_get_cdev(n) (dev_get_drvdata(&n->dev))
+#define sch_set_cdev(n, c) (dev_set_drvdata(&n->dev, c))
 
 #define MAX_CIWS 8
 

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  parent reply	other threads:[~2007-12-20 15:26 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 15:19 [patch 00/47] s390 2.6.25 patch queue Martin Schwidefsky
2007-12-20 15:19 ` [patch 01/47] Cleanup in Documentation/kernel-parameters.txt Martin Schwidefsky
2007-12-20 15:19 ` [patch 02/47] cio: Dump ccw device information in case of timeout Martin Schwidefsky
2007-12-20 15:19 ` [patch 03/47] cio: Use helpers instead of container_of() Martin Schwidefsky
2007-12-20 15:19 ` [patch 04/47] cio: css_driver: Use consistent parameters Martin Schwidefsky
2007-12-20 15:19 ` [patch 05/47] cio: Reset sch->driver Martin Schwidefsky
2007-12-20 15:19 ` [patch 06/47] cio: Add css_driver_{register,unregister} Martin Schwidefsky
2007-12-20 15:19 ` [patch 07/47] cio: Cleanup debug feature usage Martin Schwidefsky
2007-12-20 15:19 ` [patch 08/47] cio: Introduce subchannel->private Martin Schwidefsky
2007-12-20 15:19 ` [patch 09/47] cio: Extend adapter interrupt interface Martin Schwidefsky
2007-12-20 15:19 ` [patch 10/47] cio: I/O subchannel specific fields Martin Schwidefsky
2007-12-20 15:19 ` Martin Schwidefsky [this message]
2007-12-20 15:19 ` [patch 12/47] cio: Set driver->owner on css, ccw and ccwgroup busses Martin Schwidefsky
2007-12-20 15:19 ` [patch 13/47] cio: reduce cpu utilization during device scan Martin Schwidefsky
2007-12-20 15:19 ` [patch 14/47] qdio: Remove double checked value Martin Schwidefsky
2007-12-20 15:19 ` [patch 15/47] qdio: set QDIO_ACTIVATE_TIMEOUT to 5s Martin Schwidefsky
2007-12-20 15:19 ` [patch 16/47] sclp: sysfs interface for SCLP cpi Martin Schwidefsky
2007-12-20 15:19 ` [patch 17/47] Standby cpu activation/deactivation Martin Schwidefsky
2007-12-20 15:19 ` [patch 18/47] sclp: convert channel path configure code to use sync interface Martin Schwidefsky
2007-12-20 15:19 ` [patch 19/47] Optimize reference bit handling Martin Schwidefsky
2007-12-20 15:19 ` [patch 20/47] Fix tlb flushing with idte Martin Schwidefsky
2007-12-20 15:19 ` [patch 21/47] Change vmalloc defintions Martin Schwidefsky
2007-12-20 15:19 ` [patch 22/47] Print kernel version in dump_stack() and show_regs() Martin Schwidefsky
2007-12-20 15:19 ` [patch 23/47] Get rid of HOLES_IN_ZONE requirement Martin Schwidefsky
2007-12-20 15:19 ` [patch 24/47] DEBUG_PAGEALLOC support for s390 Martin Schwidefsky
2007-12-20 15:19 ` [patch 25/47] Remove owner_pc member from raw_spinlock_t Martin Schwidefsky
2007-12-20 15:19 ` [patch 26/47] Use new style spinlock initializer in __RWSEM_INITIALIZER Martin Schwidefsky
2007-12-20 15:19 ` [patch 27/47] Get rid of additional_cpus kernel parameter Martin Schwidefsky
2007-12-20 15:19 ` [patch 28/47] Remove appldata include from sysctl_check.c Martin Schwidefsky
2007-12-20 15:19 ` [patch 29/47] crypto: move s390 Kconfig options Martin Schwidefsky
2007-12-20 15:19 ` [patch 30/47] dasd: fix return value of dasd_generic_probe() Martin Schwidefsky
2007-12-20 15:19 ` [patch 31/47] arch/s390: Add missing "space" Martin Schwidefsky
2007-12-20 15:19 ` [patch 32/47] drivers/s390: " Martin Schwidefsky
2007-12-20 15:19 ` [patch 33/47] kernel: Shutdown Actions Interface Martin Schwidefsky
2007-12-20 15:19 ` [patch 34/47] Load disabled wait psw instead of stopping cpu on halt Martin Schwidefsky
2007-12-20 15:20 ` [patch 35/47] use LIST_HEAD instead of LIST_HEAD_INIT Martin Schwidefsky
2007-12-20 15:20 ` [patch 36/47] Allocate and free cpu lowcores and stacks when needed/possible Martin Schwidefsky
2007-12-20 15:20 ` [patch 37/47] Initialize sclp_ipl_info Martin Schwidefsky
2007-12-20 15:20 ` [patch 38/47] vmemmap: allocate struct pages before 1:1 mapping Martin Schwidefsky
2007-12-20 15:20 ` [patch 39/47] Use diag308 subcodes 3 and 6 for reboot and dump when possible Martin Schwidefsky
2007-12-20 15:20 ` [patch 40/47] arch/s390/: Spelling fixes Martin Schwidefsky
2007-12-20 15:20 ` [patch 41/47] include/asm-s390/: " Martin Schwidefsky
2007-12-20 15:20 ` [patch 42/47] drivers/s390/: " Martin Schwidefsky
2007-12-20 15:20 ` [patch 43/47] Move NOTES and BUG_TABLE Martin Schwidefsky
2007-12-20 15:20 ` [patch 44/47] single-step cleanup Martin Schwidefsky
2007-12-20 15:20 ` [patch 45/47] dasd: add hyper PAV support to DASD device driver, part 1 Martin Schwidefsky
2007-12-20 15:20 ` [patch 46/47] dasd: add hyper PAV support to DASD device driver, part 2 Martin Schwidefsky
2007-12-20 15:20 ` [patch 47/47] dasd: add hyper PAV support to DASD device driver, part 3 Martin Schwidefsky

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=20071220152105.364996161@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /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