소스 검색

[media] media: Remove pre-allocated entity enumeration bitmap

The bitmaps for entity enumerations used to be statically allocated. Now
that the drivers have been converted to use the new interface which
explicitly initialises the enum objects, drop the pre-allocated bitmaps.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus 9 년 전
부모
커밋
030e89ecab
2개의 변경된 파일7개의 추가작업 그리고 18개의 파일을 삭제
  1. 5 11
      drivers/media/media-entity.c
  2. 2 7
      include/media/media-entity.h

+ 5 - 11
drivers/media/media-entity.c

@@ -81,14 +81,10 @@ static inline const char *intf_type(struct media_interface *intf)
 __must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum,
 __must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum,
 					  int idx_max)
 					  int idx_max)
 {
 {
-	if (idx_max > MEDIA_ENTITY_ENUM_MAX_ID) {
-		ent_enum->bmap = kcalloc(DIV_ROUND_UP(idx_max, BITS_PER_LONG),
-					 sizeof(long), GFP_KERNEL);
-		if (!ent_enum->bmap)
-			return -ENOMEM;
-	} else {
-		ent_enum->bmap = ent_enum->prealloc_bmap;
-	}
+	ent_enum->bmap = kcalloc(DIV_ROUND_UP(idx_max, BITS_PER_LONG),
+				 sizeof(long), GFP_KERNEL);
+	if (!ent_enum->bmap)
+		return -ENOMEM;
 
 
 	bitmap_zero(ent_enum->bmap, idx_max);
 	bitmap_zero(ent_enum->bmap, idx_max);
 	ent_enum->idx_max = idx_max;
 	ent_enum->idx_max = idx_max;
@@ -104,9 +100,7 @@ EXPORT_SYMBOL_GPL(__media_entity_enum_init);
  */
  */
 void media_entity_enum_cleanup(struct media_entity_enum *ent_enum)
 void media_entity_enum_cleanup(struct media_entity_enum *ent_enum)
 {
 {
-	if (ent_enum->bmap != ent_enum->prealloc_bmap)
-		kfree(ent_enum->bmap);
-	ent_enum->bmap = NULL;
+	kfree(ent_enum->bmap);
 }
 }
 EXPORT_SYMBOL_GPL(media_entity_enum_cleanup);
 EXPORT_SYMBOL_GPL(media_entity_enum_cleanup);
 
 

+ 2 - 7
include/media/media-entity.h

@@ -72,27 +72,22 @@ struct media_gobj {
 };
 };
 
 
 #define MEDIA_ENTITY_ENUM_MAX_DEPTH	16
 #define MEDIA_ENTITY_ENUM_MAX_DEPTH	16
-#define MEDIA_ENTITY_ENUM_MAX_ID	64
 
 
 /*
 /*
  * The number of pads can't be bigger than the number of entities,
  * The number of pads can't be bigger than the number of entities,
  * as the worse-case scenario is to have one entity linked up to
  * as the worse-case scenario is to have one entity linked up to
- * MEDIA_ENTITY_ENUM_MAX_ID - 1 entities.
+ * 63 entities.
  */
  */
-#define MEDIA_ENTITY_MAX_PADS		(MEDIA_ENTITY_ENUM_MAX_ID - 1)
+#define MEDIA_ENTITY_MAX_PADS		63
 
 
 /**
 /**
  * struct media_entity_enum - An enumeration of media entities.
  * struct media_entity_enum - An enumeration of media entities.
  *
  *
- * @prealloc_bmap: Pre-allocated space reserved for media entities if the
- *		total number of entities does not exceed
- *		MEDIA_ENTITY_ENUM_MAX_ID.
  * @bmap:	Bit map in which each bit represents one entity at struct
  * @bmap:	Bit map in which each bit represents one entity at struct
  *		media_entity->internal_idx.
  *		media_entity->internal_idx.
  * @idx_max:	Number of bits in bmap
  * @idx_max:	Number of bits in bmap
  */
  */
 struct media_entity_enum {
 struct media_entity_enum {
-	DECLARE_BITMAP(prealloc_bmap, MEDIA_ENTITY_ENUM_MAX_ID);
 	unsigned long *bmap;
 	unsigned long *bmap;
 	int idx_max;
 	int idx_max;
 };
 };