Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1035952imm; Wed, 25 Jul 2018 10:20:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcg/+2n8Ymp22s4AHa5GUSl2M0tlEcUxjeu+K6PRfmc0NmHAFR/VVOwRpFbrXfgOfQTiSx9 X-Received: by 2002:a63:3046:: with SMTP id w67-v6mr20829511pgw.176.1532539222146; Wed, 25 Jul 2018 10:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532539222; cv=none; d=google.com; s=arc-20160816; b=Y222m/BDyuoIsFWX1Sb1yFptVgJ0pNsWAo0CqJq9pUKRxB0WcL3wEsoMya41GZqh1o tgQT1i9OyZ9l6VLSfZvkpo91I0A+ENFYQSoK3TLhCuFQeGw2eyKg5FgkaE5QpQTrkfMJ BV/p1z3vLPz+pWuCuHJ66bfvHMp4C4Fimi/QFoEkPOM61a+LyJGtHJCHg+oIAStQnxP0 KI+MvItA7lF7l/1MizRA+jZuUmr73ZceaJePFx1rqSweHimo7Mo/0ZYGkfWBoQ+JULZS jRg5mSuegNVV8Eiwtt78FHC673bKx/8gqvkuB0+xYP+gA0bcx+RBjaJIPns3Qpo2BmWP ZYxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=cOkOdsnhkmu9fl8PYXdiXrAD1ILM0CG7LQC0wWds1fI=; b=tqm8ltfvmS4pF4JWRlcUxzm7s/3uXEj/SpNPsZtqhqbmghCaIR1dglgW9gWz6KCqZb jTqtMJ9aXz/8Y7K5308DglY/iKCFB7UxJzgExzl4E13rjIApCET+MZws+GdlwWJ2cMH8 yeg2UPq8W7lxK4uQbXiKvaKUoxj9oTEoNk1hBp7P7ksYoKLGILZH9EtqMnuOjBoROVyE S0h7kL40GpoPEH1pT+/L5f5MYxiWzdLq2KuRTf+DqcXdyLUIMpdIcu3nI2sZnCQTdfIi UFXye3rim/o4v4oaU5JaWIueGA0TUq6fjwtcxZ8OA49JnmIWGAWrgdQ6qY2PDscHwtPq bZCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LfsGLEkY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v129-v6si14931160pfv.278.2018.07.25.10.20.05; Wed, 25 Jul 2018 10:20:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LfsGLEkY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729195AbeGYSbs (ORCPT + 99 others); Wed, 25 Jul 2018 14:31:48 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33747 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728573AbeGYSbs (ORCPT ); Wed, 25 Jul 2018 14:31:48 -0400 Received: by mail-pg1-f193.google.com with SMTP id r5-v6so5748685pgv.0 for ; Wed, 25 Jul 2018 10:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=cOkOdsnhkmu9fl8PYXdiXrAD1ILM0CG7LQC0wWds1fI=; b=LfsGLEkYumlRpUBJHo8XyDgLdPEHZELu1CnCxv7m5oxI1JBmq+7rRyXYNBLxMXl+kn qv2S0ZmGVKFKxxMePILtqPs1s3ao0sD6ycsryVRSsSJo86aPUguJiZq4j4CHbOc2CT7f KC4k8Th7hEROIA+AMfgzjinOrjRrA+eRxFV6c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cOkOdsnhkmu9fl8PYXdiXrAD1ILM0CG7LQC0wWds1fI=; b=W1kdWId9hlVGMCp+QQCgBvBSi4wkdOeF/Z8L71PiOkZPnycxd7JR8Y6QN8pmFnxFXb PllYaknMKvTV6A5+csGhnQu12265+ZZ4HE/wfGt1e8mRUW8jit3ON2B9P2xAA8F1fQ0Y loFfi0rzR7YWYmxU/YEiiEWsDZ/M/Xa/PMUdrZBDLxINQgIHnE8EExLJUgUloSUNkAOS TPOJkPLHAza92uSOV4tdq06iSB4iAIpgAbBrCCePVPEPtT9cOF/uB/WySp7VHmKSDe+j eC0cDoM4chfiM35lkOPTb6TpE/j193IHXuvVkwryEBOfK21iBeAoUWmb4MoNWsHl8yq7 hzeg== X-Gm-Message-State: AOUpUlHAz49rbJDNwYIngttlIl5EyHALbCPZxvu6oEYJxbzRt39y7GCo 0EYyguE1wZZuWLadZfU0u6rNmw== X-Received: by 2002:a62:1a4a:: with SMTP id a71-v6mr23109828pfa.190.1532539151743; Wed, 25 Jul 2018 10:19:11 -0700 (PDT) Received: from zsm-linux.mtv.corp.google.com ([2620:0:1000:1511:965:9e30:3027:44b2]) by smtp.googlemail.com with ESMTPSA id f18-v6sm32681529pff.29.2018.07.25.10.19.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 10:19:10 -0700 (PDT) From: Zubin Mithra To: rostedt@goodmis.org, linux-kernel@vger.kernel.org Cc: keescook@chromium.org, groeck@chromium.org, zsm@chromium.org Subject: [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init Date: Wed, 25 Jul 2018 10:19:01 -0700 Message-Id: <20180725171901.4468-1-zsm@chromium.org> X-Mailer: git-send-email 2.18.0.233.g985f88cf7e-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tracefs_ops is initialized inside tracefs_create_instance_dir and not modified after. tracefs_create_instance_dir allows for initialization only once, and is called from create_trace_instances(marked __init), which is called from tracer_init_tracefs(marked __init). Also, mark tracefs_create_instance_dir as __init. Signed-off-by: Zubin Mithra --- fs/tracefs/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index bea8ad876bf9..7098c49f3693 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -53,7 +53,7 @@ static const struct file_operations tracefs_file_operations = { static struct tracefs_dir_ops { int (*mkdir)(const char *name); int (*rmdir)(const char *name); -} tracefs_ops; +} tracefs_ops __ro_after_init; static char *get_dname(struct dentry *dentry) { @@ -478,7 +478,8 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent) * * Returns the dentry of the instances directory. */ -struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent, +__init struct dentry *tracefs_create_instance_dir(const char *name, + struct dentry *parent, int (*mkdir)(const char *name), int (*rmdir)(const char *name)) { -- 2.18.0.233.g985f88cf7e-goog