aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/css.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/cio/css.c')
-rw-r--r--drivers/s390/cio/css.c65
1 files changed, 57 insertions, 8 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 393c73c47f87..95805da2bb26 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -601,8 +601,7 @@ static void css_process_crw(struct crw *crw0, struct crw *crw1, int overflow)
601 css_evaluate_subchannel(mchk_schid, 0); 601 css_evaluate_subchannel(mchk_schid, 0);
602} 602}
603 603
604static int __init 604static int __init setup_subchannel(struct subchannel_id schid, void *data)
605__init_channel_subsystem(struct subchannel_id schid, void *data)
606{ 605{
607 struct subchannel *sch; 606 struct subchannel *sch;
608 int ret; 607 int ret;
@@ -854,14 +853,13 @@ static struct notifier_block css_power_notifier = {
854 * The struct subchannel's are created during probing (except for the 853 * The struct subchannel's are created during probing (except for the
855 * static console subchannel). 854 * static console subchannel).
856 */ 855 */
857static int __init 856static int __init css_bus_init(void)
858init_channel_subsystem (void)
859{ 857{
860 int ret, i; 858 int ret, i;
861 859
862 ret = chsc_determine_css_characteristics(); 860 ret = chsc_determine_css_characteristics();
863 if (ret == -ENOMEM) 861 if (ret == -ENOMEM)
864 goto out; /* No need to continue. */ 862 goto out;
865 863
866 ret = chsc_alloc_sei_area(); 864 ret = chsc_alloc_sei_area();
867 if (ret) 865 if (ret)
@@ -934,7 +932,6 @@ init_channel_subsystem (void)
934 /* Enable default isc for I/O subchannels. */ 932 /* Enable default isc for I/O subchannels. */
935 isc_register(IO_SCH_ISC); 933 isc_register(IO_SCH_ISC);
936 934
937 for_each_subchannel(__init_channel_subsystem, NULL);
938 return 0; 935 return 0;
939out_file: 936out_file:
940 if (css_chsc_characteristics.secm) 937 if (css_chsc_characteristics.secm)
@@ -966,6 +963,60 @@ out:
966 return ret; 963 return ret;
967} 964}
968 965
966static void __init css_bus_cleanup(void)
967{
968 struct channel_subsystem *css;
969 int i;
970
971 for (i = 0; i <= __MAX_CSSID; i++) {
972 css = channel_subsystems[i];
973 device_unregister(&css->pseudo_subchannel->dev);
974 css->pseudo_subchannel = NULL;
975 if (css_chsc_characteristics.secm)
976 device_remove_file(&css->device, &dev_attr_cm_enable);
977 device_unregister(&css->device);
978 }
979 bus_unregister(&css_bus_type);
980 crw_unregister_handler(CRW_RSC_CSS);
981 chsc_free_sei_area();
982 kfree(slow_subchannel_set);
983 isc_unregister(IO_SCH_ISC);
984}
985
986static int __init channel_subsystem_init(void)
987{
988 int ret;
989
990 ret = css_bus_init();
991 if (ret)
992 return ret;
993
994 ret = io_subchannel_init();
995 if (ret)
996 css_bus_cleanup();
997
998 return ret;
999}
1000subsys_initcall(channel_subsystem_init);
1001
1002/*
1003 * Wait for the initialization of devices to finish, to make sure we are
1004 * done with our setup if the search for the root device starts.
1005 */
1006static int __init channel_subsystem_init_sync(void)
1007{
1008 /* Allocate and register subchannels. */
1009 for_each_subchannel(setup_subchannel, NULL);
1010
1011 /* Wait for the initialization of ccw devices to finish. */
1012 wait_event(ccw_device_init_wq,
1013 atomic_read(&ccw_device_init_count) == 0);
1014 flush_workqueue(ccw_device_work);
1015
1016 return 0;
1017}
1018subsys_initcall_sync(channel_subsystem_init_sync);
1019
969int sch_is_pseudo_sch(struct subchannel *sch) 1020int sch_is_pseudo_sch(struct subchannel *sch)
970{ 1021{
971 return sch == to_css(sch->dev.parent)->pseudo_subchannel; 1022 return sch == to_css(sch->dev.parent)->pseudo_subchannel;
@@ -1135,7 +1186,5 @@ void css_driver_unregister(struct css_driver *cdrv)
1135} 1186}
1136EXPORT_SYMBOL_GPL(css_driver_unregister); 1187EXPORT_SYMBOL_GPL(css_driver_unregister);
1137 1188
1138subsys_initcall(init_channel_subsystem);
1139
1140MODULE_LICENSE("GPL"); 1189MODULE_LICENSE("GPL");
1141EXPORT_SYMBOL(css_bus_type); 1190EXPORT_SYMBOL(css_bus_type);