Merge branch 'tizen_2.4' into tizen_2.4_dev
[kernel/swap-modules.git] / us_manager / img / img_file.c
index d4f6596..ec4903c 100644 (file)
@@ -82,12 +82,14 @@ static void img_del_ip_by_list(struct img_ip *ip)
        list_del(&ip->list);
 }
 
-static struct img_ip *find_img_ip(struct img_file *file, unsigned long addr)
+static struct img_ip *find_img_ip(struct img_file *file, unsigned long addr,
+                                 struct probe_desc *pd)
 {
        struct img_ip *ip;
 
        list_for_each_entry(ip, &file->ip_list, list) {
-               if (ip->addr == addr)
+               if ((ip->addr == addr) &&
+                   (ip->desc == pd))
                        return ip;
        }
 
@@ -104,20 +106,19 @@ static struct img_ip *find_img_ip(struct img_file *file, unsigned long addr)
  * @return Error code
  */
 int img_file_add_ip(struct img_file *file, unsigned long addr,
-                   struct probe_info *probe_i)
+                   struct probe_desc *pd)
 {
        struct img_ip *ip;
 
-       ip = find_img_ip(file, addr);
+       ip = find_img_ip(file, addr, pd);
        if (ip) {
                /* ip already exists in img */
                return 0;
        }
 
-       ip = create_img_ip(addr, probe_i);
+       ip = create_img_ip(addr, pd);
        if (ip == NULL)
                return -ENOMEM;
-
        img_add_ip_by_list(file, ip);
 
        return 0;
@@ -130,11 +131,12 @@ int img_file_add_ip(struct img_file *file, unsigned long addr,
  * @param addr Function address
  * @return Error code
  */
-int img_file_del_ip(struct img_file *file, unsigned long addr)
+int img_file_del_ip(struct img_file *file, unsigned long addr,
+                   struct probe_desc *pd)
 {
        struct img_ip *ip;
 
-       ip = find_img_ip(file, addr);
+       ip = find_img_ip(file, addr, pd);
        if (ip == NULL) {
                printk(KERN_INFO "Warning: no ip found in img, addr = %lx\n",
                       addr);
@@ -142,6 +144,7 @@ int img_file_del_ip(struct img_file *file, unsigned long addr)
        }
 
        img_del_ip_by_list(ip);
+       free_img_ip(ip);
 
        return 0;
 }