linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] coresight: Minor sparse and style fixes
@ 2020-04-26 18:58 Stephen Boyd
  2020-04-26 18:58 ` [PATCH 1/5] coresight: Include required headers in C files Stephen Boyd
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-26 18:58 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Suzuki K Poulose, Mike Leach,
	Douglas Anderson

I got a report that kcalloc() didn't exist in coresight-cti-platform.c
on arm builds and that looked like we didn't include very many headers
to get prototypes of functions like kcalloc(), etc. The first patch fixes
this problem by including the headers and then the rest of these
patches fix minor sparse and style issues that I saw while looking
through the coresight directory.

Pathes based on v5.7-rc1.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com> 
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>

Stephen Boyd (5):
  coresight: Include required headers in C files
  coresight: Mark some functions static
  coresight: Don't initialize variables unnecessarily
  coresight: Initialize arg in sparse friendly way
  coresight: Avoid casting void pointers

 .../coresight/coresight-cti-platform.c          | 11 ++++++++---
 .../hwtracing/coresight/coresight-cti-sysfs.c   | 17 ++++++++++++-----
 drivers/hwtracing/coresight/coresight-cti.c     |  6 +++---
 drivers/hwtracing/coresight/coresight-cti.h     | 10 +++++++++-
 drivers/hwtracing/coresight/coresight-etb10.c   |  2 +-
 drivers/hwtracing/coresight/coresight-etm3x.c   |  2 +-
 drivers/hwtracing/coresight/coresight-etm4x.c   |  2 +-
 .../hwtracing/coresight/coresight-platform.c    |  4 ++--
 drivers/hwtracing/coresight/coresight-priv.h    |  9 ++++++---
 drivers/hwtracing/coresight/coresight-tmc.c     |  2 +-
 10 files changed, 44 insertions(+), 21 deletions(-)


base-commit: 8f3d9f354286745c751374f5f1fcafee6b3f3136
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] coresight: Include required headers in C files
  2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
@ 2020-04-26 18:58 ` Stephen Boyd
  2020-04-27 16:34   ` Mathieu Poirier
  2020-04-26 18:58 ` [PATCH 2/5] coresight: Mark some functions static Stephen Boyd
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Stephen Boyd @ 2020-04-26 18:58 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Douglas Anderson,
	Suzuki K Poulose, Mike Leach

We should include headers that C files use in the C files that use them
and avoid relying on implicit includes as much as possible. This helps
avoid compiler errors in the future about missing declarations when
header files change includes in the future.

Cc: Douglas Anderson <dianders@chromium.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/hwtracing/coresight/coresight-cti-platform.c |  8 +++++++-
 drivers/hwtracing/coresight/coresight-cti-sysfs.c    |  7 +++++++
 drivers/hwtracing/coresight/coresight-cti.h          | 10 +++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
index b44d83142b62..245f16c61af8 100644
--- a/drivers/hwtracing/coresight/coresight-cti-platform.c
+++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
@@ -2,11 +2,17 @@
 /*
  * Copyright (c) 2019, The Linaro Limited. All rights reserved.
  */
+#include <linux/coresight.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/property.h>
+#include <linux/slab.h>
 
 #include <dt-bindings/arm/coresight-cti-dt.h>
-#include <linux/of.h>
 
 #include "coresight-cti.h"
+#include "coresight-priv.h"
 
 /* Number of CTI signals in the v8 architecturally defined connection */
 #define NR_V8PE_IN_SIGS		2
diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index 1f8fb7c15e80..bed460541f15 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -4,7 +4,14 @@
  * Author: Mike Leach <mike.leach@linaro.org>
  */
 
+#include <linux/atomic.h>
 #include <linux/coresight.h>
+#include <linux/device.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/sysfs.h>
 
 #include "coresight-cti.h"
 
diff --git a/drivers/hwtracing/coresight/coresight-cti.h b/drivers/hwtracing/coresight/coresight-cti.h
index 004df3ab9dd0..d80123b905a8 100644
--- a/drivers/hwtracing/coresight/coresight-cti.h
+++ b/drivers/hwtracing/coresight/coresight-cti.h
@@ -7,8 +7,10 @@
 #ifndef _CORESIGHT_CORESIGHT_CTI_H
 #define _CORESIGHT_CORESIGHT_CTI_H
 
