mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] atmel-mci: fixes for 2.6.27
@ 2008-09-19 19:09 Haavard Skinnemoen
  2008-09-19 19:09 ` [PATCH 1/4] atmel-mci: debugfs: enable clock before dumping regs Haavard Skinnemoen
  2008-09-20 10:13 ` [PATCH 0/4] atmel-mci: fixes for 2.6.27 Pierre Ossman
  0 siblings, 2 replies; 6+ messages in thread
From: Haavard Skinnemoen @ 2008-09-19 19:09 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel, kernel, Haavard Skinnemoen

Hi Pierre,

Here is a small handful of fixes for problems I've found while testing
the new atmel-mci driver. I hope they can be applied before 2.6.27
goes out the door.

I guess it's too late to add DMA support at this point, so I'll post
that separately along with a few other improvements.

Haavard Skinnemoen (4):
      atmel-mci: debugfs: enable clock before dumping regs
      atmel-mci: Fix memory leak in atmci_regs_show
      atmel-mci: Fix bogus debugfs file size
      atmel-mci: Set MMC_CAP_NEEDS_POLL if no detect_pin

 drivers/mmc/host/atmel-mci.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Haavard

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

* [PATCH 1/4] atmel-mci: debugfs: enable clock before dumping regs
  2008-09-19 19:09 [PATCH 0/4] atmel-mci: fixes for 2.6.27 Haavard Skinnemoen
@ 2008-09-19 19:09 ` Haavard Skinnemoen
  2008-09-19 19:09   ` [PATCH 2/4] atmel-mci: Fix memory leak in atmci_regs_show Haavard Skinnemoen
  2008-09-20 10:13 ` [PATCH 0/4] atmel-mci: fixes for 2.6.27 Pierre Ossman
  1 sibling, 1 reply; 6+ messages in thread
From: Haavard Skinnemoen @ 2008-09-19 19:09 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel, kernel, Haavard Skinnemoen

Make sure that the peripheral clock is enabled before reading the MMIO
registers for the debugfs "regs" dump.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
---
 drivers/mmc/host/atmel-mci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 0bd06f5..6de773d 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -195,7 +195,9 @@ static int atmci_regs_show(struct seq_file *s, void *v)
 
 	/* Grab a more or less consistent snapshot */
 	spin_lock_irq(&host->mmc->lock);
+	clk_enable(host->mck);
 	memcpy_fromio(buf, host->regs, MCI_REGS_SIZE);
+	clk_disable(host->mck);
 	spin_unlock_irq(&host->mmc->lock);
 
 	seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n",
-- 
1.5.6.5


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

* [PATCH 2/4] atmel-mci: Fix memory leak in atmci_regs_show
  2008-09-19 19:09 ` [PATCH 1/4] atmel-mci: debugfs: enable clock before dumping regs Haavard Skinnemoen
@ 2008-09-19 19:09   ` Haavard Skinnemoen
  2008-09-19 19:09     ` [PATCH 3/4] atmel-mci: Fix bogus debugfs file size Haavard Skinnemoen
  0 siblings, 1 reply; 6+ messages in thread
From: Haavard Skinnemoen @ 2008-09-19 19:09 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel, kernel, Haavard Skinnemoen

The debugfs hook atmci_regs_show allocates a temporary buffer for
storing a register snapshot, but it doesn't free it before returning.
Plug this leak.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
---
 drivers/mmc/host/atmel-mci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 6de773d..becca91 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -218,6 +218,8 @@ static int atmci_regs_show(struct seq_file *s, void *v)
 	atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]);
 	atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]);
 
+	kfree(buf);
+
 	return 0;
 }
 
-- 
1.5.6.5


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

