From: Stephen Rothwell <sfr@canb.auug.org.au>
To: "Hans J. Koch" <hjk@linutronix.de>, Greg Kroah-Hartman <gregkh@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Wolfram Sang <w.sang@pengutronix.de>
Subject: [PATCH] uio: make uio_info's name and version const
Date: Fri, 12 Dec 2008 16:30:41 +1100 [thread overview]
Message-ID: <20081212163041.7bc16261.sfr@canb.auug.org.au> (raw)
These are only ever assigned constant strings and never modified.
This was noticed because Wolfram Sang needed to cast the result of
of_get_property() in order to assign it to the name field of a struct
uio_info.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
Documentation/DocBook/uio-howto.tmpl | 4 ++--
include/linux/uio_driver.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
Tested by compiling all the uio drivers available on x86. The others
(all in arch sh) only ever assign constant string literals to these
fields.
[Resent with properly quoted recipient addresses]
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index df87d1b..21ba47e 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -339,12 +339,12 @@ offset = N * getpagesize();
<itemizedlist>
<listitem><para>
-<varname>char *name</varname>: Required. The name of your driver as
+<varname>const char *name</varname>: Required. The name of your driver as
it will appear in sysfs. I recommend using the name of your module for this.
</para></listitem>
<listitem><para>
-<varname>char *version</varname>: Required. This string appears in
+<varname>const char *version</varname>: Required. This string appears in
<filename>/sys/class/uio/uioX/version</filename>.
</para></listitem>
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index cdf338d..b5f23b1 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -57,8 +57,8 @@ struct uio_device;
*/
struct uio_info {
struct uio_device *uio_dev;
- char *name;
- char *version;
+ const char *name;
+ const char *version;
struct uio_mem mem[MAX_UIO_MAPS];
long irq;
unsigned long irq_flags;
--
1.6.0.5
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
next reply other threads:[~2008-12-12 5:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-12 5:30 Stephen Rothwell [this message]
2008-12-12 10:44 ` Hans J. Koch
2008-12-12 22:51 ` Stephen Rothwell
2008-12-19 0:29 ` patch uio-make-uio_info-s-name-and-version-const.patch added to gregkh-2.6 tree gregkh
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=20081212163041.7bc16261.sfr@canb.auug.org.au \
--to=sfr@canb.auug.org.au \
--cc=gregkh@suse.de \
--cc=hjk@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=w.sang@pengutronix.de \
/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
all inboxes | Powered by JetHome®