linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Leach <mike.leach@linaro.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	devicetree@vger.kernel.org,
	Coresight ML <coresight@lists.linaro.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	linux-arm-msm@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Maxime Ripard <maxime@cerno.tech>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Andy Gross <agross@kernel.org>, Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH v9 08/15] coresight: cti: Enable CTI associated with devices.
Date: Tue, 25 Feb 2020 15:03:18 +0000	[thread overview]
Message-ID: <CAJ9a7VjJMtftam3t_e25ckOW_dufncbqdLkHeV3G8e7W9K5bCw@mail.gmail.com> (raw)
In-Reply-To: <20200221165134.GA25043@xps15>

As using devm_... for allocation, there is no need to explicitly free
up tc->con_dev_name, also the lifetime of the connection is linked to
the lifetime of csdev, so we can drop the devm_kstrdup in the csdev
case so this becomes

/* match: so swap in csdev name & dev */
               tc->con_dev_name = dev_name(&csdev->dev);
                tc->con_dev = csdev;
                return true;

Same true for similar link in patch 1, removing 2 un-needed
allocations, leaving 1 to be fixed up with error checking

Mike


On Fri, 21 Feb 2020 at 16:51, Mathieu Poirier
<mathieu.poirier@linaro.org> wrote:
>
> On Fri, Feb 21, 2020 at 12:20:17AM +0000, Suzuki K Poulose wrote:
> > Hi Mike
> >
> > Sorry for the delay. one minor comment below.
> >
> > On 02/10/2020 09:39 PM, Mike Leach wrote:
> > > The CoreSight subsystem enables a path of devices from source to sink.
> > > Any CTI devices associated with the path devices must be enabled at the
> > > same time.
> > >
> > > This patch adds an associated coresight_device element to the main
> > > coresight device structure, and uses this to create associations between
> > > the CTI and other devices based on the device tree data. The associated
> > > device element is used to enable CTI in conjunction with the path elements.
> > >
> > > CTI devices are reference counted so where a single CTI is associated with
> > > multiple elements on the path, it will be enabled on the first associated
> > > device enable, and disabled with the last associated device disable.
> > >
> > > Signed-off-by: Mike Leach <mike.leach@linaro.org>
> > > Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > ---
> > >   drivers/hwtracing/coresight/coresight-cti.c  | 129 +++++++++++++++++++
> > >   drivers/hwtracing/coresight/coresight-cti.h  |   1 +
> > >   drivers/hwtracing/coresight/coresight-priv.h |  12 ++
> > >   drivers/hwtracing/coresight/coresight.c      |  71 +++++++++-
> > >   include/linux/coresight.h                    |   4 +
> > >   5 files changed, 212 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c
> > > index 77c2af247917..c4494923d030 100644
> > > --- a/drivers/hwtracing/coresight/coresight-cti.c
> > > +++ b/drivers/hwtracing/coresight/coresight-cti.c
> > > @@ -4,6 +4,7 @@
> > >    * Author: Mike Leach <mike.leach@linaro.org>
> > >    */
> > > +#include <linux/property.h>
> > >   #include "coresight-cti.h"
> > >   /**
> > > @@ -440,6 +441,131 @@ int cti_channel_setop(struct device *dev, enum cti_chan_set_op op,
> > >     return err;
> > >   }
> > > +/*
> > > + * Look for a matching connection device name in the list of connections.
> > > + * If found then swap in the csdev name, set trig con association pointer
> > > + * and return found.
> > > + */
> > > +static bool
> > > +cti_match_fixup_csdev(struct cti_device *ctidev, const char *node_name,
> > > +                 struct coresight_device *csdev)
> > > +{
> > > +   struct cti_trig_con *tc;
> > > +   const char *csdev_name;
> > > +
> > > +   list_for_each_entry(tc, &ctidev->trig_cons, node) {
> > > +           if (tc->con_dev_name) {
> > > +                   if (!strcmp(node_name, tc->con_dev_name)) {
> > > +                           /* match: so swap in csdev name & dev */
> > > +                           csdev_name = dev_name(&csdev->dev);
> > > +                           tc->con_dev_name =
> > > +                                   devm_kstrdup(&csdev->dev, csdev_name,
> > > +                                                GFP_KERNEL);
> >
> > In the extreme rare case of an allocation failure, we may want to
> > check if the allocation was successful or not, rather than silently
> > ignoring it. With that fixed,
>
> Line 419 and 423 in patch 1 need the same attention.
>
> >
> > Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>



--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK

  reply	other threads:[~2020-02-25 15:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 21:39 [PATCH v9 00/15] CoreSight CTI Driver Mike Leach
2020-02-10 21:39 ` [PATCH v9 01/15] coresight: cti: Initial " Mike Leach
2020-02-21 17:06   ` Mathieu Poirier
2020-02-24 14:07     ` Mike Leach
2020-02-10 21:39 ` [PATCH v9 02/15] coresight: cti: Add sysfs coresight mgmt reg access Mike Leach
2020-02-10 21:39 ` [PATCH v9 03/15] coresight: cti: Add sysfs access to program function regs Mike Leach
2020-02-10 21:39 ` [PATCH v9 04/15] coresight: cti: Add sysfs trigger / channel programming API Mike Leach
2020-02-10 21:39 ` [PATCH v9 05/15] dt-bindings: arm: Adds CoreSight CTI hardware definitions Mike Leach
2020-02-10 21:39 ` [PATCH v9 06/15] coresight: cti: Add device tree support for v8 arch CTI Mike Leach
2020-02-10 21:39 ` [PATCH v9 07/15] coresight: cti: Add device tree support for custom CTI Mike Leach
2020-02-10 21:39 ` [PATCH v9 08/15] coresight: cti: Enable CTI associated with devices Mike Leach
2020-02-17 23:12   ` Mathieu Poirier
2020-02-21  0:20   ` Suzuki K Poulose
2020-02-21 16:51     ` Mathieu Poirier
2020-02-25 15:03       ` Mike Leach [this message]
2020-02-10 21:39 ` [PATCH v9 09/15] coresight: cti: Add connection information to sysfs Mike Leach
2020-02-10 21:39 ` [PATCH v9 10/15] dt-bindings: qcom: Add CTI options for qcom msm8916 Mike Leach
2020-02-10 21:39 ` [PATCH v9 11/15] dt-bindings: arm: Juno platform - add CTI entries to device tree Mike Leach
2020-02-11 11:59   ` Sudeep Holla
2020-02-12 22:12     ` Mathieu Poirier
2020-02-13 11:08       ` Sudeep Holla
2020-02-10 21:39 ` [PATCH v9 12/15] dt-bindings: hisilicon: Add CTI bindings for hi-6220 Mike Leach
2020-02-10 21:39 ` [PATCH v9 13/15] docs: coresight: Update documentation for CoreSight to cover CTI Mike Leach
2020-02-10 21:39 ` [PATCH v9 14/15] docs: sysfs: coresight: Add sysfs ABI documentation for CTI Mike Leach
2020-02-10 21:39 ` [PATCH v9 15/15] Update MAINTAINERS to add reviewer for CoreSight Mike Leach
2020-02-24 15:46 ` [PATCH v9 00/15] CoreSight CTI Driver Marc Gonzalez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ9a7VjJMtftam3t_e25ckOW_dufncbqdLkHeV3G8e7W9K5bCw@mail.gmail.com \
    --to=mike.leach@linaro.org \
    --cc=agross@kernel.org \
    --cc=corbet@lwn.net \
    --cc=coresight@lists.linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=maxime@cerno.tech \
    --cc=robh+dt@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).