Re: [PATCH 4/4] sysfs: make suicidal nodes just do it directly

Cornelia Huck
2007-09-20T09:25:27Z

On Thu, 20 Sep 2007 16:26:15 +0900,
Tejun Heo <htejun@gmail.com> wrote:

> Sysfs now allows direct suicide. Make suicidial sysfs nodes to use
> it and remove now unncessary callback mechanism.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> drivers/base/core.c | 33 ----------------------
> drivers/s390/cio/ccwgroup.c | 25 +++-------------
> drivers/scsi/scsi_sysfs.c | 13 +--------
> fs/sysfs/file.c | 63 -------------------------------------------
> include/linux/device.h | 6 ----
> include/linux/sysfs.h | 9 ------
> 6 files changed, 6 insertions(+), 143 deletions(-)
>

Just browsing through this (I'll review and do some tests later), but
you missed drivers/s390/cio/device.c::ccw_device_remove_disconnected().

Following (not event compile tested) patch (which is basically a revert
of 59a8a6e227cf0bc42e5be741ebfea97c222ab9ef) should take care of it.

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

---
drivers/s390/cio/device.c | 51 +++++++++-------------------------------------
1 files changed, 10 insertions(+), 41 deletions(-)

--- linux-2.6.orig/drivers/s390/cio/device.c
+++ linux-2.6/drivers/s390/cio/device.c
@@ -288,62 +288,31 @@ static void ccw_device_unregister(struct
device_del(&cdev->dev);
}

-static void ccw_device_remove_orphan_cb(struct device *dev)
-{
- struct ccw_device *cdev = to_ccwdev(dev);
-
- ccw_device_unregister(cdev);
- put_device(&cdev->dev);
-}
-
-static void ccw_device_remove_sch_cb(struct device *dev)
-{
- struct subchannel *sch;
-
- sch = to_subchannel(dev);
- css_sch_device_unregister(sch);
- /* Reset intparm to zeroes. */
- sch->schib.pmcw.intparm = 0;
- cio_modify(sch);
- put_device(&sch->dev);
-}
-
static void
ccw_device_remove_disconnected(struct ccw_device *cdev)
{
+ struct subchannel *sch;
unsigned long flags;
- int rc;

/*
* Forced offline in disconnected state means
* 'throw away device'.
*/
if (ccw_device_is_orphan(cdev)) {
- /*
- * Deregister ccw device.
- * Unfortunately, we cannot do this directly from the
- * attribute method.
- */
+ /* Deregister ccw device. */
spin_lock_irqsave(cdev->ccwlock, flags);
cdev->private->state = DEV_STATE_NOT_OPER;
spin_unlock_irqrestore(cdev->ccwlock, flags);
- rc = device_schedule_callback(&cdev->dev,
- ccw_device_remove_orphan_cb);
- if (rc)
- CIO_MSG_EVENT(2, "Couldn't unregister orphan "
- "0.%x.%04x\n",
- cdev->private->dev_id.ssid,
- cdev->private->dev_id.devno);
+ ccw_device_unregister(cdev);
+ put_device(&cdev->dev);
return;
}
- /* Deregister subchannel, which will kill the ccw device. */
- rc = device_schedule_callback(cdev->dev.parent,
- ccw_device_remove_sch_cb);
- if (rc)
- CIO_MSG_EVENT(2, "Couldn't unregister disconnected device "
- "0.%x.%04x\n",
- cdev->private->dev_id.ssid,
- cdev->private->dev_id.devno);
+ sch = to_subchannel(cdev->dev.parent);
+ css_sch_device_unregister(sch);
+ /* Reset intparm to zeroes. */
+ sch->schib.pmcw.intparm = 0;
+ cio_modify(sch);
+ put_device(&sch->dev);
}

/**