]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: introduce mtd_lock interface
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 23 Dec 2011 17:15:39 +0000 (19:15 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 9 Jan 2012 18:25:39 +0000 (18:25 +0000)
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/maps/scb2_flash.c
drivers/mtd/mtdchar.c
drivers/mtd/mtdconcat.c
drivers/mtd/mtdpart.c
include/linux/mtd/mtd.h

index d88c8426bb0fe7a4032fbdd8d3cee879542c59d2..01af34778de39b4b618a09326fd4e0ed3a64d112 100644 (file)
@@ -205,7 +205,7 @@ scb2_flash_remove(struct pci_dev *dev)
 
        /* disable flash writes */
        if (scb2_mtd->lock)
-               scb2_mtd->lock(scb2_mtd, 0, scb2_mtd->size);
+               mtd_lock(scb2_mtd, 0, scb2_mtd->size);
 
        mtd_device_unregister(scb2_mtd);
        map_destroy(scb2_mtd);
index b5722ecf19d3992acaccd71e7ee6ae5ee4cdc324..870f2cb415cb0db951422878b56b03657fe515da 100644 (file)
@@ -824,7 +824,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
                if (!mtd->lock)
                        ret = -EOPNOTSUPP;
                else
-                       ret = mtd->lock(mtd, einfo.start, einfo.length);
+                       ret = mtd_lock(mtd, einfo.start, einfo.length);
                break;
        }
 
index cc2336edfe28681f2dc7f218b568fa536b3a1e49..97d6360986c8f190b6cc3312409bd8d1db1b19d5 100644 (file)
@@ -556,7 +556,7 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
                        size = len;
 
                if (subdev->lock) {
-                       err = subdev->lock(subdev, ofs, size);
+                       err = mtd_lock(subdev, ofs, size);
                        if (err)
                                break;
                } else
index 2b545052795ee107026ae11ed54b3e72d2e26311..a5e7a2103dcf7f32c6cd91386e148afb63870fed 100644 (file)
@@ -279,7 +279,7 @@ static int part_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
        struct mtd_part *part = PART(mtd);
        if ((len + ofs) > mtd->size)
                return -EINVAL;
-       return part->master->lock(part->master, ofs + part->offset, len);
+       return mtd_lock(part->master, ofs + part->offset, len);
 }
 
 static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
index 47ea19c1e5237765d4b4c8ead3b5abe79dbbc63f..167bac2e380e6d59984a8333ac4ac1357943f2ee 100644 (file)
@@ -207,14 +207,13 @@ struct mtd_info {
        int (*writev) (struct mtd_info *mtd, const struct kvec *vecs,
                        unsigned long count, loff_t to, size_t *retlen);
        void (*sync) (struct mtd_info *mtd);
+       int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
 
        /* Backing device capabilities for this device
         * - provides mmap capabilities
         */
        struct backing_dev_info *backing_dev_info;
 
-       /* Chip-supported device locking */
-       int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
        int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
        int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
 
@@ -384,6 +383,12 @@ static inline void mtd_sync(struct mtd_info *mtd)
        mtd->sync(mtd);
 }
 
+/* Chip-supported device locking */
+static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
+{
+       return mtd->lock(mtd, ofs, len);
+}
+
 static inline struct mtd_info *dev_to_mtd(struct device *dev)
 {
        return dev ? dev_get_drvdata(dev) : NULL;