Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: r852: remove useless pci powerup/down from suspend/resume routines

It turns out that pci core now handles these, so this code is redundant
and can even cause bugs

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Maxim Levitsky and committed by
David Woodhouse
9bf70717 12aebf3e

+1 -31
+1 -29
drivers/mtd/nand/r852.c
··· 757 757 758 758 spin_lock_irqsave(&dev->irqlock, flags); 759 759 760 - /* We can recieve shared interrupt while pci is suspended 761 - in that case reads will return 0xFFFFFFFF.... */ 762 - if (dev->insuspend) 763 - goto out; 764 - 765 760 /* handle card detection interrupts first */ 766 761 card_status = r852_read_reg(dev, R852_CARD_IRQ_STA); 767 762 r852_write_reg(dev, R852_CARD_IRQ_STA, card_status); ··· 1030 1035 int r852_suspend(struct device *device) 1031 1036 { 1032 1037 struct r852_device *dev = pci_get_drvdata(to_pci_dev(device)); 1033 - unsigned long flags; 1034 1038 1035 1039 if (dev->ctlreg & R852_CTL_CARDENABLE) 1036 1040 return -EBUSY; ··· 1041 1047 r852_disable_irqs(dev); 1042 1048 r852_engine_disable(dev); 1043 1049 1044 - spin_lock_irqsave(&dev->irqlock, flags); 1045 - dev->insuspend = 1; 1046 - spin_unlock_irqrestore(&dev->irqlock, flags); 1047 - 1048 - /* At that point, even if interrupt handler is running, it will quit */ 1049 - /* So wait for this to happen explictly */ 1050 - synchronize_irq(dev->irq); 1051 - 1052 1050 /* If card was pulled off just during the suspend, which is very 1053 1051 unlikely, we will remove it on resume, it too late now 1054 1052 anyway... */ 1055 1053 dev->card_unstable = 0; 1056 - 1057 - pci_save_state(to_pci_dev(device)); 1058 - return pci_prepare_to_sleep(to_pci_dev(device)); 1054 + return 0; 1059 1055 } 1060 1056 1061 1057 int r852_resume(struct device *device) 1062 1058 { 1063 1059 struct r852_device *dev = pci_get_drvdata(to_pci_dev(device)); 1064 - unsigned long flags; 1065 - 1066 - /* Turn on the hardware */ 1067 - pci_back_from_sleep(to_pci_dev(device)); 1068 - pci_restore_state(to_pci_dev(device)); 1069 1060 1070 1061 r852_disable_irqs(dev); 1071 1062 r852_card_update_present(dev); 1072 1063 r852_engine_disable(dev); 1073 - 1074 - 1075 - /* Now its safe for IRQ to run */ 1076 - spin_lock_irqsave(&dev->irqlock, flags); 1077 - dev->insuspend = 0; 1078 - spin_unlock_irqrestore(&dev->irqlock, flags); 1079 1064 1080 1065 1081 1066 /* If card status changed, just do the work */ ··· 1093 1120 MODULE_DEVICE_TABLE(pci, r852_pci_id_tbl); 1094 1121 1095 1122 SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume); 1096 - 1097 1123 1098 1124 static struct pci_driver r852_pci_driver = { 1099 1125 .name = DRV_NAME,
-2
drivers/mtd/nand/r852.h
··· 140 140 /* interrupt handling */ 141 141 spinlock_t irqlock; /* IRQ protecting lock */ 142 142 int irq; /* irq num */ 143 - int insuspend; /* device is suspended */ 144 - 145 143 /* misc */ 146 144 void *tmp_buffer; /* temporary buffer */ 147 145 uint8_t ctlreg; /* cached contents of control reg */