lkml.org 
[lkml]   [2007]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 05/47] cio: Reset sch->driver.
From: Cornelia Huck <cornelia.huck@de.ibm.com>

sch->driver needs to be reset to NULL on failed probe and after
remove. We also need to check for sch->driver on shutdown.

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

drivers/s390/cio/css.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

Index: quilt-2.6/drivers/s390/cio/css.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/css.c
+++ quilt-2.6/drivers/s390/cio/css.c
@@ -796,32 +796,36 @@ css_bus_match (struct device *dev, struc
return 0;
}

-static int
-css_probe (struct device *dev)
+static int css_probe(struct device *dev)
{
struct subchannel *sch;
+ int ret;

sch = to_subchannel(dev);
sch->driver = to_cssdriver(dev->driver);
- return (sch->driver->probe ? sch->driver->probe(sch) : 0);
+ ret = sch->driver->probe ? sch->driver->probe(sch) : 0;
+ if (ret)
+ sch->driver = NULL;
+ return ret;
}

-static int
-css_remove (struct device *dev)
+static int css_remove(struct device *dev)
{
struct subchannel *sch;
+ int ret;

sch = to_subchannel(dev);
- return (sch->driver->remove ? sch->driver->remove(sch) : 0);
+ ret = sch->driver->remove ? sch->driver->remove(sch) : 0;
+ sch->driver = NULL;
+ return ret;
}

-static void
-css_shutdown (struct device *dev)
+static void css_shutdown(struct device *dev)
{
struct subchannel *sch;

sch = to_subchannel(dev);
- if (sch->driver->shutdown)
+ if (sch->driver && sch->driver->shutdown)
sch->driver->shutdown(sch);
}

--
blue skies,
Martin.

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



\
 
 \ /
  Last update: 2007-12-20 16:27    [W:0.213 / U:0.284 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site