@@ -67,32 +67,9 @@ static int iucv_bus_match(struct device *dev, struct device_driver *drv)
6767 return 0 ;
6868}
6969
70- enum iucv_pm_states {
71- IUCV_PM_INITIAL = 0 ,
72- IUCV_PM_FREEZING = 1 ,
73- IUCV_PM_THAWING = 2 ,
74- IUCV_PM_RESTORING = 3 ,
75- };
76- static enum iucv_pm_states iucv_pm_state ;
77-
78- static int iucv_pm_prepare (struct device * );
79- static void iucv_pm_complete (struct device * );
80- static int iucv_pm_freeze (struct device * );
81- static int iucv_pm_thaw (struct device * );
82- static int iucv_pm_restore (struct device * );
83-
84- static const struct dev_pm_ops iucv_pm_ops = {
85- .prepare = iucv_pm_prepare ,
86- .complete = iucv_pm_complete ,
87- .freeze = iucv_pm_freeze ,
88- .thaw = iucv_pm_thaw ,
89- .restore = iucv_pm_restore ,
90- };
91-
9270struct bus_type iucv_bus = {
9371 .name = "iucv" ,
9472 .match = iucv_bus_match ,
95- .pm = & iucv_pm_ops ,
9673};
9774EXPORT_SYMBOL (iucv_bus );
9875
@@ -434,31 +411,6 @@ static void iucv_block_cpu(void *data)
434411 cpumask_clear_cpu (cpu , & iucv_irq_cpumask );
435412}
436413
437- /**
438- * iucv_block_cpu_almost
439- * @data: unused
440- *
441- * Allow connection-severed interrupts only on this cpu.
442- */
443- static void iucv_block_cpu_almost (void * data )
444- {
445- int cpu = smp_processor_id ();
446- union iucv_param * parm ;
447-
448- /* Allow iucv control interrupts only */
449- parm = iucv_param_irq [cpu ];
450- memset (parm , 0 , sizeof (union iucv_param ));
451- parm -> set_mask .ipmask = 0x08 ;
452- iucv_call_b2f0 (IUCV_SETMASK , parm );
453- /* Allow iucv-severed interrupt only */
454- memset (parm , 0 , sizeof (union iucv_param ));
455- parm -> set_mask .ipmask = 0x20 ;
456- iucv_call_b2f0 (IUCV_SETCONTROLMASK , parm );
457-
458- /* Clear indication that iucv interrupts are allowed for this cpu. */
459- cpumask_clear_cpu (cpu , & iucv_irq_cpumask );
460- }
461-
462414/**
463415 * iucv_declare_cpu
464416 * @data: unused
@@ -1834,146 +1786,6 @@ static void iucv_external_interrupt(struct ext_code ext_code,
18341786 spin_unlock (& iucv_queue_lock );
18351787}
18361788
1837- static int iucv_pm_prepare (struct device * dev )
1838- {
1839- int rc = 0 ;
1840-
1841- #ifdef CONFIG_PM_DEBUG
1842- printk (KERN_INFO "iucv_pm_prepare\n" );
1843- #endif
1844- if (dev -> driver && dev -> driver -> pm && dev -> driver -> pm -> prepare )
1845- rc = dev -> driver -> pm -> prepare (dev );
1846- return rc ;
1847- }
1848-
1849- static void iucv_pm_complete (struct device * dev )
1850- {
1851- #ifdef CONFIG_PM_DEBUG
1852- printk (KERN_INFO "iucv_pm_complete\n" );
1853- #endif
1854- if (dev -> driver && dev -> driver -> pm && dev -> driver -> pm -> complete )
1855- dev -> driver -> pm -> complete (dev );
1856- }
1857-
1858- /**
1859- * iucv_path_table_empty() - determine if iucv path table is empty
1860- *
1861- * Returns 0 if there are still iucv pathes defined
1862- * 1 if there are no iucv pathes defined
1863- */
1864- static int iucv_path_table_empty (void )
1865- {
1866- int i ;
1867-
1868- for (i = 0 ; i < iucv_max_pathid ; i ++ ) {
1869- if (iucv_path_table [i ])
1870- return 0 ;
1871- }
1872- return 1 ;
1873- }
1874-
1875- /**
1876- * iucv_pm_freeze() - Freeze PM callback
1877- * @dev: iucv-based device
1878- *
1879- * disable iucv interrupts
1880- * invoke callback function of the iucv-based driver
1881- * shut down iucv, if no iucv-pathes are established anymore
1882- */
1883- static int iucv_pm_freeze (struct device * dev )
1884- {
1885- int cpu ;
1886- struct iucv_irq_list * p , * n ;
1887- int rc = 0 ;
1888-
1889- #ifdef CONFIG_PM_DEBUG
1890- printk (KERN_WARNING "iucv_pm_freeze\n" );
1891- #endif
1892- if (iucv_pm_state != IUCV_PM_FREEZING ) {
1893- for_each_cpu (cpu , & iucv_irq_cpumask )
1894- smp_call_function_single (cpu , iucv_block_cpu_almost ,
1895- NULL , 1 );
1896- cancel_work_sync (& iucv_work );
1897- list_for_each_entry_safe (p , n , & iucv_work_queue , list ) {
1898- list_del_init (& p -> list );
1899- iucv_sever_pathid (p -> data .ippathid ,
1900- iucv_error_no_listener );
1901- kfree (p );
1902- }
1903- }
1904- iucv_pm_state = IUCV_PM_FREEZING ;
1905- if (dev -> driver && dev -> driver -> pm && dev -> driver -> pm -> freeze )
1906- rc = dev -> driver -> pm -> freeze (dev );
1907- if (iucv_path_table_empty ())
1908- iucv_disable ();
1909- return rc ;
1910- }
1911-
1912- /**
1913- * iucv_pm_thaw() - Thaw PM callback
1914- * @dev: iucv-based device
1915- *
1916- * make iucv ready for use again: allocate path table, declare interrupt buffers
1917- * and enable iucv interrupts
1918- * invoke callback function of the iucv-based driver
1919- */
1920- static int iucv_pm_thaw (struct device * dev )
1921- {
1922- int rc = 0 ;
1923-
1924- #ifdef CONFIG_PM_DEBUG
1925- printk (KERN_WARNING "iucv_pm_thaw\n" );
1926- #endif
1927- iucv_pm_state = IUCV_PM_THAWING ;
1928- if (!iucv_path_table ) {
1929- rc = iucv_enable ();
1930- if (rc )
1931- goto out ;
1932- }
1933- if (cpumask_empty (& iucv_irq_cpumask )) {
1934- if (iucv_nonsmp_handler )
1935- /* enable interrupts on one cpu */
1936- iucv_allow_cpu (NULL );
1937- else
1938- /* enable interrupts on all cpus */
1939- iucv_setmask_mp ();
1940- }
1941- if (dev -> driver && dev -> driver -> pm && dev -> driver -> pm -> thaw )
1942- rc = dev -> driver -> pm -> thaw (dev );
1943- out :
1944- return rc ;
1945- }
1946-
1947- /**
1948- * iucv_pm_restore() - Restore PM callback
1949- * @dev: iucv-based device
1950- *
1951- * make iucv ready for use again: allocate path table, declare interrupt buffers
1952- * and enable iucv interrupts
1953- * invoke callback function of the iucv-based driver
1954- */
1955- static int iucv_pm_restore (struct device * dev )
1956- {
1957- int rc = 0 ;
1958-
1959- #ifdef CONFIG_PM_DEBUG
1960- printk (KERN_WARNING "iucv_pm_restore %p\n" , iucv_path_table );
1961- #endif
1962- if ((iucv_pm_state != IUCV_PM_RESTORING ) && iucv_path_table )
1963- pr_warn ("Suspending Linux did not completely close all IUCV connections\n" );
1964- iucv_pm_state = IUCV_PM_RESTORING ;
1965- if (cpumask_empty (& iucv_irq_cpumask )) {
1966- rc = iucv_query_maxconn ();
1967- rc = iucv_enable ();
1968- if (rc )
1969- goto out ;
1970- }
1971- if (dev -> driver && dev -> driver -> pm && dev -> driver -> pm -> restore )
1972- rc = dev -> driver -> pm -> restore (dev );
1973- out :
1974- return rc ;
1975- }
1976-
19771789struct iucv_interface iucv_if = {
19781790 .message_receive = iucv_message_receive ,
19791791 .__message_receive = __iucv_message_receive ,
0 commit comments