mmc: use sysfs groups to handle conditional attributes

Suppressing uevents turned out to be a bad idea as it screws up the
order of events, making user space very confused. Change the system to
use sysfs groups instead.

This is a regression that, for some odd reason, has gone unnoticed for
some time. It confuses hal so that the block devices (which have the
mmc device as a parent) are not registered. End result being that
desktop magic when cards are inserted won't work.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index b0c22ca..fd95b18 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -17,7 +17,6 @@
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
 
-#include "sysfs.h"
 #include "core.h"
 #include "sdio_cis.h"
 #include "bus.h"
@@ -43,7 +42,7 @@
 }
 
 static struct device_attribute mmc_dev_attrs[] = {
-	MMC_ATTR_RO(type),
+	__ATTR(type, S_IRUGO, mmc_type_show, NULL),
 	__ATTR_NULL,
 };
 
@@ -189,7 +188,7 @@
 /*
  * Allocate and initialise a new MMC card structure.
  */
-struct mmc_card *mmc_alloc_card(struct mmc_host *host)
+struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type)
 {
 	struct mmc_card *card;
 
@@ -204,6 +203,7 @@
 	card->dev.parent = mmc_classdev(host);
 	card->dev.bus = &mmc_bus_type;
 	card->dev.release = mmc_release_card;
+	card->dev.type = type;
 
 	return card;
 }
@@ -248,24 +248,10 @@
 			type, card->rca);
 	}
 
-	card->dev.uevent_suppress = 1;
-
 	ret = device_add(&card->dev);
 	if (ret)
 		return ret;
 
-	if (card->host->bus_ops->sysfs_add) {
-		ret = card->host->bus_ops->sysfs_add(card->host, card);
-		if (ret) {
-			device_del(&card->dev);
-			return ret;
-		 }
-	}
-
-	card->dev.uevent_suppress = 0;
-
-	kobject_uevent(&card->dev.kobj, KOBJ_ADD);
-
 	mmc_card_set_present(card);
 
 	return 0;
@@ -285,9 +271,6 @@
 			printk(KERN_INFO "%s: card %04x removed\n",
 				mmc_hostname(card->host), card->rca);
 		}
-
-		if (card->host->bus_ops->sysfs_remove)
-			card->host->bus_ops->sysfs_remove(card->host, card);
 		device_del(&card->dev);
 	}