From 2782ba9e41e3353e182298645bcf42d89dc0188e Mon Sep 17 00:00:00 2001 From: brucex Date: Wed, 14 Jun 2023 17:48:31 +0800 Subject: [PATCH] gpu: host1x: Fix for const correctness in actmon code Building the Android Common Kernel (ACK) with clang exposes build errors due to const correctness issues in actmon code. Remove actmon name when it is not necessary. Set host1x_info var as const. Set host1x_actmon_entry var as const. Bug 3974840 Change-Id: I50c1437199ad549f397944aefa535103ed2fa05c Signed-off-by: Bruce Xu Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921160 Reviewed-by: Mikko Perttunen Reviewed-by: Johnny Liu GVS: Gerrit_Virtual_Submit --- drivers/gpu/host1x/actmon.c | 11 +++++------ drivers/gpu/host1x/actmon.h | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/host1x/actmon.c b/drivers/gpu/host1x/actmon.c index 143a10c5..8ead0f65 100644 --- a/drivers/gpu/host1x/actmon.c +++ b/drivers/gpu/host1x/actmon.c @@ -81,7 +81,7 @@ DEFINE_SIMPLE_ATTRIBUTE(host1x_actmon_sample_period_fops, host1x_actmon_sample_period_set, "%lld\n"); -static void host1x_actmon_debug_init(struct host1x_actmon *actmon) +static void host1x_actmon_debug_init(struct host1x_actmon *actmon, const char *name) { struct host1x *host = dev_get_drvdata(actmon->client->host->parent); struct dentry *debugfs = host->actmon_debugfs; @@ -89,7 +89,7 @@ static void host1x_actmon_debug_init(struct host1x_actmon *actmon) if (!debugfs) return; - actmon->debugfs = debugfs_create_dir(actmon->name, debugfs); + actmon->debugfs = debugfs_create_dir(name, debugfs); /* R/W files */ debugfs_create_file("sample_period", 0644, actmon->debugfs, actmon, @@ -326,8 +326,8 @@ void host1x_actmon_handle_interrupt(struct host1x *host, int classid) int host1x_actmon_register(struct host1x_client *client) { struct host1x *host = dev_get_drvdata(client->host->parent); - struct host1x_info *info = host->info; - struct host1x_actmon_entry *entry = NULL; + const struct host1x_info *info = host->info; + const struct host1x_actmon_entry *entry = NULL; struct host1x_actmon_module *module; struct host1x_actmon *actmon; unsigned long flags; @@ -357,7 +357,6 @@ int host1x_actmon_register(struct host1x_client *client) actmon->rate = clk_get_rate(host->actmon_clk); actmon->regs = host->actmon_regs + entry->offset; actmon->irq = entry->irq; - actmon->name = entry->name; actmon->num_modules = entry->num_modules; actmon->usecs_per_sample = 1500; @@ -365,7 +364,7 @@ int host1x_actmon_register(struct host1x_client *client) host1x_actmon_init(actmon); /* Create debugfs for the actmon */ - host1x_actmon_debug_init(actmon); + host1x_actmon_debug_init(actmon, entry->name); /* Configure actmon module registers */ for (i = 0; i < actmon->num_modules; i++) { diff --git a/drivers/gpu/host1x/actmon.h b/drivers/gpu/host1x/actmon.h index 1f92987f..798bfd8e 100644 --- a/drivers/gpu/host1x/actmon.h +++ b/drivers/gpu/host1x/actmon.h @@ -31,7 +31,6 @@ struct host1x_actmon_module { struct host1x_client; struct host1x_actmon { - char *name; unsigned int irq; unsigned int num_modules; unsigned long rate;