[PATCH 0/2] UBI: fix ubi.mtd MODULE_PARM_DESC issues and add per-device wear-leveling threshold

From: Ran Hongyun

Date: Wed Jul 22 2026 - 22:22:02 EST


This series adds a per-device wear-leveling threshold for UBI devices,
with a preparatory fix to the MODULE_PARM_DESC.

Patch 1 fixes two pre-existing issues in the ubi.mtd MODULE_PARM_DESC:
the parameter format string was missing the enable_fm and need_resv_pool
tokens, and the bad-block reservation note was misplaced after Example 5
instead of after Example 3.

Patch 2 extends struct ubi_attach_req with a __s32 wl_threshold field,
plumbs it through the ioctl and module parameter paths, and replaces
the compile-time macros UBI_WL_THRESHOLD and WL_FREE_MAX_DIFF with p
er-device fields across wl.c and fastmap-wl.c. 0 means "use the kernel
default", the accepted range is 2-65536.

Ran Hongyun (2):
UBI: fix two issues in the ubi.mtd MODULE_PARM_DESC
UBI: support per-device wear-leveling threshold

drivers/mtd/ubi/build.c | 43 ++++++++++++++++++++++++++++++------
drivers/mtd/ubi/cdev.c | 2 +-
drivers/mtd/ubi/fastmap-wl.c | 8 +++----
drivers/mtd/ubi/ubi.h | 21 +++++++++++++++++-
drivers/mtd/ubi/wl.c | 39 ++++++++------------------------
include/uapi/mtd/ubi-user.h | 10 ++++++++-
6 files changed, 79 insertions(+), 44 deletions(-)

--
2.52.0