X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmtd%2Fmaps%2Fphysmap.c;h=183255fcfdcbd288dc38e697b6a6ed8ff3be3321;hb=d18bb9a548e550f3ced57618e75085fb3f173133;hp=f00e04efbe2898db97673008c90f5faea20e1fa6;hpb=6e5565f949af1322f8f3d3f43d044645ae448499;p=linux-2.6 diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index f00e04efbe..183255fcfd 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -202,9 +202,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state int ret = 0; int i; - if (info) - for (i = 0; i < MAX_RESOURCES; i++) - ret |= info->mtd[i]->suspend(info->mtd[i]); + for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) + ret |= info->mtd[i]->suspend(info->mtd[i]); return ret; } @@ -214,9 +213,9 @@ static int physmap_flash_resume(struct platform_device *dev) struct physmap_flash_info *info = platform_get_drvdata(dev); int i; - if (info) - for (i = 0; i < MAX_RESOURCES; i++) - info->mtd[i]->resume(info->mtd[i]); + for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) + info->mtd[i]->resume(info->mtd[i]); + return 0; } @@ -225,8 +224,8 @@ static void physmap_flash_shutdown(struct platform_device *dev) struct physmap_flash_info *info = platform_get_drvdata(dev); int i; - for (i = 0; i < MAX_RESOURCES; i++) - if (info && info->mtd[i]->suspend(info->mtd[i]) == 0) + for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) + if (info->mtd[i]->suspend(info->mtd[i]) == 0) info->mtd[i]->resume(info->mtd[i]); } #else @@ -243,6 +242,7 @@ static struct platform_driver physmap_flash_driver = { .shutdown = physmap_flash_shutdown, .driver = { .name = "physmap-flash", + .owner = THIS_MODULE, }, }; @@ -320,3 +320,10 @@ module_exit(physmap_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("David Woodhouse "); MODULE_DESCRIPTION("Generic configurable MTD map driver"); + +/* legacy platform drivers can't hotplug or coldplg */ +#ifndef PHYSMAP_COMPAT +/* work with hotplug and coldplug */ +MODULE_ALIAS("platform:physmap-flash"); +#endif +