All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rainer Weikusat <rainer.weikusat@sncag.com>
To: linux-mtd@lists.infradead.org
Subject: add 'static' where sensible to physmap.c [PATCH]
Date: Thu, 08 Jul 2004 11:16:14 +0800	[thread overview]
Message-ID: <87acybchoh.fsf@farside.sncag.com> (raw)

This is a small patch that changes everything in physmap.c
that does not need external linkage to static linkage (ie
everything):

----------------
Index: physmap.c
===================================================================
RCS file: /home/cvs/repo/linux-rsg/drivers/mtd/maps/physmap.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- physmap.c	8 Jul 2004 03:00:41 -0000	1.6
+++ physmap.c	8 Jul 2004 03:01:23 -0000	1.7
@@ -22,50 +22,50 @@
 
 static struct mtd_info *mymtd;
 
-__u8 physmap_read8(struct map_info *map, unsigned long ofs)
+static __u8 physmap_read8(struct map_info *map, unsigned long ofs)
 {
 	return __raw_readb(map->map_priv_1 + ofs);
 }
 
-__u16 physmap_read16(struct map_info *map, unsigned long ofs)
+static __u16 physmap_read16(struct map_info *map, unsigned long ofs)
 {
 	return __raw_readw(map->map_priv_1 + ofs);
 }
 
-__u32 physmap_read32(struct map_info *map, unsigned long ofs)
+static __u32 physmap_read32(struct map_info *map, unsigned long ofs)
 {
 	return __raw_readl(map->map_priv_1 + ofs);
 }
 
-void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
+static void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
 {
 	memcpy_fromio(to, map->map_priv_1 + from, len);
 }
 
-void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
+static void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
 {
 	__raw_writeb(d, map->map_priv_1 + adr);
 	mb();
 }
 
-void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
+static void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
 {
 	__raw_writew(d, map->map_priv_1 + adr);
 	mb();
 }
 
-void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
+static void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
 {
 	__raw_writel(d, map->map_priv_1 + adr);
 	mb();
 }
 
-void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
+static void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
 {
 	memcpy_toio(map->map_priv_1 + to, from, len);
 }
 
-struct map_info physmap_map = {
+static struct map_info physmap_map = {
 	name: "Physically mapped flash",
 	size: WINDOW_SIZE,
 	buswidth: BUSWIDTH,
@@ -115,7 +115,7 @@
 #endif
 #endif
 
-int __init init_physmap(void)
+static int __init init_physmap(void)
 {
 	static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 };
 	const char **type;
-------------

The device I am working on here happens to be equipped w/ AMD flash
chips of different types in a not necessarily continous memory
mapping (29LV160D, 29LV320D and 29DL640D). Instead of adding yet
another board-specific driver sitting atop a generic interface, I
would rather change the physmap-driver to deal w/ multiple different
flash chips (I tried to use a naive configuration, but the results
were less than encouraging). Which leads to a question: Would it be
better to create a "multi physmap"-driver, starting with a copy of the
existing one, or to modify physmap.c to handle both
cases. Personallly, I would prefer the latter, to avoid code
duplication where possible. But the file would certainly not get
prettier by adding a lot of #ifdefs to it. Any suggestions on this?

                 reply	other threads:[~2004-07-08  3:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87acybchoh.fsf@farside.sncag.com \
    --to=rainer.weikusat@sncag.com \
    --cc=linux-mtd@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.