From patchwork Sun Aug 30 03:06:59 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: 7096221 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 52B1B9F1B9 for ; Sun, 30 Aug 2015 03:09:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 667C1207F8 for ; Sun, 30 Aug 2015 03:09:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 978202082D for ; Sun, 30 Aug 2015 03:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753460AbbH3DIX (ORCPT ); Sat, 29 Aug 2015 23:08:23 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:48544 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753317AbbH3DHx (ORCPT ); Sat, 29 Aug 2015 23:07:53 -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 1ZVsyH-0007in-0x; Sun, 30 Aug 2015 03:07:53 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.85) (envelope-from ) id 1ZVsxY-0004tJ-LQ; 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 48/55] [media] media_device: add a topology version field Date: Sun, 30 Aug 2015 00:06:59 -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 Every time a graph object is added or removed, the version of the topology changes. That's a requirement for the new MEDIA_IOC_G_TOPOLOGY, in order to allow userspace to know that the topology has changed after a previous call to it. Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index c89f51bc688d..c18f4af52771 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -185,6 +185,9 @@ void media_gobj_init(struct media_device *mdev, list_add_tail(&gobj->list, &mdev->interfaces); break; } + + mdev->topology_version++; + dev_dbg_obj(__func__, gobj); } @@ -199,6 +202,8 @@ void media_gobj_remove(struct media_gobj *gobj) { dev_dbg_obj(__func__, gobj); + gobj->mdev->topology_version++; + /* Remove the object from mdev list */ list_del(&gobj->list); } diff --git a/include/media/media-device.h b/include/media/media-device.h index 0d1b9c687454..1b12774a9ab4 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -41,6 +41,8 @@ struct device; * @bus_info: Unique and stable device location identifier * @hw_revision: Hardware device revision * @driver_version: Device driver version + * @topology_version: Monotonic counter for storing the version of the graph + * topology. Should be incremented each time the topology changes. * @entity_id: Unique ID used on the last entity registered * @pad_id: Unique ID used on the last pad registered * @link_id: Unique ID used on the last link registered @@ -74,6 +76,8 @@ struct media_device { u32 hw_revision; u32 driver_version; + u32 topology_version; + u32 entity_id; u32 pad_id; u32 link_id;