From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD27FC3A589 for ; Thu, 15 Aug 2019 12:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94B3C20644 for ; Thu, 15 Aug 2019 12:51:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lHf6CoFz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731152AbfHOMvp (ORCPT ); Thu, 15 Aug 2019 08:51:45 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:45102 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729627AbfHOMvp (ORCPT ); Thu, 15 Aug 2019 08:51:45 -0400 Received: from pendragon.ideasonboard.com (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8E62B2AF; Thu, 15 Aug 2019 14:51:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1565873499; bh=kBx17/4iFXQHrjJi+Z3btsgylqDYNIufeqn7rdwR33k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lHf6CoFzpwMOD/j9iDej/b2DkBF5KPYYiq8t02UZnbtm7Pngs/svEfewhrrH3Ta1A /UfcVXrHZFxJlaw7WpDXTj4W/NmCYMT7jAtcIueTot6Uss9WwYcaLeK9rsrR7xjkl0 5syUHc2hDk4K6zapS2AMEv/Cm/EVrCqc2a7LTgGY= Date: Thu, 15 Aug 2019 15:51:36 +0300 From: Laurent Pinchart To: Marco Felsch Cc: Mauro Carvalho Chehab , sakari.ailus@linux.intel.com, hans.verkuil@cisco.com, jacopo+renesas@jmondi.org, robh+dt@kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH v6 05/13] media: tvp5150: add input source selection of_graph support Message-ID: <20190815125136.GE13823@pendragon.ideasonboard.com> References: <20190415124413.18456-1-m.felsch@pengutronix.de> <20190415124413.18456-6-m.felsch@pengutronix.de> <20190514152545.6020dcd8@coco.lan> <20190516180315.GQ14820@pendragon.ideasonboard.com> <20190813085429.p2i6g6fzckbtsfz6@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190813085429.p2i6g6fzckbtsfz6@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Archived-At: List-Archive: List-Post: On Tue, Aug 13, 2019 at 10:54:29AM +0200, Marco Felsch wrote: > Hi Laurent, > > On 19-05-16 21:03, Laurent Pinchart wrote: > > Hello Marco, > > > > Thank you for the patch. > > > > On Tue, May 14, 2019 at 03:25:45PM -0300, Mauro Carvalho Chehab wrote: > > > Em Mon, 15 Apr 2019 14:44:05 +0200 Marco Felsch escreveu: > > > > > > > This patch adds the of_graph support to describe the tvp connections. > > > > Physical the TVP5150 has three ports: AIP1A, AIP1B and YOUT. As result > > > > of discussion [1],[2] the device-tree maps these ports 1:1. The svideo > > > > connector must be conneted to port@0/endpoint@1, look at the Documentation > > > > According to [2], it must be connected to port port@0 and port@1, not > > just port@0. > > You're right. I missed that.. I will change that for the v7. > > > > > for more information. Since the TVP5150 is a converter the device-tree > > > > must contain at least 1-input and 1-output port. The mc-connectors and > > > > mc-links are only created if the device-tree contains the corresponding > > > > connector nodes. If more than one connector is available the > > > > media_entity_operations.link_setup() callback ensures that only one > > > > connector is active. > > > > > > > > [1] https://www.spinics.net/lists/linux-media/msg138545.html > > > > [2] https://www.spinics.net/lists/linux-media/msg138546.html > > > > > > > > Signed-off-by: Marco Felsch > > > > --- > > > > Changelog: > > > > > > > > [1] https://patchwork.kernel.org/cover/10794703/ > > > > [2] https://patchwork.kernel.org/cover/10786553/ > > > > > > > > v6: > > > > - fix misspelled comments > > > > - use 'unsigned int' where it's possible > > > > - cleanup ifdef part-2: > > > > - tvp5150_mc_init, tvp5150_add_of_connectors: add surrounding > > > > CONFIG_MEDIA_CONTROLLER ifdef and stubs to improve readability > > > > - tvp5150_mc_init: uniform interface, use 'struct tvp5150' since all > > > > internal function do this. > > > > - tvp5150_add_of_connectors: call within probe() to make it cleaner > > > > - tvp5150_parse_dt: move local loop vars within the loop. > > > > > > > > v5: > > > > - Fixing build deps: > > > > - tvp5150_mc_init: fix CONFIG_MEDIA_CONTROLLER deps > > > > - struct tvp5150: drop CONFIG_MEDIA_CONTROLLER conditional property > > > > includes. This leads into to complex deps for futher development. > > > > - tvp5150_dt_cleanup: enable function only if CONFIG_OF is enabled > > > > - tvp5150_parse_dt: enable function only if CONFIG_OF is enabled > > > > - tvp5150_probe: call tvp5150_dt_cleanup only if CONFIG_OF is enabled > > > > > > > > - Simplify link_setup routine: > > > > - use generic connector parsing since both series [1,2] are squashed into > > > > one > > > > - struct tvp5150: drop pads_state and modify_second_link property > > > > due to link_setup() rework. > > > > - tvp5150_link_setup: add more comments > > > > - tvp5150_link_setup: simply the link setup routine a lot. Edit the 2nd > > > > link directly within the driver instead of a recursive media-framework > > > > call (__media_entity_setup_link). This improves the readability and > > > > shrinks the driver code. > > > > - tvp5150_link_setup: disable all active links in case user switches > > > > connectors without disable it first. > > > > - tvp5150_registered: simplify default link enable path due to link_setup() > > > > rework. > > > > > > > > - General cleanups > > > > - tvp5150_parse_dt: drop unecessary test > > > > - tvp5150_parse_dt: add err message due to misconfiguration > > > > - tvp5150_parse_dt: make use of V4L2_MBUS_UNKNOWN definition > > > > - s/dev_dbg/dev_dbg_lvl > > > > > > > > v4: > > > > - rebase on top of media_tree/master, fix merge conflict due to commit > > > > 60359a28d592 ("media: v4l: fwnode: Initialise the V4L2 fwnode endpoints > > > > to zero") > > > > > > > > v3: > > > > - probe(): s/err/err_free_v4l2_ctrls > > > > - drop MC dependency for tvp5150_pads > > > > > > > > v2: > > > > - adapt commit message > > > > - unify ifdef switches > > > > - rename tvp5150_valid_input -> tvp5150_of_valid_input, to be more precise > > > > - mc: use 2-input and 1-output pad > > > > - mc: link svideo connector to both input pads > > > > - mc: enable/disable svideo links in one go > > > > - mc: change link_setup() behaviour, switch the input src don't require a > > > > explicite disable before. > > > > - mc: rename 'local' media_pad param to tvp5150_pad to avoid confusion > > > > - mc: enable link to the first available connector and set the > > > > corresponding tvp5150 input src per default during registered() > > > > - mc/of: factor out oftree connector allocation > > > > - of: drop svideo dt port > > > > - of: move svideo connector to port@0/endpoint@1 > > > > - of: require at least 1-in and 1-out endpoint > > > > > > > > drivers/media/i2c/tvp5150.c | 409 ++++++++++++++++++++++++++++++++---- > > > > 1 file changed, 370 insertions(+), 39 deletions(-) > > > > > > > > diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c > > > > index 89da921c8886..4e3228b2ccbc 100644 > > > > --- a/drivers/media/i2c/tvp5150.c > > > > +++ b/drivers/media/i2c/tvp5150.c > > > > @@ -44,16 +44,29 @@ MODULE_PARM_DESC(debug, "Debug level (0-2)"); > > > > #define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg) > > > > > > > > enum tvp5150_pads { > > > > - TVP5150_PAD_IF_INPUT, > > > > + TVP5150_PAD_AIP1A = TVP5150_COMPOSITE0, > > > > + TVP5150_PAD_AIP1B, > > > > TVP5150_PAD_VID_OUT, > > > > TVP5150_NUM_PADS > > > > }; > > > > > > > > +struct tvp5150_connector { > > > > + struct v4l2_fwnode_connector base; > > > > + struct media_entity ent; > > > > + struct media_pad pad; > > > > +}; > > > > + > > > > struct tvp5150 { > > > > struct v4l2_subdev sd; > > > > -#ifdef CONFIG_MEDIA_CONTROLLER > > > > + /* additional endpoint for the svideo connector */ > > > > Could you please capitalize the first word of all comments to match the > > driver style ? > > Okay, I will check it for my v7. > > > > > + struct device_node *endpoints[TVP5150_NUM_PADS + 1]; > > > > As the endpoints are only used at probe time, I would declare this as a > > local variable in the probe function and pass it to both > > tvp5150_add_of_connectors() and tvp5150_parse_dt(). If you order the > > calls correctly it should simplify the probe error handling. > > Yes that could be also a solution. I took Jacopo's comments and > refactored the code so the endpoints no longer needed in my v7. > > > > > + unsigned int endpoints_num; > > > > + > > > > + /* media-ctl properties */ > > > > media-ctl makes me think about the userspace application, maybe "Media > > controller properties" ? > > I've dopped that comment becuase it is to obvious.. > > > > > struct media_pad pads[TVP5150_NUM_PADS]; > > > > -#endif > > > > + struct tvp5150_connector *connectors; > > > > + int connectors_num; > > > > unsigned int ? > > Of course. > > > > > + > > > > struct v4l2_ctrl_handler hdl; > > > > struct v4l2_rect rect; > > > > struct regmap *regmap; > > > > @@ -1167,6 +1180,131 @@ static int tvp5150_enum_frame_size(struct v4l2_subdev *sd, > > > > return 0; > > > > } > > > > > > > > +/**************************************************************************** > > > > + * Media entity ops > > > > + ****************************************************************************/ > > > > +#if defined(CONFIG_MEDIA_CONTROLLER) > > > > Should we depend on CONFIG_MEDIA_CONTROLLER instead, especially since > > you remove the similar conditional in the struct tvp5150 definition and > > in the probe function ? > > I don't know if we can add the dependency without worries because the > tvp5150 is also used by the usb/em28xx devices which can be build > without CONFIG_MEDIA_CONTROLLER support. During .probe() a stub function > will be called if CONFIG_MEDIA_CONTROLLER isn't enabled. > > > > > +static int tvp5150_set_link(struct media_pad *connector_pad, > > > > + struct media_pad *tvp5150_pad, u32 flags) > > > > +{ > > > > + struct media_link *link; > > > > + > > > > + link = media_entity_find_link(connector_pad, tvp5150_pad); > > > > + if (!link) > > > > + return -EINVAL; > > > > + > > > > + link->flags = flags; > > > > + link->reverse->flags = link->flags; > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +static int tvp5150_disable_all_input_links(struct tvp5150 *decoder) > > > > +{ > > > > + struct media_pad *connector_pad; > > > > + unsigned int i; > > > > + int err; > > > > + > > > > + for (i = 0; i < TVP5150_NUM_PADS - 1; i++) { > > > > + connector_pad = media_entity_remote_pad(&decoder->pads[i]); > > > > + if (!connector_pad) > > > > + continue; > > > > + > > > > + err = tvp5150_set_link(connector_pad, &decoder->pads[i], 0); > > > > + if (err) > > > > + return err; > > > > + } > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +static int tvp5150_s_routing(struct v4l2_subdev *sd, u32 input, u32 output, > > > > + u32 config); > > > > + > > > > +static int tvp5150_link_setup(struct media_entity *entity, > > > > + const struct media_pad *tvp5150_pad, > > > > + const struct media_pad *remote, u32 flags) > > > > +{ > > > > + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); > > > > + struct tvp5150 *decoder = to_tvp5150(sd); > > > > + struct media_pad *other_tvp5150_pad = > > > > + &decoder->pads[tvp5150_pad->index ^ 1]; > > > > + bool is_svideo = false; > > > > + unsigned int i; > > > > + int err; > > > > + > > > > + /* > > > > + * The TVP5150 state is determined by the enabled sink pad link(s). > > > > + * Enabling or disabling the source pad link has no effect. > > > > + */ > > > > + if (tvp5150_pad->flags & MEDIA_PAD_FL_SOURCE) > > > > + return 0; > > > > + > > > > + /* Check if the svideo connector should be enabled */ > > > > + for (i = 0; i < decoder->connectors_num; i++) { > > > > + if (remote->entity == &decoder->connectors[i].ent) { > > > > > > > + is_svideo = > > > > + decoder->connectors[i].base.type == V4L2_CON_SVIDEO; > > > > > > Nitpick: > > > > > > I would actually prefer to keep this on a single line. Ok, it will violate > > > the 80-columns, but it would be better than the above (IMHO). > > > > > > > + break; > > > > + } > > > > + } > > > > + > > > > + dev_dbg_lvl(sd->dev, 1, debug, "link setup '%s':%d->'%s':%d[%d]", > > > > + remote->entity->name, remote->index, > > > > + tvp5150_pad->entity->name, tvp5150_pad->index, > > > > + flags & MEDIA_LNK_FL_ENABLED); > > > > + if (is_svideo) > > > > + dev_dbg_lvl(sd->dev, 1, debug, > > > > + "link setup '%s':%d->'%s':%d[%d]", > > > > + remote->entity->name, remote->index, > > > > + other_tvp5150_pad->entity->name, > > > > + other_tvp5150_pad->index, > > > > + flags & MEDIA_LNK_FL_ENABLED); > > > > + > > > > + /* > > > > + * The TVP5150 has an internal mux which allows the following setup: > > > > + * > > > > + * comp-connector1 --\ > > > > + * |---> AIP1A > > > > + * / > > > > + * svideo-connector -| > > > > + * \ > > > > + * |---> AIP1B > > > > + * comp-connector2 --/ > > > > + * > > > > + * We can't rely on user space that the current connector gets disabled > > > > + * first before enabling the new connector. Disable all active > > > > + * connector links to be on the safe side. > > > > + */ > > > > + err = tvp5150_disable_all_input_links(decoder); > > > > + if (err) > > > > + return err; > > > > + > > > > + tvp5150_s_routing(sd, is_svideo ? TVP5150_SVIDEO : tvp5150_pad->index, > > > > + flags & MEDIA_LNK_FL_ENABLED ? TVP5150_NORMAL : > > > > + TVP5150_BLACK_SCREEN, 0); > > > > + > > > > + if (flags & MEDIA_LNK_FL_ENABLED) { > > > > + /* > > > > + * S-Video connector is conneted to both ports AIP1A and AIP1B. > > > > + * Both links must be enabled in one-shot regardless which link > > > > + * the user requests. > > > > + */ > > > > This is a very grey area, I don't think the MC API explicitly allows > > doing this. As changing links during streaming is disallowed, wouldn't > > it be easier to handle the routing configuration at stream start ? You > > wouldn't have to deal with this issue then, you could just return an > > error if only one link is enabled. Furthermore, it would allow > > supporting a configuration where a composite signal is connected to the > > Y pin of the mini-DIN connector. > > We discussed this a few series earlier because my first solution what > like this you describe above. I changed that because Mauro had some > concerns about the usability. Now this behaviour is easier to use but > as you pointed out above, such 'special' handling isn't doable anymore. > I would keep this solution since I want to get this series merged ;) > If someone wants such a 'special' configuration he can implement it > later. But that would break the ABI. I'm sorry, but we need to find an agreement on this issue to merge the series, it's not a detail that can be addressed later. Could you start a discussion with Mauro to see if he can be convinced, or if he has a better proposal ? > > > > + if (is_svideo) { > > > > + err = tvp5150_set_link((struct media_pad *) remote, > > > > + other_tvp5150_pad, flags); > > > > + if (err) > > > > + return err; > > > > + } > > > > + } > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +static const struct media_entity_operations tvp5150_sd_media_ops = { > > > > + .link_setup = tvp5150_link_setup, > > > > +}; > > > > +#endif > > > > /**************************************************************************** > > > > I2C Command > > > > ****************************************************************************/ > > > > @@ -1314,6 +1452,65 @@ static int tvp5150_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) > > > > return 0; > > > > } > > > > > > > > +static int tvp5150_registered(struct v4l2_subdev *sd) > > > > +{ > > > > +#if defined(CONFIG_MEDIA_CONTROLLER) > > > > + struct tvp5150 *decoder = to_tvp5150(sd); > > > > + unsigned int i; > > > > + int ret; > > > > + > > > > + /* > > > > + * Setup connector pads and links. Enable the link to the first > > > > + * available connector per default. > > > > + */ > > > > + for (i = 0; i < decoder->connectors_num; i++) { > > > > + struct media_entity *con = &decoder->connectors[i].ent; > > > > + struct media_pad *pad = &decoder->connectors[i].pad; > > > > + unsigned int port = decoder->connectors[i].base.remote_port; > > > > + bool is_svideo = > > > > + decoder->connectors[i].base.type == V4L2_CON_SVIDEO; > > > > + int flags = i ? 0 : MEDIA_LNK_FL_ENABLED; > > > > The flags passed to media_create_pad_link() are unsigned. > > You are right, changed that. > > > > > + > > > > + pad->flags = MEDIA_PAD_FL_SOURCE; > > > > + ret = media_entity_pads_init(con, 1, pad); > > > > + if (ret < 0) > > > > + return ret; > > > > + > > > > + ret = media_device_register_entity(sd->v4l2_dev->mdev, con); > > > > + if (ret < 0) > > > > + return ret; > > > > + > > > > + ret = media_create_pad_link(con, 0, &sd->entity, port, flags); > > > > + if (ret < 0) { > > > > + media_device_unregister_entity(con); > > > > + return ret; > > > > + } > > > > Will the other registered media entities be unregistered correctly ? > > Good point. I add a seperate error handling to ensure all registered > entities gets unregistered. > > > > > + > > > > + if (is_svideo) { > > > > + /* svideo links to both aip1a and aip1b */ > > > > + ret = media_create_pad_link(con, 0, &sd->entity, > > > > + port + 1, flags); > > > > Does the TVP5150 support both connecting Y to AIP1A and C to AIP1B, and > > Y to AIP1B and C to AIP1A ? If so the port + 1 won't always work. > > No, if I understood the datasheet right Y is always connected to AIP1A > and C to AIP1B. Since I improved the struct v4l2_fwnode_connector to > hold more connector-port information the 'port+1' logic isn't used > anymore. > > > > > + if (ret < 0) { > > > > + media_device_unregister_entity(con); > > > > + return ret; > > > > + } > > > > + } > > > > + > > > > + /* enable default input */ > > > > + if (flags == MEDIA_LNK_FL_ENABLED) { > > > > + decoder->input = > > > > + is_svideo ? TVP5150_SVIDEO : > > > > + port == 0 ? TVP5150_COMPOSITE0 : > > > > + TVP5150_COMPOSITE1; > > > > + > > > > + tvp5150_selmux(sd); > > > > + } > > > > You could move this after the loop and operation on > > decoder->connectors[0]. Hopefully you could then use if's instead of > > nested ? : operators, as the above isn't very readable. > > That's also doable. Mauro which solution do you prefer? > > > > > + } > > > > +#endif > > > > + return 0; > > > > +} > > > > + > > > > + > > > > One blank line is enough. > > Fixed. > > > > > /* ----------------------------------------------------------------------- */ > > > > > > > > static const struct v4l2_ctrl_ops tvp5150_ctrl_ops = { > > > > @@ -1367,6 +1564,10 @@ static const struct v4l2_subdev_ops tvp5150_ops = { > > > > .pad = &tvp5150_pad_ops, > > > > }; > > > > > > > > +static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = { > > > > + .registered = tvp5150_registered, > > > > +}; > > > > + > > > > /**************************************************************************** > > > > I2C Client & Driver > > > > ****************************************************************************/ > > > > @@ -1515,38 +1716,168 @@ static int tvp5150_init(struct i2c_client *c) > > > > return 0; > > > > } > > > > > > > > -static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) > > > > +#if defined(CONFIG_MEDIA_CONTROLLER) > > > > +static int tvp5150_add_of_connectors(struct tvp5150 *decoder) > > > > { > > > > - struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 }; > > > > - struct device_node *ep; > > > > - unsigned int flags; > > > > - int ret = 0; > > > > + struct device *dev = decoder->sd.dev; > > > > You use dev in a singla location, I think you could use decoder->sd.dev > > directly. > > This function is no longer used but you're right. > > > > > > > + struct tvp5150_connector *connectors; > > > > + unsigned int connectors_num = decoder->connectors_num; > > > > + int i, ret; > > > > i is never negative, you can make it an unsiged int. > > > > > > > > > > - ep = of_graph_get_next_endpoint(np, NULL); > > > > - if (!ep) > > > > - return -EINVAL; > > > > + /* > > > > + * Only add of_connectors if device really is a OF device since > > > > + * the driver is used by usb devices e.g. em28xx and embedded > > > > + * devices. > > > > + */ > > > > + if (!decoder->connectors_num) > > > > Maybe if (!connectors_num) ? > > > > > > + return 0; > > > > > > > > - ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg); > > > > - if (ret) > > > > - goto err; > > > > + /* Allocate and initialize all available input connectors */ > > > > + connectors = devm_kcalloc(dev, connectors_num, sizeof(*connectors), > > > > + GFP_KERNEL); > > > > + if (!connectors) > > > > + return -ENOMEM; > > > > + > > > > + for (i = 0; i < connectors_num; i++) { > > > > + struct v4l2_fwnode_connector *c = &connectors[i].base; > > > > + > > > > + ret = v4l2_fwnode_parse_connector( > > > > + of_fwnode_handle(decoder->endpoints[i]), c); > > > > I think you should handle errors here. > > > > > > + > > > > + connectors[i].ent.flags = MEDIA_ENT_FL_CONNECTOR; > > > > + connectors[i].ent.function = c->type == V4L2_CON_SVIDEO ? > > > > + MEDIA_ENT_F_CONN_SVIDEO : MEDIA_ENT_F_CONN_COMPOSITE; > > > > + connectors[i].ent.name = c->label; > > > > I don't think using the label as the entity name is a good idea, as we > > require entity names to be unique, and labels offer no such guarantee. > > Good point. What about :