diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-04-17 01:46:31 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2008-04-17 01:47:07 -0400 |
commit | ca68305bf3c76c4a7cd1c77d5423219f39164df8 (patch) | |
tree | dc73a7d9eb53a47d16690e8106a097aa8f601866 /drivers | |
parent | 9e74a6b8983c2653dd2a6f51e634efa281e95d59 (diff) |
[S390] Remove code duplication from monreader / dcssblk.
Move the function that prints the segment warning messages found in the
monreader driver and the dcssblk driver to the extmem base code.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/s390/block/dcssblk.c | 53 | ||||
-rw-r--r-- | drivers/s390/char/monreader.c | 54 |
2 files changed, 3 insertions, 104 deletions
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index e6c94dbfdeaa..04787eab1016 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -142,57 +142,6 @@ dcssblk_get_device_by_name(char *name) | |||
142 | return NULL; | 142 | return NULL; |
143 | } | 143 | } |
144 | 144 | ||
145 | /* | ||
146 | * print appropriate error message for segment_load()/segment_type() | ||
147 | * return code | ||
148 | */ | ||
149 | static void | ||
150 | dcssblk_segment_warn(int rc, char* seg_name) | ||
151 | { | ||
152 | switch (rc) { | ||
153 | case -ENOENT: | ||
154 | PRINT_WARN("cannot load/query segment %s, does not exist\n", | ||
155 | seg_name); | ||
156 | break; | ||
157 | case -ENOSYS: | ||
158 | PRINT_WARN("cannot load/query segment %s, not running on VM\n", | ||
159 | seg_name); | ||
160 | break; | ||
161 | case -EIO: | ||
162 | PRINT_WARN("cannot load/query segment %s, hardware error\n", | ||
163 | seg_name); | ||
164 | break; | ||
165 | case -ENOTSUPP: | ||
166 | PRINT_WARN("cannot load/query segment %s, is a multi-part " | ||
167 | "segment\n", seg_name); | ||
168 | break; | ||
169 | case -ENOSPC: | ||
170 | PRINT_WARN("cannot load/query segment %s, overlaps with " | ||
171 | "storage\n", seg_name); | ||
172 | break; | ||
173 | case -EBUSY: | ||
174 | PRINT_WARN("cannot load/query segment %s, overlaps with " | ||
175 | "already loaded dcss\n", seg_name); | ||
176 | break; | ||
177 | case -EPERM: | ||
178 | PRINT_WARN("cannot load/query segment %s, already loaded in " | ||
179 | "incompatible mode\n", seg_name); | ||
180 | break; | ||
181 | case -ENOMEM: | ||
182 | PRINT_WARN("cannot load/query segment %s, out of memory\n", | ||
183 | seg_name); | ||
184 | break; | ||
185 | case -ERANGE: | ||
186 | PRINT_WARN("cannot load/query segment %s, exceeds kernel " | ||
187 | "mapping range\n", seg_name); | ||
188 | break; | ||
189 | default: | ||
190 | PRINT_WARN("cannot load/query segment %s, return value %i\n", | ||
191 | seg_name, rc); | ||
192 | break; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | static void dcssblk_unregister_callback(struct device *dev) | 145 | static void dcssblk_unregister_callback(struct device *dev) |
197 | { | 146 | { |
198 | device_unregister(dev); | 147 | device_unregister(dev); |
@@ -423,7 +372,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char | |||
423 | rc = segment_load(local_buf, SEGMENT_SHARED, | 372 | rc = segment_load(local_buf, SEGMENT_SHARED, |
424 | &dev_info->start, &dev_info->end); | 373 | &dev_info->start, &dev_info->end); |
425 | if (rc < 0) { | 374 | if (rc < 0) { |
426 | dcssblk_segment_warn(rc, dev_info->segment_name); | 375 | segment_warning(rc, dev_info->segment_name); |
427 | goto dealloc_gendisk; | 376 | goto dealloc_gendisk; |
428 | } | 377 | } |
429 | seg_byte_size = (dev_info->end - dev_info->start + 1); | 378 | seg_byte_size = (dev_info->end - dev_info->start + 1); |
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index 67009bfa093e..1e1f50655bbf 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c | |||
@@ -111,56 +111,6 @@ static void dcss_mkname(char *ascii_name, char *ebcdic_name) | |||
111 | ASCEBC(ebcdic_name, 8); | 111 | ASCEBC(ebcdic_name, 8); |
112 | } | 112 | } |
113 | 113 | ||
114 | /* | ||
115 | * print appropriate error message for segment_load()/segment_type() | ||
116 | * return code | ||
117 | */ | ||
118 | static void mon_segment_warn(int rc, char* seg_name) | ||
119 | { | ||
120 | switch (rc) { | ||
121 | case -ENOENT: | ||
122 | P_WARNING("cannot load/query segment %s, does not exist\n", | ||
123 | seg_name); | ||
124 | break; | ||
125 | case -ENOSYS: | ||
126 | P_WARNING("cannot load/query segment %s, not running on VM\n", | ||
127 | seg_name); | ||
128 | break; | ||
129 | case -EIO: | ||
130 | P_WARNING("cannot load/query segment %s, hardware error\n", | ||
131 | seg_name); | ||
132 | break; | ||
133 | case -ENOTSUPP: | ||
134 | P_WARNING("cannot load/query segment %s, is a multi-part " | ||
135 | "segment\n", seg_name); | ||
136 | break; | ||
137 | case -ENOSPC: | ||
138 | P_WARNING("cannot load/query segment %s, overlaps with " | ||
139 | "storage\n", seg_name); | ||
140 | break; | ||
141 | case -EBUSY: | ||
142 | P_WARNING("cannot load/query segment %s, overlaps with " | ||
143 | "already loaded dcss\n", seg_name); | ||
144 | break; | ||
145 | case -EPERM: | ||
146 | P_WARNING("cannot load/query segment %s, already loaded in " | ||
147 | "incompatible mode\n", seg_name); | ||
148 | break; | ||
149 | case -ENOMEM: | ||
150 | P_WARNING("cannot load/query segment %s, out of memory\n", | ||
151 | seg_name); | ||
152 | break; | ||
153 | case -ERANGE: | ||
154 | P_WARNING("cannot load/query segment %s, exceeds kernel " | ||
155 | "mapping range\n", seg_name); | ||
156 | break; | ||
157 | default: | ||
158 | P_WARNING("cannot load/query segment %s, return value %i\n", | ||
159 | seg_name, rc); | ||
160 | break; | ||
161 | } | ||
162 | } | ||
163 | |||
164 | static inline unsigned long mon_mca_start(struct mon_msg *monmsg) | 114 | static inline unsigned long mon_mca_start(struct mon_msg *monmsg) |
165 | { | 115 | { |
166 | return *(u32 *) &monmsg->msg.rmmsg; | 116 | return *(u32 *) &monmsg->msg.rmmsg; |
@@ -585,7 +535,7 @@ static int __init mon_init(void) | |||
585 | 535 | ||
586 | rc = segment_type(mon_dcss_name); | 536 | rc = segment_type(mon_dcss_name); |
587 | if (rc < 0) { | 537 | if (rc < 0) { |
588 | mon_segment_warn(rc, mon_dcss_name); | 538 | segment_warning(rc, mon_dcss_name); |
589 | goto out_iucv; | 539 | goto out_iucv; |
590 | } | 540 | } |
591 | if (rc != SEG_TYPE_SC) { | 541 | if (rc != SEG_TYPE_SC) { |
@@ -598,7 +548,7 @@ static int __init mon_init(void) | |||
598 | rc = segment_load(mon_dcss_name, SEGMENT_SHARED, | 548 | rc = segment_load(mon_dcss_name, SEGMENT_SHARED, |
599 | &mon_dcss_start, &mon_dcss_end); | 549 | &mon_dcss_start, &mon_dcss_end); |
600 | if (rc < 0) { | 550 | if (rc < 0) { |
601 | mon_segment_warn(rc, mon_dcss_name); | 551 | segment_warning(rc, mon_dcss_name); |
602 | rc = -EINVAL; | 552 | rc = -EINVAL; |
603 | goto out_iucv; | 553 | goto out_iucv; |
604 | } | 554 | } |