X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fmtd%2Fmtdcore.c;h=dade02ab0687aeee729a3e1c80339b5e27fbdf87;hb=e82b3aec8d508d2a925a4c766e97f16b7c4dfb1b;hp=dc86df18e94b72768ce0d7beaaf06e629c9217a0;hpb=6cd59f7a4119fef124677827a9b30684c2c8e674;p=powerpc.git diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index dc86df18e9..dade02ab06 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1,5 +1,5 @@ /* - * $Id: mtdcore.c,v 1.45 2005/02/18 14:34:50 dedekind Exp $ + * $Id: mtdcore.c,v 1.47 2005/11/07 11:14:20 gleixner Exp $ * * Core registration and callback routines for MTD * drivers and users. @@ -25,7 +25,7 @@ #include -/* These are exported solely for the purpose of mtd_blkdevs.c. You +/* These are exported solely for the purpose of mtd_blkdevs.c. You should not use them for _anything_ else */ DECLARE_MUTEX(mtd_table_mutex); struct mtd_info *mtd_table[MAX_MTD_DEVICES]; @@ -66,7 +66,7 @@ int add_mtd_device(struct mtd_info *mtd) struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list); not->add(mtd); } - + up(&mtd_table_mutex); /* We _know_ we aren't being removed, because our caller is still holding us here. So none @@ -75,7 +75,7 @@ int add_mtd_device(struct mtd_info *mtd) __module_get(THIS_MODULE); return 0; } - + up(&mtd_table_mutex); return 1; } @@ -93,13 +93,13 @@ int add_mtd_device(struct mtd_info *mtd) int del_mtd_device (struct mtd_info *mtd) { int ret; - + down(&mtd_table_mutex); if (mtd_table[mtd->index] != mtd) { ret = -ENODEV; } else if (mtd->usecount) { - printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n", + printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n", mtd->index, mtd->name, mtd->usecount); ret = -EBUSY; } else { @@ -140,7 +140,7 @@ void register_mtd_user (struct mtd_notifier *new) list_add(&new->list, &mtd_notifiers); __module_get(THIS_MODULE); - + for (i=0; i< MAX_MTD_DEVICES; i++) if (mtd_table[i]) new->add(mtd_table[i]); @@ -169,7 +169,7 @@ int unregister_mtd_user (struct mtd_notifier *old) for (i=0; i< MAX_MTD_DEVICES; i++) if (mtd_table[i]) old->remove(mtd_table[i]); - + list_del(&old->list); up(&mtd_table_mutex); return 0; @@ -187,7 +187,7 @@ int unregister_mtd_user (struct mtd_notifier *old) * both, return the num'th driver only if its address matches. Return NULL * if not. */ - + struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num) { struct mtd_info *ret = NULL; @@ -296,39 +296,6 @@ EXPORT_SYMBOL(unregister_mtd_user); EXPORT_SYMBOL(default_mtd_writev); EXPORT_SYMBOL(default_mtd_readv); -/*====================================================================*/ -/* Power management code */ - -#ifdef CONFIG_PM - -#include - -static struct pm_dev *mtd_pm_dev = NULL; - -static int mtd_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data) -{ - int ret = 0, i; - - if (down_trylock(&mtd_table_mutex)) - return -EAGAIN; - if (rqst == PM_SUSPEND) { - for (i = 0; ret == 0 && i < MAX_MTD_DEVICES; i++) { - if (mtd_table[i] && mtd_table[i]->suspend) - ret = mtd_table[i]->suspend(mtd_table[i]); - } - } else i = MAX_MTD_DEVICES-1; - - if (rqst == PM_RESUME || ret) { - for ( ; i >= 0; i--) { - if (mtd_table[i] && mtd_table[i]->resume) - mtd_table[i]->resume(mtd_table[i]); - } - } - up(&mtd_table_mutex); - return ret; -} -#endif - /*====================================================================*/ /* Support for /proc/mtd */ @@ -388,22 +355,11 @@ static int __init init_mtd(void) if ((proc_mtd = create_proc_entry( "mtd", 0, NULL ))) proc_mtd->read_proc = mtd_read_proc; #endif - -#ifdef CONFIG_PM - mtd_pm_dev = pm_register(PM_UNKNOWN_DEV, 0, mtd_pm_callback); -#endif return 0; } static void __exit cleanup_mtd(void) { -#ifdef CONFIG_PM - if (mtd_pm_dev) { - pm_unregister(mtd_pm_dev); - mtd_pm_dev = NULL; - } -#endif - #ifdef CONFIG_PROC_FS if (proc_mtd) remove_proc_entry( "mtd", NULL);