*/
 static int init_nandsim(struct mtd_info *mtd)
 {
-       struct nand_chip *chip = (struct nand_chip *)mtd->priv;
-       struct nandsim   *ns   = (struct nandsim *)(chip->priv);
+       struct nand_chip *chip = mtd->priv;
+       struct nandsim   *ns   = chip->priv;
        int i, ret = 0;
        uint64_t remains;
        uint64_t next_offset;
 
 static u_char ns_nand_read_byte(struct mtd_info *mtd)
 {
-        struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
+       struct nandsim *ns = ((struct nand_chip *)mtd->priv)->priv;
        u_char outb = 0x00;
 
        /* Sanity and correctness checks */
 
 static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
 {
-        struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
+       struct nandsim *ns = ((struct nand_chip *)mtd->priv)->priv;
 
        /* Sanity and correctness checks */
        if (!ns->lines.ce) {
 
 static void ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
-        struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
+       struct nandsim *ns = ((struct nand_chip *)mtd->priv)->priv;
 
        /* Check that chip is expecting data input */
        if (!(ns->state & STATE_DATAIN_MASK)) {
 
 static void ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 {
-        struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
+       struct nandsim *ns = ((struct nand_chip *)mtd->priv)->priv;
 
        /* Sanity and correctness checks */
        if (!ns->lines.ce) {
  */
 static void __exit ns_cleanup_module(void)
 {
-       struct nandsim *ns = (struct nandsim *)(((struct nand_chip *)nsmtd->priv)->priv);
+       struct nandsim *ns = ((struct nand_chip *)nsmtd->priv)->priv;
        int i;
 
        free_nandsim(ns);    /* Free nandsim private resources */