aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/pcmciamtd.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/mtd/maps/pcmciamtd.c
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/mtd/maps/pcmciamtd.c')
-rw-r--r--drivers/mtd/maps/pcmciamtd.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index 0026460be153..8259dca97e20 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -54,7 +54,7 @@ static const int debug = 0;
54#define MAX_PCMCIA_ADDR 0x4000000 54#define MAX_PCMCIA_ADDR 0x4000000
55 55
56struct pcmciamtd_dev { 56struct pcmciamtd_dev {
57 dev_link_t link; /* PCMCIA link */ 57 struct pcmcia_device *p_dev;
58 dev_node_t node; /* device node */ 58 dev_node_t node; /* device node */
59 caddr_t win_base; /* ioremapped address of PCMCIA window */ 59 caddr_t win_base; /* ioremapped address of PCMCIA window */
60 unsigned int win_size; /* size of window */ 60 unsigned int win_size; /* size of window */
@@ -111,8 +111,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
111 memreq_t mrq; 111 memreq_t mrq;
112 int ret; 112 int ret;
113 113
114 if(!(dev->link.state & DEV_PRESENT)) { 114 if(!(dev->p_dev->state & DEV_PRESENT)) {
115 DEBUG(1, "device removed state = 0x%4.4X", dev->link.state); 115 DEBUG(1, "device removed state = 0x%4.4X", dev->p_dev->state);
116 return 0; 116 return 0;
117 } 117 }
118 118
@@ -122,7 +122,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
122 dev->offset, mrq.CardOffset); 122 dev->offset, mrq.CardOffset);
123 mrq.Page = 0; 123 mrq.Page = 0;
124 if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { 124 if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) {
125 cs_error(dev->link.handle, MapMemPage, ret); 125 cs_error(dev->p_dev->handle, MapMemPage, ret);
126 return NULL; 126 return NULL;
127 } 127 }
128 dev->offset = mrq.CardOffset; 128 dev->offset = mrq.CardOffset;
@@ -319,7 +319,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f
319static void pcmciamtd_set_vpp(struct map_info *map, int on) 319static void pcmciamtd_set_vpp(struct map_info *map, int on)
320{ 320{
321 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 321 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
322 dev_link_t *link = &dev->link; 322 dev_link_t *link = dev->p_dev;
323 modconf_t mod; 323 modconf_t mod;
324 int ret; 324 int ret;
325 325
@@ -650,7 +650,7 @@ static void pcmciamtd_config(dev_link_t *link)
650 use the faster non-remapping read/write functions */ 650 use the faster non-remapping read/write functions */
651 if(mtd->size <= dev->win_size) { 651 if(mtd->size <= dev->win_size) {
652 DEBUG(1, "Using non remapping memory functions"); 652 DEBUG(1, "Using non remapping memory functions");
653 dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->link.state); 653 dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->p_dev->state);
654 dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; 654 dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base;
655 if (dev->pcmcia_map.bankwidth == 1) { 655 if (dev->pcmcia_map.bankwidth == 1) {
656 dev->pcmcia_map.read = pcmcia_read8; 656 dev->pcmcia_map.read = pcmcia_read8;
@@ -673,7 +673,7 @@ static void pcmciamtd_config(dev_link_t *link)
673 snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index); 673 snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
674 info("mtd%d: %s", mtd->index, mtd->name); 674 info("mtd%d: %s", mtd->index, mtd->name);
675 link->state &= ~DEV_CONFIG_PENDING; 675 link->state &= ~DEV_CONFIG_PENDING;
676 link->dev = &dev->node; 676 link->dev_node = &dev->node;
677 return; 677 return;
678 678
679 cs_failed: 679 cs_failed:
@@ -735,7 +735,7 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev)
735static int pcmciamtd_attach(struct pcmcia_device *p_dev) 735static int pcmciamtd_attach(struct pcmcia_device *p_dev)
736{ 736{
737 struct pcmciamtd_dev *dev; 737 struct pcmciamtd_dev *dev;
738 dev_link_t *link; 738 dev_link_t *link = dev_to_instance(p_dev);
739 739
740 /* Create new memory card device */ 740 /* Create new memory card device */
741 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 741 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
@@ -743,16 +743,12 @@ static int pcmciamtd_attach(struct pcmcia_device *p_dev)
743 DEBUG(1, "dev=0x%p", dev); 743 DEBUG(1, "dev=0x%p", dev);
744 744
745 memset(dev, 0, sizeof(*dev)); 745 memset(dev, 0, sizeof(*dev));
746 link = &dev->link; 746 dev->p_dev = p_dev;
747 link->priv = dev; 747 link->priv = dev;
748 748
749 link->conf.Attributes = 0; 749 link->conf.Attributes = 0;
750 link->conf.IntType = INT_MEMORY; 750 link->conf.IntType = INT_MEMORY;
751 751
752 link->next = NULL;
753 link->handle = p_dev;
754 p_dev->instance = link;
755
756 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 752 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
757 pcmciamtd_config(link); 753 pcmciamtd_config(link);
758 754