* [PATCH 3/4] atmel-mci: Fix bogus debugfs file size
  2008-09-19 19:09   ` [PATCH 2/4] atmel-mci: Fix memory leak in atmci_regs_show Haavard Skinnemoen
@ 2008-09-19 19:09     ` Haavard Skinnemoen
  2008-09-19 19:09       ` [PATCH 4/4] atmel-mci: Set MMC_CAP_NEEDS_POLL if no detect_pin Haavard Skinnemoen
  0 siblings, 1 reply; 6+ messages in thread
From: Haavard Skinnemoen @ 2008-09-19 19:09 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel, kernel, Haavard Skinnemoen

We used to store a binary register snapshot in the "regs" file, so we
set the file size to be the size of this snapshot. This is no longer
valid since we switched to using seq_file.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
---
 drivers/mmc/host/atmel-mci.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index becca91..3909608 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -241,7 +241,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
 	struct mmc_host	*mmc;
 	struct dentry	*root;
 	struct dentry	*node;
-	struct resource	*res;
 
 	mmc = host->mmc;
 	root = mmc->debugfs_root;
@@ -255,9 +254,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
 	if (!node)
 		goto err;
 
-	res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-	node->d_inode->i_size = res->end - res->start + 1;
-
 	node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops);
 	if (!node)
 		goto err;
-- 
1.5.6.5


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

* [PATCH 4/4] atmel-mci: Set MMC_CAP_NEEDS_POLL if no detect_pin
  2008-09-19 19:09     ` [PATCH 3/4] atmel-mci: Fix bogus debugfs file size Haavard Skinnemoen
@ 2008-09-19 19:09       ` Haavard Skinnemoen
  0 siblings, 0 replies; 6+ messages in thread
From: Haavard Skinnemoen @ 2008-09-19 19:09 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel, kernel, Haavard Skinnemoen

This allows the mmc core to detect card insertion/removal for slots that
don't have any CD pin wired up.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
---
 drivers/mmc/host/atmel-mci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 3909608..917035e 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1059,6 +1059,10 @@ static int __init atmci_probe(struct platform_device *pdev)
 			host->present = !gpio_get_value(host->detect_pin);
 		}
 	}
+
+	if (!gpio_is_valid(host->detect_pin))
+		mmc->caps |= MMC_CAP_NEEDS_POLL;
+
 	if (gpio_is_valid(host->wp_pin)) {
 		if (gpio_request(host->wp_pin, "mmc_wp")) {
 			dev_dbg(&mmc->class_dev, "no WP pin available\n");
-- 
1.5.6.5


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

* Re: [PATCH 0/4] atmel-mci: fixes for 2.6.27
  2008-09-19 19:09 [PATCH 0/4] atmel-mci: fixes for 2.6.27 Haavard Skinnemoen
  2008-09-19 19:09 ` [PATCH 1/4] atmel-mci: debugfs: enable clock before dumping regs Haavard Skinnemoen
@ 2008-09-20 10:13 ` Pierre Ossman
  1 sibling, 0 replies; 6+ messages in thread
From: Pierre Ossman @ 2008-09-20 10:13 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: linux-kernel, kernel, Haavard Skinnemoen

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

On Fri, 19 Sep 2008 21:09:26 +0200
Haavard Skinnemoen <haavard.skinnemoen@atmel.com> wrote:

> Hi Pierre,
> 
> Here is a small handful of fixes for problems I've found while testing
> the new atmel-mci driver. I hope they can be applied before 2.6.27
> goes out the door.
> 

Queued up and on its way to Linus.

> I guess it's too late to add DMA support at this point, so I'll post
> that separately along with a few other improvements.

Yeah, no features at this point. I do appreciate getting patches some
time before the merge window (preferably right after it closes).

-- 
     -- Pierre Ossman

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

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2008-09-20 10:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-19 19:09 [PATCH 0/4] atmel-mci: fixes for 2.6.27 Haavard Skinnemoen
2008-09-19 19:09 ` [PATCH 1/4] atmel-mci: debugfs: enable clock before dumping regs Haavard Skinnemoen
2008-09-19 19:09   ` [PATCH 2/4] atmel-mci: Fix memory leak in atmci_regs_show Haavard Skinnemoen
2008-09-19 19:09     ` [PATCH 3/4] atmel-mci: Fix bogus debugfs file size Haavard Skinnemoen
2008-09-19 19:09       ` [PATCH 4/4] atmel-mci: Set MMC_CAP_NEEDS_POLL if no detect_pin Haavard Skinnemoen
2008-09-20 10:13 ` [PATCH 0/4] atmel-mci: fixes for 2.6.27 Pierre Ossman

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®