diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-28 10:27:18 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:26:13 -0500 |
commit | 016c1291ce70a22f15f666441a4fd2f0b450375b (patch) | |
tree | 650a0d91aa87bcf6146f98eadf0341d46ce0ef0f /drivers/mtd/mtdoops.c | |
parent | 4991e7251ed951a5f33faf25912e9db416306309 (diff) |
mtd: mtdoops: do not use mtd->panic_write directly
Instead of checking if 'mtd->panic_write' is defined, call 'mtd_panic_write()'
and check the error code - '-EOPNOTSUPP' will be returned if the function is
not defined.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdoops.c')
-rw-r--r-- | drivers/mtd/mtdoops.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 69532a34e563..c8540b8a7fc6 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c | |||
@@ -221,10 +221,14 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic) | |||
221 | hdr[0] = cxt->nextcount; | 221 | hdr[0] = cxt->nextcount; |
222 | hdr[1] = MTDOOPS_KERNMSG_MAGIC; | 222 | hdr[1] = MTDOOPS_KERNMSG_MAGIC; |
223 | 223 | ||
224 | if (panic) | 224 | if (panic) { |
225 | ret = mtd_panic_write(mtd, cxt->nextpage * record_size, | 225 | ret = mtd_panic_write(mtd, cxt->nextpage * record_size, |
226 | record_size, &retlen, cxt->oops_buf); | 226 | record_size, &retlen, cxt->oops_buf); |
227 | else | 227 | if (ret == -EOPNOTSUPP) { |
228 | printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n"); | ||
229 | return; | ||
230 | } | ||
231 | } else | ||
228 | ret = mtd_write(mtd, cxt->nextpage * record_size, | 232 | ret = mtd_write(mtd, cxt->nextpage * record_size, |
229 | record_size, &retlen, cxt->oops_buf); | 233 | record_size, &retlen, cxt->oops_buf); |
230 | 234 | ||
@@ -330,13 +334,8 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper, | |||
330 | memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); | 334 | memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); |
331 | 335 | ||
332 | /* Panics must be written immediately */ | 336 | /* Panics must be written immediately */ |
333 | if (reason != KMSG_DUMP_OOPS) { | 337 | if (reason != KMSG_DUMP_OOPS) |
334 | if (!cxt->mtd->panic_write) | 338 | mtdoops_write(cxt, 1); |
335 | printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n"); | ||
336 | else | ||
337 | mtdoops_write(cxt, 1); | ||
338 | return; | ||
339 | } | ||
340 | 339 | ||
341 | /* For other cases, schedule work to write it "nicely" */ | 340 | /* For other cases, schedule work to write it "nicely" */ |
342 | schedule_work(&cxt->work_write); | 341 | schedule_work(&cxt->work_write); |