From: gregkh@linuxfoundation.org (Greg KH)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/11 v6] coresight: add CoreSight core layer framework
Date: Thu, 11 Sep 2014 13:33:44 -0700 [thread overview]
Message-ID: <20140911203344.GA7593@kroah.com> (raw)
In-Reply-To: <1410450558-12358-2-git-send-email-mathieu.poirier@linaro.org>
Some first impressions in glancing at the code, not a complete review at
all:
On Thu, Sep 11, 2014 at 09:49:08AM -0600, mathieu.poirier at linaro.org wrote:
> --- /dev/null
> +++ b/drivers/coresight/coresight.c
> @@ -0,0 +1,663 @@
> +/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#define pr_fmt(fmt) "coresight: " fmt
MODULE_NAME ?
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/types.h>
> +#include <linux/device.h>
> +#include <linux/io.h>
> +#include <linux/err.h>
> +#include <linux/export.h>
> +#include <linux/slab.h>
> +#include <linux/semaphore.h>
> +#include <linux/clk.h>
> +#include <linux/coresight.h>
> +#include <linux/of_platform.h>
> +#include <linux/debugfs.h>
> +#include <linux/delay.h>
> +
> +#include "coresight-priv.h"
> +
> +struct dentry *cs_debugfs_parent = NULL;
> +
> +static LIST_HEAD(coresight_orph_conns);
> +static LIST_HEAD(coresight_devs);
You are a struct device, you don't need a separate list, why not just
iterate over your bus list of devices?
> +/**
> + * @id: unique ID of the component.
> + * @conns: list of connections associated to this component.
> + * @type: as defined by @coresight_dev_type.
> + * @subtype: as defined by @coresight_dev_subtype.
> + * @ops: generic operations for this component, as defined
> + by @coresight_ops.
> + * @de: handle on a component's debugfs entry.
> + * @dev: The device entity associated to this component.
> + * @kref: keeping count on component references.
> + * @dev_link: link of current component into list of all components
> + discovered in the system.
> + * @path_link: link of current component into the path being enabled.
> + * @owner: typically "THIS_MODULE".
> + * @enable: 'true' if component is currently part of an active path.
> + * @activated: 'true' only if a _sink_ has been activated. A sink can be
> + activated but not yet enabled. Enabling for a _sink_
> + happens when a source has been selected for that it.
> + */
> +struct coresight_device {
> + int id;
Why not use the device name instead?
> + struct coresight_connection *conns;
> + int nr_conns;
> + enum coresight_dev_type type;
> + struct coresight_dev_subtype subtype;
> + const struct coresight_ops *ops;
> + struct dentry *de;
All devices have a dentry? in debugfs? isn't that overkill?
> + struct device dev;
> + struct kref kref;
You CAN NOT have two reference counts in the same structure, that's a
huge design mistake. Stick with one reference count, otherwise they are
guaranteed to get out of sync and bad things will happen.
> + struct list_head dev_link;
As discussed above, I don't think you need this.
> + struct list_head path_link;
Odds are, you don't need this either.
> + struct module *owner;
devices aren't owned by modules, they are data, not code.
> + bool enable; /* true only if configured as part of a path */
> + bool activated; /* true only if a sink is part of a path */
> +};
> +
> +#define to_coresight_device(d) container_of(d, struct coresight_device, dev)
> +
> +#define source_ops(csdev) csdev->ops->source_ops
> +#define sink_ops(csdev) csdev->ops->sink_ops
> +#define link_ops(csdev) csdev->ops->link_ops
> +
> +#define CORESIGHT_DEBUGFS_ENTRY(__name, __entry_name, \
> + __mode, __get, __set, __fmt) \
> +DEFINE_SIMPLE_ATTRIBUTE(__name ## _ops, __get, __set, __fmt) \
Use the RW and RO only versions please. No need to ever set your own
mode value.
thanks,
greg k-h
next prev parent reply other threads:[~2014-09-11 20:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 15:49 [PATCH 00/11 v6] Coresight framework and drivers mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 01/11 v6] coresight: add CoreSight core layer framework mathieu.poirier at linaro.org
2014-09-11 20:33 ` Greg KH [this message]
2014-09-12 17:41 ` Mathieu Poirier
2014-09-12 18:16 ` Greg KH
2014-09-18 23:09 ` Mathieu Poirier
2014-09-24 5:45 ` Greg KH
2014-09-26 21:23 ` Mathieu Poirier
2014-09-12 18:44 ` Russell King - ARM Linux
2014-09-16 19:42 ` Mathieu Poirier
2014-09-11 15:49 ` [PATCH 02/11 v6] coresight-tmc: add CoreSight TMC driver mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 03/11 v6] coresight-tpiu: add CoreSight TPIU driver mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 04/11 v6] coresight-etb: add CoreSight ETB driver mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 05/11 v6] coresight-funnel: add CoreSight Funnel driver mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 06/11 v6] coresight-replicator: add CoreSight Replicator driver mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 07/11 v6] coresight-etm: add CoreSight ETM/PTM driver mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 08/11 v6] coresight: adding documentation for coresight mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 09/11 v6] coresight: adding support for beagle and beagleXM mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 10/11 v6] coresight: adding basic support for Vexpress TC2 mathieu.poirier at linaro.org
2014-09-11 15:49 ` [PATCH 11/11 v6] ARM: removing support for etb/etm in "arch/arm/kernel/" mathieu.poirier at linaro.org
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=20140911203344.GA7593@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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