jingfei195887 commented on code in PR #16642: URL: https://github.com/apache/nuttx/pull/16642#discussion_r2206144326
########## boards/arm/samv7/common/src/sam_progmem.c: ########## @@ -66,40 +66,24 @@ static int sam_progmem_register_driver(int minor, struct mtd_dev_s *mtd, const char *devpath) { -#ifdef CONFIG_BCH - char blockdev[18]; - char chardev[12]; -#endif + char mtddev[12]; int ret = OK; - /* Use the FTL layer to wrap the MTD driver as a block driver */ - - ret = ftl_initialize(minor, mtd); - if (ret < 0) - { - ferr("ERROR: Failed to initialize the FTL layer: %d\n", ret); - return ret; - } - -#ifdef CONFIG_BCH /* Use the minor number to create device paths */ - snprintf(blockdev, sizeof(blockdev), "/dev/mtdblock%d", minor); if (devpath == NULL) { - snprintf(chardev, sizeof(chardev), "/dev/mtd%d", minor); - devpath = chardev; + snprintf(mtddev, sizeof(mtddev), "/dev/mtd%d", minor); + devpath = mtddev; } - /* Now create a character device on the block device */ + /* Register the MTD driver */ - ret = bchdev_register(blockdev, devpath, false); + ret = register_mtddriver(devpath, mtd, 0755, NULL); if (ret < 0) { - ferr("ERROR: bchdev_register %s failed: %d\n", devpath, ret); - return ret; Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org