From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1525880459; cv=none; d=google.com; s=arc-20160816; b=WLoGwrPmLGQOhDLx0jze6KPp0W/bR/DGESVl88Xi8LUXr/xEcaM/EmCVmY8aVEbfIK 522w/rtwuMljbLo495E9KgbItTq04YejCfh8OBNMbxWx7d8tkqeMQ9BESzgb4p/NNRZ/ s8fUelycRTWp3EsWzh4khDw6L3zrPuLFPKITYKgmhnZaY3sGWSJoT+AqmtYzZTRocDjk /ybxv4JLQba9lLsUGfLs+MdRm9uKonn0t62M6a+G2LZCDSmday9eyl1+kpMVPXUDMyAr JrZbrLKvpr0KzSCrEoaRstZyyyz4T/+z522djMqWQ0E5CREgtST4ozBUR7/ynbvQMR2i VC8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=/SNC6XdsTW3SsGTTxaCdTcMNXw+2bMh75oLCXdSr/VQ=; b=yUIgWY/6qALhqWMNkWHdY6xsNElK4ee9Yw0d3kzOncTcDwvCNUPvscL4Dnq9nUmpw7 gTebprMKQo5wBsYtTibovNQAqQ/Zn9H1Fsu7nGXgUwrSA30Sb7secCzxUBdvbR+EbWVJ AAZQHm3X4rqSHBFqgtVv5asem1z5eOrB1lRzOLcat5JBOC7h9k3tbJ7V5D2jO3x4ew3d u3AD/+FbENaZM5Sem0630r2o35W3xNkkd6pnOVcyR1ro2aLJTT1Qtm19EqaU3uZYwDtS /uU1FiQ9WsuYCjMXn/OyyYtw9vEfEIDdAecj6mCUBgPGrIWzt4gmHRDRjVOm0LHlrzPN AI2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eQrbaekX; spf=pass (google.com: domain of mathieu.poirier@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=mathieu.poirier@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eQrbaekX; spf=pass (google.com: domain of mathieu.poirier@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=mathieu.poirier@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Google-Smtp-Source: AB8JxZqAip528vpxaHCT3DHvM8Dmgjn85MtKHtFFVDUtIDR0qQtjSpL2ZajbUKZ2Tuw/0UBG0w03+A== Date: Wed, 9 May 2018 09:40:55 -0600 From: Mathieu Poirier To: Robin Murphy Cc: Kim Phillips , Alexander Shishkin , Alex Williamson , Andrew Morton , David Howells , Eric Auger , Eric Biederman , Gargi Sharma , Geert Uytterhoeven , Greg Kroah-Hartman , Kefeng Wang , Kirill Tkhai , Mike Rapoport , Oleg Nesterov , Pavel Tatashin , Rik van Riel , Russell King , Thierry Reding , Todd Kjos , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] amba: Export amba_bustype Message-ID: <20180509154055.GB25559@xps15> References: <20180508140628.f30774c70c4c481bff3f8000@arm.com> <8c2648ec-1379-fb2a-35d2-b3fa8fc9f063@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8c2648ec-1379-fb2a-35d2-b3fa8fc9f063@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1599923962072715113?= X-GMAIL-MSGID: =?utf-8?q?1600001627918218421?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Wed, May 09, 2018 at 02:38:32PM +0100, Robin Murphy wrote: > Hi Kim, > > On 08/05/18 20:06, Kim Phillips wrote: > >This patch is provided in the context of allowing the Coresight driver > >subsystem to be loaded as modules. Coresight uses amba_bus in its call > >to bus_find_device() in of_coresight_get_endpoint_device() when > >searching for a configurable endpoint device. This patch allows > >Coresight to reference amba_bustype when built as a module. > > > >Cc: Mathieu Poirier > >Cc: Alex Williamson > >Cc: Eric Auger > >Cc: Russell King > >Cc: Greg Kroah-Hartman > >Cc: Todd Kjos > >Cc: Geert Uytterhoeven > >Cc: Thierry Reding > >Cc: Robin Murphy > >Signed-off-by: Kim Phillips > >--- > >There was a prior patch submitted by Alex W. here: > > > >https://lkml.org/lkml/2017/6/19/811 > > > >But I can't tell its fate - presume simply delayed? > > > >Coresight uses amba_bus in its call to bus_find_device() here: > > > >https://lxr.missinglinkelectronics.com/linux/drivers/hwtracing/coresight/of_coresight.c#L51 > > > >Grepping for bus_type and EXPORT shows other busses exporting their > >type, so I don't think this is the wrong approach. If, OTOH, Coresight > >needs to do something differently, please comment. > > Exposing raw bus_types is pretty ugly, but it is indeed the status quo, so > this probably is the reasonable thing to do. I suppose an amba_bus > equivalent of of_find_device_by_node() could be implemented, but for only a > single potential user that doesn't seem particularly worthwhile, since > unless some massive shake-up of how buses work comes along the bus_type will > inevitably end up being exported for other reasons anyway. So, in the > context of this series; > > Reviewed-by: Robin Murphy > > However, as a wild idea for sidestepping the issue completely (or at least > keeping it within the CoreSight framework), at first glance it appears > something like the below might be feasible, although I may well be missing > some obvious reason why not. > > Thanks, > Robin. > > ----->8----- > diff --git a/drivers/hwtracing/coresight/of_coresight.c > b/drivers/hwtracing/coresight/of_coresight.c > index 7c375443ede6..2c3fdc9b63e6 100644 > --- a/drivers/hwtracing/coresight/of_coresight.c > +++ b/drivers/hwtracing/coresight/of_coresight.c > @@ -27,28 +27,13 @@ > > static int of_dev_node_match(struct device *dev, void *data) > { > - return dev->of_node == data; > + return dev->parent->of_node == data; > } > > static struct device * > of_coresight_get_endpoint_device(struct device_node *endpoint) > { > - struct device *dev = NULL; > - > - /* > - * If we have a non-configurable replicator, it will be found on the > - * platform bus. > - */ > - dev = bus_find_device(&platform_bus_type, NULL, > - endpoint, of_dev_node_match); > - if (dev) > - return dev; > - > - /* > - * We have a configurable component - circle through the AMBA bus > - * looking for the device that matches the endpoint node. > - */ > - return bus_find_device(&amba_bustype, NULL, > + return bus_find_device(&coresight_bustype, NULL, > endpoint, of_dev_node_match); > } Hi Robin and thanks for the input. Your approach would work if all CS devices would be on the CS bus, which is not the case at discovery time when of_coresight_get_endpoint_device() is called. Mathieu >