-#include <asm/local.h>
+#include <linux/list.h>
 #include <linux/spinlock.h>
+#include <linux/types.h>
+
 #include "coresight-priv.h"
 
 /*
@@ -52,6 +54,12 @@
  */
 #define CTIINOUTEN_MAX		32
 
+struct attribute;
+struct attribute_group;
+struct coresight_device;
+struct device;
+struct fwnode_handle;
+
 /**
  * Group of related trigger signals
  *
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] coresight: Mark some functions static
  2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
  2020-04-26 18:58 ` [PATCH 1/5] coresight: Include required headers in C files Stephen Boyd
@ 2020-04-26 18:58 ` Stephen Boyd
  2020-04-26 18:58 ` [PATCH 3/5] coresight: Don't initialize variables unnecessarily Stephen Boyd
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-26 18:58 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Suzuki K Poulose, Mike Leach

These functions aren't used outside the file they're in. Mark them
static to indicate as such and silence tools like sparse.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/hwtracing/coresight/coresight-cti-platform.c | 3 +--
 drivers/hwtracing/coresight/coresight-cti-sysfs.c    | 2 +-
 drivers/hwtracing/coresight/coresight-cti.c          | 6 +++---
 drivers/hwtracing/coresight/coresight-etb10.c        | 2 +-
 drivers/hwtracing/coresight/coresight-platform.c     | 4 ++--
 drivers/hwtracing/coresight/coresight-tmc.c          | 2 +-
 6 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
index 245f16c61af8..ab3bd4ed0910 100644
--- a/drivers/hwtracing/coresight/coresight-cti-platform.c
+++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
@@ -435,8 +435,7 @@ static int cti_plat_create_impdef_connections(struct device *dev,
 }
 
 /* get the hardware configuration & connection data. */
