linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: huckc@de.ibm.com
Subject: [PATCH] Add {css,ccw}_bus_type probe, remove, shutdown methods.
Date: Fri, 13 Jan 2006 11:50:12 -0800	[thread overview]
Message-ID: <11371818121681@kroah.com> (raw)
In-Reply-To: <11371818122256@kroah.com>

[PATCH] Add {css,ccw}_bus_type probe, remove, shutdown methods.

The following patch converts css_bus_type and ccw_bus_type to use
the new bus_type methods.

Signed-off-by: Cornelia Huck <huckc@de.ibm.com>
CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 8bbace7e686f1536905c703038a7eddfb1520264
tree 99253fd56bebd7903ac8dd05ee7c236c765e2798
parent 348290a4ae143a692124330942b464ccdb0d0365
author Cornelia Huck <huckc@de.ibm.com> Wed, 11 Jan 2006 10:56:22 +0100
committer Greg Kroah-Hartman <gregkh@suse.de> Fri, 13 Jan 2006 11:26:11 -0800

 drivers/s390/cio/css.c    |   36 +++++++++++++++++++++++++++++++-
 drivers/s390/cio/css.h    |    4 ++++
 drivers/s390/cio/device.c |   50 ++++++++++++++++++++++-----------------------
 3 files changed, 62 insertions(+), 28 deletions(-)

diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index e565193..2d319fb 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -542,9 +542,41 @@ css_bus_match (struct device *dev, struc
 	return 0;
 }
 
