[S390] chsc: initialization fixes

This patch fixes:
 * kfree vs. free_page usage
 * structure definition for determine_css_characteristics
 * naming convention for the chsc init function
 * deregistration of crw handlers in the cleanup path

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Sebastian Ott 2010-10-25 16:10:28 +02:00 committed by Martin Schwidefsky
parent b730f3a933
commit 34aec07c17
3 changed files with 17 additions and 17 deletions

View File

@ -2,7 +2,7 @@
* drivers/s390/cio/chsc.c * drivers/s390/cio/chsc.c
* S/390 common I/O routines -- channel subsystem call * S/390 common I/O routines -- channel subsystem call
* *
* Copyright IBM Corp. 1999,2008 * Copyright IBM Corp. 1999,2010
* Author(s): Ingo Adlung (adlung@de.ibm.com) * Author(s): Ingo Adlung (adlung@de.ibm.com)
* Cornelia Huck (cornelia.huck@de.ibm.com) * Cornelia Huck (cornelia.huck@de.ibm.com)
* Arnd Bergmann (arndb@de.ibm.com) * Arnd Bergmann (arndb@de.ibm.com)
@ -813,7 +813,7 @@ out:
return ret; return ret;
} }
int __init chsc_alloc_sei_area(void) int __init chsc_init(void)
{ {
int ret; int ret;
@ -825,14 +825,14 @@ int __init chsc_alloc_sei_area(void)
} }
ret = crw_register_handler(CRW_RSC_CSS, chsc_process_crw); ret = crw_register_handler(CRW_RSC_CSS, chsc_process_crw);
if (ret) if (ret)
kfree(sei_page); free_page((unsigned long)sei_page);
return ret; return ret;
} }
void __init chsc_free_sei_area(void) void __init chsc_init_cleanup(void)
{ {
crw_unregister_handler(CRW_RSC_CSS); crw_unregister_handler(CRW_RSC_CSS);
kfree(sei_page); free_page((unsigned long)sei_page);
} }
int chsc_enable_facility(int operation_code) int chsc_enable_facility(int operation_code)
@ -895,7 +895,7 @@ chsc_determine_css_characteristics(void)
struct chsc_header response; struct chsc_header response;
u32 reserved4; u32 reserved4;
u32 general_char[510]; u32 general_char[510];
u32 chsc_char[518]; u32 chsc_char[508];
} __attribute__ ((packed)) *scsc_area; } __attribute__ ((packed)) *scsc_area;
scsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); scsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);

View File

@ -60,8 +60,8 @@ struct chsc_ssd_info {
extern int chsc_get_ssd_info(struct subchannel_id schid, extern int chsc_get_ssd_info(struct subchannel_id schid,
struct chsc_ssd_info *ssd); struct chsc_ssd_info *ssd);
extern int chsc_determine_css_characteristics(void); extern int chsc_determine_css_characteristics(void);
extern int chsc_alloc_sei_area(void); extern int chsc_init(void);
extern void chsc_free_sei_area(void); extern void chsc_init_cleanup(void);
extern int chsc_enable_facility(int); extern int chsc_enable_facility(int);
struct channel_subsystem; struct channel_subsystem;

View File

@ -1,7 +1,7 @@
/* /*
* driver for channel subsystem * driver for channel subsystem
* *
* Copyright IBM Corp. 2002, 2009 * Copyright IBM Corp. 2002, 2010
* *
* Author(s): Arnd Bergmann (arndb@de.ibm.com) * Author(s): Arnd Bergmann (arndb@de.ibm.com)
* Cornelia Huck (cornelia.huck@de.ibm.com) * Cornelia Huck (cornelia.huck@de.ibm.com)
@ -863,14 +863,14 @@ static int __init css_bus_init(void)
{ {
int ret, i; int ret, i;
ret = chsc_init();
if (ret)
return ret;
ret = chsc_determine_css_characteristics(); ret = chsc_determine_css_characteristics();
if (ret == -ENOMEM) if (ret == -ENOMEM)
goto out; goto out;
ret = chsc_alloc_sei_area();
if (ret)
goto out;
/* Try to enable MSS. */ /* Try to enable MSS. */
ret = chsc_enable_facility(CHSC_SDA_OC_MSS); ret = chsc_enable_facility(CHSC_SDA_OC_MSS);
if (ret) if (ret)
@ -956,9 +956,9 @@ out_unregister:
} }
bus_unregister(&css_bus_type); bus_unregister(&css_bus_type);
out: out:
crw_unregister_handler(CRW_RSC_CSS); crw_unregister_handler(CRW_RSC_SCH);
chsc_free_sei_area();
idset_free(slow_subchannel_set); idset_free(slow_subchannel_set);
chsc_init_cleanup();
pr_alert("The CSS device driver initialization failed with " pr_alert("The CSS device driver initialization failed with "
"errno=%d\n", ret); "errno=%d\n", ret);
return ret; return ret;
@ -978,9 +978,9 @@ static void __init css_bus_cleanup(void)
device_unregister(&css->device); device_unregister(&css->device);
} }
bus_unregister(&css_bus_type); bus_unregister(&css_bus_type);
crw_unregister_handler(CRW_RSC_CSS); crw_unregister_handler(CRW_RSC_SCH);
chsc_free_sei_area();
idset_free(slow_subchannel_set); idset_free(slow_subchannel_set);
chsc_init_cleanup();
isc_unregister(IO_SCH_ISC); isc_unregister(IO_SCH_ISC);
} }