The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Subject: [PATCH 5/6] tty_audit: make tty pointers in exposed functions const
Date: Wed, 21 Jun 2023 12:16:10 +0200	[thread overview]
Message-ID: <20230621101611.10580-6-jirislaby@kernel.org> (raw)
In-Reply-To: <20230621101611.10580-1-jirislaby@kernel.org>

Both tty_audit_add_data() and tty_audit_tiocsti() need only to read from
the tty struct, so make the tty parameters of them both const. This
aids the compiler a bit.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
 drivers/tty/tty.h       | 11 ++++++-----
 drivers/tty/tty_audit.c |  5 +++--
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h
index 1e0d80e98d26..89769a1f1f97 100644
--- a/drivers/tty/tty.h
+++ b/drivers/tty/tty.h
@@ -99,14 +99,15 @@ extern int tty_ldisc_autoload;
 
 /* tty_audit.c */
 #ifdef CONFIG_AUDIT
-void tty_audit_add_data(struct tty_struct *tty, const void *data, size_t size);
-void tty_audit_tiocsti(struct tty_struct *tty, char ch);
+void tty_audit_add_data(const struct tty_struct *tty, const void *data,
+			size_t size);
+void tty_audit_tiocsti(const struct tty_struct *tty, char ch);
 #else
-static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
-				      size_t size)
+static inline void tty_audit_add_data(const struct tty_struct *tty,
+				      const void *data, size_t size)
 {
 }
-static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
+static inline void tty_audit_tiocsti(const struct tty_struct *tty, char ch)
 {
 }
 #endif
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 6cf8b63368ee..5cbe28ac1763 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -134,7 +134,7 @@ void tty_audit_fork(struct signal_struct *sig)
 /*
  *	tty_audit_tiocsti	-	Log TIOCSTI
  */
-void tty_audit_tiocsti(struct tty_struct *tty, char ch)
+void tty_audit_tiocsti(const struct tty_struct *tty, char ch)
 {
 	dev_t dev;
 
@@ -199,7 +199,8 @@ static struct tty_audit_buf *tty_audit_buf_get(void)
  *
  *	Audit @data of @size from @tty, if necessary.
  */
-void tty_audit_add_data(struct tty_struct *tty, const void *data, size_t size)
+void tty_audit_add_data(const struct tty_struct *tty, const void *data,
+			size_t size)
 {
 	struct tty_audit_buf *buf;
 	unsigned int audit_tty;
-- 
2.41.0


  parent reply	other threads:[~2023-06-21 10:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 10:16 [PATCH 0/6] tty_audit: random cleanups Jiri Slaby (SUSE)
2023-06-21 10:16 ` [PATCH 1/6] tty_audit: use TASK_COMM_LEN for task comm Jiri Slaby (SUSE)
2023-06-21 10:16 ` [PATCH 2/6] tty_audit: use kzalloc() in tty_audit_buf_alloc() Jiri Slaby (SUSE)
2023-06-21 10:16 ` [PATCH 3/6] tty_audit: invert the condition in tty_audit_log() Jiri Slaby (SUSE)
2023-06-21 10:16 ` [PATCH 4/6] tty_audit: make icanon a bool Jiri Slaby (SUSE)
2023-06-21 10:16 ` Jiri Slaby (SUSE) [this message]
2023-06-21 10:16 ` [PATCH 6/6] tty_audit: make data of tty_audit_log() const Jiri Slaby (SUSE)

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=20230621101611.10580-6-jirislaby@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.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