mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/7] mci: Allow to specify device name
Date: Thu, 13 Dec 2012 22:49:05 +0100	[thread overview]
Message-ID: <1355435350-20348-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1355435350-20348-1-git-send-email-s.hauer@pengutronix.de>

When multiple MMC/SD cards are present in the system we often
have to have persistent names to identify them during runtime.
This patch allows to overwrite the devicename which is used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/mci-core.c |   10 +++++++---
 include/mci.h          |    1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index e29bd2e..559f8ab 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1397,9 +1397,13 @@ static int mci_card_probe(struct mci *mci)
 	mci->blk.dev = mci->mci_dev;
 	mci->blk.ops = &mci_ops;
 
-	disknum = cdev_find_free_index("disk");
+	if (host->devname) {
+		mci->blk.cdev.name = strdup(host->devname);
+	} else {
+		disknum = cdev_find_free_index("disk");
+		mci->blk.cdev.name = asprintf("disk%d", disknum);
+	}
 
-	mci->blk.cdev.name = asprintf("disk%d", disknum);
 	mci->blk.blockbits = SECTOR_SHIFT;
 	mci->blk.num_blocks = mci_calc_blk_cnt(mci->capacity, mci->blk.blockbits);
 
@@ -1409,7 +1413,7 @@ static int mci_card_probe(struct mci *mci)
 		goto on_error;
 	}
 
-	dev_info(mci->mci_dev, "registered disk%d\n", disknum);
+	dev_info(mci->mci_dev, "registered %s\n", mci->blk.cdev.name);
 
 	/* create partitions on demand */
 	rc = parse_partition_table(&mci->blk);
diff --git a/include/mci.h b/include/mci.h
index db78b9c..0041e27 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -286,6 +286,7 @@ struct mci_ios {
 /** host information */
 struct mci_host {
 	struct device_d *hw_dev;	/**< the host MCI hardware device */
+	char *devname;			/**< the devicename for the card, defaults to disk%d */
 	unsigned voltages;
 	unsigned host_caps;	/**< Host's interface capabilities, refer MMC_VDD_* */
 	unsigned f_min;		/**< host interface lower limit */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-12-13 21:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13 21:49 [PATCH] Efika MX Smartbook support Sascha Hauer
2012-12-13 21:49 ` [PATCH 1/7] ata sff: set device pointer in ata port Sascha Hauer
2012-12-13 21:49 ` Sascha Hauer [this message]
2012-12-13 21:49 ` [PATCH 3/7] mci i.MX esdhc: Allow to specify devicename from platformdata Sascha Hauer
2012-12-13 21:49 ` [PATCH 4/7] mfd mc13893: Add register defines Sascha Hauer
2012-12-13 21:49 ` [PATCH 5/7] ARM i.MX51: Add support for the Efika MX Smartbook Sascha Hauer
2012-12-15  9:00   ` Sascha Hauer
2012-12-17 11:15   ` Peter Korsgaard
2012-12-19 20:26     ` Sascha Hauer
2012-12-13 21:49 ` [PATCH 6/7] ARM: Add defconfig for Efika MX smartbook Sascha Hauer
2012-12-13 21:49 ` [PATCH 7/7] USB ehci: Add powerup fixup for EfikaSB Sascha Hauer

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=1355435350-20348-3-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox