netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
To: Armin Schindler <mac@melware.de>, Karsten Keil <isdn@linux-pingi.de>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Subject: [PATCH 4/4] isdn/eicon: use const strings with format arguments
Date: Sat, 29 Oct 2016 14:56:05 +0200	[thread overview]
Message-ID: <20161029125605.13610-4-nicolas.iooss_linux@m4x.org> (raw)
In-Reply-To: <20161029125605.13610-1-nicolas.iooss_linux@m4x.org>

Functions using a printf format argument do not modify the value of this
argument. These functions can therefore use type "const char *" instead
of "char *".

This patch has only been compile-tested.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 drivers/isdn/hardware/eicon/debug.c    | 14 +++++++-------
 drivers/isdn/hardware/eicon/debuglib.h |  6 +++---
 drivers/isdn/hardware/eicon/maintidi.c |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/debug.c b/drivers/isdn/hardware/eicon/debug.c
index cd8d70e3292d..b8772bbee872 100644
--- a/drivers/isdn/hardware/eicon/debug.c
+++ b/drivers/isdn/hardware/eicon/debug.c
@@ -14,9 +14,9 @@
 
 static void DI_register(void *arg);
 static void DI_deregister(pDbgHandle hDbg);
-static void DI_format(int do_lock, word id, int type, char *format, va_list argument_list);
-static void DI_format_locked(word id, int type, char *format, va_list argument_list);
-static void DI_format_old(word id, char *format, va_list ap) { }
+static void DI_format(int do_lock, word id, int type, const char *format, va_list argument_list);
+static void DI_format_locked(word id, int type, const char *format, va_list argument_list);
+static void DI_format_old(word id, const char *format, va_list ap) { }
 static void DiProcessEventLog(unsigned short id, unsigned long msgID, va_list ap) { }
 static void single_p(byte *P, word *PLength, byte Id);
 static void diva_maint_xdi_cb(ENTITY *e);
@@ -25,7 +25,7 @@ static int diva_mnt_cmp_nmbr(const char *nmbr);
 static void diva_free_dma_descriptor(IDI_CALL request, int nr);
 static int diva_get_dma_descriptor(IDI_CALL request, dword *dma_magic);
 __printf(3, 4)
-void diva_mnt_internal_dprintf(dword drv_id, dword type, char *p, ...);
+void diva_mnt_internal_dprintf(dword drv_id, dword type, const char *p, ...);
 
 static dword MaxDumpSize = 256;
 static dword MaxXlogSize = 2 + 128;
@@ -561,7 +561,7 @@ static void DI_deregister(pDbgHandle hDbg) {
 
 static void DI_format_locked(unsigned short id,
 			     int type,
-			     char *format,
+			     const char *format,
 			     va_list argument_list) {
 	DI_format(1, id, type, format, argument_list);
 }
@@ -569,7 +569,7 @@ static void DI_format_locked(unsigned short id,
 static void DI_format(int do_lock,
 		      unsigned short id,
 		      int type,
-		      char *format,
+		      const char *format,
 		      va_list ap) {
 	diva_os_spin_lock_magic_t old_irql;
 	dword sec, usec;
@@ -1904,7 +1904,7 @@ static void diva_change_management_debug_mask(diva_maint_client_t *pC, dword old
 }
 
 
-void diva_mnt_internal_dprintf(dword drv_id, dword type, char *fmt, ...) {
+void diva_mnt_internal_dprintf(dword drv_id, dword type, const char *fmt, ...) {
 	va_list ap;
 
 	va_start(ap, fmt);
diff --git a/drivers/isdn/hardware/eicon/debuglib.h b/drivers/isdn/hardware/eicon/debuglib.h
index 6dcbf6afb8f9..2170de140335 100644
--- a/drivers/isdn/hardware/eicon/debuglib.h
+++ b/drivers/isdn/hardware/eicon/debuglib.h
@@ -230,10 +230,10 @@ extern void DbgSetLevel(unsigned long dbgMask);
  */
 typedef struct _DbgHandle_ *pDbgHandle;
 typedef void (*DbgEnd)(pDbgHandle);
-typedef void (*DbgLog)(unsigned short, int, char *, va_list);
-typedef void (*DbgOld)(unsigned short, char *, va_list);
+typedef void (*DbgLog)(unsigned short, int, const char *, va_list);
+typedef void (*DbgOld)(unsigned short, const char *, va_list);
 typedef void (*DbgEv)(unsigned short, unsigned long, va_list);
-typedef void (*DbgIrq)(unsigned short, int, char *, va_list);
+typedef void (*DbgIrq)(unsigned short, int, const char *, va_list);
 typedef struct _DbgHandle_
 { char    Registered; /* driver successfully registered */
 #define DBG_HANDLE_REG_NEW 0x01  /* this (new) structure    */
diff --git a/drivers/isdn/hardware/eicon/maintidi.c b/drivers/isdn/hardware/eicon/maintidi.c
index b2ed2939b4fa..a635595e9be3 100644
--- a/drivers/isdn/hardware/eicon/maintidi.c
+++ b/drivers/isdn/hardware/eicon/maintidi.c
@@ -31,7 +31,7 @@
 
 
 extern __printf(3, 4)
-void diva_mnt_internal_dprintf(dword drv_id, dword type, char *p, ...);
+void diva_mnt_internal_dprintf(dword drv_id, dword type, const char *p, ...);
 
 #define MODEM_PARSE_ENTRIES  16 /* amount of variables of interest */
 #define FAX_PARSE_ENTRIES    12 /* amount of variables of interest */
-- 
2.10.1

      parent reply	other threads:[~2016-10-29 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-29 12:56 [PATCH 1/4] isdn/eicon: remove unused argument in DBG_ERR call Nicolas Iooss
2016-10-29 12:56 ` [PATCH 2/4] isdn/eicon: fix some message formatting errors Nicolas Iooss
2016-10-31 13:42   ` David Laight
2016-10-29 12:56 ` [PATCH 3/4] isdn/eicon: add some __printf attributes Nicolas Iooss
2016-10-29 12:56 ` Nicolas Iooss [this message]

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=20161029125605.13610-4-nicolas.iooss_linux@m4x.org \
    --to=nicolas.iooss_linux@m4x.org \
    --cc=isdn@linux-pingi.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mac@melware.de \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).