aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:23:14 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:10 -0500
commitcc3b4866bee996c922e875b8c8efe9f0d8803aae (patch)
tree6632837b6986f33566f75ed971cecbdc210e3201 /drivers/mtd
parent8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (diff)
[PATCH] pcmcia: unify detach, REMOVAL_EVENT handlers into one remove callback
Unify the "detach" and REMOVAL_EVENT handlers to one "remove" function. Old functionality is preserved, for the moment. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/maps/pcmciamtd.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index 86443cf44dc6..3ddcb1bf6824 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -722,18 +722,6 @@ static int pcmciamtd_event(event_t event, int priority,
722 722
723 DEBUG(1, "event=0x%06x", event); 723 DEBUG(1, "event=0x%06x", event);
724 switch (event) { 724 switch (event) {
725 case CS_EVENT_CARD_REMOVAL:
726 DEBUG(2, "EVENT_CARD_REMOVAL");
727 link->state &= ~DEV_PRESENT;
728 if (link->state & DEV_CONFIG) {
729 struct pcmciamtd_dev *dev = link->priv;
730 if(dev->mtd_info) {
731 del_mtd_device(dev->mtd_info);
732 info("mtd%d: Removed", dev->mtd_info->index);
733 }
734 pcmciamtd_release(link);
735 }
736 break;
737 case CS_EVENT_CARD_INSERTION: 725 case CS_EVENT_CARD_INSERTION:
738 DEBUG(2, "EVENT_CARD_INSERTION"); 726 DEBUG(2, "EVENT_CARD_INSERTION");
739 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 727 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
@@ -752,23 +740,21 @@ static int pcmciamtd_event(event_t event, int priority,
752 * when the device is released. 740 * when the device is released.
753 */ 741 */
754 742
755static void pcmciamtd_detach(dev_link_t *link) 743static void pcmciamtd_detach(struct pcmcia_device *p_dev)
756{ 744{
745 dev_link_t *link = dev_to_instance(p_dev);
746
757 DEBUG(3, "link=0x%p", link); 747 DEBUG(3, "link=0x%p", link);
758 748
759 if(link->state & DEV_CONFIG) { 749 if(link->state & DEV_CONFIG) {
760 pcmciamtd_release(link); 750 struct pcmciamtd_dev *dev = link->priv;
761 } 751 if(dev->mtd_info) {
752 del_mtd_device(dev->mtd_info);
753 info("mtd%d: Removed", dev->mtd_info->index);
754 }
762 755
763 if (link->handle) { 756 pcmciamtd_release(link);
764 int ret;
765 DEBUG(2, "Deregistering with card services");
766 ret = pcmcia_deregister_client(link->handle);
767 if (ret != CS_SUCCESS)
768 cs_error(link->handle, DeregisterClient, ret);
769 } 757 }
770
771 link->state |= DEV_STALE_LINK;
772} 758}
773 759
774 760
@@ -807,7 +793,7 @@ static dev_link_t *pcmciamtd_attach(void)
807 ret = pcmcia_register_client(&link->handle, &client_reg); 793 ret = pcmcia_register_client(&link->handle, &client_reg);
808 if (ret != 0) { 794 if (ret != 0) {
809 cs_error(link->handle, RegisterClient, ret); 795 cs_error(link->handle, RegisterClient, ret);
810 pcmciamtd_detach(link); 796 pcmciamtd_detach(link->handle);
811 return NULL; 797 return NULL;
812 } 798 }
813 DEBUG(2, "link = %p", link); 799 DEBUG(2, "link = %p", link);
@@ -847,7 +833,7 @@ static struct pcmcia_driver pcmciamtd_driver = {
847 }, 833 },
848 .attach = pcmciamtd_attach, 834 .attach = pcmciamtd_attach,
849 .event = pcmciamtd_event, 835 .event = pcmciamtd_event,
850 .detach = pcmciamtd_detach, 836 .remove = pcmciamtd_detach,
851 .owner = THIS_MODULE, 837 .owner = THIS_MODULE,
852 .id_table = pcmciamtd_ids, 838 .id_table = pcmciamtd_ids,
853 .suspend = pcmciamtd_suspend, 839 .suspend = pcmciamtd_suspend,