+static int
+css_probe (struct device *dev)
+{
+	struct subchannel *sch;
+
+	sch = to_subchannel(dev);
+	sch->driver = container_of (dev->driver, struct css_driver, drv);
+	return (sch->driver->probe ? sch->driver->probe(sch) : 0);
+}
+
+static int
+css_remove (struct device *dev)
+{
+	struct subchannel *sch;
+
+	sch = to_subchannel(dev);
+	return (sch->driver->remove ? sch->driver->remove(sch) : 0);
+}
+
+static void
+css_shutdown (struct device *dev)
+{
+	struct subchannel *sch;
+
+	sch = to_subchannel(dev);
+	if (sch->driver->shutdown)
+		sch->driver->shutdown(sch);
+}
+
 struct bus_type css_bus_type = {
-	.name  = "css",
-	.match = &css_bus_match,
+	.name     = "css",
+	.match    = css_bus_match,
+	.probe    = css_probe,
+	.remove   = css_remove,
+	.shutdown = css_shutdown,
 };
 
 subsys_initcall(init_channel_subsystem);
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h
index 251ebd7..aa5ab5d 100644
--- a/drivers/s390/cio/css.h
+++ b/drivers/s390/cio/css.h
@@ -115,6 +115,7 @@ struct ccw_device_private {
  * Currently, we only care about I/O subchannels (type 0), these
  * have a ccw_device connected to them.
  */
+struct subchannel;
 struct css_driver {
 	unsigned int subchannel_type;
 	struct device_driver drv;
@@ -122,6 +123,9 @@ struct css_driver {
 	int (*notify)(struct device *, int);
 	void (*verify)(struct device *);
 	void (*termination)(struct device *);
+	int (*probe)(struct subchannel *);
+	int (*remove)(struct subchannel *);
+	void (*shutdown)(struct subchannel *);
 };
 
 /*
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index fa3e4c0..eb73605 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -107,33 +107,29 @@ ccw_uevent (struct device *dev, char **e
 	return 0;
 }
 
-struct bus_type ccw_bus_type = {
-	.name  = "ccw",
-	.match = &ccw_bus_match,
-	.uevent = &ccw_uevent,
-};
+struct bus_type ccw_bus_type;
 
-static int io_subchannel_probe (struct device *);
-static int io_subchannel_remove (struct device *);
+static int io_subchannel_probe (struct subchannel *);
+static int io_subchannel_remove (struct subchannel *);
 void io_subchannel_irq (struct device *);
 static int io_subchannel_notify(struct device *, int);
 static void io_subchannel_verify(struct device *);
 static void io_subchannel_ioterm(struct device *);
-static void io_subchannel_shutdown(struct device *);
+static void io_subchannel_shutdown(struct subchannel *);
 
 struct css_driver io_subchannel_driver = {
 	.subchannel_type = SUBCHANNEL_TYPE_IO,
 	.drv = {
 		.name = "io_subchannel",
 		.bus  = &css_bus_type,
-		.probe = &io_subchannel_probe,
-		.remove = &io_subchannel_remove,
-		.shutdown = &io_subchannel_shutdown,
 	},
 	.irq = io_subchannel_irq,
 	.notify = io_subchannel_notify,
 	.verify = io_subchannel_verify,
 	.termination = io_subchannel_ioterm,
+	.probe = io_subchannel_probe,
+	.remove = io_subchannel_remove,
+	.shutdown = io_subchannel_shutdown,
 };
 
 struct workqueue_struct *ccw_device_work;
@@ -803,14 +799,12 @@ io_subchannel_recog(struct ccw_device *c
 }
 
 static int
-io_subchannel_probe (struct device *pdev)
+io_subchannel_probe (struct subchannel *sch)
 {
-	struct subchannel *sch;
 	struct ccw_device *cdev;
 	int rc;
 	unsigned long flags;
 
-	sch = to_subchannel(pdev);
 	if (sch->dev.driver_data) {
 		/*
 		 * This subchannel already has an associated ccw_device.
@@ -846,7 +840,7 @@ io_subchannel_probe (struct device *pdev
 	memset(cdev->private, 0, sizeof(struct ccw_device_private));
 	atomic_set(&cdev->private->onoff, 0);
 	cdev->dev = (struct device) {
-		.parent = pdev,
+		.parent = &sch->dev,
 		.release = ccw_device_release,
 	};
 	INIT_LIST_HEAD(&cdev->private->kick_work.entry);
@@ -859,7 +853,7 @@ io_subchannel_probe (struct device *pdev
 		return -ENODEV;
 	}
 
-	rc = io_subchannel_recog(cdev, to_subchannel(pdev));
+	rc = io_subchannel_recog(cdev, sch);
 	if (rc) {
 		spin_lock_irqsave(&sch->lock, flags);
 		sch->dev.driver_data = NULL;
@@ -883,17 +877,17 @@ ccw_device_unregister(void *data)
 }
 
 static int
-io_subchannel_remove (struct device *dev)
+io_subchannel_remove (struct subchannel *sch)
 {
 	struct ccw_device *cdev;
 	unsigned long flags;
 
-	if (!dev->driver_data)
+	if (!sch->dev.driver_data)
 		return 0;
-	cdev = dev->driver_data;
+	cdev = sch->dev.driver_data;
 	/* Set ccw device to not operational and drop reference. */
 	spin_lock_irqsave(cdev->ccwlock, flags);
-	dev->driver_data = NULL;
+	sch->dev.driver_data = NULL;
 	cdev->private->state = DEV_STATE_NOT_OPER;
 	spin_unlock_irqrestore(cdev->ccwlock, flags);
 	/*
@@ -948,14 +942,12 @@ io_subchannel_ioterm(struct device *dev)
 }
 
 static void
-io_subchannel_shutdown(struct device *dev)
+io_subchannel_shutdown(struct subchannel *sch)
 {
-	struct subchannel *sch;
 	struct ccw_device *cdev;
 	int ret;
 
-	sch = to_subchannel(dev);
-	cdev = dev->driver_data;
+	cdev = sch->dev.driver_data;
 
 	if (cio_is_console(sch->schid))
 		return;
@@ -1129,6 +1121,14 @@ ccw_device_remove (struct device *dev)
 	return 0;
 }
 
+struct bus_type ccw_bus_type = {
+	.name   = "ccw",
+	.match  = ccw_bus_match,
+	.uevent = ccw_uevent,
+	.probe  = ccw_device_probe,
+	.remove = ccw_device_remove,
+};
+
 int
 ccw_driver_register (struct ccw_driver *cdriver)
 {
@@ -1136,8 +1136,6 @@ ccw_driver_register (struct ccw_driver *
 
 	drv->bus = &ccw_bus_type;
 	drv->name = cdriver->name;
-	drv->probe = ccw_device_probe;
-	drv->remove = ccw_device_remove;
 
 	return driver_register(drv);
 }


  reply	other threads:[~2006-01-13 19:50 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-13 19:46 [GIT PATCH] More Driver Core patches for 2.6.15 Greg KH
2006-01-13 19:50 ` [PATCH] Add bus_type probe, remove, shutdown methods Greg KH
2006-01-13 19:50   ` [PATCH] Add pci_bus_type probe and remove methods Greg KH
2006-01-13 19:50     ` [PATCH] INPUT: add MODALIAS to the event environment Greg KH
2006-01-13 19:50       ` [PATCH] Add SA1111 bus_type probe/remove methods Greg KH
2006-01-13 19:50         ` [PATCH] Add locomo " Greg KH
2006-01-13 19:50           ` [PATCH] Add logic module " Greg KH
2006-01-13 19:50             ` [PATCH] Add tiocx " Greg KH
2006-01-13 19:50               ` [PATCH] Add ecard_bus_type probe/remove/shutdown methods Greg KH
2006-01-13 19:50                 ` [PATCH] Add of_platform_bus_type probe and remove methods Greg KH
2006-01-13 19:50                   ` [PATCH] Add ocp_bus_type " Greg KH
2006-01-13 19:50                     ` [PATCH] Add parisc_bus_type " Greg KH
2006-01-13 19:50                       ` [PATCH] Add sh_bus_type " Greg KH
2006-01-13 19:50                         ` [PATCH] Add gameport bus_type " Greg KH
2006-01-13 19:50                           ` [PATCH] Add vio_bus_type " Greg KH
2006-01-13 19:50                             ` [PATCH] Add serio bus_type " Greg KH
2006-01-13 19:50                               ` [PATCH] Add dio_bus_type " Greg KH
2006-01-13 19:50                                 ` [PATCH] Add i2c_bus_type " Greg KH
2006-01-13 19:50                                   ` [PATCH] Add pcmcia_bus_type " Greg KH
2006-01-13 19:50                                     ` [PATCH] Add MCP bus_type " Greg KH
2006-01-13 19:50                                       ` [PATCH] Add macio_bus_type " Greg KH
2006-01-13 19:50                                         ` [PATCH] Add mmc_bus_type " Greg KH
2006-01-13 19:50                                           ` [PATCH] Add pnp_bus_type " Greg KH
2006-01-13 19:50                                             ` [PATCH] Add usb_serial_bus_type " Greg KH
2006-01-13 19:50                                               ` [PATCH] Add ccwgroup_bus_type " Greg KH
2006-01-13 19:50                                                 ` [PATCH] Add superhyway_bus_type " Greg KH
2006-01-13 19:50                                                   ` [PATCH] Add ide_bus_type " Greg KH
2006-01-13 19:50                                                     ` [PATCH] Add zorro_bus_type " Greg KH
2006-01-13 19:50                                                       ` [PATCH] Add Pseudo LLD bus_type " Greg KH
2006-01-13 19:50                                                         ` [PATCH] Add rio_bus_type " Greg KH
2006-01-13 19:50                                                           ` [PATCH] platform-device-del typo fix Greg KH
2006-01-13 19:50                                                             ` [PATCH] Add bttv sub bus_type probe and remove methods Greg KH
2006-01-13 19:50                                                               ` Greg KH [this message]
2006-01-13 19:50                                                                 ` [PATCH] Remove usb gadget generic driver methods Greg KH
2006-01-13 19:50                                                                   ` [PATCH] device_shutdown can loop if the driver frees itself Greg KH
2006-01-13 20:06                                                     ` [PATCH] Add ide_bus_type probe and remove methods Bartlomiej Zolnierkiewicz
2006-01-14 19:57                                                       ` Russell King
2006-01-14 20:32                                                         ` Bartlomiej Zolnierkiewicz
2006-01-23  8:39                                                         ` Bartlomiej Zolnierkiewicz
2006-01-14  5:14       ` [PATCH] INPUT: add MODALIAS to the event environment Alexander E. Patrakov
2006-01-14 11:04         ` Kay Sievers
2006-01-14 13:15           ` Alexander E. Patrakov
2006-01-14 13:21             ` Kay Sievers
2006-01-14 13:42               ` Alexander E. Patrakov
2006-01-14 14:11                 ` Kay Sievers
2006-01-14 14:50                   ` Alexander E. Patrakov
2006-01-23  6:00             ` Dmitry Torokhov
  -- strict thread matches above, loose matches on Subject: below --
2006-01-05 14:29 [CFT 1/29] Add bus_type probe, remove, shutdown methods Russell King
2006-01-06 11:48 ` Russell King
2006-01-06 13:38   ` Cornelia Huck
2006-01-11  9:56     ` [PATCH] Add {css,ccw}_bus_type " Cornelia Huck

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=11371818121681@kroah.com \
    --to=gregkh@suse.de \
    --cc=greg@kroah.com \
    --cc=huckc@de.ibm.com \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).