mtd: use sprintf instead of printk in show functions
authorYi Zeng <yi.zeng@amlogic.com>
Fri, 23 Mar 2018 06:28:12 +0000 (14:28 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Sat, 24 Mar 2018 09:20:56 +0000 (01:20 -0800)
PD#134355: mtd: use sprintf instead of printk in show functions

Remove the unused system attribute in dtb and env.

Change-Id: Ie7f7bda60ac1b192708a6b6fd0dc1c77ca1eb0e0
Signed-off-by: Yi Zeng <yi.zeng@amlogic.com>
drivers/amlogic/mtd/aml_dtb.c
drivers/amlogic/mtd/aml_env.c

index 193ceec..e8711d8 100644 (file)
@@ -117,46 +117,6 @@ exit_err:
 
 /* under kernel */
 #ifndef AML_NAND_UBOOT
-ssize_t dtb_show(struct class *class, struct class_attribute *attr,
-               char *buf)
-{
-       pr_info("dtb_show : #####\n");
-       /* fixme, read back and show in log! */
-       return 0;
-}
-
-ssize_t dtb_store(struct class *class, struct class_attribute *attr,
-               const char *buf, size_t count)
-{
-       int ret = 0;
-       u8 *dtb_ptr = NULL;
-
-       pr_info("dtb_store : #####\n");
-       dtb_ptr = kzalloc(aml_chip_dtb->dtbsize, GFP_KERNEL);
-       if (dtb_ptr == NULL) {
-               pr_info("%s: malloc buf failed\n ", __func__);
-               return -ENOMEM;
-       }
-       /* fixme, why read back then write? */
-       ret = amlnf_dtb_read(dtb_ptr, aml_chip_dtb->dtbsize);
-       if (ret) {
-               pr_info("%s: read failed\n", __func__);
-               kfree(dtb_ptr);
-               return -EFAULT;
-       }
-
-       ret = amlnf_dtb_save(dtb_ptr, aml_chip_dtb->dtbsize);
-       if (ret) {
-               pr_info("%s: save failed\n", __func__);
-               kfree(dtb_ptr);
-               return -EFAULT;
-       }
-
-       pr_info("dtb_store : OK #####\n");
-       return count;
-}
-
-static CLASS_ATTR(nfdtb, 0644, dtb_show, dtb_store);
 
 int dtb_open(struct inode *node, struct file *file)
 {
@@ -315,13 +275,6 @@ int amlnf_dtb_init(struct aml_nand_chip *aml_chip)
                goto exit_err2;
        }
 
-       ret = class_create_file(amlnf_dtb_class, &class_attr_nfdtb);
-       if (ret) {
-               pr_info("%s dev add failed\n", __func__);
-               ret = -1;
-               goto exit_err2;
-       }
-
        dtb_dev_nand = device_create(amlnf_dtb_class,
                NULL,
                amlnf_dtb_no,
@@ -340,7 +293,6 @@ int amlnf_dtb_init(struct aml_nand_chip *aml_chip)
        return ret;
 
 exit_err3:
-       class_remove_file(amlnf_dtb_class, &class_attr_nfdtb);
        class_destroy(amlnf_dtb_class);
 exit_err2:
        cdev_del(&amlnf_dtb);
index ef700e1..39f48a9 100644 (file)
@@ -141,47 +141,6 @@ exit_err:
 #ifndef CONFIG_MTD_ENV_IN_NAND
 #ifndef AML_NAND_UBOOT
 
-ssize_t env_show(struct class *class, struct class_attribute *attr,
-               char *buf)
-{
-       pr_info("env_show : #####\n");
-       return 0;
-}
-
-ssize_t env_store(struct class *class, struct class_attribute *attr,
-               const char *buf, size_t count)
-{
-       int ret = 0;
-       u8 *env_ptr = NULL;
-
-
-       env_ptr = kzalloc(CONFIG_ENV_SIZE, GFP_KERNEL);
-       if (env_ptr == NULL)
-               return -ENOMEM;
-
-       mutex_lock(&env_mutex);
-       pr_info("env_store : #####\n");
-       ret = amlnf_env_read(env_ptr, CONFIG_ENV_SIZE);
-       if (ret) {
-               pr_info("nand_env_read: nand env read failed\n");
-               kfree(env_ptr);
-               return -EFAULT;
-       }
-
-       ret = amlnf_env_save(env_ptr, CONFIG_ENV_SIZE);
-       if (ret) {
-               pr_info("nand_env_read: nand env read failed\n");
-               kfree(env_ptr);
-               return -EFAULT;
-       }
-
-       pr_info("env_store : OK #####\n");
-       mutex_unlock(&env_mutex);
-       return count;
-}
-
-static CLASS_ATTR(env, 0644, env_show, env_store);
-
 int uboot_env_open(struct inode *node, struct file *file)
 {
        return 0;
@@ -363,13 +322,6 @@ int aml_ubootenv_init(struct aml_nand_chip *aml_chip)
                goto exit_err2;
        }
 
-       ret = class_create_file(uboot_env_class, &class_attr_env);
-       if (ret) {
-               pr_info("uboot env dev add failed\n");
-               ret = -1;
-               goto exit_err2;
-       }
-
        uboot_dev = device_create(uboot_env_class,
                NULL,
                uboot_env_no,
@@ -388,7 +340,6 @@ int aml_ubootenv_init(struct aml_nand_chip *aml_chip)
 
        return ret;
 exit_err3:
-       class_remove_file(uboot_env_class, &class_attr_env);
        class_destroy(uboot_env_class);
 exit_err2:
        cdev_del(&uboot_env);