aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2008-04-17 01:46:31 -0400
committerHeiko Carstens <heiko.carstens@de.ibm.com>2008-04-17 01:47:07 -0400
commitca68305bf3c76c4a7cd1c77d5423219f39164df8 (patch)
treedc73a7d9eb53a47d16690e8106a097aa8f601866 /drivers/s390/block
parent9e74a6b8983c2653dd2a6f51e634efa281e95d59 (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/s390/block')
-rw-r--r--drivers/s390/block/dcssblk.c53
1 files changed, 1 insertions, 52 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 */
149static void
150dcssblk_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
196static void dcssblk_unregister_callback(struct device *dev) 145static 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);