Преглед изворни кода

[S390] cio: introduce ccw_device_schedule_sch_unregister

Introduce ccw_device_schedule_sch_unregister as a wrapper for queuing
ccw_device_call_sch_unregister on the slow_path_wq. This wrapper
will be used in the next patch.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Sebastian Ott пре 16 година
родитељ
комит
c4621a6264
2 измењених фајлова са 12 додато и 10 уклоњено
  1. 11 10
      drivers/s390/cio/device.c
  2. 1 0
      drivers/s390/cio/device.h

+ 11 - 10
drivers/s390/cio/device.c

@@ -310,8 +310,6 @@ static void ccw_device_remove_orphan_cb(struct work_struct *work)
 	put_device(&cdev->dev);
 	put_device(&cdev->dev);
 }
 }
 
 
-static void ccw_device_call_sch_unregister(struct work_struct *work);
-
 static void
 static void
 ccw_device_remove_disconnected(struct ccw_device *cdev)
 ccw_device_remove_disconnected(struct ccw_device *cdev)
 {
 {
@@ -335,11 +333,10 @@ ccw_device_remove_disconnected(struct ccw_device *cdev)
 		spin_unlock_irqrestore(cdev->ccwlock, flags);
 		spin_unlock_irqrestore(cdev->ccwlock, flags);
 		PREPARE_WORK(&cdev->private->kick_work,
 		PREPARE_WORK(&cdev->private->kick_work,
 				ccw_device_remove_orphan_cb);
 				ccw_device_remove_orphan_cb);
+		queue_work(slow_path_wq, &cdev->private->kick_work);
 	} else
 	} else
 		/* Deregister subchannel, which will kill the ccw device. */
 		/* Deregister subchannel, which will kill the ccw device. */
-		PREPARE_WORK(&cdev->private->kick_work,
-				ccw_device_call_sch_unregister);
-	queue_work(slow_path_wq, &cdev->private->kick_work);
+		ccw_device_schedule_sch_unregister(cdev);
 }
 }
 
 
 /**
 /**
@@ -1020,6 +1017,13 @@ static void ccw_device_call_sch_unregister(struct work_struct *work)
 	put_device(&sch->dev);
 	put_device(&sch->dev);
 }
 }
 
 
+void ccw_device_schedule_sch_unregister(struct ccw_device *cdev)
+{
+	PREPARE_WORK(&cdev->private->kick_work,
+		     ccw_device_call_sch_unregister);
+	queue_work(slow_path_wq, &cdev->private->kick_work);
+}
+
 /*
 /*
  * subchannel recognition done. Called from the state machine.
  * subchannel recognition done. Called from the state machine.
  */
  */
@@ -1036,9 +1040,7 @@ io_subchannel_recog_done(struct ccw_device *cdev)
 		/* Remove device found not operational. */
 		/* Remove device found not operational. */
 		if (!get_device(&cdev->dev))
 		if (!get_device(&cdev->dev))
 			break;
 			break;
-		PREPARE_WORK(&cdev->private->kick_work,
-			     ccw_device_call_sch_unregister);
-		queue_work(slow_path_wq, &cdev->private->kick_work);
+		ccw_device_schedule_sch_unregister(cdev);
 		if (atomic_dec_and_test(&ccw_device_init_count))
 		if (atomic_dec_and_test(&ccw_device_init_count))
 			wake_up(&ccw_device_init_wq);
 			wake_up(&ccw_device_init_wq);
 		break;
 		break;
@@ -1557,8 +1559,7 @@ static int purge_fn(struct device *dev, void *data)
 		goto out;
 		goto out;
 	CIO_MSG_EVENT(3, "ccw: purging 0.%x.%04x\n", priv->dev_id.ssid,
 	CIO_MSG_EVENT(3, "ccw: purging 0.%x.%04x\n", priv->dev_id.ssid,
 		      priv->dev_id.devno);
 		      priv->dev_id.devno);
-	PREPARE_WORK(&cdev->private->kick_work, ccw_device_call_sch_unregister);
-	queue_work(slow_path_wq, &cdev->private->kick_work);
+	ccw_device_schedule_sch_unregister(cdev);
 
 
 out:
 out:
 	/* Abort loop in case of pending signal. */
 	/* Abort loop in case of pending signal. */

+ 1 - 0
drivers/s390/cio/device.h

@@ -87,6 +87,7 @@ int ccw_device_is_orphan(struct ccw_device *);
 int ccw_device_recognition(struct ccw_device *);
 int ccw_device_recognition(struct ccw_device *);
 int ccw_device_online(struct ccw_device *);
 int ccw_device_online(struct ccw_device *);
 int ccw_device_offline(struct ccw_device *);
 int ccw_device_offline(struct ccw_device *);
+void ccw_device_schedule_sch_unregister(struct ccw_device *);
 int ccw_purge_blacklisted(void);
 int ccw_purge_blacklisted(void);
 
 
 /* Function prototypes for device status and basic sense stuff. */
 /* Function prototypes for device status and basic sense stuff. */