From patchwork Sun Aug 30 03:06:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 7096391 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 DA78CBEEC1 for ; Sun, 30 Aug 2015 03:09:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 045D820824 for ; Sun, 30 Aug 2015 03:09:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 193412083B for ; Sun, 30 Aug 2015 03:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753440AbbH3DIQ (ORCPT ); Sat, 29 Aug 2015 23:08:16 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:48403 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753264AbbH3DHs (ORCPT ); Sat, 29 Aug 2015 23:07:48 -0400 Received: from [179.181.112.204] (helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZVsyB-0007ih-Vv; Sun, 30 Aug 2015 03:07:48 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.85) (envelope-from ) id 1ZVsxY-0004qd-2a; Sun, 30 Aug 2015 00:07:08 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab Subject: [PATCH v8 21/55] [media] media: make media_link more generic to handle interace links Date: Sun, 30 Aug 2015 00:06:32 -0300 Message-Id: X-Mailer: git-send-email 2.4.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 By adding an union at media_link, we get for free a way to represent interface->entity links. No need to change anything at the code, just at the internal header file. Signed-off-by: Mauro Carvalho Chehab Acked-by: Hans Verkuil diff --git a/include/media/media-entity.h b/include/media/media-entity.h index bb89cedb0c40..b4923a24efd5 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -75,14 +75,20 @@ struct media_pipeline { struct media_link { struct media_gobj graph_obj; struct list_head list; - struct media_pad *source; /* Source pad */ - struct media_pad *sink; /* Sink pad */ + union { + struct media_gobj *gobj0; + struct media_pad *source; + }; + union { + struct media_gobj *gobj1; + struct media_pad *sink; + }; struct media_link *reverse; /* Link in the reverse direction */ unsigned long flags; /* Link flags (MEDIA_LNK_FL_*) */ }; struct media_pad { - struct media_gobj graph_obj; + struct media_gobj graph_obj; /* must be first field in struct */ struct media_entity *entity; /* Entity this pad belongs to */ u16 index; /* Pad index in the entity pads array */ unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */ @@ -105,7 +111,7 @@ struct media_entity_operations { }; struct media_entity { - struct media_gobj graph_obj; + struct media_gobj graph_obj; /* must be first field in struct */ struct list_head list; const char *name; /* Entity name */ u32 type; /* Entity type (MEDIA_ENT_T_*) */ @@ -119,7 +125,7 @@ struct media_entity { u16 num_backlinks; /* Number of backlinks */ struct media_pad *pads; /* Pads array (num_pads objects) */ - struct list_head links; /* Links list */ + struct list_head links; /* Pad-to-pad links list */ const struct media_entity_operations *ops; /* Entity operations */