Skip to content

Commit 0c034fe

Browse files
ezequielgarciajanaszewski
authored andcommitted
mtd: Uninline mtd_write_oob and move it to mtdcore.c
There's no reason for having mtd_write_oob inlined in mtd.h header. Move it to mtdcore.c where it belongs. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
1 parent 916fe61 commit 0c034fe

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎drivers/mtd/mtdcore.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,18 @@ int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops)
997997
}
998998
EXPORT_SYMBOL_GPL(mtd_read_oob);
999999

1000+
int mtd_write_oob(struct mtd_info *mtd, loff_t to,
1001+
struct mtd_oob_ops *ops)
1002+
{
1003+
ops->retlen = ops->oobretlen = 0;
1004+
if (!mtd->_write_oob)
1005+
return -EOPNOTSUPP;
1006+
if (!(mtd->flags & MTD_WRITEABLE))
1007+
return -EROFS;
1008+
return mtd->_write_oob(mtd, to, ops);
1009+
}
1010+
EXPORT_SYMBOL_GPL(mtd_write_oob);
1011+
10001012
/*
10011013
* Method to access the protection register area, present in some flash
10021014
* devices. The user data is one time programmable but the factory data is read

‎include/linux/mtd/mtd.h‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,7 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
283283
const u_char *buf);
284284

285285
int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops);
286-
287-
static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
288-
struct mtd_oob_ops *ops)
289-
{
290-
ops->retlen = ops->oobretlen = 0;
291-
if (!mtd->_write_oob)
292-
return -EOPNOTSUPP;
293-
if (!(mtd->flags & MTD_WRITEABLE))
294-
return -EROFS;
295-
return mtd->_write_oob(mtd, to, ops);
296-
}
286+
int mtd_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops);
297287

298288
int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
299289
struct otp_info *buf);

0 commit comments

Comments
 (0)