-int cti_plat_get_hw_data(struct device *dev,
-			 struct cti_drvdata *drvdata)
+static int cti_plat_get_hw_data(struct device *dev, struct cti_drvdata *drvdata)
 {
 	int rc = 0;
 	struct cti_device *cti_dev = &drvdata->ctidev;
diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index bed460541f15..7da846a3a829 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -1146,7 +1146,7 @@ static int cti_create_con_attr_set(struct device *dev, int con_idx,
 }
 
 /* create the array of group pointers for the CTI sysfs groups */
-int cti_create_cons_groups(struct device *dev, struct cti_device *ctidev)
+static int cti_create_cons_groups(struct device *dev, struct cti_device *ctidev)
 {
 	int nr_groups;
 
diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c
index aa6e0249bd70..aac9a0d91e19 100644
--- a/drivers/hwtracing/coresight/coresight-cti.c
+++ b/drivers/hwtracing/coresight/coresight-cti.c
@@ -19,7 +19,7 @@
  */
 
 /* net of CTI devices connected via CTM */
-LIST_HEAD(ect_net);
+static LIST_HEAD(ect_net);
 
 /* protect the list */
 static DEFINE_MUTEX(ect_mutex);
@@ -578,12 +578,12 @@ int cti_disable(struct coresight_device *csdev)
 	return cti_disable_hw(drvdata);
 }
 
-const struct coresight_ops_ect cti_ops_ect = {
+static const struct coresight_ops_ect cti_ops_ect = {
 	.enable = cti_enable,
 	.disable = cti_disable,
 };
 
-const struct coresight_ops cti_ops = {
+static const struct coresight_ops cti_ops = {
 	.ect_ops = &cti_ops_ect,
 };
 
diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
index 3810290e6d07..03e3f2590191 100644
--- a/drivers/hwtracing/coresight/coresight-etb10.c
+++ b/drivers/hwtracing/coresight/coresight-etb10.c
@@ -717,7 +717,7 @@ static const struct attribute_group coresight_etb_mgmt_group = {
 	.name = "mgmt",
 };
 
-const struct attribute_group *coresight_etb_groups[] = {
+static const struct attribute_group *coresight_etb_groups[] = {
 	&coresight_etb_group,
 	&coresight_etb_mgmt_group,
 	NULL,
diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 43418a2126ff..8639f6981794 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -501,7 +501,7 @@ static inline bool acpi_validate_dsd_graph(const union acpi_object *graph)
 }
 
 /* acpi_get_dsd_graph	- Find the _DSD Graph property for the given device. */
-const union acpi_object *
+static const union acpi_object *
 acpi_get_dsd_graph(struct acpi_device *adev)
 {
 	int i;
@@ -564,7 +564,7 @@ acpi_validate_coresight_graph(const union acpi_object *cs_graph)
  * Returns the pointer to the CoreSight Graph Package when found. Otherwise
  * returns NULL.
  */
-const union acpi_object *
+static const union acpi_object *
 acpi_get_coresight_graph(struct acpi_device *adev)
 {
 	const union acpi_object *graph_list, *graph;
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
index 1cf82fa58289..39fba1d16e6e 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.c
+++ b/drivers/hwtracing/coresight/coresight-tmc.c
@@ -361,7 +361,7 @@ static const struct attribute_group coresight_tmc_mgmt_group = {
 	.name = "mgmt",
 };
 
-const struct attribute_group *coresight_tmc_groups[] = {
+static const struct attribute_group *coresight_tmc_groups[] = {
 	&coresight_tmc_group,
 	&coresight_tmc_mgmt_group,
 	NULL,
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] coresight: Don't initialize variables unnecessarily
  2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
  2020-04-26 18:58 ` [PATCH 1/5] coresight: Include required headers in C files Stephen Boyd
  2020-04-26 18:58 ` [PATCH 2/5] coresight: Mark some functions static Stephen Boyd
@ 2020-04-26 18:58 ` Stephen Boyd
  2020-04-26 18:58 ` [PATCH 4/5] coresight: Initialize arg in sparse friendly way Stephen Boyd
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-26 18:58 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Suzuki K Poulose, Mike Leach

These variables are assigned again before they're used. Leave them
unassigned at first so that the compiler can detect problems in the
future with use before initialization.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/hwtracing/coresight/coresight-cti-sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index 7da846a3a829..77e14e770806 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -1043,8 +1043,8 @@ static int cti_create_con_sysfs_attr(struct device *dev,
 				     enum cti_conn_attr_type attr_type,
 				     int attr_idx)
 {
-	struct dev_ext_attribute *eattr = 0;
-	char *name = 0;
+	struct dev_ext_attribute *eattr;
+	char *name;
 
 	eattr = devm_kzalloc(dev, sizeof(struct dev_ext_attribute),
 				    GFP_KERNEL);
@@ -1163,8 +1163,8 @@ static int cti_create_cons_groups(struct device *dev, struct cti_device *ctidev)
 int cti_create_cons_sysfs(struct device *dev, struct cti_drvdata *drvdata)
 {
 	struct cti_device *ctidev = &drvdata->ctidev;
-	int err = 0, con_idx = 0, i;
-	struct cti_trig_con *tc = NULL;
+	int err, con_idx = 0, i;
+	struct cti_trig_con *tc;
 
 	err = cti_create_cons_groups(dev, ctidev);
 	if (err)
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/5] coresight: Initialize arg in sparse friendly way
  2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
                   ` (2 preceding siblings ...)
  2020-04-26 18:58 ` [PATCH 3/5] coresight: Don't initialize variables unnecessarily Stephen Boyd
@ 2020-04-26 18:58 ` Stephen Boyd
  2020-04-26 18:58 ` [PATCH 5/5] coresight: Avoid casting void pointers Stephen Boyd
  2020-04-27 17:05 ` [PATCH 0/5] coresight: Minor sparse and style fixes Mathieu Poirier
  5 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-26 18:58 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Suzuki K Poulose, Mike Leach

Sparse gets annoyed when this initializer is 0 but the first struct
member is a pointer. Just use { } to initialize instead so that sparse
is quiet.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/hwtracing/coresight/coresight-etm3x.c | 2 +-
 drivers/hwtracing/coresight/coresight-etm4x.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
index e2cb6873c3f2..bf22dcfd3327 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x.c
@@ -504,7 +504,7 @@ static int etm_enable_perf(struct coresight_device *csdev,
 static int etm_enable_sysfs(struct coresight_device *csdev)
 {
 	struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
-	struct etm_enable_arg arg = { 0 };
+	struct etm_enable_arg arg = { };
 	int ret;
 
 	spin_lock(&drvdata->spinlock);
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index a90d757f7043..0f850efc1c82 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -412,7 +412,7 @@ static int etm4_enable_perf(struct coresight_device *csdev,
 static int etm4_enable_sysfs(struct coresight_device *csdev)
 {
 	struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
-	struct etm4_enable_arg arg = { 0 };
+	struct etm4_enable_arg arg = { };
 	int ret;
 
 	spin_lock(&drvdata->spinlock);
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] coresight: Avoid casting void pointers
  2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
                   ` (3 preceding siblings ...)
  2020-04-26 18:58 ` [PATCH 4/5] coresight: Initialize arg in sparse friendly way Stephen Boyd
@ 2020-04-26 18:58 ` Stephen Boyd
  2020-04-26 20:37   ` Joe Perches
  2020-04-27 17:05 ` [PATCH 0/5] coresight: Minor sparse and style fixes Mathieu Poirier
  5 siblings, 1 reply; 10+ messages in thread
From: Stephen Boyd @ 2020-04-26 18:58 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Suzuki K Poulose, Mike Leach

We don't need to cast void pointers, such as the amba_id data. Assign to
a local variable to make the code prettier and also return NULL instead
of 0 to make sparse happy.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/hwtracing/coresight/coresight-priv.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
index 890f9a5c97c6..09ca9d824cee 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -206,9 +206,12 @@ cti_remove_assoc_from_csdev(struct coresight_device *csdev) {}
 /* extract the data value from a UCI structure given amba_id pointer. */
 static inline void *coresight_get_uci_data(const struct amba_id *id)
 {
-	if (id->data)
-		return ((struct amba_cs_uci_id *)(id->data))->data;
-	return 0;
+	struct amba_cs_uci_id *uci_id = id->data;
+
+	if (uci_id)
+		return id->data;
+
+	return NULL;
 }
 
 void coresight_release_platform_data(struct coresight_platform_data *pdata);
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/5] coresight: Avoid casting void pointers
  2020-04-26 18:58 ` [PATCH 5/5] coresight: Avoid casting void pointers Stephen Boyd
@ 2020-04-26 20:37   ` Joe Perches
  0 siblings, 0 replies; 10+ messages in thread
From: Joe Perches @ 2020-04-26 20:37 UTC (permalink / raw)
  To: Stephen Boyd, Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Suzuki K Poulose, Mike Leach

On Sun, 2020-04-26 at 11:58 -0700, Stephen Boyd wrote:
> We don't need to cast void pointers, such as the amba_id data. Assign to
> a local variable to make the code prettier and also return NULL instead
> of 0 to make sparse happy.
[]
> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
[]
> @@ -206,9 +206,12 @@ cti_remove_assoc_from_csdev(struct coresight_device *csdev) {}
>  /* extract the data value from a UCI structure given amba_id pointer. */
>  static inline void *coresight_get_uci_data(const struct amba_id *id)
>  {
> -	if (id->data)
> -		return ((struct amba_cs_uci_id *)(id->data))->data;
> -	return 0;
> +	struct amba_cs_uci_id *uci_id = id->data;
> +
> +	if (uci_id)
> +		return id->data;

Missing one more level of indirection here yes?

		return uci_id->data;

> +
> +	return NULL;
>  }

And this code would generally be written to return the expected
value at the bottom of the function and any unusual return
early like:

static inline void *coresight_get_uci_data(const struct amba_id *id)
{
	struct amba_cs_uci_id *uci_id = id->data;

	if (!uci_id)
		return NULL;

	return uci_id->data;
}



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] coresight: Include required headers in C files
  2020-04-26 18:58 ` [PATCH 1/5] coresight: Include required headers in C files Stephen Boyd
@ 2020-04-27 16:34   ` Mathieu Poirier
  2020-04-28 17:34     ` Stephen Boyd
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Poirier @ 2020-04-27 16:34 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel, linux-arm-kernel, Douglas Anderson,
	Suzuki K Poulose, Mike Leach

On Sun, Apr 26, 2020 at 11:58:01AM -0700, Stephen Boyd wrote:
> We should include headers that C files use in the C files that use them
> and avoid relying on implicit includes as much as possible. This helps
> avoid compiler errors in the future about missing declarations when
> header files change includes in the future.
> 
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  drivers/hwtracing/coresight/coresight-cti-platform.c |  8 +++++++-
>  drivers/hwtracing/coresight/coresight-cti-sysfs.c    |  7 +++++++
>  drivers/hwtracing/coresight/coresight-cti.h          | 10 +++++++++-
>  3 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index b44d83142b62..245f16c61af8 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -2,11 +2,17 @@
>  /*
>   * Copyright (c) 2019, The Linaro Limited. All rights reserved.
>   */
> +#include <linux/coresight.h>
> +#include <linux/device.h>
> +#include <linux/err.h>
> +#include <linux/of.h>
> +#include <linux/property.h>
> +#include <linux/slab.h>
>  
>  #include <dt-bindings/arm/coresight-cti-dt.h>
> -#include <linux/of.h>
>  
>  #include "coresight-cti.h"
> +#include "coresight-priv.h"
>  
>  /* Number of CTI signals in the v8 architecturally defined connection */
>  #define NR_V8PE_IN_SIGS		2
> diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> index 1f8fb7c15e80..bed460541f15 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> @@ -4,7 +4,14 @@
>   * Author: Mike Leach <mike.leach@linaro.org>
>   */
>  
> +#include <linux/atomic.h>
>  #include <linux/coresight.h>
> +#include <linux/device.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/slab.h>
> +#include <linux/spinlock.h>
> +#include <linux/sysfs.h>
>  
>  #include "coresight-cti.h"
>  
> diff --git a/drivers/hwtracing/coresight/coresight-cti.h b/drivers/hwtracing/coresight/coresight-cti.h
> index 004df3ab9dd0..d80123b905a8 100644
> --- a/drivers/hwtracing/coresight/coresight-cti.h
> +++ b/drivers/hwtracing/coresight/coresight-cti.h
> @@ -7,8 +7,10 @@
>  #ifndef _CORESIGHT_CORESIGHT_CTI_H
>  #define _CORESIGHT_CORESIGHT_CTI_H
>  
> -#include <asm/local.h>
> +#include <linux/list.h>
>  #include <linux/spinlock.h>
> +#include <linux/types.h>
> +
>  #include "coresight-priv.h"
>  
>  /*
> @@ -52,6 +54,12 @@
>   */
>  #define CTIINOUTEN_MAX		32
>  
> +struct attribute;
> +struct attribute_group;
> +struct coresight_device;
> +struct device;
> +struct fwnode_handle;
> +

I would prefer adding the headers rather than forward declarations, it scales
better.

Thanks,
Mathieu

>  /**
>   * Group of related trigger signals
>   *
> -- 
> Sent by a computer, using git, on the internet
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] coresight: Minor sparse and style fixes
  2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
                   ` (4 preceding siblings ...)
  2020-04-26 18:58 ` [PATCH 5/5] coresight: Avoid casting void pointers Stephen Boyd
@ 2020-04-27 17:05 ` Mathieu Poirier
  5 siblings, 0 replies; 10+ messages in thread
From: Mathieu Poirier @ 2020-04-27 17:05 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel, linux-arm-kernel, Suzuki K Poulose, Mike Leach,
	Douglas Anderson

On Sun, Apr 26, 2020 at 11:58:00AM -0700, Stephen Boyd wrote:
> I got a report that kcalloc() didn't exist in coresight-cti-platform.c
> on arm builds and that looked like we didn't include very many headers
> to get prototypes of functions like kcalloc(), etc. The first patch fixes
> this problem by including the headers and then the rest of these
> patches fix minor sparse and style issues that I saw while looking
> through the coresight directory.
> 
> Pathes based on v5.7-rc1.
> 
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> 
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> 
> Stephen Boyd (5):
>   coresight: Include required headers in C files
>   coresight: Mark some functions static
>   coresight: Don't initialize variables unnecessarily
>   coresight: Initialize arg in sparse friendly way
>   coresight: Avoid casting void pointers

I have applied patches 2, 3 and 4, so no need to send them again.  Note that I
dropped changes to coresight-cti.c and coresight-etb10.c in patch 2 as the
changes were already in my coresight-next branch.

Thanks,
Mathieu

> 
>  .../coresight/coresight-cti-platform.c          | 11 ++++++++---
>  .../hwtracing/coresight/coresight-cti-sysfs.c   | 17 ++++++++++++-----
>  drivers/hwtracing/coresight/coresight-cti.c     |  6 +++---
>  drivers/hwtracing/coresight/coresight-cti.h     | 10 +++++++++-
>  drivers/hwtracing/coresight/coresight-etb10.c   |  2 +-
>  drivers/hwtracing/coresight/coresight-etm3x.c   |  2 +-
>  drivers/hwtracing/coresight/coresight-etm4x.c   |  2 +-
>  .../hwtracing/coresight/coresight-platform.c    |  4 ++--
>  drivers/hwtracing/coresight/coresight-priv.h    |  9 ++++++---
>  drivers/hwtracing/coresight/coresight-tmc.c     |  2 +-
>  10 files changed, 44 insertions(+), 21 deletions(-)
> 
> 
> base-commit: 8f3d9f354286745c751374f5f1fcafee6b3f3136
> -- 
> Sent by a computer, using git, on the internet
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] coresight: Include required headers in C files
  2020-04-27 16:34   ` Mathieu Poirier
@ 2020-04-28 17:34     ` Stephen Boyd
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2020-04-28 17:34 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-kernel, linux-arm-kernel, Douglas Anderson,
	Suzuki K Poulose, Mike Leach

Quoting Mathieu Poirier (2020-04-27 09:34:46)
> On Sun, Apr 26, 2020 at 11:58:01AM -0700, Stephen Boyd wrote:
> > diff --git a/drivers/hwtracing/coresight/coresight-cti.h b/drivers/hwtracing/coresight/coresight-cti.h
> > index 004df3ab9dd0..d80123b905a8 100644
> > --- a/drivers/hwtracing/coresight/coresight-cti.h
> > +++ b/drivers/hwtracing/coresight/coresight-cti.h
> > @@ -7,8 +7,10 @@
> >  #ifndef _CORESIGHT_CORESIGHT_CTI_H
> >  #define _CORESIGHT_CORESIGHT_CTI_H
> >  
> > -#include <asm/local.h>
> > +#include <linux/list.h>
> >  #include <linux/spinlock.h>
> > +#include <linux/types.h>
> > +
> >  #include "coresight-priv.h"
> >  
> >  /*
> > @@ -52,6 +54,12 @@
> >   */
> >  #define CTIINOUTEN_MAX               32
> >  
> > +struct attribute;
> > +struct attribute_group;
> > +struct coresight_device;
> > +struct device;
> > +struct fwnode_handle;
> > +
> 
> I would prefer adding the headers rather than forward declarations, it scales
> better.
> 

Ok. I'm worried that including too many headers when they're not
necessary means it's easier to get into the problem that I'm trying to
solve here where kcalloc() isn't defined. Anyway, I'll update the
patch and resend!

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-28 17:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
2020-04-26 18:58 ` [PATCH 1/5] coresight: Include required headers in C files Stephen Boyd
2020-04-27 16:34   ` Mathieu Poirier
2020-04-28 17:34     ` Stephen Boyd
2020-04-26 18:58 ` [PATCH 2/5] coresight: Mark some functions static Stephen Boyd
2020-04-26 18:58 ` [PATCH 3/5] coresight: Don't initialize variables unnecessarily Stephen Boyd
2020-04-26 18:58 ` [PATCH 4/5] coresight: Initialize arg in sparse friendly way Stephen Boyd
2020-04-26 18:58 ` [PATCH 5/5] coresight: Avoid casting void pointers Stephen Boyd
2020-04-26 20:37   ` Joe Perches
2020-04-27 17:05 ` [PATCH 0/5] coresight: Minor sparse and style fixes Mathieu Poirier

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).