Message ID | l242pu$fog$1@ger.gmane.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Romain Izard <romain.izard.pro <at> gmail.com> writes: > > For internal use I have added a 'rescan' sysfs entry to the mmc > controller, instead of the sdio device itself. It is quite similar to > the way it is done in the scsi subsystem, and uses the same > 'mmc_detect_change' function as you do . > > Updated to use the new attribute groups syntax for 3.12, I obtain the > following patch - compile-tested only, nothing more, as I do not have a > 3.12 test system available. Hi Romain, Than you. This is exactly what I was looking for. My kernel version is 3.4.19 so I had back port your patch a little. At the and it is working OK. Regards, Bojan -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 49bc403..b5b0811 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -39,9 +39,26 @@ static void mmc_host_classdev_release(struct device *dev) kfree(host); } +static ssize_t rescan_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct mmc_host *host = cls_dev_to_mmc_host(dev); + mmc_detect_change(host, 0); + return count; +} + +static DEVICE_ATTR_WO(rescan); + +static struct attribute *mmc_host_attrs[] = { + &dev_attr_rescan.attr, + NULL, +}; +ATTRIBUTE_GROUPS(mmc_host); + static struct class mmc_host_class = { .name = "mmc_host", .dev_release = mmc_host_classdev_release, + .dev_groups = mmc_host_groups, }; int mmc_register_host_class(void)