mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Kay Sievers <kay.sievers@vrfy.org>, Pierre Ossman <drzeus-mmc@drzeus.cx>
Cc: linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 1/1] mmc: add MODALIAS linkage for MMC/SD devices
Date: Tue, 27 Jan 2009 12:12:05 +0000	[thread overview]
Message-ID: <1233058325-12719-1-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <20090126093549.GC17399@shadowen.org>

[Here is an updated patch which only uses information already exported in
the ABI.]

Currently we are using an explicit udev rule to trigger loading of the
mmc-block module when an MMC or SD card is detected:

    SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -Qba mmc-block"

It makes much more sense for the mmc bus driver and the mmc-block module to
share MODALIAS information so that they are linked automatically.

Add MODALIAS attributes to the uevents as generated, and add the
corresponding MODULE_ALIAS marks to the mmc-block module so that it is
automatically loaded by udev.  Following discussion it was decided to
expose the textual types, and so I have followed the example set by
the dmi: aliases for handling text.  The aliases are of the following
form:

    mmc:t<type>:

For example:

    mmc:tMMC:

The entry ends with a separator (:) in order to allow simple differentiation
between common prefixes such as SD and SDIO in MODULE_ALIAS declarations.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 drivers/mmc/card/block.c |    3 +++
 drivers/mmc/core/bus.c   |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 3d067c3..9799273 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -41,6 +41,9 @@
 
 #include "queue.h"
 
+MODULE_ALIAS("mmc:tMMC:*");
+MODULE_ALIAS("mmc:tSD:*");
+
 /*
  * max 8 partitions per card
  */
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index f210a8e..7b34c00 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -84,6 +84,11 @@ mmc_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 	}
 
 	retval = add_uevent_var(env, "MMC_NAME=%s", mmc_card_name(card));
+	if (retval)
+		return retval;
+
+	retval = add_uevent_var(env, "MODALIAS=mmc:t%s:",
+						(type) ? type : "UNKNOWN");
 
 	return retval;
 }
-- 
1.6.1.258.g7ff14.dirty


  reply	other threads:[~2009-01-27 12:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-06 18:56 Andy Whitcroft
2009-01-12 15:05 ` Pierre Ossman
2009-01-15 15:00   ` Andy Whitcroft
2009-01-24 17:56     ` Pierre Ossman
2009-01-24 23:45       ` Kay Sievers
2009-01-25 15:48         ` Pierre Ossman
2009-01-25 16:00           ` Kay Sievers
2009-01-26  9:35             ` Andy Whitcroft
2009-01-27 12:12               ` Andy Whitcroft [this message]
2009-01-27 19:14             ` Pierre Ossman
2009-01-27 19:26               ` Kay Sievers
2009-01-28 15:06                 ` Andy Whitcroft
2009-01-28 19:58                   ` Pierre Ossman
     [not found] <20090218205654.05896ece@mjolnir.ossman.eu>
2009-02-23 12:38 ` Andy Whitcroft
2009-03-02 21:10   ` Pierre Ossman

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=1233058325-12719-1-git-send-email-apw@canonical.com \
    --to=apw@canonical.com \
    --cc=drzeus-mmc@drzeus.cx \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®