public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/mmc/core/: make 4 functions static
@ 2007-07-12 23:56 Adrian Bunk
  2007-07-15 16:52 ` Pierre Ossman
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2007-07-12 23:56 UTC (permalink / raw)
  To: drzeus-mmc; +Cc: linux-kernel

This patch makes the following needlessly global functions static:
- sd_ops.c: mmc_app_cmd()
- sd_ops.c: mmc_wait_for_app_cmd()
- core.c: __mmc_release_bus()
- core.c: mmc_start_request()

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/mmc/core/core.c   |   49 +++++++++++++++++++----------
 drivers/mmc/core/core.h   |   22 -------------
 drivers/mmc/core/sd_ops.c |   64 ++++++++++++++++++--------------------
 drivers/mmc/core/sd_ops.h |    1 
 include/linux/mmc/core.h  |    2 -
 5 files changed, 64 insertions(+), 74 deletions(-)

--- linux-2.6.22-rc6-mm1/include/linux/mmc/core.h.old	2007-07-11 22:06:20.000000000 +0200
+++ linux-2.6.22-rc6-mm1/include/linux/mmc/core.h	2007-07-11 22:06:32.000000000 +0200
@@ -101,8 +101,6 @@
 
 extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
-extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
-	struct mmc_command *, int);
 
 extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *, int);
 
--- linux-2.6.22-rc6-mm1/drivers/mmc/core/sd_ops.h.old	2007-07-11 22:09:30.000000000 +0200
+++ linux-2.6.22-rc6-mm1/drivers/mmc/core/sd_ops.h	2007-07-11 22:09:37.000000000 +0200
@@ -12,7 +12,6 @@
 #ifndef _MMC_SD_OPS_H
 #define _MMC_SD_OPS_H
 
-int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);
 int mmc_app_set_bus_width(struct mmc_card *card, int width);
 int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
 int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
--- linux-2.6.22-rc6-mm1/drivers/mmc/core/sd_ops.c.old	2007-07-11 22:06:50.000000000 +0200
+++ linux-2.6.22-rc6-mm1/drivers/mmc/core/sd_ops.c	2007-07-11 22:09:15.000000000 +0200
@@ -21,6 +21,35 @@
 #include "core.h"
 #include "sd_ops.h"
 
+static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
+{
+	int err;
+	struct mmc_command cmd;
+
+	BUG_ON(!host);
+	BUG_ON(card && (card->host != host));
+
+	cmd.opcode = MMC_APP_CMD;
+
+	if (card) {
+		cmd.arg = card->rca << 16;
+		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+	} else {
+		cmd.arg = 0;
+		cmd.flags = MMC_RSP_R1 | MMC_CMD_BCR;
+	}
+
+	err = mmc_wait_for_cmd(host, &cmd, 0);
+	if (err != MMC_ERR_NONE)
+		return err;
+
+	/* Check that card supported application commands */
+	if (!(cmd.resp[0] & R1_APP_CMD))
+		return MMC_ERR_FAILED;
+
+	return MMC_ERR_NONE;
+}
+
 /**
  *	mmc_wait_for_app_cmd - start an application command and wait for
  			       completion
@@ -34,8 +63,8 @@
  *	that occurred while the command was executing.  Do not attempt to
  *	parse the response.
  */
-int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
-	struct mmc_command *cmd, int retries)
+static int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
+				struct mmc_command *cmd, int retries)
 {
 	struct mmc_request mrq;
 
@@ -75,37 +104,6 @@
 	return err;
 }
 
-EXPORT_SYMBOL(mmc_wait_for_app_cmd);
-
-int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
-{
-	int err;
-	struct mmc_command cmd;
-
-	BUG_ON(!host);
-	BUG_ON(card && (card->host != host));
-
-	cmd.opcode = MMC_APP_CMD;
-
-	if (card) {
-		cmd.arg = card->rca << 16;
-		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
-	} else {
-		cmd.arg = 0;
-		cmd.flags = MMC_RSP_R1 | MMC_CMD_BCR;
-	}
-
-	err = mmc_wait_for_cmd(host, &cmd, 0);
-	if (err != MMC_ERR_NONE)
-		return err;
-
-	/* Check that card supported application commands */
-	if (!(cmd.resp[0] & R1_APP_CMD))
-		return MMC_ERR_FAILED;
-
-	return MMC_ERR_NONE;
-}
-
 int mmc_app_set_bus_width(struct mmc_card *card, int width)
 {
 	int err;
--- linux-2.6.22-rc6-mm1/drivers/mmc/core/core.h.old	2007-07-11 22:11:30.000000000 +0200
+++ linux-2.6.22-rc6-mm1/drivers/mmc/core/core.h	2007-07-11 22:12:48.000000000 +0200
@@ -25,28 +25,6 @@
 void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
 void mmc_detach_bus(struct mmc_host *host);
 
-void __mmc_release_bus(struct mmc_host *host);
-
-static inline void mmc_bus_get(struct mmc_host *host)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&host->lock, flags);
-	host->bus_refs++;
-	spin_unlock_irqrestore(&host->lock, flags);
-}
-
-static inline void mmc_bus_put(struct mmc_host *host)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&host->lock, flags);
-	host->bus_refs--;
-	if ((host->bus_refs == 0) && host->bus_ops)
-		__mmc_release_bus(host);
-	spin_unlock_irqrestore(&host->lock, flags);
-}
-
 void mmc_set_chip_select(struct mmc_host *host, int mode);
 void mmc_set_clock(struct mmc_host *host, unsigned int hz);
 void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
--- linux-2.6.22-rc6-mm1/drivers/mmc/core/core.c.old	2007-07-11 22:07:17.000000000 +0200
+++ linux-2.6.22-rc6-mm1/drivers/mmc/core/core.c	2007-07-11 22:14:44.000000000 +0200
@@ -40,6 +40,38 @@
 static struct workqueue_struct *workqueue;
 
 /*
+ * Cleanup when the last reference to the bus operator is dropped.
+ */
+static void __mmc_release_bus(struct mmc_host *host)
+{
+	BUG_ON(!host);
+	BUG_ON(host->bus_refs);
+	BUG_ON(!host->bus_dead);
+
+	host->bus_ops = NULL;
+}
+
+static void mmc_bus_get(struct mmc_host *host)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&host->lock, flags);
+	host->bus_refs++;
+	spin_unlock_irqrestore(&host->lock, flags);
+}
+
+static void mmc_bus_put(struct mmc_host *host)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&host->lock, flags);
+	host->bus_refs--;
+	if ((host->bus_refs == 0) && host->bus_ops)
+		__mmc_release_bus(host);
+	spin_unlock_irqrestore(&host->lock, flags);
+}
+
+/*
  * Internal function. Schedule delayed work in the MMC work queue.
  */
 static int mmc_schedule_delayed_work(struct delayed_work *work,
@@ -94,8 +126,7 @@
  *	Queue a command on the specified host.  We expect the
  *	caller to be holding the host lock with interrupts disabled.
  */
-void
-mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
+static void mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 {
 #ifdef CONFIG_MMC_DEBUG
 	unsigned int i, sz;
@@ -134,8 +165,6 @@
 	host->ops->request(host, mrq);
 }
 
-EXPORT_SYMBOL(mmc_start_request);
-
 static void mmc_wait_done(struct mmc_request *mrq)
 {
 	complete(mrq->done_data);
@@ -482,18 +511,6 @@
 	mmc_bus_put(host);
 }
 
-/*
- * Cleanup when the last reference to the bus operator is dropped.
- */
-void __mmc_release_bus(struct mmc_host *host)
-{
-	BUG_ON(!host);
-	BUG_ON(host->bus_refs);
-	BUG_ON(!host->bus_dead);
-
-	host->bus_ops = NULL;
-}
-
 /**
  *	mmc_detect_change - process change of state on a MMC socket
  *	@host: host which changed state.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [2.6 patch] drivers/mmc/core/: make 4 functions static
  2007-07-12 23:56 [2.6 patch] drivers/mmc/core/: make 4 functions static Adrian Bunk
@ 2007-07-15 16:52 ` Pierre Ossman
  2007-07-16  2:33   ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Ossman @ 2007-07-15 16:52 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

On Fri, 13 Jul 2007 01:56:02 +0200
Adrian Bunk <bunk@stusta.de> wrote:

> This patch makes the following needlessly global functions static:
> - sd_ops.c: mmc_wait_for_app_cmd()
> - core.c: mmc_start_request()

I am a bit torn about these two. Even though we don't cater to
out-of-tree stuff, having these as exported symbols shows that they are
part of the API. Removing them might risk people going about doing
something silly because they don't know the functionality exists, and
we might not spot it at patch review time.

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [2.6 patch] drivers/mmc/core/: make 4 functions static
  2007-07-15 16:52 ` Pierre Ossman
@ 2007-07-16  2:33   ` Adrian Bunk
  2007-07-20 15:50     ` Pierre Ossman
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2007-07-16  2:33 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel

On Sun, Jul 15, 2007 at 06:52:34PM +0200, Pierre Ossman wrote:
> On Fri, 13 Jul 2007 01:56:02 +0200
> Adrian Bunk <bunk@stusta.de> wrote:
> 
> > This patch makes the following needlessly global functions static:
> > - sd_ops.c: mmc_wait_for_app_cmd()
> > - core.c: mmc_start_request()
> 
> I am a bit torn about these two. Even though we don't cater to
> out-of-tree stuff, having these as exported symbols shows that they are
> part of the API. Removing them might risk people going about doing
> something silly because they don't know the functionality exists, and
> we might not spot it at patch review time.

If mmc_start_request() is considered part of an API people should use, 
why isn't there a prototype in a header file?

> Rgds

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [2.6 patch] drivers/mmc/core/: make 4 functions static
  2007-07-16  2:33   ` Adrian Bunk
@ 2007-07-20 15:50     ` Pierre Ossman
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Ossman @ 2007-07-20 15:50 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

On Mon, 16 Jul 2007 04:33:46 +0200
Adrian Bunk <bunk@stusta.de> wrote:

> 
> If mmc_start_request() is considered part of an API people should
> use, why isn't there a prototype in a header file?
> 

Just goes to show how much I know. ;)

So I guess we can privatize that one. But I'd still like to keep
mmc_wait_for_app_cmd().

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-20 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12 23:56 [2.6 patch] drivers/mmc/core/: make 4 functions static Adrian Bunk
2007-07-15 16:52 ` Pierre Ossman
2007-07-16  2:33   ` Adrian Bunk
2007-07-20 15:50     ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox