From patchwork Fri Sep 11 10:09:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 7159231 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 69EDFBEEC1 for ; Fri, 11 Sep 2015 10:11:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98D062082B for ; Fri, 11 Sep 2015 10:11:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B786E20829 for ; Fri, 11 Sep 2015 10:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752530AbbIKKLr (ORCPT ); Fri, 11 Sep 2015 06:11:47 -0400 Received: from mga01.intel.com ([192.55.52.88]:14390 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752452AbbIKKLq (ORCPT ); Fri, 11 Sep 2015 06:11:46 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 11 Sep 2015 03:11:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,511,1437462000"; d="scan'208";a="766949789" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga001.jf.intel.com with ESMTP; 11 Sep 2015 03:11:33 -0700 Received: from nauris.fi.intel.com (nauris.localdomain [192.168.240.2]) by paasikivi.fi.intel.com (Postfix) with ESMTP id C771420FA8; Fri, 11 Sep 2015 13:11:00 +0300 (EEST) Received: by nauris.fi.intel.com (Postfix, from userid 1000) id BFCC6201ED; Fri, 11 Sep 2015 13:09:23 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, javier@osg.samsung.com, mchehab@osg.samsung.com, hverkuil@xs4all.nl Subject: [RFC 5/9] media: Use entity enums in graph walk Date: Fri, 11 Sep 2015 13:09:08 +0300 Message-Id: <1441966152-28444-6-git-send-email-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.1.0.231.g7484e3b In-Reply-To: <1441966152-28444-1-git-send-email-sakari.ailus@linux.intel.com> References: <1441966152-28444-1-git-send-email-sakari.ailus@linux.intel.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Sakari Ailus --- drivers/media/media-entity.c | 10 +++++----- include/media/media-entity.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 5526e8c..a4d6e1b 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -332,12 +332,12 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, { graph->top = 0; graph->stack[graph->top].entity = NULL; - bitmap_zero(graph->entities, MEDIA_ENTITY_MAX_LOW_ID); + media_entity_enum_init(graph->entities); - if (WARN_ON(media_entity_id(entity) >= MEDIA_ENTITY_MAX_LOW_ID)) + if (WARN_ON(entity->low_id >= MEDIA_ENTITY_MAX_LOW_ID)) return; - __set_bit(media_entity_id(entity), graph->entities); + media_entity_enum_set(graph->entities, entity); stack_push(graph, entity); } EXPORT_SYMBOL_GPL(media_entity_graph_walk_start); @@ -381,11 +381,11 @@ media_entity_graph_walk_next(struct media_entity_graph *graph) /* Get the entity in the other end of the link . */ next = media_entity_other(entity, link); - if (WARN_ON(media_entity_id(next) >= MEDIA_ENTITY_MAX_LOW_ID)) + if (WARN_ON(entity->low_id >= MEDIA_ENTITY_MAX_LOW_ID)) return NULL; /* Has the entity already been visited? */ - if (__test_and_set_bit(media_entity_id(next), graph->entities)) { + if (media_entity_enum_test_and_set(graph->entities, next)) { link_top(graph) = link_top(graph)->next; continue; } diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 95b1061..849ec4a 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -370,7 +370,7 @@ struct media_entity_graph { struct list_head *link; } stack[MEDIA_ENTITY_ENUM_MAX_DEPTH]; - DECLARE_BITMAP(entities, MEDIA_ENTITY_MAX_LOW_ID); + DECLARE_MEDIA_ENTITY_ENUM(entities); int top; };