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 <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921160
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
brucex
2023-06-14 17:48:31 +08:00
committed by mobile promotions
parent 94b8c1c354
commit 2782ba9e41
2 changed files with 5 additions and 7 deletions

View File

@@ -81,7 +81,7 @@ DEFINE_SIMPLE_ATTRIBUTE(host1x_actmon_sample_period_fops,
host1x_actmon_sample_period_set, host1x_actmon_sample_period_set,
"%lld\n"); "%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 host1x *host = dev_get_drvdata(actmon->client->host->parent);
struct dentry *debugfs = host->actmon_debugfs; struct dentry *debugfs = host->actmon_debugfs;
@@ -89,7 +89,7 @@ static void host1x_actmon_debug_init(struct host1x_actmon *actmon)
if (!debugfs) if (!debugfs)
return; return;
actmon->debugfs = debugfs_create_dir(actmon->name, debugfs); actmon->debugfs = debugfs_create_dir(name, debugfs);
/* R/W files */ /* R/W files */
debugfs_create_file("sample_period", 0644, actmon->debugfs, actmon, 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) int host1x_actmon_register(struct host1x_client *client)
{ {
struct host1x *host = dev_get_drvdata(client->host->parent); struct host1x *host = dev_get_drvdata(client->host->parent);
struct host1x_info *info = host->info; const struct host1x_info *info = host->info;
struct host1x_actmon_entry *entry = NULL; const struct host1x_actmon_entry *entry = NULL;
struct host1x_actmon_module *module; struct host1x_actmon_module *module;
struct host1x_actmon *actmon; struct host1x_actmon *actmon;
unsigned long flags; unsigned long flags;
@@ -357,7 +357,6 @@ int host1x_actmon_register(struct host1x_client *client)
actmon->rate = clk_get_rate(host->actmon_clk); actmon->rate = clk_get_rate(host->actmon_clk);
actmon->regs = host->actmon_regs + entry->offset; actmon->regs = host->actmon_regs + entry->offset;
actmon->irq = entry->irq; actmon->irq = entry->irq;
actmon->name = entry->name;
actmon->num_modules = entry->num_modules; actmon->num_modules = entry->num_modules;
actmon->usecs_per_sample = 1500; actmon->usecs_per_sample = 1500;
@@ -365,7 +364,7 @@ int host1x_actmon_register(struct host1x_client *client)
host1x_actmon_init(actmon); host1x_actmon_init(actmon);
/* Create debugfs for the actmon */ /* Create debugfs for the actmon */
host1x_actmon_debug_init(actmon); host1x_actmon_debug_init(actmon, entry->name);
/* Configure actmon module registers */ /* Configure actmon module registers */
for (i = 0; i < actmon->num_modules; i++) { for (i = 0; i < actmon->num_modules; i++) {

View File

@@ -31,7 +31,6 @@ struct host1x_actmon_module {
struct host1x_client; struct host1x_client;
struct host1x_actmon { struct host1x_actmon {
char *name;
unsigned int irq; unsigned int irq;
unsigned int num_modules; unsigned int num_modules;
unsigned long rate; unsigned long rate;